reactjs-tiptap-editor 1.0.24 → 1.0.25
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/lib/{ActionMenuButton-HYlhmRvw.js → ActionMenuButton-8cTG45Ft.js} +1 -1
- package/lib/{ActionMenuButton-B8NhVw5m.cjs → ActionMenuButton-CXeFhner.cjs} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +1 -1
- package/lib/Blockquote.cjs +1 -1
- package/lib/Blockquote.js +1 -1
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +1 -1
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +1 -1
- package/lib/{Callout-B-S2f0Qo.cjs → Callout-DWOMZPiP.cjs} +1 -1
- package/lib/{Callout-CF7Y9yJ7.js → Callout-ZlPQrMEt.js} +1 -1
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +2 -2
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +1 -1
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +1 -1
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.js +1 -1
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +1 -1
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +2 -2
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +1 -1
- package/lib/{Drawer-CaXVhxo4.js → Drawer-C-EO1uoK.js} +1 -1
- package/lib/{Drawer-Was4hxYH.cjs → Drawer-TJY4NuHx.cjs} +1 -1
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +2 -2
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +2 -2
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +1 -1
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +1 -1
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +1 -1
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +3 -3
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +3 -3
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +8 -8
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +38 -32
- package/lib/History.cjs +1 -1
- package/lib/History.js +1 -1
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +1 -1
- package/lib/{Iframe-BI0sq6pd.cjs → Iframe-5zx43DL4.cjs} +1 -1
- package/lib/{Iframe-Bp986fj0.js → Iframe-CGb6-2LD.js} +1 -1
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +1 -1
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +1 -1
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +2 -2
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +1 -1
- package/lib/{Indent-E6B8DkyN.js → Indent-CdMYsDNS.js} +1 -1
- package/lib/{Indent-FvM52kjA.cjs → Indent-DuwV8s1t.cjs} +1 -1
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +1 -1
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +1 -1
- package/lib/{Katex-pzwyyiFJ.js → Katex-CCP_ZQz2.js} +2 -2
- package/lib/{Katex-DP6EjdKz.cjs → Katex-D9FP7EUE.cjs} +1 -1
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +1 -1
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +2 -2
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +1 -1
- package/lib/{LinkEditBlock-OjN4F2rM.js → LinkEditBlock-B1m-TVMu.js} +2 -2
- package/lib/{LinkEditBlock-Cmkmp2fW.cjs → LinkEditBlock-DQ8-iufJ.cjs} +1 -1
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.js +2 -2
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +2 -2
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +1 -1
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +2 -2
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +2 -2
- package/lib/{SlashCommandNodeView-DarAytvt.cjs → SlashCommandNodeView-DNixmQGa.cjs} +1 -1
- package/lib/{SlashCommandNodeView-o323V8li.js → SlashCommandNodeView-Dt6n1SP9.js} +1 -1
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +1 -1
- package/lib/{Table-Clnz-i4l.cjs → Table-C5JxBXef.cjs} +1 -1
- package/lib/{Table-CC9uNHPL.js → Table-DdEgaUwa.js} +2 -2
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +1 -1
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +2 -2
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +2 -2
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +1 -1
- package/lib/{Twitter-0kmrijjL.cjs → Twitter--tfifMt1.cjs} +1 -1
- package/lib/{Twitter-BVnXL8we.js → Twitter-Dnz9qyW0.js} +2 -2
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +1 -1
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +1 -1
- package/lib/bubble.cjs +1 -1
- package/lib/bubble.js +14 -14
- package/lib/{dropdown-menu-BW2M6saA.js → dropdown-menu-ROihzXsP.js} +1 -1
- package/lib/{dropdown-menu-BIGvxqiu.cjs → dropdown-menu-yQ-sQ1k4.cjs} +1 -1
- package/lib/{index-deubsx3z.cjs → index-Gi752TMk.cjs} +1 -1
- package/lib/{index-BrsJsbds.js → index-X6WZUM9O.js} +15 -15
- package/lib/index.cjs +1 -1
- package/lib/index.js +1 -1
- package/lib/{popover-DoSfJsFS.cjs → popover-BPzkMuyi.cjs} +1 -1
- package/lib/{popover-BIVHT1W9.js → popover-BfWFqCIs.js} +1 -1
- package/lib/{separator-b-qOPJmp.js → separator-CBPrZizK.js} +2 -2
- package/lib/{separator-SRbPfmGa.cjs → separator-DpaS43Gt.cjs} +1 -1
- package/lib/{textarea-CpxXPky_.js → textarea-Bl64keav.js} +1 -1
- package/lib/{textarea-DbGw9oCU.cjs → textarea-wvARZKyA.cjs} +1 -1
- package/package.json +1 -1
package/lib/bubble.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var So=Object.create;var jn=Object.defineProperty;var Co=Object.getOwnPropertyDescriptor;var ko=Object.getOwnPropertyNames;var Eo=Object.getPrototypeOf,_o=Object.prototype.hasOwnProperty;var To=(e,t,n)=>t in e?jn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Do=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ko(t))!_o.call(e,s)&&s!==n&&jn(e,s,{get:()=>t[s],enumerable:!(i=Co(t,s))||i.enumerable});return e};var Ao=(e,t,n)=>(n=e!=null?So(Eo(e)):{},Do(t||!e||!e.__esModule?jn(n,"default",{value:e,enumerable:!0}):n,e));var Ne=(e,t,n)=>To(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),T=require("./index-Bcj8cyOO.cjs"),q=require("./index-BF3EVCB1.cjs"),Y=require("@tiptap/pm/state"),Ls=require("./Table-Clnz-i4l.cjs"),Ps=require("./clsx-D6gYQn3o.cjs"),b=require("react"),wi=require("react-dom"),m=require("./index-deubsx3z.cjs"),St=require("./Callout-B-S2f0Qo.cjs"),dt=require("./Katex-DP6EjdKz.cjs"),B=require("./index-CWw4s87s.cjs"),Pt=require("lucide-react"),Rn=require("./CodeBlock.cjs"),wt=require("./separator-SRbPfmGa.cjs"),kt=require("./popover-DoSfJsFS.cjs"),Gi=require("./Column.cjs");require("./theme.cjs");const Fe=require("./Drawer-Was4hxYH.cjs"),Yi=require("easydrawer"),Je=require("./shortId-Bfj8TyNr.cjs"),ue=require("./Excalidraw.cjs"),Wt=require("./Iframe-BI0sq6pd.cjs"),Io=require("./ImageGif.cjs"),Mo=require("katex"),Zn=require("./textarea-DbGw9oCU.cjs"),Ve=require("./LinkEditBlock-Cmkmp2fW.cjs"),Nn=require("@tiptap/pm/view"),Oo=require("@tiptap/pm/model"),jo=require("./Clear.cjs"),de=require("./Indent-FvM52kjA.cjs"),Us=require("./TextAlign.cjs"),U=require("./dropdown-menu-BIGvxqiu.cjs"),Qn=require("./Mermaid.cjs"),Ro=require("./Bold.cjs"),No=require("./Code.cjs");require("./index-BAb_UADw.cjs");const Bo=require("./Color.cjs"),Lo=require("./Highlight.cjs"),Po=require("./Italic.cjs"),Uo=require("./SlashCommandNodeView-DarAytvt.cjs"),$o=require("./Strike.cjs"),Fo=require("./TextUnderline.cjs"),Bn=require("./Twitter-0kmrijjL.cjs");function Vo(e,t){const n=Math.min(e.top,t.top),i=Math.max(e.bottom,t.bottom),s=Math.min(e.left,t.left),o=Math.max(e.right,t.right)-s,l=i-n,c=s,a=n;return new DOMRect(c,a,o,l)}var Ho=class{constructor({editor:e,element:t,view:n,pluginKey:i="bubbleMenu",updateDelay:s=250,resizeDelay:r=60,shouldShow:o,appendTo:l,getReferencedVirtualElement:c,options:a}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:h,state:f,from:p,to:g})=>{const{doc:x,selection:w}=f,{empty:y}=w,C=!x.textBetween(p,g).length&&T.isTextSelection(f.selection),S=this.element.contains(document.activeElement);return!(!(h.hasFocus()||S)||y||C||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:h})=>{var f;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}h!=null&&h.relatedTarget&&((f=this.element.parentNode)!=null&&f.contains(h.relatedTarget))||(h==null?void 0:h.relatedTarget)!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(h,f)=>{const p=!(f!=null&&f.selection.eq(h.state.selection)),g=!(f!=null&&f.doc.eq(h.state.doc));!p&&!g||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(h,p,g,f)},this.updateDelay))},this.updateHandler=(h,f,p,g)=>{const{composing:x}=h;if(x||!f&&!p)return;if(!this.getShouldShow(g)){this.hide();return}this.show(),this.updatePosition()},this.transactionHandler=({transaction:h})=>{const f=h.getMeta(this.pluginKey);f==="updatePosition"?this.updatePosition():f&&typeof f=="object"&&f.type==="updateOptions"?this.updateOptions(f.options):f==="hide"?this.hide():f==="show"&&(this.updatePosition(),this.show())};var u;this.editor=e,this.element=t,this.view=n,this.pluginKey=i,this.updateDelay=s,this.resizeDelay=r,this.appendTo=l,this.scrollTarget=(u=a==null?void 0:a.scrollTarget)!=null?u:window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...a},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(q.flip(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(q.shift(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(q.offset(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(q.arrow(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(q.size(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(q.autoPlacement(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(q.hide(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(q.inline(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}get virtualElement(){var e,t,n;const{selection:i}=this.editor.state,s=(e=this.getReferencedVirtualElement)==null?void 0:e.call(this);if(s)return s;if(!((n=(t=this.view)==null?void 0:t.dom)!=null&&n.parentNode))return;const r=T.posToDOMRect(this.view,i.from,i.to);let o={getBoundingClientRect:()=>r,getClientRects:()=>[r]};if(i instanceof Y.NodeSelection){let l=this.view.nodeDOM(i.from);const c=l.dataset.nodeViewWrapper?l:l.querySelector("[data-node-view-wrapper]");c&&(l=c),l&&(o={getBoundingClientRect:()=>l.getBoundingClientRect(),getClientRects:()=>[l.getBoundingClientRect()]})}if(i instanceof Ls.CellSelection){const{$anchorCell:l,$headCell:c}=i,a=l?l.pos:c.pos,u=c?c.pos:l.pos,h=this.view.nodeDOM(a),f=this.view.nodeDOM(u);if(!h||!f)return;const p=h===f?h.getBoundingClientRect():Vo(h.getBoundingClientRect(),f.getBoundingClientRect());o={getBoundingClientRect:()=>p,getClientRects:()=>[p]}}return o}updatePosition(){if(!this.isVisible)return;const e=this.virtualElement;e&&q.computePosition(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:t,y:n,strategy:i,middlewareData:s})=>{var r,o;if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if((r=s.hide)!=null&&r.referenceHidden||(o=s.hide)!=null&&o.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=i,this.element.style.left=`${t}px`,this.element.style.top=`${n}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){const{state:n}=e,i=n.selection.from!==n.selection.to;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(e,t);return}const s=!(t!=null&&t.selection.eq(e.state.selection)),r=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,s,r,t)}getShouldShow(e){var t;const{state:n}=this.view,{selection:i}=n,{ranges:s}=i,r=Math.min(...s.map(c=>c.$from.pos)),o=Math.max(...s.map(c=>c.$to.pos));return((t=this.shouldShow)==null?void 0:t.call(this,{editor:this.editor,element:this.element,view:this.view,state:n,oldState:e,from:r,to:o}))||!1}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(e){var t;if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){const n=(t=e.options.scrollTarget)!=null?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},$s=e=>new Y.Plugin({key:typeof e.pluginKey=="string"?new Y.PluginKey(e.pluginKey):e.pluginKey,view:t=>new Ho({view:t,...e})});T.Extension.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[$s({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var zo=class{constructor({editor:e,element:t,view:n,pluginKey:i="floatingMenu",updateDelay:s=250,resizeDelay:r=60,options:o,appendTo:l,shouldShow:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:u,state:h})=>{const{selection:f}=h,{$anchor:p,empty:g}=f,x=p.depth===1,w=p.parent.isTextblock&&!p.parent.type.spec.code&&!p.parent.textContent&&p.parent.childCount===0&&!this.getTextContent(p.parent);return!(!u.hasFocus()||!g||!x||!w||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(u,h,f,p)=>{const{composing:g}=u;if(g||!h&&!f)return;if(!this.getShouldShow(p)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var h;if(this.preventHide){this.preventHide=!1;return}u!=null&&u.relatedTarget&&((h=this.element.parentNode)!=null&&h.contains(u.relatedTarget))||(u==null?void 0:u.relatedTarget)!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:u})=>{const h=u.getMeta(this.pluginKey);h==="updatePosition"?this.updatePosition():h&&typeof h=="object"&&h.type==="updateOptions"?this.updateOptions(h.options):h==="hide"?this.hide():h==="show"&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)};var a;this.editor=e,this.element=t,this.view=n,this.pluginKey=i,this.updateDelay=s,this.resizeDelay=r,this.appendTo=l,this.scrollTarget=(a=o==null?void 0:o.scrollTarget)!=null?a:window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return T.getText(e,{textSerializers:T.getTextSerializersFromSchema(this.editor.schema)})}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(q.flip(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(q.shift(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(q.offset(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(q.arrow(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(q.size(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(q.autoPlacement(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(q.hide(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(q.inline(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}getShouldShow(e){var t;const{state:n}=this.view,{selection:i}=n,{ranges:s}=i,r=Math.min(...s.map(c=>c.$from.pos)),o=Math.max(...s.map(c=>c.$to.pos));return(t=this.shouldShow)==null?void 0:t.call(this,{editor:this.editor,view:this.view,state:n,oldState:e,from:r,to:o})}updateOptions(e){var t;if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){const n=(t=e.options.scrollTarget)!=null?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){var e,t;if(!((t=(e=this.view)==null?void 0:e.dom)!=null&&t.parentNode))return;const{selection:n}=this.editor.state,i=T.posToDOMRect(this.view,n.from,n.to),s={getBoundingClientRect:()=>i,getClientRects:()=>[i]};q.computePosition(s,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:r,y:o,strategy:l,middlewareData:c})=>{var a,u;if((a=c.hide)!=null&&a.referenceHidden||(u=c.hide)!=null&&u.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=l,this.element.style.left=`${r}px`,this.element.style.top=`${o}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const n=!(t!=null&&t.selection.eq(e.state.selection)),i=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,n,i,t)}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Fs=e=>new Y.Plugin({key:typeof e.pluginKey=="string"?new Y.PluginKey(e.pluginKey):e.pluginKey,view:t=>new zo({view:t,...e})});T.Extension.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,"updatePosition"),!0)}},addProseMirrorPlugins(){return this.options.element?[Fs({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function Vs(e,t){return e??new Y.PluginKey(t)}var Ko=typeof window<"u"?b.useLayoutEffect:b.useEffect,Hs=new Set(["left","opacity","position","top","visibility","width"]),qo=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","columnCount","columns","fillOpacity","flex","flexGrow","flexShrink","fontWeight","gridArea","gridColumn","gridColumnEnd","gridColumnStart","gridRow","gridRowEnd","gridRowStart","lineClamp","lineHeight","opacity","order","orphans","scale","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","tabSize","widows","zIndex","zoom"]),Wo=new Set(["children","className","style"]),Go=new Set(["tabIndex"]),Yo=new Set(["accessKey","autoCapitalize","contentEditable","contextMenu","dir","draggable","enterKeyHint","hidden","id","lang","nonce","role","slot","spellCheck","tabIndex","title","translate"]),Jo={Blur:"focusout",DoubleClick:"dblclick",Focus:"focusin",MouseEnter:"mouseenter",MouseLeave:"mouseleave"};function ti(e,t){return/^on[A-Z]/.test(e)&&typeof t=="function"}function Xo(e){return e.startsWith("aria-")||e.startsWith("data-"),e}function Zo(e){return e.startsWith("aria-")||e.startsWith("data-")||Yo.has(e)}function zs(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Qo(e){var t;const n=e.endsWith("Capture"),s=(n?e.slice(0,-7):e).slice(2);return{eventName:(t=Jo[s])!=null?t:s.toLowerCase(),options:n?{capture:!0}:void 0}}function tl(e,t){let n=t.defaultPrevented,i=!1;const s=Object.create(t);return Object.defineProperties(s,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>{}},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>i},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{i=!0,t.stopPropagation()}}}),s}function Ln(e){return Go.has(e)}function Ji(e,t,n){if(t==="tabIndex"){e.tabIndex=Number(n);return}e[t]=n}function el(e,t){if(t==="tabIndex"){e.removeAttribute("tabindex");return}const n=e[t];if(typeof n=="boolean"){e[t]=!1;return}if(typeof n=="number"){e[t]=0;return}e[t]=""}function nl(e,t){return typeof t!="number"||t===0||e.startsWith("--")||qo.has(e)?String(t):`${t}px`}function il(e,t){Hs.has(t)||e.style.removeProperty(zs(t))}function sl(e,t,n){Hs.has(t)||e.style.setProperty(zs(t),nl(t,n))}function rl(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(s=>{if(Wo.has(s)||!Zo(s)||ti(s,t[s])||ti(s,n[s]))return;const r=t[s],o=n[s];if(r===o)return;const l=Xo(s);if(o==null||o===!1){Ln(s)&&el(e,s),e.removeAttribute(l);return}if(o===!0){Ln(s)&&Ji(e,s,!0),e.setAttribute(l,"");return}if(Ln(s)){Ji(e,s,o);return}e.setAttribute(l,String(o))})}function ol(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute("class")}}function ll(e,t,n){const i=t??{},s=n??{};new Set([...Object.keys(i),...Object.keys(s)]).forEach(o=>{const l=i[o],c=s[o];if(l!==c){if(c==null){il(e,o);return}sl(e,o,c)}})}function cl(e,t,n){t.forEach(({eventName:s,listener:r,options:o})=>{e.removeEventListener(s,r,o)});const i=[];return Object.entries(n).forEach(([s,r])=>{if(!ti(s,r))return;const{eventName:o,options:l}=Qo(s),c=a=>{r(tl(e,a))};e.addEventListener(o,c,l),i.push({eventName:o,listener:c,options:l})}),i}function Ks(e,t){const n=b.useRef({}),i=b.useRef([]);Ko(()=>{const s=n.current;return ol(e,s.className,t.className),ll(e,s.style,t.style),rl(e,s,t),i.current=cl(e,i.current,t),n.current=t,()=>{i.current.forEach(({eventName:r,listener:o,options:l})=>{e.removeEventListener(r,o,l)}),i.current=[]}},[e,t])}var nt=b.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:i,appendTo:s,shouldShow:r=null,getReferencedVirtualElement:o,options:l,children:c,...a},u)=>{const h=b.useRef(document.createElement("div")),f=b.useRef(Vs(e,"bubbleMenu")).current;Ks(h.current,a),typeof u=="function"?u(h.current):u&&(u.current=h.current);const{editor:p}=Ps.useCurrentEditor(),g=t||p,x={updateDelay:n,resizeDelay:i,appendTo:s,pluginKey:f,shouldShow:r,getReferencedVirtualElement:o,options:l},w=b.useRef(x);w.current=x;const[y,C]=b.useState(!1),S=b.useRef(!0);return b.useEffect(()=>{if(g!=null&&g.isDestroyed)return;if(!g){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const D=h.current;D.style.visibility="hidden",D.style.position="absolute";const H=$s({...w.current,editor:g,element:D});g.registerPlugin(H);const A=w.current.pluginKey;return S.current=!0,C(!0),()=>{C(!1),g.unregisterPlugin(A),window.requestAnimationFrame(()=>{D.parentNode&&D.parentNode.removeChild(D)})}},[g]),b.useEffect(()=>{if(!(!y||!g||g.isDestroyed)){if(S.current){S.current=!1;return}g.view.dispatch(g.state.tr.setMeta(f,{type:"updateOptions",options:w.current}))}},[y,g,n,i,r,l,s,o,f]),wi.createPortal(c,h.current)});b.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:i,appendTo:s,shouldShow:r=null,options:o,children:l,...c},a)=>{const u=b.useRef(document.createElement("div")),h=b.useRef(Vs(e,"floatingMenu")).current;Ks(u.current,c),typeof a=="function"?a(u.current):a&&(a.current=u.current);const{editor:f}=Ps.useCurrentEditor(),p=t||f,g={updateDelay:n,resizeDelay:i,appendTo:s,pluginKey:h,shouldShow:r,options:o},x=b.useRef(g);x.current=g;const[w,y]=b.useState(!1),C=b.useRef(!0);return b.useEffect(()=>{if(p!=null&&p.isDestroyed)return;if(!p){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const S=u.current;S.style.visibility="hidden",S.style.position="absolute";const D=Fs({...x.current,editor:p,element:S});p.registerPlugin(D);const H=x.current.pluginKey;return C.current=!0,y(!0),()=>{y(!1),p.unregisterPlugin(H),window.requestAnimationFrame(()=>{S.parentNode&&S.parentNode.removeChild(S)})}},[p]),b.useEffect(()=>{if(!(!w||!p||p.isDestroyed)){if(C.current){C.current=!1;return}p.view.dispatch(p.state.tr.setMeta(h,{type:"updateOptions",options:x.current}))}},[w,p,n,i,r,o,s,h]),wi.createPortal(l,u.current)});function Ht(e,t){const{state:n}=t,i=n.selection.$anchor;let s=!1;if(i.depth)for(let r=i.depth;r>0;r--)i.node(r).type.name===e&&(t.dispatchTransaction&&t.dispatchTransaction(n.tr.delete(i.before(r),i.after(r)).scrollIntoView()),s=!0);else{const r=n.selection.node;r&&r.type.name===e&&(t.chain().deleteSelection().run(),s=!0)}if(!s){const r=i.pos;if(r){const o=n.tr.doc.nodeAt(r);o&&o.type.name===e&&(t.dispatchTransaction&&t.dispatchTransaction(n.tr.delete(r,r+o.nodeSize)),s=!0)}}return s}const al=[{value:"note",label:"Note",icon:"Info"},{value:"tip",label:"Tip",icon:"Lightbulb"},{value:"important",label:"Important",icon:"AlertCircle"},{value:"warning",label:"Warning",icon:"TriangleAlert"},{value:"caution",label:"Caution",icon:"OctagonAlert"}];function hl(){const e=m.useEditableEditor(),t=m.useEditorInstance(),{t:n}=B.useLocale(),{type:i,title:s,body:r}=dt.useAttributes(t,St.Callout.name,{type:"note",title:"",body:""}),[o,l]=b.useState(!1),[c,a]=b.useState("note"),[u,h]=b.useState(""),[f,p]=b.useState("");b.useEffect(()=>{o&&(a(i||"note"),h(s||""),p(r||""))},[o,i,s,r]);const g=b.useCallback(()=>{t&&(t.chain().updateAttributes(St.Callout.name,{type:c,title:u,body:f}).focus().run(),l(!1))},[t,c,u,f]),x=b.useCallback(()=>{l(!1)},[]),w=b.useCallback(()=>{Ht(St.Callout.name,t)},[t]),y=b.useCallback(()=>t.isActive(St.Callout.name),[t]);return e?d.jsx(nt,{editor:t,options:{placement:"top",offset:8,flip:!0},pluginKey:"RichTextBubbleCallout",shouldShow:y,children:d.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:[d.jsxs(m.Dialog,{onOpenChange:l,open:o,children:[d.jsx(m.DialogTrigger,{asChild:!0,children:d.jsx(m.ActionButton,{icon:"Pencil",tooltip:n("editor.callout.edit.title")})}),d.jsxs(m.DialogContent,{children:[d.jsx(m.DialogTitle,{children:n("editor.callout.edit.title")}),d.jsxs("div",{className:"richtext-space-y-4 richtext-py-4",children:[d.jsxs("div",{className:"richtext-space-y-2",children:[d.jsx(m.Label,{children:n("editor.callout.dialog.type")}),d.jsxs(St.Select,{onValueChange:a,value:c,children:[d.jsx(St.SelectTrigger,{children:d.jsx(St.SelectValue,{className:"richtext-text-accent",placeholder:n("editor.callout.dialog.type.placeholder")})}),d.jsx(St.SelectContent,{children:al.map(C=>d.jsx(St.SelectItem,{value:C.value,children:n(`editor.callout.type.${C.value}`)},C.value))})]})]}),d.jsxs("div",{className:"richtext-space-y-2",children:[d.jsx(m.Label,{children:n("editor.callout.dialog.title.label")}),d.jsx(m.Input,{onChange:C=>h(C.target.value),placeholder:n("editor.callout.dialog.title.placeholder"),type:"text",value:u})]}),d.jsxs("div",{className:"richtext-space-y-2",children:[d.jsx(m.Label,{children:n("editor.callout.dialog.body.label")}),d.jsx(m.Input,{onChange:C=>p(C.target.value),placeholder:n("editor.callout.dialog.body.placeholder"),type:"text",value:f})]})]}),d.jsxs(m.DialogFooter,{children:[d.jsx(m.Button,{onClick:x,variant:"outline",children:n("editor.callout.dialog.button.cancel")}),d.jsx(m.Button,{onClick:g,children:n("editor.callout.dialog.button.apply")})]})]})]}),d.jsx(m.ActionButton,{action:w,icon:"Trash2",tooltip:n("editor.delete")})]})}):d.jsx(d.Fragment,{})}function ul(){const e=m.useEditableEditor(),t=m.useEditorInstance(),{t:n}=B.useLocale(),i=b.useCallback(()=>t.isActive(Gi.MultipleColumnNode.name),[t]),s=b.useCallback(()=>Ht(Gi.MultipleColumnNode.name,t),[t]),r=b.useCallback(()=>t.chain().focus().addColBefore().run(),[t]),o=b.useCallback(()=>t.chain().focus().addColAfter().run(),[t]),l=b.useCallback(()=>t.chain().focus().deleteCol().run(),[t]);return e?d.jsx(nt,{editor:t,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleColumns",shouldShow:i,children:d.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:[d.jsx(m.ActionButton,{action:r,icon:"ColumnAddLeft",tooltip:n("editor.table.menu.insertColumnBefore")}),d.jsx(m.ActionButton,{action:o,icon:"ColumnAddRight",tooltip:n("editor.table.menu.insertColumnAfter")}),d.jsx(m.ActionButton,{action:l,icon:"DeleteColumn",tooltip:n("editor.table.menu.deleteColumn")}),d.jsx(m.ActionButton,{action:s,icon:"Trash2",tooltip:n("editor.table.menu.delete_column")})]})}):d.jsx(d.Fragment,{})}function dl(e,t){const n=["size-small","size-medium","size-large"],i=["SizeS","SizeM","SizeL"];return n.map((s,r)=>({type:`image-${s}`,component:m.ActionButton,componentProps:{tooltip:t(`editor.${s.replace("-",".")}.tooltip`),icon:i[r],action:()=>e.commands.updateImage({width:B.IMAGE_SIZE[s]}),isActive:()=>e.isActive("image",{width:B.IMAGE_SIZE[s]})}}))}function fl(e,t){const n=["size-small","size-medium","size-large"],i=["SizeS","SizeM","SizeL"];return n.map((s,r)=>({type:`image-${s}`,component:m.ActionButton,componentProps:{tooltip:t(`editor.${s.replace("-",".")}.tooltip`),icon:i[r],action:()=>e.commands.updateImageGif({width:B.IMAGE_SIZE[s]}),isActive:()=>e.isActive("image",{width:B.IMAGE_SIZE[s]})}}))}function pl(e,t){const n=["left","center","right"],i={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return n.map(s=>({type:`image-${s}`,component:m.ActionButton,componentProps:{tooltip:t(`editor.textalign.${s}.tooltip`),icon:i[s],action:()=>{var r,o;return(o=(r=e.commands)==null?void 0:r.setAlignImage)==null?void 0:o.call(r,s)},isActive:()=>e.isActive({align:s})||!1,disabled:!1}}))}function gl(e,t){const n=["left","center","right"],i={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return n.map(s=>({type:`image-${s}`,component:m.ActionButton,componentProps:{tooltip:t(`editor.textalign.${s}.tooltip`),icon:i[s],action:()=>{var r,o;return(o=(r=e.commands)==null?void 0:r.setAlignImageGif)==null?void 0:o.call(r,s)},isActive:()=>e.isActive({align:s})||!1,disabled:!1}}))}function ml(e,t){const n=["left","center","right"],i={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return n.map(s=>({type:`image-${s}`,component:m.ActionButton,componentProps:{tooltip:t(`editor.textalign.${s}.tooltip`),icon:i[s],action:()=>{var r,o;return(o=(r=e.commands)==null?void 0:r.setAlignImageMermaid)==null?void 0:o.call(r,s)},isActive:()=>e.isActive({align:s})||!1,disabled:!1}}))}function xl(e,t){const n=["left","center","right"],i={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return n.map(s=>({type:`image-${s}`,component:m.ActionButton,componentProps:{tooltip:t(`editor.textalign.${s}.tooltip`),icon:i[s],action:()=>{var r,o;return(o=(r=e.commands)==null?void 0:r.setAlignImageDrawer)==null?void 0:o.call(r,s)},isActive:()=>e.isActive({align:s})||!1,disabled:!1}}))}function bl(e){return[{type:"flex-start",icon:"AlignLeft",tooltip:"Align left"},{type:"center",icon:"AlignCenter",tooltip:"Align center"},{type:"flex-end",icon:"AlignRight",tooltip:"Align right"}].map(n=>({type:`video-align-${n.type}`,component:m.ActionButton,componentProps:{tooltip:n.tooltip,icon:n.icon,action:()=>e.commands.updateVideo({align:n.type}),isActive:()=>e.getAttributes("video").align===n.type}}))}function wl(e,t){const n=["size-small","size-medium","size-large"],i=["SizeS","SizeM","SizeL"];return n.map((s,r)=>({type:`video-${s}`,component:m.ActionButton,componentProps:{tooltip:t(`editor.${s.replace("-",".")}.tooltip`),icon:i[r],action:()=>e.commands.updateVideo({width:B.VIDEO_SIZE[s]}),isActive:()=>e.isActive("video",{width:B.VIDEO_SIZE[s]})}}))}function yl(e,t){return[{type:"flipX",component:m.ActionButton,componentProps:{editor:e,tooltip:t("editor.tooltip.flipX"),icon:"FlipX",action:()=>{const n=e.getAttributes("image"),{flipX:i}=n;e.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipX:!i}).run()}}},{type:"flipY",component:m.ActionButton,componentProps:{editor:e,tooltip:t("editor.tooltip.flipY"),icon:"FlipY",action:()=>{const n=e.getAttributes("image"),{flipY:i}=n;e.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipY:!i}).run()}}},...dl(e,t),...pl(e,t),{type:"remove",component:m.ActionButton,componentProps:{editor:e,tooltip:t("editor.remove"),icon:"Trash2",action:()=>{const{state:n,dispatch:i}=e.view;T.deleteSelection(n,i)}}}]}function vl(e,t){return[...fl(e,t),...gl(e,t),{type:"remove",component:m.ActionButton,componentProps:{editor:e,tooltip:t("editor.remove"),icon:"Trash2",action:()=>{const{state:n,dispatch:i}=e.view;T.deleteSelection(n,i)}}}]}function Sl(e,t){return[...ml(e,t),{type:"edit",component:m.ActionButton,componentProps:{editor:e,tooltip:t("editor.edit"),icon:"Pencil",action:()=>!0}},{type:"remove",component:m.ActionButton,componentProps:{editor:e,tooltip:t("editor.remove"),icon:"Trash2",action:()=>{const{state:n,dispatch:i}=e.view;T.deleteSelection(n,i)}}}]}function Cl(e,t){return[...xl(e,t),{type:"edit",component:m.ActionButton,componentProps:{editor:e,tooltip:t("editor.edit"),icon:"Pencil",action:()=>!0}},{type:"remove",component:m.ActionButton,componentProps:{editor:e,tooltip:t("editor.remove"),icon:"Trash2",action:()=>{const{state:n,dispatch:i}=e.view;T.deleteSelection(n,i)}}}]}function kl(e,t){return[...wl(e,t),...bl(e),{type:"remove",component:m.ActionButton,componentProps:{editor:e,tooltip:t("editor.remove"),icon:"Trash2",action:()=>{const{state:n,dispatch:i}=e.view;T.deleteSelection(n,i)}}}]}let fe=!1;function El({editor:e,attrs:t,extension:n}){const[i,s]=b.useState(!1),r=b.useRef(null),o=b.useRef(null),{alt:l,align:c}=t,a=n==null?void 0:n.options.upload,u=()=>{(async()=>{const v=document.querySelector("#easydrawer");v&&(r.current=new Yi.Editor(v,{wheelEventsEnabled:!1,disableZoom:!0}),o.current=Yi.makeDropdownToolbar(r.current),o.current.addDefaultToolWidgets(),r.current.loadFromSVG(decodeURIComponent(l)))})()};b.useEffect(()=>{i&&setTimeout(()=>{u()},200)},[i]);const h=async()=>{if(r.current){const A=r.current.toSVG(),v=A.outerHTML,k=`drawer-${Je.shortId()}.svg`;let L=Je.i(A.outerHTML);if(a){const z=m.dataURLtoFile(L,k);L=await a(z)}e==null||e.chain().focus().setDrawer({type:"drawer",src:L,alt:encodeURIComponent(v),width:426,height:212},!!v).run(),e==null||e.commands.setAlignImageDrawer(c)}s(!1)},f=A=>{const v=r.current.toolController.getPrimaryTools()[2],k=o.current.getWidgetById("pen-1");v&&k&&(v.setColor(A),k.serializeState())},p=A=>{const v=r.current.toolController.getPrimaryTools()[2],k=o.current.getWidgetById("pen-1");v&&k&&(v.setThickness(A),k.serializeState())},g=A=>{const v=r.current.toolController.getPrimaryTools()[3],k=o.current.getWidgetById("pen-2");v&&k&&(v.setColor(A),k.serializeState())},x=A=>{const v=o.current.getWidgetById("shape");v&&v.setShapeType(A)},w=A=>{const v=r.current.toolController.getPrimaryTools()[5],k=o.current.getWidgetById("shape");v&&k&&(v.setColor(A),k.serializeState())},y=A=>{const v=r.current.toolController.getPrimaryTools()[5],k=o.current.getWidgetById("shape");v&&k&&(v.setThickness(A),k.serializeState())},C=A=>{const v=r.current.toolController.getPrimaryTools()[5],k=o.current.getWidgetById("shape");v&&k&&(v.setBorderColor(A),k.serializeState())},S=()=>{if(fe){for(;r.current.history.redoStackSize>0;)r.current.history.redo();fe=!1;return}r.current.history.undo()},D=()=>{fe||r.current.history.redo()},H=()=>{if(!fe){for(;r.current.history.undoStackSize>0;)S();fe=!0}};return d.jsxs(m.Dialog,{onOpenChange:s,open:i,children:[d.jsx(m.DialogTrigger,{asChild:!0,children:d.jsx(m.ActionButton,{action:()=>s(!0),icon:"Pencil",tooltip:"Edit Drawer"})}),d.jsxs(m.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[d.jsx(m.DialogTitle,{children:"Edit Drawer"}),d.jsxs("div",{style:{height:"100%",borderWidth:1,background:"white",position:"relative"},children:[d.jsx("div",{className:"richtext-size-full",id:"easydrawer"}),d.jsx(Fe.ControlDrawer,{changeBorderColorShape:C,changeColorShape:w,changeShape:x,onClear:H,onRedo:D,onThicknessChange:y,onUndo:S,refEditor:r,setColorHighlight:g,setColorPen:f,setThicknessPen:p})]}),d.jsx(m.DialogFooter,{children:d.jsx(m.Button,{onClick:h,type:"button",children:"Save changes"})})]})]})}function _l({item:e,disabled:t,editor:n}){var s;const i=e.component;return i?d.jsx(b.Fragment,{children:e.type==="divider"?d.jsx(wt.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}):d.jsx(i,{...e.componentProps,disabled:t||((s=e==null?void 0:e.componentProps)==null?void 0:s.disabled),editor:n})}):d.jsx(d.Fragment,{})}function Tl(){const{lang:e,t}=B.useLocale(),n=m.useEditableEditor(),i=m.useEditorInstance(),s=dt.useAttributes(i,Fe.Drawer.name),r=m.useExtension(Fe.Drawer.name),o=({editor:c})=>{const{selection:a}=c.view.state,{$from:u,to:h}=a;let f=!1;return c.view.state.doc.nodesBetween(u.pos,h,p=>{if(p.type.name===Fe.Drawer.name)return f=!0,!1}),f},l=b.useMemo(()=>Cl(i,t),[i,e,t]);return n?d.jsx(nt,{editor:i,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleDrawer",shouldShow:o,children:l!=null&&l.length?d.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:l==null?void 0:l.map((c,a)=>c.type==="edit"&&(s!=null&&s.src)?d.jsx(El,{attrs:s,editor:i,extension:r},`bubbleMenu-drawer-${a}`):d.jsx(_l,{editor:i,item:c},`bubbleMenu-drawer-${a}`))}):d.jsx(d.Fragment,{})}):d.jsx(d.Fragment,{})}const qs=({width:e,maxWidth:t,height:n,onOk:i,children:s})=>{const{t:r}=B.useLocale(),[o,l]=b.useState({width:"",height:"",maxWidth:""});b.useEffect(()=>{l({width:e,height:n,maxWidth:t})},[n,t,e]);function c(a){a.preventDefault(),a.stopPropagation(),i(o)}return d.jsxs(kt.Popover,{modal:!0,children:[d.jsx(kt.PopoverTrigger,{asChild:!0,children:s}),d.jsx(kt.PopoverContent,{children:d.jsxs("form",{className:"richtext-flex richtext-flex-col richtext-gap-2",onSubmit:c,children:[d.jsx(m.Label,{className:"mb-[6px]",children:"Width"}),d.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:d.jsx("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:d.jsx(m.Input,{onChange:a=>l({...o,width:a.target.value}),required:!0,type:"number",value:o.width})})}),d.jsx(m.Label,{className:"mb-[6px]",children:"Max Width"}),d.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:d.jsx("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:d.jsx(m.Input,{onChange:a=>l({...o,maxWidth:a.target.value}),required:!0,type:"number",value:o.maxWidth})})}),d.jsx(m.Label,{className:"mb-[6px]",children:"Height"}),d.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:d.jsx("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:d.jsx(m.Input,{onChange:a=>l({...o,height:a.target.value}),required:!0,type:"number",value:o.height})})}),d.jsx(m.Button,{className:"richtext-mt-2 richtext-self-end",type:"submit",children:r("editor.link.dialog.button.apply")})]})})]})},Nt=new Map;function Dl(e){const t=e.options.element;Nt.has("width")||Nt.set("width",t.clientWidth),Nt.has("width")&&Nt.get("width")<=0&&Nt.set("width",t.clientWidth);const n={attributes:!0,childList:!0,subtree:!0},i=function(){Nt.set("width",t.clientWidth)},s=new MutationObserver(i);return s.observe(t,n),e.on("destroy",()=>{s.disconnect()}),{width:Nt.get("width")}}function Al(){const e=m.useEditableEditor(),t=m.useEditorInstance(),{t:n}=B.useLocale(),{width:i}=Dl(t),s=dt.useAttributes(t,ue.Excalidraw.name,{defaultShowPicker:!1,createUser:"",width:0,height:0}),{defaultShowPicker:r,createUser:o,width:l,height:c}=s,a=b.useCallback(p=>{t.chain().updateAttributes(ue.Excalidraw.name,p).setNodeSelection(t.state.selection.from).focus().run()},[t]),u=b.useCallback(()=>{const p=m.EVENTS.EXCALIDRAW(t.id);m.emit(p,s)},[t,s]),h=b.useCallback(()=>t.isActive(ue.Excalidraw.name),[t]),f=b.useCallback(()=>Ht(ue.Excalidraw.name,t),[t]);return b.useEffect(()=>{r&&(u(),t.chain().updateAttributes(ue.Excalidraw.name,{defaultShowPicker:!1}).focus().run())},[o,r,t,u]),e?d.jsx(nt,{editor:t,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleExcalidraw",shouldShow:h,children:d.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:[d.jsx(m.ActionButton,{action:u,icon:"Pencil",tooltip:n("editor.edit")}),d.jsx(qs,{height:c,maxWidth:i,onOk:a,width:l,children:d.jsx(m.ActionButton,{icon:"Settings",tooltip:n("editor.settings")})}),d.jsx(m.ActionButton,{action:f,icon:"Trash2",tooltip:n("editor.delete")})]})}):d.jsx(d.Fragment,{})}function Il(){const e=m.useEditableEditor(),t=m.useEditorInstance(),{t:n}=B.useLocale(),{width:i,height:s,src:r}=dt.useAttributes(t,Wt.Iframe.name,{width:0,height:0,src:"",defaultShowPicker:!1}),[o,l]=b.useState(!1),[c,a]=b.useState(""),u=b.useCallback(w=>{var y;(y=w==null?void 0:w.preventDefault)==null||y.call(w),l(!1)},[l]);b.useEffect(()=>{o&&a(r)},[o,r]);const h=b.useCallback(w=>{var C;(C=w==null?void 0:w.preventDefault)==null||C.call(w);const y=Wt.getServiceSrc(c);t.chain().updateAttributes(Wt.Iframe.name,{src:(y==null?void 0:y.src)||c}).setNodeSelection(t.state.selection.from).focus().run(),l(!1)},[t,c,l]),f=b.useCallback(()=>{window.open(r,"_blank")},[r]),p=b.useCallback(w=>{t.chain().updateAttributes(Wt.Iframe.name,w).setNodeSelection(t.state.selection.from).focus().run()},[t]),g=b.useCallback(()=>t.isActive(Wt.Iframe.name)&&!r,[t,r]),x=b.useCallback(()=>Ht(Wt.Iframe.name,t),[t]);return e?d.jsx(d.Fragment,{children:d.jsx(nt,{editor:t,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleIframe",shouldShow:g,children:d.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:[d.jsx(m.ActionButton,{action:f,icon:"Eye",tooltip:"Visit Link"}),d.jsxs(m.Dialog,{onOpenChange:l,open:o,children:[d.jsx(m.DialogTrigger,{asChild:!0,children:d.jsx(m.ActionButton,{icon:"Pencil",tooltip:"Open Edit Link"})}),d.jsxs(m.DialogContent,{children:[d.jsx(m.DialogHeader,{children:d.jsx(m.DialogTitle,{children:"Edit Link Iframe"})}),d.jsx(m.Input,{autoFocus:!0,onInput:w=>a(w.target.value),placeholder:"Enter link",type:"url",value:c}),d.jsxs(m.DialogFooter,{children:[d.jsx(m.Button,{onClick:u,type:"button",children:"Cancel"}),d.jsx(m.Button,{onClick:h,type:"button",children:"OK"})]})]})]}),d.jsx(qs,{height:s,onOk:p,width:i,children:d.jsx(m.ActionButton,{icon:"Settings",tooltip:n("editor.settings")})}),d.jsx(m.ActionButton,{action:x,icon:"Trash2",tooltip:n("editor.delete")})]})})}):d.jsx(d.Fragment,{})}function Ml({children:e,visible:t,toggleVisible:n}){const{t:i}=B.useLocale(),s=m.useEditorInstance(),r=dt.useAttributes(s,dt.Katex.name,{text:"",macros:""}),{text:o,macros:l}=r,[c,a]=b.useState(decodeURIComponent(o||"")),[u,h]=b.useState(decodeURIComponent(l||""));b.useEffect(()=>{t&&(a(decodeURIComponent(o||"")),h(decodeURIComponent(l||"")))},[t]);const f=b.useCallback(()=>{s.chain().focus().setKatex({text:encodeURIComponent(c),macros:encodeURIComponent(u)}).run(),a(""),h(""),n(!1)},[s,c,u,n]),p=b.useMemo(()=>{try{return Mo.renderToString(c,{macros:dt.safeJSONParse(u||"")})}catch{return c}},[c,u]),g=b.useMemo(()=>`${c}`.trim()?p:null,[c,p]);return d.jsxs(m.Dialog,{onOpenChange:n,open:t,children:[d.jsx(m.DialogTrigger,{asChild:!0,children:e}),d.jsxs(m.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[d.jsx(m.DialogTitle,{children:i("editor.formula.dialog.text")}),d.jsx("div",{style:{height:"100%",border:"1px solid hsl(var(--border))"},children:d.jsxs("div",{className:"richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]",children:[d.jsxs("div",{className:"richtext-flex-1",children:[d.jsx(m.Label,{className:"mb-[6px]",children:"Expression"}),d.jsx(Zn.Textarea,{autoFocus:!0,className:"richtext-mb-[10px]",onChange:x=>a(x.target.value),placeholder:"Text",required:!0,rows:10,value:c,style:{color:"hsl(var(--foreground))"}}),d.jsx(m.Label,{className:"mb-[6px]",children:"Macros"}),d.jsx(Zn.Textarea,{onChange:x=>h(x.target.value),placeholder:"Macros",rows:10,value:u,style:{color:"hsl(var(--foreground))"}})]}),d.jsx("div",{className:"richtext-flex richtext-flex-1 richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",dangerouslySetInnerHTML:{__html:g||""},style:{height:"100%",borderWidth:1,minHeight:500,background:"#fff"}})]})}),d.jsx(m.DialogFooter,{children:d.jsx(m.Button,{onClick:f,type:"button",children:"Save changes"})})]})]})}function Ol(){const e=m.useEditableEditor(),t=m.useEditorInstance(),[n,i]=b.useState(!1),s=b.useCallback(()=>t.isActive(dt.Katex.name),[t]),r=b.useCallback(()=>Ht(dt.Katex.name,t),[t]);return e?d.jsx(nt,{editor:t,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleKatex",shouldShow:s,children:d.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:[d.jsx(Ml,{toggleVisible:i,visible:n,children:d.jsx(m.ActionButton,{action:()=>i(!n),tooltip:"Edit",children:d.jsx(Pt.Pencil,{size:16})})}),d.jsx(m.ActionButton,{action:r,tooltip:"Delete",children:d.jsx(Pt.Trash2,{size:16})})]})}):d.jsx(d.Fragment,{})}function jl(e){const{t}=B.useLocale();return d.jsxs("div",{className:"richtext-flex richtext-flex-nowrap",children:[d.jsx(m.ActionButton,{disabled:!(e!=null&&e.link),icon:"ExternalLink",tooltip:t("editor.link.open.tooltip"),tooltipOptions:{sideOffset:15},action:()=>{window.open(e==null?void 0:e.link,"_blank")}}),d.jsx(m.ActionButton,{icon:"Pencil",tooltip:t("editor.link.edit.tooltip"),tooltipOptions:{sideOffset:15},action:()=>{e==null||e.onEdit()}}),d.jsx(m.ActionButton,{icon:"Unlink",tooltip:t("editor.link.unlink.tooltip"),tooltipOptions:{sideOffset:15},action:()=>{e==null||e.onClear()}})]})}function Rl(){const e=m.useEditableEditor(),t=m.useEditorInstance(),[n,i]=b.useState(!1),s=dt.useAttributes(t,Ve.Link.name),r=s==null?void 0:s.href,o=b.useCallback(({editor:u})=>u.isActive(Ve.Link.name),[]),l=(u,h,f)=>{const p=t.state.selection,{from:g}=p,x=(h==null?void 0:h.length)??0,w=g+x;t.chain().extendMarkRange("link").insertContent({type:"text",text:h,marks:[{type:"link",attrs:{href:u,target:f?"_blank":""}}]}).setLink({href:u}).setTextSelection({from:g,to:w}).focus().run(),i(!1)},c=b.useCallback(()=>{t.chain().extendMarkRange("link").unsetLink().focus().run(),i(!1)},[t]),a=()=>{i(!1)};return e?d.jsx(nt,{editor:t,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleLink",shouldShow:o,children:d.jsx(d.Fragment,{children:n?d.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-4 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:d.jsx(Ve.LinkEditBlock,{editor:t,onClose:a,onSetLink:l})}):d.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:d.jsx(jl,{editor:t,link:r,onClear:c,onEdit:()=>{i(!0)}})})})}):d.jsx(d.Fragment,{})}function yi({item:e,disabled:t,editor:n}){const i=e.component;return i?d.jsx(b.Fragment,{children:e.type==="divider"?d.jsx(wt.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}):d.jsx(i,{...e.componentProps,disabled:t||(e==null?void 0:e.componentdisabled),editor:n})}):d.jsx(d.Fragment,{})}function Nl(e){return e.type.name===m.Image.name}function Bl(e){return e.type.name===Io.ImageGif.name}function Ll(e){return e.type.name===m.Video.name}function Pl(){const{lang:e,t}=B.useLocale(),n=m.useEditableEditor(),i=m.useEditorInstance(),s=({editor:o})=>{const{selection:l}=o.view.state,{$from:c,to:a}=l;let u=!1;return o.view.state.doc.nodesBetween(c.pos,a,h=>{if(Nl(h))return u=!0,!1}),u},r=b.useMemo(()=>yl(i,t),[i,e,t]);return n?d.jsx(nt,{editor:i,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleImage",shouldShow:s,children:r!=null&&r.length?d.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:r==null?void 0:r.map((o,l)=>d.jsx(yi,{editor:i,item:o},`bubbleMenu-image-${l}`))}):d.jsx(d.Fragment,{})}):d.jsx(d.Fragment,{})}function Ul(){const{lang:e,t}=B.useLocale(),n=m.useEditableEditor(),i=m.useEditorInstance(),s=({editor:o})=>{const{selection:l}=o.view.state,{$from:c,to:a}=l;let u=!1;return o.view.state.doc.nodesBetween(c.pos,a,h=>{if(Bl(h))return u=!0,!1}),u},r=b.useMemo(()=>vl(i,t),[i,t,e]);return n?d.jsx(nt,{editor:i,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleImageGif",shouldShow:s,children:r!=null&&r.length?d.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:r==null?void 0:r.map((o,l)=>d.jsx(yi,{editor:i,item:o},`bubbleMenu-image-gif-${l}`))}):d.jsx(d.Fragment,{})}):d.jsx(d.Fragment,{})}function $l(){const{t:e}=B.useLocale(),t=m.useEditableEditor(),n=m.useEditorInstance(),i=({editor:r})=>{const{selection:o}=r.view.state,{$from:l,to:c}=o;let a=!1;return r.view.state.doc.nodesBetween(l.pos,c,u=>{if(Ll(u))return a=!0,!1}),a},s=b.useMemo(()=>kl(n,e),[n,e]);return t?d.jsx(nt,{editor:n,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleVideo",shouldShow:i,children:s!=null&&s.length?d.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:s==null?void 0:s.map((r,o)=>d.jsx(yi,{editor:n,item:r},`bubbleMenu-video-${o}`))}):d.jsx(d.Fragment,{})}):d.jsx(d.Fragment,{})}const Xi=`graph TB
|
|
1
|
+
"use strict";var So=Object.create;var jn=Object.defineProperty;var Co=Object.getOwnPropertyDescriptor;var ko=Object.getOwnPropertyNames;var Eo=Object.getPrototypeOf,_o=Object.prototype.hasOwnProperty;var To=(e,t,n)=>t in e?jn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Do=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ko(t))!_o.call(e,s)&&s!==n&&jn(e,s,{get:()=>t[s],enumerable:!(i=Co(t,s))||i.enumerable});return e};var Ao=(e,t,n)=>(n=e!=null?So(Eo(e)):{},Do(t||!e||!e.__esModule?jn(n,"default",{value:e,enumerable:!0}):n,e));var Ne=(e,t,n)=>To(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),T=require("./index-Bcj8cyOO.cjs"),q=require("./index-BF3EVCB1.cjs"),Y=require("@tiptap/pm/state"),Ls=require("./Table-C5JxBXef.cjs"),Ps=require("./clsx-D6gYQn3o.cjs"),b=require("react"),wi=require("react-dom"),m=require("./index-Gi752TMk.cjs"),St=require("./Callout-DWOMZPiP.cjs"),dt=require("./Katex-D9FP7EUE.cjs"),B=require("./index-CWw4s87s.cjs"),Pt=require("lucide-react"),Rn=require("./CodeBlock.cjs"),wt=require("./separator-DpaS43Gt.cjs"),kt=require("./popover-BPzkMuyi.cjs"),Gi=require("./Column.cjs");require("./theme.cjs");const Fe=require("./Drawer-TJY4NuHx.cjs"),Yi=require("easydrawer"),Je=require("./shortId-Bfj8TyNr.cjs"),ue=require("./Excalidraw.cjs"),Wt=require("./Iframe-5zx43DL4.cjs"),Io=require("./ImageGif.cjs"),Mo=require("katex"),Zn=require("./textarea-wvARZKyA.cjs"),Ve=require("./LinkEditBlock-DQ8-iufJ.cjs"),Nn=require("@tiptap/pm/view"),Oo=require("@tiptap/pm/model"),jo=require("./Clear.cjs"),de=require("./Indent-DuwV8s1t.cjs"),Us=require("./TextAlign.cjs"),U=require("./dropdown-menu-yQ-sQ1k4.cjs"),Qn=require("./Mermaid.cjs"),Ro=require("./Bold.cjs"),No=require("./Code.cjs");require("./index-BAb_UADw.cjs");const Bo=require("./Color.cjs"),Lo=require("./Highlight.cjs"),Po=require("./Italic.cjs"),Uo=require("./SlashCommandNodeView-DNixmQGa.cjs"),$o=require("./Strike.cjs"),Fo=require("./TextUnderline.cjs"),Bn=require("./Twitter--tfifMt1.cjs");function Vo(e,t){const n=Math.min(e.top,t.top),i=Math.max(e.bottom,t.bottom),s=Math.min(e.left,t.left),o=Math.max(e.right,t.right)-s,l=i-n,c=s,a=n;return new DOMRect(c,a,o,l)}var Ho=class{constructor({editor:e,element:t,view:n,pluginKey:i="bubbleMenu",updateDelay:s=250,resizeDelay:r=60,shouldShow:o,appendTo:l,getReferencedVirtualElement:c,options:a}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:h,state:f,from:p,to:g})=>{const{doc:x,selection:w}=f,{empty:y}=w,C=!x.textBetween(p,g).length&&T.isTextSelection(f.selection),S=this.element.contains(document.activeElement);return!(!(h.hasFocus()||S)||y||C||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:h})=>{var f;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}h!=null&&h.relatedTarget&&((f=this.element.parentNode)!=null&&f.contains(h.relatedTarget))||(h==null?void 0:h.relatedTarget)!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(h,f)=>{const p=!(f!=null&&f.selection.eq(h.state.selection)),g=!(f!=null&&f.doc.eq(h.state.doc));!p&&!g||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(h,p,g,f)},this.updateDelay))},this.updateHandler=(h,f,p,g)=>{const{composing:x}=h;if(x||!f&&!p)return;if(!this.getShouldShow(g)){this.hide();return}this.show(),this.updatePosition()},this.transactionHandler=({transaction:h})=>{const f=h.getMeta(this.pluginKey);f==="updatePosition"?this.updatePosition():f&&typeof f=="object"&&f.type==="updateOptions"?this.updateOptions(f.options):f==="hide"?this.hide():f==="show"&&(this.updatePosition(),this.show())};var u;this.editor=e,this.element=t,this.view=n,this.pluginKey=i,this.updateDelay=s,this.resizeDelay=r,this.appendTo=l,this.scrollTarget=(u=a==null?void 0:a.scrollTarget)!=null?u:window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...a},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(q.flip(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(q.shift(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(q.offset(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(q.arrow(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(q.size(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(q.autoPlacement(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(q.hide(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(q.inline(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}get virtualElement(){var e,t,n;const{selection:i}=this.editor.state,s=(e=this.getReferencedVirtualElement)==null?void 0:e.call(this);if(s)return s;if(!((n=(t=this.view)==null?void 0:t.dom)!=null&&n.parentNode))return;const r=T.posToDOMRect(this.view,i.from,i.to);let o={getBoundingClientRect:()=>r,getClientRects:()=>[r]};if(i instanceof Y.NodeSelection){let l=this.view.nodeDOM(i.from);const c=l.dataset.nodeViewWrapper?l:l.querySelector("[data-node-view-wrapper]");c&&(l=c),l&&(o={getBoundingClientRect:()=>l.getBoundingClientRect(),getClientRects:()=>[l.getBoundingClientRect()]})}if(i instanceof Ls.CellSelection){const{$anchorCell:l,$headCell:c}=i,a=l?l.pos:c.pos,u=c?c.pos:l.pos,h=this.view.nodeDOM(a),f=this.view.nodeDOM(u);if(!h||!f)return;const p=h===f?h.getBoundingClientRect():Vo(h.getBoundingClientRect(),f.getBoundingClientRect());o={getBoundingClientRect:()=>p,getClientRects:()=>[p]}}return o}updatePosition(){if(!this.isVisible)return;const e=this.virtualElement;e&&q.computePosition(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:t,y:n,strategy:i,middlewareData:s})=>{var r,o;if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if((r=s.hide)!=null&&r.referenceHidden||(o=s.hide)!=null&&o.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=i,this.element.style.left=`${t}px`,this.element.style.top=`${n}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){const{state:n}=e,i=n.selection.from!==n.selection.to;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(e,t);return}const s=!(t!=null&&t.selection.eq(e.state.selection)),r=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,s,r,t)}getShouldShow(e){var t;const{state:n}=this.view,{selection:i}=n,{ranges:s}=i,r=Math.min(...s.map(c=>c.$from.pos)),o=Math.max(...s.map(c=>c.$to.pos));return((t=this.shouldShow)==null?void 0:t.call(this,{editor:this.editor,element:this.element,view:this.view,state:n,oldState:e,from:r,to:o}))||!1}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(e){var t;if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){const n=(t=e.options.scrollTarget)!=null?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},$s=e=>new Y.Plugin({key:typeof e.pluginKey=="string"?new Y.PluginKey(e.pluginKey):e.pluginKey,view:t=>new Ho({view:t,...e})});T.Extension.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[$s({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var zo=class{constructor({editor:e,element:t,view:n,pluginKey:i="floatingMenu",updateDelay:s=250,resizeDelay:r=60,options:o,appendTo:l,shouldShow:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:u,state:h})=>{const{selection:f}=h,{$anchor:p,empty:g}=f,x=p.depth===1,w=p.parent.isTextblock&&!p.parent.type.spec.code&&!p.parent.textContent&&p.parent.childCount===0&&!this.getTextContent(p.parent);return!(!u.hasFocus()||!g||!x||!w||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(u,h,f,p)=>{const{composing:g}=u;if(g||!h&&!f)return;if(!this.getShouldShow(p)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var h;if(this.preventHide){this.preventHide=!1;return}u!=null&&u.relatedTarget&&((h=this.element.parentNode)!=null&&h.contains(u.relatedTarget))||(u==null?void 0:u.relatedTarget)!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:u})=>{const h=u.getMeta(this.pluginKey);h==="updatePosition"?this.updatePosition():h&&typeof h=="object"&&h.type==="updateOptions"?this.updateOptions(h.options):h==="hide"?this.hide():h==="show"&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)};var a;this.editor=e,this.element=t,this.view=n,this.pluginKey=i,this.updateDelay=s,this.resizeDelay=r,this.appendTo=l,this.scrollTarget=(a=o==null?void 0:o.scrollTarget)!=null?a:window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return T.getText(e,{textSerializers:T.getTextSerializersFromSchema(this.editor.schema)})}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(q.flip(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(q.shift(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(q.offset(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(q.arrow(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(q.size(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(q.autoPlacement(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(q.hide(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(q.inline(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}getShouldShow(e){var t;const{state:n}=this.view,{selection:i}=n,{ranges:s}=i,r=Math.min(...s.map(c=>c.$from.pos)),o=Math.max(...s.map(c=>c.$to.pos));return(t=this.shouldShow)==null?void 0:t.call(this,{editor:this.editor,view:this.view,state:n,oldState:e,from:r,to:o})}updateOptions(e){var t;if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){const n=(t=e.options.scrollTarget)!=null?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){var e,t;if(!((t=(e=this.view)==null?void 0:e.dom)!=null&&t.parentNode))return;const{selection:n}=this.editor.state,i=T.posToDOMRect(this.view,n.from,n.to),s={getBoundingClientRect:()=>i,getClientRects:()=>[i]};q.computePosition(s,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:r,y:o,strategy:l,middlewareData:c})=>{var a,u;if((a=c.hide)!=null&&a.referenceHidden||(u=c.hide)!=null&&u.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=l,this.element.style.left=`${r}px`,this.element.style.top=`${o}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const n=!(t!=null&&t.selection.eq(e.state.selection)),i=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,n,i,t)}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Fs=e=>new Y.Plugin({key:typeof e.pluginKey=="string"?new Y.PluginKey(e.pluginKey):e.pluginKey,view:t=>new zo({view:t,...e})});T.Extension.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,"updatePosition"),!0)}},addProseMirrorPlugins(){return this.options.element?[Fs({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function Vs(e,t){return e??new Y.PluginKey(t)}var Ko=typeof window<"u"?b.useLayoutEffect:b.useEffect,Hs=new Set(["left","opacity","position","top","visibility","width"]),qo=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","columnCount","columns","fillOpacity","flex","flexGrow","flexShrink","fontWeight","gridArea","gridColumn","gridColumnEnd","gridColumnStart","gridRow","gridRowEnd","gridRowStart","lineClamp","lineHeight","opacity","order","orphans","scale","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","tabSize","widows","zIndex","zoom"]),Wo=new Set(["children","className","style"]),Go=new Set(["tabIndex"]),Yo=new Set(["accessKey","autoCapitalize","contentEditable","contextMenu","dir","draggable","enterKeyHint","hidden","id","lang","nonce","role","slot","spellCheck","tabIndex","title","translate"]),Jo={Blur:"focusout",DoubleClick:"dblclick",Focus:"focusin",MouseEnter:"mouseenter",MouseLeave:"mouseleave"};function ti(e,t){return/^on[A-Z]/.test(e)&&typeof t=="function"}function Xo(e){return e.startsWith("aria-")||e.startsWith("data-"),e}function Zo(e){return e.startsWith("aria-")||e.startsWith("data-")||Yo.has(e)}function zs(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Qo(e){var t;const n=e.endsWith("Capture"),s=(n?e.slice(0,-7):e).slice(2);return{eventName:(t=Jo[s])!=null?t:s.toLowerCase(),options:n?{capture:!0}:void 0}}function tl(e,t){let n=t.defaultPrevented,i=!1;const s=Object.create(t);return Object.defineProperties(s,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>{}},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>i},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{i=!0,t.stopPropagation()}}}),s}function Ln(e){return Go.has(e)}function Ji(e,t,n){if(t==="tabIndex"){e.tabIndex=Number(n);return}e[t]=n}function el(e,t){if(t==="tabIndex"){e.removeAttribute("tabindex");return}const n=e[t];if(typeof n=="boolean"){e[t]=!1;return}if(typeof n=="number"){e[t]=0;return}e[t]=""}function nl(e,t){return typeof t!="number"||t===0||e.startsWith("--")||qo.has(e)?String(t):`${t}px`}function il(e,t){Hs.has(t)||e.style.removeProperty(zs(t))}function sl(e,t,n){Hs.has(t)||e.style.setProperty(zs(t),nl(t,n))}function rl(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(s=>{if(Wo.has(s)||!Zo(s)||ti(s,t[s])||ti(s,n[s]))return;const r=t[s],o=n[s];if(r===o)return;const l=Xo(s);if(o==null||o===!1){Ln(s)&&el(e,s),e.removeAttribute(l);return}if(o===!0){Ln(s)&&Ji(e,s,!0),e.setAttribute(l,"");return}if(Ln(s)){Ji(e,s,o);return}e.setAttribute(l,String(o))})}function ol(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute("class")}}function ll(e,t,n){const i=t??{},s=n??{};new Set([...Object.keys(i),...Object.keys(s)]).forEach(o=>{const l=i[o],c=s[o];if(l!==c){if(c==null){il(e,o);return}sl(e,o,c)}})}function cl(e,t,n){t.forEach(({eventName:s,listener:r,options:o})=>{e.removeEventListener(s,r,o)});const i=[];return Object.entries(n).forEach(([s,r])=>{if(!ti(s,r))return;const{eventName:o,options:l}=Qo(s),c=a=>{r(tl(e,a))};e.addEventListener(o,c,l),i.push({eventName:o,listener:c,options:l})}),i}function Ks(e,t){const n=b.useRef({}),i=b.useRef([]);Ko(()=>{const s=n.current;return ol(e,s.className,t.className),ll(e,s.style,t.style),rl(e,s,t),i.current=cl(e,i.current,t),n.current=t,()=>{i.current.forEach(({eventName:r,listener:o,options:l})=>{e.removeEventListener(r,o,l)}),i.current=[]}},[e,t])}var nt=b.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:i,appendTo:s,shouldShow:r=null,getReferencedVirtualElement:o,options:l,children:c,...a},u)=>{const h=b.useRef(document.createElement("div")),f=b.useRef(Vs(e,"bubbleMenu")).current;Ks(h.current,a),typeof u=="function"?u(h.current):u&&(u.current=h.current);const{editor:p}=Ps.useCurrentEditor(),g=t||p,x={updateDelay:n,resizeDelay:i,appendTo:s,pluginKey:f,shouldShow:r,getReferencedVirtualElement:o,options:l},w=b.useRef(x);w.current=x;const[y,C]=b.useState(!1),S=b.useRef(!0);return b.useEffect(()=>{if(g!=null&&g.isDestroyed)return;if(!g){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const D=h.current;D.style.visibility="hidden",D.style.position="absolute";const H=$s({...w.current,editor:g,element:D});g.registerPlugin(H);const A=w.current.pluginKey;return S.current=!0,C(!0),()=>{C(!1),g.unregisterPlugin(A),window.requestAnimationFrame(()=>{D.parentNode&&D.parentNode.removeChild(D)})}},[g]),b.useEffect(()=>{if(!(!y||!g||g.isDestroyed)){if(S.current){S.current=!1;return}g.view.dispatch(g.state.tr.setMeta(f,{type:"updateOptions",options:w.current}))}},[y,g,n,i,r,l,s,o,f]),wi.createPortal(c,h.current)});b.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:i,appendTo:s,shouldShow:r=null,options:o,children:l,...c},a)=>{const u=b.useRef(document.createElement("div")),h=b.useRef(Vs(e,"floatingMenu")).current;Ks(u.current,c),typeof a=="function"?a(u.current):a&&(a.current=u.current);const{editor:f}=Ps.useCurrentEditor(),p=t||f,g={updateDelay:n,resizeDelay:i,appendTo:s,pluginKey:h,shouldShow:r,options:o},x=b.useRef(g);x.current=g;const[w,y]=b.useState(!1),C=b.useRef(!0);return b.useEffect(()=>{if(p!=null&&p.isDestroyed)return;if(!p){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const S=u.current;S.style.visibility="hidden",S.style.position="absolute";const D=Fs({...x.current,editor:p,element:S});p.registerPlugin(D);const H=x.current.pluginKey;return C.current=!0,y(!0),()=>{y(!1),p.unregisterPlugin(H),window.requestAnimationFrame(()=>{S.parentNode&&S.parentNode.removeChild(S)})}},[p]),b.useEffect(()=>{if(!(!w||!p||p.isDestroyed)){if(C.current){C.current=!1;return}p.view.dispatch(p.state.tr.setMeta(h,{type:"updateOptions",options:x.current}))}},[w,p,n,i,r,o,s,h]),wi.createPortal(l,u.current)});function Ht(e,t){const{state:n}=t,i=n.selection.$anchor;let s=!1;if(i.depth)for(let r=i.depth;r>0;r--)i.node(r).type.name===e&&(t.dispatchTransaction&&t.dispatchTransaction(n.tr.delete(i.before(r),i.after(r)).scrollIntoView()),s=!0);else{const r=n.selection.node;r&&r.type.name===e&&(t.chain().deleteSelection().run(),s=!0)}if(!s){const r=i.pos;if(r){const o=n.tr.doc.nodeAt(r);o&&o.type.name===e&&(t.dispatchTransaction&&t.dispatchTransaction(n.tr.delete(r,r+o.nodeSize)),s=!0)}}return s}const al=[{value:"note",label:"Note",icon:"Info"},{value:"tip",label:"Tip",icon:"Lightbulb"},{value:"important",label:"Important",icon:"AlertCircle"},{value:"warning",label:"Warning",icon:"TriangleAlert"},{value:"caution",label:"Caution",icon:"OctagonAlert"}];function hl(){const e=m.useEditableEditor(),t=m.useEditorInstance(),{t:n}=B.useLocale(),{type:i,title:s,body:r}=dt.useAttributes(t,St.Callout.name,{type:"note",title:"",body:""}),[o,l]=b.useState(!1),[c,a]=b.useState("note"),[u,h]=b.useState(""),[f,p]=b.useState("");b.useEffect(()=>{o&&(a(i||"note"),h(s||""),p(r||""))},[o,i,s,r]);const g=b.useCallback(()=>{t&&(t.chain().updateAttributes(St.Callout.name,{type:c,title:u,body:f}).focus().run(),l(!1))},[t,c,u,f]),x=b.useCallback(()=>{l(!1)},[]),w=b.useCallback(()=>{Ht(St.Callout.name,t)},[t]),y=b.useCallback(()=>t.isActive(St.Callout.name),[t]);return e?d.jsx(nt,{editor:t,options:{placement:"top",offset:8,flip:!0},pluginKey:"RichTextBubbleCallout",shouldShow:y,children:d.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:[d.jsxs(m.Dialog,{onOpenChange:l,open:o,children:[d.jsx(m.DialogTrigger,{asChild:!0,children:d.jsx(m.ActionButton,{icon:"Pencil",tooltip:n("editor.callout.edit.title")})}),d.jsxs(m.DialogContent,{children:[d.jsx(m.DialogTitle,{children:n("editor.callout.edit.title")}),d.jsxs("div",{className:"richtext-space-y-4 richtext-py-4",children:[d.jsxs("div",{className:"richtext-space-y-2",children:[d.jsx(m.Label,{children:n("editor.callout.dialog.type")}),d.jsxs(St.Select,{onValueChange:a,value:c,children:[d.jsx(St.SelectTrigger,{children:d.jsx(St.SelectValue,{className:"richtext-text-accent",placeholder:n("editor.callout.dialog.type.placeholder")})}),d.jsx(St.SelectContent,{children:al.map(C=>d.jsx(St.SelectItem,{value:C.value,children:n(`editor.callout.type.${C.value}`)},C.value))})]})]}),d.jsxs("div",{className:"richtext-space-y-2",children:[d.jsx(m.Label,{children:n("editor.callout.dialog.title.label")}),d.jsx(m.Input,{onChange:C=>h(C.target.value),placeholder:n("editor.callout.dialog.title.placeholder"),type:"text",value:u})]}),d.jsxs("div",{className:"richtext-space-y-2",children:[d.jsx(m.Label,{children:n("editor.callout.dialog.body.label")}),d.jsx(m.Input,{onChange:C=>p(C.target.value),placeholder:n("editor.callout.dialog.body.placeholder"),type:"text",value:f})]})]}),d.jsxs(m.DialogFooter,{children:[d.jsx(m.Button,{onClick:x,variant:"outline",children:n("editor.callout.dialog.button.cancel")}),d.jsx(m.Button,{onClick:g,children:n("editor.callout.dialog.button.apply")})]})]})]}),d.jsx(m.ActionButton,{action:w,icon:"Trash2",tooltip:n("editor.delete")})]})}):d.jsx(d.Fragment,{})}function ul(){const e=m.useEditableEditor(),t=m.useEditorInstance(),{t:n}=B.useLocale(),i=b.useCallback(()=>t.isActive(Gi.MultipleColumnNode.name),[t]),s=b.useCallback(()=>Ht(Gi.MultipleColumnNode.name,t),[t]),r=b.useCallback(()=>t.chain().focus().addColBefore().run(),[t]),o=b.useCallback(()=>t.chain().focus().addColAfter().run(),[t]),l=b.useCallback(()=>t.chain().focus().deleteCol().run(),[t]);return e?d.jsx(nt,{editor:t,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleColumns",shouldShow:i,children:d.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:[d.jsx(m.ActionButton,{action:r,icon:"ColumnAddLeft",tooltip:n("editor.table.menu.insertColumnBefore")}),d.jsx(m.ActionButton,{action:o,icon:"ColumnAddRight",tooltip:n("editor.table.menu.insertColumnAfter")}),d.jsx(m.ActionButton,{action:l,icon:"DeleteColumn",tooltip:n("editor.table.menu.deleteColumn")}),d.jsx(m.ActionButton,{action:s,icon:"Trash2",tooltip:n("editor.table.menu.delete_column")})]})}):d.jsx(d.Fragment,{})}function dl(e,t){const n=["size-small","size-medium","size-large"],i=["SizeS","SizeM","SizeL"];return n.map((s,r)=>({type:`image-${s}`,component:m.ActionButton,componentProps:{tooltip:t(`editor.${s.replace("-",".")}.tooltip`),icon:i[r],action:()=>e.commands.updateImage({width:B.IMAGE_SIZE[s]}),isActive:()=>e.isActive("image",{width:B.IMAGE_SIZE[s]})}}))}function fl(e,t){const n=["size-small","size-medium","size-large"],i=["SizeS","SizeM","SizeL"];return n.map((s,r)=>({type:`image-${s}`,component:m.ActionButton,componentProps:{tooltip:t(`editor.${s.replace("-",".")}.tooltip`),icon:i[r],action:()=>e.commands.updateImageGif({width:B.IMAGE_SIZE[s]}),isActive:()=>e.isActive("image",{width:B.IMAGE_SIZE[s]})}}))}function pl(e,t){const n=["left","center","right"],i={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return n.map(s=>({type:`image-${s}`,component:m.ActionButton,componentProps:{tooltip:t(`editor.textalign.${s}.tooltip`),icon:i[s],action:()=>{var r,o;return(o=(r=e.commands)==null?void 0:r.setAlignImage)==null?void 0:o.call(r,s)},isActive:()=>e.isActive({align:s})||!1,disabled:!1}}))}function gl(e,t){const n=["left","center","right"],i={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return n.map(s=>({type:`image-${s}`,component:m.ActionButton,componentProps:{tooltip:t(`editor.textalign.${s}.tooltip`),icon:i[s],action:()=>{var r,o;return(o=(r=e.commands)==null?void 0:r.setAlignImageGif)==null?void 0:o.call(r,s)},isActive:()=>e.isActive({align:s})||!1,disabled:!1}}))}function ml(e,t){const n=["left","center","right"],i={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return n.map(s=>({type:`image-${s}`,component:m.ActionButton,componentProps:{tooltip:t(`editor.textalign.${s}.tooltip`),icon:i[s],action:()=>{var r,o;return(o=(r=e.commands)==null?void 0:r.setAlignImageMermaid)==null?void 0:o.call(r,s)},isActive:()=>e.isActive({align:s})||!1,disabled:!1}}))}function xl(e,t){const n=["left","center","right"],i={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return n.map(s=>({type:`image-${s}`,component:m.ActionButton,componentProps:{tooltip:t(`editor.textalign.${s}.tooltip`),icon:i[s],action:()=>{var r,o;return(o=(r=e.commands)==null?void 0:r.setAlignImageDrawer)==null?void 0:o.call(r,s)},isActive:()=>e.isActive({align:s})||!1,disabled:!1}}))}function bl(e){return[{type:"flex-start",icon:"AlignLeft",tooltip:"Align left"},{type:"center",icon:"AlignCenter",tooltip:"Align center"},{type:"flex-end",icon:"AlignRight",tooltip:"Align right"}].map(n=>({type:`video-align-${n.type}`,component:m.ActionButton,componentProps:{tooltip:n.tooltip,icon:n.icon,action:()=>e.commands.updateVideo({align:n.type}),isActive:()=>e.getAttributes("video").align===n.type}}))}function wl(e,t){const n=["size-small","size-medium","size-large"],i=["SizeS","SizeM","SizeL"];return n.map((s,r)=>({type:`video-${s}`,component:m.ActionButton,componentProps:{tooltip:t(`editor.${s.replace("-",".")}.tooltip`),icon:i[r],action:()=>e.commands.updateVideo({width:B.VIDEO_SIZE[s]}),isActive:()=>e.isActive("video",{width:B.VIDEO_SIZE[s]})}}))}function yl(e,t){return[{type:"flipX",component:m.ActionButton,componentProps:{editor:e,tooltip:t("editor.tooltip.flipX"),icon:"FlipX",action:()=>{const n=e.getAttributes("image"),{flipX:i}=n;e.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipX:!i}).run()}}},{type:"flipY",component:m.ActionButton,componentProps:{editor:e,tooltip:t("editor.tooltip.flipY"),icon:"FlipY",action:()=>{const n=e.getAttributes("image"),{flipY:i}=n;e.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipY:!i}).run()}}},...dl(e,t),...pl(e,t),{type:"remove",component:m.ActionButton,componentProps:{editor:e,tooltip:t("editor.remove"),icon:"Trash2",action:()=>{const{state:n,dispatch:i}=e.view;T.deleteSelection(n,i)}}}]}function vl(e,t){return[...fl(e,t),...gl(e,t),{type:"remove",component:m.ActionButton,componentProps:{editor:e,tooltip:t("editor.remove"),icon:"Trash2",action:()=>{const{state:n,dispatch:i}=e.view;T.deleteSelection(n,i)}}}]}function Sl(e,t){return[...ml(e,t),{type:"edit",component:m.ActionButton,componentProps:{editor:e,tooltip:t("editor.edit"),icon:"Pencil",action:()=>!0}},{type:"remove",component:m.ActionButton,componentProps:{editor:e,tooltip:t("editor.remove"),icon:"Trash2",action:()=>{const{state:n,dispatch:i}=e.view;T.deleteSelection(n,i)}}}]}function Cl(e,t){return[...xl(e,t),{type:"edit",component:m.ActionButton,componentProps:{editor:e,tooltip:t("editor.edit"),icon:"Pencil",action:()=>!0}},{type:"remove",component:m.ActionButton,componentProps:{editor:e,tooltip:t("editor.remove"),icon:"Trash2",action:()=>{const{state:n,dispatch:i}=e.view;T.deleteSelection(n,i)}}}]}function kl(e,t){return[...wl(e,t),...bl(e),{type:"remove",component:m.ActionButton,componentProps:{editor:e,tooltip:t("editor.remove"),icon:"Trash2",action:()=>{const{state:n,dispatch:i}=e.view;T.deleteSelection(n,i)}}}]}let fe=!1;function El({editor:e,attrs:t,extension:n}){const[i,s]=b.useState(!1),r=b.useRef(null),o=b.useRef(null),{alt:l,align:c}=t,a=n==null?void 0:n.options.upload,u=()=>{(async()=>{const v=document.querySelector("#easydrawer");v&&(r.current=new Yi.Editor(v,{wheelEventsEnabled:!1,disableZoom:!0}),o.current=Yi.makeDropdownToolbar(r.current),o.current.addDefaultToolWidgets(),r.current.loadFromSVG(decodeURIComponent(l)))})()};b.useEffect(()=>{i&&setTimeout(()=>{u()},200)},[i]);const h=async()=>{if(r.current){const A=r.current.toSVG(),v=A.outerHTML,k=`drawer-${Je.shortId()}.svg`;let L=Je.i(A.outerHTML);if(a){const z=m.dataURLtoFile(L,k);L=await a(z)}e==null||e.chain().focus().setDrawer({type:"drawer",src:L,alt:encodeURIComponent(v),width:426,height:212},!!v).run(),e==null||e.commands.setAlignImageDrawer(c)}s(!1)},f=A=>{const v=r.current.toolController.getPrimaryTools()[2],k=o.current.getWidgetById("pen-1");v&&k&&(v.setColor(A),k.serializeState())},p=A=>{const v=r.current.toolController.getPrimaryTools()[2],k=o.current.getWidgetById("pen-1");v&&k&&(v.setThickness(A),k.serializeState())},g=A=>{const v=r.current.toolController.getPrimaryTools()[3],k=o.current.getWidgetById("pen-2");v&&k&&(v.setColor(A),k.serializeState())},x=A=>{const v=o.current.getWidgetById("shape");v&&v.setShapeType(A)},w=A=>{const v=r.current.toolController.getPrimaryTools()[5],k=o.current.getWidgetById("shape");v&&k&&(v.setColor(A),k.serializeState())},y=A=>{const v=r.current.toolController.getPrimaryTools()[5],k=o.current.getWidgetById("shape");v&&k&&(v.setThickness(A),k.serializeState())},C=A=>{const v=r.current.toolController.getPrimaryTools()[5],k=o.current.getWidgetById("shape");v&&k&&(v.setBorderColor(A),k.serializeState())},S=()=>{if(fe){for(;r.current.history.redoStackSize>0;)r.current.history.redo();fe=!1;return}r.current.history.undo()},D=()=>{fe||r.current.history.redo()},H=()=>{if(!fe){for(;r.current.history.undoStackSize>0;)S();fe=!0}};return d.jsxs(m.Dialog,{onOpenChange:s,open:i,children:[d.jsx(m.DialogTrigger,{asChild:!0,children:d.jsx(m.ActionButton,{action:()=>s(!0),icon:"Pencil",tooltip:"Edit Drawer"})}),d.jsxs(m.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[d.jsx(m.DialogTitle,{children:"Edit Drawer"}),d.jsxs("div",{style:{height:"100%",borderWidth:1,background:"white",position:"relative"},children:[d.jsx("div",{className:"richtext-size-full",id:"easydrawer"}),d.jsx(Fe.ControlDrawer,{changeBorderColorShape:C,changeColorShape:w,changeShape:x,onClear:H,onRedo:D,onThicknessChange:y,onUndo:S,refEditor:r,setColorHighlight:g,setColorPen:f,setThicknessPen:p})]}),d.jsx(m.DialogFooter,{children:d.jsx(m.Button,{onClick:h,type:"button",children:"Save changes"})})]})]})}function _l({item:e,disabled:t,editor:n}){var s;const i=e.component;return i?d.jsx(b.Fragment,{children:e.type==="divider"?d.jsx(wt.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}):d.jsx(i,{...e.componentProps,disabled:t||((s=e==null?void 0:e.componentProps)==null?void 0:s.disabled),editor:n})}):d.jsx(d.Fragment,{})}function Tl(){const{lang:e,t}=B.useLocale(),n=m.useEditableEditor(),i=m.useEditorInstance(),s=dt.useAttributes(i,Fe.Drawer.name),r=m.useExtension(Fe.Drawer.name),o=({editor:c})=>{const{selection:a}=c.view.state,{$from:u,to:h}=a;let f=!1;return c.view.state.doc.nodesBetween(u.pos,h,p=>{if(p.type.name===Fe.Drawer.name)return f=!0,!1}),f},l=b.useMemo(()=>Cl(i,t),[i,e,t]);return n?d.jsx(nt,{editor:i,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleDrawer",shouldShow:o,children:l!=null&&l.length?d.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:l==null?void 0:l.map((c,a)=>c.type==="edit"&&(s!=null&&s.src)?d.jsx(El,{attrs:s,editor:i,extension:r},`bubbleMenu-drawer-${a}`):d.jsx(_l,{editor:i,item:c},`bubbleMenu-drawer-${a}`))}):d.jsx(d.Fragment,{})}):d.jsx(d.Fragment,{})}const qs=({width:e,maxWidth:t,height:n,onOk:i,children:s})=>{const{t:r}=B.useLocale(),[o,l]=b.useState({width:"",height:"",maxWidth:""});b.useEffect(()=>{l({width:e,height:n,maxWidth:t})},[n,t,e]);function c(a){a.preventDefault(),a.stopPropagation(),i(o)}return d.jsxs(kt.Popover,{modal:!0,children:[d.jsx(kt.PopoverTrigger,{asChild:!0,children:s}),d.jsx(kt.PopoverContent,{children:d.jsxs("form",{className:"richtext-flex richtext-flex-col richtext-gap-2",onSubmit:c,children:[d.jsx(m.Label,{className:"mb-[6px]",children:"Width"}),d.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:d.jsx("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:d.jsx(m.Input,{onChange:a=>l({...o,width:a.target.value}),required:!0,type:"number",value:o.width})})}),d.jsx(m.Label,{className:"mb-[6px]",children:"Max Width"}),d.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:d.jsx("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:d.jsx(m.Input,{onChange:a=>l({...o,maxWidth:a.target.value}),required:!0,type:"number",value:o.maxWidth})})}),d.jsx(m.Label,{className:"mb-[6px]",children:"Height"}),d.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:d.jsx("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:d.jsx(m.Input,{onChange:a=>l({...o,height:a.target.value}),required:!0,type:"number",value:o.height})})}),d.jsx(m.Button,{className:"richtext-mt-2 richtext-self-end",type:"submit",children:r("editor.link.dialog.button.apply")})]})})]})},Nt=new Map;function Dl(e){const t=e.options.element;Nt.has("width")||Nt.set("width",t.clientWidth),Nt.has("width")&&Nt.get("width")<=0&&Nt.set("width",t.clientWidth);const n={attributes:!0,childList:!0,subtree:!0},i=function(){Nt.set("width",t.clientWidth)},s=new MutationObserver(i);return s.observe(t,n),e.on("destroy",()=>{s.disconnect()}),{width:Nt.get("width")}}function Al(){const e=m.useEditableEditor(),t=m.useEditorInstance(),{t:n}=B.useLocale(),{width:i}=Dl(t),s=dt.useAttributes(t,ue.Excalidraw.name,{defaultShowPicker:!1,createUser:"",width:0,height:0}),{defaultShowPicker:r,createUser:o,width:l,height:c}=s,a=b.useCallback(p=>{t.chain().updateAttributes(ue.Excalidraw.name,p).setNodeSelection(t.state.selection.from).focus().run()},[t]),u=b.useCallback(()=>{const p=m.EVENTS.EXCALIDRAW(t.id);m.emit(p,s)},[t,s]),h=b.useCallback(()=>t.isActive(ue.Excalidraw.name),[t]),f=b.useCallback(()=>Ht(ue.Excalidraw.name,t),[t]);return b.useEffect(()=>{r&&(u(),t.chain().updateAttributes(ue.Excalidraw.name,{defaultShowPicker:!1}).focus().run())},[o,r,t,u]),e?d.jsx(nt,{editor:t,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleExcalidraw",shouldShow:h,children:d.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:[d.jsx(m.ActionButton,{action:u,icon:"Pencil",tooltip:n("editor.edit")}),d.jsx(qs,{height:c,maxWidth:i,onOk:a,width:l,children:d.jsx(m.ActionButton,{icon:"Settings",tooltip:n("editor.settings")})}),d.jsx(m.ActionButton,{action:f,icon:"Trash2",tooltip:n("editor.delete")})]})}):d.jsx(d.Fragment,{})}function Il(){const e=m.useEditableEditor(),t=m.useEditorInstance(),{t:n}=B.useLocale(),{width:i,height:s,src:r}=dt.useAttributes(t,Wt.Iframe.name,{width:0,height:0,src:"",defaultShowPicker:!1}),[o,l]=b.useState(!1),[c,a]=b.useState(""),u=b.useCallback(w=>{var y;(y=w==null?void 0:w.preventDefault)==null||y.call(w),l(!1)},[l]);b.useEffect(()=>{o&&a(r)},[o,r]);const h=b.useCallback(w=>{var C;(C=w==null?void 0:w.preventDefault)==null||C.call(w);const y=Wt.getServiceSrc(c);t.chain().updateAttributes(Wt.Iframe.name,{src:(y==null?void 0:y.src)||c}).setNodeSelection(t.state.selection.from).focus().run(),l(!1)},[t,c,l]),f=b.useCallback(()=>{window.open(r,"_blank")},[r]),p=b.useCallback(w=>{t.chain().updateAttributes(Wt.Iframe.name,w).setNodeSelection(t.state.selection.from).focus().run()},[t]),g=b.useCallback(()=>t.isActive(Wt.Iframe.name)&&!r,[t,r]),x=b.useCallback(()=>Ht(Wt.Iframe.name,t),[t]);return e?d.jsx(d.Fragment,{children:d.jsx(nt,{editor:t,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleIframe",shouldShow:g,children:d.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:[d.jsx(m.ActionButton,{action:f,icon:"Eye",tooltip:"Visit Link"}),d.jsxs(m.Dialog,{onOpenChange:l,open:o,children:[d.jsx(m.DialogTrigger,{asChild:!0,children:d.jsx(m.ActionButton,{icon:"Pencil",tooltip:"Open Edit Link"})}),d.jsxs(m.DialogContent,{children:[d.jsx(m.DialogHeader,{children:d.jsx(m.DialogTitle,{children:"Edit Link Iframe"})}),d.jsx(m.Input,{autoFocus:!0,onInput:w=>a(w.target.value),placeholder:"Enter link",type:"url",value:c}),d.jsxs(m.DialogFooter,{children:[d.jsx(m.Button,{onClick:u,type:"button",children:"Cancel"}),d.jsx(m.Button,{onClick:h,type:"button",children:"OK"})]})]})]}),d.jsx(qs,{height:s,onOk:p,width:i,children:d.jsx(m.ActionButton,{icon:"Settings",tooltip:n("editor.settings")})}),d.jsx(m.ActionButton,{action:x,icon:"Trash2",tooltip:n("editor.delete")})]})})}):d.jsx(d.Fragment,{})}function Ml({children:e,visible:t,toggleVisible:n}){const{t:i}=B.useLocale(),s=m.useEditorInstance(),r=dt.useAttributes(s,dt.Katex.name,{text:"",macros:""}),{text:o,macros:l}=r,[c,a]=b.useState(decodeURIComponent(o||"")),[u,h]=b.useState(decodeURIComponent(l||""));b.useEffect(()=>{t&&(a(decodeURIComponent(o||"")),h(decodeURIComponent(l||"")))},[t]);const f=b.useCallback(()=>{s.chain().focus().setKatex({text:encodeURIComponent(c),macros:encodeURIComponent(u)}).run(),a(""),h(""),n(!1)},[s,c,u,n]),p=b.useMemo(()=>{try{return Mo.renderToString(c,{macros:dt.safeJSONParse(u||"")})}catch{return c}},[c,u]),g=b.useMemo(()=>`${c}`.trim()?p:null,[c,p]);return d.jsxs(m.Dialog,{onOpenChange:n,open:t,children:[d.jsx(m.DialogTrigger,{asChild:!0,children:e}),d.jsxs(m.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[d.jsx(m.DialogTitle,{children:i("editor.formula.dialog.text")}),d.jsx("div",{style:{height:"100%",border:"1px solid hsl(var(--border))"},children:d.jsxs("div",{className:"richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]",children:[d.jsxs("div",{className:"richtext-flex-1",children:[d.jsx(m.Label,{className:"mb-[6px]",children:"Expression"}),d.jsx(Zn.Textarea,{autoFocus:!0,className:"richtext-mb-[10px]",onChange:x=>a(x.target.value),placeholder:"Text",required:!0,rows:10,value:c,style:{color:"hsl(var(--foreground))"}}),d.jsx(m.Label,{className:"mb-[6px]",children:"Macros"}),d.jsx(Zn.Textarea,{onChange:x=>h(x.target.value),placeholder:"Macros",rows:10,value:u,style:{color:"hsl(var(--foreground))"}})]}),d.jsx("div",{className:"richtext-flex richtext-flex-1 richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",dangerouslySetInnerHTML:{__html:g||""},style:{height:"100%",borderWidth:1,minHeight:500,background:"#fff"}})]})}),d.jsx(m.DialogFooter,{children:d.jsx(m.Button,{onClick:f,type:"button",children:"Save changes"})})]})]})}function Ol(){const e=m.useEditableEditor(),t=m.useEditorInstance(),[n,i]=b.useState(!1),s=b.useCallback(()=>t.isActive(dt.Katex.name),[t]),r=b.useCallback(()=>Ht(dt.Katex.name,t),[t]);return e?d.jsx(nt,{editor:t,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleKatex",shouldShow:s,children:d.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:[d.jsx(Ml,{toggleVisible:i,visible:n,children:d.jsx(m.ActionButton,{action:()=>i(!n),tooltip:"Edit",children:d.jsx(Pt.Pencil,{size:16})})}),d.jsx(m.ActionButton,{action:r,tooltip:"Delete",children:d.jsx(Pt.Trash2,{size:16})})]})}):d.jsx(d.Fragment,{})}function jl(e){const{t}=B.useLocale();return d.jsxs("div",{className:"richtext-flex richtext-flex-nowrap",children:[d.jsx(m.ActionButton,{disabled:!(e!=null&&e.link),icon:"ExternalLink",tooltip:t("editor.link.open.tooltip"),tooltipOptions:{sideOffset:15},action:()=>{window.open(e==null?void 0:e.link,"_blank")}}),d.jsx(m.ActionButton,{icon:"Pencil",tooltip:t("editor.link.edit.tooltip"),tooltipOptions:{sideOffset:15},action:()=>{e==null||e.onEdit()}}),d.jsx(m.ActionButton,{icon:"Unlink",tooltip:t("editor.link.unlink.tooltip"),tooltipOptions:{sideOffset:15},action:()=>{e==null||e.onClear()}})]})}function Rl(){const e=m.useEditableEditor(),t=m.useEditorInstance(),[n,i]=b.useState(!1),s=dt.useAttributes(t,Ve.Link.name),r=s==null?void 0:s.href,o=b.useCallback(({editor:u})=>u.isActive(Ve.Link.name),[]),l=(u,h,f)=>{const p=t.state.selection,{from:g}=p,x=(h==null?void 0:h.length)??0,w=g+x;t.chain().extendMarkRange("link").insertContent({type:"text",text:h,marks:[{type:"link",attrs:{href:u,target:f?"_blank":""}}]}).setLink({href:u}).setTextSelection({from:g,to:w}).focus().run(),i(!1)},c=b.useCallback(()=>{t.chain().extendMarkRange("link").unsetLink().focus().run(),i(!1)},[t]),a=()=>{i(!1)};return e?d.jsx(nt,{editor:t,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleLink",shouldShow:o,children:d.jsx(d.Fragment,{children:n?d.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-4 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:d.jsx(Ve.LinkEditBlock,{editor:t,onClose:a,onSetLink:l})}):d.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:d.jsx(jl,{editor:t,link:r,onClear:c,onEdit:()=>{i(!0)}})})})}):d.jsx(d.Fragment,{})}function yi({item:e,disabled:t,editor:n}){const i=e.component;return i?d.jsx(b.Fragment,{children:e.type==="divider"?d.jsx(wt.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}):d.jsx(i,{...e.componentProps,disabled:t||(e==null?void 0:e.componentdisabled),editor:n})}):d.jsx(d.Fragment,{})}function Nl(e){return e.type.name===m.Image.name}function Bl(e){return e.type.name===Io.ImageGif.name}function Ll(e){return e.type.name===m.Video.name}function Pl(){const{lang:e,t}=B.useLocale(),n=m.useEditableEditor(),i=m.useEditorInstance(),s=({editor:o})=>{const{selection:l}=o.view.state,{$from:c,to:a}=l;let u=!1;return o.view.state.doc.nodesBetween(c.pos,a,h=>{if(Nl(h))return u=!0,!1}),u},r=b.useMemo(()=>yl(i,t),[i,e,t]);return n?d.jsx(nt,{editor:i,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleImage",shouldShow:s,children:r!=null&&r.length?d.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:r==null?void 0:r.map((o,l)=>d.jsx(yi,{editor:i,item:o},`bubbleMenu-image-${l}`))}):d.jsx(d.Fragment,{})}):d.jsx(d.Fragment,{})}function Ul(){const{lang:e,t}=B.useLocale(),n=m.useEditableEditor(),i=m.useEditorInstance(),s=({editor:o})=>{const{selection:l}=o.view.state,{$from:c,to:a}=l;let u=!1;return o.view.state.doc.nodesBetween(c.pos,a,h=>{if(Bl(h))return u=!0,!1}),u},r=b.useMemo(()=>vl(i,t),[i,t,e]);return n?d.jsx(nt,{editor:i,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleImageGif",shouldShow:s,children:r!=null&&r.length?d.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:r==null?void 0:r.map((o,l)=>d.jsx(yi,{editor:i,item:o},`bubbleMenu-image-gif-${l}`))}):d.jsx(d.Fragment,{})}):d.jsx(d.Fragment,{})}function $l(){const{t:e}=B.useLocale(),t=m.useEditableEditor(),n=m.useEditorInstance(),i=({editor:r})=>{const{selection:o}=r.view.state,{$from:l,to:c}=o;let a=!1;return r.view.state.doc.nodesBetween(l.pos,c,u=>{if(Ll(u))return a=!0,!1}),a},s=b.useMemo(()=>kl(n,e),[n,e]);return t?d.jsx(nt,{editor:n,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleVideo",shouldShow:i,children:s!=null&&s.length?d.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:s==null?void 0:s.map((r,o)=>d.jsx(yi,{editor:n,item:r},`bubbleMenu-video-${o}`))}):d.jsx(d.Fragment,{})}):d.jsx(d.Fragment,{})}const Xi=`graph TB
|
|
2
2
|
a-->b`,Fl=({editor:e,attrs:t,extension:n})=>{const{alt:i,align:s}=t,[r,o]=b.useState(decodeURIComponent(i??Xi)),[l,c]=b.useState(""),[a,u]=b.useState(!1),h=b.useRef(null),[f,p]=b.useState(null),g=n==null?void 0:n.options.upload,x=b.useCallback(S=>{S&&import("mermaid").then(D=>{p(D.default)})},[]),w=async S=>{try{const{svg:D}=await f.render("mermaid-svg",S);c(D)}catch{c("")}},y=()=>{f.initialize({darkMode:!1,startOnLoad:!1,fontSize:12,theme:"base"}),w(r)};b.useEffect(()=>{f&&a&&y()},[f,a]),b.useEffect(()=>{f&&a&&w(r)},[f,r]);const C=async()=>{if(r!==""){if(r){const S=h.current.querySelector("svg"),{width:D,height:H}=S.getBoundingClientRect(),A=`mermaid-${Je.shortId()}.svg`;let v=Je.i(S.outerHTML);if(g){const k=m.dataURLtoFile(v,A);v=await g(k)}e==null||e.chain().focus().setMermaid({type:"mermaid",src:v,alt:encodeURIComponent(r),width:D,height:H},!!r).run(),e==null||e.commands.setAlignImageMermaid(s)}u(!1)}};return d.jsxs(m.Dialog,{onOpenChange:u,open:a,children:[d.jsx(m.DialogTrigger,{asChild:!0,children:d.jsx(m.ActionButton,{action:()=>u(!0),icon:"Pencil",tooltip:"Edit Mermaid"})}),d.jsxs(m.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[d.jsx(m.DialogTitle,{children:"Edit Mermaid"}),d.jsx("div",{ref:x,style:{height:"100%",border:"1px solid hsl(var(--border))"},children:d.jsxs("div",{className:"richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]",children:[d.jsx(Zn.Textarea,{autoFocus:!0,className:"richtext-flex-1",defaultValue:Xi,onChange:S=>o(S.target.value),placeholder:"Text",required:!0,rows:10,value:r,style:{color:"hsl(var(--foreground))"}}),d.jsx("div",{className:"richtext-flex richtext-flex-1 richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",dangerouslySetInnerHTML:{__html:l},ref:h,style:{height:"100%",border:"1px solid hsl(var(--border))",minHeight:500}})]})}),d.jsx(m.DialogFooter,{children:d.jsx(m.Button,{onClick:C,type:"button",children:"Save changes"})})]})]})};function Vl({item:e,disabled:t,editor:n}){var s;const i=e.component;return i?d.jsx(b.Fragment,{children:e.type==="divider"?d.jsx(wt.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}):d.jsx(i,{...e.componentProps,disabled:t||((s=e==null?void 0:e.componentProps)==null?void 0:s.disabled),editor:n})}):d.jsx(d.Fragment,{})}function Hl(e){return e.type.name===Qn.Mermaid.name}function zl(){const{lang:e,t}=B.useLocale(),n=m.useEditableEditor(),i=m.useEditorInstance(),s=dt.useAttributes(i,Qn.Mermaid.name),r=m.useExtension(Qn.Mermaid.name),o=({editor:c})=>{const{selection:a}=c.view.state,{$from:u,to:h}=a;let f=!1;return c.view.state.doc.nodesBetween(u.pos,h,p=>{if(Hl(p))return f=!0,!1}),f},l=b.useMemo(()=>Sl(i,t),[i,e,t]);return n?d.jsx(nt,{editor:i,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleMermaid",shouldShow:o,children:l!=null&&l.length?d.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:l==null?void 0:l.map((c,a)=>c.type==="edit"&&(s!=null&&s.src)?d.jsx(Fl,{attrs:s,editor:i,extension:r},`bubbleMenu-mermaid-${a}`):d.jsx(Vl,{editor:i,item:c},`bubbleMenu-mermaid-${a}`))}):d.jsx(d.Fragment,{})}):d.jsx(d.Fragment,{})}function Kl({hiddenActions:e=[]}){var x,w,y,C,S,D,H,A,v,k,L,z,M,P,K,E,ot,Re;const{t}=B.useLocale(),n=m.useEditableEditor(),i=m.useEditorInstance(),s=({editor:qt})=>T.isActive(qt.view.state,Ls.Table.name),r=qt=>e.includes(qt);function o(){i.chain().focus().addColumnBefore().run()}function l(){i.chain().focus().addColumnAfter().run()}function c(){i.chain().focus().deleteColumn().run()}function a(){i.chain().focus().addRowBefore().run()}function u(){i.chain().focus().addRowAfter().run()}function h(){i.chain().focus().deleteRow().run()}function f(){i.chain().focus().mergeCells().run()}function p(){i==null||i.chain().focus().splitCell().run()}function g(){i.chain().focus().deleteTable().run()}return n?d.jsx(nt,{editor:i,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleTable",shouldShow:s,children:d.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:[!r("addColumnBefore")&&d.jsx(m.ActionButton,{action:o,disabled:!((w=(x=i==null?void 0:i.can())==null?void 0:x.addColumnBefore)!=null&&w.call(x)),icon:"BetweenHorizonalEnd",tooltip:t("editor.table.menu.insertColumnBefore"),tooltipOptions:{sideOffset:15}}),!r("addColumnAfter")&&d.jsx(m.ActionButton,{action:l,disabled:!((C=(y=i==null?void 0:i.can())==null?void 0:y.addColumnAfter)!=null&&C.call(y)),icon:"BetweenHorizonalStart",tooltip:t("editor.table.menu.insertColumnAfter"),tooltipOptions:{sideOffset:15}}),!r("deleteColumn")&&d.jsx(m.ActionButton,{action:c,disabled:!((D=i==null?void 0:(S=i.can()).deleteColumn)!=null&&D.call(S)),icon:"DeleteColumn",tooltip:t("editor.table.menu.deleteColumn"),tooltipOptions:{sideOffset:15}}),d.jsx(wt.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),!r("addRowAbove")&&d.jsx(m.ActionButton,{action:a,disabled:!((A=i==null?void 0:(H=i.can()).addRowBefore)!=null&&A.call(H)),icon:"BetweenVerticalEnd",tooltip:t("editor.table.menu.insertRowAbove"),tooltipOptions:{sideOffset:15}}),!r("addRowBelow")&&d.jsx(m.ActionButton,{action:u,disabled:!((k=(v=i==null?void 0:i.can())==null?void 0:v.addRowAfter)!=null&&k.call(v)),icon:"BetweenVerticalStart",tooltip:t("editor.table.menu.insertRowBelow"),tooltipOptions:{sideOffset:15}}),!r("deleteRow")&&d.jsx(m.ActionButton,{action:h,disabled:!((z=(L=i==null?void 0:i.can())==null?void 0:L.deleteRow)!=null&&z.call(L)),icon:"DeleteRow",tooltip:t("editor.table.menu.deleteRow"),tooltipOptions:{sideOffset:15}}),d.jsx(wt.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),!r("mergeCells")&&d.jsx(m.ActionButton,{action:f,disabled:!((P=(M=i==null?void 0:i.can())==null?void 0:M.mergeCells)!=null&&P.call(M)),icon:"TableCellsMerge",tooltip:t("editor.table.menu.mergeCells"),tooltipOptions:{sideOffset:15}}),!r("splitCells")&&d.jsx(m.ActionButton,{action:p,disabled:!((E=(K=i==null?void 0:i.can())==null?void 0:K.splitCell)!=null&&E.call(K)),icon:"TableCellsSplit",tooltip:t("editor.table.menu.splitCells"),tooltipOptions:{sideOffset:15}}),d.jsx(wt.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),!r("deleteTable")&&d.jsx(m.ActionButton,{action:g,disabled:!((Re=(ot=i==null?void 0:i.can())==null?void 0:ot.deleteTable)!=null&&Re.call(ot)),icon:"Trash2",tooltip:t("editor.table.menu.deleteTable"),tooltipOptions:{sideOffset:15}})]})}):d.jsx(d.Fragment,{})}function ql(){const{t:e}=B.useLocale(),[t,n]=b.useState(!1),i=m.useEditorInstance(),s=b.useMemo(()=>{var o,l;return(l=(o=Uo.renderCommandListDefault({t:e}))==null?void 0:o[0])==null?void 0:l.commands},[e]),r=b.useMemo(()=>{var l;return(l=s==null?void 0:s.find(c=>{var a;return(a=c==null?void 0:c.isActive)==null?void 0:a.call(c,i)}))==null?void 0:l.label},[i.state.selection.ranges,t,i,s,e]);return d.jsxs(kt.Popover,{modal:!0,onOpenChange:n,open:t,children:[d.jsx(kt.PopoverTrigger,{asChild:!0,className:"hover:richtext-bg-accent data-[state=on]:richtext-bg-accent",children:d.jsxs(m.ActionButton,{dataState:!!r,children:[r?d.jsx(d.Fragment,{children:r}):d.jsx(d.Fragment,{children:e("editor.paragraph.tooltip")}),d.jsx(m.IconComponent,{className:"richtext-ml-1 richtext-size-3 richtext-text-zinc-500",name:"MenuDown"})]})}),d.jsx(kt.PopoverContent,{align:"start",className:"!richtext-w-[initial] !richtext-p-[4px]",hideWhenDetached:!0,side:"bottom",children:s==null?void 0:s.map(o=>{var c;const l=(c=o==null?void 0:o.isActive)==null?void 0:c.call(o,i);return d.jsxs("div",{className:"richtext-flex richtext-w-full richtext-items-center richtext-gap-3 richtext-rounded-sm !richtext-border-none !richtext-bg-transparent richtext-px-2 richtext-py-1.5 richtext-text-left richtext-text-sm richtext-text-foreground !richtext-outline-none richtext-transition-colors hover:!richtext-bg-accent",onClick:a=>{a.preventDefault(),o.action({editor:i,range:i.state.selection.ranges}),n(!1)},children:[d.jsxs("div",{className:"!richtext-min-w-[20px]",children:[l&&d.jsx(Pt.Check,{size:16}),!r&&o.label===e("editor.paragraph.tooltip")&&!l&&d.jsx(Pt.Check,{size:16})]}),d.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-1",children:[o.iconName&&d.jsx(m.IconComponent,{className:"!richtext-mr-1 !richtext-text-lg",name:o.iconName}),o.label]})]},o.name)})})]})}function Wl(){return d.jsxs(d.Fragment,{children:[d.jsx(ql,{}),d.jsx(wt.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),d.jsx(Ro.RichTextBold,{}),d.jsx(Po.RichTextItalic,{}),d.jsx(Fo.RichTextUnderline,{}),d.jsx($o.RichTextStrike,{}),d.jsx(No.RichTextCode,{}),d.jsx(Ve.RichTextLink,{}),d.jsx(wt.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),d.jsx(Bo.RichTextColor,{}),d.jsx(Lo.RichTextHighlight,{}),d.jsx(Us.RichTextAlign,{})]})}function Gl({buttonBubble:e}){const t=m.useEditorInstance(),n=m.useEditableEditor(),i=({editor:s})=>{const{selection:r}=s.view.state,{$from:o,to:l}=r;return s.isActive("codeBlock")||o.pos===l?!1:r instanceof Y.TextSelection};return n?d.jsx(nt,{editor:t,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleText",shouldShow:i,children:e?d.jsx(d.Fragment,{children:e}):d.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:d.jsx(Wl,{})})}):d.jsx(d.Fragment,{})}function Yl(){const{t:e}=B.useLocale(),t=m.useEditableEditor(),n=m.useEditorInstance(),[i,s]=b.useState(!1),r=b.useCallback(({editor:c})=>c.isActive(Bn.Twitter.name),[]),o=c=>{n.commands.updateTweet({src:c}),s(!1)},l=b.useCallback(()=>Ht(Bn.Twitter.name,n),[n]);return t?d.jsx(nt,{editor:n,options:{placement:"bottom",offset:8,flip:!0},pluginKey:"RichTextBubbleTwitter",shouldShow:r,children:d.jsx(d.Fragment,{children:i?d.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-4 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:d.jsx(Bn.FormEditLinkTwitter,{editor:n,onSetLink:o})}):d.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:[d.jsx(m.ActionButton,{icon:"Pencil",tooltip:e("editor.link.edit.tooltip"),tooltipOptions:{sideOffset:15},action:()=>{s(!0)}}),d.jsx(m.ActionButton,{action:l,icon:"Trash",tooltip:e("editor.delete"),tooltipOptions:{sideOffset:15}})]})})}):d.jsx(d.Fragment,{})}const ft=()=>new Map,ei=e=>{const t=ft();return e.forEach((n,i)=>{t.set(i,n)}),t},Tt=(e,t,n)=>{let i=e.get(t);return i===void 0&&e.set(t,i=n()),i},Jl=(e,t)=>{const n=[];for(const[i,s]of e)n.push(t(s,i));return n},Xl=(e,t)=>{for(const[n,i]of e)if(t(i,n))return!0;return!1},Ut=()=>new Set,Pn=e=>e[e.length-1],Zl=(e,t)=>{for(let n=0;n<t.length;n++)e.push(t[n])},$t=Array.from,vi=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},Si=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},Ql=(e,t)=>{const n=new Array(e);for(let i=0;i<e;i++)n[i]=t(i,n);return n},te=Array.isArray;class Ws{constructor(){this._observers=ft()}on(t,n){return Tt(this._observers,t,Ut).add(n),n}once(t,n){const i=(...s)=>{this.off(t,i),n(...s)};this.on(t,i)}off(t,n){const i=this._observers.get(t);i!==void 0&&(i.delete(n),i.size===0&&this._observers.delete(t))}emit(t,n){return $t((this._observers.get(t)||ft()).values()).forEach(i=>i(...n))}destroy(){this._observers=ft()}}const pt=Math.floor,He=Math.abs,ee=(e,t)=>e<t?e:t,Ot=(e,t)=>e>t?e:t,Gs=e=>e!==0?e<0:1/e<0,Zi=1,Qi=2,Un=4,$n=8,xe=32,Et=64,tt=128,tc=1<<29,mn=31,ni=63,Lt=127,ec=2147483647,Xe=Number.MAX_SAFE_INTEGER,ts=Number.MIN_SAFE_INTEGER,nc=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&pt(e)===e),Ys=String.fromCharCode,ic=e=>e.toLowerCase(),sc=/^\s*/g,rc=e=>e.replace(sc,""),oc=/([A-Z])/g,es=(e,t)=>rc(e.replace(oc,n=>`${t}${ic(n)}`)),lc=e=>{const t=unescape(encodeURIComponent(e)),n=t.length,i=new Uint8Array(n);for(let s=0;s<n;s++)i[s]=t.codePointAt(s);return i},be=typeof TextEncoder<"u"?new TextEncoder:null,cc=e=>be.encode(e),ac=be?cc:lc;let ge=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});ge&&ge.decode(new Uint8Array).length===1&&(ge=null);const hc=(e,t)=>Ql(t,()=>e).join("");class Ae{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const Ie=()=>new Ae,uc=e=>{const t=Ie();return e(t),ut(t)},dc=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},ut=e=>{const t=new Uint8Array(dc(e));let n=0;for(let i=0;i<e.bufs.length;i++){const s=e.bufs[i];t.set(s,n),n+=s.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},fc=(e,t)=>{const n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(Ot(n,t)*2),e.cpos=0)},W=(e,t)=>{const n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},ii=W,I=(e,t)=>{for(;t>Lt;)W(e,tt|Lt&t),t=pt(t/128);W(e,Lt&t)},Ci=(e,t)=>{const n=Gs(t);for(n&&(t=-t),W(e,(t>ni?tt:0)|(n?Et:0)|ni&t),t=pt(t/64);t>0;)W(e,(t>Lt?tt:0)|Lt&t),t=pt(t/128)},si=new Uint8Array(3e4),pc=si.length/3,gc=(e,t)=>{if(t.length<pc){const n=be.encodeInto(t,si).written||0;I(e,n);for(let i=0;i<n;i++)W(e,si[i])}else st(e,ac(t))},mc=(e,t)=>{const n=unescape(encodeURIComponent(t)),i=n.length;I(e,i);for(let s=0;s<i;s++)W(e,n.codePointAt(s))},Yt=be&&be.encodeInto?gc:mc,xn=(e,t)=>{const n=e.cbuf.length,i=e.cpos,s=ee(n-i,t.length),r=t.length-s;e.cbuf.set(t.subarray(0,s),i),e.cpos+=s,r>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(Ot(n*2,r)),e.cbuf.set(t.subarray(s)),e.cpos=r)},st=(e,t)=>{I(e,t.byteLength),xn(e,t)},ki=(e,t)=>{fc(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},xc=(e,t)=>ki(e,4).setFloat32(0,t,!1),bc=(e,t)=>ki(e,8).setFloat64(0,t,!1),wc=(e,t)=>ki(e,8).setBigInt64(0,t,!1),ns=new DataView(new ArrayBuffer(4)),yc=e=>(ns.setFloat32(0,e),ns.getFloat32(0)===e),ne=(e,t)=>{switch(typeof t){case"string":W(e,119),Yt(e,t);break;case"number":nc(t)&&He(t)<=ec?(W(e,125),Ci(e,t)):yc(t)?(W(e,124),xc(e,t)):(W(e,123),bc(e,t));break;case"bigint":W(e,122),wc(e,t);break;case"object":if(t===null)W(e,126);else if(te(t)){W(e,117),I(e,t.length);for(let n=0;n<t.length;n++)ne(e,t[n])}else if(t instanceof Uint8Array)W(e,116),st(e,t);else{W(e,118);const n=Object.keys(t);I(e,n.length);for(let i=0;i<n.length;i++){const s=n[i];Yt(e,s),ne(e,t[s])}}break;case"boolean":W(e,t?120:121);break;default:W(e,127)}};class is extends Ae{constructor(t){super(),this.w=t,this.s=null,this.count=0}write(t){this.s===t?this.count++:(this.count>0&&I(this,this.count-1),this.count=1,this.w(this,t),this.s=t)}}const ss=e=>{e.count>0&&(Ci(e.encoder,e.count===1?e.s:-e.s),e.count>1&&I(e.encoder,e.count-2))};class ze{constructor(){this.encoder=new Ae,this.s=0,this.count=0}write(t){this.s===t?this.count++:(ss(this),this.count=1,this.s=t)}toUint8Array(){return ss(this),ut(this.encoder)}}const rs=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);Ci(e.encoder,t),e.count>1&&I(e.encoder,e.count-2)}};class Fn{constructor(){this.encoder=new Ae,this.s=0,this.count=0,this.diff=0}write(t){this.diff===t-this.s?(this.s=t,this.count++):(rs(this),this.count=1,this.diff=t-this.s,this.s=t)}toUint8Array(){return rs(this),ut(this.encoder)}}class vc{constructor(){this.sarr=[],this.s="",this.lensE=new ze}write(t){this.s+=t,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(t.length)}toUint8Array(){const t=new Ae;return this.sarr.push(this.s),this.s="",Yt(t,this.sarr.join("")),xn(t,this.lensE.toUint8Array()),ut(t)}}const vt=e=>new Error(e),at=()=>{throw vt("Method unimplemented")},et=()=>{throw vt("Unexpected case")},Js=vt("Unexpected end of array"),Xs=vt("Integer out of Range");class bn{constructor(t){this.arr=t,this.pos=0}}const Ei=e=>new bn(e),Sc=e=>e.pos!==e.arr.length,Cc=(e,t)=>{const n=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n},lt=e=>Cc(e,R(e)),we=e=>e.arr[e.pos++],R=e=>{let t=0,n=1;const i=e.arr.length;for(;e.pos<i;){const s=e.arr[e.pos++];if(t=t+(s&Lt)*n,n*=128,s<tt)return t;if(t>Xe)throw Xs}throw Js},_i=e=>{let t=e.arr[e.pos++],n=t&ni,i=64;const s=(t&Et)>0?-1:1;if((t&tt)===0)return s*n;const r=e.arr.length;for(;e.pos<r;){if(t=e.arr[e.pos++],n=n+(t&Lt)*i,i*=128,t<tt)return s*n;if(n>Xe)throw Xs}throw Js},kc=e=>{let t=R(e);if(t===0)return"";{let n=String.fromCodePoint(we(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(we(e));else for(;t>0;){const i=t<1e4?t:1e4,s=e.arr.subarray(e.pos,e.pos+i);e.pos+=i,n+=String.fromCodePoint.apply(null,s),t-=i}return decodeURIComponent(escape(n))}},Ec=e=>ge.decode(lt(e)),ri=ge?Ec:kc,Ti=(e,t)=>{const n=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,n},_c=e=>Ti(e,4).getFloat32(0,!1),Tc=e=>Ti(e,8).getFloat64(0,!1),Dc=e=>Ti(e,8).getBigInt64(0,!1),Ac=[e=>{},e=>null,_i,_c,Tc,Dc,e=>!1,e=>!0,ri,e=>{const t=R(e),n={};for(let i=0;i<t;i++){const s=ri(e);n[s]=Ze(e)}return n},e=>{const t=R(e),n=[];for(let i=0;i<t;i++)n.push(Ze(e));return n},lt],Ze=e=>Ac[127-we(e)](e);class os extends bn{constructor(t,n){super(t),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),Sc(this)?this.count=R(this)+1:this.count=-1),this.count--,this.s}}class Ke extends bn{constructor(t){super(t),this.s=0,this.count=0}read(){if(this.count===0){this.s=_i(this);const t=Gs(this.s);this.count=1,t&&(this.s=-this.s,this.count=R(this)+2)}return this.count--,this.s}}class Vn extends bn{constructor(t){super(t),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const t=_i(this),n=t&1;this.diff=pt(t/2),this.count=1,n&&(this.count=R(this)+2)}return this.s+=this.diff,this.count--,this.s}}class Ic{constructor(t){this.decoder=new Ke(t),this.str=ri(this.decoder),this.spos=0}read(){const t=this.spos+this.decoder.read(),n=this.str.slice(this.spos,t);return this.spos=t,n}}const Mc=crypto.getRandomValues.bind(crypto),Oc=Math.random,Zs=()=>Mc(new Uint32Array(1))[0],jc=e=>e[pt(Oc()*e.length)],Rc="10000000-1000-4000-8000"+-1e11,Nc=()=>Rc.replace(/[018]/g,e=>(e^Zs()&15>>e/4).toString(16)),Bc=Date.now,ls=e=>new Promise(e);Promise.all.bind(Promise);const cs=e=>e===void 0?null:e;class Lc{constructor(){this.map=new Map}setItem(t,n){this.map.set(t,n)}getItem(t){return this.map.get(t)}}let Qs=new Lc,Pc=!0;try{typeof localStorage<"u"&&localStorage&&(Qs=localStorage,Pc=!1)}catch{}const Uc=Qs,ye=Symbol("Equality"),tr=(e,t)=>{var n;return e===t||!!((n=e==null?void 0:e[ye])!=null&&n.call(e,t))||!1},$c=e=>typeof e=="object",Fc=Object.assign,er=Object.keys,Vc=(e,t)=>{for(const n in e)t(e[n],n)},Qe=e=>er(e).length,Hc=e=>{for(const t in e)return!1;return!0},oe=(e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0},Di=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),zc=(e,t)=>e===t||Qe(e)===Qe(t)&&oe(e,(n,i)=>(n!==void 0||Di(t,i))&&tr(t[i],n)),Kc=Object.freeze,nr=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&nr(e[t])}return Kc(e)},Ai=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&Ai(e,t,n+1)}},qe=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[ye]!=null)return e[ye](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:{if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break}case Set:{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;break}case Map:{if(e.size!==t.size)return!1;for(const n of e.keys())if(!t.has(n)||!qe(e.get(n),t.get(n)))return!1;break}case void 0:case Object:if(Qe(e)!==Qe(t))return!1;for(const n in e)if(!Di(e,n)||!qe(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!qe(e[n],t[n]))return!1;break;default:return!1}return!0},qc=(e,t)=>t.includes(e),ie=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",ir=typeof window<"u"&&typeof document<"u"&&!ie;let bt;const Wc=()=>{if(bt===void 0)if(ie){bt=ft();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const i=e[n];i[0]==="-"?(t!==null&&bt.set(t,""),t=i):t!==null&&(bt.set(t,i),t=null)}t!==null&&bt.set(t,"")}else typeof location=="object"?(bt=ft(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");bt.set(`--${es(t,"-")}`,n),bt.set(`-${es(t,"-")}`,n)}})):bt=ft();return bt},oi=e=>Wc().has(e),tn=e=>cs(ie?process.env[e.toUpperCase().replaceAll("-","_")]:Uc.getItem(e)),sr=e=>oi("--"+e)||tn(e)!==null,Gc=sr("production"),Yc=ie&&qc(process.env.FORCE_COLOR,["true","1","2"]),Jc=Yc||!oi("--no-colors")&&!sr("no-color")&&(!ie||process.stdout.isTTY)&&(!ie||oi("--color")||tn("COLORTERM")!==null||(tn("TERM")||"").includes("color")),Xc=e=>{let t="";for(let n=0;n<e.byteLength;n++)t+=Ys(e[n]);return btoa(t)},Zc=e=>Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("base64"),Qc=ir?Xc:Zc,ta=e=>uc(t=>ne(t,e));class ea{constructor(t,n){this.left=t,this.right=n}}const Ct=(e,t)=>new ea(e,t),as=e=>e.next()>=.5,Hn=(e,t,n)=>pt(e.next()*(n+1-t)+t),rr=(e,t,n)=>pt(e.next()*(n+1-t)+t),Ii=(e,t,n)=>rr(e,t,n),na=e=>Ys(Ii(e,97,122)),ia=(e,t=0,n=20)=>{const i=Ii(e,t,n);let s="";for(let r=0;r<i;r++)s+=na(e);return s},zn=(e,t)=>t[Ii(e,0,t.length-1)],sa=Symbol("0schema");class ra{constructor(){this._rerrs=[]}extend(t,n,i,s=null){this._rerrs.push({path:t,expected:n,has:i,message:s})}toString(){const t=[];for(let n=this._rerrs.length-1;n>0;n--){const i=this._rerrs[n];t.push(hc(" ",(this._rerrs.length-n)*2)+`${i.path!=null?`[${i.path}] `:""}${i.has} doesn't match ${i.expected}. ${i.message}`)}return t.join(`
|
|
3
3
|
`)}}const li=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[ye]?tr(e,t):te(e)?vi(e,n=>Si(t,i=>li(n,i))):$c(e)?oe(e,(n,i)=>li(n,t[i])):!1;class Z{extends(t){let[n,i]=[this.shape,t.shape];return this.constructor._dilutes&&([i,n]=[n,i]),li(n,i)}equals(t){return this.constructor===t.constructor&&qe(this.shape,t.shape)}[sa](){return!0}[ye](t){return this.equals(t)}validate(t){return this.check(t)}check(t,n){at()}get nullable(){return le(this,Cn)}get optional(){return new cr(this)}cast(t){return hs(t,this),t}expect(t){return hs(t,this),t}}Ne(Z,"_dilutes",!1);class Mi extends Z{constructor(t,n){super(),this.shape=t,this._c=n}check(t,n=void 0){const i=(t==null?void 0:t.constructor)===this.shape&&(this._c==null||this._c(t));return!i&&(n==null||n.extend(null,this.shape.name,t==null?void 0:t.constructor.name,(t==null?void 0:t.constructor)!==this.shape?"Constructor match failed":"Check failed")),i}}const V=(e,t=null)=>new Mi(e,t);V(Mi);class Oi extends Z{constructor(t){super(),this.shape=t}check(t,n){const i=this.shape(t);return!i&&(n==null||n.extend(null,"custom prop",t==null?void 0:t.constructor.name,"failed to check custom prop")),i}}const J=e=>new Oi(e);V(Oi);class wn extends Z{constructor(t){super(),this.shape=t}check(t,n){const i=this.shape.some(s=>s===t);return!i&&(n==null||n.extend(null,this.shape.join(" | "),t.toString())),i}}const yn=(...e)=>new wn(e),or=V(wn),oa=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,t=>"\\"+t)),lr=e=>{if(se.check(e))return[oa(e)];if(or.check(e))return e.shape.map(t=>t+"");if(xr.check(e))return["[+-]?\\d+.?\\d*"];if(br.check(e))return[".*"];if(nn.check(e))return e.shape.map(lr).flat(1);et()};class la extends Z{constructor(t){super(),this.shape=t,this._r=new RegExp("^"+t.map(lr).map(n=>`(${n.join("|")})`).join("")+"$")}check(t,n){const i=this._r.exec(t)!=null;return!i&&(n==null||n.extend(null,this._r.toString(),t.toString(),"String doesn't match string template.")),i}}V(la);const ca=Symbol("optional");class cr extends Z{constructor(t){super(),this.shape=t}check(t,n){const i=t===void 0||this.shape.check(t);return!i&&(n==null||n.extend(null,"undefined (optional)","()")),i}get[ca](){return!0}}const aa=V(cr);class ha extends Z{check(t,n){return n==null||n.extend(null,"never",typeof t),!1}}V(ha);const gn=class gn extends Z{constructor(t,n=!1){super(),this.shape=t,this._isPartial=n}get partial(){return new gn(this.shape,!0)}check(t,n){return t==null?(n==null||n.extend(null,"object","null"),!1):oe(this.shape,(i,s)=>{const r=this._isPartial&&!Di(t,s)||i.check(t[s],n);return!r&&(n==null||n.extend(s.toString(),i.toString(),typeof t[s],"Object property does not match")),r})}};Ne(gn,"_dilutes",!0);let en=gn;const ua=e=>new en(e),da=V(en),fa=J(e=>e!=null&&(e.constructor===Object||e.constructor==null));class ar extends Z{constructor(t,n){super(),this.shape={keys:t,values:n}}check(t,n){return t!=null&&oe(t,(i,s)=>{const r=this.shape.keys.check(s,n);return!r&&(n==null||n.extend(s+"","Record",typeof t,r?"Key doesn't match schema":"Value doesn't match value")),r&&this.shape.values.check(i,n)})}}const hr=(e,t)=>new ar(e,t),pa=V(ar);class ur extends Z{constructor(t){super(),this.shape=t}check(t,n){return t!=null&&oe(this.shape,(i,s)=>{const r=i.check(t[s],n);return!r&&(n==null||n.extend(s.toString(),"Tuple",typeof i)),r})}}const ga=(...e)=>new ur(e);V(ur);class dr extends Z{constructor(t){super(),this.shape=t.length===1?t[0]:new vn(t)}check(t,n){const i=te(t)&&vi(t,s=>this.shape.check(s));return!i&&(n==null||n.extend(null,"Array","")),i}}const fr=(...e)=>new dr(e),ma=V(dr),xa=J(e=>te(e));class pr extends Z{constructor(t,n){super(),this.shape=t,this._c=n}check(t,n){const i=t instanceof this.shape&&(this._c==null||this._c(t));return!i&&(n==null||n.extend(null,this.shape.name,t==null?void 0:t.constructor.name)),i}}const ba=(e,t=null)=>new pr(e,t);V(pr);const wa=ba(Z);class ya extends Z{constructor(t){super(),this.len=t.length-1,this.args=ga(...t.slice(-1)),this.res=t[this.len]}check(t,n){const i=t.constructor===Function&&t.length<=this.len;return!i&&(n==null||n.extend(null,"function",typeof t)),i}}const va=V(ya),Sa=J(e=>typeof e=="function");class Ca extends Z{constructor(t){super(),this.shape=t}check(t,n){const i=vi(this.shape,s=>s.check(t,n));return!i&&(n==null||n.extend(null,"Intersectinon",typeof t)),i}}V(Ca,e=>e.shape.length>0);class vn extends Z{constructor(t){super(),this.shape=t}check(t,n){const i=Si(this.shape,s=>s.check(t,n));return n==null||n.extend(null,"Union",typeof t),i}}Ne(vn,"_dilutes",!0);const le=(...e)=>e.findIndex(t=>nn.check(t))>=0?le(...e.map(t=>ve(t)).map(t=>nn.check(t)?t.shape:[t]).flat(1)):e.length===1?e[0]:new vn(e),nn=V(vn),gr=()=>!0,sn=J(gr),ka=V(Oi,e=>e.shape===gr),ji=J(e=>typeof e=="bigint"),Ea=J(e=>e===ji),mr=J(e=>typeof e=="symbol");J(e=>e===mr);const Jt=J(e=>typeof e=="number"),xr=J(e=>e===Jt),se=J(e=>typeof e=="string"),br=J(e=>e===se),Sn=J(e=>typeof e=="boolean"),_a=J(e=>e===Sn),wr=yn(void 0);V(wn,e=>e.shape.length===1&&e.shape[0]===void 0);yn(void 0);const Cn=yn(null),Ta=V(wn,e=>e.shape.length===1&&e.shape[0]===null);V(Uint8Array);V(Mi,e=>e.shape===Uint8Array);const Da=le(Jt,se,Cn,wr,ji,Sn,mr);(()=>{const e=fr(sn),t=hr(se,sn),n=le(Jt,se,Cn,Sn,e,t);return e.shape=n,t.shape.values=n,n})();const ve=e=>{if(wa.check(e))return e;if(fa.check(e)){const t={};for(const n in e)t[n]=ve(e[n]);return ua(t)}else{if(xa.check(e))return le(...e.map(ve));if(Da.check(e))return yn(e);if(Sa.check(e))return V(e)}et()},hs=Gc?()=>{}:(e,t)=>{const n=new ra;if(!t.check(e,n))throw vt(`Expected value to be of type ${t.constructor.name}.
|
|
4
4
|
${n.toString()}`)};class Aa{constructor(t){this.patterns=[],this.$state=t}if(t,n){return this.patterns.push({if:ve(t),h:n}),this}else(t){return this.if(sn,t)}done(){return(t,n)=>{for(let i=0;i<this.patterns.length;i++){const s=this.patterns[i];if(s.if.check(t))return s.h(t,n)}throw vt("Unhandled pattern")}}}const Ia=e=>new Aa(e),yr=Ia(sn).if(xr,(e,t)=>Hn(t,ts,Xe)).if(br,(e,t)=>ia(t)).if(_a,(e,t)=>as(t)).if(Ea,(e,t)=>BigInt(Hn(t,ts,Xe))).if(nn,(e,t)=>Gt(t,zn(t,e.shape))).if(da,(e,t)=>{const n={};for(const i in e.shape){let s=e.shape[i];if(aa.check(s)){if(as(t))continue;s=s.shape}n[i]=yr(s,t)}return n}).if(ma,(e,t)=>{const n=[],i=rr(t,0,42);for(let s=0;s<i;s++)n.push(Gt(t,e.shape));return n}).if(or,(e,t)=>zn(t,e.shape)).if(Ta,(e,t)=>null).if(va,(e,t)=>{const n=Gt(t,e.res);return()=>n}).if(ka,(e,t)=>Gt(t,zn(t,[Jt,se,Cn,wr,ji,Sn,fr(Jt),hr(le("a","b","c"),Jt)]))).if(pa,(e,t)=>{const n={},i=Hn(t,0,3);for(let s=0;s<i;s++){const r=Gt(t,e.shape.keys),o=Gt(t,e.shape.values);n[r]=o}return n}).done(),Gt=(e,t)=>yr(ve(t),e),Me=typeof document<"u"?document:{};J(e=>e.nodeType===Na);typeof DOMParser<"u"&&new DOMParser;J(e=>e.nodeType===Oa);J(e=>e.nodeType===ja);const Ma=e=>Jl(e,(t,n)=>`${n}:${t};`).join(""),Oa=Me.ELEMENT_NODE,ja=Me.TEXT_NODE,Ra=Me.DOCUMENT_NODE,Na=Me.DOCUMENT_FRAGMENT_NODE;J(e=>e.nodeType===Ra);const Ba=e=>class{constructor(n){this._=n}destroy(){e(this._)}},La=Ba(clearTimeout),vr=(e,t)=>new La(setTimeout(t,e)),Dt=Symbol,Sr=Dt(),Cr=Dt(),Pa=Dt(),Ua=Dt(),$a=Dt(),kr=Dt(),Fa=Dt(),Ri=Dt(),Va=Dt(),Ha=e=>{var s;e.length===1&&((s=e[0])==null?void 0:s.constructor)===Function&&(e=e[0]());const t=[],n=[];let i=0;for(;i<e.length;i++){const r=e[i];if(r===void 0)break;if(r.constructor===String||r.constructor===Number)t.push(r);else if(r.constructor===Object)break}for(i>0&&n.push(t.join(""));i<e.length;i++){const r=e[i];r instanceof Symbol||n.push(r)}return n},za={[Sr]:Ct("font-weight","bold"),[Cr]:Ct("font-weight","normal"),[Pa]:Ct("color","blue"),[$a]:Ct("color","green"),[Ua]:Ct("color","grey"),[kr]:Ct("color","red"),[Fa]:Ct("color","purple"),[Ri]:Ct("color","orange"),[Va]:Ct("color","black")},Ka=e=>{var o;e.length===1&&((o=e[0])==null?void 0:o.constructor)===Function&&(e=e[0]());const t=[],n=[],i=ft();let s=[],r=0;for(;r<e.length;r++){const l=e[r],c=za[l];if(c!==void 0)i.set(c.left,c.right);else{if(l===void 0)break;if(l.constructor===String||l.constructor===Number){const a=Ma(i);r>0||a.length>0?(t.push("%c"+l),n.push(a)):t.push(l)}else break}}for(r>0&&(s=n,s.unshift(t.join("")));r<e.length;r++){const l=e[r];l instanceof Symbol||s.push(l)}return s},Er=Jc?Ka:Ha,qa=(...e)=>{console.log(...Er(e)),Tr.forEach(t=>t.print(e))},_r=(...e)=>{console.warn(...Er(e)),e.unshift(Ri),Tr.forEach(t=>t.print(e))},Tr=Ut(),Dr=e=>({[Symbol.iterator](){return this},next:e}),Wa=(e,t)=>Dr(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),Kn=(e,t)=>Dr(()=>{const{done:n,value:i}=e.next();return{done:n,value:n?void 0:t(i)}});class kn{constructor(t,n){this.clock=t,this.len=n}}class ce{constructor(){this.clients=new Map}}const jt=(e,t,n)=>t.clients.forEach((i,s)=>{const r=e.doc.store.clients.get(s);if(r!=null){const o=r[r.length-1],l=o.id.clock+o.length;for(let c=0,a=i[c];c<i.length&&a.clock<l;a=i[++c])Br(e,r,a.clock,a.len,n)}}),Ga=(e,t)=>{let n=0,i=e.length-1;for(;n<=i;){const s=pt((n+i)/2),r=e[s],o=r.clock;if(o<=t){if(t<o+r.len)return s;n=s+1}else i=s-1}return null},ae=(e,t)=>{const n=e.clients.get(t.client);return n!==void 0&&Ga(n,t.clock)!==null},Ni=e=>{e.clients.forEach(t=>{t.sort((s,r)=>s.clock-r.clock);let n,i;for(n=1,i=1;n<t.length;n++){const s=t[i-1],r=t[n];s.clock+s.len>=r.clock?t[i-1]=new kn(s.clock,Ot(s.len,r.clock+r.len-s.clock)):(i<n&&(t[i]=r),i++)}t.length=i})},ci=e=>{const t=new ce;for(let n=0;n<e.length;n++)e[n].clients.forEach((i,s)=>{if(!t.clients.has(s)){const r=i.slice();for(let o=n+1;o<e.length;o++)Zl(r,e[o].clients.get(s)||[]);t.clients.set(s,r)}});return Ni(t),t},Se=(e,t,n,i)=>{Tt(e.clients,t,()=>[]).push(new kn(n,i))},Ar=()=>new ce,Ya=e=>{const t=Ar();return e.clients.forEach((n,i)=>{const s=[];for(let r=0;r<n.length;r++){const o=n[r];if(o.deleted){const l=o.id.clock;let c=o.length;if(r+1<n.length)for(let a=n[r+1];r+1<n.length&&a.deleted;a=n[++r+1])c+=a.length;s.push(new kn(l,c))}}s.length>0&&t.clients.set(i,s)}),t},Bi=(e,t)=>{I(e.restEncoder,t.clients.size),$t(t.clients.entries()).sort((n,i)=>i[0]-n[0]).forEach(([n,i])=>{e.resetDsCurVal(),I(e.restEncoder,n);const s=i.length;I(e.restEncoder,s);for(let r=0;r<s;r++){const o=i[r];e.writeDsClock(o.clock),e.writeDsLen(o.len)}})},Ja=e=>{const t=new ce,n=R(e.restDecoder);for(let i=0;i<n;i++){e.resetDsCurVal();const s=R(e.restDecoder),r=R(e.restDecoder);if(r>0){const o=Tt(t.clients,s,()=>[]);for(let l=0;l<r;l++)o.push(new kn(e.readDsClock(),e.readDsLen()))}}return t},us=(e,t,n)=>{const i=new ce,s=R(e.restDecoder);for(let r=0;r<s;r++){e.resetDsCurVal();const o=R(e.restDecoder),l=R(e.restDecoder),c=n.clients.get(o)||[],a=$(n,o);for(let u=0;u<l;u++){const h=e.readDsClock(),f=h+e.readDsLen();if(h<a){a<f&&Se(i,o,a,f-a);let p=gt(c,h),g=c[p];for(!g.deleted&&g.id.clock<h&&(c.splice(p+1,0,un(t,g,h-g.id.clock)),p++);p<c.length&&(g=c[p++],g.id.clock<f);)g.deleted||(f<g.id.clock+g.length&&c.splice(p,0,un(t,g,f-g.id.clock)),g.delete(t))}else Se(i,o,h,f-h)}}if(i.clients.size>0){const r=new En;return I(r.restEncoder,0),Bi(r,i),r.toUint8Array()}return null},Ir=Zs;class zt extends Ws{constructor({guid:t=Nc(),collectionid:n=null,gc:i=!0,gcFilter:s=()=>!0,meta:r=null,autoLoad:o=!1,shouldLoad:l=!0}={}){super(),this.gc=i,this.gcFilter=s,this.clientID=Ir(),this.guid=t,this.collectionid=n,this.share=new Map,this.store=new Rr,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=l,this.autoLoad=o,this.meta=r,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=ls(a=>{this.on("load",()=>{this.isLoaded=!0,a(this)})});const c=()=>ls(a=>{const u=h=>{(h===void 0||h===!0)&&(this.off("sync",u),a())};this.on("sync",u)});this.on("sync",a=>{a===!1&&this.isSynced&&(this.whenSynced=c()),this.isSynced=a===void 0||a===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=c()}load(){const t=this._item;t!==null&&!this.shouldLoad&&j(t.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set($t(this.subdocs).map(t=>t.guid))}transact(t,n=null){return j(this,t,n)}get(t,n=G){const i=Tt(this.share,t,()=>{const r=new n;return r._integrate(this,null),r}),s=i.constructor;if(n!==G&&s!==n)if(s===G){const r=new n;r._map=i._map,i._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=r}),r._start=i._start;for(let o=r._start;o!==null;o=o.right)o.parent=r;return r._length=i._length,this.share.set(t,r),r._integrate(this,null),r}else throw new Error(`Type with the name ${t} has already been defined with a different constructor`);return i}getArray(t=""){return this.get(t,Qt)}getText(t=""){return this.get(t,Rt)}getMap(t=""){return this.get(t,re)}getXmlElement(t=""){return this.get(t,Q)}getXmlFragment(t=""){return this.get(t,Ft)}toJSON(){const t={};return this.share.forEach((n,i)=>{t[i]=n.toJSON()}),t}destroy(){this.isDestroyed=!0,$t(this.subdocs).forEach(n=>n.destroy());const t=this._item;if(t!==null){this._item=null;const n=t.content;n.doc=new zt({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,j(t.parent.doc,i=>{const s=n.doc;t.deleted||i.subdocsAdded.add(s),i.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class Xa{constructor(t){this.dsCurrVal=0,this.restDecoder=t}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=R(this.restDecoder),this.dsCurrVal}readDsLen(){const t=R(this.restDecoder)+1;return this.dsCurrVal+=t,t}}class rn extends Xa{constructor(t){super(t),this.keys=[],R(t),this.keyClockDecoder=new Vn(lt(t)),this.clientDecoder=new Ke(lt(t)),this.leftClockDecoder=new Vn(lt(t)),this.rightClockDecoder=new Vn(lt(t)),this.infoDecoder=new os(lt(t),we),this.stringDecoder=new Ic(lt(t)),this.parentInfoDecoder=new os(lt(t),we),this.typeRefDecoder=new Ke(lt(t)),this.lenDecoder=new Ke(lt(t))}readLeftID(){return new Xt(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new Xt(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return Ze(this.restDecoder)}readBuf(){return lt(this.restDecoder)}readJSON(){return Ze(this.restDecoder)}readKey(){const t=this.keyClockDecoder.read();if(t<this.keys.length)return this.keys[t];{const n=this.stringDecoder.read();return this.keys.push(n),n}}}class Za{constructor(){this.restEncoder=Ie()}toUint8Array(){return ut(this.restEncoder)}resetDsCurVal(){}writeDsClock(t){I(this.restEncoder,t)}writeDsLen(t){I(this.restEncoder,t)}}class Qa extends Za{writeLeftID(t){I(this.restEncoder,t.client),I(this.restEncoder,t.clock)}writeRightID(t){I(this.restEncoder,t.client),I(this.restEncoder,t.clock)}writeClient(t){I(this.restEncoder,t)}writeInfo(t){ii(this.restEncoder,t)}writeString(t){Yt(this.restEncoder,t)}writeParentInfo(t){I(this.restEncoder,t?1:0)}writeTypeRef(t){I(this.restEncoder,t)}writeLen(t){I(this.restEncoder,t)}writeAny(t){ne(this.restEncoder,t)}writeBuf(t){st(this.restEncoder,t)}writeJSON(t){Yt(this.restEncoder,JSON.stringify(t))}writeKey(t){Yt(this.restEncoder,t)}}class th{constructor(){this.restEncoder=Ie(),this.dsCurrVal=0}toUint8Array(){return ut(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(t){const n=t-this.dsCurrVal;this.dsCurrVal=t,I(this.restEncoder,n)}writeDsLen(t){t===0&&et(),I(this.restEncoder,t-1),this.dsCurrVal+=t}}class En extends th{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Fn,this.clientEncoder=new ze,this.leftClockEncoder=new Fn,this.rightClockEncoder=new Fn,this.infoEncoder=new is(ii),this.stringEncoder=new vc,this.parentInfoEncoder=new is(ii),this.typeRefEncoder=new ze,this.lenEncoder=new ze}toUint8Array(){const t=Ie();return I(t,0),st(t,this.keyClockEncoder.toUint8Array()),st(t,this.clientEncoder.toUint8Array()),st(t,this.leftClockEncoder.toUint8Array()),st(t,this.rightClockEncoder.toUint8Array()),st(t,ut(this.infoEncoder)),st(t,this.stringEncoder.toUint8Array()),st(t,ut(this.parentInfoEncoder)),st(t,this.typeRefEncoder.toUint8Array()),st(t,this.lenEncoder.toUint8Array()),xn(t,ut(this.restEncoder)),ut(t)}writeLeftID(t){this.clientEncoder.write(t.client),this.leftClockEncoder.write(t.clock)}writeRightID(t){this.clientEncoder.write(t.client),this.rightClockEncoder.write(t.clock)}writeClient(t){this.clientEncoder.write(t)}writeInfo(t){this.infoEncoder.write(t)}writeString(t){this.stringEncoder.write(t)}writeParentInfo(t){this.parentInfoEncoder.write(t?1:0)}writeTypeRef(t){this.typeRefEncoder.write(t)}writeLen(t){this.lenEncoder.write(t)}writeAny(t){ne(this.restEncoder,t)}writeBuf(t){st(this.restEncoder,t)}writeJSON(t){ne(this.restEncoder,t)}writeKey(t){const n=this.keyMap.get(t);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(t)):this.keyClockEncoder.write(n)}}const eh=(e,t,n,i)=>{i=Ot(i,t[0].id.clock);const s=gt(t,i);I(e.restEncoder,t.length-s),e.writeClient(n),I(e.restEncoder,i);const r=t[s];r.write(e,i-r.id.clock);for(let o=s+1;o<t.length;o++)t[o].write(e,0)},Mr=(e,t,n)=>{const i=new Map;n.forEach((s,r)=>{$(t,r)>s&&i.set(r,s)}),_n(t).forEach((s,r)=>{n.has(r)||i.set(r,0)}),I(e.restEncoder,i.size),$t(i.entries()).sort((s,r)=>r[0]-s[0]).forEach(([s,r])=>{eh(e,t.clients.get(s),s,r)})},nh=(e,t)=>{const n=ft(),i=R(e.restDecoder);for(let s=0;s<i;s++){const r=R(e.restDecoder),o=new Array(r),l=e.readClient();let c=R(e.restDecoder);n.set(l,{i:0,refs:o});for(let a=0;a<r;a++){const u=e.readInfo();switch(mn&u){case 0:{const h=e.readLen();o[a]=new ct(_(l,c),h),c+=h;break}case 10:{const h=R(e.restDecoder);o[a]=new ht(_(l,c),h),c+=h;break}default:{const h=(u&(Et|tt))===0,f=new O(_(l,c),null,(u&tt)===tt?e.readLeftID():null,null,(u&Et)===Et?e.readRightID():null,h?e.readParentInfo()?t.get(e.readString()):e.readLeftID():null,h&&(u&xe)===xe?e.readString():null,so(e,u));o[a]=f,c+=f.length}}}}return n},ih=(e,t,n)=>{const i=[];let s=$t(n.keys()).sort((p,g)=>p-g);if(s.length===0)return null;const r=()=>{if(s.length===0)return null;let p=n.get(s[s.length-1]);for(;p.refs.length===p.i;)if(s.pop(),s.length>0)p=n.get(s[s.length-1]);else return null;return p};let o=r();if(o===null)return null;const l=new Rr,c=new Map,a=(p,g)=>{const x=c.get(p);(x==null||x>g)&&c.set(p,g)};let u=o.refs[o.i++];const h=new Map,f=()=>{for(const p of i){const g=p.id.client,x=n.get(g);x?(x.i--,l.clients.set(g,x.refs.slice(x.i)),n.delete(g),x.i=0,x.refs=[]):l.clients.set(g,[p]),s=s.filter(w=>w!==g)}i.length=0};for(;;){if(u.constructor!==ht){const g=Tt(h,u.id.client,()=>$(t,u.id.client))-u.id.clock;if(g<0)i.push(u),a(u.id.client,u.id.clock-1),f();else{const x=u.getMissing(e,t);if(x!==null){i.push(u);const w=n.get(x)||{refs:[],i:0};if(w.refs.length===w.i)a(x,$(t,x)),f();else{u=w.refs[w.i++];continue}}else(g===0||g<u.length)&&(u.integrate(e,g),h.set(u.id.client,u.id.clock+u.length))}}if(i.length>0)u=i.pop();else if(o!==null&&o.i<o.refs.length)u=o.refs[o.i++];else{if(o=r(),o===null)break;u=o.refs[o.i++]}}if(l.clients.size>0){const p=new En;return Mr(p,l,new Map),I(p.restEncoder,0),{missing:c,update:p.toUint8Array()}}return null},sh=(e,t)=>Mr(e,t.doc.store,t.beforeState),rh=(e,t,n,i=new rn(e))=>j(t,s=>{s.local=!1;let r=!1;const o=s.doc,l=o.store,c=nh(i,o),a=ih(s,l,c),u=l.pendingStructs;if(u){for(const[f,p]of u.missing)if(p<$(l,f)){r=!0;break}if(a){for(const[f,p]of a.missing){const g=u.missing.get(f);(g==null||g>p)&&u.missing.set(f,p)}u.update=ys([u.update,a.update])}}else l.pendingStructs=a;const h=us(i,s,l);if(l.pendingDs){const f=new rn(Ei(l.pendingDs));R(f.restDecoder);const p=us(f,s,l);h&&p?l.pendingDs=ys([h,p]):l.pendingDs=h||p}else l.pendingDs=h;if(r){const f=l.pendingStructs.update;l.pendingStructs=null,ai(s.doc,f)}},n,!1),ai=(e,t,n,i=rn)=>{const s=Ei(t);rh(s,e,n,new i(s))};class oh{constructor(){this.l=[]}}const ds=()=>new oh,fs=(e,t)=>e.l.push(t),ps=(e,t)=>{const n=e.l,i=n.length;e.l=n.filter(s=>t!==s),i===e.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},Or=(e,t,n)=>Ai(e.l,[t,n]);class Xt{constructor(t,n){this.client=t,this.clock=n}}const Be=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,_=(e,t)=>new Xt(e,t),Ce=e=>{for(const[t,n]of e.doc.share.entries())if(n===e)return t;throw et()},ke=(e,t)=>{for(;t!==null;){if(t.parent===e)return!0;t=t.parent._item}return!1};class on{constructor(t,n,i,s=0){this.type=t,this.tname=n,this.item=i,this.assoc=s}}class lh{constructor(t,n,i=0){this.type=t,this.index=n,this.assoc=i}}const ch=(e,t,n=0)=>new lh(e,t,n),Le=(e,t,n)=>{let i=null,s=null;return e._item===null?s=Ce(e):i=_(e._item.id.client,e._item.id.clock),new on(i,s,t,n)},qn=(e,t,n=0)=>{let i=e._start;if(n<0){if(t===0)return Le(e,null,n);t--}for(;i!==null;){if(!i.deleted&&i.countable){if(i.length>t)return Le(e,_(i.id.client,i.id.clock+t),n);t-=i.length}if(i.right===null&&n<0)return Le(e,i.lastId,n);i=i.right}return Le(e,null,n)},ah=(e,t)=>{const n=Zt(e,t),i=t.clock-n.id.clock;return{item:n,diff:i}},hh=(e,t,n=!0)=>{const i=t.store,s=e.item,r=e.type,o=e.tname,l=e.assoc;let c=null,a=0;if(s!==null){if($(i,s.client)<=s.clock)return null;const u=n?fi(i,s):ah(i,s),h=u.item;if(!(h instanceof O))return null;if(c=h.parent,c._item===null||!c._item.deleted){a=h.deleted||!h.countable?0:u.diff+(l>=0?0:1);let f=h.left;for(;f!==null;)!f.deleted&&f.countable&&(a+=f.length),f=f.left}}else{if(o!==null)c=t.get(o);else if(r!==null){if($(i,r.client)<=r.clock)return null;const{item:u}=n?fi(i,r):{item:Zt(i,r)};if(u instanceof O&&u.content instanceof xt)c=u.content.type;else return null}else throw et();l>=0?a=c._length:a=0}return ch(c,a,e.assoc)};class Li{constructor(t,n){this.ds=t,this.sv=n}}const jr=(e,t)=>new Li(e,t),Wn=e=>jr(Ya(e.store),_n(e.store)),Bt=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!ae(t.ds,e.id),hi=(e,t)=>{const n=Tt(e.meta,hi,Ut),i=e.doc.store;n.has(t)||(t.sv.forEach((s,r)=>{s<$(i,r)&&it(e,_(r,s))}),jt(e,t.ds,s=>{}),n.add(t))};class Rr{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const _n=e=>{const t=new Map;return e.clients.forEach((n,i)=>{const s=n[n.length-1];t.set(i,s.id.clock+s.length)}),t},$=(e,t)=>{const n=e.clients.get(t);if(n===void 0)return 0;const i=n[n.length-1];return i.id.clock+i.length},Nr=(e,t)=>{let n=e.clients.get(t.id.client);if(n===void 0)n=[],e.clients.set(t.id.client,n);else{const i=n[n.length-1];if(i.id.clock+i.length!==t.id.clock)throw et()}n.push(t)},gt=(e,t)=>{let n=0,i=e.length-1,s=e[i],r=s.id.clock;if(r===t)return i;let o=pt(t/(r+s.length-1)*i);for(;n<=i;){if(s=e[o],r=s.id.clock,r<=t){if(t<r+s.length)return o;n=o+1}else i=o-1;o=pt((n+i)/2)}throw et()},uh=(e,t)=>{const n=e.clients.get(t.client);return n[gt(n,t.clock)]},Zt=uh,ui=(e,t,n)=>{const i=gt(t,n),s=t[i];return s.id.clock<n&&s instanceof O?(t.splice(i+1,0,un(e,s,n-s.id.clock)),i+1):i},it=(e,t)=>{const n=e.doc.store.clients.get(t.client);return n[ui(e,n,t.clock)]},gs=(e,t,n)=>{const i=t.clients.get(n.client),s=gt(i,n.clock),r=i[s];return n.clock!==r.id.clock+r.length-1&&r.constructor!==ct&&i.splice(s+1,0,un(e,r,n.clock-r.id.clock+1)),r},dh=(e,t,n)=>{const i=e.clients.get(t.id.client);i[gt(i,t.id.clock)]=n},Br=(e,t,n,i,s)=>{if(i===0)return;const r=n+i;let o=ui(e,t,n),l;do l=t[o++],r<l.id.clock+l.length&&ui(e,t,r),s(l);while(o<t.length&&t[o].id.clock<r)};class fh{constructor(t,n,i){this.doc=t,this.deleteSet=new ce,this.beforeState=_n(t.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=n,this.meta=new Map,this.local=i,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const ms=(e,t)=>t.deleteSet.clients.size===0&&!Xl(t.afterState,(n,i)=>t.beforeState.get(i)!==n)?!1:(Ni(t.deleteSet),sh(e,t),Bi(e,t.deleteSet),!0),xs=(e,t,n)=>{const i=t._item;(i===null||i.id.clock<(e.beforeState.get(i.id.client)||0)&&!i.deleted)&&Tt(e.changed,t,Ut).add(n)},We=(e,t)=>{let n=e[t],i=e[t-1],s=t;for(;s>0;n=i,i=e[--s-1]){if(i.deleted===n.deleted&&i.constructor===n.constructor&&i.mergeWith(n)){n instanceof O&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,i);continue}break}const r=t-s;return r&&e.splice(t+1-r,r),r},ph=(e,t,n)=>{for(const[i,s]of e.clients.entries()){const r=t.clients.get(i);for(let o=s.length-1;o>=0;o--){const l=s[o],c=l.clock+l.len;for(let a=gt(r,l.clock),u=r[a];a<r.length&&u.id.clock<c;u=r[++a]){const h=r[a];if(l.clock+l.len<=h.id.clock)break;h instanceof O&&h.deleted&&!h.keep&&n(h)&&h.gc(t,!1)}}}},gh=(e,t)=>{e.clients.forEach((n,i)=>{const s=t.clients.get(i);for(let r=n.length-1;r>=0;r--){const o=n[r],l=ee(s.length-1,1+gt(s,o.clock+o.len-1));for(let c=l,a=s[c];c>0&&a.id.clock>=o.clock;a=s[c])c-=1+We(s,c)}})},Lr=(e,t)=>{if(t<e.length){const n=e[t],i=n.doc,s=i.store,r=n.deleteSet,o=n._mergeStructs;try{Ni(r),n.afterState=_n(n.doc.store),i.emit("beforeObserverCalls",[n,i]);const l=[];n.changed.forEach((c,a)=>l.push(()=>{(a._item===null||!a._item.deleted)&&a._callObserver(n,c)})),l.push(()=>{n.changedParentTypes.forEach((c,a)=>{a._dEH.l.length>0&&(a._item===null||!a._item.deleted)&&(c=c.filter(u=>u.target._item===null||!u.target._item.deleted),c.forEach(u=>{u.currentTarget=a,u._path=null}),c.sort((u,h)=>u.path.length-h.path.length),l.push(()=>{Or(a._dEH,c,n)}))}),l.push(()=>i.emit("afterTransaction",[n,i])),l.push(()=>{n._needFormattingCleanup&&Nh(n)})}),Ai(l,[])}finally{i.gc&&ph(r,s,i.gcFilter),gh(r,s),n.afterState.forEach((u,h)=>{const f=n.beforeState.get(h)||0;if(f!==u){const p=s.clients.get(h),g=Ot(gt(p,f),1);for(let x=p.length-1;x>=g;)x-=1+We(p,x)}});for(let u=o.length-1;u>=0;u--){const{client:h,clock:f}=o[u].id,p=s.clients.get(h),g=gt(p,f);g+1<p.length&&We(p,g+1)>1||g>0&&We(p,g)}if(!n.local&&n.afterState.get(i.clientID)!==n.beforeState.get(i.clientID)&&(qa(Ri,Sr,"[yjs] ",Cr,kr,"Changed the client-id because another client seems to be using it."),i.clientID=Ir()),i.emit("afterTransactionCleanup",[n,i]),i._observers.has("update")){const u=new Qa;ms(u,n)&&i.emit("update",[u.toUint8Array(),n.origin,i,n])}if(i._observers.has("updateV2")){const u=new En;ms(u,n)&&i.emit("updateV2",[u.toUint8Array(),n.origin,i,n])}const{subdocsAdded:l,subdocsLoaded:c,subdocsRemoved:a}=n;(l.size>0||a.size>0||c.size>0)&&(l.forEach(u=>{u.clientID=i.clientID,u.collectionid==null&&(u.collectionid=i.collectionid),i.subdocs.add(u)}),a.forEach(u=>i.subdocs.delete(u)),i.emit("subdocs",[{loaded:c,added:l,removed:a},i,n]),a.forEach(u=>u.destroy())),e.length<=t+1?(i._transactionCleanups=[],i.emit("afterAllTransactions",[i,e])):Lr(e,t+1)}}},j=(e,t,n=null,i=!0)=>{const s=e._transactionCleanups;let r=!1,o=null;e._transaction===null&&(r=!0,e._transaction=new fh(e,n,i),s.push(e._transaction),s.length===1&&e.emit("beforeAllTransactions",[e]),e.emit("beforeTransaction",[e._transaction,e]));try{o=t(e._transaction)}finally{if(r){const l=e._transaction===s[0];e._transaction=null,l&&Lr(s,0)}}return o};class mh{constructor(t,n){this.insertions=n,this.deletions=t,this.meta=new Map}}const bs=(e,t,n)=>{jt(e,n.deletions,i=>{i instanceof O&&t.scope.some(s=>s===e.doc||ke(s,i))&&Vi(i,!1)})},ws=(e,t,n)=>{let i=null;const s=e.doc,r=e.scope;j(s,l=>{for(;t.length>0&&e.currStackItem===null;){const c=s.store,a=t.pop(),u=new Set,h=[];let f=!1;jt(l,a.insertions,p=>{if(p instanceof O){if(p.redone!==null){let{item:g,diff:x}=fi(c,p.id);x>0&&(g=it(l,_(g.id.client,g.id.clock+x))),p=g}!p.deleted&&r.some(g=>g===l.doc||ke(g,p))&&h.push(p)}}),jt(l,a.deletions,p=>{p instanceof O&&r.some(g=>g===l.doc||ke(g,p))&&!ae(a.insertions,p.id)&&u.add(p)}),u.forEach(p=>{f=io(l,p,u,a.insertions,e.ignoreRemoteMapChanges,e)!==null||f});for(let p=h.length-1;p>=0;p--){const g=h[p];e.deleteFilter(g)&&(g.delete(l),f=!0)}e.currStackItem=f?a:null}l.changed.forEach((c,a)=>{c.has(null)&&a._searchMarker&&(a._searchMarker.length=0)}),i=l},e);const o=e.currStackItem;if(o!=null){const l=i.changedParentTypes;e.emit("stack-item-popped",[{stackItem:o,type:n,changedParentTypes:l,origin:e},e]),e.currStackItem=null}return o};class Pr extends Ws{constructor(t,{captureTimeout:n=500,captureTransaction:i=c=>!0,deleteFilter:s=()=>!0,trackedOrigins:r=new Set([null]),ignoreRemoteMapChanges:o=!1,doc:l=te(t)?t[0].doc:t instanceof zt?t:t.doc}={}){super(),this.scope=[],this.doc=l,this.addToScope(t),this.deleteFilter=s,r.add(this),this.trackedOrigins=r,this.captureTransaction=i,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=o,this.captureTimeout=n,this.afterTransactionHandler=c=>{if(!this.captureTransaction(c)||!this.scope.some(w=>c.changedParentTypes.has(w)||w===this.doc)||!this.trackedOrigins.has(c.origin)&&(!c.origin||!this.trackedOrigins.has(c.origin.constructor)))return;const a=this.undoing,u=this.redoing,h=a?this.redoStack:this.undoStack;a?this.stopCapturing():u||this.clear(!1,!0);const f=new ce;c.afterState.forEach((w,y)=>{const C=c.beforeState.get(y)||0,S=w-C;S>0&&Se(f,y,C,S)});const p=Bc();let g=!1;if(this.lastChange>0&&p-this.lastChange<this.captureTimeout&&h.length>0&&!a&&!u){const w=h[h.length-1];w.deletions=ci([w.deletions,c.deleteSet]),w.insertions=ci([w.insertions,f])}else h.push(new mh(c.deleteSet,f)),g=!0;!a&&!u&&(this.lastChange=p),jt(c,c.deleteSet,w=>{w instanceof O&&this.scope.some(y=>y===c.doc||ke(y,w))&&Vi(w,!0)});const x=[{stackItem:h[h.length-1],origin:c.origin,type:a?"redo":"undo",changedParentTypes:c.changedParentTypes},this];g?this.emit("stack-item-added",x):this.emit("stack-item-updated",x)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(t){const n=new Set(this.scope);t=te(t)?t:[t],t.forEach(i=>{n.has(i)||(n.add(i),(i instanceof G?i.doc!==this.doc:i!==this.doc)&&_r("[yjs#509] Not same Y.Doc"),this.scope.push(i))})}addTrackedOrigin(t){this.trackedOrigins.add(t)}removeTrackedOrigin(t){this.trackedOrigins.delete(t)}clear(t=!0,n=!0){(t&&this.canUndo()||n&&this.canRedo())&&this.doc.transact(i=>{t&&(this.undoStack.forEach(s=>bs(i,this,s)),this.undoStack=[]),n&&(this.redoStack.forEach(s=>bs(i,this,s)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:t,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let t;try{t=ws(this,this.undoStack,"undo")}finally{this.undoing=!1}return t}redo(){this.redoing=!0;let t;try{t=ws(this,this.redoStack,"redo")}finally{this.redoing=!1}return t}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*xh(e){const t=R(e.restDecoder);for(let n=0;n<t;n++){const i=R(e.restDecoder),s=e.readClient();let r=R(e.restDecoder);for(let o=0;o<i;o++){const l=e.readInfo();if(l===10){const c=R(e.restDecoder);yield new ht(_(s,r),c),r+=c}else if((mn&l)!==0){const c=(l&(Et|tt))===0,a=new O(_(s,r),null,(l&tt)===tt?e.readLeftID():null,null,(l&Et)===Et?e.readRightID():null,c?e.readParentInfo()?e.readString():e.readLeftID():null,c&&(l&xe)===xe?e.readString():null,so(e,l));yield a,r+=a.length}else{const c=e.readLen();yield new ct(_(s,r),c),r+=c}}}}class bh{constructor(t,n){this.gen=xh(t),this.curr=null,this.done=!1,this.filterSkips=n,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===ht);return this.curr}}class wh{constructor(t){this.currClient=0,this.startClock=0,this.written=0,this.encoder=t,this.clientStructs=[]}}const yh=(e,t)=>{if(e.constructor===ct){const{client:n,clock:i}=e.id;return new ct(_(n,i+t),e.length-t)}else if(e.constructor===ht){const{client:n,clock:i}=e.id;return new ht(_(n,i+t),e.length-t)}else{const n=e,{client:i,clock:s}=n.id;return new O(_(i,s+t),null,_(i,s+t-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(t))}},ys=(e,t=rn,n=En)=>{if(e.length===1)return e[0];const i=e.map(u=>new t(Ei(u)));let s=i.map(u=>new bh(u,!0)),r=null;const o=new n,l=new wh(o);for(;s=s.filter(f=>f.curr!==null),s.sort((f,p)=>{if(f.curr.id.client===p.curr.id.client){const g=f.curr.id.clock-p.curr.id.clock;return g===0?f.curr.constructor===p.curr.constructor?0:f.curr.constructor===ht?1:-1:g}else return p.curr.id.client-f.curr.id.client}),s.length!==0;){const u=s[0],h=u.curr.id.client;if(r!==null){let f=u.curr,p=!1;for(;f!==null&&f.id.clock+f.length<=r.struct.id.clock+r.struct.length&&f.id.client>=r.struct.id.client;)f=u.next(),p=!0;if(f===null||f.id.client!==h||p&&f.id.clock>r.struct.id.clock+r.struct.length)continue;if(h!==r.struct.id.client)pe(l,r.struct,r.offset),r={struct:f,offset:0},u.next();else if(r.struct.id.clock+r.struct.length<f.id.clock)if(r.struct.constructor===ht)r.struct.length=f.id.clock+f.length-r.struct.id.clock;else{pe(l,r.struct,r.offset);const g=f.id.clock-r.struct.id.clock-r.struct.length;r={struct:new ht(_(h,r.struct.id.clock+r.struct.length),g),offset:0}}else{const g=r.struct.id.clock+r.struct.length-f.id.clock;g>0&&(r.struct.constructor===ht?r.struct.length-=g:f=yh(f,g)),r.struct.mergeWith(f)||(pe(l,r.struct,r.offset),r={struct:f,offset:0},u.next())}}else r={struct:u.curr,offset:0},u.next();for(let f=u.curr;f!==null&&f.id.client===h&&f.id.clock===r.struct.id.clock+r.struct.length&&f.constructor!==ht;f=u.next())pe(l,r.struct,r.offset),r={struct:f,offset:0}}r!==null&&(pe(l,r.struct,r.offset),r=null),vh(l);const c=i.map(u=>Ja(u)),a=ci(c);return Bi(o,a),o.toUint8Array()},Ur=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:ut(e.encoder.restEncoder)}),e.encoder.restEncoder=Ie(),e.written=0)},pe=(e,t,n)=>{e.written>0&&e.currClient!==t.id.client&&Ur(e),e.written===0&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),I(e.encoder.restEncoder,t.id.clock+n)),t.write(e.encoder,n),e.written++},vh=e=>{Ur(e);const t=e.encoder.restEncoder;I(t,e.clientStructs.length);for(let n=0;n<e.clientStructs.length;n++){const i=e.clientStructs[n];I(t,i.written),xn(t,i.restEncoder)}},vs="You must not compute changes after the event-handler fired.";class Tn{constructor(t,n){this.target=t,this.currentTarget=t,this.transaction=n,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=Sh(this.currentTarget,this.target))}deletes(t){return ae(this.transaction.deleteSet,t.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw vt(vs);const t=new Map,n=this.target;this.transaction.changed.get(n).forEach(s=>{if(s!==null){const r=n._map.get(s);let o,l;if(this.adds(r)){let c=r.left;for(;c!==null&&this.adds(c);)c=c.left;if(this.deletes(r))if(c!==null&&this.deletes(c))o="delete",l=Pn(c.content.getContent());else return;else c!==null&&this.deletes(c)?(o="update",l=Pn(c.content.getContent())):(o="add",l=void 0)}else if(this.deletes(r))o="delete",l=Pn(r.content.getContent());else return;t.set(s,{action:o,oldValue:l})}}),this._keys=t}return this._keys}get delta(){return this.changes.delta}adds(t){return t.id.clock>=(this.transaction.beforeState.get(t.id.client)||0)}get changes(){let t=this._changes;if(t===null){if(this.transaction.doc._transactionCleanups.length===0)throw vt(vs);const n=this.target,i=Ut(),s=Ut(),r=[];if(t={added:i,deleted:s,delta:r,keys:this.keys},this.transaction.changed.get(n).has(null)){let l=null;const c=()=>{l&&r.push(l)};for(let a=n._start;a!==null;a=a.right)a.deleted?this.deletes(a)&&!this.adds(a)&&((l===null||l.delete===void 0)&&(c(),l={delete:0}),l.delete+=a.length,s.add(a)):this.adds(a)?((l===null||l.insert===void 0)&&(c(),l={insert:[]}),l.insert=l.insert.concat(a.content.getContent()),i.add(a)):((l===null||l.retain===void 0)&&(c(),l={retain:0}),l.retain+=a.length);l!==null&&l.retain===void 0&&c()}this._changes=t}return t}}const Sh=(e,t)=>{const n=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)n.unshift(t._item.parentSub);else{let i=0,s=t._item.parent._start;for(;s!==t._item&&s!==null;)!s.deleted&&s.countable&&(i+=s.length),s=s.right;n.unshift(i)}t=t._item.parent}return n},X=()=>{_r("Invalid access: Add Yjs type to a document before reading data.")},$r=80;let Pi=0;class Ch{constructor(t,n){t.marker=!0,this.p=t,this.index=n,this.timestamp=Pi++}}const kh=e=>{e.timestamp=Pi++},Fr=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=Pi++},Eh=(e,t,n)=>{if(e.length>=$r){const i=e.reduce((s,r)=>s.timestamp<r.timestamp?s:r);return Fr(i,t,n),i}else{const i=new Ch(t,n);return e.push(i),i}},Dn=(e,t)=>{if(e._start===null||t===0||e._searchMarker===null)return null;const n=e._searchMarker.length===0?null:e._searchMarker.reduce((r,o)=>He(t-r.index)<He(t-o.index)?r:o);let i=e._start,s=0;for(n!==null&&(i=n.p,s=n.index,kh(n));i.right!==null&&s<t;){if(!i.deleted&&i.countable){if(t<s+i.length)break;s+=i.length}i=i.right}for(;i.left!==null&&s>t;)i=i.left,!i.deleted&&i.countable&&(s-=i.length);for(;i.left!==null&&i.left.id.client===i.id.client&&i.left.id.clock+i.left.length===i.id.clock;)i=i.left,!i.deleted&&i.countable&&(s-=i.length);return n!==null&&He(n.index-s)<i.parent.length/$r?(Fr(n,i,s),n):Eh(e._searchMarker,i,s)},Ee=(e,t,n)=>{for(let i=e.length-1;i>=0;i--){const s=e[i];if(n>0){let r=s.p;for(r.marker=!1;r&&(r.deleted||!r.countable);)r=r.left,r&&!r.deleted&&r.countable&&(s.index-=r.length);if(r===null||r.marker===!0){e.splice(i,1);continue}s.p=r,r.marker=!0}(t<s.index||n>0&&t===s.index)&&(s.index=Ot(t,s.index+n))}},An=(e,t,n)=>{const i=e,s=t.changedParentTypes;for(;Tt(s,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;Or(i._eH,n,t)};class G{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=ds(),this._dEH=ds(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(t,n){this.doc=t,this._item=n}_copy(){throw at()}clone(){throw at()}_write(t){}get _first(){let t=this._start;for(;t!==null&&t.deleted;)t=t.right;return t}_callObserver(t,n){!t.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(t){fs(this._eH,t)}observeDeep(t){fs(this._dEH,t)}unobserve(t){ps(this._eH,t)}unobserveDeep(t){ps(this._dEH,t)}toJSON(){}}const Vr=(e,t,n)=>{e.doc??X(),t<0&&(t=e._length+t),n<0&&(n=e._length+n);let i=n-t;const s=[];let r=e._start;for(;r!==null&&i>0;){if(r.countable&&!r.deleted){const o=r.content.getContent();if(o.length<=t)t-=o.length;else{for(let l=t;l<o.length&&i>0;l++)s.push(o[l]),i--;t=0}}r=r.right}return s},Hr=e=>{e.doc??X();const t=[];let n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){const i=n.content.getContent();for(let s=0;s<i.length;s++)t.push(i[s])}n=n.right}return t},zr=(e,t)=>{const n=[];let i=e._start;for(;i!==null;){if(i.countable&&Bt(i,t)){const s=i.content.getContent();for(let r=0;r<s.length;r++)n.push(s[r])}i=i.right}return n},_e=(e,t)=>{let n=0,i=e._start;for(e.doc??X();i!==null;){if(i.countable&&!i.deleted){const s=i.content.getContent();for(let r=0;r<s.length;r++)t(s[r],n++,e)}i=i.right}},Kr=(e,t)=>{const n=[];return _e(e,(i,s)=>{n.push(t(i,s,e))}),n},_h=e=>{let t=e._start,n=null,i=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};n=t.content.getContent(),i=0,t=t.right}const s=n[i++];return n.length<=i&&(n=null),{done:!1,value:s}}}},qr=(e,t)=>{e.doc??X();const n=Dn(e,t);let i=e._start;for(n!==null&&(i=n.p,t-=n.index);i!==null;i=i.right)if(!i.deleted&&i.countable){if(t<i.length)return i.content.getContent()[t];t-=i.length}},ln=(e,t,n,i)=>{let s=n;const r=e.doc,o=r.clientID,l=r.store,c=n===null?t._start:n.right;let a=[];const u=()=>{a.length>0&&(s=new O(_(o,$(l,o)),s,s&&s.lastId,c,c&&c.id,t,null,new Vt(a)),s.integrate(e,0),a=[])};i.forEach(h=>{if(h===null)a.push(h);else switch(h.constructor){case Number:case Object:case Boolean:case Array:case String:a.push(h);break;default:switch(u(),h.constructor){case Uint8Array:case ArrayBuffer:s=new O(_(o,$(l,o)),s,s&&s.lastId,c,c&&c.id,t,null,new Oe(new Uint8Array(h))),s.integrate(e,0);break;case zt:s=new O(_(o,$(l,o)),s,s&&s.lastId,c,c&&c.id,t,null,new je(h)),s.integrate(e,0);break;default:if(h instanceof G)s=new O(_(o,$(l,o)),s,s&&s.lastId,c,c&&c.id,t,null,new xt(h)),s.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),u()},Wr=()=>vt("Length exceeded!"),Gr=(e,t,n,i)=>{if(n>t._length)throw Wr();if(n===0)return t._searchMarker&&Ee(t._searchMarker,n,i.length),ln(e,t,null,i);const s=n,r=Dn(t,n);let o=t._start;for(r!==null&&(o=r.p,n-=r.index,n===0&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&it(e,_(o.id.client,o.id.clock+n));break}n-=o.length}return t._searchMarker&&Ee(t._searchMarker,s,i.length),ln(e,t,o,i)},Th=(e,t,n)=>{let s=(t._searchMarker||[]).reduce((r,o)=>o.index>r.index?o:r,{index:0,p:t._start}).p;if(s)for(;s.right;)s=s.right;return ln(e,t,s,n)},Yr=(e,t,n,i)=>{if(i===0)return;const s=n,r=i,o=Dn(t,n);let l=t._start;for(o!==null&&(l=o.p,n-=o.index);l!==null&&n>0;l=l.right)!l.deleted&&l.countable&&(n<l.length&&it(e,_(l.id.client,l.id.clock+n)),n-=l.length);for(;i>0&&l!==null;)l.deleted||(i<l.length&&it(e,_(l.id.client,l.id.clock+i)),l.delete(e),i-=l.length),l=l.right;if(i>0)throw Wr();t._searchMarker&&Ee(t._searchMarker,s,-r+i)},cn=(e,t,n)=>{const i=t._map.get(n);i!==void 0&&i.delete(e)},Ui=(e,t,n,i)=>{const s=t._map.get(n)||null,r=e.doc,o=r.clientID;let l;if(i==null)l=new Vt([i]);else switch(i.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:l=new Vt([i]);break;case Uint8Array:l=new Oe(i);break;case zt:l=new je(i);break;default:if(i instanceof G)l=new xt(i);else throw new Error("Unexpected content type")}new O(_(o,$(r.store,o)),s,s&&s.lastId,null,null,t,n,l).integrate(e,0)},$i=(e,t)=>{e.doc??X();const n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},Jr=e=>{const t={};return e.doc??X(),e._map.forEach((n,i)=>{n.deleted||(t[i]=n.content.getContent()[n.length-1])}),t},Xr=(e,t)=>{e.doc??X();const n=e._map.get(t);return n!==void 0&&!n.deleted},Dh=(e,t)=>{const n={};return e._map.forEach((i,s)=>{let r=i;for(;r!==null&&(!t.sv.has(r.id.client)||r.id.clock>=(t.sv.get(r.id.client)||0));)r=r.left;r!==null&&Bt(r,t)&&(n[s]=r.content.getContent()[r.length-1])}),n},Pe=e=>(e.doc??X(),Wa(e._map.entries(),t=>!t[1].deleted));class Ah extends Tn{}class Qt extends G{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){const n=new Qt;return n.push(t),n}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Qt}clone(){const t=new Qt;return t.insert(0,this.toArray().map(n=>n instanceof G?n.clone():n)),t}get length(){return this.doc??X(),this._length}_callObserver(t,n){super._callObserver(t,n),An(this,t,new Ah(this,t))}insert(t,n){this.doc!==null?j(this.doc,i=>{Gr(i,this,t,n)}):this._prelimContent.splice(t,0,...n)}push(t){this.doc!==null?j(this.doc,n=>{Th(n,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,n=1){this.doc!==null?j(this.doc,i=>{Yr(i,this,t,n)}):this._prelimContent.splice(t,n)}get(t){return qr(this,t)}toArray(){return Hr(this)}slice(t=0,n=this.length){return Vr(this,t,n)}toJSON(){return this.map(t=>t instanceof G?t.toJSON():t)}map(t){return Kr(this,t)}forEach(t){_e(this,t)}[Symbol.iterator](){return _h(this)}_write(t){t.writeTypeRef(tu)}}const Ih=e=>new Qt;class Mh extends Tn{constructor(t,n,i){super(t,n),this.keysChanged=i}}class re extends G{constructor(t){super(),this._prelimContent=null,t===void 0?this._prelimContent=new Map:this._prelimContent=new Map(t)}_integrate(t,n){super._integrate(t,n),this._prelimContent.forEach((i,s)=>{this.set(s,i)}),this._prelimContent=null}_copy(){return new re}clone(){const t=new re;return this.forEach((n,i)=>{t.set(i,n instanceof G?n.clone():n)}),t}_callObserver(t,n){An(this,t,new Mh(this,t,n))}toJSON(){this.doc??X();const t={};return this._map.forEach((n,i)=>{if(!n.deleted){const s=n.content.getContent()[n.length-1];t[i]=s instanceof G?s.toJSON():s}}),t}get size(){return[...Pe(this)].length}keys(){return Kn(Pe(this),t=>t[0])}values(){return Kn(Pe(this),t=>t[1].content.getContent()[t[1].length-1])}entries(){return Kn(Pe(this),t=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this.doc??X(),this._map.forEach((n,i)=>{n.deleted||t(n.content.getContent()[n.length-1],i,this)})}[Symbol.iterator](){return this.entries()}delete(t){this.doc!==null?j(this.doc,n=>{cn(n,this,t)}):this._prelimContent.delete(t)}set(t,n){return this.doc!==null?j(this.doc,i=>{Ui(i,this,t,n)}):this._prelimContent.set(t,n),n}get(t){return $i(this,t)}has(t){return Xr(this,t)}clear(){this.doc!==null?j(this.doc,t=>{this.forEach(function(n,i,s){cn(t,s,i)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(eu)}}const Oh=e=>new re,It=(e,t)=>e===t||typeof e=="object"&&typeof t=="object"&&e&&t&&zc(e,t);class di{constructor(t,n,i,s){this.left=t,this.right=n,this.index=i,this.currentAttributes=s}forward(){switch(this.right===null&&et(),this.right.content.constructor){case F:this.right.deleted||he(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const Ss=(e,t,n)=>{for(;t.right!==null&&n>0;){switch(t.right.content.constructor){case F:t.right.deleted||he(t.currentAttributes,t.right.content);break;default:t.right.deleted||(n<t.right.length&&it(e,_(t.right.id.client,t.right.id.clock+n)),t.index+=t.right.length,n-=t.right.length);break}t.left=t.right,t.right=t.right.right}return t},Ue=(e,t,n,i)=>{const s=new Map,r=i?Dn(t,n):null;if(r){const o=new di(r.p.left,r.p,r.index,s);return Ss(e,o,n-r.index)}else{const o=new di(null,t._start,0,s);return Ss(e,o,n)}},Zr=(e,t,n,i)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===F&&It(i.get(n.right.content.key),n.right.content.value));)n.right.deleted||i.delete(n.right.content.key),n.forward();const s=e.doc,r=s.clientID;i.forEach((o,l)=>{const c=n.left,a=n.right,u=new O(_(r,$(s.store,r)),c,c&&c.lastId,a,a&&a.id,t,null,new F(l,o));u.integrate(e,0),n.right=u,n.forward()})},he=(e,t)=>{const{key:n,value:i}=t;i===null?e.delete(n):e.set(n,i)},Qr=(e,t)=>{for(;e.right!==null;){if(!(e.right.deleted||e.right.content.constructor===F&&It(t[e.right.content.key]??null,e.right.content.value)))break;e.forward()}},to=(e,t,n,i)=>{const s=e.doc,r=s.clientID,o=new Map;for(const l in i){const c=i[l],a=n.currentAttributes.get(l)??null;if(!It(a,c)){o.set(l,a);const{left:u,right:h}=n;n.right=new O(_(r,$(s.store,r)),u,u&&u.lastId,h,h&&h.id,t,null,new F(l,c)),n.right.integrate(e,0),n.forward()}}return o},Gn=(e,t,n,i,s)=>{n.currentAttributes.forEach((f,p)=>{s[p]===void 0&&(s[p]=null)});const r=e.doc,o=r.clientID;Qr(n,s);const l=to(e,t,n,s),c=i.constructor===String?new mt(i):i instanceof G?new xt(i):new Kt(i);let{left:a,right:u,index:h}=n;t._searchMarker&&Ee(t._searchMarker,n.index,c.getLength()),u=new O(_(o,$(r.store,o)),a,a&&a.lastId,u,u&&u.id,t,null,c),u.integrate(e,0),n.right=u,n.index=h,n.forward(),Zr(e,t,n,l)},Cs=(e,t,n,i,s)=>{const r=e.doc,o=r.clientID;Qr(n,s);const l=to(e,t,n,s);t:for(;n.right!==null&&(i>0||l.size>0&&(n.right.deleted||n.right.content.constructor===F));){if(!n.right.deleted)switch(n.right.content.constructor){case F:{const{key:c,value:a}=n.right.content,u=s[c];if(u!==void 0){if(It(u,a))l.delete(c);else{if(i===0)break t;l.set(c,a)}n.right.delete(e)}else n.currentAttributes.set(c,a);break}default:i<n.right.length&&it(e,_(n.right.id.client,n.right.id.clock+i)),i-=n.right.length;break}n.forward()}if(i>0){let c="";for(;i>0;i--)c+=`
|
package/lib/bubble.js
CHANGED
|
@@ -5,35 +5,35 @@ import { jsx as p, Fragment as I, jsxs as x } from "react/jsx-runtime";
|
|
|
5
5
|
import { a1 as ml, f as mr, E as Ue, a2 as wl, a3 as bl, a4 as Le, a5 as yl, Q as Ui, O as wr, v as Je, F as Xe, T as Li, A as xl, u as vl, a6 as Sl, a7 as Cl, a8 as kl } from "./index-BblvcbTH.js";
|
|
6
6
|
import { f as br, s as yr, o as xr, a as vr, b as Sr, d as Cr, h as kr, i as _r, c as Pi } from "./index-CGjT-a9h.js";
|
|
7
7
|
import { Plugin as Pe, PluginKey as Yt, NodeSelection as di, TextSelection as _l, SelectionRange as El, Selection as Tl } from "@tiptap/pm/state";
|
|
8
|
-
import { C as Dl, T as Al } from "./Table-
|
|
8
|
+
import { C as Dl, T as Al } from "./Table-DdEgaUwa.js";
|
|
9
9
|
import { u as Er } from "./clsx-0OU6n9va.js";
|
|
10
10
|
import Tr, { useRef as ct, useState as U, useEffect as Z, useLayoutEffect as Il, useCallback as O, useMemo as ht, Fragment as Bi } from "react";
|
|
11
11
|
import { createPortal as $i } from "react-dom";
|
|
12
|
-
import { F as Q, h as j, D as Be, r as $e, A as v, s as Ve, v as He, L as Ut, j as te, w as ze, B as Lt, x as Dr, m as Vi, E as Ol, z as Ml, Y as Rl, p as Nl, Z as Ul, I as rt } from "./index-
|
|
13
|
-
import { C as Ze, S as Ll, a as Pl, b as Bl, c as $l, d as Vl } from "./Callout-
|
|
14
|
-
import { u as Gt, K as ui, s as Hl } from "./Katex-
|
|
12
|
+
import { F as Q, h as j, D as Be, r as $e, A as v, s as Ve, v as He, L as Ut, j as te, w as ze, B as Lt, x as Dr, m as Vi, E as Ol, z as Ml, Y as Rl, p as Nl, Z as Ul, I as rt } from "./index-X6WZUM9O.js";
|
|
13
|
+
import { C as Ze, S as Ll, a as Pl, b as Bl, c as $l, d as Vl } from "./Callout-ZlPQrMEt.js";
|
|
14
|
+
import { u as Gt, K as ui, s as Hl } from "./Katex-CCP_ZQz2.js";
|
|
15
15
|
import { u as J, o as un, V as bs } from "./index-oj858lQO.js";
|
|
16
16
|
import { Pencil as zl, Trash2 as Ar, Check as fi, Copy as Fl } from "lucide-react";
|
|
17
17
|
import { CodeBlock as Gn } from "./CodeBlock.js";
|
|
18
|
-
import { S as Ct } from "./separator-
|
|
19
|
-
import { P as Hi, a as zi, b as Fi } from "./popover-
|
|
18
|
+
import { S as Ct } from "./separator-CBPrZizK.js";
|
|
19
|
+
import { P as Hi, a as zi, b as Fi } from "./popover-BfWFqCIs.js";
|
|
20
20
|
import { MultipleColumnNode as ys } from "./Column.js";
|
|
21
21
|
import "./theme.js";
|
|
22
|
-
import { C as Kl, D as qn } from "./Drawer-
|
|
22
|
+
import { C as Kl, D as qn } from "./Drawer-C-EO1uoK.js";
|
|
23
23
|
import { Editor as jl, makeDropdownToolbar as Wl } from "easydrawer";
|
|
24
24
|
import { s as Ir, i as Or } from "./shortId-WJVkrvml.js";
|
|
25
25
|
import { Excalidraw as we } from "./Excalidraw.js";
|
|
26
|
-
import { I as be, g as Yl } from "./Iframe-
|
|
26
|
+
import { I as be, g as Yl } from "./Iframe-CGb6-2LD.js";
|
|
27
27
|
import { ImageGif as Gl } from "./ImageGif.js";
|
|
28
28
|
import ql from "katex";
|
|
29
|
-
import { T as pi } from "./textarea-
|
|
30
|
-
import { L as xs, a as Jl, R as Xl } from "./LinkEditBlock-
|
|
29
|
+
import { T as pi } from "./textarea-Bl64keav.js";
|
|
30
|
+
import { L as xs, a as Jl, R as Xl } from "./LinkEditBlock-B1m-TVMu.js";
|
|
31
31
|
import { DecorationSet as vs, Decoration as Zl } from "@tiptap/pm/view";
|
|
32
32
|
import { NodeRange as Ql } from "@tiptap/pm/model";
|
|
33
33
|
import { Clear as tc } from "./Clear.js";
|
|
34
|
-
import { I as ec, a as Ss, s as Cs } from "./Indent-
|
|
34
|
+
import { I as ec, a as Ss, s as Cs } from "./Indent-CdMYsDNS.js";
|
|
35
35
|
import { RichTextAlign as nc, TextAlign as ic } from "./TextAlign.js";
|
|
36
|
-
import { D as sc, a as rc, b as oc, f as Et, d as lc, g as ks, h as _s, i as Es, j as Ts } from "./dropdown-menu-
|
|
36
|
+
import { D as sc, a as rc, b as oc, f as Et, d as lc, g as ks, h as _s, i as Es, j as Ts } from "./dropdown-menu-ROihzXsP.js";
|
|
37
37
|
import { Mermaid as gi } from "./Mermaid.js";
|
|
38
38
|
import { RichTextBold as cc } from "./Bold.js";
|
|
39
39
|
import { RichTextCode as ac } from "./Code.js";
|
|
@@ -41,10 +41,10 @@ import "./index-zw-Kd38i.js";
|
|
|
41
41
|
import { RichTextColor as hc } from "./Color.js";
|
|
42
42
|
import { RichTextHighlight as dc } from "./Highlight.js";
|
|
43
43
|
import { RichTextItalic as uc } from "./Italic.js";
|
|
44
|
-
import { r as fc } from "./SlashCommandNodeView-
|
|
44
|
+
import { r as fc } from "./SlashCommandNodeView-Dt6n1SP9.js";
|
|
45
45
|
import { RichTextStrike as pc } from "./Strike.js";
|
|
46
46
|
import { RichTextUnderline as gc } from "./TextUnderline.js";
|
|
47
|
-
import { T as Ds, F as mc } from "./Twitter-
|
|
47
|
+
import { T as Ds, F as mc } from "./Twitter-Dnz9qyW0.js";
|
|
48
48
|
function wc(e, t) {
|
|
49
49
|
const n = Math.min(e.top, t.top), i = Math.max(e.bottom, t.bottom), s = Math.min(e.left, t.left), o = Math.max(e.right, t.right) - s, l = i - n, c = s, a = n;
|
|
50
50
|
return new DOMRect(c, a, o, l);
|
|
@@ -2,7 +2,7 @@ import { jsx as c, jsxs as x } from "react/jsx-runtime";
|
|
|
2
2
|
import * as t from "@radix-ui/react-dropdown-menu";
|
|
3
3
|
import { ChevronRight as d, Check as h, Circle as l } from "lucide-react";
|
|
4
4
|
import * as s from "react";
|
|
5
|
-
import { c as o } from "./index-
|
|
5
|
+
import { c as o } from "./index-X6WZUM9O.js";
|
|
6
6
|
const R = t.Root, I = t.Trigger, S = t.Portal, C = t.Sub, m = s.forwardRef(({ className: e, inset: r, children: i, ...a }, n) => /* @__PURE__ */ x(
|
|
7
7
|
t.SubTrigger,
|
|
8
8
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const c=require("react/jsx-runtime"),w=require("@radix-ui/react-dropdown-menu"),d=require("lucide-react"),g=require("react"),a=require("./index-
|
|
1
|
+
"use strict";const c=require("react/jsx-runtime"),w=require("@radix-ui/react-dropdown-menu"),d=require("lucide-react"),g=require("react"),a=require("./index-Gi752TMk.cjs");function x(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const o=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(r,i,o.get?o:{enumerable:!0,get:()=>t[i]})}}return r.default=t,Object.freeze(r)}const e=x(w),n=x(g),y=e.Root,N=e.Trigger,D=e.Portal,M=e.Sub,h=n.forwardRef(({className:t,inset:r,children:i,...o},s)=>c.jsxs(e.SubTrigger,{ref:s,className:a.cn("richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-outline-none focus:richtext-bg-accent data-[state=open]:richtext-bg-accent",r&&"richtext-pl-8",t),...o,children:[i,c.jsx(d.ChevronRight,{className:"richtext-ml-auto richtext-size-4"})]}));h.displayName=e.SubTrigger.displayName;const l=n.forwardRef(({className:t,...r},i)=>c.jsx(e.SubContent,{"data-richtext-portal":!0,ref:i,className:a.cn("richtext-z-50 richtext-min-w-[8rem] richtext-overflow-hidden richtext-rounded-md !richtext-border !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-lg data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2",t),...r}));l.displayName=e.SubContent.displayName;const u=n.forwardRef(({className:t,sideOffset:r=4,...i},o)=>c.jsx(e.Portal,{"data-richtext-portal":!0,children:c.jsx(e.Content,{"data-richtext-portal":!0,ref:o,sideOffset:r,className:a.cn("richtext-z-50 richtext-min-w-[8rem] richtext-overflow-hidden richtext-rounded-md !richtext-border !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2",t),...i})}));u.displayName=e.Content.displayName;const p=n.forwardRef(({className:t,inset:r,...i},o)=>c.jsx(e.Item,{ref:o,className:a.cn("richtext-relative richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-outline-none richtext-transition-colors focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",r&&"richtext-pl-8",t),...i}));p.displayName=e.Item.displayName;const m=n.forwardRef(({className:t,children:r,checked:i,...o},s)=>c.jsxs(e.CheckboxItem,{checked:i,ref:s,className:a.cn("richtext-relative richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-outline-none richtext-transition-colors focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",t),...o,children:[c.jsx("span",{className:"richtext-absolute richtext-left-2 richtext-flex richtext-size-3.5 richtext-items-center richtext-justify-center",children:c.jsx(e.ItemIndicator,{children:c.jsx(d.Check,{className:"richtext-size-4"})})}),r]}));m.displayName=e.CheckboxItem.displayName;const j=n.forwardRef(({className:t,children:r,...i},o)=>c.jsxs(e.RadioItem,{ref:o,className:a.cn("richtext-relative richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-outline-none richtext-transition-colors focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",t),...i,children:[c.jsx("span",{className:"richtext-absolute richtext-left-2 richtext-flex richtext-size-3.5 richtext-items-center richtext-justify-center",children:c.jsx(e.ItemIndicator,{children:c.jsx(d.Circle,{className:"richtext-size-2 richtext-fill-current"})})}),r]}));j.displayName=e.RadioItem.displayName;const S=n.forwardRef(({className:t,inset:r,...i},o)=>c.jsx(e.Label,{ref:o,className:a.cn("richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-font-semibold",r&&"richtext-pl-8",t),...i}));S.displayName=e.Label.displayName;const f=n.forwardRef(({className:t,...r},i)=>c.jsx(e.Separator,{className:a.cn("richtext--mx-1 richtext-my-1 richtext-h-px richtext-bg-muted",t),ref:i,...r}));f.displayName=e.Separator.displayName;function b({className:t,...r}){return c.jsx("span",{className:a.cn("richtext-ml-auto richtext-text-xs richtext-tracking-widest richtext-opacity-60",t),...r})}b.displayName="DropdownMenuShortcut";exports.DropdownMenu=y;exports.DropdownMenuCheckboxItem=m;exports.DropdownMenuContent=u;exports.DropdownMenuItem=p;exports.DropdownMenuPortal=D;exports.DropdownMenuSeparator=f;exports.DropdownMenuShortcut=b;exports.DropdownMenuSub=M;exports.DropdownMenuSubContent=l;exports.DropdownMenuSubTrigger=h;exports.DropdownMenuTrigger=N;
|