@brainfish-ai/components 0.28.8 → 0.28.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/conversation.d.ts +0 -1
- package/dist/esm/chunks/{ChatSearch.Cs9XKATE.js → ChatSearch.DIrtg9k_.js} +2 -2
- package/dist/esm/chunks/{ChatSearch.Cs9XKATE.js.map → ChatSearch.DIrtg9k_.js.map} +1 -1
- package/dist/esm/chunks/Conversation.7_k59TJL.js +20 -0
- package/dist/esm/chunks/Conversation.7_k59TJL.js.map +1 -0
- package/dist/esm/components/chat-search.js +1 -1
- package/dist/esm/components/conversation.js +1 -1
- package/dist/esm/global.css +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/tailwind.preset.js +1 -1
- package/dist/esm/tailwind.preset.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/stats.html +1 -1
- package/package.json +2 -1
- package/tailwind.preset.ts +1 -0
- package/dist/esm/chunks/Conversation.DRNYzOpI.js +0 -22
- package/dist/esm/chunks/Conversation.DRNYzOpI.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brainfish-ai/components",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.10",
|
|
4
4
|
"description": "Brainfish Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/esm/index.js",
|
|
@@ -204,6 +204,7 @@
|
|
|
204
204
|
"remark-rehype": "^11.1.2",
|
|
205
205
|
"select": "^1.1.2",
|
|
206
206
|
"shadcn": "latest",
|
|
207
|
+
"tailwindcss-device": "^1.0.0",
|
|
207
208
|
"unified": "^11.0.5",
|
|
208
209
|
"use-immer": "^0.11.0",
|
|
209
210
|
"usehooks-ts": "^3.1.1",
|
package/tailwind.preset.ts
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
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 c,Suspense as l,forwardRef as u,Component as d,createElement as f,useImperativeHandle as m}from"react";import{Tooltip as p,TooltipTrigger as h,TooltipContent as g,TooltipProvider as v}from"../components/ui/tooltip.js";import{c as y}from"./utils.C6Qu-kwd.js";import{ScrollArea as x}from"../components/ui/scroll-area.js";import{ThumbsUp as E,ThumbsDown as b,Copy as w,DotsThreeVertical as S,X as C,Plus as N,CaretRight as k,Stop as D,ArrowUp as _}from"@phosphor-icons/react";import{F as O}from"./FormattedMessage.XNMN23hm.js";import{DropdownMenu as R,DropdownMenuTrigger as M,DropdownMenuContent as P,DropdownMenuItem as A,DropdownMenuSeparator as F}from"../components/ui/dropdown-menu.js";import{Popover as I,PopoverTrigger as T,PopoverContent as L}from"../components/ui/popover.js";import{Command as j,CommandInput as K,CommandList as B,CommandEmpty as z,CommandGroup as U,CommandItem as $}from"../components/ui/command.js";import{createEditor as J,$getRoot as W,$createParagraphNode as V,$getSelection as H,HISTORY_MERGE_TAG as q,$caretFromPoint as G,$isExtendableTextPointCaret as Z,$extendCaretToRange as X,$isChildCaret as Y,$isElementNode as Q,$isDecoratorNode as ee,$isRootNode as te,$getEditor as ne,$isTokenOrSegmented as re,$getCharacterOffsets as oe,$cloneWithPropertiesEphemeral as ie,$isRangeSelection as se,$findMatchingParent as ae,mergeRegister as ce,DecoratorNode as le,addClassNamesToElement as ue,shallowMergeConfig as de,$create as fe,defineExtension as me,safeCast as pe,createState as he,FORMAT_TEXT_COMMAND as ge,$isNodeSelection as ve,COMMAND_PRIORITY_LOW as ye,RootNode as xe,TextNode as Ee,LineBreakNode as be,TabNode as we,ParagraphNode as Se,$isEditorState as Ce,createCommand as Ne,CLICK_COMMAND as ke,isDOMNode as De,$getNodeFromDOMNode as _e,$createNodeSelection as Oe,$setSelection as Re,$getState as Me,toggleTextFormatType as Pe,TEXT_TYPE_TO_FORMAT as Ae,$setState as Fe,$getNodeByKey as Ie,removeClassNamesFromElement as Te,CLEAR_EDITOR_COMMAND as Le,COMMAND_PRIORITY_EDITOR as je,KEY_TAB_COMMAND as Ke,$isBlockElementNode as Be,$createRangeSelection as ze,$normalizeSelection__EXPERIMENTAL as Ue,OUTDENT_CONTENT_COMMAND as $e,INDENT_CONTENT_COMMAND as Je,INSERT_TAB_COMMAND as We,COMMAND_PRIORITY_CRITICAL as Ve,$isParagraphNode as He,$isTextNode as qe,isDOMDocumentNode as Ge,ArtificialNode__DO_NOT_USE as Ze,$createLineBreakNode as Xe,$isRootOrShadowRoot as Ye,isBlockDomNode as Qe,isInlineDomNode as et,getRegisteredNode as tt,isHTMLElement as nt,isDocumentFragment as rt,$createTabNode as ot,getDOMSelection as it,COPY_COMMAND as st,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND as at,$isTextPointCaret as ct,$getCaretRange as lt,$getChildCaret as ut,$parseSerializedNode as dt,isSelectionWithinEditor as ft,DELETE_CHARACTER_COMMAND as mt,DELETE_WORD_COMMAND as pt,DELETE_LINE_COMMAND as ht,CONTROLLED_TEXT_INSERTION_COMMAND as gt,REMOVE_TEXT_COMMAND as vt,FORMAT_ELEMENT_COMMAND as yt,INSERT_LINE_BREAK_COMMAND as xt,INSERT_PARAGRAPH_COMMAND as Et,$insertNodes as bt,KEY_ARROW_UP_COMMAND as wt,$getAdjacentNode as St,KEY_ARROW_DOWN_COMMAND as Ct,KEY_ARROW_LEFT_COMMAND as Nt,KEY_ARROW_RIGHT_COMMAND as kt,KEY_BACKSPACE_COMMAND as Dt,KEY_DELETE_COMMAND as _t,KEY_ENTER_COMMAND as Ot,KEY_ESCAPE_COMMAND as Rt,DROP_COMMAND as Mt,$getNearestNodeFromDOMNode as Pt,DRAGSTART_COMMAND as At,DRAGOVER_COMMAND as Ft,SELECT_ALL_COMMAND as It,$selectAll as Tt,CUT_COMMAND as Lt,PASTE_COMMAND as jt,isSelectionCapturedInDecoratorInput as Kt,PASTE_TAG as Bt,KEY_SPACE_COMMAND as zt,ElementNode as Ut,setNodeIndentFromDOM as $t,$applyNodeReplacement as Jt,COMMAND_PRIORITY_HIGH as Wt}from"lexical";import{jsx as Vt,jsxs as Ht,Fragment as qt}from"react/jsx-runtime";import{flushSync as Gt,createPortal as Zt}from"react-dom";import{createEmptyHistoryState as Xt,registerHistory as Yt}from"@lexical/history";import{ListNode as Qt,ListItemNode as en,registerList as tn,registerListStrictIndentTransform as nn,$isListItemNode as rn}from"@lexical/list";import{LinkNode as on,registerLink as sn,AutoLinkNode as an}from"@lexical/link";import{registerMarkdownShortcuts as cn,TRANSFORMERS as ln,ORDERED_LIST as un,UNORDERED_LIST as dn,LINK as fn,INLINE_CODE as mn,CODE as pn,$convertToMarkdownString as hn,$convertFromMarkdownString as gn}from"@lexical/markdown";import{CodeNode as vn,CodeHighlightNode as yn,$isCodeNode as xn}from"@lexical/code";import{L as En}from"./logo.CGKfN1U6.js";const bn=i(null),wn={onCopy:(e,t)=>{navigator.clipboard.writeText(t)}};function Sn(){const e=o(bn);if(!e)throw new Error("useConversation must be used within a <Conversation> provider");return e}function Cn({messages:o,callbacks:i,children:s}){const a=o.some(e=>"streaming"===e.status),c=t({...wn,...i});n(()=>{c.current={...wn,...i}});const l=r(()=>({onSend:(...e)=>c.current.onSend?.(...e),onStop:(...e)=>c.current.onStop?.(...e),onSuggestionClick:(...e)=>c.current.onSuggestionClick?.(...e),onActionClick:(...e)=>c.current.onActionClick?.(...e),onFeedback:(...e)=>c.current.onFeedback?.(...e),onCitationClick:(...e)=>c.current.onCitationClick?.(...e),onAttachmentAction:(...e)=>c.current.onAttachmentAction?.(...e),onContextPillRemove:(...e)=>c.current.onContextPillRemove?.(...e),onCopy:(...e)=>c.current.onCopy?.(...e)}),[]),u=r(()=>({messages:o,callbacks:l,isStreaming:a}),[o,l,a]);/* @__PURE__ */
|
|
2
|
-
return e.createElement(bn.Provider,{value:u},s)}const Nn=({block:t,isStreaming:n})=>/* @__PURE__ */e.createElement(O,{message:{content:t.text},isStreaming:n}),kn=({citations:t,onCitationClick:n})=>/* @__PURE__ */e.createElement("span",{className:"inline-flex flex-wrap gap-1"},t.map(t=>/* @__PURE__ */e.createElement(Dn,{key:t.id,citation:t,onClick:n}))),Dn=({citation:t,onClick:n})=>/* @__PURE__ */e.createElement(p,null,/* @__PURE__ */e.createElement(h,{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(g,{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))),_n=({block:t,isStreaming:n,onCitationClick:r})=>"text"===t.type?/* @__PURE__ */e.createElement(e.Fragment,null,/* @__PURE__ */e.createElement(Nn,{block:t,isStreaming:n}),t.citations&&t.citations.length>0&&/* @__PURE__ */e.createElement(kn,{citations:t.citations,onCitationClick:r})):null,On=({className:t})=>/* @__PURE__ */e.createElement("span",{className:y("text-sm font-medium animate-sweep bg-sweep-yellowfin bg-clip-text text-transparent [background-size:200%_auto]",t)},"Working..."),Rn=({message:t,className:n})=>{const{callbacks:r}=Sn(),o="streaming"===t.status,i="pending"===t.status,a="completed"===t.status,c=s(()=>{const e=t.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n");r.onCopy?.(t.id,e)},[t,r]),l=t.content.some(e=>e.text.length>0);return i&&0===t.content.length||o&&!l?/* @__PURE__ */e.createElement(On,{className:n}):/* @__PURE__ */e.createElement("div",{className:y("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"},t.content.map((t,n)=>/* @__PURE__ */e.createElement(_n,{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(Mn,{tooltip:"Helpful",active:"positive"===t.feedback,onClick:()=>r.onFeedback?.(t.id,"positive")},
|
|
3
|
-
/* @__PURE__ */e.createElement(E,{className:"h-4 w-4",weight:"positive"===t.feedback?"fill":"regular"})),/* @__PURE__ */e.createElement(Mn,{tooltip:"Not helpful",active:"negative"===t.feedback,onClick:()=>r.onFeedback?.(t.id,"negative")},
|
|
4
|
-
/* @__PURE__ */e.createElement(b,{className:"h-4 w-4",weight:"negative"===t.feedback?"fill":"regular"})),/* @__PURE__ */e.createElement(Mn,{tooltip:"Copy",onClick:c},/* @__PURE__ */e.createElement(w,{className:"h-4 w-4"})),/* @__PURE__ */e.createElement(Mn,{tooltip:"More"},/* @__PURE__ */e.createElement(S,{className:"h-4 w-4"})))))},Mn=({children:t,tooltip:n,active:r,onClick:o})=>/* @__PURE__ */e.createElement(p,null,/* @__PURE__ */e.createElement(h,{asChild:!0},/* @__PURE__ */e.createElement("button",{type:"button",className:y("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(g,{side:"bottom"},/* @__PURE__ */e.createElement("p",{className:"text-xs"},n))),Pn=({message:t,className:n})=>{const r=t.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n").split(/\n\n+/);/* @__PURE__ */
|
|
5
|
-
return e.createElement("div",{className:y("flex justify-end py-4",n)},/* @__PURE__ */e.createElement("div",{className:"max-w-[85%] rounded bg-surface px-4 py-2.5 text-foreground"},r.map((t,n)=>/* @__PURE__ */e.createElement("p",{key:n,className:"m-0 mb-4 whitespace-pre-wrap last:mb-0"},t))))},An=({message:t,className:n})=>{switch(t.role){case"ai":/* @__PURE__ */
|
|
6
|
-
return e.createElement(Rn,{message:t,className:n});case"user":/* @__PURE__ */
|
|
7
|
-
return e.createElement(Pn,{message:t,className:n});default:return null}},Fn=({className:n,bottomPadding:r=0,onContentBehind:o})=>{const{messages:i}=Sn(),s=t(null),c=t(null);return a(()=>{const e=s.current;e&&(e.scrollTop=e.scrollHeight)},[i]),a(()=>{const e=c.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:y("h-full",n)},/* @__PURE__ */e.createElement("div",{className:"px-6"},i.map(t=>/* @__PURE__ */e.createElement(An,{key:t.id,message:t})),/* @__PURE__ */e.createElement("div",{ref:c,className:"h-px"})),/* @__PURE__ */e.createElement("div",{style:{height:r+8}}))},In=i(null);function Tn(){const e=o(In);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 Ln="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,jn=Ln?n:a,Kn={tag:q};function Bn({initialConfig:e,children:t}){const n=r(()=>{const{theme:t,namespace:n,nodes:r,onError:o,editorState:i,html:s}=e,a=(l=t,{getTheme:function(){return null!=l?l:null}}),c=J({editable:e.editable,html:s,namespace:n,nodes:r,onError:e=>o(e,c),theme:t});var l;return function(e,t){if(null!==t)if(void 0===t)e.update(()=>{const t=W();if(t.isEmpty()){const n=V();t.append(n);const r=Ln?document.activeElement:null;(null!==H()||null!==r&&r===e.getRootElement())&&n.select()}},Kn);else if(null!==t)switch(typeof t){case"string":{const n=e.parseEditorState(t);e.setEditorState(n,Kn);break}case"object":e.setEditorState(t,Kn);break;case"function":e.update(()=>{W().isEmpty()&&t(e)},Kn)}}(c,i),[c,a]},[]);return jn(()=>{const t=e.editable,[r]=n;r.setEditable(void 0===t||t)},[]),Vt(In.Provider,{value:n,children:t})}const zn="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:a;function Un(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}const $n=new Map;function Jn(e){const t=ne().getElementByKey(e.getKey());if(null===t)return null;const n=t.ownerDocument.defaultView;return null===n?null:n.getComputedStyle(t)}function Wn(e){return Jn(te(e)?e:e.getParentOrThrow())}function Vn(e){const t=Wn(e);return null!==t&&"rtl"===t.direction}function Hn(e,t,n="self"){const r=e.getStartEndPoints();if(t.isSelected(e)&&!re(t)&&null!==r){const[o,i]=r,s=e.isBackward(),a=o.getNode(),c=i.getNode(),l=t.is(a),u=t.is(c);if(l||u){const[r,o]=oe(e),i=a.is(c),l=t.is(s?c:a),u=t.is(s?a:c);let d,f=0;i?(f=r>o?o:r,d=r>o?r:o):l?(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=ie(t)),t.__text=m)}}return t}function qn(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);$n.set(t,n)}function Gn(e){const t=Zn(e);return null!==t&&"vertical-rl"===t.writingMode}function Zn(e){const t=e.anchor.getNode();return Q(t)?Jn(t):Wn(t)}function Xn(e,t){let n=Gn(e)?!t:t;Yn(e)&&(n=!n);const r=G(e.focus,n?"previous":"next");if(Z(r))return!1;for(const o of X(r)){if(Y(o))return!o.origin.isInline();if(!Q(o.origin)){if(ee(o.origin))return!0;break}}return!1}function Yn(e){const t=Zn(e);return null!==t&&"rtl"===t.direction}function Qn(e,t,n){const r=Yn(e);let o;o=Gn(e)||r?!n:n,function(e,t,n,r){e.modify(t?"extend":"move",n,r)}(e,t,o,"character")}const er="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,tr=er&&"documentMode"in document?document.documentMode:null;function nr(e){const t=ae(e,e=>Q(e)&&!e.isInline());return Q(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 rr(e,t){return null!==e&&Object.getPrototypeOf(e).constructor.name===t.name}function or(e){const t=H();if(!se(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=ae(t,e=>Q(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}er&&"InputEvent"in window&&!tr&&new window.InputEvent("input");const ir=Symbol.for("preact-signals");function sr(){if(ur>1)return void ur--;let e,t=!1;for(;void 0!==cr;){let n=cr;for(cr=void 0,dr++;void 0!==n;){const r=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&gr(n))try{n.c()}catch(fi){t||(e=fi,t=!0)}n=r}}if(dr=0,ur--,t)throw e}let ar,cr;function lr(e){const t=ar;ar=void 0;try{return e()}finally{ar=t}}let ur=0,dr=0,fr=0;function mr(e){if(void 0===ar)return;let t=e.n;return void 0===t||t.t!==ar?(t={i:0,S:e,p:ar.s,n:void 0,t:ar,e:void 0,x:void 0,r:t},void 0!==ar.s&&(ar.s.n=t),ar.s=t,e.n=t,32&ar.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=ar.s,t.n=void 0,ar.s.n=t,ar.s=t),t):void 0}function pr(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 hr(e,t){return new pr(e,t)}function gr(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 vr(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 yr(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 xr(e,t){pr.call(this,void 0),this.x=e,this.s=void 0,this.g=fr-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 Er(e){const t=e.u;if(e.u=void 0,"function"==typeof t){ur++;const n=ar;ar=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,br(e),t}finally{ar=n,sr()}}}function br(e){for(let t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Er(e)}function wr(e){if(ar!==this)throw new Error("Out-of-order effect");yr(this),ar=e,this.f&=-2,8&this.f&&br(this),sr()}function Sr(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 Cr(e,t){const n=new Sr(e,t);try{n.c()}catch(e){throw n.d(),e}const r=n.d.bind(n);return r[Symbol.dispose]=r,r}function Nr(e,t={}){const n={};for(const r in e){const o=t[r],i=hr(void 0===o?e[r]:o);n[r]=i}return n}function kr(){const e=W(),t=H(),n=V();e.clear(),e.append(n),null!==t&&n.select(),se(t)&&(t.format=0)}function Dr(e){return("function"==typeof e.nodes?e.nodes():e.nodes)||[]}pr.prototype.brand=ir,pr.prototype.h=function(){return!0},pr.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:lr(()=>{var e;null==(e=this.W)||e.call(this)}))},pr.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&&lr(()=>{var e;null==(e=this.Z)||e.call(this)}))}},pr.prototype.subscribe=function(e){return Cr(()=>{const t=this.value,n=ar;ar=void 0;try{e(t)}finally{ar=n}},{name:"sub"})},pr.prototype.valueOf=function(){return this.value},pr.prototype.toString=function(){return this.value+""},pr.prototype.toJSON=function(){return this.value},pr.prototype.peek=function(){const e=ar;ar=void 0;try{return this.value}finally{ar=e}},Object.defineProperty(pr.prototype,"value",{get(){const e=mr(this);return void 0!==e&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(dr>100)throw new Error("Cycle detected");this.v=e,this.i++,fr++,ur++;try{for(let e=this.t;void 0!==e;e=e.x)e.t.N()}finally{sr()}}}}),xr.prototype=new pr,xr.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===fr)return!0;if(this.g=fr,this.f|=1,this.i>0&&!gr(this))return this.f&=-2,!0;const e=ar;try{vr(this),ar=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 ar=e,yr(this),this.f&=-2,!0},xr.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)}pr.prototype.S.call(this,e)},xr.prototype.U=function(e){if(void 0!==this.t&&(pr.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)}},xr.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(xr.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const e=mr(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Sr.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()}},Sr.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Er(this),vr(this),ur++;const e=ar;return ar=this,wr.bind(this,e)},Sr.prototype.N=function(){2&this.f||(this.f|=2,this.o=cr,cr=this)},Sr.prototype.d=function(){this.f|=8,1&this.f||br(this)},Sr.prototype.dispose=function(){this.d()},me({build:(e,t,n)=>Nr(t),config:pe({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,n){const r=n.getOutput();return Cr(()=>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()})}))}}),me({build:(e,t,n)=>Nr(t),config:pe({$onClear:kr}),name:"@lexical/extension/ClearEditor",register(e,t,n){const{$onClear:r}=n.getOutput();return Cr(()=>function(e,t=kr){return e.registerCommand(Le,n=>(e.update(t),!0),je)}(e,r.value))}});const _r=he("format",{parse:e=>"number"==typeof e?e:0});let Or=class extends le{$config(){return this.config("decorator-text",{extends:le,stateConfigs:[{flat:!0,stateConfig:_r}]})}getFormat(){return Me(this,_r)}getFormatFlags(e,t){return Pe(this.getFormat(),e,t)}hasFormat(e){const t=Ae[e];return 0!==(this.getFormat()&t)}setFormat(e){return Fe(this,_r,e)}toggleFormat(e){const t=this.getFormat(),n=Pe(t,e,null);return this.setFormat(n)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function Rr(e){return e instanceof Or}function Mr(e,t){let n;return hr(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}me({name:"@lexical/extension/DecoratorText",nodes:()=>[Or],register:(e,t,n)=>e.registerCommand(ge,e=>{const t=H();if(ve(t)||se(t))for(const n of t.getNodes())Rr(n)&&n.toggleFormat(e);return!1},ye)});const Pr=me({build:e=>Mr(()=>e.getEditorState(),t=>e.registerUpdateListener(e=>{t.value=e.editorState})),name:"@lexical/extension/EditorState"});function Ar(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 Fr(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]=Fr(n[e],r[e]);return e}return t}function Ir(e){return 0===e.id}function Tr(e){return 2===e.id}const Lr=new Set;class jr{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):de;for(const n of this.configs)e=t(e,n);return e}init(e){const t=this.state;Tr(t)||Ar(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&&Ar(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&&Ar(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&&Ar(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&&Ar(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&&Ar(311),this._signal}getInitResult(){void 0===this.extension.init&&Ar(312,this.extension.name);const e=this.state;return function(e){return e.id>=4}(e)||Ar(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)||Ar(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&&Ar(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){const t=this.builder.getExtensionRep(e);return void 0===t&&Ar(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){const e=this.state;return function(e){return e.id>=7}(e)||Ar(316,String(e.id),String(7)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||Lr}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)||Ar(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}}const Kr={tag:q};function Br(){const e=W();e.isEmpty()&&e.append(V())}const zr=me({config:pe({setOptions:Kr,updateOptions:Kr}),init:({$initialEditorState:e=Br})=>({$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(Ce(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:[xe,Ee,be,we,Se]}),Ur=Symbol.for("@lexical/extension/LexicalBuilder");function $r(){}function Jr(e){throw e}function Wr(e){return Array.isArray(e)?e:[e]}const Vr="0.41.0+prod.esm";class Hr{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=Vr,this.roots=e;for(const t of e)this.addExtension(t)}static fromExtensions(e){const t=[Wr(zr)];for(const n of e)t.push(Wr(n));return new Hr(t)}static maybeFromEditor(e){const t=e[Ur];return t&&(t.PACKAGE_VERSION!==Vr&&Ar(292,t.PACKAGE_VERSION,Vr),t instanceof Hr||Ar(293)),t}static fromEditor(e){const t=Hr.maybeFromEditor(e);return void 0===t&&Ar(294),t}constructEditor(){const{$initialEditorState:e,onError:t,...n}=this.buildCreateEditorArgs(),r=Object.assign(J({...n,...t?{onError:e=>{t(e,r)}}:{}}),{[Ur]:this});for(const o of this.sortedExtensionReps())o.build(r);return r}buildEditor(){let e=$r;function t(){try{e()}finally{e=$r}}const n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=ce(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&&Ar(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&&Ar(296);const t=Wr(e),[n]=t;"string"!=typeof n.name&&Ar(297,typeof n.name);let r=this.extensionNameMap.get(n.name);if(void 0!==r&&r.extension!==n&&Ar(298,n.name),!r){r=new jr(this,n),this.extensionNameMap.set(n.name,r);const e=this.conflicts.get(n.name);"string"==typeof e&&Ar(299,n.name,e);for(const t of n.conflictsWith||[])this.extensionNameMap.has(t)&&Ar(299,n.name,t),this.conflicts.set(t,n.name);for(const t of n.dependencies||[]){const e=Wr(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(Tr(o))return;const i=n.extension.name;var s;Ir(o)||Ar(300,i,r||"[unknown]"),Ir(s=o)||Ar(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)||Ar(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())Ir(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&&Ar(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 ce(...r)}buildCreateEditorArgs(){const e={},t=new Set,n=new Map,r=new Map,o={},i={},s=this.sortedExtensionReps();for(const l of s){const{extension:s}=l;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 Dr(s)){if("function"!=typeof e){const t=n.get(e.replace);t&&Ar(302,s.name,e.replace.name,t.extension.name),n.set(e.replace,l)}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&&Fr(i,s.theme)}Object.keys(i).length>0&&(e.theme=i),t.size&&(e.nodes=[...t]);const a=Object.keys(o).length>0,c=r.size>0;(a||c)&&(e.html={},a&&(e.html.import=o),c&&(e.html.export=r));for(const l of s)l.init(e);return e.onError||(e.onError=Jr),e}}const qr=new Set,Gr=me({build(e,t,n){const r=n.getDependency(Pr).output,o=hr({watchedNodeKeys:new Map}),i=Mr(()=>{},()=>Cr(()=>{const e=i.peek(),{watchedNodeKeys:t}=o.value;let n,s=!1;r.value.read(()=>{if(H())for(const[r,o]of t.entries()){if(0===o.size){t.delete(r);continue}const i=Ie(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 xr(e,t)}(()=>(i.value||qr).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:[Pr],name:"@lexical/extension/NodeSelection"});Ne("INSERT_HORIZONTAL_RULE_COMMAND");class Zr extends le{static getType(){return"horizontalrule"}static clone(e){return new Zr(e.__key)}static importJSON(e){return Yr().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:Xr,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(e){const t=document.createElement("hr");return ue(t,e.theme.hr),t}getTextContent(){return"\n"}isInline(){return!1}updateDOM(){return!1}}function Xr(){return{node:Yr()}}function Yr(){return fe(Zr)}function Qr(e){return e instanceof Zr}function eo(e){return e.canBeEmpty()}me({dependencies:[Pr,Gr],name:"@lexical/extension/HorizontalRule",nodes:()=>[Zr],register(e,t,n){const{watchNodeKey:r}=n.getDependency(Gr).output,o=hr({nodeSelections:new Map}),i=e._config.theme.hrSelected??"selected";return ce(e.registerCommand(ke,e=>{if(De(e.target)){const t=_e(e.target);if(Qr(t))return function(e,t=!1){const n=H(),r=e.isSelected(),o=e.getKey();let i;t&&ve(n)?i=n:(i=Oe(),Re(i)),r?i.delete(o):i.add(o)}(t,e.shiftKey),!0}return!1},ye),e.registerMutationListener(Zr,(t,n)=>{!function(e){if(ur>0)return e();ur++;try{return e()}finally{sr()}}(()=>{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:hr(s),selectedSignal:r(o)}))}n&&(o.value={nodeSelections:i})})}),Cr(()=>{const e=[];for(const{domNode:t,selectedSignal:n}of o.value.nodeSelections.values())e.push(Cr(()=>{const e=t.value;e&&(n.value?ue(e,i):Te(e,i))}));return ce(...e)}))}}),me({build:(e,t,n)=>Nr(t),config:pe({$canIndent:eo,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,n){const{disabled:r,maxIndent:o,$canIndent:i}=n.getOutput();return Cr(()=>{if(!r.value)return function(e,t,n=eo){return ce(e.registerCommand(Ke,t=>{const n=H();if(!se(n))return!1;t.preventDefault();const r=function(e){if(e.getNodes().filter(e=>Be(e)&&e.canIndent()).length>0)return!0;const t=e.anchor,n=e.focus,r=n.isBefore(t)?n:t,o=nr(r.getNode());if(o.canIndent()){const e=o.getKey();let t=ze();if(t.anchor.set(e,0,"element"),t.focus.set(e,0,"element"),t=Ue(t),t.anchor.is(r))return!0}return!1}(n)?t.shiftKey?$e:Je:We;return e.dispatchCommand(r,void 0)},je),e.registerCommand(Je,()=>{const e="number"==typeof t?t:t?t.peek():null,r=H();if(!se(r))return!1;const o="function"==typeof n?n:n.peek();return or(t=>{if(o(t)){const n=t.getIndent()+1;(!e||n<e)&&t.setIndent(n)}})},Ve))}(e,o,i)})}});const to=me({name:"@lexical/react/ReactProvider"});function no(e,t=!0){if(e)return!1;let n=W().getTextContent();return t&&(n=n.trim()),""===n}function ro(e){return()=>function(e){if(!no(e,!1))return!1;const t=W().getChildren(),n=t.length;if(n>1)return!1;for(let r=0;r<n;r++){const e=t[r];if(ee(e))return!1;if(Q(e)){if(!He(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(!qe(e))return!1}}}return!0}(e)}function oo(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=H();if(se(e)){const t=e.anchor;let c=t.getNode(),l=0,u=0;if(qe(c)&&r>=0&&o>=0&&(l=r,u=r+o,e.setTextNodeRange(c,l,c,u)),l===u&&""===i||(e.insertRawText(i),c=t.getNode()),qe(c)){l=s,u=s+a;const t=c.getTextContentSize();l=l>t?t:l,u=u>t?t:u,e.setTextNodeRange(c,l,c,u)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}const io=me({build:(e,t,n)=>Nr(t),config:pe({disabled:"undefined"==typeof window}),name:"@lexical/dragon",register:(e,t,n)=>Cr(()=>n.getOutput().disabled.value?void 0:oo(e))});function so(e,t,n,r=null){let o=null===r||t.isSelected(r);const i=Q(t)&&t.excludeFromCopy("html");let s=t;null!==r&&qe(t)&&(s=Hn(r,t,"clone"));const a=Q(s)?s.getChildren():[],c=tt(e,s.getType());let l;l=c&&void 0!==c.exportDOM?c.exportDOM(e,s):s.exportDOM(e);const{element:u,after:d}=l;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&&Q(t)&&i&&t.extractWithChild(n,r,"html")&&(o=!0)}if(o&&!i){if((nt(u)||rt(u))&&u.append(f),n.append(u),d){const e=d.call(s,u);e&&(rt(u)?u.replaceChildren(e):u.replaceWith(e))}}else n.append(f);return o}const ao=new Set(["STYLE","SCRIPT"]);function co(e,t,n,r,o=new Map,i){let s=[];if(ao.has(e.nodeName))return s;let a=null;const c=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),l=c?c(e):null;let u=null;if(null!==l){u=l.after;const t=l.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!=l.forChild&&o.set(e.nodeName,l.forChild)}const d=e.childNodes;let f=[];const m=(null==a||!Ye(a))&&(null!=a&&Be(a)||r);for(let p=0;p<d.length;p++)f.push(...co(d[p],t,n,m,new Map(o),a));return null!=u&&(f=u(f)),Qe(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(Be(e))r&&!e.getFormat()&&e.setFormat(r),o.push(e);else if(i.push(e),s===t.length-1||s<t.length-1&&Be(t[s+1])){const e=n();e.setFormat(r),e.append(...i),o.push(e),i=[]}}return o}(e,f,m?()=>{const e=new Ze;return n.push(e),e}:V)),null==a?f.length>0?s=s.concat(f):Qe(e)&&function(e){return null!=e.nextSibling&&null!=e.previousSibling&&(et(e.nextSibling)&&et(e.previousSibling))}(e)&&(s=s.concat(Xe())):Q(a)&&a.append(...f),s}function lo(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 uo(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 fo(n,function(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n],o=dt(r);qe(o)&&qn(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 fo(n,function(e,t){const n=Ge(t)?t.body.childNodes:t.childNodes;let r=[];const o=[];for(const i of n)if(!ao.has(i.nodeName)){const t=co(i,e,o,!1);null!==t&&(r=r.concat(t))}return function(e){for(const t of e)t.getNextSibling()instanceof Ze&&t.insertAfter(Xe());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(se(t)){const e=s.split(/(\r?\n|\t)/);""===e[e.length-1]&&e.pop();for(let t=0;t<e.length;t++){const n=H();if(se(n)){const r=e[t];"\n"===r||"\r\n"===r?n.insertParagraph():"\t"===r?n.insertNodes([ot()]):n.insertText(r)}}}else t.insertRawText(s)}function fo(e,t,n){e.dispatchCommand(at,{nodes:t,selection:n})||(n.insertNodes(t),function(e){if(se(e)&&e.isCollapsed()){const t=e.anchor;let n=null;const r=G(t,"previous");if(r)if(ct(r))n=r.origin;else{const e=lt(r,ut(W(),"next").getFlipped());for(const t of e){if(qe(t.origin)){n=t.origin;break}if(Q(t.origin)&&!t.origin.isInline())break}}if(n&&qe(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 mo(e,t,n,r=[]){let o=null===t||n.isSelected(t);const i=Q(n)&&n.excludeFromCopy("html");let s=n;null!==t&&qe(s)&&(s=Hn(t,s,"clone"));const a=Q(s)?s.getChildren():[],c=function(e){const t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&lo(58,n.name),Q(e)){const e=t.children;Array.isArray(e)||lo(59,n.name)}return t}(s);qe(s)&&0===s.getTextContentSize()&&(o=!1);for(let l=0;l<a.length;l++){const r=a[l],i=mo(e,t,r,c.children);!o&&Q(n)&&i&&n.extractWithChild(r,t,"clone")&&(o=!0)}if(o&&!i)r.push(c);else if(Array.isArray(c.children))for(let l=0;l<c.children.length;l++){const e=c.children[l];r.push(e)}return o}let po=null;async function ho(e,t,n){if(null!==po)return!1;if(null!==t)return new Promise((r,o)=>{e.update(()=>{r(go(e,t,n))})});const r=e.getRootElement(),o=e._window||window,i=o.document,s=it(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 c=new Range;return c.setStart(a,0),c.setEnd(a,1),s.removeAllRanges(),s.addRange(c),new Promise((t,r)=>{const s=e.registerCommand(st,r=>(rr(r,ClipboardEvent)&&(s(),null!==po&&(o.clearTimeout(po),po=null),t(go(e,r,n))),!0),Ve);po=o.setTimeout(()=>{s(),po=null,t(!1)},50),i.execCommand("copy"),a.remove()})}function go(e,t,n){if(void 0===n){const t=it(e._window),r=H();if(!r||r.isCollapsed())return!1;if(!t)return!1;const o=t.anchorNode,i=t.focusNode;if(null!==o&&null!==i&&!ft(e,o,i))return!1;n=function(e=H()){const t={"text/plain":e?e.getTextContent():""};if(e){const n=ne();for(const[r,o]of vo){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 vo)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 vo=[["text/html",function(e,t=H()){return null==t&&lo(166),se(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=W().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=H()){return null==t&&lo(166),se(t)&&t.isCollapsed()||0===t.getNodes().length?null:JSON.stringify(function(e,t){const n=[],r=W().getChildren();for(let o=0;o<r.length;o++)mo(e,t,r[o],n);return{namespace:e._config.namespace,nodes:n}}(e,t))}]];function yo(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 xo="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Eo=xo&&"documentMode"in document?document.documentMode:null,bo=xo&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),wo=!(!xo||!("InputEvent"in window)||Eo)&&"getTargetRanges"in new window.InputEvent("input"),So=xo&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Co=xo&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,No=xo&&/^(?=.*Chrome).*/i.test(navigator.userAgent),ko=xo&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&bo&&!No,Do=Ne("DRAG_DROP_PASTE_FILE");class _o extends Ut{static getType(){return"quote"}static clone(e){return new _o(e.__key)}createDOM(e){const t=document.createElement("blockquote");return ue(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:Ao,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(nt(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 Oo().updateFromJSON(e)}insertNewAfter(e,t){const n=V(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,t),n}collapseAtStart(){const e=V();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function Oo(){return Jt(new _o)}class Ro extends Ut{__tag;static getType(){return"heading"}static clone(e){return new Ro(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];ue(n,e)}return n}updateDOM(e,t,n){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:Po,priority:0}),h2:e=>({conversion:Po,priority:0}),h3:e=>({conversion:Po,priority:0}),h4:e=>({conversion:Po,priority:0}),h5:e=>({conversion:Po,priority:0}),h6:e=>({conversion:Po,priority:0}),p:e=>{const t=e.firstChild;return null!==t&&Mo(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>Mo(e)?{conversion:e=>({node:Fo("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(nt(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 Fo(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?V():Fo(this.getTag()),i=this.getDirection();if(o.setDirection(i),this.insertAfter(o,t),0===n&&!this.isEmpty()&&e){const e=V();e.select(),this.replace(e,!0)}return o}collapseAtStart(){const e=this.isEmpty()?V():Fo(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function Mo(e){return"span"===e.nodeName.toLowerCase()&&"26pt"===e.style.fontSize}function Po(e){const t=e.nodeName.toLowerCase();let n=null;return"h1"!==t&&"h2"!==t&&"h3"!==t&&"h4"!==t&&"h5"!==t&&"h6"!==t||(n=Fo(t),null!==e.style&&($t(e,n),n.setFormat(e.style.textAlign))),{node:n}}function Ao(e){const t=Oo();return null!==e.style&&(t.setFormat(e.style.textAlign),$t(e,t)),{node:t}}function Fo(e="h1"){return Jt(new Ro(e))}function Io(e){let t=null;if(rr(e,DragEvent)?t=e.dataTransfer:rr(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 To(e){const t=Pt(e);return ee(t)}function Lo(e){for(const t of["lowercase","uppercase","capitalize"])e.hasFormat(t)&&e.toggleFormat(t)}function jo(e){return ce(e.registerCommand(ke,e=>{const t=H();return!!ve(t)&&(t.clear(),!0)},je),e.registerCommand(mt,e=>{const t=H();return se(t)?(t.deleteCharacter(e),!0):!!ve(t)&&(t.deleteNodes(),!0)},je),e.registerCommand(pt,e=>{const t=H();return!!se(t)&&(t.deleteWord(e),!0)},je),e.registerCommand(ht,e=>{const t=H();return!!se(t)&&(t.deleteLine(e),!0)},je),e.registerCommand(gt,t=>{const n=H();if("string"==typeof t)null!==n&&n.insertText(t);else{if(null===n)return!1;const r=t.dataTransfer;if(null!=r)uo(r,n,e);else if(se(n)){const e=t.data;return e&&n.insertText(e),!0}}return!0},je),e.registerCommand(vt,()=>{const e=H();return!!se(e)&&(e.removeText(),!0)},je),e.registerCommand(ge,e=>{const t=H();return!!se(t)&&(t.formatText(e),!0)},je),e.registerCommand(yt,e=>{const t=H();if(!se(t)&&!ve(t))return!1;const n=t.getNodes();for(const r of n){const t=ae(r,e=>Q(e)&&!e.isInline());null!==t&&t.setFormat(e)}return!0},je),e.registerCommand(xt,e=>{const t=H();return!!se(t)&&(t.insertLineBreak(e),!0)},je),e.registerCommand(Et,()=>{const e=H();return!!se(e)&&(e.insertParagraph(),!0)},je),e.registerCommand(We,()=>{const e=ot(),t=H();return se(t)&&(e.setFormat(t.format),e.setStyle(t.style)),bt([e]),!0},je),e.registerCommand(Je,()=>or(e=>{const t=e.getIndent();e.setIndent(t+1)}),je),e.registerCommand($e,()=>or(e=>{const t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}),je),e.registerCommand(wt,e=>{const t=H();if(ve(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}else if(se(t)){const n=St(t.focus,!0);if(!e.shiftKey&&ee(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},je),e.registerCommand(Ct,e=>{const t=H();if(ve(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectNext(0,0),!0}else if(se(t)){if(function(e){const t=e.focus;return"root"===t.key&&t.offset===W().getChildrenSize()}(t))return e.preventDefault(),!0;const n=St(t.focus,!1);if(!e.shiftKey&&ee(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},je),e.registerCommand(Nt,e=>{const t=H();if(ve(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),Vn(n[0])?n[0].selectNext(0,0):n[0].selectPrevious(),!0}if(!se(t))return!1;if(Xn(t,!0)){const n=e.shiftKey;return e.preventDefault(),Qn(t,n,!0),!0}return!1},je),e.registerCommand(kt,e=>{const t=H();if(ve(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),Vn(n[0])?n[0].selectPrevious():n[0].selectNext(0,0),!0}if(!se(t))return!1;const n=e.shiftKey;return!!Xn(t,!1)&&(e.preventDefault(),Qn(t,n,!1),!0)},je),e.registerCommand(Dt,t=>{if(To(t.target))return!1;const n=H();if(se(n)){if(function(e){if(!e.isCollapsed())return!1;const{anchor:t}=e;if(0!==t.offset)return!1;const n=t.getNode();if(te(n))return!1;const r=nr(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(n))return t.preventDefault(),e.dispatchCommand($e,void 0);if(Co&&"ko-KR"===navigator.language)return!1}else if(!ve(n))return!1;return t.preventDefault(),e.dispatchCommand(mt,!0)},je),e.registerCommand(_t,t=>{if(To(t.target))return!1;const n=H();return!(!se(n)&&!ve(n))&&(t.preventDefault(),e.dispatchCommand(mt,!1))},je),e.registerCommand(Ot,t=>{const n=H();if(!se(n))return!1;if(Lo(n),null!==t){if((Co||So||ko)&&wo)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(xt,!1)}return e.dispatchCommand(Et,void 0)},je),e.registerCommand(Rt,()=>{const t=H();return!!se(t)&&(e.blur(),!0)},je),e.registerCommand(Mt,t=>{const[,n]=Io(t);if(n.length>0){const r=yo(t.clientX,t.clientY);if(null!==r){const{offset:t,node:o}=r,i=Pt(o);if(null!==i){const e=ze();if(qe(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=Ue(e);Re(n)}e.dispatchCommand(Do,n)}return t.preventDefault(),!0}const r=H();return!!se(r)},je),e.registerCommand(At,e=>{const[t]=Io(e),n=H();return!(t&&!se(n))},je),e.registerCommand(Ft,e=>{const[t]=Io(e),n=H();if(t&&!se(n))return!1;const r=yo(e.clientX,e.clientY);if(null!==r){const t=Pt(r.node);ee(t)&&e.preventDefault()}return!0},je),e.registerCommand(It,()=>(Tt(),!0),je),e.registerCommand(st,t=>(ho(e,rr(t,ClipboardEvent)?t:null),!0),je),e.registerCommand(Lt,t=>(async function(e,t){await ho(t,rr(e,ClipboardEvent)?e:null),t.update(()=>{const e=H();se(e)?e.removeText():ve(e)&&e.getNodes().forEach(e=>e.remove())})}(t,e),!0),je),e.registerCommand(jt,t=>{const[,n,r]=Io(t);return n.length>0&&!r?(e.dispatchCommand(Do,n),!0):(!De(t.target)||!Kt(t.target))&&(null!==H()&&(function(e,t){e.preventDefault(),t.update(()=>{const n=H(),r=rr(e,InputEvent)||rr(e,KeyboardEvent)?null:e.clipboardData;null!=r&&null!==n&&uo(r,n,t)},{tag:Bt})}(t,e),!0))},je),e.registerCommand(zt,e=>{const t=H();return se(t)&&Lo(t),!1},je),e.registerCommand(Ke,e=>{const t=H();return se(t)&&Lo(t),!1},je))}function Ko(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.`)}me({conflictsWith:["@lexical/plain-text"],dependencies:[io],name:"@lexical/rich-text",nodes:()=>[Ro,_o],register:jo});const Bo="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:a;function zo({editor:e,ErrorBoundary:t}){return function(e,t){const[n,o]=c(()=>e.getDecorators());return Bo(()=>e.registerDecoratorListener(e=>{Gt(()=>{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=Vt(t,{onError:t=>e._onError(t),children:Vt(l,{fallback:null,children:n[s]})}),c=e.getElementByKey(s);null!==c&&r.push(Zt(a,c,s))}return r},[t,n,e])}(e,t)}function Uo({editor:e,ErrorBoundary:t}){return function(e){const t=Hr.maybeFromEditor(e);if(t&&t.hasExtensionByName(to.name)){for(const e of["@lexical/plain-text","@lexical/rich-text"])t.hasExtensionByName(e)&&Ko(320,e);return!0}return!1}(e)?null:Vt(zo,{editor:e,ErrorBoundary:t})}function $o(e){return e.getEditorState().read(ro(e.isComposing()))}function Jo({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){const[r]=Tn();return function(e){Bo(()=>ce(jo(e),oo(e)),[e])}(r),Ht(qt,{children:[e,Vt(Wo,{content:t}),Vt(Uo,{editor:r,ErrorBoundary:n})]})}function Wo({content:e}){const[n]=Tn(),o=function(e){const[t,n]=c(()=>$o(e));return Bo(()=>{function t(){const t=$o(e);n(t)}return t(),ce(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(n),i=function(e){const[n]=Tn(),o=r(()=>e(n),[n,e]),[i,s]=c(()=>o.initialValueFn()),a=t(i);return zn(()=>{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}(Un);return o?"function"==typeof e?e(i):e:null}const Vo="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:a;const Ho=u(function({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:o,ariaDescribedBy:i,ariaErrorMessage:a,ariaExpanded:l,ariaInvalid:u,ariaLabel:d,ariaLabelledBy:f,ariaMultiline:m,ariaOwns:p,ariaRequired:h,autoCapitalize:g,className:v,id:y,role:x="textbox",spellCheck:E=!0,style:b,tabIndex:w,"data-testid":S,...C},N){const[k,D]=c(e.isEditable()),_=s(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),O=r(()=>function(...e){return t=>{for(const n of e)"function"==typeof n?n(t):null!=n&&(n.current=t)}}(N,_),[_,N]);return Vo(()=>(D(e.isEditable()),e.registerEditableListener(e=>{D(e)})),[e]),Vt("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?!!l: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":h,autoCapitalize:g,className:v,contentEditable:k,"data-testid":S,id:y,ref:O,role:x,spellCheck:E,style:b,tabIndex:w,...C})});function qo(e){return e.getEditorState().read(ro(e.isComposing()))}const Go=u(function(e,t){const{placeholder:n,...r}=e,[o]=Tn();return Ht(qt,{children:[Vt(Ho,{editor:o,...r,ref:t}),null!=n&&Vt(Zo,{editor:o,content:n})]})});function Zo({content:e,editor:t}){const r=function(e){const[t,n]=c(()=>qo(e));return Vo(()=>{function t(){const t=qo(e);n(t)}return t(),ce(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),[o,i]=c(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:Vt("div",{"aria-hidden":!0,children:s})}function Xo({delay:e,externalHistoryState:t}){const[n]=Tn();return function(e,t,n=1e3){const o=r(()=>t||Xt(),[t]);a(()=>Yt(e,o,n),[n,e,o])}(n,t,e),null}function Yo({hasStrictIndent:e=!1,shouldPreserveNumbering:t=!1}){const[n]=Tn();return a(()=>{if(!n.hasNodes([Qt,en]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[n]),a(()=>ce(tn(n,{restoreNumbering:t}),e?nn(n):()=>{}),[n,e,t]),a(()=>tn(r),[r=n]),null;var r}function Qo({validateUrl:e,attributes:t}){const[n]=Tn();return a(()=>{if(!n.hasNodes([on]))throw new Error("LinkPlugin: LinkNode not registered on editor")}),a(()=>sn(n,Nr({attributes:t,validateUrl:e})),[n,e,t]),null}const ei="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:a;function ti({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){const[r]=Tn();return ei(()=>{if(n)return r.registerUpdateListener(({editorState:o,dirtyElements:i,dirtyLeaves:s,prevEditorState:a,tags:c})=>{t&&0===i.size&&0===s.size||e&&c.has(q)||a.isEmpty()||n(o,r,c)})},[r,e,t,n]),null}function ni(e,t){return e.getEditorState().read(()=>{const e=Ie(t);return null!==e&&e.isSelected()})}function ri({nodeKey:e}){const[t]=Tn(),[n,r,o]=function(e){const[t]=Tn(),[n,r]=c(()=>ni(t,e));return a(()=>{let n=!0;const o=t.registerUpdateListener(()=>{n&&r(ni(t,e))});return()=>{n=!1,o()}},[t,e]),[n,s(n=>{t.update(()=>{let t=H();ve(t)||(t=Oe(),Re(t)),ve(t)&&(n?t.add(e):t.delete(e))})},[t,e]),s(()=>{t.update(()=>{const e=H();ve(e)&&e.clear()})},[t])]}(e);return a(()=>ce(t.registerCommand(ke,i=>{const s=t.getElementByKey(e);return i.target===s&&(i.shiftKey||o(),r(!n),!0)},ye)),[o,t,n,e,r]),a(()=>{const r=t.getElementByKey(e),o=t._config.theme.hrSelected??"selected";null!==r&&(n?ue(r,o):Te(r,o))},[t,n,e]),null}class oi extends Zr{static getType(){return"horizontalrule"}static clone(e){return new oi(e.__key)}static importJSON(e){return si().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:ii,priority:0})}}decorate(){return Vt(ri,{nodeKey:this.__key})}}function ii(){return{node:si()}}function si(){return Jt(new oi)}const ai=[{dependencies:[oi],export:e=>Qr(e)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(e,t,n,r)=>{const o=si();r||null!=e.getNextSibling()?e.replace(o):e.insertBefore(o),o.selectNext()},type:"element"},...ln];function ci({transformers:e=ai}){const[t]=Tn();return a(()=>cn(t,e),[t,e]),null}const li=i(null),ui={didCatch:!1,error:null};class di extends d{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=ui}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(ui))}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(ui))}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(li.Provider,{value:{didCatch:o,error:i,resetErrorBoundary:this.resetErrorBoundary}},s)}}function fi({children:e,onError:t}){return Vt(di,{fallback:Vt("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}const mi=[un,dn,fn,mn,pn];function pi({editorRef:e}){const[t]=Tn();return a(()=>(e.current=t,()=>{e.current=null}),[t,e]),null}function hi({onSubmit:e}){const[t]=Tn();return a(()=>t.registerCommand(Ot,n=>{if(n.shiftKey)return!1;const r=H();if(se(r)){const e=r.anchor.getNode();if(rn(e)||rn(e.getParent()))return!1;if(xn(e)||xn(e.getParent()))return!1}return n.preventDefault(),t.read(()=>{e?.(hn(mi))}),!0},Wt),[t,e]),null}function gi({defaultValue:n,onChange:r,onSubmit:o,placeholder:i,disabled:s,className:a,autoFocus:c,forwardedRef:l}){const u=t(null);m(l,()=>({clear(){u.current?.update(()=>{const e=W();e.clear(),e.append(V())})},focus(){u.current?.focus()}}));const d={namespace:"RichTextInput",nodes:[Qt,en,on,an,vn,yn],editable:!s,editorState:n?()=>gn(n,mi):void 0,onError:e=>console.error("[RichTextInput]",e)};/* @__PURE__ */
|
|
8
|
-
return e.createElement(Bn,{initialConfig:d},/* @__PURE__ */e.createElement("div",{className:a},/* @__PURE__ */e.createElement("div",{className:"relative"},/* @__PURE__ */e.createElement(Jo,{contentEditable:/* @__PURE__ */e.createElement(Go,{autoFocus:c,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:fi}))),/* @__PURE__ */e.createElement(Xo,null),/* @__PURE__ */e.createElement(Yo,null),/* @__PURE__ */e.createElement(Qo,null),/* @__PURE__ */e.createElement(ci,{transformers:mi}),r&&/* @__PURE__ */e.createElement(ti,{onChange:e=>{e.read(()=>{r(hn(mi))})}}),/* @__PURE__ */e.createElement(hi,{onSubmit:o}),/* @__PURE__ */e.createElement(pi,{editorRef:u}))}const vi=u((t,n)=>/* @__PURE__ */e.createElement(gi,{...t,forwardedRef:n}));vi.displayName="RichTextInput";const yi=({pill:t,onRemove:n})=>/* @__PURE__ */e.createElement("span",{className:"inline-flex items-center gap-0.5 rounded-full bg-muted px-2 py-1 text-xs text-muted-foreground"},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)},
|
|
9
|
-
/* @__PURE__ */e.createElement(C,{className:"h-2.5 w-2.5"}))),xi=({placeholder:n="What can we help with today?",attachments:r=[],collections:o=[],contextPills:i=[],disabled:a=!1,isElevated:l=!1,className:u})=>{const{callbacks:d,isStreaming:f}=Sn(),[m,p]=c(!1),h=t(""),g=t(null),[v,x]=c(!1),[E,b]=c(!1),w=t(null),S=t(!1),C=s(()=>{w.current&&(clearTimeout(w.current),w.current=null),b(!0)},[]),O=s(()=>{w.current=setTimeout(()=>{S.current||b(!1)},150)},[]),J=a,W=s(e=>{const t=(e??h.current).trim();!t||J||f||(d.onSend?.(t,r.length>0?r:void 0),g.current?.clear(),g.current?.focus())},[J,f,d,r]),V=s(()=>{d.onStop?.()},[d]),H=s(e=>{d.onAttachmentAction?.(e)},[d]),q=s(e=>{b(!1),x(!1),H({type:"select-collection",collection:e})},[H]);/* @__PURE__ */
|
|
10
|
-
return e.createElement("div",{className:y("",u)},/* @__PURE__ */e.createElement("div",{className:y("relative rounded-t-2xl rounded-b-lg bg-gradient-yellowfin p-2 transition-shadow duration-300",l&&"shadow-[0_-20px_25px_-5px_rgba(0,0,0,0.1),0_-8px_10px_-6px_rgba(0,0,0,0.1)]")},
|
|
11
|
-
/* @__PURE__ */e.createElement("div",{className:"rounded-t-lg rounded-b bg-surface shadow-md"},i.length>0&&/* @__PURE__ */e.createElement("div",{className:"flex flex-wrap gap-1.5 px-3 pt-3"},i.map(t=>/* @__PURE__ */e.createElement(yi,{key:t.id,pill:t,onRemove:d.onContextPillRemove}))),/* @__PURE__ */e.createElement(vi,{ref:g,placeholder:n,disabled:a,autoFocus:!0,className:"w-full bg-transparent p-4 text-sm disabled:cursor-not-allowed disabled:opacity-50",onChange:e=>{h.current=e,p(e.trim().length>0)},onSubmit:W}),/* @__PURE__ */e.createElement("div",{className:"flex items-center justify-between px-2 pb-2"},/* @__PURE__ */e.createElement("div",{className:"flex items-center gap-1"},/* @__PURE__ */e.createElement(R,{open:v,onOpenChange:x},/* @__PURE__ */e.createElement(M,{asChild:!0,disabled:a||f},/* @__PURE__ */e.createElement("button",{type:"button",className:y("inline-flex h-6 w-6 items-center justify-center rounded text-default hover:bg-muted transition-all",v&&"shadow-md dark:shadow-md"),disabled:a||f},
|
|
12
|
-
/* @__PURE__ */e.createElement(N,{className:y("h-4 w-4 transition-transform duration-200",v&&"-rotate-45")}))),/* @__PURE__ */e.createElement(P,{align:"end",side:"right",className:"rounded border-none shadow-md bg-surface p-2 min-w-[200px] dark:border-none dark:shadow-md"},o.length>0&&/* @__PURE__ */e.createElement(e.Fragment,null,/* @__PURE__ */e.createElement(I,{open:E,onOpenChange:b},/* @__PURE__ */e.createElement(T,{asChild:!0},/* @__PURE__ */e.createElement(A,{className:"p-2",onSelect:e=>e.preventDefault(),onMouseEnter:C,onMouseLeave:O,onFocus:C},"Collection",
|
|
13
|
-
/* @__PURE__ */e.createElement(k,{className:"ml-auto h-4 w-4"}))),/* @__PURE__ */e.createElement(L,{className:"w-[200px] rounded border-none p-0 shadow-md dark:border-none dark:shadow-md",side:"right",align:"start",onMouseEnter:C,onMouseLeave:O,onFocusCapture:()=>{S.current=!0},onBlurCapture:()=>{S.current=!1,O()}},
|
|
14
|
-
/* @__PURE__ */e.createElement(j,null,o.length>5&&/* @__PURE__ */e.createElement(K,{placeholder:"Search collections..."}),/* @__PURE__ */e.createElement(B,null,/* @__PURE__ */e.createElement(z,null,"No collections found."),/* @__PURE__ */e.createElement(U,null,o.map(t=>/* @__PURE__ */e.createElement($,{key:t.id,value:t.label,onSelect:()=>q(t)},t.label))))))),/* @__PURE__ */e.createElement(F,null)),
|
|
15
|
-
/* @__PURE__ */e.createElement(A,{className:"p-2",onSelect:()=>H({type:"attach-tab"})},"Attach tab"),
|
|
16
|
-
/* @__PURE__ */e.createElement(F,null),
|
|
17
|
-
/* @__PURE__ */e.createElement(A,{className:"p-2",onSelect:()=>H({type:"screenshot"})},"Take a screenshot"),
|
|
18
|
-
/* @__PURE__ */e.createElement(A,{className:"p-2",onSelect:()=>H({type:"record-video"})},"Record a video"),
|
|
19
|
-
/* @__PURE__ */e.createElement(A,{className:"p-2",onSelect:()=>H({type:"add-file"})},"Add image or file")))),f?/* @__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:V,disabled:a},
|
|
20
|
-
/* @__PURE__ */e.createElement(D,{className:"h-4 w-4",weight:"fill"})):/* @__PURE__ */e.createElement("button",{type:"button",className:y("inline-flex h-6 w-6 items-center justify-center rounded transition-colors",m?"bg-input text-primary-foreground hover:bg-input/90":"bg-muted text-muted-foreground"),onClick:()=>W(),disabled:J||!m},
|
|
21
|
-
/* @__PURE__ */e.createElement(_,{className:"h-4 w-4",weight:"bold"}))))))},Ei=({items:t,className:n})=>{const{callbacks:r}=Sn();return 0===t.length?null:/* @__PURE__ */e.createElement("div",{className:y("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)))},bi=({actions:t,onActionClick:n,className:r})=>0===t.length?null:/* @__PURE__ */e.createElement("div",{className:y("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)))),wi=()=>/* @__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(En,{variant:"full",color:"outline",className:"h-2.5 w-auto"})),Si=Object.assign(({messages:n,callbacks:r,children:o,suggestions:i=[],actions:s=[],placeholder:l,attachments:u,collections:d,contextPills:f,showBranding:m=!1,className:p})=>{const h=!!o,g=t(null),[x,E]=c(0),[b,w]=c(!1);return a(()=>{const e=g.current;if(!e)return;const t=new ResizeObserver(([e])=>{e&&E(e.borderBoxSize[0]?.blockSize??e.contentRect.height)});return t.observe(e),()=>t.disconnect()},[]),/* @__PURE__ */e.createElement(v,null,/* @__PURE__ */e.createElement(Cn,{messages:n,callbacks:r},/* @__PURE__ */e.createElement("div",{className:y("flex h-full flex-col pb-4",p)},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(Fn,{bottomPadding:x,onContentBehind:w})),/* @__PURE__ */e.createElement("div",{ref:g,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(Ei,{items:i}),s.length>0&&/* @__PURE__ */e.createElement(bi,{actions:s,onActionClick:e=>r.onActionClick?.(e,"")}),/* @__PURE__ */e.createElement(xi,{placeholder:l,attachments:u,collections:d,contextPills:f,isElevated:b})))),m&&/* @__PURE__ */e.createElement("div",{className:"relative z-10 pt-2"},/* @__PURE__ */e.createElement(wi,null))))))},{Messages:Fn,Input:xi,Suggestions:Ei,Actions:bi,Loading:On});export{yi as C,Si as a,bi as b,xi as c,Rn as d,Pn as e,Fn as f,Cn as g,On as h,Ei as i,Sn as u};
|
|
22
|
-
//# sourceMappingURL=Conversation.DRNYzOpI.js.map
|