reactjs-tiptap-editor 1.0.22 → 1.0.23
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-B1067mIC.js → ActionMenuButton-C53IYt_R.js} +1 -1
- package/lib/{ActionMenuButton-BBDqKvKg.cjs → ActionMenuButton-Da0H9Beu.cjs} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +2 -2
- 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-lBlBlK_w.cjs → Callout-CdXbDkZ6.cjs} +1 -1
- package/lib/{Callout-V2mO6s2Y.js → Callout-igc-a1lj.js} +2 -2
- 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-BeYo9jAG.cjs → Drawer-CrMuQNbZ.cjs} +1 -1
- package/lib/{Drawer-Cyv27orn.js → Drawer-DzroBQds.js} +2 -2
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +2 -2
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +3 -3
- 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 +4 -4
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +8 -8
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +4 -4
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +2 -2
- 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-Bx-VDxSB.cjs → Iframe-DVLx3H0m.cjs} +1 -1
- package/lib/{Iframe-D9JVKzO0.js → Iframe-Dt2Styg8.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 +45 -45
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +2 -2
- package/lib/{Indent-B5tQ5Wfg.js → Indent-BCZFJKcN.js} +1 -1
- package/lib/{Indent-CCLO0KpG.cjs → Indent-CQCn1r9U.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-w_c6vAMd.js → Katex--VT0zcjU.js} +3 -3
- package/lib/{Katex-rtfVV2pl.cjs → Katex-By61XteD.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 +3 -3
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +1 -1
- package/lib/{LinkEditBlock-_41zgSyl.cjs → LinkEditBlock-BLkA2CYZ.cjs} +1 -1
- package/lib/{LinkEditBlock-CTlU8YnO.js → LinkEditBlock-C_F9zWEj.js} +3 -3
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.js +10 -10
- 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 +3 -3
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +3 -3
- package/lib/{SlashCommandNodeView-CVKjpS6r.cjs → SlashCommandNodeView-Aqc77oRC.cjs} +1 -1
- package/lib/{SlashCommandNodeView-DNkpJuM3.js → SlashCommandNodeView-DxlBPKPV.js} +2 -2
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +1 -1
- package/lib/{Table-BFiU40iW.cjs → Table-DqXkwJAY.cjs} +1 -1
- package/lib/{Table-yZtD5Qo1.js → Table-r09L4PvT.js} +3 -3
- 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-CKm0M53B.js → Twitter-DP_9V0zb.js} +3 -3
- package/lib/{Twitter-BJjt8vv_.cjs → Twitter-f-oMDZuV.cjs} +1 -1
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +1 -1
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +2 -2
- package/lib/bubble.cjs +1 -1
- package/lib/bubble.js +15 -15
- package/lib/{dropdown-menu-Dre693DD.cjs → dropdown-menu-DeBV2h9-.cjs} +1 -1
- package/lib/{dropdown-menu-AhMKS9PQ.js → dropdown-menu-uIj8M0jD.js} +1 -1
- package/lib/{index-BfHAqkoX.js → index-BVtsbzV8.js} +1 -1
- package/lib/{index-C4aGVY2E.cjs → index-CWw4s87s.cjs} +1 -1
- package/lib/{index-83hp1lZH.cjs → index-ezTXvA7H.cjs} +1 -1
- package/lib/{index-DtVRewGA.js → index-oj858lQO.js} +229 -31
- package/lib/index.cjs +1 -1
- package/lib/index.js +1 -1
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.js +7 -6
- package/lib/locales/index.d.ts +199 -1
- package/lib/locales/ja.d.ts +198 -0
- package/lib/{popover-D7w_FVSV.cjs → popover-Cq1iLY7i.cjs} +1 -1
- package/lib/{popover-B1ptDngu.js → popover-mlZeH-7I.js} +1 -1
- package/lib/{separator-CDoF4Z4Z.js → separator-Bh_ttGZg.js} +3 -3
- package/lib/{separator-C_7KkuoG.cjs → separator-DvAvl5_5.cjs} +1 -1
- package/lib/{textarea-CEtXap1b.cjs → textarea-CKXzGwId.cjs} +1 -1
- package/lib/{textarea-CNzZnjjW.js → textarea-MU5imD7D.js} +1 -1
- package/package.json +1 -1
package/lib/bubble.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var vo=Object.create;var jn=Object.defineProperty;var So=Object.getOwnPropertyDescriptor;var Co=Object.getOwnPropertyNames;var ko=Object.getPrototypeOf,Eo=Object.prototype.hasOwnProperty;var _o=(e,t,n)=>t in e?jn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var To=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Co(t))!Eo.call(e,s)&&s!==n&&jn(e,s,{get:()=>t[s],enumerable:!(i=So(t,s))||i.enumerable});return e};var Ao=(e,t,n)=>(n=e!=null?vo(ko(e)):{},To(t||!e||!e.__esModule?jn(n,"default",{value:e,enumerable:!0}):n,e));var Ne=(e,t,n)=>_o(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),T=require("./index-C4WLt4NA.cjs"),H=require("./index-TcJ2UKnv.cjs"),W=require("@tiptap/pm/state"),Bs=require("./Table-BFiU40iW.cjs"),Ls=require("./clsx-DSAWW32g.cjs"),b=require("react"),Us=require("react-dom"),m=require("./index-83hp1lZH.cjs"),St=require("./Callout-lBlBlK_w.cjs"),ut=require("./Katex-rtfVV2pl.cjs"),B=require("./index-C4aGVY2E.cjs"),Ut=require("lucide-react"),Rn=require("./CodeBlock.cjs"),bt=require("./separator-C_7KkuoG.cjs"),kt=require("./popover-D7w_FVSV.cjs"),Wi=require("./Column.cjs");require("./theme.cjs");const Fe=require("./Drawer-BeYo9jAG.cjs"),Gi=require("easydrawer"),Je=require("./shortId-Bfj8TyNr.cjs"),ue=require("./Excalidraw.cjs"),Wt=require("./Iframe-Bx-VDxSB.cjs"),Io=require("./ImageGif.cjs"),Do=require("katex"),Zn=require("./textarea-CEtXap1b.cjs"),Ve=require("./LinkEditBlock-_41zgSyl.cjs"),Nn=require("@tiptap/pm/view"),Mo=require("@tiptap/pm/model"),Oo=require("./Clear.cjs"),de=require("./Indent-CCLO0KpG.cjs"),Ps=require("./TextAlign.cjs"),U=require("./dropdown-menu-Dre693DD.cjs"),Qn=require("./Mermaid.cjs"),jo=require("./Bold.cjs"),Ro=require("./Code.cjs");require("./index-DlxZt4_j.cjs");const No=require("./Color.cjs"),Bo=require("./Highlight.cjs"),Lo=require("./Italic.cjs"),Uo=require("./SlashCommandNodeView-CVKjpS6r.cjs"),Po=require("./Strike.cjs"),$o=require("./TextUnderline.cjs"),Bn=require("./Twitter-BJjt8vv_.cjs");function Fo(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 Vo=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),k=this.element.contains(document.activeElement);return!(!(h.hasFocus()||k)||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.updatePosition(),this.show()},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)};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(H.flip(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(H.shift(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(H.offset(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(H.arrow(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(H.size(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(H.autoPlacement(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(H.hide(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(H.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 W.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 Bs.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():Fo(h.getBoundingClientRect(),f.getBoundingClientRect());o={getBoundingClientRect:()=>p,getClientRects:()=>[p]}}return o}updatePosition(){const e=this.virtualElement;e&&H.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((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 W.Plugin({key:typeof e.pluginKey=="string"?new W.PluginKey(e.pluginKey):e.pluginKey,view:t=>new Vo({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 Ho=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)},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(H.flip(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(H.shift(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(H.offset(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(H.arrow(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(H.size(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(H.autoPlacement(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(H.hide(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(H.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(){const{selection:e}=this.editor.state,t=T.posToDOMRect(this.view,e.from,e.to),n={getBoundingClientRect:()=>t,getClientRects:()=>[t]};H.computePosition(n,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:i,y:s,strategy:r,middlewareData:o})=>{var l,c;if((l=o.hide)!=null&&l.referenceHidden||(c=o.hide)!=null&&c.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=r,this.element.style.left=`${i}px`,this.element.style.top=`${s}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 W.Plugin({key:typeof e.pluginKey=="string"?new W.PluginKey(e.pluginKey):e.pluginKey,view:t=>new Ho({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 W.PluginKey(t)}var zo=typeof window<"u"?b.useLayoutEffect:b.useEffect,Hs=new Set(["left","opacity","position","top","visibility","width"]),Ko=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"]),qo=new Set(["children","className","style"]),Wo=new Set(["tabIndex"]),Go=new Set(["accessKey","autoCapitalize","contentEditable","contextMenu","dir","draggable","enterKeyHint","hidden","id","lang","nonce","role","slot","spellCheck","tabIndex","title","translate"]),Yo={Blur:"focusout",DoubleClick:"dblclick",Focus:"focusin",MouseEnter:"mouseenter",MouseLeave:"mouseleave"};function ti(e,t){return/^on[A-Z]/.test(e)&&typeof t=="function"}function Jo(e){return e.startsWith("aria-")||e.startsWith("data-"),e}function Xo(e){return e.startsWith("aria-")||e.startsWith("data-")||Go.has(e)}function zs(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Zo(e){var t;const n=e.endsWith("Capture"),s=(n?e.slice(0,-7):e).slice(2);return{eventName:(t=Yo[s])!=null?t:s.toLowerCase(),options:n?{capture:!0}:void 0}}function Qo(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 Wo.has(e)}function Yi(e,t,n){if(t==="tabIndex"){e.tabIndex=Number(n);return}e[t]=n}function tl(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 el(e,t){return typeof t!="number"||t===0||e.startsWith("--")||Ko.has(e)?String(t):`${t}px`}function nl(e,t){Hs.has(t)||e.style.removeProperty(zs(t))}function il(e,t,n){Hs.has(t)||e.style.setProperty(zs(t),el(t,n))}function sl(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(s=>{if(qo.has(s)||!Xo(s)||ti(s,t[s])||ti(s,n[s]))return;const r=t[s],o=n[s];if(r===o)return;const l=Jo(s);if(o==null||o===!1){Ln(s)&&tl(e,s),e.removeAttribute(l);return}if(o===!0){Ln(s)&&Yi(e,s,!0),e.setAttribute(l,"");return}if(Ln(s)){Yi(e,s,o);return}e.setAttribute(l,String(o))})}function rl(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute("class")}}function ol(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){nl(e,o);return}il(e,o,c)}})}function ll(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}=Zo(s),c=a=>{r(Qo(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([]);zo(()=>{const s=n.current;return rl(e,s.className,t.className),ol(e,s.style,t.style),sl(e,s,t),i.current=ll(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 et=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}=Ls.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),k=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 L=$s({...w.current,editor:g,element:D});g.registerPlugin(L);const v=w.current.pluginKey;return k.current=!0,C(!0),()=>{C(!1),g.unregisterPlugin(v),window.requestAnimationFrame(()=>{D.parentNode&&D.parentNode.removeChild(D)})}},[g]),b.useEffect(()=>{if(!(!y||!g||g.isDestroyed)){if(k.current){k.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]),Us.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}=Ls.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 k=u.current;k.style.visibility="hidden",k.style.position="absolute";const D=Fs({...x.current,editor:p,element:k});p.registerPlugin(D);const L=x.current.pluginKey;return C.current=!0,y(!0),()=>{y(!1),p.unregisterPlugin(L),window.requestAnimationFrame(()=>{k.parentNode&&k.parentNode.removeChild(k)})}},[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]),Us.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 cl=[{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 al(){const e=m.useEditableEditor(),t=m.useEditorInstance(),{t:n}=B.useLocale(),{type:i,title:s,body:r}=ut.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(et,{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:cl.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 hl(){const e=m.useEditableEditor(),t=m.useEditorInstance(),{t:n}=B.useLocale(),i=b.useCallback(()=>t.isActive(Wi.MultipleColumnNode.name),[t]),s=b.useCallback(()=>Ht(Wi.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(et,{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 ul(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 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.updateImageGif({width:B.IMAGE_SIZE[s]}),isActive:()=>e.isActive("image",{width:B.IMAGE_SIZE[s]})}}))}function fl(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 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.setAlignImageGif)==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.setAlignImageMermaid)==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.setAlignImageDrawer)==null?void 0:o.call(r,s)},isActive:()=>e.isActive({align:s})||!1,disabled:!1}}))}function xl(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 bl(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 wl(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()}}},...ul(e,t),...fl(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 yl(e,t){return[...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[...gl(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 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[...bl(e,t),...xl(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 kl({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 S=document.querySelector("#easydrawer");S&&(r.current=new Gi.Editor(S,{wheelEventsEnabled:!1,disableZoom:!0}),o.current=Gi.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 v=r.current.toSVG(),S=v.outerHTML,A=`drawer-${Je.shortId()}.svg`;let z=Je.i(v.outerHTML);if(a){const N=m.dataURLtoFile(z,A);z=await a(N)}e==null||e.chain().focus().setDrawer({type:"drawer",src:z,alt:encodeURIComponent(S),width:426,height:212},!!S).run(),e==null||e.commands.setAlignImageDrawer(c)}s(!1)},f=v=>{const S=r.current.toolController.getPrimaryTools()[2],A=o.current.getWidgetById("pen-1");S&&A&&(S.setColor(v),A.serializeState())},p=v=>{const S=r.current.toolController.getPrimaryTools()[2],A=o.current.getWidgetById("pen-1");S&&A&&(S.setThickness(v),A.serializeState())},g=v=>{const S=r.current.toolController.getPrimaryTools()[3],A=o.current.getWidgetById("pen-2");S&&A&&(S.setColor(v),A.serializeState())},x=v=>{const S=o.current.getWidgetById("shape");S&&S.setShapeType(v)},w=v=>{const S=r.current.toolController.getPrimaryTools()[5],A=o.current.getWidgetById("shape");S&&A&&(S.setColor(v),A.serializeState())},y=v=>{const S=r.current.toolController.getPrimaryTools()[5],A=o.current.getWidgetById("shape");S&&A&&(S.setThickness(v),A.serializeState())},C=v=>{const S=r.current.toolController.getPrimaryTools()[5],A=o.current.getWidgetById("shape");S&&A&&(S.setBorderColor(v),A.serializeState())},k=()=>{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()},L=()=>{if(!fe){for(;r.current.history.undoStackSize>0;)k();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:L,onRedo:D,onThicknessChange:y,onUndo:k,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 El({item:e,disabled:t,editor:n}){var s;const i=e.component;return i?d.jsx(b.Fragment,{children:e.type==="divider"?d.jsx(bt.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 _l(){const{lang:e,t}=B.useLocale(),n=m.useEditableEditor(),i=m.useEditorInstance(),s=ut.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(()=>Sl(i,t),[i,e,t]);return n?d.jsx(et,{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(kl,{attrs:s,editor:i,extension:r},`bubbleMenu-drawer-${a}`):d.jsx(El,{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 Tl(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}=Tl(t),s=ut.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(et,{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}=ut.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(et,{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 Dl({children:e,visible:t,toggleVisible:n}){const{t:i}=B.useLocale(),s=m.useEditorInstance(),r=ut.useAttributes(s,ut.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 Do.renderToString(c,{macros:ut.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 Ml(){const e=m.useEditableEditor(),t=m.useEditorInstance(),[n,i]=b.useState(!1),s=b.useCallback(()=>t.isActive(ut.Katex.name),[t]),r=b.useCallback(()=>Ht(ut.Katex.name,t),[t]);return e?d.jsx(et,{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(Dl,{toggleVisible:i,visible:n,children:d.jsx(m.ActionButton,{action:()=>i(!n),tooltip:"Edit",children:d.jsx(Ut.Pencil,{size:16})})}),d.jsx(m.ActionButton,{action:r,tooltip:"Delete",children:d.jsx(Ut.Trash2,{size:16})})]})}):d.jsx(d.Fragment,{})}function Ol(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 jl(){const e=m.useEditableEditor(),t=m.useEditorInstance(),[n,i]=b.useState(!1),s=ut.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(et,{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(Ol,{editor:t,link:r,onClear:c,onEdit:()=>{i(!0)}})})})}):d.jsx(d.Fragment,{})}function wi({item:e,disabled:t,editor:n}){const i=e.component;return i?d.jsx(b.Fragment,{children:e.type==="divider"?d.jsx(bt.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 Rl(e){return e.type.name===m.Image.name}function Nl(e){return e.type.name===Io.ImageGif.name}function Bl(e){return e.type.name===m.Video.name}function Ll(){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(Rl(h))return u=!0,!1}),u},r=b.useMemo(()=>wl(i,t),[i,e,t]);return n?d.jsx(et,{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(wi,{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(Nl(h))return u=!0,!1}),u},r=b.useMemo(()=>yl(i,t),[i,t,e]);return n?d.jsx(et,{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(wi,{editor:i,item:o},`bubbleMenu-image-gif-${l}`))}):d.jsx(d.Fragment,{})}):d.jsx(d.Fragment,{})}function Pl(){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(Bl(u))return a=!0,!1}),a},s=b.useMemo(()=>Cl(n,e),[n,e]);return t?d.jsx(et,{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(wi,{editor:n,item:r},`bubbleMenu-video-${o}`))}):d.jsx(d.Fragment,{})}):d.jsx(d.Fragment,{})}const Ji=`graph TB
|
|
1
|
+
"use strict";var vo=Object.create;var jn=Object.defineProperty;var So=Object.getOwnPropertyDescriptor;var Co=Object.getOwnPropertyNames;var ko=Object.getPrototypeOf,Eo=Object.prototype.hasOwnProperty;var _o=(e,t,n)=>t in e?jn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var To=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Co(t))!Eo.call(e,s)&&s!==n&&jn(e,s,{get:()=>t[s],enumerable:!(i=So(t,s))||i.enumerable});return e};var Ao=(e,t,n)=>(n=e!=null?vo(ko(e)):{},To(t||!e||!e.__esModule?jn(n,"default",{value:e,enumerable:!0}):n,e));var Ne=(e,t,n)=>_o(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),T=require("./index-C4WLt4NA.cjs"),H=require("./index-TcJ2UKnv.cjs"),W=require("@tiptap/pm/state"),Bs=require("./Table-DqXkwJAY.cjs"),Ls=require("./clsx-DSAWW32g.cjs"),b=require("react"),Us=require("react-dom"),m=require("./index-ezTXvA7H.cjs"),St=require("./Callout-CdXbDkZ6.cjs"),ut=require("./Katex-By61XteD.cjs"),B=require("./index-CWw4s87s.cjs"),Ut=require("lucide-react"),Rn=require("./CodeBlock.cjs"),bt=require("./separator-DvAvl5_5.cjs"),kt=require("./popover-Cq1iLY7i.cjs"),Wi=require("./Column.cjs");require("./theme.cjs");const Fe=require("./Drawer-CrMuQNbZ.cjs"),Gi=require("easydrawer"),Je=require("./shortId-Bfj8TyNr.cjs"),ue=require("./Excalidraw.cjs"),Wt=require("./Iframe-DVLx3H0m.cjs"),Io=require("./ImageGif.cjs"),Do=require("katex"),Zn=require("./textarea-CKXzGwId.cjs"),Ve=require("./LinkEditBlock-BLkA2CYZ.cjs"),Nn=require("@tiptap/pm/view"),Mo=require("@tiptap/pm/model"),Oo=require("./Clear.cjs"),de=require("./Indent-CQCn1r9U.cjs"),Ps=require("./TextAlign.cjs"),U=require("./dropdown-menu-DeBV2h9-.cjs"),Qn=require("./Mermaid.cjs"),jo=require("./Bold.cjs"),Ro=require("./Code.cjs");require("./index-DlxZt4_j.cjs");const No=require("./Color.cjs"),Bo=require("./Highlight.cjs"),Lo=require("./Italic.cjs"),Uo=require("./SlashCommandNodeView-Aqc77oRC.cjs"),Po=require("./Strike.cjs"),$o=require("./TextUnderline.cjs"),Bn=require("./Twitter-f-oMDZuV.cjs");function Fo(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 Vo=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),k=this.element.contains(document.activeElement);return!(!(h.hasFocus()||k)||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.updatePosition(),this.show()},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)};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(H.flip(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(H.shift(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(H.offset(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(H.arrow(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(H.size(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(H.autoPlacement(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(H.hide(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(H.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 W.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 Bs.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():Fo(h.getBoundingClientRect(),f.getBoundingClientRect());o={getBoundingClientRect:()=>p,getClientRects:()=>[p]}}return o}updatePosition(){const e=this.virtualElement;e&&H.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((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 W.Plugin({key:typeof e.pluginKey=="string"?new W.PluginKey(e.pluginKey):e.pluginKey,view:t=>new Vo({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 Ho=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)},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(H.flip(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(H.shift(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(H.offset(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(H.arrow(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(H.size(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(H.autoPlacement(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(H.hide(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(H.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(){const{selection:e}=this.editor.state,t=T.posToDOMRect(this.view,e.from,e.to),n={getBoundingClientRect:()=>t,getClientRects:()=>[t]};H.computePosition(n,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:i,y:s,strategy:r,middlewareData:o})=>{var l,c;if((l=o.hide)!=null&&l.referenceHidden||(c=o.hide)!=null&&c.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=r,this.element.style.left=`${i}px`,this.element.style.top=`${s}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 W.Plugin({key:typeof e.pluginKey=="string"?new W.PluginKey(e.pluginKey):e.pluginKey,view:t=>new Ho({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 W.PluginKey(t)}var zo=typeof window<"u"?b.useLayoutEffect:b.useEffect,Hs=new Set(["left","opacity","position","top","visibility","width"]),Ko=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"]),qo=new Set(["children","className","style"]),Wo=new Set(["tabIndex"]),Go=new Set(["accessKey","autoCapitalize","contentEditable","contextMenu","dir","draggable","enterKeyHint","hidden","id","lang","nonce","role","slot","spellCheck","tabIndex","title","translate"]),Yo={Blur:"focusout",DoubleClick:"dblclick",Focus:"focusin",MouseEnter:"mouseenter",MouseLeave:"mouseleave"};function ti(e,t){return/^on[A-Z]/.test(e)&&typeof t=="function"}function Jo(e){return e.startsWith("aria-")||e.startsWith("data-"),e}function Xo(e){return e.startsWith("aria-")||e.startsWith("data-")||Go.has(e)}function zs(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Zo(e){var t;const n=e.endsWith("Capture"),s=(n?e.slice(0,-7):e).slice(2);return{eventName:(t=Yo[s])!=null?t:s.toLowerCase(),options:n?{capture:!0}:void 0}}function Qo(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 Wo.has(e)}function Yi(e,t,n){if(t==="tabIndex"){e.tabIndex=Number(n);return}e[t]=n}function tl(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 el(e,t){return typeof t!="number"||t===0||e.startsWith("--")||Ko.has(e)?String(t):`${t}px`}function nl(e,t){Hs.has(t)||e.style.removeProperty(zs(t))}function il(e,t,n){Hs.has(t)||e.style.setProperty(zs(t),el(t,n))}function sl(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(s=>{if(qo.has(s)||!Xo(s)||ti(s,t[s])||ti(s,n[s]))return;const r=t[s],o=n[s];if(r===o)return;const l=Jo(s);if(o==null||o===!1){Ln(s)&&tl(e,s),e.removeAttribute(l);return}if(o===!0){Ln(s)&&Yi(e,s,!0),e.setAttribute(l,"");return}if(Ln(s)){Yi(e,s,o);return}e.setAttribute(l,String(o))})}function rl(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute("class")}}function ol(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){nl(e,o);return}il(e,o,c)}})}function ll(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}=Zo(s),c=a=>{r(Qo(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([]);zo(()=>{const s=n.current;return rl(e,s.className,t.className),ol(e,s.style,t.style),sl(e,s,t),i.current=ll(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 et=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}=Ls.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),k=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 L=$s({...w.current,editor:g,element:D});g.registerPlugin(L);const v=w.current.pluginKey;return k.current=!0,C(!0),()=>{C(!1),g.unregisterPlugin(v),window.requestAnimationFrame(()=>{D.parentNode&&D.parentNode.removeChild(D)})}},[g]),b.useEffect(()=>{if(!(!y||!g||g.isDestroyed)){if(k.current){k.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]),Us.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}=Ls.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 k=u.current;k.style.visibility="hidden",k.style.position="absolute";const D=Fs({...x.current,editor:p,element:k});p.registerPlugin(D);const L=x.current.pluginKey;return C.current=!0,y(!0),()=>{y(!1),p.unregisterPlugin(L),window.requestAnimationFrame(()=>{k.parentNode&&k.parentNode.removeChild(k)})}},[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]),Us.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 cl=[{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 al(){const e=m.useEditableEditor(),t=m.useEditorInstance(),{t:n}=B.useLocale(),{type:i,title:s,body:r}=ut.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(et,{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:cl.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 hl(){const e=m.useEditableEditor(),t=m.useEditorInstance(),{t:n}=B.useLocale(),i=b.useCallback(()=>t.isActive(Wi.MultipleColumnNode.name),[t]),s=b.useCallback(()=>Ht(Wi.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(et,{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 ul(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 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.updateImageGif({width:B.IMAGE_SIZE[s]}),isActive:()=>e.isActive("image",{width:B.IMAGE_SIZE[s]})}}))}function fl(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 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.setAlignImageGif)==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.setAlignImageMermaid)==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.setAlignImageDrawer)==null?void 0:o.call(r,s)},isActive:()=>e.isActive({align:s})||!1,disabled:!1}}))}function xl(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 bl(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 wl(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()}}},...ul(e,t),...fl(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 yl(e,t){return[...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[...gl(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 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[...bl(e,t),...xl(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 kl({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 S=document.querySelector("#easydrawer");S&&(r.current=new Gi.Editor(S,{wheelEventsEnabled:!1,disableZoom:!0}),o.current=Gi.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 v=r.current.toSVG(),S=v.outerHTML,A=`drawer-${Je.shortId()}.svg`;let z=Je.i(v.outerHTML);if(a){const N=m.dataURLtoFile(z,A);z=await a(N)}e==null||e.chain().focus().setDrawer({type:"drawer",src:z,alt:encodeURIComponent(S),width:426,height:212},!!S).run(),e==null||e.commands.setAlignImageDrawer(c)}s(!1)},f=v=>{const S=r.current.toolController.getPrimaryTools()[2],A=o.current.getWidgetById("pen-1");S&&A&&(S.setColor(v),A.serializeState())},p=v=>{const S=r.current.toolController.getPrimaryTools()[2],A=o.current.getWidgetById("pen-1");S&&A&&(S.setThickness(v),A.serializeState())},g=v=>{const S=r.current.toolController.getPrimaryTools()[3],A=o.current.getWidgetById("pen-2");S&&A&&(S.setColor(v),A.serializeState())},x=v=>{const S=o.current.getWidgetById("shape");S&&S.setShapeType(v)},w=v=>{const S=r.current.toolController.getPrimaryTools()[5],A=o.current.getWidgetById("shape");S&&A&&(S.setColor(v),A.serializeState())},y=v=>{const S=r.current.toolController.getPrimaryTools()[5],A=o.current.getWidgetById("shape");S&&A&&(S.setThickness(v),A.serializeState())},C=v=>{const S=r.current.toolController.getPrimaryTools()[5],A=o.current.getWidgetById("shape");S&&A&&(S.setBorderColor(v),A.serializeState())},k=()=>{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()},L=()=>{if(!fe){for(;r.current.history.undoStackSize>0;)k();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:L,onRedo:D,onThicknessChange:y,onUndo:k,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 El({item:e,disabled:t,editor:n}){var s;const i=e.component;return i?d.jsx(b.Fragment,{children:e.type==="divider"?d.jsx(bt.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 _l(){const{lang:e,t}=B.useLocale(),n=m.useEditableEditor(),i=m.useEditorInstance(),s=ut.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(()=>Sl(i,t),[i,e,t]);return n?d.jsx(et,{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(kl,{attrs:s,editor:i,extension:r},`bubbleMenu-drawer-${a}`):d.jsx(El,{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 Tl(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}=Tl(t),s=ut.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(et,{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}=ut.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(et,{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 Dl({children:e,visible:t,toggleVisible:n}){const{t:i}=B.useLocale(),s=m.useEditorInstance(),r=ut.useAttributes(s,ut.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 Do.renderToString(c,{macros:ut.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 Ml(){const e=m.useEditableEditor(),t=m.useEditorInstance(),[n,i]=b.useState(!1),s=b.useCallback(()=>t.isActive(ut.Katex.name),[t]),r=b.useCallback(()=>Ht(ut.Katex.name,t),[t]);return e?d.jsx(et,{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(Dl,{toggleVisible:i,visible:n,children:d.jsx(m.ActionButton,{action:()=>i(!n),tooltip:"Edit",children:d.jsx(Ut.Pencil,{size:16})})}),d.jsx(m.ActionButton,{action:r,tooltip:"Delete",children:d.jsx(Ut.Trash2,{size:16})})]})}):d.jsx(d.Fragment,{})}function Ol(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 jl(){const e=m.useEditableEditor(),t=m.useEditorInstance(),[n,i]=b.useState(!1),s=ut.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(et,{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(Ol,{editor:t,link:r,onClear:c,onEdit:()=>{i(!0)}})})})}):d.jsx(d.Fragment,{})}function wi({item:e,disabled:t,editor:n}){const i=e.component;return i?d.jsx(b.Fragment,{children:e.type==="divider"?d.jsx(bt.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 Rl(e){return e.type.name===m.Image.name}function Nl(e){return e.type.name===Io.ImageGif.name}function Bl(e){return e.type.name===m.Video.name}function Ll(){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(Rl(h))return u=!0,!1}),u},r=b.useMemo(()=>wl(i,t),[i,e,t]);return n?d.jsx(et,{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(wi,{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(Nl(h))return u=!0,!1}),u},r=b.useMemo(()=>yl(i,t),[i,t,e]);return n?d.jsx(et,{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(wi,{editor:i,item:o},`bubbleMenu-image-gif-${l}`))}):d.jsx(d.Fragment,{})}):d.jsx(d.Fragment,{})}function Pl(){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(Bl(u))return a=!0,!1}),a},s=b.useMemo(()=>Cl(n,e),[n,e]);return t?d.jsx(et,{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(wi,{editor:n,item:r},`bubbleMenu-video-${o}`))}):d.jsx(d.Fragment,{})}):d.jsx(d.Fragment,{})}const Ji=`graph TB
|
|
2
2
|
a-->b`,$l=({editor:e,attrs:t,extension:n})=>{const{alt:i,align:s}=t,[r,o]=b.useState(decodeURIComponent(i??Ji)),[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(k=>{k&&import("mermaid").then(D=>{p(D.default)})},[]),w=async k=>{try{const{svg:D}=await f.render("mermaid-svg",k);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 k=h.current.querySelector("svg"),{width:D,height:L}=k.getBoundingClientRect(),v=`mermaid-${Je.shortId()}.svg`;let S=Je.i(k.outerHTML);if(g){const A=m.dataURLtoFile(S,v);S=await g(A)}e==null||e.chain().focus().setMermaid({type:"mermaid",src:S,alt:encodeURIComponent(r),width:D,height:L},!!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:Ji,onChange:k=>o(k.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 Fl({item:e,disabled:t,editor:n}){var s;const i=e.component;return i?d.jsx(b.Fragment,{children:e.type==="divider"?d.jsx(bt.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 Vl(e){return e.type.name===Qn.Mermaid.name}function Hl(){const{lang:e,t}=B.useLocale(),n=m.useEditableEditor(),i=m.useEditorInstance(),s=ut.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(Vl(p))return f=!0,!1}),f},l=b.useMemo(()=>vl(i,t),[i,e,t]);return n?d.jsx(et,{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($l,{attrs:s,editor:i,extension:r},`bubbleMenu-mermaid-${a}`):d.jsx(Fl,{editor:i,item:c},`bubbleMenu-mermaid-${a}`))}):d.jsx(d.Fragment,{})}):d.jsx(d.Fragment,{})}function zl({hiddenActions:e=[]}){var x,w,y,C,k,D,L,v,S,A,z,N,$,Y,st,E,vt,Re;const{t}=B.useLocale(),n=m.useEditableEditor(),i=m.useEditorInstance(),s=({editor:qt})=>T.isActive(qt.view.state,Bs.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(et,{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:(k=i.can()).deleteColumn)!=null&&D.call(k)),icon:"DeleteColumn",tooltip:t("editor.table.menu.deleteColumn"),tooltipOptions:{sideOffset:15}}),d.jsx(bt.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),!r("addRowAbove")&&d.jsx(m.ActionButton,{action:a,disabled:!((v=i==null?void 0:(L=i.can()).addRowBefore)!=null&&v.call(L)),icon:"BetweenVerticalEnd",tooltip:t("editor.table.menu.insertRowAbove"),tooltipOptions:{sideOffset:15}}),!r("addRowBelow")&&d.jsx(m.ActionButton,{action:u,disabled:!((A=(S=i==null?void 0:i.can())==null?void 0:S.addRowAfter)!=null&&A.call(S)),icon:"BetweenVerticalStart",tooltip:t("editor.table.menu.insertRowBelow"),tooltipOptions:{sideOffset:15}}),!r("deleteRow")&&d.jsx(m.ActionButton,{action:h,disabled:!((N=(z=i==null?void 0:i.can())==null?void 0:z.deleteRow)!=null&&N.call(z)),icon:"DeleteRow",tooltip:t("editor.table.menu.deleteRow"),tooltipOptions:{sideOffset:15}}),d.jsx(bt.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),!r("mergeCells")&&d.jsx(m.ActionButton,{action:f,disabled:!((Y=($=i==null?void 0:i.can())==null?void 0:$.mergeCells)!=null&&Y.call($)),icon:"TableCellsMerge",tooltip:t("editor.table.menu.mergeCells"),tooltipOptions:{sideOffset:15}}),!r("splitCells")&&d.jsx(m.ActionButton,{action:p,disabled:!((E=(st=i==null?void 0:i.can())==null?void 0:st.splitCell)!=null&&E.call(st)),icon:"TableCellsSplit",tooltip:t("editor.table.menu.splitCells"),tooltipOptions:{sideOffset:15}}),d.jsx(bt.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),!r("deleteTable")&&d.jsx(m.ActionButton,{action:g,disabled:!((Re=(vt=i==null?void 0:i.can())==null?void 0:vt.deleteTable)!=null&&Re.call(vt)),icon:"Trash2",tooltip:t("editor.table.menu.deleteTable"),tooltipOptions:{sideOffset:15}})]})}):d.jsx(d.Fragment,{})}function Kl(){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(Ut.Check,{size:16}),!r&&o.label===e("editor.paragraph.tooltip")&&!l&&d.jsx(Ut.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 ql(){return d.jsxs(d.Fragment,{children:[d.jsx(Kl,{}),d.jsx(bt.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),d.jsx(jo.RichTextBold,{}),d.jsx(Lo.RichTextItalic,{}),d.jsx($o.RichTextUnderline,{}),d.jsx(Po.RichTextStrike,{}),d.jsx(Ro.RichTextCode,{}),d.jsx(Ve.RichTextLink,{}),d.jsx(bt.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),d.jsx(No.RichTextColor,{}),d.jsx(Bo.RichTextHighlight,{}),d.jsx(Ps.RichTextAlign,{})]})}function Wl({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 W.TextSelection};return n?d.jsx(et,{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(ql,{})})}):d.jsx(d.Fragment,{})}function Gl(){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(et,{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 dt=()=>new Map,ei=e=>{const t=dt();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},Yl=(e,t)=>{const n=[];for(const[i,s]of e)n.push(t(s,i));return n},Jl=(e,t)=>{for(const[n,i]of e)if(t(i,n))return!0;return!1},Pt=()=>new Set,Un=e=>e[e.length-1],Xl=(e,t)=>{for(let n=0;n<t.length;n++)e.push(t[n])},$t=Array.from,yi=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},vi=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},Zl=(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=dt()}on(t,n){return Tt(this._observers,t,Pt).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)||dt()).values()).forEach(i=>i(...n))}destroy(){this._observers=dt()}}const ft=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,Xi=1,Zi=2,Pn=4,$n=8,xe=32,Et=64,tt=128,Ql=1<<29,mn=31,ni=63,Lt=127,tc=2147483647,Xe=Number.MAX_SAFE_INTEGER,Qi=Number.MIN_SAFE_INTEGER,ec=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&ft(e)===e),Ys=String.fromCharCode,nc=e=>e.toLowerCase(),ic=/^\s*/g,sc=e=>e.replace(ic,""),rc=/([A-Z])/g,ts=(e,t)=>sc(e.replace(rc,n=>`${t}${nc(n)}`)),oc=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,lc=e=>be.encode(e),cc=be?lc:oc;let ge=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});ge&&ge.decode(new Uint8Array).length===1&&(ge=null);const ac=(e,t)=>Zl(t,()=>e).join("");class Ie{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const De=()=>new Ie,hc=e=>{const t=De();return e(t),ht(t)},uc=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},ht=e=>{const t=new Uint8Array(uc(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},dc=(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)},K=(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=K,I=(e,t)=>{for(;t>Lt;)K(e,tt|Lt&t),t=ft(t/128);K(e,Lt&t)},Si=(e,t)=>{const n=Gs(t);for(n&&(t=-t),K(e,(t>ni?tt:0)|(n?Et:0)|ni&t),t=ft(t/64);t>0;)K(e,(t>Lt?tt:0)|Lt&t),t=ft(t/128)},si=new Uint8Array(3e4),fc=si.length/3,pc=(e,t)=>{if(t.length<fc){const n=be.encodeInto(t,si).written||0;I(e,n);for(let i=0;i<n;i++)K(e,si[i])}else rt(e,cc(t))},gc=(e,t)=>{const n=unescape(encodeURIComponent(t)),i=n.length;I(e,i);for(let s=0;s<i;s++)K(e,n.codePointAt(s))},Yt=be&&be.encodeInto?pc:gc,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)},rt=(e,t)=>{I(e,t.byteLength),xn(e,t)},Ci=(e,t)=>{dc(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},mc=(e,t)=>Ci(e,4).setFloat32(0,t,!1),xc=(e,t)=>Ci(e,8).setFloat64(0,t,!1),bc=(e,t)=>Ci(e,8).setBigInt64(0,t,!1),es=new DataView(new ArrayBuffer(4)),wc=e=>(es.setFloat32(0,e),es.getFloat32(0)===e),ne=(e,t)=>{switch(typeof t){case"string":K(e,119),Yt(e,t);break;case"number":ec(t)&&He(t)<=tc?(K(e,125),Si(e,t)):wc(t)?(K(e,124),mc(e,t)):(K(e,123),xc(e,t));break;case"bigint":K(e,122),bc(e,t);break;case"object":if(t===null)K(e,126);else if(te(t)){K(e,117),I(e,t.length);for(let n=0;n<t.length;n++)ne(e,t[n])}else if(t instanceof Uint8Array)K(e,116),rt(e,t);else{K(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":K(e,t?120:121);break;default:K(e,127)}};class ns extends Ie{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 is=e=>{e.count>0&&(Si(e.encoder,e.count===1?e.s:-e.s),e.count>1&&I(e.encoder,e.count-2))};class ze{constructor(){this.encoder=new Ie,this.s=0,this.count=0}write(t){this.s===t?this.count++:(is(this),this.count=1,this.s=t)}toUint8Array(){return is(this),ht(this.encoder)}}const ss=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);Si(e.encoder,t),e.count>1&&I(e.encoder,e.count-2)}};class Fn{constructor(){this.encoder=new Ie,this.s=0,this.count=0,this.diff=0}write(t){this.diff===t-this.s?(this.s=t,this.count++):(ss(this),this.count=1,this.diff=t-this.s,this.s=t)}toUint8Array(){return ss(this),ht(this.encoder)}}class yc{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 Ie;return this.sarr.push(this.s),this.s="",Yt(t,this.sarr.join("")),xn(t,this.lensE.toUint8Array()),ht(t)}}const yt=e=>new Error(e),ct=()=>{throw yt("Method unimplemented")},Z=()=>{throw yt("Unexpected case")},Js=yt("Unexpected end of array"),Xs=yt("Integer out of Range");class bn{constructor(t){this.arr=t,this.pos=0}}const ki=e=>new bn(e),vc=e=>e.pos!==e.arr.length,Sc=(e,t)=>{const n=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n},ot=e=>Sc(e,j(e)),we=e=>e.arr[e.pos++],j=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},Ei=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},Cc=e=>{let t=j(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))}},kc=e=>ge.decode(ot(e)),ri=ge?kc:Cc,_i=(e,t)=>{const n=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,n},Ec=e=>_i(e,4).getFloat32(0,!1),_c=e=>_i(e,8).getFloat64(0,!1),Tc=e=>_i(e,8).getBigInt64(0,!1),Ac=[e=>{},e=>null,Ei,Ec,_c,Tc,e=>!1,e=>!0,ri,e=>{const t=j(e),n={};for(let i=0;i<t;i++){const s=ri(e);n[s]=Ze(e)}return n},e=>{const t=j(e),n=[];for(let i=0;i<t;i++)n.push(Ze(e));return n},ot],Ze=e=>Ac[127-we(e)](e);class rs 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),vc(this)?this.count=j(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=Ei(this);const t=Gs(this.s);this.count=1,t&&(this.s=-this.s,this.count=j(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=Ei(this),n=t&1;this.diff=ft(t/2),this.count=1,n&&(this.count=j(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 Dc=crypto.getRandomValues.bind(crypto),Mc=Math.random,Zs=()=>Dc(new Uint32Array(1))[0],Oc=e=>e[ft(Mc()*e.length)],jc="10000000-1000-4000-8000"+-1e11,Rc=()=>jc.replace(/[018]/g,e=>(e^Zs()&15>>e/4).toString(16)),Nc=Date.now,os=e=>new Promise(e);Promise.all.bind(Promise);const ls=e=>e===void 0?null:e;class Bc{constructor(){this.map=new Map}setItem(t,n){this.map.set(t,n)}getItem(t){return this.map.get(t)}}let Qs=new Bc,Lc=!0;try{typeof localStorage<"u"&&localStorage&&(Qs=localStorage,Lc=!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},Pc=e=>typeof e=="object",$c=Object.assign,er=Object.keys,Fc=(e,t)=>{for(const n in e)t(e[n],n)},Qe=e=>er(e).length,Vc=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},Ti=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Hc=(e,t)=>e===t||Qe(e)===Qe(t)&&oe(e,(n,i)=>(n!==void 0||Ti(t,i))&&tr(t[i],n)),zc=Object.freeze,nr=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&nr(e[t])}return zc(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(!Ti(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},Kc=(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 xt;const qc=()=>{if(xt===void 0)if(ie){xt=dt();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const i=e[n];i[0]==="-"?(t!==null&&xt.set(t,""),t=i):t!==null&&(xt.set(t,i),t=null)}t!==null&&xt.set(t,"")}else typeof location=="object"?(xt=dt(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");xt.set(`--${ts(t,"-")}`,n),xt.set(`-${ts(t,"-")}`,n)}})):xt=dt();return xt},oi=e=>qc().has(e),tn=e=>ls(ie?process.env[e.toUpperCase().replaceAll("-","_")]:Uc.getItem(e)),sr=e=>oi("--"+e)||tn(e)!==null,Wc=sr("production"),Gc=ie&&Kc(process.env.FORCE_COLOR,["true","1","2"]),Yc=Gc||!oi("--no-colors")&&!sr("no-color")&&(!ie||process.stdout.isTTY)&&(!ie||oi("--color")||tn("COLORTERM")!==null||(tn("TERM")||"").includes("color")),Jc=e=>{let t="";for(let n=0;n<e.byteLength;n++)t+=Ys(e[n]);return btoa(t)},Xc=e=>Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("base64"),Zc=ir?Jc:Xc,Qc=e=>hc(t=>ne(t,e));class ta{constructor(t,n){this.left=t,this.right=n}}const Ct=(e,t)=>new ta(e,t),cs=e=>e.next()>=.5,Hn=(e,t,n)=>ft(e.next()*(n+1-t)+t),rr=(e,t,n)=>ft(e.next()*(n+1-t)+t),Ii=(e,t,n)=>rr(e,t,n),ea=e=>Ys(Ii(e,97,122)),na=(e,t=0,n=20)=>{const i=Ii(e,t,n);let s="";for(let r=0;r<i;r++)s+=ea(e);return s},zn=(e,t)=>t[Ii(e,0,t.length-1)],ia=Symbol("0schema");class sa{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(ac(" ",(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)?yi(e,n=>vi(t,i=>li(n,i))):Pc(e)?oe(e,(n,i)=>li(n,t[i])):!1;class Q{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)}[ia](){return!0}[ye](t){return this.equals(t)}validate(t){return this.check(t)}check(t,n){ct()}get nullable(){return le(this,Cn)}get optional(){return new cr(this)}cast(t){return as(t,this),t}expect(t){return as(t,this),t}}Ne(Q,"_dilutes",!1);class Di extends Q{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 Di(e,t);V(Di);class Mi extends Q{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 G=e=>new Mi(e);V(Mi);class wn extends Q{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),ra=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,t=>"\\"+t)),lr=e=>{if(se.check(e))return[ra(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);Z()};class oa extends Q{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(oa);const la=Symbol("optional");class cr extends Q{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[la](){return!0}}const ca=V(cr);class aa extends Q{check(t,n){return n==null||n.extend(null,"never",typeof t),!1}}V(aa);const gn=class gn extends Q{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&&!Ti(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 ha=e=>new en(e),ua=V(en),da=G(e=>e!=null&&(e.constructor===Object||e.constructor==null));class ar extends Q{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),fa=V(ar);class ur extends Q{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 pa=(...e)=>new ur(e);V(ur);class dr extends Q{constructor(t){super(),this.shape=t.length===1?t[0]:new vn(t)}check(t,n){const i=te(t)&&yi(t,s=>this.shape.check(s));return!i&&(n==null||n.extend(null,"Array","")),i}}const fr=(...e)=>new dr(e),ga=V(dr),ma=G(e=>te(e));class pr extends Q{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 xa=(e,t=null)=>new pr(e,t);V(pr);const ba=xa(Q);class wa extends Q{constructor(t){super(),this.len=t.length-1,this.args=pa(...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 ya=V(wa),va=G(e=>typeof e=="function");class Sa extends Q{constructor(t){super(),this.shape=t}check(t,n){const i=yi(this.shape,s=>s.check(t,n));return!i&&(n==null||n.extend(null,"Intersectinon",typeof t)),i}}V(Sa,e=>e.shape.length>0);class vn extends Q{constructor(t){super(),this.shape=t}check(t,n){const i=vi(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=G(gr),Ca=V(Mi,e=>e.shape===gr),Oi=G(e=>typeof e=="bigint"),ka=G(e=>e===Oi),mr=G(e=>typeof e=="symbol");G(e=>e===mr);const Jt=G(e=>typeof e=="number"),xr=G(e=>e===Jt),se=G(e=>typeof e=="string"),br=G(e=>e===se),Sn=G(e=>typeof e=="boolean"),Ea=G(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),_a=V(wn,e=>e.shape.length===1&&e.shape[0]===null);V(Uint8Array);V(Di,e=>e.shape===Uint8Array);const Ta=le(Jt,se,Cn,wr,Oi,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(ba.check(e))return e;if(da.check(e)){const t={};for(const n in e)t[n]=ve(e[n]);return ha(t)}else{if(ma.check(e))return le(...e.map(ve));if(Ta.check(e))return yn(e);if(va.check(e))return V(e)}Z()},as=Wc?()=>{}:(e,t)=>{const n=new sa;if(!t.check(e,n))throw yt(`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 yt("Unhandled pattern")}}}const Ia=e=>new Aa(e),yr=Ia(sn).if(xr,(e,t)=>Hn(t,Qi,Xe)).if(br,(e,t)=>na(t)).if(Ea,(e,t)=>cs(t)).if(ka,(e,t)=>BigInt(Hn(t,Qi,Xe))).if(nn,(e,t)=>Gt(t,zn(t,e.shape))).if(ua,(e,t)=>{const n={};for(const i in e.shape){let s=e.shape[i];if(ca.check(s)){if(cs(t))continue;s=s.shape}n[i]=yr(s,t)}return n}).if(ga,(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(_a,(e,t)=>null).if(ya,(e,t)=>{const n=Gt(t,e.res);return()=>n}).if(Ca,(e,t)=>Gt(t,zn(t,[Jt,se,Cn,wr,Oi,Sn,fr(Jt),hr(le("a","b","c"),Jt)]))).if(fa,(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:{};G(e=>e.nodeType===Ra);typeof DOMParser<"u"&&new DOMParser;G(e=>e.nodeType===Ma);G(e=>e.nodeType===Oa);const Da=e=>Yl(e,(t,n)=>`${n}:${t};`).join(""),Ma=Me.ELEMENT_NODE,Oa=Me.TEXT_NODE,ja=Me.DOCUMENT_NODE,Ra=Me.DOCUMENT_FRAGMENT_NODE;G(e=>e.nodeType===ja);const Na=e=>class{constructor(n){this._=n}destroy(){e(this._)}},Ba=Na(clearTimeout),vr=(e,t)=>new Ba(setTimeout(t,e)),At=Symbol,Sr=At(),Cr=At(),La=At(),Ua=At(),Pa=At(),kr=At(),$a=At(),ji=At(),Fa=At(),Va=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},Ha={[Sr]:Ct("font-weight","bold"),[Cr]:Ct("font-weight","normal"),[La]:Ct("color","blue"),[Pa]:Ct("color","green"),[Ua]:Ct("color","grey"),[kr]:Ct("color","red"),[$a]:Ct("color","purple"),[ji]:Ct("color","orange"),[Fa]:Ct("color","black")},za=e=>{var o;e.length===1&&((o=e[0])==null?void 0:o.constructor)===Function&&(e=e[0]());const t=[],n=[],i=dt();let s=[],r=0;for(;r<e.length;r++){const l=e[r],c=Ha[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=Da(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=Yc?za:Va,Ka=(...e)=>{console.log(...Er(e)),Tr.forEach(t=>t.print(e))},_r=(...e)=>{console.warn(...Er(e)),e.unshift(ji),Tr.forEach(t=>t.print(e))},Tr=Pt(),Ar=e=>({[Symbol.iterator](){return this},next:e}),qa=(e,t)=>Ar(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),Kn=(e,t)=>Ar(()=>{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)}}),Wa=(e,t)=>{let n=0,i=e.length-1;for(;n<=i;){const s=ft((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&&Wa(n,t.clock)!==null},Ri=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++)Xl(r,e[o].clients.get(s)||[]);t.clients.set(s,r)}});return Ri(t),t},Se=(e,t,n,i)=>{Tt(e.clients,t,()=>[]).push(new kn(n,i))},Ir=()=>new ce,Ga=e=>{const t=Ir();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},Ni=(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)}})},Ya=e=>{const t=new ce,n=j(e.restDecoder);for(let i=0;i<n;i++){e.resetDsCurVal();const s=j(e.restDecoder),r=j(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},hs=(e,t,n)=>{const i=new ce,s=j(e.restDecoder);for(let r=0;r<s;r++){e.resetDsCurVal();const o=j(e.restDecoder),l=j(e.restDecoder),c=n.clients.get(o)||[],a=P(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=pt(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),Ni(r,i),r.toUint8Array()}return null},Dr=Zs;class zt extends Ws{constructor({guid:t=Rc(),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=Dr(),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=os(a=>{this.on("load",()=>{this.isLoaded=!0,a(this)})});const c=()=>os(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&&O(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 O(this,t,n)}get(t,n=q){const i=Tt(this.share,t,()=>{const r=new n;return r._integrate(this,null),r}),s=i.constructor;if(n!==q&&s!==n)if(s===q){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,J)}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,O(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 Ja{constructor(t){this.dsCurrVal=0,this.restDecoder=t}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=j(this.restDecoder),this.dsCurrVal}readDsLen(){const t=j(this.restDecoder)+1;return this.dsCurrVal+=t,t}}class rn extends Ja{constructor(t){super(t),this.keys=[],j(t),this.keyClockDecoder=new Vn(ot(t)),this.clientDecoder=new Ke(ot(t)),this.leftClockDecoder=new Vn(ot(t)),this.rightClockDecoder=new Vn(ot(t)),this.infoDecoder=new rs(ot(t),we),this.stringDecoder=new Ic(ot(t)),this.parentInfoDecoder=new rs(ot(t),we),this.typeRefDecoder=new Ke(ot(t)),this.lenDecoder=new Ke(ot(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 ot(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 Xa{constructor(){this.restEncoder=De()}toUint8Array(){return ht(this.restEncoder)}resetDsCurVal(){}writeDsClock(t){I(this.restEncoder,t)}writeDsLen(t){I(this.restEncoder,t)}}class Za extends Xa{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){rt(this.restEncoder,t)}writeJSON(t){Yt(this.restEncoder,JSON.stringify(t))}writeKey(t){Yt(this.restEncoder,t)}}class Qa{constructor(){this.restEncoder=De(),this.dsCurrVal=0}toUint8Array(){return ht(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(t){const n=t-this.dsCurrVal;this.dsCurrVal=t,I(this.restEncoder,n)}writeDsLen(t){t===0&&Z(),I(this.restEncoder,t-1),this.dsCurrVal+=t}}class En extends Qa{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 ns(ii),this.stringEncoder=new yc,this.parentInfoEncoder=new ns(ii),this.typeRefEncoder=new ze,this.lenEncoder=new ze}toUint8Array(){const t=De();return I(t,0),rt(t,this.keyClockEncoder.toUint8Array()),rt(t,this.clientEncoder.toUint8Array()),rt(t,this.leftClockEncoder.toUint8Array()),rt(t,this.rightClockEncoder.toUint8Array()),rt(t,ht(this.infoEncoder)),rt(t,this.stringEncoder.toUint8Array()),rt(t,ht(this.parentInfoEncoder)),rt(t,this.typeRefEncoder.toUint8Array()),rt(t,this.lenEncoder.toUint8Array()),xn(t,ht(this.restEncoder)),ht(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){rt(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 th=(e,t,n,i)=>{i=Ot(i,t[0].id.clock);const s=pt(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)=>{P(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])=>{th(e,t.clients.get(s),s,r)})},eh=(e,t)=>{const n=dt(),i=j(e.restDecoder);for(let s=0;s<i;s++){const r=j(e.restDecoder),o=new Array(r),l=e.readClient();let c=j(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 lt(_(l,c),h),c+=h;break}case 10:{const h=j(e.restDecoder);o[a]=new at(_(l,c),h),c+=h;break}default:{const h=(u&(Et|tt))===0,f=new M(_(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},nh=(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!==at){const g=Tt(h,u.id.client,()=>P(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,P(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},ih=(e,t)=>Mr(e,t.doc.store,t.beforeState),sh=(e,t,n,i=new rn(e))=>O(t,s=>{s.local=!1;let r=!1;const o=s.doc,l=o.store,c=eh(i,o),a=nh(s,l,c),u=l.pendingStructs;if(u){for(const[f,p]of u.missing)if(p<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=ws([u.update,a.update])}}else l.pendingStructs=a;const h=hs(i,s,l);if(l.pendingDs){const f=new rn(ki(l.pendingDs));j(f.restDecoder);const p=hs(f,s,l);h&&p?l.pendingDs=ws([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=ki(t);sh(s,e,n,new i(s))};class rh{constructor(){this.l=[]}}const us=()=>new rh,ds=(e,t)=>e.l.push(t),fs=(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 Z()},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 oh{constructor(t,n,i=0){this.type=t,this.index=n,this.assoc=i}}const lh=(e,t,n=0)=>new oh(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)},ch=(e,t)=>{const n=Zt(e,t),i=t.clock-n.id.clock;return{item:n,diff:i}},ah=(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(P(i,s.client)<=s.clock)return null;const u=n?fi(i,s):ch(i,s),h=u.item;if(!(h instanceof M))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(P(i,r.client)<=r.clock)return null;const{item:u}=n?fi(i,r):{item:Zt(i,r)};if(u instanceof M&&u.content instanceof mt)c=u.content.type;else return null}else throw Z();l>=0?a=c._length:a=0}return lh(c,a,e.assoc)};class Bi{constructor(t,n){this.ds=t,this.sv=n}}const jr=(e,t)=>new Bi(e,t),Wn=e=>jr(Ga(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,Pt),i=e.doc.store;n.has(t)||(t.sv.forEach((s,r)=>{s<P(i,r)&&nt(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},P=(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 Z()}n.push(t)},pt=(e,t)=>{let n=0,i=e.length-1,s=e[i],r=s.id.clock;if(r===t)return i;let o=ft(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=ft((n+i)/2)}throw Z()},hh=(e,t)=>{const n=e.clients.get(t.client);return n[pt(n,t.clock)]},Zt=hh,ui=(e,t,n)=>{const i=pt(t,n),s=t[i];return s.id.clock<n&&s instanceof M?(t.splice(i+1,0,un(e,s,n-s.id.clock)),i+1):i},nt=(e,t)=>{const n=e.doc.store.clients.get(t.client);return n[ui(e,n,t.clock)]},ps=(e,t,n)=>{const i=t.clients.get(n.client),s=pt(i,n.clock),r=i[s];return n.clock!==r.id.clock+r.length-1&&r.constructor!==lt&&i.splice(s+1,0,un(e,r,n.clock-r.id.clock+1)),r},uh=(e,t,n)=>{const i=e.clients.get(t.id.client);i[pt(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 dh{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 gs=(e,t)=>t.deleteSet.clients.size===0&&!Jl(t.afterState,(n,i)=>t.beforeState.get(i)!==n)?!1:(Ri(t.deleteSet),ih(e,t),Ni(e,t.deleteSet),!0),ms=(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,Pt).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 M&&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},fh=(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=pt(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 M&&h.deleted&&!h.keep&&n(h)&&h.gc(t,!1)}}}},ph=(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+pt(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{Ri(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&&Rh(n)})}),Ai(l,[])}finally{i.gc&&fh(r,s,i.gcFilter),ph(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(pt(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=pt(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)&&(Ka(ji,Sr,"[yjs] ",Cr,kr,"Changed the client-id because another client seems to be using it."),i.clientID=Dr()),i.emit("afterTransactionCleanup",[n,i]),i._observers.has("update")){const u=new Za;gs(u,n)&&i.emit("update",[u.toUint8Array(),n.origin,i,n])}if(i._observers.has("updateV2")){const u=new En;gs(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)}}},O=(e,t,n=null,i=!0)=>{const s=e._transactionCleanups;let r=!1,o=null;e._transaction===null&&(r=!0,e._transaction=new dh(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 gh{constructor(t,n){this.insertions=n,this.deletions=t,this.meta=new Map}}const xs=(e,t,n)=>{jt(e,n.deletions,i=>{i instanceof M&&t.scope.some(s=>s===e.doc||ke(s,i))&&Fi(i,!1)})},bs=(e,t,n)=>{let i=null;const s=e.doc,r=e.scope;O(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 M){if(p.redone!==null){let{item:g,diff:x}=fi(c,p.id);x>0&&(g=nt(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 M&&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 Ur 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,k=w-C;k>0&&Se(f,y,C,k)});const p=Nc();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 gh(c.deleteSet,f)),g=!0;!a&&!u&&(this.lastChange=p),jt(c,c.deleteSet,w=>{w instanceof M&&this.scope.some(y=>y===c.doc||ke(y,w))&&Fi(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 q?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=>xs(i,this,s)),this.undoStack=[]),n&&(this.redoStack.forEach(s=>xs(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=bs(this,this.undoStack,"undo")}finally{this.undoing=!1}return t}redo(){this.redoing=!0;let t;try{t=bs(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*mh(e){const t=j(e.restDecoder);for(let n=0;n<t;n++){const i=j(e.restDecoder),s=e.readClient();let r=j(e.restDecoder);for(let o=0;o<i;o++){const l=e.readInfo();if(l===10){const c=j(e.restDecoder);yield new at(_(s,r),c),r+=c}else if((mn&l)!==0){const c=(l&(Et|tt))===0,a=new M(_(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 lt(_(s,r),c),r+=c}}}}class xh{constructor(t,n){this.gen=mh(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===at);return this.curr}}class bh{constructor(t){this.currClient=0,this.startClock=0,this.written=0,this.encoder=t,this.clientStructs=[]}}const wh=(e,t)=>{if(e.constructor===lt){const{client:n,clock:i}=e.id;return new lt(_(n,i+t),e.length-t)}else if(e.constructor===at){const{client:n,clock:i}=e.id;return new at(_(n,i+t),e.length-t)}else{const n=e,{client:i,clock:s}=n.id;return new M(_(i,s+t),null,_(i,s+t-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(t))}},ws=(e,t=rn,n=En)=>{if(e.length===1)return e[0];const i=e.map(u=>new t(ki(u)));let s=i.map(u=>new xh(u,!0)),r=null;const o=new n,l=new bh(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===at?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===at)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 at(_(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===at?r.struct.length-=g:f=wh(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!==at;f=u.next())pe(l,r.struct,r.offset),r={struct:f,offset:0}}r!==null&&(pe(l,r.struct,r.offset),r=null),yh(l);const c=i.map(u=>Ya(u)),a=ci(c);return Ni(o,a),o.toUint8Array()},Pr=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:ht(e.encoder.restEncoder)}),e.encoder.restEncoder=De(),e.written=0)},pe=(e,t,n)=>{e.written>0&&e.currClient!==t.id.client&&Pr(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++},yh=e=>{Pr(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)}},ys="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=vh(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 yt(ys);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=Un(c.content.getContent());else return;else c!==null&&this.deletes(c)?(o="update",l=Un(c.content.getContent())):(o="add",l=void 0)}else if(this.deletes(r))o="delete",l=Un(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 yt(ys);const n=this.target,i=Pt(),s=Pt(),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 vh=(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 Li=0;class Sh{constructor(t,n){t.marker=!0,this.p=t,this.index=n,this.timestamp=Li++}}const Ch=e=>{e.timestamp=Li++},Fr=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=Li++},kh=(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 Sh(t,n);return e.push(i),i}},An=(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,Ch(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):kh(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))}},In=(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 q{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=us(),this._dEH=us(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(t,n){this.doc=t,this._item=n}_copy(){throw ct()}clone(){throw ct()}_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){ds(this._eH,t)}observeDeep(t){ds(this._dEH,t)}unobserve(t){fs(this._eH,t)}unobserveDeep(t){fs(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},Eh=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=An(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 M(_(o,P(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 M(_(o,P(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 M(_(o,P(l,o)),s,s&&s.lastId,c,c&&c.id,t,null,new je(h)),s.integrate(e,0);break;default:if(h instanceof q)s=new M(_(o,P(l,o)),s,s&&s.lastId,c,c&&c.id,t,null,new mt(h)),s.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),u()},Wr=()=>yt("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=An(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&&nt(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)},_h=(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=An(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&&nt(e,_(l.id.client,l.id.clock+n)),n-=l.length);for(;i>0&&l!==null;)l.deleted||(i<l.length&&nt(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 q)l=new mt(i);else throw new Error("Unexpected content type")}new M(_(o,P(r.store,o)),s,s&&s.lastId,null,null,t,n,l).integrate(e,0)},Pi=(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},Th=(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},Ue=e=>(e.doc??X(),qa(e._map.entries(),t=>!t[1].deleted));class Ah extends Tn{}class Qt extends q{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 q?n.clone():n)),t}get length(){return this.doc??X(),this._length}_callObserver(t,n){super._callObserver(t,n),In(this,t,new Ah(this,t))}insert(t,n){this.doc!==null?O(this.doc,i=>{Gr(i,this,t,n)}):this._prelimContent.splice(t,0,...n)}push(t){this.doc!==null?O(this.doc,n=>{_h(n,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,n=1){this.doc!==null?O(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 q?t.toJSON():t)}map(t){return Kr(this,t)}forEach(t){_e(this,t)}[Symbol.iterator](){return Eh(this)}_write(t){t.writeTypeRef(Qh)}}const Ih=e=>new Qt;class Dh extends Tn{constructor(t,n,i){super(t,n),this.keysChanged=i}}class re extends q{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 q?n.clone():n)}),t}_callObserver(t,n){In(this,t,new Dh(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 q?s.toJSON():s}}),t}get size(){return[...Ue(this)].length}keys(){return Kn(Ue(this),t=>t[0])}values(){return Kn(Ue(this),t=>t[1].content.getContent()[t[1].length-1])}entries(){return Kn(Ue(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?O(this.doc,n=>{cn(n,this,t)}):this._prelimContent.delete(t)}set(t,n){return this.doc!==null?O(this.doc,i=>{Ui(i,this,t,n)}):this._prelimContent.set(t,n),n}get(t){return Pi(this,t)}has(t){return Xr(this,t)}clear(){this.doc!==null?O(this.doc,t=>{this.forEach(function(n,i,s){cn(t,s,i)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(tu)}}const Mh=e=>new re,Dt=(e,t)=>e===t||typeof e=="object"&&typeof t=="object"&&e&&t&&Hc(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&&Z(),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 vs=(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&&nt(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},Pe=(e,t,n,i)=>{const s=new Map,r=i?An(t,n):null;if(r){const o=new di(r.p.left,r.p,r.index,s);return vs(e,o,n-r.index)}else{const o=new di(null,t._start,0,s);return vs(e,o,n)}},Zr=(e,t,n,i)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===F&&Dt(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 M(_(r,P(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&&Dt(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(!Dt(a,c)){o.set(l,a);const{left:u,right:h}=n;n.right=new M(_(r,P(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 gt(i):i instanceof q?new mt(i):new Kt(i);let{left:a,right:u,index:h}=n;t._searchMarker&&Ee(t._searchMarker,n.index,c.getLength()),u=new M(_(o,P(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)},Ss=(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(Dt(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&&nt(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 A, jsxs as x } from "react/jsx-runtime";
|
|
|
5
5
|
import { $ as gl, e as gr, E as Ue, a0 as ml, a1 as wl, a2 as Le, a3 as bl, O as Ui, L as mr, u as Je, F as Xe, T as Li, A as yl, s as xl, a4 as vl, a5 as Sl, a6 as kl } from "./index-D0EmqTpe.js";
|
|
6
6
|
import { f as wr, s as br, o as yr, a as xr, b as vr, d as Sr, h as kr, e as Cr, c as Pi } from "./index-P5_MyY0i.js";
|
|
7
7
|
import { Plugin as Pe, PluginKey as Yt, NodeSelection as di, TextSelection as Cl, SelectionRange as _l, Selection as El } from "@tiptap/pm/state";
|
|
8
|
-
import { C as Tl, T as Dl } from "./Table-
|
|
8
|
+
import { C as Tl, T as Dl } from "./Table-r09L4PvT.js";
|
|
9
9
|
import { u as _r } from "./clsx-Bg-2aTKh.js";
|
|
10
10
|
import Er, { useRef as ot, useState as N, useEffect as nt, useLayoutEffect as Al, useCallback as O, useMemo as ht, Fragment as $i } from "react";
|
|
11
11
|
import { createPortal as Tr } from "react-dom";
|
|
12
|
-
import { F as Q, h as F, D as $e, r as Be, 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 Bi, E as Il, z as Ol, Y as Ml, p as Rl, Z as Nl, I as st } from "./index-
|
|
13
|
-
import { C as Ze, S as Ul, a as Ll, b as Pl, c as $l, d as Bl } from "./Callout-
|
|
14
|
-
import { u as Gt, K as ui, s as Vl } from "./Katex
|
|
15
|
-
import { u as q,
|
|
12
|
+
import { F as Q, h as F, D as $e, r as Be, 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 Bi, E as Il, z as Ol, Y as Ml, p as Rl, Z as Nl, I as st } from "./index-BVtsbzV8.js";
|
|
13
|
+
import { C as Ze, S as Ul, a as Ll, b as Pl, c as $l, d as Bl } from "./Callout-igc-a1lj.js";
|
|
14
|
+
import { u as Gt, K as ui, s as Vl } from "./Katex--VT0zcjU.js";
|
|
15
|
+
import { u as q, o as un, V as ws } from "./index-oj858lQO.js";
|
|
16
16
|
import { Pencil as Hl, Trash2 as Ar, Check as fi, Copy as zl } from "lucide-react";
|
|
17
17
|
import { CodeBlock as Gn } from "./CodeBlock.js";
|
|
18
|
-
import { S as St } from "./separator-
|
|
19
|
-
import { P as Vi, a as Hi, b as zi } from "./popover-
|
|
18
|
+
import { S as St } from "./separator-Bh_ttGZg.js";
|
|
19
|
+
import { P as Vi, a as Hi, b as zi } from "./popover-mlZeH-7I.js";
|
|
20
20
|
import { MultipleColumnNode as bs } from "./Column.js";
|
|
21
21
|
import "./theme.js";
|
|
22
|
-
import { C as Fl, D as qn } from "./Drawer-
|
|
22
|
+
import { C as Fl, D as qn } from "./Drawer-DzroBQds.js";
|
|
23
23
|
import { Editor as jl, makeDropdownToolbar as Kl } 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 Wl } from "./Iframe-
|
|
26
|
+
import { I as be, g as Wl } from "./Iframe-Dt2Styg8.js";
|
|
27
27
|
import { ImageGif as Yl } from "./ImageGif.js";
|
|
28
28
|
import Gl from "katex";
|
|
29
|
-
import { T as pi } from "./textarea-
|
|
30
|
-
import { L as ys, a as ql, R as Jl } from "./LinkEditBlock-
|
|
29
|
+
import { T as pi } from "./textarea-MU5imD7D.js";
|
|
30
|
+
import { L as ys, a as ql, R as Jl } from "./LinkEditBlock-C_F9zWEj.js";
|
|
31
31
|
import { DecorationSet as xs, Decoration as Xl } from "@tiptap/pm/view";
|
|
32
32
|
import { NodeRange as Zl } from "@tiptap/pm/model";
|
|
33
33
|
import { Clear as Ql } from "./Clear.js";
|
|
34
|
-
import { I as tc, a as vs, s as Ss } from "./Indent-
|
|
34
|
+
import { I as tc, a as vs, s as Ss } from "./Indent-BCZFJKcN.js";
|
|
35
35
|
import { RichTextAlign as ec, TextAlign as nc } from "./TextAlign.js";
|
|
36
|
-
import { D as ic, a as sc, b as rc, f as Et, d as oc, g as ks, h as Cs, i as _s, j as Es } from "./dropdown-menu-
|
|
36
|
+
import { D as ic, a as sc, b as rc, f as Et, d as oc, g as ks, h as Cs, i as _s, j as Es } from "./dropdown-menu-uIj8M0jD.js";
|
|
37
37
|
import { Mermaid as gi } from "./Mermaid.js";
|
|
38
38
|
import { RichTextBold as lc } from "./Bold.js";
|
|
39
39
|
import { RichTextCode as cc } from "./Code.js";
|
|
@@ -41,10 +41,10 @@ import "./index-CbkpBnTX.js";
|
|
|
41
41
|
import { RichTextColor as ac } from "./Color.js";
|
|
42
42
|
import { RichTextHighlight as hc } from "./Highlight.js";
|
|
43
43
|
import { RichTextItalic as dc } from "./Italic.js";
|
|
44
|
-
import { r as uc } from "./SlashCommandNodeView-
|
|
44
|
+
import { r as uc } from "./SlashCommandNodeView-DxlBPKPV.js";
|
|
45
45
|
import { RichTextStrike as fc } from "./Strike.js";
|
|
46
46
|
import { RichTextUnderline as pc } from "./TextUnderline.js";
|
|
47
|
-
import { T as Ts, F as gc } from "./Twitter-
|
|
47
|
+
import { T as Ts, F as gc } from "./Twitter-DP_9V0zb.js";
|
|
48
48
|
function mc(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);
|
|
@@ -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-ezTXvA7H.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;
|
|
@@ -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-BVtsbzV8.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
|
{
|
|
@@ -7,7 +7,7 @@ import * as F from "@radix-ui/react-dialog";
|
|
|
7
7
|
import { NotebookPen as Bt, ExternalLink as $t, X as lt, Loader2 as Ft, WrapText as Wt, PencilRuler as Gt, FlipHorizontal as Xt, FlipVertical as Yt, CropIcon as qt, ChevronUp as Zt, Paperclip as Kt, Eye as Jt, Settings as Qt, ZoomOut as er, ZoomIn as tr, BookMarked as rr, Sigma as ir, SmilePlusIcon as nr, Replace as qe, SmilePlus as or, Frame as ar, Columns2 as Ze, PanelRight as sr, PanelLeft as lr, Clipboard as cr, Copy as dr, GripVertical as ur, Plus as hr, Columns4 as fr, Columns3 as mr, Heading6 as gr, Heading5 as pr, Heading4 as xr, Heading3 as br, Heading2 as vr, Heading1 as wr, Pilcrow as yr, ChevronsUpDown as Cr, Trash as kr, Trash2 as Mr, TableCellsSplit as zr, TableCellsMerge as Tr, BetweenVerticalEnd as Ir, BetweenVerticalStart as Sr, BetweenHorizonalStart as Nr, BetweenHorizonalEnd as Ar, Unlink as Lr, Pencil as Er, Sparkles as Rr, Table as Vr, Minimize as Dr, Maximize as Hr, Video as Or, ImageUp as Pr, Link as jr, ListTodo as _r, ListOrdered as Ur, List as Br, IndentDecrease as $r, IndentIncrease as Fr, Type as Wr, CodeXml as Gr, Code as Xr, Superscript as Yr, Subscript as qr, ChevronDown as Zr, Undo2 as Kr, Redo2 as Jr, PaintRoller as Qr, Eraser as ei, Minus as ti, Strikethrough as ri, Quote as ii, Underline as ni, Italic as oi, LoaderCircle as ai, Bold as si, Check as li } from "lucide-react";
|
|
8
8
|
import { c as ct, N as ci, u as di, b as ui, a as hi } from "./clsx-Bg-2aTKh.js";
|
|
9
9
|
import { N as dt, n as fi, a7 as mi, m as ut } from "./index-D0EmqTpe.js";
|
|
10
|
-
import { I as Ke,
|
|
10
|
+
import { I as Ke, j as Je, k as gi, u as ne, V as pi } from "./index-oj858lQO.js";
|
|
11
11
|
import { Slot as ht } from "@radix-ui/react-slot";
|
|
12
12
|
import * as be from "@radix-ui/react-tooltip";
|
|
13
13
|
import * as ft from "@radix-ui/react-toggle";
|