@brainfish-ai/components 0.30.7 → 0.30.8

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.
@@ -206,7 +206,7 @@ export declare type FileAttachment = {
206
206
  name: string;
207
207
  mimeType: string;
208
208
  url?: string;
209
- storageKey?: string;
209
+ attachmentId?: string;
210
210
  };
211
211
  };
212
212
 
@@ -214,7 +214,7 @@ export declare type FileAttachmentBlock = {
214
214
  type: 'file';
215
215
  fileName: string;
216
216
  mimeType: string;
217
- storageKey: string;
217
+ attachmentId: string;
218
218
  url?: string;
219
219
  };
220
220
 
@@ -1,19 +1,19 @@
1
- import e,{useRef as t,useLayoutEffect as n,useMemo as r,useContext as o,createContext as i,useCallback as s,useEffect as a,useState as l,Suspense as c,forwardRef as u,Component as d,createElement as f,useImperativeHandle as m}from"react";import{Tooltip as p,TooltipTrigger as g,TooltipContent as h,TooltipProvider as y}from"../components/ui/tooltip.js";import{c as v}from"./utils.C6Qu-kwd.js";import{ScrollArea as x}from"../components/ui/scroll-area.js";import{Copy as E,Browser as b,FileText as w,Folder as N,ChatsTeardrop as S,File as C,FileDoc as k,FilePdf as D,Video as R,Image as _,CircleNotch as O,X as T,Files as A,Plus as M,CaretRight as P,Stop as I,ArrowUp as F}from"@phosphor-icons/react";import{F as L}from"./FormattedMessage.D_knqVl-.js";import{C as j}from"./ConversationStatus.BhdnM1uS.js";import*as K from"@radix-ui/react-dialog";import{DropdownMenu as z,DropdownMenuTrigger as B,DropdownMenuContent as $,DropdownMenuItem as U}from"../components/ui/dropdown-menu.js";import{Popover as W,PopoverTrigger as J,PopoverContent as V}from"../components/ui/popover.js";import{Command as H,CommandInput as q,CommandList as G,CommandEmpty as Y,CommandGroup as Z,CommandItem as X}from"../components/ui/command.js";import{createEditor as Q,$getRoot as ee,$createParagraphNode as te,$getSelection as ne,HISTORY_MERGE_TAG as re,$caretFromPoint as oe,$isExtendableTextPointCaret as ie,$extendCaretToRange as se,$isChildCaret as ae,$isElementNode as le,$isDecoratorNode as ce,$isRootNode as ue,$getEditor as de,$isTokenOrSegmented as fe,$getCharacterOffsets as me,$cloneWithPropertiesEphemeral as pe,$isRangeSelection as ge,$findMatchingParent as he,mergeRegister as ye,DecoratorNode as ve,addClassNamesToElement as xe,shallowMergeConfig as Ee,$create as be,defineExtension as we,safeCast as Ne,createState as Se,FORMAT_TEXT_COMMAND as Ce,$isNodeSelection as ke,COMMAND_PRIORITY_LOW as De,RootNode as Re,TextNode as _e,LineBreakNode as Oe,TabNode as Te,ParagraphNode as Ae,$isEditorState as Me,createCommand as Pe,CLICK_COMMAND as Ie,isDOMNode as Fe,$getNodeFromDOMNode as Le,$createNodeSelection as je,$setSelection as Ke,$getState as ze,toggleTextFormatType as Be,TEXT_TYPE_TO_FORMAT as $e,$setState as Ue,$getNodeByKey as We,removeClassNamesFromElement as Je,CLEAR_EDITOR_COMMAND as Ve,COMMAND_PRIORITY_EDITOR as He,KEY_TAB_COMMAND as qe,$isBlockElementNode as Ge,$createRangeSelection as Ye,$normalizeSelection__EXPERIMENTAL as Ze,OUTDENT_CONTENT_COMMAND as Xe,INDENT_CONTENT_COMMAND as Qe,INSERT_TAB_COMMAND as et,COMMAND_PRIORITY_CRITICAL as tt,$isParagraphNode as nt,$isTextNode as rt,isDOMDocumentNode as ot,ArtificialNode__DO_NOT_USE as it,$createLineBreakNode as st,$isRootOrShadowRoot as at,isBlockDomNode as lt,isInlineDomNode as ct,getRegisteredNode as ut,isHTMLElement as dt,isDocumentFragment as ft,$createTabNode as mt,getDOMSelection as pt,COPY_COMMAND as gt,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND as ht,$isTextPointCaret as yt,$getCaretRange as vt,$getChildCaret as xt,$parseSerializedNode as Et,isSelectionWithinEditor as bt,DELETE_CHARACTER_COMMAND as wt,DELETE_WORD_COMMAND as Nt,DELETE_LINE_COMMAND as St,CONTROLLED_TEXT_INSERTION_COMMAND as Ct,REMOVE_TEXT_COMMAND as kt,FORMAT_ELEMENT_COMMAND as Dt,INSERT_LINE_BREAK_COMMAND as Rt,INSERT_PARAGRAPH_COMMAND as _t,$insertNodes as Ot,KEY_ARROW_UP_COMMAND as Tt,$getAdjacentNode as At,KEY_ARROW_DOWN_COMMAND as Mt,KEY_ARROW_LEFT_COMMAND as Pt,KEY_ARROW_RIGHT_COMMAND as It,KEY_BACKSPACE_COMMAND as Ft,KEY_DELETE_COMMAND as Lt,KEY_ENTER_COMMAND as jt,KEY_ESCAPE_COMMAND as Kt,DROP_COMMAND as zt,$getNearestNodeFromDOMNode as Bt,DRAGSTART_COMMAND as $t,DRAGOVER_COMMAND as Ut,SELECT_ALL_COMMAND as Wt,$selectAll as Jt,CUT_COMMAND as Vt,PASTE_COMMAND as Ht,isSelectionCapturedInDecoratorInput as qt,PASTE_TAG as Gt,KEY_SPACE_COMMAND as Yt,ElementNode as Zt,setNodeIndentFromDOM as Xt,$applyNodeReplacement as Qt,COMMAND_PRIORITY_HIGH as en}from"lexical";import{jsx as tn,jsxs as nn,Fragment as rn}from"react/jsx-runtime";import{flushSync as on,createPortal as sn}from"react-dom";import{createEmptyHistoryState as an,registerHistory as ln}from"@lexical/history";import{ListNode as cn,ListItemNode as un,registerList as dn,registerListStrictIndentTransform as fn,$isListItemNode as mn}from"@lexical/list";import{LinkNode as pn,registerLink as gn,AutoLinkNode as hn}from"@lexical/link";import{registerMarkdownShortcuts as yn,TRANSFORMERS as vn,ORDERED_LIST as xn,UNORDERED_LIST as En,LINK as bn,INLINE_CODE as wn,CODE as Nn,$convertToMarkdownString as Sn,$convertFromMarkdownString as Cn}from"@lexical/markdown";import{CodeNode as kn,CodeHighlightNode as Dn,$isCodeNode as Rn}from"@lexical/code";import{L as _n}from"./logo.DtwFGMBj.js";const On=i(null),Tn={onCopy:(e,t)=>{navigator.clipboard.writeText(t)}};function An(){const e=o(On);if(!e)throw new Error("useConversation must be used within a <Conversation> provider");return e}function Mn({messages:o,callbacks:i,children:s}){const a=o.some(e=>"streaming"===e.status),l=t({...Tn,...i});n(()=>{l.current={...Tn,...i}});const c=r(()=>({onSend:(...e)=>l.current.onSend?.(...e),onStop:(...e)=>l.current.onStop?.(...e),onSuggestionClick:(...e)=>l.current.onSuggestionClick?.(...e),onActionClick:(...e)=>l.current.onActionClick?.(...e),onCitationClick:(...e)=>l.current.onCitationClick?.(...e),onAttachmentAdd:(...e)=>l.current.onAttachmentAdd?.(...e),onAttachmentRemove:(...e)=>l.current.onAttachmentRemove?.(...e),onCopy:(...e)=>l.current.onCopy?.(...e)}),[]),u=r(()=>({messages:o,callbacks:c,isStreaming:a}),[o,c,a]);/* @__PURE__ */
2
- return e.createElement(On.Provider,{value:u},s)}const Pn=({block:t,isStreaming:n})=>/* @__PURE__ */e.createElement(L,{message:{content:t.text},isStreaming:n}),In=({citations:t,onCitationClick:n})=>/* @__PURE__ */e.createElement("span",{className:"inline-flex flex-wrap gap-1"},t.map(t=>/* @__PURE__ */e.createElement(Fn,{key:t.id,citation:t,onClick:n}))),Fn=({citation:t,onClick:n})=>/* @__PURE__ */e.createElement(p,null,/* @__PURE__ */e.createElement(g,{asChild:!0},/* @__PURE__ */e.createElement("button",{type:"button",className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-primary/10 text-xs font-medium text-primary hover:bg-primary/20 transition-colors",onClick:()=>n?.(t)},t.index)),/* @__PURE__ */e.createElement(h,{side:"top",className:"max-w-xs"},/* @__PURE__ */e.createElement("p",{className:"text-sm font-medium"},t.title),/* @__PURE__ */e.createElement("p",{className:"text-xs text-muted-foreground truncate"},t.url))),Ln=({block:t,isStreaming:n,onCitationClick:r})=>"text"===t.type?/* @__PURE__ */e.createElement(e.Fragment,null,/* @__PURE__ */e.createElement(Pn,{block:t,isStreaming:n}),t.citations&&t.citations.length>0&&/* @__PURE__ */e.createElement(In,{citations:t.citations,onCitationClick:r})):null,jn=({message:t,className:n})=>{const{callbacks:r}=An(),o="streaming"===t.status,i="pending"===t.status,a="completed"===t.status,l=s(()=>{const e=t.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n");r.onCopy?.(t.id,e)},[t,r]),c=t.content.some(e=>"text"===e.type&&e.text.length>0),u="error"===t.status;return i&&0===t.content.length||o&&!c?/* @__PURE__ */e.createElement(j,{className:n}):/* @__PURE__ */e.createElement("div",{className:v("flex gap-3 p-4 bg-surface rounded",n)},/* @__PURE__ */e.createElement("div",{className:"flex-1 min-w-0"},/* @__PURE__ */e.createElement("div",{className:"space-y-1"},u?/* @__PURE__ */e.createElement(Ln,{block:{type:"text",text:"Sorry, something went wrong. Please try again."}}):t.content.map((t,n)=>/* @__PURE__ */e.createElement(Ln,{key:n,block:t,isStreaming:o,onCitationClick:r.onCitationClick}))),a&&/* @__PURE__ */e.createElement("div",{className:"mt-3 flex items-center gap-1"},/* @__PURE__ */e.createElement(Kn,{tooltip:"Copy",onClick:l},/* @__PURE__ */e.createElement(E,{className:"h-4 w-4"})))))},Kn=({children:t,tooltip:n,active:r,onClick:o})=>/* @__PURE__ */e.createElement(p,null,/* @__PURE__ */e.createElement(g,{asChild:!0},/* @__PURE__ */e.createElement("button",{type:"button",className:v("inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",r&&"text-primary"),onClick:o},t)),/* @__PURE__ */e.createElement(h,{side:"bottom"},/* @__PURE__ */e.createElement("p",{className:"text-xs"},n))),zn={image:_,video:R,pdf:D,doc:k,file:C,channel:S,collection:N,article:w,page:b},Bn=({pill:t,onRemove:n})=>{const r=t.iconType?zn[t.iconType]:null,o=t.loading?t.progress??0:100;/* @__PURE__ */
1
+ import e,{useRef as t,useLayoutEffect as n,useMemo as r,useContext as o,createContext as i,useCallback as s,useEffect as a,useState as l,Suspense as c,forwardRef as d,Component as u,createElement as f,useImperativeHandle as m}from"react";import{Tooltip as p,TooltipTrigger as g,TooltipContent as h,TooltipProvider as y}from"../components/ui/tooltip.js";import{c as v}from"./utils.C6Qu-kwd.js";import{ScrollArea as x}from"../components/ui/scroll-area.js";import{Copy as E,Browser as b,FileText as w,Folder as N,ChatsTeardrop as S,File as C,FileDoc as k,FilePdf as D,Video as R,Image as _,CircleNotch as O,X as T,Files as A,Plus as M,CaretRight as P,Stop as I,ArrowUp as F}from"@phosphor-icons/react";import{F as L}from"./FormattedMessage.D_knqVl-.js";import{C as j}from"./ConversationStatus.BhdnM1uS.js";import*as K from"@radix-ui/react-dialog";import{DropdownMenu as z,DropdownMenuTrigger as B,DropdownMenuContent as $,DropdownMenuItem as U}from"../components/ui/dropdown-menu.js";import{Popover as W,PopoverTrigger as J,PopoverContent as V}from"../components/ui/popover.js";import{Command as H,CommandInput as q,CommandList as G,CommandEmpty as Y,CommandGroup as Z,CommandItem as X}from"../components/ui/command.js";import{createEditor as Q,$getRoot as ee,$createParagraphNode as te,$getSelection as ne,HISTORY_MERGE_TAG as re,$caretFromPoint as oe,$isExtendableTextPointCaret as ie,$extendCaretToRange as se,$isChildCaret as ae,$isElementNode as le,$isDecoratorNode as ce,$isRootNode as de,$getEditor as ue,$isTokenOrSegmented as fe,$getCharacterOffsets as me,$cloneWithPropertiesEphemeral as pe,$isRangeSelection as ge,$findMatchingParent as he,mergeRegister as ye,DecoratorNode as ve,addClassNamesToElement as xe,shallowMergeConfig as Ee,$create as be,defineExtension as we,safeCast as Ne,createState as Se,FORMAT_TEXT_COMMAND as Ce,$isNodeSelection as ke,COMMAND_PRIORITY_LOW as De,RootNode as Re,TextNode as _e,LineBreakNode as Oe,TabNode as Te,ParagraphNode as Ae,$isEditorState as Me,createCommand as Pe,CLICK_COMMAND as Ie,isDOMNode as Fe,$getNodeFromDOMNode as Le,$createNodeSelection as je,$setSelection as Ke,$getState as ze,toggleTextFormatType as Be,TEXT_TYPE_TO_FORMAT as $e,$setState as Ue,$getNodeByKey as We,removeClassNamesFromElement as Je,CLEAR_EDITOR_COMMAND as Ve,COMMAND_PRIORITY_EDITOR as He,KEY_TAB_COMMAND as qe,$isBlockElementNode as Ge,$createRangeSelection as Ye,$normalizeSelection__EXPERIMENTAL as Ze,OUTDENT_CONTENT_COMMAND as Xe,INDENT_CONTENT_COMMAND as Qe,INSERT_TAB_COMMAND as et,COMMAND_PRIORITY_CRITICAL as tt,$isParagraphNode as nt,$isTextNode as rt,isDOMDocumentNode as ot,ArtificialNode__DO_NOT_USE as it,$createLineBreakNode as st,$isRootOrShadowRoot as at,isBlockDomNode as lt,isInlineDomNode as ct,getRegisteredNode as dt,isHTMLElement as ut,isDocumentFragment as ft,$createTabNode as mt,getDOMSelection as pt,COPY_COMMAND as gt,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND as ht,$isTextPointCaret as yt,$getCaretRange as vt,$getChildCaret as xt,$parseSerializedNode as Et,isSelectionWithinEditor as bt,DELETE_CHARACTER_COMMAND as wt,DELETE_WORD_COMMAND as Nt,DELETE_LINE_COMMAND as St,CONTROLLED_TEXT_INSERTION_COMMAND as Ct,REMOVE_TEXT_COMMAND as kt,FORMAT_ELEMENT_COMMAND as Dt,INSERT_LINE_BREAK_COMMAND as Rt,INSERT_PARAGRAPH_COMMAND as _t,$insertNodes as Ot,KEY_ARROW_UP_COMMAND as Tt,$getAdjacentNode as At,KEY_ARROW_DOWN_COMMAND as Mt,KEY_ARROW_LEFT_COMMAND as Pt,KEY_ARROW_RIGHT_COMMAND as It,KEY_BACKSPACE_COMMAND as Ft,KEY_DELETE_COMMAND as Lt,KEY_ENTER_COMMAND as jt,KEY_ESCAPE_COMMAND as Kt,DROP_COMMAND as zt,$getNearestNodeFromDOMNode as Bt,DRAGSTART_COMMAND as $t,DRAGOVER_COMMAND as Ut,SELECT_ALL_COMMAND as Wt,$selectAll as Jt,CUT_COMMAND as Vt,PASTE_COMMAND as Ht,isSelectionCapturedInDecoratorInput as qt,PASTE_TAG as Gt,KEY_SPACE_COMMAND as Yt,ElementNode as Zt,setNodeIndentFromDOM as Xt,$applyNodeReplacement as Qt,COMMAND_PRIORITY_HIGH as en}from"lexical";import{jsx as tn,jsxs as nn,Fragment as rn}from"react/jsx-runtime";import{flushSync as on,createPortal as sn}from"react-dom";import{createEmptyHistoryState as an,registerHistory as ln}from"@lexical/history";import{ListNode as cn,ListItemNode as dn,registerList as un,registerListStrictIndentTransform as fn,$isListItemNode as mn}from"@lexical/list";import{LinkNode as pn,registerLink as gn,AutoLinkNode as hn}from"@lexical/link";import{registerMarkdownShortcuts as yn,TRANSFORMERS as vn,ORDERED_LIST as xn,UNORDERED_LIST as En,LINK as bn,INLINE_CODE as wn,CODE as Nn,$convertToMarkdownString as Sn,$convertFromMarkdownString as Cn}from"@lexical/markdown";import{CodeNode as kn,CodeHighlightNode as Dn,$isCodeNode as Rn}from"@lexical/code";import{L as _n}from"./logo.DtwFGMBj.js";const On=i(null),Tn={onCopy:(e,t)=>{navigator.clipboard.writeText(t)}};function An(){const e=o(On);if(!e)throw new Error("useConversation must be used within a <Conversation> provider");return e}function Mn({messages:o,callbacks:i,children:s}){const a=o.some(e=>"streaming"===e.status),l=t({...Tn,...i});n(()=>{l.current={...Tn,...i}});const c=r(()=>({onSend:(...e)=>l.current.onSend?.(...e),onStop:(...e)=>l.current.onStop?.(...e),onSuggestionClick:(...e)=>l.current.onSuggestionClick?.(...e),onActionClick:(...e)=>l.current.onActionClick?.(...e),onCitationClick:(...e)=>l.current.onCitationClick?.(...e),onAttachmentAdd:(...e)=>l.current.onAttachmentAdd?.(...e),onAttachmentRemove:(...e)=>l.current.onAttachmentRemove?.(...e),onCopy:(...e)=>l.current.onCopy?.(...e)}),[]),d=r(()=>({messages:o,callbacks:c,isStreaming:a}),[o,c,a]);/* @__PURE__ */
2
+ return e.createElement(On.Provider,{value:d},s)}const Pn=({block:t,isStreaming:n})=>/* @__PURE__ */e.createElement(L,{message:{content:t.text},isStreaming:n}),In=({citations:t,onCitationClick:n})=>/* @__PURE__ */e.createElement("span",{className:"inline-flex flex-wrap gap-1"},t.map(t=>/* @__PURE__ */e.createElement(Fn,{key:t.id,citation:t,onClick:n}))),Fn=({citation:t,onClick:n})=>/* @__PURE__ */e.createElement(p,null,/* @__PURE__ */e.createElement(g,{asChild:!0},/* @__PURE__ */e.createElement("button",{type:"button",className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-primary/10 text-xs font-medium text-primary hover:bg-primary/20 transition-colors",onClick:()=>n?.(t)},t.index)),/* @__PURE__ */e.createElement(h,{side:"top",className:"max-w-xs"},/* @__PURE__ */e.createElement("p",{className:"text-sm font-medium"},t.title),/* @__PURE__ */e.createElement("p",{className:"text-xs text-muted-foreground truncate"},t.url))),Ln=({block:t,isStreaming:n,onCitationClick:r})=>"text"===t.type?/* @__PURE__ */e.createElement(e.Fragment,null,/* @__PURE__ */e.createElement(Pn,{block:t,isStreaming:n}),t.citations&&t.citations.length>0&&/* @__PURE__ */e.createElement(In,{citations:t.citations,onCitationClick:r})):null,jn=({message:t,className:n})=>{const{callbacks:r}=An(),o="streaming"===t.status,i="pending"===t.status,a="completed"===t.status,l=s(()=>{const e=t.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n");r.onCopy?.(t.id,e)},[t,r]),c=t.content.some(e=>"text"===e.type&&e.text.length>0),d="error"===t.status;return i&&0===t.content.length||o&&!c?/* @__PURE__ */e.createElement(j,{className:n}):/* @__PURE__ */e.createElement("div",{className:v("flex gap-3 p-4 bg-surface rounded",n)},/* @__PURE__ */e.createElement("div",{className:"flex-1 min-w-0"},/* @__PURE__ */e.createElement("div",{className:"space-y-1"},d?/* @__PURE__ */e.createElement(Ln,{block:{type:"text",text:"Sorry, something went wrong. Please try again."}}):t.content.map((t,n)=>/* @__PURE__ */e.createElement(Ln,{key:n,block:t,isStreaming:o,onCitationClick:r.onCitationClick}))),a&&/* @__PURE__ */e.createElement("div",{className:"mt-3 flex items-center gap-1"},/* @__PURE__ */e.createElement(Kn,{tooltip:"Copy",onClick:l},/* @__PURE__ */e.createElement(E,{className:"h-4 w-4"})))))},Kn=({children:t,tooltip:n,active:r,onClick:o})=>/* @__PURE__ */e.createElement(p,null,/* @__PURE__ */e.createElement(g,{asChild:!0},/* @__PURE__ */e.createElement("button",{type:"button",className:v("inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",r&&"text-primary"),onClick:o},t)),/* @__PURE__ */e.createElement(h,{side:"bottom"},/* @__PURE__ */e.createElement("p",{className:"text-xs"},n))),zn={image:_,video:R,pdf:D,doc:k,file:C,channel:S,collection:N,article:w,page:b},Bn=({pill:t,onRemove:n})=>{const r=t.iconType?zn[t.iconType]:null,o=t.loading?t.progress??0:100;/* @__PURE__ */
3
3
  return e.createElement("span",{className:"relative inline-flex items-center gap-0.5 overflow-hidden rounded-full border border-muted px-2 py-1 text-xs text-muted-foreground"},/* @__PURE__ */e.createElement("span",{className:"absolute inset-0 bg-muted transition-[width] duration-300 ease-out",style:{width:`${o}%`}}),/* @__PURE__ */e.createElement("span",{className:"relative flex items-center gap-0.5"},t.loading?/* @__PURE__ */e.createElement(O,{className:"h-3 w-3 shrink-0 mr-0.5 animate-spin"}):r&&/* @__PURE__ */e.createElement(r,{className:"h-3 w-3 shrink-0 mr-0.5"}),t.label,n&&/* @__PURE__ */e.createElement("button",{type:"button",className:"ml-0.5 inline-flex h-3.5 w-3.5 items-center justify-center rounded-full hover:bg-muted-foreground/20",onClick:()=>n(t)},
4
4
  /* @__PURE__ */e.createElement(T,{className:"h-2.5 w-2.5"}))))};function $n({src:t,alt:n,open:r,onClose:o}){/* @__PURE__ */
5
5
  return e.createElement(K.Root,{open:r,onOpenChange:e=>{e||o()}},
6
6
  /* @__PURE__ */e.createElement(K.Portal,null,/* @__PURE__ */e.createElement(K.Overlay,{className:"fixed inset-0 z-50 bg-black/80 cursor-zoom-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"}),/* @__PURE__ */e.createElement(K.Content,{className:"fixed left-1/2 top-1/2 z-50 max-w-[calc(100vw-4rem)] max-h-[calc(100vh-4rem)] outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",style:{translate:"-50% -50%"},"aria-describedby":void 0,onPointerDownOutside:o},
7
7
  /* @__PURE__ */e.createElement(K.Title,{className:"sr-only"},n??"Image preview"),
8
- /* @__PURE__ */e.createElement("img",{src:t,alt:n??"Attachment",className:"max-w-full max-h-full object-contain rounded-lg ring-1 ring-white/10"}))))}function Un({file:t,url:n,alt:r,loading:o,onRemove:i}){const[s,a]=e.useState(),[l,c]=e.useState(!1);e.useEffect(()=>{if(!t)return;const e=URL.createObjectURL(t);return a(e),()=>URL.revokeObjectURL(e)},[t]);const u=n??s;return u?/* @__PURE__ */e.createElement(e.Fragment,null,/* @__PURE__ */e.createElement("div",{className:"relative group size-16 rounded-lg overflow-hidden flex-shrink-0 ring-1 ring-black/10 dark:ring-white/10"},/* @__PURE__ */e.createElement("button",{type:"button",className:"w-full h-full cursor-zoom-in",onClick:()=>c(!0),disabled:o},
9
- /* @__PURE__ */e.createElement("img",{src:u,alt:r??"Attachment",className:"w-full h-full object-cover"})),o&&/* @__PURE__ */e.createElement("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 pointer-events-none"},/* @__PURE__ */e.createElement("div",{className:"animate-spin rounded-full size-4 border-[2.5px] border-black/30 border-t-white"})),i&&/* @__PURE__ */e.createElement("button",{type:"button",onClick:i,className:"absolute top-0.5 right-0.5 p-0.5 rounded-full opacity-0 group-hover:opacity-100 transition-opacity bg-black/50 hover:bg-black/70"},
10
- /* @__PURE__ */e.createElement(T,{className:"size-2.5 text-white","aria-label":"Remove"}))),/* @__PURE__ */e.createElement($n,{src:u,alt:r,open:l,onClose:()=>c(!1)})):null}function Wn({attachments:t,onRemove:n,className:r}){const o=t.filter(e=>e.file.mimeType.startsWith("image/"));return 0===o.length?null:/* @__PURE__ */e.createElement("div",{className:v("flex flex-wrap gap-2",r)},o.map(t=>/* @__PURE__ */e.createElement(Un,{key:t.id,file:t.raw,url:t.file.url,alt:t.file.name,loading:t.loading,onRemove:n?()=>n(t):void 0})))}function Jn({blocks:t,className:n}){const r=t.filter(e=>e.mimeType.startsWith("image/"));return 0===r.length?null:/* @__PURE__ */e.createElement("div",{className:v("flex flex-wrap gap-2",n)},r.map(t=>/* @__PURE__ */e.createElement(Un,{key:t.storageKey,url:t.url,alt:t.fileName})))}function Vn(e){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":"application/pdf"===e?"pdf":"application/msword"===e||e.includes("wordprocessingml")?"doc":"file"}function Hn(e){switch(e.type){case"file":return`file:${e.storageKey}`;case"page":return`page:${e.url}`;case"entity":return`entity:${e.entity.type}:${e.entity.id}`}}function qn(e){switch(e.type){case"file":return{id:e.storageKey,label:e.fileName,iconType:Vn(e.mimeType)};case"page":return{id:e.url,label:e.title,iconType:"page"};case"entity":return{id:e.entity.id,label:e.entity.title,iconType:e.entity.type}}}const Gn=({message:t,className:n})=>{const r=t.content.filter(e=>"text"===e.type),o=t.content.filter(e=>"file"===e.type&&e.mimeType.startsWith("image/")),i=t.content.filter(e=>"text"!==e.type&&("file"!==e.type||!e.mimeType.startsWith("image/"))),s=r.map(e=>e.text).join("\n").split(/\n\n+/).filter(e=>e.trim().length>0);/* @__PURE__ */
8
+ /* @__PURE__ */e.createElement("img",{src:t,alt:n??"Attachment",className:"max-w-full max-h-full object-contain rounded-lg ring-1 ring-white/10"}))))}function Un({file:t,url:n,alt:r,loading:o,onRemove:i}){const[s,a]=e.useState(),[l,c]=e.useState(!1);e.useEffect(()=>{if(!t)return;const e=URL.createObjectURL(t);return a(e),()=>URL.revokeObjectURL(e)},[t]);const d=n??s;return d?/* @__PURE__ */e.createElement(e.Fragment,null,/* @__PURE__ */e.createElement("div",{className:"relative group size-16 rounded-lg overflow-hidden flex-shrink-0 ring-1 ring-black/10 dark:ring-white/10"},/* @__PURE__ */e.createElement("button",{type:"button",className:"w-full h-full cursor-zoom-in",onClick:()=>c(!0),disabled:o},
9
+ /* @__PURE__ */e.createElement("img",{src:d,alt:r??"Attachment",className:"w-full h-full object-cover"})),o&&/* @__PURE__ */e.createElement("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 pointer-events-none"},/* @__PURE__ */e.createElement("div",{className:"animate-spin rounded-full size-4 border-[2.5px] border-black/30 border-t-white"})),i&&/* @__PURE__ */e.createElement("button",{type:"button",onClick:i,className:"absolute top-0.5 right-0.5 p-0.5 rounded-full opacity-0 group-hover:opacity-100 transition-opacity bg-black/50 hover:bg-black/70"},
10
+ /* @__PURE__ */e.createElement(T,{className:"size-2.5 text-white","aria-label":"Remove"}))),/* @__PURE__ */e.createElement($n,{src:d,alt:r,open:l,onClose:()=>c(!1)})):null}function Wn({attachments:t,onRemove:n,className:r}){const o=t.filter(e=>e.file.mimeType.startsWith("image/"));return 0===o.length?null:/* @__PURE__ */e.createElement("div",{className:v("flex flex-wrap gap-2",r)},o.map(t=>/* @__PURE__ */e.createElement(Un,{key:t.id,file:t.raw,url:t.file.url,alt:t.file.name,loading:t.loading,onRemove:n?()=>n(t):void 0})))}function Jn({blocks:t,className:n}){const r=t.filter(e=>e.mimeType.startsWith("image/"));return 0===r.length?null:/* @__PURE__ */e.createElement("div",{className:v("flex flex-wrap gap-2",n)},r.map(t=>/* @__PURE__ */e.createElement(Un,{key:t.attachmentId,url:t.url,alt:t.fileName})))}function Vn(e){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":"application/pdf"===e?"pdf":"application/msword"===e||e.includes("wordprocessingml")?"doc":"file"}function Hn(e){switch(e.type){case"file":return`file:${e.attachmentId}`;case"page":return`page:${e.url}`;case"entity":return`entity:${e.entity.type}:${e.entity.id}`}}function qn(e){switch(e.type){case"file":return{id:e.attachmentId,label:e.fileName,iconType:Vn(e.mimeType)};case"page":return{id:e.url,label:e.title,iconType:"page"};case"entity":return{id:e.entity.id,label:e.entity.title,iconType:e.entity.type}}}const Gn=({message:t,className:n})=>{const r=t.content.filter(e=>"text"===e.type),o=t.content.filter(e=>"file"===e.type&&e.mimeType.startsWith("image/")),i=t.content.filter(e=>"text"!==e.type&&("file"!==e.type||!e.mimeType.startsWith("image/"))),s=r.map(e=>e.text).join("\n").split(/\n\n+/).filter(e=>e.trim().length>0);/* @__PURE__ */
11
11
  return e.createElement("div",{className:v("flex justify-end py-4",n)},/* @__PURE__ */e.createElement("div",{className:"max-w-[85%] rounded bg-surface px-4 py-2.5 text-foreground flex flex-col gap-3"},/* @__PURE__ */e.createElement(Jn,{blocks:o}),i.length>0&&/* @__PURE__ */e.createElement("div",{className:"flex flex-wrap gap-1.5"},i.map(t=>/* @__PURE__ */e.createElement(Bn,{key:Hn(t),pill:qn(t)}))),s.length>0&&/* @__PURE__ */e.createElement("div",null,s.map((t,n)=>/* @__PURE__ */e.createElement("p",{key:n,className:"m-0 mb-4 whitespace-pre-wrap last:mb-0"},t)))))},Yn=({message:t,className:n})=>{switch(t.role){case"ai":/* @__PURE__ */
12
12
  return e.createElement(jn,{message:t,className:n});case"user":/* @__PURE__ */
13
- return e.createElement(Gn,{message:t,className:n});default:return null}},Zn=({className:n,bottomPadding:r=0,onContentBehind:o})=>{const{messages:i}=An(),s=t(null),l=t(null);return a(()=>{const e=s.current;e&&(e.scrollTop=e.scrollHeight)},[i]),a(()=>{const e=l.current,t=s.current;if(!e||!t||!o)return;const n=new IntersectionObserver(([e])=>{e&&o(!e.isIntersecting)},{root:t,threshold:0,rootMargin:`0px 0px -${r}px 0px`});return n.observe(e),()=>n.disconnect()},[o,r]),/* @__PURE__ */e.createElement(x,{ref:s,className:v("h-full",n)},/* @__PURE__ */e.createElement("div",{className:"px-6"},i.map(t=>/* @__PURE__ */e.createElement(Yn,{key:t.id,message:t})),/* @__PURE__ */e.createElement("div",{ref:l,className:"h-px"})),/* @__PURE__ */e.createElement("div",{style:{height:r+8}}))},Xn=i(null);function Qn(){const e=o(Xn);return null==e&&function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const o of t)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),e}const er="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,tr=er?n:a,nr={tag:re};function rr({initialConfig:e,children:t}){const n=r(()=>{const{theme:t,namespace:n,nodes:r,onError:o,editorState:i,html:s}=e,a=(c=t,{getTheme:function(){return null!=c?c:null}}),l=Q({editable:e.editable,html:s,namespace:n,nodes:r,onError:e=>o(e,l),theme:t});var c;return function(e,t){if(null!==t)if(void 0===t)e.update(()=>{const t=ee();if(t.isEmpty()){const n=te();t.append(n);const r=er?document.activeElement:null;(null!==ne()||null!==r&&r===e.getRootElement())&&n.select()}},nr);else if(null!==t)switch(typeof t){case"string":{const n=e.parseEditorState(t);e.setEditorState(n,nr);break}case"object":e.setEditorState(t,nr);break;case"function":e.update(()=>{ee().isEmpty()&&t(e)},nr)}}(l,i),[l,a]},[]);return tr(()=>{const t=e.editable,[r]=n;r.setEditable(void 0===t||t)},[]),tn(Xn.Provider,{value:n,children:t})}const or="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:a;function ir(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}const sr=new Map;function ar(e){const t=de().getElementByKey(e.getKey());if(null===t)return null;const n=t.ownerDocument.defaultView;return null===n?null:n.getComputedStyle(t)}function lr(e){return ar(ue(e)?e:e.getParentOrThrow())}function cr(e){const t=lr(e);return null!==t&&"rtl"===t.direction}function ur(e,t,n="self"){const r=e.getStartEndPoints();if(t.isSelected(e)&&!fe(t)&&null!==r){const[o,i]=r,s=e.isBackward(),a=o.getNode(),l=i.getNode(),c=t.is(a),u=t.is(l);if(c||u){const[r,o]=me(e),i=a.is(l),c=t.is(s?l:a),u=t.is(s?a:l);let d,f=0;i?(f=r>o?o:r,d=r>o?r:o):c?(f=s?o:r,d=void 0):u&&(f=0,d=s?r:o);const m=t.__text.slice(f,d);m!==t.__text&&("clone"===n&&(t=pe(t)),t.__text=m)}}return t}function dr(e){const t=e.getStyle(),n=function(e){const t={};if(!e)return t;const n=e.split(";");for(const r of n)if(""!==r){const[e,n]=r.split(/:([^]+)/);e&&n&&(t[e.trim()]=n.trim())}return t}(t);sr.set(t,n)}function fr(e){const t=mr(e);return null!==t&&"vertical-rl"===t.writingMode}function mr(e){const t=e.anchor.getNode();return le(t)?ar(t):lr(t)}function pr(e,t){let n=fr(e)?!t:t;gr(e)&&(n=!n);const r=oe(e.focus,n?"previous":"next");if(ie(r))return!1;for(const o of se(r)){if(ae(o))return!o.origin.isInline();if(!le(o.origin)){if(ce(o.origin))return!0;break}}return!1}function gr(e){const t=mr(e);return null!==t&&"rtl"===t.direction}function hr(e,t,n){const r=gr(e);let o;o=fr(e)||r?!n:n,function(e,t,n,r){e.modify(t?"extend":"move",n,r)}(e,t,o,"character")}const yr="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,vr=yr&&"documentMode"in document?document.documentMode:null;function xr(e){const t=he(e,e=>le(e)&&!e.isInline());return le(t)||function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const o of t)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(4,e.__key),t}function Er(e,t){return null!==e&&Object.getPrototypeOf(e).constructor.name===t.name}function br(e){const t=ne();if(!ge(t))return!1;const n=new Set,r=t.getNodes();for(let o=0;o<r.length;o++){const t=r[o],i=t.getKey();if(n.has(i))continue;const s=he(t,e=>le(e)&&!e.isInline());if(null===s)continue;const a=s.getKey();s.canIndent()&&!n.has(a)&&(n.add(a),e(s))}return n.size>0}yr&&"InputEvent"in window&&!vr&&new window.InputEvent("input");const wr=Symbol.for("preact-signals");function Nr(){if(Dr>1)return void Dr--;let e,t=!1;for(;void 0!==Cr;){let n=Cr;for(Cr=void 0,Rr++;void 0!==n;){const r=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&Mr(n))try{n.c()}catch(_i){t||(e=_i,t=!0)}n=r}}if(Rr=0,Dr--,t)throw e}let Sr,Cr;function kr(e){const t=Sr;Sr=void 0;try{return e()}finally{Sr=t}}let Dr=0,Rr=0,_r=0;function Or(e){if(void 0===Sr)return;let t=e.n;return void 0===t||t.t!==Sr?(t={i:0,S:e,p:Sr.s,n:void 0,t:Sr,e:void 0,x:void 0,r:t},void 0!==Sr.s&&(Sr.s.n=t),Sr.s=t,e.n=t,32&Sr.f&&e.S(t),t):-1===t.i?(t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=Sr.s,t.n=void 0,Sr.s.n=t,Sr.s=t),t):void 0}function Tr(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function Ar(e,t){return new Tr(e,t)}function Mr(e){for(let t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Pr(e){for(let t=e.s;void 0!==t;t=t.n){const n=t.S.n;if(void 0!==n&&(t.r=n),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function Ir(e){let t,n=e.s;for(;void 0!==n;){const e=n.p;-1===n.i?(n.S.U(n),void 0!==e&&(e.n=n.n),void 0!==n.n&&(n.n.p=e)):t=n,n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=e}e.s=t}function Fr(e,t){Tr.call(this,void 0),this.x=e,this.s=void 0,this.g=_r-1,this.f=4,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function Lr(e){const t=e.u;if(e.u=void 0,"function"==typeof t){Dr++;const n=Sr;Sr=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,jr(e),t}finally{Sr=n,Nr()}}}function jr(e){for(let t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Lr(e)}function Kr(e){if(Sr!==this)throw new Error("Out-of-order effect");Ir(this),Sr=e,this.f&=-2,8&this.f&&jr(this),Nr()}function zr(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=null==t?void 0:t.name}function Br(e,t){const n=new zr(e,t);try{n.c()}catch(e){throw n.d(),e}const r=n.d.bind(n);return r[Symbol.dispose]=r,r}function $r(e,t={}){const n={};for(const r in e){const o=t[r],i=Ar(void 0===o?e[r]:o);n[r]=i}return n}function Ur(){const e=ee(),t=ne(),n=te();e.clear(),e.append(n),null!==t&&n.select(),ge(t)&&(t.format=0)}function Wr(e){return("function"==typeof e.nodes?e.nodes():e.nodes)||[]}Tr.prototype.brand=wr,Tr.prototype.h=function(){return!0},Tr.prototype.S=function(e){const t=this.t;t!==e&&void 0===e.e&&(e.x=t,this.t=e,void 0!==t?t.e=e:kr(()=>{var e;null==(e=this.W)||e.call(this)}))},Tr.prototype.U=function(e){if(void 0!==this.t){const t=e.e,n=e.x;void 0!==t&&(t.x=n,e.e=void 0),void 0!==n&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,void 0===n&&kr(()=>{var e;null==(e=this.Z)||e.call(this)}))}},Tr.prototype.subscribe=function(e){return Br(()=>{const t=this.value,n=Sr;Sr=void 0;try{e(t)}finally{Sr=n}},{name:"sub"})},Tr.prototype.valueOf=function(){return this.value},Tr.prototype.toString=function(){return this.value+""},Tr.prototype.toJSON=function(){return this.value},Tr.prototype.peek=function(){const e=Sr;Sr=void 0;try{return this.value}finally{Sr=e}},Object.defineProperty(Tr.prototype,"value",{get(){const e=Or(this);return void 0!==e&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Rr>100)throw new Error("Cycle detected");this.v=e,this.i++,_r++,Dr++;try{for(let e=this.t;void 0!==e;e=e.x)e.t.N()}finally{Nr()}}}}),Fr.prototype=new Tr,Fr.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===_r)return!0;if(this.g=_r,this.f|=1,this.i>0&&!Mr(this))return this.f&=-2,!0;const e=Sr;try{Pr(this),Sr=this;const e=this.x();(16&this.f||this.v!==e||0===this.i)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return Sr=e,Ir(this),this.f&=-2,!0},Fr.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(let e=this.s;void 0!==e;e=e.n)e.S.S(e)}Tr.prototype.S.call(this,e)},Fr.prototype.U=function(e){if(void 0!==this.t&&(Tr.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(let e=this.s;void 0!==e;e=e.n)e.S.U(e)}},Fr.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(Fr.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const e=Or(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),zr.prototype.c=function(){const e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;const e=this.x();"function"==typeof e&&(this.u=e)}finally{e()}},zr.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Lr(this),Pr(this),Dr++;const e=Sr;return Sr=this,Kr.bind(this,e)},zr.prototype.N=function(){2&this.f||(this.f|=2,this.o=Cr,Cr=this)},zr.prototype.d=function(){this.f|=8,1&this.f||jr(this)},zr.prototype.dispose=function(){this.d()},we({build:(e,t,n)=>$r(t),config:Ne({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,n){const r=n.getOutput();return Br(()=>r.disabled.value?void 0:e.registerRootListener(t=>{e.focus(()=>{const e=document.activeElement;null===t||null!==e&&t.contains(e)||t.focus({preventScroll:!0})},{defaultSelection:r.defaultSelection.peek()})}))}}),we({build:(e,t,n)=>$r(t),config:Ne({$onClear:Ur}),name:"@lexical/extension/ClearEditor",register(e,t,n){const{$onClear:r}=n.getOutput();return Br(()=>function(e,t=Ur){return e.registerCommand(Ve,n=>(e.update(t),!0),He)}(e,r.value))}});const Jr=Se("format",{parse:e=>"number"==typeof e?e:0});let Vr=class extends ve{$config(){return this.config("decorator-text",{extends:ve,stateConfigs:[{flat:!0,stateConfig:Jr}]})}getFormat(){return ze(this,Jr)}getFormatFlags(e,t){return Be(this.getFormat(),e,t)}hasFormat(e){const t=$e[e];return 0!==(this.getFormat()&t)}setFormat(e){return Ue(this,Jr,e)}toggleFormat(e){const t=this.getFormat(),n=Be(t,e,null);return this.setFormat(n)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function Hr(e){return e instanceof Vr}function qr(e,t){let n;return Ar(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}we({name:"@lexical/extension/DecoratorText",nodes:()=>[Vr],register:(e,t,n)=>e.registerCommand(Ce,e=>{const t=ne();if(ke(t)||ge(t))for(const n of t.getNodes())Hr(n)&&n.toggleFormat(e);return!1},De)});const Gr=we({build:e=>qr(()=>e.getEditorState(),t=>e.registerUpdateListener(e=>{t.value=e.editorState})),name:"@lexical/extension/EditorState"});function Yr(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const o of t)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Zr(e,t){if(e&&t&&!Array.isArray(t)&&"object"==typeof e&&"object"==typeof t){const n=e,r=t;for(const e in r)n[e]=Zr(n[e],r[e]);return e}return t}function Xr(e){return 0===e.id}function Qr(e){return 2===e.id}const eo=new Set;class to{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:0}}mergeConfigs(){let e=this.extension.config||{};const t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):Ee;for(const n of this.configs)e=t(e,n);return e}init(e){const t=this.state;Qr(t)||Yr(306,String(t.id));const n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},o=function(e,t,n){return Object.assign(e,{config:t,id:3,registerState:n})}(t,this.mergeConfigs(),n);let i;this.state=o,this.extension.init&&(i=this.extension.init(e,o.config,n)),this.state=function(e,t,n){return Object.assign(e,{id:4,initResult:t,registerState:n})}(o,i,r)}build(e){const t=this.state;let n;4!==t.id&&Yr(307,String(t.id),String(5)),this.extension.build&&(n=this.extension.build(e,t.config,t.registerState));const r={...t.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(e,t,n){return Object.assign(e,{id:5,output:t,registerState:n})}(t,n,r)}register(e,t){this._signal=t;const n=this.state;5!==n.id&&Yr(308,String(n.id),String(5));const r=this.extension.register&&this.extension.register(e,n.config,n.registerState);return this.state=function(e){return Object.assign(e,{id:6})}(n),()=>{const e=this.state;7!==e.id&&Yr(309,String(n.id),String(7)),this.state=function(e){return Object.assign(e,{id:5})}(e),r&&r()}}afterRegistration(e){const t=this.state;let n;return 6!==t.id&&Yr(310,String(t.id),String(6)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=function(e){return Object.assign(e,{id:7})}(t),n}getSignal(){return void 0===this._signal&&Yr(311),this._signal}getInitResult(){void 0===this.extension.init&&Yr(312,this.extension.name);const e=this.state;return function(e){return e.id>=4}(e)||Yr(313,String(e.id),String(4)),e.initResult}getInitPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionInitDependency():void 0}getExtensionInitDependency(){const e=this.state;return function(e){return e.id>=3}(e)||Yr(314,String(e.id),String(3)),{config:e.config}}getPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}getInitDependency(e){const t=this.builder.getExtensionRep(e);return void 0===t&&Yr(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){const t=this.builder.getExtensionRep(e);return void 0===t&&Yr(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){const e=this.state;return function(e){return e.id>=7}(e)||Yr(316,String(e.id),String(7)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||eo}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map(([e])=>e)),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){const e=this.state;(function(e){return e.id>=5})(e)||Yr(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}}const no={tag:re};function ro(){const e=ee();e.isEmpty()&&e.append(te())}const oo=we({config:Ne({setOptions:no,updateOptions:no}),init:({$initialEditorState:e=ro})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},r){const o=r.getInitResult();if(!o.initialized){o.initialized=!0;const{$initialEditorState:r}=o;if(Me(r))e.setEditorState(r,n);else if("function"==typeof r)e.update(()=>{r(e)},t);else if(r&&("string"==typeof r||"object"==typeof r)){const t=e.parseEditorState(r);e.setEditorState(t,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[Re,_e,Oe,Te,Ae]}),io=Symbol.for("@lexical/extension/LexicalBuilder");function so(){}function ao(e){throw e}function lo(e){return Array.isArray(e)?e:[e]}const co="0.41.0+prod.esm";class uo{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=co,this.roots=e;for(const t of e)this.addExtension(t)}static fromExtensions(e){const t=[lo(oo)];for(const n of e)t.push(lo(n));return new uo(t)}static maybeFromEditor(e){const t=e[io];return t&&(t.PACKAGE_VERSION!==co&&Yr(292,t.PACKAGE_VERSION,co),t instanceof uo||Yr(293)),t}static fromEditor(e){const t=uo.maybeFromEditor(e);return void 0===t&&Yr(294),t}constructEditor(){const{$initialEditorState:e,onError:t,...n}=this.buildCreateEditorArgs(),r=Object.assign(Q({...n,...t?{onError:e=>{t(e,r)}}:{}}),{[io]:this});for(const o of this.sortedExtensionReps())o.build(r);return r}buildEditor(){let e=so;function t(){try{e()}finally{e=so}}const n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=ye(this.registerEditor(n),()=>n.setRootElement(null)),n}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){const t=this.extensionNameMap.get(e.name);if(t)return t.extension!==e&&Yr(295,e.name),t}addEdge(e,t,n){const r=this.outgoingConfigEdges.get(e);r?r.set(t,n):this.outgoingConfigEdges.set(e,new Map([[t,n]]));const o=this.incomingEdges.get(t);o?o.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){void 0!==this._sortedExtensionReps&&Yr(296);const t=lo(e),[n]=t;"string"!=typeof n.name&&Yr(297,typeof n.name);let r=this.extensionNameMap.get(n.name);if(void 0!==r&&r.extension!==n&&Yr(298,n.name),!r){r=new to(this,n),this.extensionNameMap.set(n.name,r);const e=this.conflicts.get(n.name);"string"==typeof e&&Yr(299,n.name,e);for(const t of n.conflictsWith||[])this.extensionNameMap.has(t)&&Yr(299,n.name,t),this.conflicts.set(t,n.name);for(const t of n.dependencies||[]){const e=lo(t);this.addEdge(n.name,e[0].name,e.slice(1)),this.addExtension(e)}for(const[t,r]of n.peerDependencies||[])this.addEdge(n.name,t,r?[r]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const e=[],t=(n,r)=>{let o=n.state;if(Qr(o))return;const i=n.extension.name;var s;Xr(o)||Yr(300,i,r||"[unknown]"),Xr(s=o)||Yr(304,String(s.id),String(0)),o=Object.assign(s,{id:1}),n.state=o;const a=this.outgoingConfigEdges.get(i);if(a)for(const e of a.keys()){const n=this.extensionNameMap.get(e);n&&t(n,i)}o=function(e){return function(e){return 1===e.id}(e)||Yr(305,String(e.id),String(1)),Object.assign(e,{id:2})}(o),n.state=o,e.push(n)};for(const n of this.extensionNameMap.values())Xr(n.state)&&t(n);for(const n of e)for(const[e,t]of this.outgoingConfigEdges.get(n.extension.name)||[])if(t.length>0){const n=this.extensionNameMap.get(e);if(n)for(const e of t)n.configs.add(e)}for(const[n,...r]of this.roots)if(r.length>0){const e=this.extensionNameMap.get(n.name);void 0===e&&Yr(301,n.name);for(const t of r)e.configs.add(t)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){const t=this.sortedExtensionReps(),n=new AbortController,r=[()=>n.abort()],o=n.signal;for(const i of t){const t=i.register(e,o);t&&r.push(t)}for(const i of t){const t=i.afterRegistration(e);t&&r.push(t)}return ye(...r)}buildCreateEditorArgs(){const e={},t=new Set,n=new Map,r=new Map,o={},i={},s=this.sortedExtensionReps();for(const c of s){const{extension:s}=c;if(void 0!==s.onError&&(e.onError=s.onError),void 0!==s.disableEvents&&(e.disableEvents=s.disableEvents),void 0!==s.parentEditor&&(e.parentEditor=s.parentEditor),void 0!==s.editable&&(e.editable=s.editable),void 0!==s.namespace&&(e.namespace=s.namespace),void 0!==s.$initialEditorState&&(e.$initialEditorState=s.$initialEditorState),s.nodes)for(const e of Wr(s)){if("function"!=typeof e){const t=n.get(e.replace);t&&Yr(302,s.name,e.replace.name,t.extension.name),n.set(e.replace,c)}t.add(e)}if(s.html){if(s.html.export)for(const[e,t]of s.html.export.entries())r.set(e,t);s.html.import&&Object.assign(o,s.html.import)}s.theme&&Zr(i,s.theme)}Object.keys(i).length>0&&(e.theme=i),t.size&&(e.nodes=[...t]);const a=Object.keys(o).length>0,l=r.size>0;(a||l)&&(e.html={},a&&(e.html.import=o),l&&(e.html.export=r));for(const c of s)c.init(e);return e.onError||(e.onError=ao),e}}const fo=new Set,mo=we({build(e,t,n){const r=n.getDependency(Gr).output,o=Ar({watchedNodeKeys:new Map}),i=qr(()=>{},()=>Br(()=>{const e=i.peek(),{watchedNodeKeys:t}=o.value;let n,s=!1;r.value.read(()=>{if(ne())for(const[r,o]of t.entries()){if(0===o.size){t.delete(r);continue}const i=We(r),a=i&&i.isSelected()||!1;s=s||a!==(!!e&&e.has(r)),a&&(n=n||new Set,n.add(r))}}),!s&&n&&e&&n.size===e.size||(i.value=n)}));return{watchNodeKey:function(e){const t=function(e,t){return new Fr(e,t)}(()=>(i.value||fo).has(e)),{watchedNodeKeys:n}=o.peek();let r=n.get(e);const s=void 0!==r;return r=r||new Set,r.add(t),s||(n.set(e,r),o.value={watchedNodeKeys:n}),t}}},dependencies:[Gr],name:"@lexical/extension/NodeSelection"});Pe("INSERT_HORIZONTAL_RULE_COMMAND");class po extends ve{static getType(){return"horizontalrule"}static clone(e){return new po(e.__key)}static importJSON(e){return ho().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:go,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(e){const t=document.createElement("hr");return xe(t,e.theme.hr),t}getTextContent(){return"\n"}isInline(){return!1}updateDOM(){return!1}}function go(){return{node:ho()}}function ho(){return be(po)}function yo(e){return e instanceof po}function vo(e){return e.canBeEmpty()}we({dependencies:[Gr,mo],name:"@lexical/extension/HorizontalRule",nodes:()=>[po],register(e,t,n){const{watchNodeKey:r}=n.getDependency(mo).output,o=Ar({nodeSelections:new Map}),i=e._config.theme.hrSelected??"selected";return ye(e.registerCommand(Ie,e=>{if(Fe(e.target)){const t=Le(e.target);if(yo(t))return function(e,t=!1){const n=ne(),r=e.isSelected(),o=e.getKey();let i;t&&ke(n)?i=n:(i=je(),Ke(i)),r?i.delete(o):i.add(o)}(t,e.shiftKey),!0}return!1},De),e.registerMutationListener(po,(t,n)=>{!function(e){if(Dr>0)return e();Dr++;try{return e()}finally{Nr()}}(()=>{let n=!1;const{nodeSelections:i}=o.peek();for(const[o,s]of t.entries())if("destroyed"===s)i.delete(o),n=!0;else{const t=i.get(o),s=e.getElementByKey(o);t?t.domNode.value=s:(n=!0,i.set(o,{domNode:Ar(s),selectedSignal:r(o)}))}n&&(o.value={nodeSelections:i})})}),Br(()=>{const e=[];for(const{domNode:t,selectedSignal:n}of o.value.nodeSelections.values())e.push(Br(()=>{const e=t.value;e&&(n.value?xe(e,i):Je(e,i))}));return ye(...e)}))}}),we({build:(e,t,n)=>$r(t),config:Ne({$canIndent:vo,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,n){const{disabled:r,maxIndent:o,$canIndent:i}=n.getOutput();return Br(()=>{if(!r.value)return function(e,t,n=vo){return ye(e.registerCommand(qe,t=>{const n=ne();if(!ge(n))return!1;t.preventDefault();const r=function(e){if(e.getNodes().filter(e=>Ge(e)&&e.canIndent()).length>0)return!0;const t=e.anchor,n=e.focus,r=n.isBefore(t)?n:t,o=xr(r.getNode());if(o.canIndent()){const e=o.getKey();let t=Ye();if(t.anchor.set(e,0,"element"),t.focus.set(e,0,"element"),t=Ze(t),t.anchor.is(r))return!0}return!1}(n)?t.shiftKey?Xe:Qe:et;return e.dispatchCommand(r,void 0)},He),e.registerCommand(Qe,()=>{const e="number"==typeof t?t:t?t.peek():null,r=ne();if(!ge(r))return!1;const o="function"==typeof n?n:n.peek();return br(t=>{if(o(t)){const n=t.getIndent()+1;(!e||n<e)&&t.setIndent(n)}})},tt))}(e,o,i)})}});const xo=we({name:"@lexical/react/ReactProvider"});function Eo(e,t=!0){if(e)return!1;let n=ee().getTextContent();return t&&(n=n.trim()),""===n}function bo(e){return()=>function(e){if(!Eo(e,!1))return!1;const t=ee().getChildren(),n=t.length;if(n>1)return!1;for(let r=0;r<n;r++){const e=t[r];if(ce(e))return!1;if(le(e)){if(!nt(e))return!1;if(0!==e.__indent)return!1;const t=e.getChildren(),n=t.length;for(let e=0;e<n;e++){const e=t[r];if(!rt(e))return!1}}}return!0}(e)}function wo(e){const t=window.location.origin,n=n=>{if(n.origin!==t)return;const r=e.getRootElement();if(document.activeElement!==r)return;const o=n.data;if("string"==typeof o){let t;try{t=JSON.parse(o)}catch(e){return}if(t&&"nuanria_messaging"===t.protocol&&"request"===t.type){const r=t.payload;if(r&&"makeChanges"===r.functionId){const t=r.args;if(t){const[r,o,i,s,a]=t;e.update(()=>{const e=ne();if(ge(e)){const t=e.anchor;let l=t.getNode(),c=0,u=0;if(rt(l)&&r>=0&&o>=0&&(c=r,u=r+o,e.setTextNodeRange(l,c,l,u)),c===u&&""===i||(e.insertRawText(i),l=t.getNode()),rt(l)){c=s,u=s+a;const t=l.getTextContentSize();c=c>t?t:c,u=u>t?t:u,e.setTextNodeRange(l,c,l,u)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}const No=we({build:(e,t,n)=>$r(t),config:Ne({disabled:"undefined"==typeof window}),name:"@lexical/dragon",register:(e,t,n)=>Br(()=>n.getOutput().disabled.value?void 0:wo(e))});function So(e,t,n,r=null){let o=null===r||t.isSelected(r);const i=le(t)&&t.excludeFromCopy("html");let s=t;null!==r&&rt(t)&&(s=ur(r,t,"clone"));const a=le(s)?s.getChildren():[],l=ut(e,s.getType());let c;c=l&&void 0!==l.exportDOM?l.exportDOM(e,s):s.exportDOM(e);const{element:u,after:d}=c;if(!u)return!1;const f=document.createDocumentFragment();for(let m=0;m<a.length;m++){const n=a[m],i=So(e,n,f,r);!o&&le(t)&&i&&t.extractWithChild(n,r,"html")&&(o=!0)}if(o&&!i){if((dt(u)||ft(u))&&u.append(f),n.append(u),d){const e=d.call(s,u);e&&(ft(u)?u.replaceChildren(e):u.replaceWith(e))}}else n.append(f);return o}const Co=new Set(["STYLE","SCRIPT"]);function ko(e,t,n,r,o=new Map,i){let s=[];if(Co.has(e.nodeName))return s;let a=null;const l=function(e,t){const{nodeName:n}=e,r=t._htmlConversions.get(n.toLowerCase());let o=null;if(void 0!==r)for(const i of r){const t=i(e);null!==t&&(null===o||(o.priority||0)<=(t.priority||0))&&(o=t)}return null!==o?o.conversion:null}(e,t),c=l?l(e):null;let u=null;if(null!==c){u=c.after;const t=c.node;if(a=Array.isArray(t)?t[t.length-1]:t,null!==a){for(const[,e]of o)if(a=e(a,i),!a)break;a&&s.push(...Array.isArray(t)?t:[a])}null!=c.forChild&&o.set(e.nodeName,c.forChild)}const d=e.childNodes;let f=[];const m=(null==a||!at(a))&&(null!=a&&Ge(a)||r);for(let p=0;p<d.length;p++)f.push(...ko(d[p],t,n,m,new Map(o),a));return null!=u&&(f=u(f)),lt(e)&&(f=function(e,t,n){const r=e.style.textAlign,o=[];let i=[];for(let s=0;s<t.length;s++){const e=t[s];if(Ge(e))r&&!e.getFormat()&&e.setFormat(r),o.push(e);else if(i.push(e),s===t.length-1||s<t.length-1&&Ge(t[s+1])){const e=n();e.setFormat(r),e.append(...i),o.push(e),i=[]}}return o}(e,f,m?()=>{const e=new it;return n.push(e),e}:te)),null==a?f.length>0?s=s.concat(f):lt(e)&&function(e){return null!=e.nextSibling&&null!=e.previousSibling&&(ct(e.nextSibling)&&ct(e.previousSibling))}(e)&&(s=s.concat(st())):le(a)&&a.append(...f),s}function Do(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const o of t)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Ro(e,t,n){const r=e.getData("application/x-lexical-editor");if(r)try{const e=JSON.parse(r);if(e.namespace===n._config.namespace&&Array.isArray(e.nodes))return _o(n,function(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n],o=Et(r);rt(o)&&dr(o),t.push(o)}return t}(e.nodes),t)}catch(e){console.error(e)}const o=e.getData("text/html"),i=e.getData("text/plain");if(o&&i!==o)try{return _o(n,function(e,t){const n=ot(t)?t.body.childNodes:t.childNodes;let r=[];const o=[];for(const i of n)if(!Co.has(i.nodeName)){const t=ko(i,e,o,!1);null!==t&&(r=r.concat(t))}return function(e){for(const t of e)t.getNextSibling()instanceof it&&t.insertAfter(st());for(const t of e){const e=t.getChildren();for(const n of e)t.insertBefore(n);t.remove()}}(o),r}(n,(new DOMParser).parseFromString(function(e){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:e=>e}).createHTML(e):e}(o),"text/html")),t)}catch(e){console.error(e)}const s=i||e.getData("text/uri-list");if(null!=s)if(ge(t)){const e=s.split(/(\r?\n|\t)/);""===e[e.length-1]&&e.pop();for(let t=0;t<e.length;t++){const n=ne();if(ge(n)){const r=e[t];"\n"===r||"\r\n"===r?n.insertParagraph():"\t"===r?n.insertNodes([mt()]):n.insertText(r)}}}else t.insertRawText(s)}function _o(e,t,n){e.dispatchCommand(ht,{nodes:t,selection:n})||(n.insertNodes(t),function(e){if(ge(e)&&e.isCollapsed()){const t=e.anchor;let n=null;const r=oe(t,"previous");if(r)if(yt(r))n=r.origin;else{const e=vt(r,xt(ee(),"next").getFlipped());for(const t of e){if(rt(t.origin)){n=t.origin;break}if(le(t.origin)&&!t.origin.isInline())break}}if(n&&rt(n)){const t=n.getFormat(),r=n.getStyle();e.format===t&&e.style===r||(e.format=t,e.style=r,e.dirty=!0)}}}(n))}function Oo(e,t,n,r=[]){let o=null===t||n.isSelected(t);const i=le(n)&&n.excludeFromCopy("html");let s=n;null!==t&&rt(s)&&(s=ur(t,s,"clone"));const a=le(s)?s.getChildren():[],l=function(e){const t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&Do(58,n.name),le(e)){const e=t.children;Array.isArray(e)||Do(59,n.name)}return t}(s);rt(s)&&0===s.getTextContentSize()&&(o=!1);for(let c=0;c<a.length;c++){const r=a[c],i=Oo(e,t,r,l.children);!o&&le(n)&&i&&n.extractWithChild(r,t,"clone")&&(o=!0)}if(o&&!i)r.push(l);else if(Array.isArray(l.children))for(let c=0;c<l.children.length;c++){const e=l.children[c];r.push(e)}return o}let To=null;async function Ao(e,t,n){if(null!==To)return!1;if(null!==t)return new Promise((r,o)=>{e.update(()=>{r(Mo(e,t,n))})});const r=e.getRootElement(),o=e._window||window,i=o.document,s=pt(o);if(null===r||null===s)return!1;const a=i.createElement("span");a.style.cssText="position: fixed; top: -1000px;",a.append(i.createTextNode("#")),r.append(a);const l=new Range;return l.setStart(a,0),l.setEnd(a,1),s.removeAllRanges(),s.addRange(l),new Promise((t,r)=>{const s=e.registerCommand(gt,r=>(Er(r,ClipboardEvent)&&(s(),null!==To&&(o.clearTimeout(To),To=null),t(Mo(e,r,n))),!0),tt);To=o.setTimeout(()=>{s(),To=null,t(!1)},50),i.execCommand("copy"),a.remove()})}function Mo(e,t,n){if(void 0===n){const t=pt(e._window),r=ne();if(!r||r.isCollapsed())return!1;if(!t)return!1;const o=t.anchorNode,i=t.focusNode;if(null!==o&&null!==i&&!bt(e,o,i))return!1;n=function(e=ne()){const t={"text/plain":e?e.getTextContent():""};if(e){const n=de();for(const[r,o]of Po){const i=o(n,e);null!==i&&(t[r]=i)}}return t}(r)}t.preventDefault();const r=t.clipboardData;return null!==r&&(function(e,t){for(const[n]of Po)void 0===t[n]&&e.setData(n,"");for(const n in t){const r=t[n];void 0!==r&&e.setData(n,r)}}(r,n),!0)}const Po=[["text/html",function(e,t=ne()){return null==t&&Do(166),ge(t)&&t.isCollapsed()||0===t.getNodes().length?"":function(e,t){if("undefined"==typeof document||"undefined"==typeof window&&void 0===global.window)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const n=document.createElement("div"),r=ee().getChildren();for(let o=0;o<r.length;o++)So(e,r[o],n,t);return n.innerHTML}(e,t)}],["application/x-lexical-editor",function(e,t=ne()){return null==t&&Do(166),ge(t)&&t.isCollapsed()||0===t.getNodes().length?null:JSON.stringify(function(e,t){const n=[],r=ee().getChildren();for(let o=0;o<r.length;o++)Oo(e,t,r[o],n);return{namespace:e._config.namespace,nodes:n}}(e,t))}]];function Io(e,t){if(void 0!==document.caretRangeFromPoint){const n=document.caretRangeFromPoint(e,t);return null===n?null:{node:n.startContainer,offset:n.startOffset}}if("undefined"!==document.caretPositionFromPoint){const n=document.caretPositionFromPoint(e,t);return null===n?null:{node:n.offsetNode,offset:n.offset}}return null}const Fo="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Lo=Fo&&"documentMode"in document?document.documentMode:null,jo=Fo&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ko=!(!Fo||!("InputEvent"in window)||Lo)&&"getTargetRanges"in new window.InputEvent("input"),zo=Fo&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Bo=Fo&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,$o=Fo&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Uo=Fo&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&jo&&!$o,Wo=Pe("DRAG_DROP_PASTE_FILE");class Jo extends Zt{static getType(){return"quote"}static clone(e){return new Jo(e.__key)}createDOM(e){const t=document.createElement("blockquote");return xe(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:Yo,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(dt(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e);const n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return Vo().updateFromJSON(e)}insertNewAfter(e,t){const n=te(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,t),n}collapseAtStart(){const e=te();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function Vo(){return Qt(new Jo)}class Ho extends Zt{__tag;static getType(){return"heading"}static clone(e){return new Ho(e.__tag,e.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}setTag(e){const t=this.getWritable();return this.__tag=e,t}createDOM(e){const t=this.__tag,n=document.createElement(t),r=e.theme.heading;if(void 0!==r){const e=r[t];xe(n,e)}return n}updateDOM(e,t,n){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:Go,priority:0}),h2:e=>({conversion:Go,priority:0}),h3:e=>({conversion:Go,priority:0}),h4:e=>({conversion:Go,priority:0}),h5:e=>({conversion:Go,priority:0}),h6:e=>({conversion:Go,priority:0}),p:e=>{const t=e.firstChild;return null!==t&&qo(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>qo(e)?{conversion:e=>({node:Zo("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(dt(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e);const n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return Zo(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,t=!0){const n=e?e.anchor.offset:0,r=this.getLastDescendant(),o=!r||e&&e.anchor.key===r.getKey()&&n===r.getTextContentSize()||!e?te():Zo(this.getTag()),i=this.getDirection();if(o.setDirection(i),this.insertAfter(o,t),0===n&&!this.isEmpty()&&e){const e=te();e.select(),this.replace(e,!0)}return o}collapseAtStart(){const e=this.isEmpty()?te():Zo(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function qo(e){return"span"===e.nodeName.toLowerCase()&&"26pt"===e.style.fontSize}function Go(e){const t=e.nodeName.toLowerCase();let n=null;return"h1"!==t&&"h2"!==t&&"h3"!==t&&"h4"!==t&&"h5"!==t&&"h6"!==t||(n=Zo(t),null!==e.style&&(Xt(e,n),n.setFormat(e.style.textAlign))),{node:n}}function Yo(e){const t=Vo();return null!==e.style&&(t.setFormat(e.style.textAlign),Xt(e,t)),{node:t}}function Zo(e="h1"){return Qt(new Ho(e))}function Xo(e){let t=null;if(Er(e,DragEvent)?t=e.dataTransfer:Er(e,ClipboardEvent)&&(t=e.clipboardData),null===t)return[!1,[],!1];const n=t.types,r=n.includes("Files"),o=n.includes("text/html")||n.includes("text/plain");return[r,Array.from(t.files),o]}function Qo(e){const t=Bt(e);return ce(t)}function ei(e){for(const t of["lowercase","uppercase","capitalize"])e.hasFormat(t)&&e.toggleFormat(t)}function ti(e){return ye(e.registerCommand(Ie,e=>{const t=ne();return!!ke(t)&&(t.clear(),!0)},He),e.registerCommand(wt,e=>{const t=ne();return ge(t)?(t.deleteCharacter(e),!0):!!ke(t)&&(t.deleteNodes(),!0)},He),e.registerCommand(Nt,e=>{const t=ne();return!!ge(t)&&(t.deleteWord(e),!0)},He),e.registerCommand(St,e=>{const t=ne();return!!ge(t)&&(t.deleteLine(e),!0)},He),e.registerCommand(Ct,t=>{const n=ne();if("string"==typeof t)null!==n&&n.insertText(t);else{if(null===n)return!1;const r=t.dataTransfer;if(null!=r)Ro(r,n,e);else if(ge(n)){const e=t.data;return e&&n.insertText(e),!0}}return!0},He),e.registerCommand(kt,()=>{const e=ne();return!!ge(e)&&(e.removeText(),!0)},He),e.registerCommand(Ce,e=>{const t=ne();return!!ge(t)&&(t.formatText(e),!0)},He),e.registerCommand(Dt,e=>{const t=ne();if(!ge(t)&&!ke(t))return!1;const n=t.getNodes();for(const r of n){const t=he(r,e=>le(e)&&!e.isInline());null!==t&&t.setFormat(e)}return!0},He),e.registerCommand(Rt,e=>{const t=ne();return!!ge(t)&&(t.insertLineBreak(e),!0)},He),e.registerCommand(_t,()=>{const e=ne();return!!ge(e)&&(e.insertParagraph(),!0)},He),e.registerCommand(et,()=>{const e=mt(),t=ne();return ge(t)&&(e.setFormat(t.format),e.setStyle(t.style)),Ot([e]),!0},He),e.registerCommand(Qe,()=>br(e=>{const t=e.getIndent();e.setIndent(t+1)}),He),e.registerCommand(Xe,()=>br(e=>{const t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}),He),e.registerCommand(Tt,e=>{const t=ne();if(ke(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}else if(ge(t)){const n=At(t.focus,!0);if(!e.shiftKey&&ce(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},He),e.registerCommand(Mt,e=>{const t=ne();if(ke(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectNext(0,0),!0}else if(ge(t)){if(function(e){const t=e.focus;return"root"===t.key&&t.offset===ee().getChildrenSize()}(t))return e.preventDefault(),!0;const n=At(t.focus,!1);if(!e.shiftKey&&ce(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},He),e.registerCommand(Pt,e=>{const t=ne();if(ke(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),cr(n[0])?n[0].selectNext(0,0):n[0].selectPrevious(),!0}if(!ge(t))return!1;if(pr(t,!0)){const n=e.shiftKey;return e.preventDefault(),hr(t,n,!0),!0}return!1},He),e.registerCommand(It,e=>{const t=ne();if(ke(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),cr(n[0])?n[0].selectPrevious():n[0].selectNext(0,0),!0}if(!ge(t))return!1;const n=e.shiftKey;return!!pr(t,!1)&&(e.preventDefault(),hr(t,n,!1),!0)},He),e.registerCommand(Ft,t=>{if(Qo(t.target))return!1;const n=ne();if(ge(n)){if(function(e){if(!e.isCollapsed())return!1;const{anchor:t}=e;if(0!==t.offset)return!1;const n=t.getNode();if(ue(n))return!1;const r=xr(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(n))return t.preventDefault(),e.dispatchCommand(Xe,void 0);if(Bo&&"ko-KR"===navigator.language)return!1}else if(!ke(n))return!1;return t.preventDefault(),e.dispatchCommand(wt,!0)},He),e.registerCommand(Lt,t=>{if(Qo(t.target))return!1;const n=ne();return!(!ge(n)&&!ke(n))&&(t.preventDefault(),e.dispatchCommand(wt,!1))},He),e.registerCommand(jt,t=>{const n=ne();if(!ge(n))return!1;if(ei(n),null!==t){if((Bo||zo||Uo)&&Ko)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(Rt,!1)}return e.dispatchCommand(_t,void 0)},He),e.registerCommand(Kt,()=>{const t=ne();return!!ge(t)&&(e.blur(),!0)},He),e.registerCommand(zt,t=>{const[,n]=Xo(t);if(n.length>0){const r=Io(t.clientX,t.clientY);if(null!==r){const{offset:t,node:o}=r,i=Bt(o);if(null!==i){const e=Ye();if(rt(i))e.anchor.set(i.getKey(),t,"text"),e.focus.set(i.getKey(),t,"text");else{const t=i.getParentOrThrow().getKey(),n=i.getIndexWithinParent()+1;e.anchor.set(t,n,"element"),e.focus.set(t,n,"element")}const n=Ze(e);Ke(n)}e.dispatchCommand(Wo,n)}return t.preventDefault(),!0}const r=ne();return!!ge(r)},He),e.registerCommand($t,e=>{const[t]=Xo(e),n=ne();return!(t&&!ge(n))},He),e.registerCommand(Ut,e=>{const[t]=Xo(e),n=ne();if(t&&!ge(n))return!1;const r=Io(e.clientX,e.clientY);if(null!==r){const t=Bt(r.node);ce(t)&&e.preventDefault()}return!0},He),e.registerCommand(Wt,()=>(Jt(),!0),He),e.registerCommand(gt,t=>(Ao(e,Er(t,ClipboardEvent)?t:null),!0),He),e.registerCommand(Vt,t=>(async function(e,t){await Ao(t,Er(e,ClipboardEvent)?e:null),t.update(()=>{const e=ne();ge(e)?e.removeText():ke(e)&&e.getNodes().forEach(e=>e.remove())})}(t,e),!0),He),e.registerCommand(Ht,t=>{const[,n,r]=Xo(t);return n.length>0&&!r?(e.dispatchCommand(Wo,n),!0):(!Fe(t.target)||!qt(t.target))&&(null!==ne()&&(function(e,t){e.preventDefault(),t.update(()=>{const n=ne(),r=Er(e,InputEvent)||Er(e,KeyboardEvent)?null:e.clipboardData;null!=r&&null!==n&&Ro(r,n,t)},{tag:Gt})}(t,e),!0))},He),e.registerCommand(Yt,e=>{const t=ne();return ge(t)&&ei(t),!1},He),e.registerCommand(qe,e=>{const t=ne();return ge(t)&&ei(t),!1},He))}function ni(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const o of t)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}we({conflictsWith:["@lexical/plain-text"],dependencies:[No],name:"@lexical/rich-text",nodes:()=>[Ho,Jo],register:ti});const ri="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:a;function oi({editor:e,ErrorBoundary:t}){return function(e,t){const[n,o]=l(()=>e.getDecorators());return ri(()=>e.registerDecoratorListener(e=>{on(()=>{o(e)})}),[e]),a(()=>{o(e.getDecorators())},[e]),r(()=>{const r=[],o=Object.keys(n);for(let i=0;i<o.length;i++){const s=o[i],a=tn(t,{onError:t=>e._onError(t),children:tn(c,{fallback:null,children:n[s]})}),l=e.getElementByKey(s);null!==l&&r.push(sn(a,l,s))}return r},[t,n,e])}(e,t)}function ii({editor:e,ErrorBoundary:t}){return function(e){const t=uo.maybeFromEditor(e);if(t&&t.hasExtensionByName(xo.name)){for(const e of["@lexical/plain-text","@lexical/rich-text"])t.hasExtensionByName(e)&&ni(320,e);return!0}return!1}(e)?null:tn(oi,{editor:e,ErrorBoundary:t})}function si(e){return e.getEditorState().read(bo(e.isComposing()))}function ai({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){const[r]=Qn();return function(e){ri(()=>ye(ti(e),wo(e)),[e])}(r),nn(rn,{children:[e,tn(li,{content:t}),tn(ii,{editor:r,ErrorBoundary:n})]})}function li({content:e}){const[n]=Qn(),o=function(e){const[t,n]=l(()=>si(e));return ri(()=>{function t(){const t=si(e);n(t)}return t(),ye(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(n),i=function(e){const[n]=Qn(),o=r(()=>e(n),[n,e]),[i,s]=l(()=>o.initialValueFn()),a=t(i);return or(()=>{const{initialValueFn:e,subscribe:t}=o,n=e();return a.current!==n&&(a.current=n,s(n)),t(e=>{a.current=e,s(e)})},[o,e]),i}(ir);return o?"function"==typeof e?e(i):e:null}const ci="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:a;const ui=u(function({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:o,ariaDescribedBy:i,ariaErrorMessage:a,ariaExpanded:c,ariaInvalid:u,ariaLabel:d,ariaLabelledBy:f,ariaMultiline:m,ariaOwns:p,ariaRequired:g,autoCapitalize:h,className:y,id:v,role:x="textbox",spellCheck:E=!0,style:b,tabIndex:w,"data-testid":N,...S},C){const[k,D]=l(e.isEditable()),R=s(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),_=r(()=>function(...e){return t=>{for(const n of e)"function"==typeof n?n(t):null!=n&&(n.current=t)}}(C,R),[R,C]);return ci(()=>(D(e.isEditable()),e.registerEditableListener(e=>{D(e)})),[e]),tn("div",{"aria-activedescendant":k?t:void 0,"aria-autocomplete":k?n:"none","aria-controls":k?o:void 0,"aria-describedby":i,...null!=a?{"aria-errormessage":a}:{},"aria-expanded":k&&"combobox"===x?!!c:void 0,...null!=u?{"aria-invalid":u}:{},"aria-label":d,"aria-labelledby":f,"aria-multiline":m,"aria-owns":k?p:void 0,"aria-readonly":!k||void 0,"aria-required":g,autoCapitalize:h,className:y,contentEditable:k,"data-testid":N,id:v,ref:_,role:x,spellCheck:E,style:b,tabIndex:w,...S})});function di(e){return e.getEditorState().read(bo(e.isComposing()))}const fi=u(function(e,t){const{placeholder:n,...r}=e,[o]=Qn();return nn(rn,{children:[tn(ui,{editor:o,...r,ref:t}),null!=n&&tn(mi,{editor:o,content:n})]})});function mi({content:e,editor:t}){const r=function(e){const[t,n]=l(()=>di(e));return ci(()=>{function t(){const t=di(e);n(t)}return t(),ye(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),[o,i]=l(t.isEditable());if(n(()=>(i(t.isEditable()),t.registerEditableListener(e=>{i(e)})),[t]),!r)return null;let s=null;return"function"==typeof e?s=e(o):null!==e&&(s=e),null===s?null:tn("div",{"aria-hidden":!0,children:s})}function pi({delay:e,externalHistoryState:t}){const[n]=Qn();return function(e,t,n=1e3){const o=r(()=>t||an(),[t]);a(()=>ln(e,o,n),[n,e,o])}(n,t,e),null}function gi({hasStrictIndent:e=!1,shouldPreserveNumbering:t=!1}){const[n]=Qn();return a(()=>{if(!n.hasNodes([cn,un]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[n]),a(()=>ye(dn(n,{restoreNumbering:t}),e?fn(n):()=>{}),[n,e,t]),a(()=>dn(r),[r=n]),null;var r}function hi({validateUrl:e,attributes:t}){const[n]=Qn();return a(()=>{if(!n.hasNodes([pn]))throw new Error("LinkPlugin: LinkNode not registered on editor")}),a(()=>gn(n,$r({attributes:t,validateUrl:e})),[n,e,t]),null}const yi="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:a;function vi({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){const[r]=Qn();return yi(()=>{if(n)return r.registerUpdateListener(({editorState:o,dirtyElements:i,dirtyLeaves:s,prevEditorState:a,tags:l})=>{t&&0===i.size&&0===s.size||e&&l.has(re)||a.isEmpty()||n(o,r,l)})},[r,e,t,n]),null}function xi(e,t){return e.getEditorState().read(()=>{const e=We(t);return null!==e&&e.isSelected()})}function Ei({nodeKey:e}){const[t]=Qn(),[n,r,o]=function(e){const[t]=Qn(),[n,r]=l(()=>xi(t,e));return a(()=>{let n=!0;const o=t.registerUpdateListener(()=>{n&&r(xi(t,e))});return()=>{n=!1,o()}},[t,e]),[n,s(n=>{t.update(()=>{let t=ne();ke(t)||(t=je(),Ke(t)),ke(t)&&(n?t.add(e):t.delete(e))})},[t,e]),s(()=>{t.update(()=>{const e=ne();ke(e)&&e.clear()})},[t])]}(e);return a(()=>ye(t.registerCommand(Ie,i=>{const s=t.getElementByKey(e);return i.target===s&&(i.shiftKey||o(),r(!n),!0)},De)),[o,t,n,e,r]),a(()=>{const r=t.getElementByKey(e),o=t._config.theme.hrSelected??"selected";null!==r&&(n?xe(r,o):Je(r,o))},[t,n,e]),null}class bi extends po{static getType(){return"horizontalrule"}static clone(e){return new bi(e.__key)}static importJSON(e){return Ni().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:wi,priority:0})}}decorate(){return tn(Ei,{nodeKey:this.__key})}}function wi(){return{node:Ni()}}function Ni(){return Qt(new bi)}const Si=[{dependencies:[bi],export:e=>yo(e)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(e,t,n,r)=>{const o=Ni();r||null!=e.getNextSibling()?e.replace(o):e.insertBefore(o),o.selectNext()},type:"element"},...vn];function Ci({transformers:e=Si}){const[t]=Qn();return a(()=>yn(t,e),[t,e]),null}const ki=i(null),Di={didCatch:!1,error:null};class Ri extends d{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Di}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){const{error:t}=this.state;null!==t&&(this.props.onReset?.({args:e,reason:"imperative-api"}),this.setState(Di))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){const{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&null!==t.error&&function(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:"keys"}),this.setState(Di))}render(){const{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:o,error:i}=this.state;let s=e;if(o){const e={error:i,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)s=t(e);else if(n)s=f(n,e);else{if(void 0===r)throw i;s=r}}return f(ki.Provider,{value:{didCatch:o,error:i,resetErrorBoundary:this.resetErrorBoundary}},s)}}function _i({children:e,onError:t}){return tn(Ri,{fallback:tn("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}const Oi=[xn,En,bn,wn,Nn];function Ti({editorRef:e}){const[t]=Qn();return a(()=>(e.current=t,()=>{e.current=null}),[t,e]),null}function Ai({onSubmit:e}){const[t]=Qn();return a(()=>t.registerCommand(jt,n=>{if(n.shiftKey)return!1;const r=ne();if(ge(r)){const e=r.anchor.getNode();if(mn(e)||mn(e.getParent()))return!1;if(Rn(e)||Rn(e.getParent()))return!1}return n.preventDefault(),t.read(()=>{e?.(Sn(Oi))}),!0},en),[t,e]),null}function Mi({defaultValue:n,onChange:r,onSubmit:o,placeholder:i,disabled:s,className:a,autoFocus:l,forwardedRef:c}){const u=t(null);m(c,()=>({clear(){u.current?.update(()=>{const e=ee();e.clear(),e.append(te())})},focus(){u.current?.focus()}}));const d={namespace:"RichTextInput",nodes:[cn,un,pn,hn,kn,Dn],editable:!s,editorState:n?()=>Cn(n,Oi):void 0,onError:e=>console.error("[RichTextInput]",e)};/* @__PURE__ */
14
- return e.createElement(rr,{initialConfig:d},/* @__PURE__ */e.createElement("div",{className:a},/* @__PURE__ */e.createElement("div",{className:"relative"},/* @__PURE__ */e.createElement(ai,{contentEditable:/* @__PURE__ */e.createElement(fi,{autoFocus:l,className:"outline-none w-full max-h-[7.5rem] overflow-y-auto [&_ul]:list-disc [&_ul]:pl-5 [&_ol]:list-decimal [&_ol]:pl-5 [&_p]:my-0 [&_ul]:my-0 [&_ol]:my-0 [&_pre]:my-0 [&_blockquote]:my-0"}),placeholder:i?/* @__PURE__ */e.createElement("div",{className:"pointer-events-none absolute top-0 left-0 select-none text-muted-foreground"},i):null,ErrorBoundary:_i}))),/* @__PURE__ */e.createElement(pi,null),/* @__PURE__ */e.createElement(gi,null),/* @__PURE__ */e.createElement(hi,null),/* @__PURE__ */e.createElement(Ci,{transformers:Oi}),r&&/* @__PURE__ */e.createElement(vi,{onChange:e=>{e.read(()=>{r(Sn(Oi))})}}),/* @__PURE__ */e.createElement(Ai,{onSubmit:o}),/* @__PURE__ */e.createElement(Ti,{editorRef:u}))}const Pi=u((t,n)=>/* @__PURE__ */e.createElement(Mi,{...t,forwardedRef:n}));Pi.displayName="RichTextInput";function Ii(e,t){return!t||0===t.length||t.some(t=>t.startsWith(".")?e.name.toLowerCase().endsWith(t.toLowerCase()):t.endsWith("/*")?e.type.startsWith(t.slice(0,-1)):e.type===t)}function Fi(e){switch(e.type){case"file":return{id:e.id,label:e.file.name,iconType:Vn(e.file.mimeType),loading:e.loading,progress:e.progress};case"page":return{id:e.id,label:e.page.title,iconType:"page"};case"entity":return{id:e.id,label:e.entity.title,iconType:e.entity.type}}}const Li=({placeholder:n="What can we help with today?",attachments:r=[],collections:o=[],pages:i=[],acceptedFileTypes:a,disabled:c=!1,isElevated:u=!1,className:d})=>{const{callbacks:f,isStreaming:m}=An(),[p,g]=l(!1),h=t(""),y=t(null),x=t(null),[E,b]=l(!1),w=t(0),[N,S]=l(!1),[C,k]=l(!1),D=t(null),R=t(!1),_=s(()=>{D.current&&(clearTimeout(D.current),D.current=null),k(!0)},[]),O=s(()=>{D.current=setTimeout(()=>{R.current||k(!1)},150)},[]),T=r.filter(e=>"file"===e.type&&e.file.mimeType.startsWith("image/")),L=r.filter(e=>!("file"===e.type&&e.file.mimeType.startsWith("image/"))),j=L.map(Fi),K=r.some(e=>"file"===e.type&&e.loading),Q=c||m||K,ee=o.length>0||i.length>0,te=s(e=>{const t=(e??h.current).trim();t&&!Q&&(f.onSend?.(t,r.length>0?r:void 0),y.current?.clear(),y.current?.focus())},[Q,f,r]),ne=s(()=>{f.onStop?.()},[f]),re=s(e=>{k(!1),S(!1),f.onAttachmentAdd?.({type:"select-entity",entity:{id:e.id,type:"collection",title:e.title,url:e.url}})},[f]),oe=s(()=>{i[0]&&(S(!1),f.onAttachmentAdd?.({type:"select-page",page:i[0]}))},[i,f]),ie=r.filter(e=>"file"===e.type).length,se=s(e=>{const t=e.slice(0,10-ie);t.length<e.length&&alert("You can only attach up to 10 files at a time."),t.length>0&&f.onAttachmentAdd?.({type:"add-files",files:t})},[ie,f]),ae=s(e=>{const t=Array.from(e.target.files??[]);e.target.value="",t.length>0&&se(t)},[se]),le=s(e=>{e.preventDefault(),w.current++,b(!0)},[]),ce=s(e=>{e.preventDefault(),w.current--,0===w.current&&b(!1)},[]),ue=s(e=>{e.preventDefault(),e.dataTransfer.dropEffect="copy"},[]),de=s(e=>{if(e.preventDefault(),w.current=0,b(!1),c||m)return;const t=Array.from(e.dataTransfer.files),n=t.filter(e=>Ii(e,a));t.length>0&&0===n.length?alert("That file type isn't supported. Please try a different format."):n.length>0&&se(n)},[c,m,a,se]),fe=s(e=>{if(c||m)return;const t=[];if(e.clipboardData.files.length>0)t.push(...Array.from(e.clipboardData.files));else for(const r of Array.from(e.clipboardData.items))if("file"===r.kind){const e=r.getAsFile();e&&t.push(e)}const n=t.filter(e=>Ii(e,a));if(t.length>0&&0===n.length)return e.preventDefault(),e.stopPropagation(),void alert("That file type isn't supported. Please try a different format.");n.length>0&&(e.preventDefault(),e.stopPropagation(),se(n))},[c,m,a,se]);/* @__PURE__ */
15
- return e.createElement("div",{className:v("w-full",d)},/* @__PURE__ */e.createElement("input",{ref:x,type:"file",multiple:!0,accept:a?.join(","),className:"sr-only",onChange:ae}),/* @__PURE__ */e.createElement("div",{className:v("relative w-full rounded-t-2xl rounded-b-lg bg-gradient-yellowfin p-2 transition-shadow duration-300",u&&"shadow-[0_-20px_25px_-5px_rgba(0,0,0,0.1),0_-8px_10px_-6px_rgba(0,0,0,0.1)]")},
16
- /* @__PURE__ */e.createElement("div",{className:"relative w-full rounded-t-lg rounded-b bg-surface shadow-md",onDragEnter:le,onDragLeave:ce,onDragOver:ue,onDrop:de,onPasteCapture:fe},E&&/* @__PURE__ */e.createElement("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded-t-lg rounded-b pointer-events-none",style:{backgroundColor:"color-mix(in srgb, var(--bfc-surface) 90%, transparent)"}},
13
+ return e.createElement(Gn,{message:t,className:n});default:return null}},Zn=({className:n,bottomPadding:r=0,onContentBehind:o})=>{const{messages:i}=An(),s=t(null),l=t(null);return a(()=>{const e=s.current;e&&(e.scrollTop=e.scrollHeight)},[i]),a(()=>{const e=l.current,t=s.current;if(!e||!t||!o)return;const n=new IntersectionObserver(([e])=>{e&&o(!e.isIntersecting)},{root:t,threshold:0,rootMargin:`0px 0px -${r}px 0px`});return n.observe(e),()=>n.disconnect()},[o,r]),/* @__PURE__ */e.createElement(x,{ref:s,className:v("h-full",n)},/* @__PURE__ */e.createElement("div",{className:"px-6"},i.map(t=>/* @__PURE__ */e.createElement(Yn,{key:t.id,message:t})),/* @__PURE__ */e.createElement("div",{ref:l,className:"h-px"})),/* @__PURE__ */e.createElement("div",{style:{height:r+8}}))},Xn=i(null);function Qn(){const e=o(Xn);return null==e&&function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const o of t)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),e}const er="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,tr=er?n:a,nr={tag:re};function rr({initialConfig:e,children:t}){const n=r(()=>{const{theme:t,namespace:n,nodes:r,onError:o,editorState:i,html:s}=e,a=(c=t,{getTheme:function(){return null!=c?c:null}}),l=Q({editable:e.editable,html:s,namespace:n,nodes:r,onError:e=>o(e,l),theme:t});var c;return function(e,t){if(null!==t)if(void 0===t)e.update(()=>{const t=ee();if(t.isEmpty()){const n=te();t.append(n);const r=er?document.activeElement:null;(null!==ne()||null!==r&&r===e.getRootElement())&&n.select()}},nr);else if(null!==t)switch(typeof t){case"string":{const n=e.parseEditorState(t);e.setEditorState(n,nr);break}case"object":e.setEditorState(t,nr);break;case"function":e.update(()=>{ee().isEmpty()&&t(e)},nr)}}(l,i),[l,a]},[]);return tr(()=>{const t=e.editable,[r]=n;r.setEditable(void 0===t||t)},[]),tn(Xn.Provider,{value:n,children:t})}const or="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:a;function ir(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}const sr=new Map;function ar(e){const t=ue().getElementByKey(e.getKey());if(null===t)return null;const n=t.ownerDocument.defaultView;return null===n?null:n.getComputedStyle(t)}function lr(e){return ar(de(e)?e:e.getParentOrThrow())}function cr(e){const t=lr(e);return null!==t&&"rtl"===t.direction}function dr(e,t,n="self"){const r=e.getStartEndPoints();if(t.isSelected(e)&&!fe(t)&&null!==r){const[o,i]=r,s=e.isBackward(),a=o.getNode(),l=i.getNode(),c=t.is(a),d=t.is(l);if(c||d){const[r,o]=me(e),i=a.is(l),c=t.is(s?l:a),d=t.is(s?a:l);let u,f=0;i?(f=r>o?o:r,u=r>o?r:o):c?(f=s?o:r,u=void 0):d&&(f=0,u=s?r:o);const m=t.__text.slice(f,u);m!==t.__text&&("clone"===n&&(t=pe(t)),t.__text=m)}}return t}function ur(e){const t=e.getStyle(),n=function(e){const t={};if(!e)return t;const n=e.split(";");for(const r of n)if(""!==r){const[e,n]=r.split(/:([^]+)/);e&&n&&(t[e.trim()]=n.trim())}return t}(t);sr.set(t,n)}function fr(e){const t=mr(e);return null!==t&&"vertical-rl"===t.writingMode}function mr(e){const t=e.anchor.getNode();return le(t)?ar(t):lr(t)}function pr(e,t){let n=fr(e)?!t:t;gr(e)&&(n=!n);const r=oe(e.focus,n?"previous":"next");if(ie(r))return!1;for(const o of se(r)){if(ae(o))return!o.origin.isInline();if(!le(o.origin)){if(ce(o.origin))return!0;break}}return!1}function gr(e){const t=mr(e);return null!==t&&"rtl"===t.direction}function hr(e,t,n){const r=gr(e);let o;o=fr(e)||r?!n:n,function(e,t,n,r){e.modify(t?"extend":"move",n,r)}(e,t,o,"character")}const yr="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,vr=yr&&"documentMode"in document?document.documentMode:null;function xr(e){const t=he(e,e=>le(e)&&!e.isInline());return le(t)||function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const o of t)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(4,e.__key),t}function Er(e,t){return null!==e&&Object.getPrototypeOf(e).constructor.name===t.name}function br(e){const t=ne();if(!ge(t))return!1;const n=new Set,r=t.getNodes();for(let o=0;o<r.length;o++){const t=r[o],i=t.getKey();if(n.has(i))continue;const s=he(t,e=>le(e)&&!e.isInline());if(null===s)continue;const a=s.getKey();s.canIndent()&&!n.has(a)&&(n.add(a),e(s))}return n.size>0}yr&&"InputEvent"in window&&!vr&&new window.InputEvent("input");const wr=Symbol.for("preact-signals");function Nr(){if(Dr>1)return void Dr--;let e,t=!1;for(;void 0!==Cr;){let n=Cr;for(Cr=void 0,Rr++;void 0!==n;){const r=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&Mr(n))try{n.c()}catch(_i){t||(e=_i,t=!0)}n=r}}if(Rr=0,Dr--,t)throw e}let Sr,Cr;function kr(e){const t=Sr;Sr=void 0;try{return e()}finally{Sr=t}}let Dr=0,Rr=0,_r=0;function Or(e){if(void 0===Sr)return;let t=e.n;return void 0===t||t.t!==Sr?(t={i:0,S:e,p:Sr.s,n:void 0,t:Sr,e:void 0,x:void 0,r:t},void 0!==Sr.s&&(Sr.s.n=t),Sr.s=t,e.n=t,32&Sr.f&&e.S(t),t):-1===t.i?(t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=Sr.s,t.n=void 0,Sr.s.n=t,Sr.s=t),t):void 0}function Tr(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function Ar(e,t){return new Tr(e,t)}function Mr(e){for(let t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Pr(e){for(let t=e.s;void 0!==t;t=t.n){const n=t.S.n;if(void 0!==n&&(t.r=n),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function Ir(e){let t,n=e.s;for(;void 0!==n;){const e=n.p;-1===n.i?(n.S.U(n),void 0!==e&&(e.n=n.n),void 0!==n.n&&(n.n.p=e)):t=n,n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=e}e.s=t}function Fr(e,t){Tr.call(this,void 0),this.x=e,this.s=void 0,this.g=_r-1,this.f=4,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function Lr(e){const t=e.u;if(e.u=void 0,"function"==typeof t){Dr++;const n=Sr;Sr=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,jr(e),t}finally{Sr=n,Nr()}}}function jr(e){for(let t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Lr(e)}function Kr(e){if(Sr!==this)throw new Error("Out-of-order effect");Ir(this),Sr=e,this.f&=-2,8&this.f&&jr(this),Nr()}function zr(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=null==t?void 0:t.name}function Br(e,t){const n=new zr(e,t);try{n.c()}catch(e){throw n.d(),e}const r=n.d.bind(n);return r[Symbol.dispose]=r,r}function $r(e,t={}){const n={};for(const r in e){const o=t[r],i=Ar(void 0===o?e[r]:o);n[r]=i}return n}function Ur(){const e=ee(),t=ne(),n=te();e.clear(),e.append(n),null!==t&&n.select(),ge(t)&&(t.format=0)}function Wr(e){return("function"==typeof e.nodes?e.nodes():e.nodes)||[]}Tr.prototype.brand=wr,Tr.prototype.h=function(){return!0},Tr.prototype.S=function(e){const t=this.t;t!==e&&void 0===e.e&&(e.x=t,this.t=e,void 0!==t?t.e=e:kr(()=>{var e;null==(e=this.W)||e.call(this)}))},Tr.prototype.U=function(e){if(void 0!==this.t){const t=e.e,n=e.x;void 0!==t&&(t.x=n,e.e=void 0),void 0!==n&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,void 0===n&&kr(()=>{var e;null==(e=this.Z)||e.call(this)}))}},Tr.prototype.subscribe=function(e){return Br(()=>{const t=this.value,n=Sr;Sr=void 0;try{e(t)}finally{Sr=n}},{name:"sub"})},Tr.prototype.valueOf=function(){return this.value},Tr.prototype.toString=function(){return this.value+""},Tr.prototype.toJSON=function(){return this.value},Tr.prototype.peek=function(){const e=Sr;Sr=void 0;try{return this.value}finally{Sr=e}},Object.defineProperty(Tr.prototype,"value",{get(){const e=Or(this);return void 0!==e&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Rr>100)throw new Error("Cycle detected");this.v=e,this.i++,_r++,Dr++;try{for(let e=this.t;void 0!==e;e=e.x)e.t.N()}finally{Nr()}}}}),Fr.prototype=new Tr,Fr.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===_r)return!0;if(this.g=_r,this.f|=1,this.i>0&&!Mr(this))return this.f&=-2,!0;const e=Sr;try{Pr(this),Sr=this;const e=this.x();(16&this.f||this.v!==e||0===this.i)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return Sr=e,Ir(this),this.f&=-2,!0},Fr.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(let e=this.s;void 0!==e;e=e.n)e.S.S(e)}Tr.prototype.S.call(this,e)},Fr.prototype.U=function(e){if(void 0!==this.t&&(Tr.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(let e=this.s;void 0!==e;e=e.n)e.S.U(e)}},Fr.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(Fr.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const e=Or(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),zr.prototype.c=function(){const e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;const e=this.x();"function"==typeof e&&(this.u=e)}finally{e()}},zr.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Lr(this),Pr(this),Dr++;const e=Sr;return Sr=this,Kr.bind(this,e)},zr.prototype.N=function(){2&this.f||(this.f|=2,this.o=Cr,Cr=this)},zr.prototype.d=function(){this.f|=8,1&this.f||jr(this)},zr.prototype.dispose=function(){this.d()},we({build:(e,t,n)=>$r(t),config:Ne({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,n){const r=n.getOutput();return Br(()=>r.disabled.value?void 0:e.registerRootListener(t=>{e.focus(()=>{const e=document.activeElement;null===t||null!==e&&t.contains(e)||t.focus({preventScroll:!0})},{defaultSelection:r.defaultSelection.peek()})}))}}),we({build:(e,t,n)=>$r(t),config:Ne({$onClear:Ur}),name:"@lexical/extension/ClearEditor",register(e,t,n){const{$onClear:r}=n.getOutput();return Br(()=>function(e,t=Ur){return e.registerCommand(Ve,n=>(e.update(t),!0),He)}(e,r.value))}});const Jr=Se("format",{parse:e=>"number"==typeof e?e:0});let Vr=class extends ve{$config(){return this.config("decorator-text",{extends:ve,stateConfigs:[{flat:!0,stateConfig:Jr}]})}getFormat(){return ze(this,Jr)}getFormatFlags(e,t){return Be(this.getFormat(),e,t)}hasFormat(e){const t=$e[e];return 0!==(this.getFormat()&t)}setFormat(e){return Ue(this,Jr,e)}toggleFormat(e){const t=this.getFormat(),n=Be(t,e,null);return this.setFormat(n)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function Hr(e){return e instanceof Vr}function qr(e,t){let n;return Ar(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}we({name:"@lexical/extension/DecoratorText",nodes:()=>[Vr],register:(e,t,n)=>e.registerCommand(Ce,e=>{const t=ne();if(ke(t)||ge(t))for(const n of t.getNodes())Hr(n)&&n.toggleFormat(e);return!1},De)});const Gr=we({build:e=>qr(()=>e.getEditorState(),t=>e.registerUpdateListener(e=>{t.value=e.editorState})),name:"@lexical/extension/EditorState"});function Yr(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const o of t)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Zr(e,t){if(e&&t&&!Array.isArray(t)&&"object"==typeof e&&"object"==typeof t){const n=e,r=t;for(const e in r)n[e]=Zr(n[e],r[e]);return e}return t}function Xr(e){return 0===e.id}function Qr(e){return 2===e.id}const eo=new Set;class to{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:0}}mergeConfigs(){let e=this.extension.config||{};const t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):Ee;for(const n of this.configs)e=t(e,n);return e}init(e){const t=this.state;Qr(t)||Yr(306,String(t.id));const n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},o=function(e,t,n){return Object.assign(e,{config:t,id:3,registerState:n})}(t,this.mergeConfigs(),n);let i;this.state=o,this.extension.init&&(i=this.extension.init(e,o.config,n)),this.state=function(e,t,n){return Object.assign(e,{id:4,initResult:t,registerState:n})}(o,i,r)}build(e){const t=this.state;let n;4!==t.id&&Yr(307,String(t.id),String(5)),this.extension.build&&(n=this.extension.build(e,t.config,t.registerState));const r={...t.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(e,t,n){return Object.assign(e,{id:5,output:t,registerState:n})}(t,n,r)}register(e,t){this._signal=t;const n=this.state;5!==n.id&&Yr(308,String(n.id),String(5));const r=this.extension.register&&this.extension.register(e,n.config,n.registerState);return this.state=function(e){return Object.assign(e,{id:6})}(n),()=>{const e=this.state;7!==e.id&&Yr(309,String(n.id),String(7)),this.state=function(e){return Object.assign(e,{id:5})}(e),r&&r()}}afterRegistration(e){const t=this.state;let n;return 6!==t.id&&Yr(310,String(t.id),String(6)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=function(e){return Object.assign(e,{id:7})}(t),n}getSignal(){return void 0===this._signal&&Yr(311),this._signal}getInitResult(){void 0===this.extension.init&&Yr(312,this.extension.name);const e=this.state;return function(e){return e.id>=4}(e)||Yr(313,String(e.id),String(4)),e.initResult}getInitPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionInitDependency():void 0}getExtensionInitDependency(){const e=this.state;return function(e){return e.id>=3}(e)||Yr(314,String(e.id),String(3)),{config:e.config}}getPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}getInitDependency(e){const t=this.builder.getExtensionRep(e);return void 0===t&&Yr(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){const t=this.builder.getExtensionRep(e);return void 0===t&&Yr(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){const e=this.state;return function(e){return e.id>=7}(e)||Yr(316,String(e.id),String(7)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||eo}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map(([e])=>e)),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){const e=this.state;(function(e){return e.id>=5})(e)||Yr(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}}const no={tag:re};function ro(){const e=ee();e.isEmpty()&&e.append(te())}const oo=we({config:Ne({setOptions:no,updateOptions:no}),init:({$initialEditorState:e=ro})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},r){const o=r.getInitResult();if(!o.initialized){o.initialized=!0;const{$initialEditorState:r}=o;if(Me(r))e.setEditorState(r,n);else if("function"==typeof r)e.update(()=>{r(e)},t);else if(r&&("string"==typeof r||"object"==typeof r)){const t=e.parseEditorState(r);e.setEditorState(t,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[Re,_e,Oe,Te,Ae]}),io=Symbol.for("@lexical/extension/LexicalBuilder");function so(){}function ao(e){throw e}function lo(e){return Array.isArray(e)?e:[e]}const co="0.41.0+prod.esm";class uo{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=co,this.roots=e;for(const t of e)this.addExtension(t)}static fromExtensions(e){const t=[lo(oo)];for(const n of e)t.push(lo(n));return new uo(t)}static maybeFromEditor(e){const t=e[io];return t&&(t.PACKAGE_VERSION!==co&&Yr(292,t.PACKAGE_VERSION,co),t instanceof uo||Yr(293)),t}static fromEditor(e){const t=uo.maybeFromEditor(e);return void 0===t&&Yr(294),t}constructEditor(){const{$initialEditorState:e,onError:t,...n}=this.buildCreateEditorArgs(),r=Object.assign(Q({...n,...t?{onError:e=>{t(e,r)}}:{}}),{[io]:this});for(const o of this.sortedExtensionReps())o.build(r);return r}buildEditor(){let e=so;function t(){try{e()}finally{e=so}}const n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=ye(this.registerEditor(n),()=>n.setRootElement(null)),n}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){const t=this.extensionNameMap.get(e.name);if(t)return t.extension!==e&&Yr(295,e.name),t}addEdge(e,t,n){const r=this.outgoingConfigEdges.get(e);r?r.set(t,n):this.outgoingConfigEdges.set(e,new Map([[t,n]]));const o=this.incomingEdges.get(t);o?o.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){void 0!==this._sortedExtensionReps&&Yr(296);const t=lo(e),[n]=t;"string"!=typeof n.name&&Yr(297,typeof n.name);let r=this.extensionNameMap.get(n.name);if(void 0!==r&&r.extension!==n&&Yr(298,n.name),!r){r=new to(this,n),this.extensionNameMap.set(n.name,r);const e=this.conflicts.get(n.name);"string"==typeof e&&Yr(299,n.name,e);for(const t of n.conflictsWith||[])this.extensionNameMap.has(t)&&Yr(299,n.name,t),this.conflicts.set(t,n.name);for(const t of n.dependencies||[]){const e=lo(t);this.addEdge(n.name,e[0].name,e.slice(1)),this.addExtension(e)}for(const[t,r]of n.peerDependencies||[])this.addEdge(n.name,t,r?[r]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const e=[],t=(n,r)=>{let o=n.state;if(Qr(o))return;const i=n.extension.name;var s;Xr(o)||Yr(300,i,r||"[unknown]"),Xr(s=o)||Yr(304,String(s.id),String(0)),o=Object.assign(s,{id:1}),n.state=o;const a=this.outgoingConfigEdges.get(i);if(a)for(const e of a.keys()){const n=this.extensionNameMap.get(e);n&&t(n,i)}o=function(e){return function(e){return 1===e.id}(e)||Yr(305,String(e.id),String(1)),Object.assign(e,{id:2})}(o),n.state=o,e.push(n)};for(const n of this.extensionNameMap.values())Xr(n.state)&&t(n);for(const n of e)for(const[e,t]of this.outgoingConfigEdges.get(n.extension.name)||[])if(t.length>0){const n=this.extensionNameMap.get(e);if(n)for(const e of t)n.configs.add(e)}for(const[n,...r]of this.roots)if(r.length>0){const e=this.extensionNameMap.get(n.name);void 0===e&&Yr(301,n.name);for(const t of r)e.configs.add(t)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){const t=this.sortedExtensionReps(),n=new AbortController,r=[()=>n.abort()],o=n.signal;for(const i of t){const t=i.register(e,o);t&&r.push(t)}for(const i of t){const t=i.afterRegistration(e);t&&r.push(t)}return ye(...r)}buildCreateEditorArgs(){const e={},t=new Set,n=new Map,r=new Map,o={},i={},s=this.sortedExtensionReps();for(const c of s){const{extension:s}=c;if(void 0!==s.onError&&(e.onError=s.onError),void 0!==s.disableEvents&&(e.disableEvents=s.disableEvents),void 0!==s.parentEditor&&(e.parentEditor=s.parentEditor),void 0!==s.editable&&(e.editable=s.editable),void 0!==s.namespace&&(e.namespace=s.namespace),void 0!==s.$initialEditorState&&(e.$initialEditorState=s.$initialEditorState),s.nodes)for(const e of Wr(s)){if("function"!=typeof e){const t=n.get(e.replace);t&&Yr(302,s.name,e.replace.name,t.extension.name),n.set(e.replace,c)}t.add(e)}if(s.html){if(s.html.export)for(const[e,t]of s.html.export.entries())r.set(e,t);s.html.import&&Object.assign(o,s.html.import)}s.theme&&Zr(i,s.theme)}Object.keys(i).length>0&&(e.theme=i),t.size&&(e.nodes=[...t]);const a=Object.keys(o).length>0,l=r.size>0;(a||l)&&(e.html={},a&&(e.html.import=o),l&&(e.html.export=r));for(const c of s)c.init(e);return e.onError||(e.onError=ao),e}}const fo=new Set,mo=we({build(e,t,n){const r=n.getDependency(Gr).output,o=Ar({watchedNodeKeys:new Map}),i=qr(()=>{},()=>Br(()=>{const e=i.peek(),{watchedNodeKeys:t}=o.value;let n,s=!1;r.value.read(()=>{if(ne())for(const[r,o]of t.entries()){if(0===o.size){t.delete(r);continue}const i=We(r),a=i&&i.isSelected()||!1;s=s||a!==(!!e&&e.has(r)),a&&(n=n||new Set,n.add(r))}}),!s&&n&&e&&n.size===e.size||(i.value=n)}));return{watchNodeKey:function(e){const t=function(e,t){return new Fr(e,t)}(()=>(i.value||fo).has(e)),{watchedNodeKeys:n}=o.peek();let r=n.get(e);const s=void 0!==r;return r=r||new Set,r.add(t),s||(n.set(e,r),o.value={watchedNodeKeys:n}),t}}},dependencies:[Gr],name:"@lexical/extension/NodeSelection"});Pe("INSERT_HORIZONTAL_RULE_COMMAND");class po extends ve{static getType(){return"horizontalrule"}static clone(e){return new po(e.__key)}static importJSON(e){return ho().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:go,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(e){const t=document.createElement("hr");return xe(t,e.theme.hr),t}getTextContent(){return"\n"}isInline(){return!1}updateDOM(){return!1}}function go(){return{node:ho()}}function ho(){return be(po)}function yo(e){return e instanceof po}function vo(e){return e.canBeEmpty()}we({dependencies:[Gr,mo],name:"@lexical/extension/HorizontalRule",nodes:()=>[po],register(e,t,n){const{watchNodeKey:r}=n.getDependency(mo).output,o=Ar({nodeSelections:new Map}),i=e._config.theme.hrSelected??"selected";return ye(e.registerCommand(Ie,e=>{if(Fe(e.target)){const t=Le(e.target);if(yo(t))return function(e,t=!1){const n=ne(),r=e.isSelected(),o=e.getKey();let i;t&&ke(n)?i=n:(i=je(),Ke(i)),r?i.delete(o):i.add(o)}(t,e.shiftKey),!0}return!1},De),e.registerMutationListener(po,(t,n)=>{!function(e){if(Dr>0)return e();Dr++;try{return e()}finally{Nr()}}(()=>{let n=!1;const{nodeSelections:i}=o.peek();for(const[o,s]of t.entries())if("destroyed"===s)i.delete(o),n=!0;else{const t=i.get(o),s=e.getElementByKey(o);t?t.domNode.value=s:(n=!0,i.set(o,{domNode:Ar(s),selectedSignal:r(o)}))}n&&(o.value={nodeSelections:i})})}),Br(()=>{const e=[];for(const{domNode:t,selectedSignal:n}of o.value.nodeSelections.values())e.push(Br(()=>{const e=t.value;e&&(n.value?xe(e,i):Je(e,i))}));return ye(...e)}))}}),we({build:(e,t,n)=>$r(t),config:Ne({$canIndent:vo,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,n){const{disabled:r,maxIndent:o,$canIndent:i}=n.getOutput();return Br(()=>{if(!r.value)return function(e,t,n=vo){return ye(e.registerCommand(qe,t=>{const n=ne();if(!ge(n))return!1;t.preventDefault();const r=function(e){if(e.getNodes().filter(e=>Ge(e)&&e.canIndent()).length>0)return!0;const t=e.anchor,n=e.focus,r=n.isBefore(t)?n:t,o=xr(r.getNode());if(o.canIndent()){const e=o.getKey();let t=Ye();if(t.anchor.set(e,0,"element"),t.focus.set(e,0,"element"),t=Ze(t),t.anchor.is(r))return!0}return!1}(n)?t.shiftKey?Xe:Qe:et;return e.dispatchCommand(r,void 0)},He),e.registerCommand(Qe,()=>{const e="number"==typeof t?t:t?t.peek():null,r=ne();if(!ge(r))return!1;const o="function"==typeof n?n:n.peek();return br(t=>{if(o(t)){const n=t.getIndent()+1;(!e||n<e)&&t.setIndent(n)}})},tt))}(e,o,i)})}});const xo=we({name:"@lexical/react/ReactProvider"});function Eo(e,t=!0){if(e)return!1;let n=ee().getTextContent();return t&&(n=n.trim()),""===n}function bo(e){return()=>function(e){if(!Eo(e,!1))return!1;const t=ee().getChildren(),n=t.length;if(n>1)return!1;for(let r=0;r<n;r++){const e=t[r];if(ce(e))return!1;if(le(e)){if(!nt(e))return!1;if(0!==e.__indent)return!1;const t=e.getChildren(),n=t.length;for(let e=0;e<n;e++){const e=t[r];if(!rt(e))return!1}}}return!0}(e)}function wo(e){const t=window.location.origin,n=n=>{if(n.origin!==t)return;const r=e.getRootElement();if(document.activeElement!==r)return;const o=n.data;if("string"==typeof o){let t;try{t=JSON.parse(o)}catch(e){return}if(t&&"nuanria_messaging"===t.protocol&&"request"===t.type){const r=t.payload;if(r&&"makeChanges"===r.functionId){const t=r.args;if(t){const[r,o,i,s,a]=t;e.update(()=>{const e=ne();if(ge(e)){const t=e.anchor;let l=t.getNode(),c=0,d=0;if(rt(l)&&r>=0&&o>=0&&(c=r,d=r+o,e.setTextNodeRange(l,c,l,d)),c===d&&""===i||(e.insertRawText(i),l=t.getNode()),rt(l)){c=s,d=s+a;const t=l.getTextContentSize();c=c>t?t:c,d=d>t?t:d,e.setTextNodeRange(l,c,l,d)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}const No=we({build:(e,t,n)=>$r(t),config:Ne({disabled:"undefined"==typeof window}),name:"@lexical/dragon",register:(e,t,n)=>Br(()=>n.getOutput().disabled.value?void 0:wo(e))});function So(e,t,n,r=null){let o=null===r||t.isSelected(r);const i=le(t)&&t.excludeFromCopy("html");let s=t;null!==r&&rt(t)&&(s=dr(r,t,"clone"));const a=le(s)?s.getChildren():[],l=dt(e,s.getType());let c;c=l&&void 0!==l.exportDOM?l.exportDOM(e,s):s.exportDOM(e);const{element:d,after:u}=c;if(!d)return!1;const f=document.createDocumentFragment();for(let m=0;m<a.length;m++){const n=a[m],i=So(e,n,f,r);!o&&le(t)&&i&&t.extractWithChild(n,r,"html")&&(o=!0)}if(o&&!i){if((ut(d)||ft(d))&&d.append(f),n.append(d),u){const e=u.call(s,d);e&&(ft(d)?d.replaceChildren(e):d.replaceWith(e))}}else n.append(f);return o}const Co=new Set(["STYLE","SCRIPT"]);function ko(e,t,n,r,o=new Map,i){let s=[];if(Co.has(e.nodeName))return s;let a=null;const l=function(e,t){const{nodeName:n}=e,r=t._htmlConversions.get(n.toLowerCase());let o=null;if(void 0!==r)for(const i of r){const t=i(e);null!==t&&(null===o||(o.priority||0)<=(t.priority||0))&&(o=t)}return null!==o?o.conversion:null}(e,t),c=l?l(e):null;let d=null;if(null!==c){d=c.after;const t=c.node;if(a=Array.isArray(t)?t[t.length-1]:t,null!==a){for(const[,e]of o)if(a=e(a,i),!a)break;a&&s.push(...Array.isArray(t)?t:[a])}null!=c.forChild&&o.set(e.nodeName,c.forChild)}const u=e.childNodes;let f=[];const m=(null==a||!at(a))&&(null!=a&&Ge(a)||r);for(let p=0;p<u.length;p++)f.push(...ko(u[p],t,n,m,new Map(o),a));return null!=d&&(f=d(f)),lt(e)&&(f=function(e,t,n){const r=e.style.textAlign,o=[];let i=[];for(let s=0;s<t.length;s++){const e=t[s];if(Ge(e))r&&!e.getFormat()&&e.setFormat(r),o.push(e);else if(i.push(e),s===t.length-1||s<t.length-1&&Ge(t[s+1])){const e=n();e.setFormat(r),e.append(...i),o.push(e),i=[]}}return o}(e,f,m?()=>{const e=new it;return n.push(e),e}:te)),null==a?f.length>0?s=s.concat(f):lt(e)&&function(e){return null!=e.nextSibling&&null!=e.previousSibling&&(ct(e.nextSibling)&&ct(e.previousSibling))}(e)&&(s=s.concat(st())):le(a)&&a.append(...f),s}function Do(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const o of t)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Ro(e,t,n){const r=e.getData("application/x-lexical-editor");if(r)try{const e=JSON.parse(r);if(e.namespace===n._config.namespace&&Array.isArray(e.nodes))return _o(n,function(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n],o=Et(r);rt(o)&&ur(o),t.push(o)}return t}(e.nodes),t)}catch(e){console.error(e)}const o=e.getData("text/html"),i=e.getData("text/plain");if(o&&i!==o)try{return _o(n,function(e,t){const n=ot(t)?t.body.childNodes:t.childNodes;let r=[];const o=[];for(const i of n)if(!Co.has(i.nodeName)){const t=ko(i,e,o,!1);null!==t&&(r=r.concat(t))}return function(e){for(const t of e)t.getNextSibling()instanceof it&&t.insertAfter(st());for(const t of e){const e=t.getChildren();for(const n of e)t.insertBefore(n);t.remove()}}(o),r}(n,(new DOMParser).parseFromString(function(e){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:e=>e}).createHTML(e):e}(o),"text/html")),t)}catch(e){console.error(e)}const s=i||e.getData("text/uri-list");if(null!=s)if(ge(t)){const e=s.split(/(\r?\n|\t)/);""===e[e.length-1]&&e.pop();for(let t=0;t<e.length;t++){const n=ne();if(ge(n)){const r=e[t];"\n"===r||"\r\n"===r?n.insertParagraph():"\t"===r?n.insertNodes([mt()]):n.insertText(r)}}}else t.insertRawText(s)}function _o(e,t,n){e.dispatchCommand(ht,{nodes:t,selection:n})||(n.insertNodes(t),function(e){if(ge(e)&&e.isCollapsed()){const t=e.anchor;let n=null;const r=oe(t,"previous");if(r)if(yt(r))n=r.origin;else{const e=vt(r,xt(ee(),"next").getFlipped());for(const t of e){if(rt(t.origin)){n=t.origin;break}if(le(t.origin)&&!t.origin.isInline())break}}if(n&&rt(n)){const t=n.getFormat(),r=n.getStyle();e.format===t&&e.style===r||(e.format=t,e.style=r,e.dirty=!0)}}}(n))}function Oo(e,t,n,r=[]){let o=null===t||n.isSelected(t);const i=le(n)&&n.excludeFromCopy("html");let s=n;null!==t&&rt(s)&&(s=dr(t,s,"clone"));const a=le(s)?s.getChildren():[],l=function(e){const t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&Do(58,n.name),le(e)){const e=t.children;Array.isArray(e)||Do(59,n.name)}return t}(s);rt(s)&&0===s.getTextContentSize()&&(o=!1);for(let c=0;c<a.length;c++){const r=a[c],i=Oo(e,t,r,l.children);!o&&le(n)&&i&&n.extractWithChild(r,t,"clone")&&(o=!0)}if(o&&!i)r.push(l);else if(Array.isArray(l.children))for(let c=0;c<l.children.length;c++){const e=l.children[c];r.push(e)}return o}let To=null;async function Ao(e,t,n){if(null!==To)return!1;if(null!==t)return new Promise((r,o)=>{e.update(()=>{r(Mo(e,t,n))})});const r=e.getRootElement(),o=e._window||window,i=o.document,s=pt(o);if(null===r||null===s)return!1;const a=i.createElement("span");a.style.cssText="position: fixed; top: -1000px;",a.append(i.createTextNode("#")),r.append(a);const l=new Range;return l.setStart(a,0),l.setEnd(a,1),s.removeAllRanges(),s.addRange(l),new Promise((t,r)=>{const s=e.registerCommand(gt,r=>(Er(r,ClipboardEvent)&&(s(),null!==To&&(o.clearTimeout(To),To=null),t(Mo(e,r,n))),!0),tt);To=o.setTimeout(()=>{s(),To=null,t(!1)},50),i.execCommand("copy"),a.remove()})}function Mo(e,t,n){if(void 0===n){const t=pt(e._window),r=ne();if(!r||r.isCollapsed())return!1;if(!t)return!1;const o=t.anchorNode,i=t.focusNode;if(null!==o&&null!==i&&!bt(e,o,i))return!1;n=function(e=ne()){const t={"text/plain":e?e.getTextContent():""};if(e){const n=ue();for(const[r,o]of Po){const i=o(n,e);null!==i&&(t[r]=i)}}return t}(r)}t.preventDefault();const r=t.clipboardData;return null!==r&&(function(e,t){for(const[n]of Po)void 0===t[n]&&e.setData(n,"");for(const n in t){const r=t[n];void 0!==r&&e.setData(n,r)}}(r,n),!0)}const Po=[["text/html",function(e,t=ne()){return null==t&&Do(166),ge(t)&&t.isCollapsed()||0===t.getNodes().length?"":function(e,t){if("undefined"==typeof document||"undefined"==typeof window&&void 0===global.window)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const n=document.createElement("div"),r=ee().getChildren();for(let o=0;o<r.length;o++)So(e,r[o],n,t);return n.innerHTML}(e,t)}],["application/x-lexical-editor",function(e,t=ne()){return null==t&&Do(166),ge(t)&&t.isCollapsed()||0===t.getNodes().length?null:JSON.stringify(function(e,t){const n=[],r=ee().getChildren();for(let o=0;o<r.length;o++)Oo(e,t,r[o],n);return{namespace:e._config.namespace,nodes:n}}(e,t))}]];function Io(e,t){if(void 0!==document.caretRangeFromPoint){const n=document.caretRangeFromPoint(e,t);return null===n?null:{node:n.startContainer,offset:n.startOffset}}if("undefined"!==document.caretPositionFromPoint){const n=document.caretPositionFromPoint(e,t);return null===n?null:{node:n.offsetNode,offset:n.offset}}return null}const Fo="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Lo=Fo&&"documentMode"in document?document.documentMode:null,jo=Fo&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ko=!(!Fo||!("InputEvent"in window)||Lo)&&"getTargetRanges"in new window.InputEvent("input"),zo=Fo&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Bo=Fo&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,$o=Fo&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Uo=Fo&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&jo&&!$o,Wo=Pe("DRAG_DROP_PASTE_FILE");class Jo extends Zt{static getType(){return"quote"}static clone(e){return new Jo(e.__key)}createDOM(e){const t=document.createElement("blockquote");return xe(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:Yo,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(ut(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e);const n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return Vo().updateFromJSON(e)}insertNewAfter(e,t){const n=te(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,t),n}collapseAtStart(){const e=te();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function Vo(){return Qt(new Jo)}class Ho extends Zt{__tag;static getType(){return"heading"}static clone(e){return new Ho(e.__tag,e.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}setTag(e){const t=this.getWritable();return this.__tag=e,t}createDOM(e){const t=this.__tag,n=document.createElement(t),r=e.theme.heading;if(void 0!==r){const e=r[t];xe(n,e)}return n}updateDOM(e,t,n){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:Go,priority:0}),h2:e=>({conversion:Go,priority:0}),h3:e=>({conversion:Go,priority:0}),h4:e=>({conversion:Go,priority:0}),h5:e=>({conversion:Go,priority:0}),h6:e=>({conversion:Go,priority:0}),p:e=>{const t=e.firstChild;return null!==t&&qo(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>qo(e)?{conversion:e=>({node:Zo("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(ut(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e);const n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return Zo(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,t=!0){const n=e?e.anchor.offset:0,r=this.getLastDescendant(),o=!r||e&&e.anchor.key===r.getKey()&&n===r.getTextContentSize()||!e?te():Zo(this.getTag()),i=this.getDirection();if(o.setDirection(i),this.insertAfter(o,t),0===n&&!this.isEmpty()&&e){const e=te();e.select(),this.replace(e,!0)}return o}collapseAtStart(){const e=this.isEmpty()?te():Zo(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function qo(e){return"span"===e.nodeName.toLowerCase()&&"26pt"===e.style.fontSize}function Go(e){const t=e.nodeName.toLowerCase();let n=null;return"h1"!==t&&"h2"!==t&&"h3"!==t&&"h4"!==t&&"h5"!==t&&"h6"!==t||(n=Zo(t),null!==e.style&&(Xt(e,n),n.setFormat(e.style.textAlign))),{node:n}}function Yo(e){const t=Vo();return null!==e.style&&(t.setFormat(e.style.textAlign),Xt(e,t)),{node:t}}function Zo(e="h1"){return Qt(new Ho(e))}function Xo(e){let t=null;if(Er(e,DragEvent)?t=e.dataTransfer:Er(e,ClipboardEvent)&&(t=e.clipboardData),null===t)return[!1,[],!1];const n=t.types,r=n.includes("Files"),o=n.includes("text/html")||n.includes("text/plain");return[r,Array.from(t.files),o]}function Qo(e){const t=Bt(e);return ce(t)}function ei(e){for(const t of["lowercase","uppercase","capitalize"])e.hasFormat(t)&&e.toggleFormat(t)}function ti(e){return ye(e.registerCommand(Ie,e=>{const t=ne();return!!ke(t)&&(t.clear(),!0)},He),e.registerCommand(wt,e=>{const t=ne();return ge(t)?(t.deleteCharacter(e),!0):!!ke(t)&&(t.deleteNodes(),!0)},He),e.registerCommand(Nt,e=>{const t=ne();return!!ge(t)&&(t.deleteWord(e),!0)},He),e.registerCommand(St,e=>{const t=ne();return!!ge(t)&&(t.deleteLine(e),!0)},He),e.registerCommand(Ct,t=>{const n=ne();if("string"==typeof t)null!==n&&n.insertText(t);else{if(null===n)return!1;const r=t.dataTransfer;if(null!=r)Ro(r,n,e);else if(ge(n)){const e=t.data;return e&&n.insertText(e),!0}}return!0},He),e.registerCommand(kt,()=>{const e=ne();return!!ge(e)&&(e.removeText(),!0)},He),e.registerCommand(Ce,e=>{const t=ne();return!!ge(t)&&(t.formatText(e),!0)},He),e.registerCommand(Dt,e=>{const t=ne();if(!ge(t)&&!ke(t))return!1;const n=t.getNodes();for(const r of n){const t=he(r,e=>le(e)&&!e.isInline());null!==t&&t.setFormat(e)}return!0},He),e.registerCommand(Rt,e=>{const t=ne();return!!ge(t)&&(t.insertLineBreak(e),!0)},He),e.registerCommand(_t,()=>{const e=ne();return!!ge(e)&&(e.insertParagraph(),!0)},He),e.registerCommand(et,()=>{const e=mt(),t=ne();return ge(t)&&(e.setFormat(t.format),e.setStyle(t.style)),Ot([e]),!0},He),e.registerCommand(Qe,()=>br(e=>{const t=e.getIndent();e.setIndent(t+1)}),He),e.registerCommand(Xe,()=>br(e=>{const t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}),He),e.registerCommand(Tt,e=>{const t=ne();if(ke(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}else if(ge(t)){const n=At(t.focus,!0);if(!e.shiftKey&&ce(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},He),e.registerCommand(Mt,e=>{const t=ne();if(ke(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectNext(0,0),!0}else if(ge(t)){if(function(e){const t=e.focus;return"root"===t.key&&t.offset===ee().getChildrenSize()}(t))return e.preventDefault(),!0;const n=At(t.focus,!1);if(!e.shiftKey&&ce(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},He),e.registerCommand(Pt,e=>{const t=ne();if(ke(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),cr(n[0])?n[0].selectNext(0,0):n[0].selectPrevious(),!0}if(!ge(t))return!1;if(pr(t,!0)){const n=e.shiftKey;return e.preventDefault(),hr(t,n,!0),!0}return!1},He),e.registerCommand(It,e=>{const t=ne();if(ke(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),cr(n[0])?n[0].selectPrevious():n[0].selectNext(0,0),!0}if(!ge(t))return!1;const n=e.shiftKey;return!!pr(t,!1)&&(e.preventDefault(),hr(t,n,!1),!0)},He),e.registerCommand(Ft,t=>{if(Qo(t.target))return!1;const n=ne();if(ge(n)){if(function(e){if(!e.isCollapsed())return!1;const{anchor:t}=e;if(0!==t.offset)return!1;const n=t.getNode();if(de(n))return!1;const r=xr(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(n))return t.preventDefault(),e.dispatchCommand(Xe,void 0);if(Bo&&"ko-KR"===navigator.language)return!1}else if(!ke(n))return!1;return t.preventDefault(),e.dispatchCommand(wt,!0)},He),e.registerCommand(Lt,t=>{if(Qo(t.target))return!1;const n=ne();return!(!ge(n)&&!ke(n))&&(t.preventDefault(),e.dispatchCommand(wt,!1))},He),e.registerCommand(jt,t=>{const n=ne();if(!ge(n))return!1;if(ei(n),null!==t){if((Bo||zo||Uo)&&Ko)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(Rt,!1)}return e.dispatchCommand(_t,void 0)},He),e.registerCommand(Kt,()=>{const t=ne();return!!ge(t)&&(e.blur(),!0)},He),e.registerCommand(zt,t=>{const[,n]=Xo(t);if(n.length>0){const r=Io(t.clientX,t.clientY);if(null!==r){const{offset:t,node:o}=r,i=Bt(o);if(null!==i){const e=Ye();if(rt(i))e.anchor.set(i.getKey(),t,"text"),e.focus.set(i.getKey(),t,"text");else{const t=i.getParentOrThrow().getKey(),n=i.getIndexWithinParent()+1;e.anchor.set(t,n,"element"),e.focus.set(t,n,"element")}const n=Ze(e);Ke(n)}e.dispatchCommand(Wo,n)}return t.preventDefault(),!0}const r=ne();return!!ge(r)},He),e.registerCommand($t,e=>{const[t]=Xo(e),n=ne();return!(t&&!ge(n))},He),e.registerCommand(Ut,e=>{const[t]=Xo(e),n=ne();if(t&&!ge(n))return!1;const r=Io(e.clientX,e.clientY);if(null!==r){const t=Bt(r.node);ce(t)&&e.preventDefault()}return!0},He),e.registerCommand(Wt,()=>(Jt(),!0),He),e.registerCommand(gt,t=>(Ao(e,Er(t,ClipboardEvent)?t:null),!0),He),e.registerCommand(Vt,t=>(async function(e,t){await Ao(t,Er(e,ClipboardEvent)?e:null),t.update(()=>{const e=ne();ge(e)?e.removeText():ke(e)&&e.getNodes().forEach(e=>e.remove())})}(t,e),!0),He),e.registerCommand(Ht,t=>{const[,n,r]=Xo(t);return n.length>0&&!r?(e.dispatchCommand(Wo,n),!0):(!Fe(t.target)||!qt(t.target))&&(null!==ne()&&(function(e,t){e.preventDefault(),t.update(()=>{const n=ne(),r=Er(e,InputEvent)||Er(e,KeyboardEvent)?null:e.clipboardData;null!=r&&null!==n&&Ro(r,n,t)},{tag:Gt})}(t,e),!0))},He),e.registerCommand(Yt,e=>{const t=ne();return ge(t)&&ei(t),!1},He),e.registerCommand(qe,e=>{const t=ne();return ge(t)&&ei(t),!1},He))}function ni(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const o of t)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}we({conflictsWith:["@lexical/plain-text"],dependencies:[No],name:"@lexical/rich-text",nodes:()=>[Ho,Jo],register:ti});const ri="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:a;function oi({editor:e,ErrorBoundary:t}){return function(e,t){const[n,o]=l(()=>e.getDecorators());return ri(()=>e.registerDecoratorListener(e=>{on(()=>{o(e)})}),[e]),a(()=>{o(e.getDecorators())},[e]),r(()=>{const r=[],o=Object.keys(n);for(let i=0;i<o.length;i++){const s=o[i],a=tn(t,{onError:t=>e._onError(t),children:tn(c,{fallback:null,children:n[s]})}),l=e.getElementByKey(s);null!==l&&r.push(sn(a,l,s))}return r},[t,n,e])}(e,t)}function ii({editor:e,ErrorBoundary:t}){return function(e){const t=uo.maybeFromEditor(e);if(t&&t.hasExtensionByName(xo.name)){for(const e of["@lexical/plain-text","@lexical/rich-text"])t.hasExtensionByName(e)&&ni(320,e);return!0}return!1}(e)?null:tn(oi,{editor:e,ErrorBoundary:t})}function si(e){return e.getEditorState().read(bo(e.isComposing()))}function ai({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){const[r]=Qn();return function(e){ri(()=>ye(ti(e),wo(e)),[e])}(r),nn(rn,{children:[e,tn(li,{content:t}),tn(ii,{editor:r,ErrorBoundary:n})]})}function li({content:e}){const[n]=Qn(),o=function(e){const[t,n]=l(()=>si(e));return ri(()=>{function t(){const t=si(e);n(t)}return t(),ye(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(n),i=function(e){const[n]=Qn(),o=r(()=>e(n),[n,e]),[i,s]=l(()=>o.initialValueFn()),a=t(i);return or(()=>{const{initialValueFn:e,subscribe:t}=o,n=e();return a.current!==n&&(a.current=n,s(n)),t(e=>{a.current=e,s(e)})},[o,e]),i}(ir);return o?"function"==typeof e?e(i):e:null}const ci="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:a;const di=d(function({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:o,ariaDescribedBy:i,ariaErrorMessage:a,ariaExpanded:c,ariaInvalid:d,ariaLabel:u,ariaLabelledBy:f,ariaMultiline:m,ariaOwns:p,ariaRequired:g,autoCapitalize:h,className:y,id:v,role:x="textbox",spellCheck:E=!0,style:b,tabIndex:w,"data-testid":N,...S},C){const[k,D]=l(e.isEditable()),R=s(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),_=r(()=>function(...e){return t=>{for(const n of e)"function"==typeof n?n(t):null!=n&&(n.current=t)}}(C,R),[R,C]);return ci(()=>(D(e.isEditable()),e.registerEditableListener(e=>{D(e)})),[e]),tn("div",{"aria-activedescendant":k?t:void 0,"aria-autocomplete":k?n:"none","aria-controls":k?o:void 0,"aria-describedby":i,...null!=a?{"aria-errormessage":a}:{},"aria-expanded":k&&"combobox"===x?!!c:void 0,...null!=d?{"aria-invalid":d}:{},"aria-label":u,"aria-labelledby":f,"aria-multiline":m,"aria-owns":k?p:void 0,"aria-readonly":!k||void 0,"aria-required":g,autoCapitalize:h,className:y,contentEditable:k,"data-testid":N,id:v,ref:_,role:x,spellCheck:E,style:b,tabIndex:w,...S})});function ui(e){return e.getEditorState().read(bo(e.isComposing()))}const fi=d(function(e,t){const{placeholder:n,...r}=e,[o]=Qn();return nn(rn,{children:[tn(di,{editor:o,...r,ref:t}),null!=n&&tn(mi,{editor:o,content:n})]})});function mi({content:e,editor:t}){const r=function(e){const[t,n]=l(()=>ui(e));return ci(()=>{function t(){const t=ui(e);n(t)}return t(),ye(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),[o,i]=l(t.isEditable());if(n(()=>(i(t.isEditable()),t.registerEditableListener(e=>{i(e)})),[t]),!r)return null;let s=null;return"function"==typeof e?s=e(o):null!==e&&(s=e),null===s?null:tn("div",{"aria-hidden":!0,children:s})}function pi({delay:e,externalHistoryState:t}){const[n]=Qn();return function(e,t,n=1e3){const o=r(()=>t||an(),[t]);a(()=>ln(e,o,n),[n,e,o])}(n,t,e),null}function gi({hasStrictIndent:e=!1,shouldPreserveNumbering:t=!1}){const[n]=Qn();return a(()=>{if(!n.hasNodes([cn,dn]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[n]),a(()=>ye(un(n,{restoreNumbering:t}),e?fn(n):()=>{}),[n,e,t]),a(()=>un(r),[r=n]),null;var r}function hi({validateUrl:e,attributes:t}){const[n]=Qn();return a(()=>{if(!n.hasNodes([pn]))throw new Error("LinkPlugin: LinkNode not registered on editor")}),a(()=>gn(n,$r({attributes:t,validateUrl:e})),[n,e,t]),null}const yi="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:a;function vi({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){const[r]=Qn();return yi(()=>{if(n)return r.registerUpdateListener(({editorState:o,dirtyElements:i,dirtyLeaves:s,prevEditorState:a,tags:l})=>{t&&0===i.size&&0===s.size||e&&l.has(re)||a.isEmpty()||n(o,r,l)})},[r,e,t,n]),null}function xi(e,t){return e.getEditorState().read(()=>{const e=We(t);return null!==e&&e.isSelected()})}function Ei({nodeKey:e}){const[t]=Qn(),[n,r,o]=function(e){const[t]=Qn(),[n,r]=l(()=>xi(t,e));return a(()=>{let n=!0;const o=t.registerUpdateListener(()=>{n&&r(xi(t,e))});return()=>{n=!1,o()}},[t,e]),[n,s(n=>{t.update(()=>{let t=ne();ke(t)||(t=je(),Ke(t)),ke(t)&&(n?t.add(e):t.delete(e))})},[t,e]),s(()=>{t.update(()=>{const e=ne();ke(e)&&e.clear()})},[t])]}(e);return a(()=>ye(t.registerCommand(Ie,i=>{const s=t.getElementByKey(e);return i.target===s&&(i.shiftKey||o(),r(!n),!0)},De)),[o,t,n,e,r]),a(()=>{const r=t.getElementByKey(e),o=t._config.theme.hrSelected??"selected";null!==r&&(n?xe(r,o):Je(r,o))},[t,n,e]),null}class bi extends po{static getType(){return"horizontalrule"}static clone(e){return new bi(e.__key)}static importJSON(e){return Ni().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:wi,priority:0})}}decorate(){return tn(Ei,{nodeKey:this.__key})}}function wi(){return{node:Ni()}}function Ni(){return Qt(new bi)}const Si=[{dependencies:[bi],export:e=>yo(e)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(e,t,n,r)=>{const o=Ni();r||null!=e.getNextSibling()?e.replace(o):e.insertBefore(o),o.selectNext()},type:"element"},...vn];function Ci({transformers:e=Si}){const[t]=Qn();return a(()=>yn(t,e),[t,e]),null}const ki=i(null),Di={didCatch:!1,error:null};class Ri extends u{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Di}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){const{error:t}=this.state;null!==t&&(this.props.onReset?.({args:e,reason:"imperative-api"}),this.setState(Di))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){const{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&null!==t.error&&function(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:"keys"}),this.setState(Di))}render(){const{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:o,error:i}=this.state;let s=e;if(o){const e={error:i,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)s=t(e);else if(n)s=f(n,e);else{if(void 0===r)throw i;s=r}}return f(ki.Provider,{value:{didCatch:o,error:i,resetErrorBoundary:this.resetErrorBoundary}},s)}}function _i({children:e,onError:t}){return tn(Ri,{fallback:tn("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}const Oi=[xn,En,bn,wn,Nn];function Ti({editorRef:e}){const[t]=Qn();return a(()=>(e.current=t,()=>{e.current=null}),[t,e]),null}function Ai({onSubmit:e}){const[t]=Qn();return a(()=>t.registerCommand(jt,n=>{if(n.shiftKey)return!1;const r=ne();if(ge(r)){const e=r.anchor.getNode();if(mn(e)||mn(e.getParent()))return!1;if(Rn(e)||Rn(e.getParent()))return!1}return n.preventDefault(),t.read(()=>{e?.(Sn(Oi))}),!0},en),[t,e]),null}function Mi({defaultValue:n,onChange:r,onSubmit:o,placeholder:i,disabled:s,className:a,autoFocus:l,forwardedRef:c}){const d=t(null);m(c,()=>({clear(){d.current?.update(()=>{const e=ee();e.clear(),e.append(te())})},focus(){d.current?.focus()}}));const u={namespace:"RichTextInput",nodes:[cn,dn,pn,hn,kn,Dn],editable:!s,editorState:n?()=>Cn(n,Oi):void 0,onError:e=>console.error("[RichTextInput]",e)};/* @__PURE__ */
14
+ return e.createElement(rr,{initialConfig:u},/* @__PURE__ */e.createElement("div",{className:a},/* @__PURE__ */e.createElement("div",{className:"relative"},/* @__PURE__ */e.createElement(ai,{contentEditable:/* @__PURE__ */e.createElement(fi,{autoFocus:l,className:"outline-none w-full max-h-[7.5rem] overflow-y-auto [&_ul]:list-disc [&_ul]:pl-5 [&_ol]:list-decimal [&_ol]:pl-5 [&_p]:my-0 [&_ul]:my-0 [&_ol]:my-0 [&_pre]:my-0 [&_blockquote]:my-0"}),placeholder:i?/* @__PURE__ */e.createElement("div",{className:"pointer-events-none absolute top-0 left-0 select-none text-muted-foreground"},i):null,ErrorBoundary:_i}))),/* @__PURE__ */e.createElement(pi,null),/* @__PURE__ */e.createElement(gi,null),/* @__PURE__ */e.createElement(hi,null),/* @__PURE__ */e.createElement(Ci,{transformers:Oi}),r&&/* @__PURE__ */e.createElement(vi,{onChange:e=>{e.read(()=>{r(Sn(Oi))})}}),/* @__PURE__ */e.createElement(Ai,{onSubmit:o}),/* @__PURE__ */e.createElement(Ti,{editorRef:d}))}const Pi=d((t,n)=>/* @__PURE__ */e.createElement(Mi,{...t,forwardedRef:n}));Pi.displayName="RichTextInput";function Ii(e,t){return!t||0===t.length||t.some(t=>t.startsWith(".")?e.name.toLowerCase().endsWith(t.toLowerCase()):t.endsWith("/*")?e.type.startsWith(t.slice(0,-1)):e.type===t)}function Fi(e){switch(e.type){case"file":return{id:e.id,label:e.file.name,iconType:Vn(e.file.mimeType),loading:e.loading,progress:e.progress};case"page":return{id:e.id,label:e.page.title,iconType:"page"};case"entity":return{id:e.id,label:e.entity.title,iconType:e.entity.type}}}const Li=({placeholder:n="What can we help with today?",attachments:r=[],collections:o=[],pages:i=[],acceptedFileTypes:a,disabled:c=!1,isElevated:d=!1,className:u})=>{const{callbacks:f,isStreaming:m}=An(),[p,g]=l(!1),h=t(""),y=t(null),x=t(null),[E,b]=l(!1),w=t(0),[N,S]=l(!1),[C,k]=l(!1),D=t(null),R=t(!1),_=s(()=>{D.current&&(clearTimeout(D.current),D.current=null),k(!0)},[]),O=s(()=>{D.current=setTimeout(()=>{R.current||k(!1)},150)},[]),T=r.filter(e=>"file"===e.type&&e.file.mimeType.startsWith("image/")),L=r.filter(e=>!("file"===e.type&&e.file.mimeType.startsWith("image/"))),j=L.map(Fi),K=r.some(e=>"file"===e.type&&e.loading),Q=c||m||K,ee=o.length>0||i.length>0,te=s(e=>{const t=(e??h.current).trim();t&&!Q&&(f.onSend?.(t,r.length>0?r:void 0),y.current?.clear(),y.current?.focus())},[Q,f,r]),ne=s(()=>{f.onStop?.()},[f]),re=s(e=>{k(!1),S(!1),f.onAttachmentAdd?.({type:"select-entity",entity:{id:e.id,type:"collection",title:e.title,url:e.url}})},[f]),oe=s(()=>{i[0]&&(S(!1),f.onAttachmentAdd?.({type:"select-page",page:i[0]}))},[i,f]),ie=r.filter(e=>"file"===e.type).length,se=s(e=>{const t=e.slice(0,10-ie);t.length<e.length&&alert("You can only attach up to 10 files at a time."),t.length>0&&f.onAttachmentAdd?.({type:"add-files",files:t})},[ie,f]),ae=s(e=>{const t=Array.from(e.target.files??[]);e.target.value="",t.length>0&&se(t)},[se]),le=s(e=>{e.preventDefault(),w.current++,b(!0)},[]),ce=s(e=>{e.preventDefault(),w.current--,0===w.current&&b(!1)},[]),de=s(e=>{e.preventDefault(),e.dataTransfer.dropEffect="copy"},[]),ue=s(e=>{if(e.preventDefault(),w.current=0,b(!1),c||m)return;const t=Array.from(e.dataTransfer.files),n=t.filter(e=>Ii(e,a));t.length>0&&0===n.length?alert("That file type isn't supported. Please try a different format."):n.length>0&&se(n)},[c,m,a,se]),fe=s(e=>{if(c||m)return;const t=[];if(e.clipboardData.files.length>0)t.push(...Array.from(e.clipboardData.files));else for(const r of Array.from(e.clipboardData.items))if("file"===r.kind){const e=r.getAsFile();e&&t.push(e)}const n=t.filter(e=>Ii(e,a));if(t.length>0&&0===n.length)return e.preventDefault(),e.stopPropagation(),void alert("That file type isn't supported. Please try a different format.");n.length>0&&(e.preventDefault(),e.stopPropagation(),se(n))},[c,m,a,se]);/* @__PURE__ */
15
+ return e.createElement("div",{className:v("w-full",u)},/* @__PURE__ */e.createElement("input",{ref:x,type:"file",multiple:!0,accept:a?.join(","),className:"sr-only",onChange:ae}),/* @__PURE__ */e.createElement("div",{className:v("relative w-full rounded-t-2xl rounded-b-lg bg-gradient-yellowfin p-2 transition-shadow duration-300",d&&"shadow-[0_-20px_25px_-5px_rgba(0,0,0,0.1),0_-8px_10px_-6px_rgba(0,0,0,0.1)]")},
16
+ /* @__PURE__ */e.createElement("div",{className:"relative w-full rounded-t-lg rounded-b bg-surface shadow-md",onDragEnter:le,onDragLeave:ce,onDragOver:de,onDrop:ue,onPasteCapture:fe},E&&/* @__PURE__ */e.createElement("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded-t-lg rounded-b pointer-events-none",style:{backgroundColor:"color-mix(in srgb, var(--bfc-surface) 90%, transparent)"}},
17
17
  /* @__PURE__ */e.createElement("div",{className:"flex flex-col items-center gap-1.5"},/* @__PURE__ */e.createElement(A,{className:"h-5 w-5 text-muted-foreground"}),/* @__PURE__ */e.createElement("span",{className:"text-sm text-muted-foreground"},"Drop files here"))),
18
18
  /* @__PURE__ */e.createElement(Wn,{attachments:T,onRemove:e=>f.onAttachmentRemove?.(e),className:"px-3 pt-3"}),j.length>0&&/* @__PURE__ */e.createElement("div",{className:"flex flex-wrap gap-1.5 px-3 pt-3"},j.map(t=>{const n=L.find(e=>e.id===t.id);/* @__PURE__ */
19
19
  return e.createElement(Bn,{key:t.id,pill:t,onRemove:n?()=>f.onAttachmentRemove?.(n):void 0})})),
@@ -25,5 +25,5 @@ return e.createElement(Bn,{key:t.id,pill:t,onRemove:n?()=>f.onAttachmentRemove?.
25
25
  /* @__PURE__ */e.createElement(U,{className:"p-2",onSelect:()=>x.current?.click()},"Add image or file"))):/* @__PURE__ */e.createElement("button",{type:"button",className:"inline-flex h-6 w-6 items-center justify-center rounded text-default hover:bg-muted transition-all",disabled:c||m,onClick:()=>x.current?.click()},
26
26
  /* @__PURE__ */e.createElement(M,{className:"h-4 w-4"}))),m?/* @__PURE__ */e.createElement("button",{type:"button",className:"inline-flex h-6 w-6 items-center justify-center rounded transition-colors bg-input text-primary-foreground hover:bg-input/90",onClick:ne,disabled:c},
27
27
  /* @__PURE__ */e.createElement(I,{className:"h-4 w-4",weight:"fill"})):/* @__PURE__ */e.createElement("button",{type:"button",className:v("inline-flex h-6 w-6 items-center justify-center rounded transition-colors",p&&!K?"bg-input text-primary-foreground hover:bg-input/90":"bg-muted text-muted-foreground"),onClick:()=>te(),disabled:Q||!p},
28
- /* @__PURE__ */e.createElement(F,{className:"h-4 w-4",weight:"bold"}))))))},ji=({items:t,className:n})=>{const{callbacks:r}=An();return 0===t.length?null:/* @__PURE__ */e.createElement("div",{className:v("flex flex-wrap justify-end gap-2 px-4 py-2",n)},t.map(t=>/* @__PURE__ */e.createElement("button",{key:t.id,type:"button",className:"rounded-full border border-border px-4 py-2 text-sm text-foreground hover:bg-muted transition-colors",onClick:()=>r.onSuggestionClick?.(t)},t.text)))},Ki=({actions:t,onActionClick:n,className:r})=>0===t.length?null:/* @__PURE__ */e.createElement("div",{className:v("flex flex-wrap gap-2 px-4 py-2",r)},t.map(t=>/* @__PURE__ */e.createElement("button",{key:t.id,type:"button",className:"inline-flex items-center gap-2 rounded-full border border-border px-4 py-2 text-sm text-foreground hover:bg-muted transition-colors",onClick:()=>n?.(t)},t.label,t.description&&/* @__PURE__ */e.createElement("span",{className:"text-muted-foreground"},t.description)))),zi=()=>/* @__PURE__ */e.createElement("div",{className:"flex items-center justify-center gap-1 text-[0.625rem] text-subtle"},/* @__PURE__ */e.createElement("span",null,"Powered by"),/* @__PURE__ */e.createElement(_n,{variant:"full",color:"outline",className:"h-2.5 w-auto"})),Bi=Object.assign(({messages:n,callbacks:r,children:o,suggestions:i=[],actions:s=[],placeholder:c,attachments:u,collections:d,pages:f,acceptedFileTypes:m,showBranding:p=!1,className:g})=>{const h=!!o,x=t(null),[E,b]=l(0),[w,N]=l(!1);return a(()=>{const e=x.current;if(!e)return;const t=new ResizeObserver(([e])=>{e&&b(e.borderBoxSize[0]?.blockSize??e.contentRect.height)});return t.observe(e),()=>t.disconnect()},[]),/* @__PURE__ */e.createElement(y,null,/* @__PURE__ */e.createElement(Mn,{messages:n,callbacks:r},/* @__PURE__ */e.createElement("div",{className:v("flex h-full flex-col pb-4",g)},h?o:/* @__PURE__ */e.createElement(e.Fragment,null,/* @__PURE__ */e.createElement("div",{className:"relative min-h-0 flex-1 grid grid-rows-[1fr] grid-cols-[1fr]"},/* @__PURE__ */e.createElement("div",{className:"row-start-1 col-start-1 min-h-0"},/* @__PURE__ */e.createElement(Zn,{bottomPadding:E,onContentBehind:N})),/* @__PURE__ */e.createElement("div",{ref:x,className:"row-start-1 col-start-1 self-end z-10 pointer-events-none px-4"},/* @__PURE__ */e.createElement("div",{className:"pointer-events-auto"},i.length>0&&/* @__PURE__ */e.createElement(ji,{items:i}),s.length>0&&/* @__PURE__ */e.createElement(Ki,{actions:s,onActionClick:e=>r.onActionClick?.(e,"")}),/* @__PURE__ */e.createElement(Li,{placeholder:c,attachments:u,collections:d,pages:f,acceptedFileTypes:m,isElevated:w})))),p&&/* @__PURE__ */e.createElement("div",{className:"relative z-10 pt-2"},/* @__PURE__ */e.createElement(zi,null))))))},{Messages:Zn,Input:Li,Suggestions:ji,Actions:Ki,Loading:j});export{Bn as C,Bi as a,Ki as b,Li as c,jn as d,Gn as e,Zn as f,Mn as g,ji as h,An as u};
29
- //# sourceMappingURL=Conversation.UzfPizn5.js.map
28
+ /* @__PURE__ */e.createElement(F,{className:"h-4 w-4",weight:"bold"}))))))},ji=({items:t,className:n})=>{const{callbacks:r}=An();return 0===t.length?null:/* @__PURE__ */e.createElement("div",{className:v("flex flex-wrap justify-end gap-2 px-4 py-2",n)},t.map(t=>/* @__PURE__ */e.createElement("button",{key:t.id,type:"button",className:"rounded-full border border-border px-4 py-2 text-sm text-foreground hover:bg-muted transition-colors",onClick:()=>r.onSuggestionClick?.(t)},t.text)))},Ki=({actions:t,onActionClick:n,className:r})=>0===t.length?null:/* @__PURE__ */e.createElement("div",{className:v("flex flex-wrap gap-2 px-4 py-2",r)},t.map(t=>/* @__PURE__ */e.createElement("button",{key:t.id,type:"button",className:"inline-flex items-center gap-2 rounded-full border border-border px-4 py-2 text-sm text-foreground hover:bg-muted transition-colors",onClick:()=>n?.(t)},t.label,t.description&&/* @__PURE__ */e.createElement("span",{className:"text-muted-foreground"},t.description)))),zi=()=>/* @__PURE__ */e.createElement("div",{className:"flex items-center justify-center gap-1 text-[0.625rem] text-subtle"},/* @__PURE__ */e.createElement("span",null,"Powered by"),/* @__PURE__ */e.createElement(_n,{variant:"full",color:"outline",className:"h-2.5 w-auto"})),Bi=Object.assign(({messages:n,callbacks:r,children:o,suggestions:i=[],actions:s=[],placeholder:c,attachments:d,collections:u,pages:f,acceptedFileTypes:m,showBranding:p=!1,className:g})=>{const h=!!o,x=t(null),[E,b]=l(0),[w,N]=l(!1);return a(()=>{const e=x.current;if(!e)return;const t=new ResizeObserver(([e])=>{e&&b(e.borderBoxSize[0]?.blockSize??e.contentRect.height)});return t.observe(e),()=>t.disconnect()},[]),/* @__PURE__ */e.createElement(y,null,/* @__PURE__ */e.createElement(Mn,{messages:n,callbacks:r},/* @__PURE__ */e.createElement("div",{className:v("flex h-full flex-col pb-4",g)},h?o:/* @__PURE__ */e.createElement(e.Fragment,null,/* @__PURE__ */e.createElement("div",{className:"relative min-h-0 flex-1 grid grid-rows-[1fr] grid-cols-[1fr]"},/* @__PURE__ */e.createElement("div",{className:"row-start-1 col-start-1 min-h-0"},/* @__PURE__ */e.createElement(Zn,{bottomPadding:E,onContentBehind:N})),/* @__PURE__ */e.createElement("div",{ref:x,className:"row-start-1 col-start-1 self-end z-10 pointer-events-none px-4"},/* @__PURE__ */e.createElement("div",{className:"pointer-events-auto"},i.length>0&&/* @__PURE__ */e.createElement(ji,{items:i}),s.length>0&&/* @__PURE__ */e.createElement(Ki,{actions:s,onActionClick:e=>r.onActionClick?.(e,"")}),/* @__PURE__ */e.createElement(Li,{placeholder:c,attachments:d,collections:u,pages:f,acceptedFileTypes:m,isElevated:w})))),p&&/* @__PURE__ */e.createElement("div",{className:"relative z-10 pt-2"},/* @__PURE__ */e.createElement(zi,null))))))},{Messages:Zn,Input:Li,Suggestions:ji,Actions:Ki,Loading:j});export{Bn as C,Bi as a,Ki as b,Li as c,jn as d,Gn as e,Zn as f,Mn as g,ji as h,An as u};
29
+ //# sourceMappingURL=Conversation.CCfPtVz8.js.map