reactjs-tiptap-editor 0.1.11 → 0.1.13
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/bundle-full.cjs +420 -0
- package/lib/bundle-full.js +66325 -0
- package/lib/{reactjs-tiptap-editor.cjs → index.cjs} +1 -1
- package/lib/index.d.cts +69 -69
- package/lib/index.d.ts +69 -69
- package/lib/{reactjs-tiptap-editor.js → index.js} +3 -3
- package/lib/locales-73BBGzRr.cjs +1 -0
- package/lib/{locales-CAZfnzv4.js → locales-CjqAVVw_.js} +16 -18
- package/lib/style.css +1 -1
- package/lib/{tiptap-BSVYcz58.js → tiptap-8FnNtpP6.js} +1 -1
- package/lib/{tiptap-z5OraroY.cjs → tiptap-DRaCr6Fj.cjs} +1 -1
- package/lib/{utils-B0SMxWW-.js → utils-DJ3-4GXI.js} +93 -102
- package/lib/utils-zAUcy3gG.cjs +152 -0
- package/lib/{vendor-BmwuOKTu.cjs → vendor-Dy6OEB8l.cjs} +41 -41
- package/lib/{vendor-C2GXVsjz.js → vendor-ehTKF-_z.js} +3866 -3607
- package/package.json +32 -8
- package/lib/locales-CO2wcFqJ.cjs +0 -1
- package/lib/utils-BG7adOxz.cjs +0 -152
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";var ii=Object.create;var ht=Object.defineProperty;var ri=Object.getOwnPropertyDescriptor;var ai=Object.getOwnPropertyNames;var oi=Object.getPrototypeOf,si=Object.prototype.hasOwnProperty;var ci=(e,t,i)=>t in e?ht(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var li=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ai(t))!si.call(e,a)&&a!==i&&ht(e,a,{get:()=>t[a],enumerable:!(r=ri(t,a))||r.enumerable});return e};var Wt=(e,t,i)=>(i=e!=null?ii(oi(e)):{},li(t||!e||!e.__esModule?ht(i,"default",{value:e,enumerable:!0}):i,e));var re=(e,t,i)=>ci(e,typeof t!="symbol"?t+"":t,i);const n=require("react/jsx-runtime"),d=require("react");require("@radix-ui/react-toast");const _=require("lucide-react"),g=require("./tiptap-DRaCr6Fj.cjs"),w=require("./vendor-Dy6OEB8l.cjs"),Ve=require("shiki"),b=require("./locales-73BBGzRr.cjs"),di=require("@radix-ui/react-select"),Mt=require("@radix-ui/react-slot"),rt=require("tippy.js"),Le=require("react-dom"),hi=require("react-image-crop"),ui=require("@radix-ui/react-checkbox"),Et=require("scroll-into-view-if-needed"),mi=require("@radix-ui/react-tabs"),se=require("prosemirror-docx"),xi=require("docx"),nt=require("mermaid"),fi=require("@radix-ui/react-dialog"),It=require("katex"),gi=require("@radix-ui/react-popover"),bi=require("@radix-ui/react-label"),fn=require("re-resizable"),pi=require("@radix-ui/react-separator"),_i=require("react-tweet"),Xe=require("@radix-ui/react-icons"),wi=require("react-colorful"),vi=require("@radix-ui/react-switch"),yi=require("@radix-ui/react-dropdown-menu"),ji=require("@radix-ui/react-tooltip"),ki=require("@radix-ui/react-toggle");function Q(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const i in e)if(i!=="default"){const r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:()=>e[i]})}}return t.default=e,Object.freeze(t)}const B=Q(d),G=Q(di),wt=Q(ui),we=Q(mi),J=Q(fi),Ue=Q(gi),gn=Q(bi),bn=Q(pi),vt=Q(vi),W=Q(yi),We=Q(ji),pn=Q(ki);let ut;function mt(){return ut===void 0&&(ut=navigator.platform.includes("Mac")),ut}function at(e){return`${e}`.toLowerCase()==="mod"?mt()?"⌘":"Ctrl":`${e}`.toLowerCase()==="alt"?mt()?"⌥":"Alt":`${e}`.toLowerCase()==="shift"?mt()?"⇧":"Shift":e}function ot(e){return e.map(at).join(" ")}function P(...e){return w.twMerge(w.clsx(e))}const y=d.forwardRef((e,t)=>{const{icon:i=void 0,tooltip:r=void 0,disabled:a=!1,customClass:o="",loading:s=void 0,shortcutKeys:c=void 0,tooltipOptions:l={},action:h=void 0,isActive:u=void 0,children:x,asChild:m=!1,upload:f=!1,...p}=e,v=Ze[i],N=m?Mt.Slot:Ke;return n.jsxs(ze,{children:[n.jsx(Oe,{asChild:!0,children:n.jsxs(N,{ref:t,size:"sm",className:P("richtext-w-[32px] richtext-h-[32px]",o),disabled:a,onClick:h,"data-state":u!=null&&u()?"on":"off",...p,children:[v&&n.jsx(v,{className:"richtext-w-4 richtext-h-4"}),x]})}),r&&n.jsx(ye,{...l,children:n.jsxs("div",{className:"richtext-flex richtext-flex-col richtext-items-center richtext-text-center richtext-max-w-24",children:[n.jsx("div",{children:r}),!!(c!=null&&c.length)&&n.jsx("span",{children:ot(c)})]})})]})}),Rt=d.forwardRef(({asChild:e,...t},i)=>{var o;const r=Ze[t.icon],a=e?Mt.Slot:F;return n.jsxs(ze,{children:[n.jsx(Oe,{asChild:!0,children:n.jsx(a,{ref:i,className:"richtext-h-[32px] richtext-px-[5px] richtext-py-0 richtext-min-w-24 richtext-overflow-hidden",variant:"ghost",disabled:t==null?void 0:t.disabled,...t,children:n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-h-full richtext-font-normal",children:[(t==null?void 0:t.title)&&n.jsx("div",{className:"richtext-flex-grow richtext-text-sm richtext-text-left richtext-truncate",children:t==null?void 0:t.title}),r&&n.jsx(r,{className:"richtext-flex-shrink-0 richtext-w-3 richtext-h-3 richtext-ml-1 richtext-text-zinc-500"})]})})}),n.jsx(ye,{children:n.jsxs("div",{className:"richtext-flex richtext-flex-col richtext-items-center richtext-text-center richtext-max-w-24",children:[(t==null?void 0:t.tooltip)&&n.jsx("div",{children:t==null?void 0:t.tooltip}),n.jsx("div",{className:"richtext-flex",children:!!((o=t==null?void 0:t.shortcutKeys)!=null&&o.length)&&n.jsx("span",{children:ot(t==null?void 0:t.shortcutKeys)})})]})})]})});function He(e,t){const{state:i}=t,r=i.selection.$anchor;let a=!1;if(r.depth)for(let o=r.depth;o>0;o--)r.node(o).type.name===e&&(t.dispatchTransaction&&t.dispatchTransaction(i.tr.delete(r.before(o),r.after(o)).scrollIntoView()),a=!0);else{const o=i.selection.node;o&&o.type.name===e&&(t.chain().deleteSelection().run(),a=!0)}if(!a){const o=r.pos;if(o){const s=i.tr.doc.nodeAt(o);s&&s.type.name===e&&(t.dispatchTransaction&&t.dispatchTransaction(i.tr.delete(o,o+s.nodeSize)),a=!0)}}return a}function Ci(e){return e}function qe(e,t,i,r){const a=Ci,[o,s]=d.useState(a(i)),c=d.useRef(o);return d.useEffect(()=>{const l=()=>{const h={...i,...e.getAttributes(t)};Object.keys(h).forEach(x=>{(h[x]===null||h[x]===void 0)&&(h[x]=i?i[x]:null)});const u=a(h);w.deepEqual(c.current,u)||(s(u),c.current=u)};return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e,i,t,a]),o}const Ge=B.forwardRef(({className:e,...t},i)=>n.jsx("textarea",{className:P("richtext-flex richtext-min-h-[80px] richtext-w-full richtext-rounded-md !richtext-border richtext-border-input richtext-bg-background richtext-px-3 richtext-py-2 richtext-text-sm richtext-ring-offset-background placeholder:richtext-text-muted-foreground focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50",e),ref:i,...t}));Ge.displayName="Textarea";const Ni=w.cva("richtext-inline-flex richtext-items-center richtext-justify-center richtext-whitespace-nowrap richtext-rounded-md richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-colors focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 disabled:richtext-pointer-events-none disabled:richtext-opacity-50",{variants:{variant:{default:"!richtext-bg-primary !richtext-text-primary-foreground hover:!richtext-bg-primary/90",destructive:"richtext-bg-destructive richtext-text-destructive-foreground hover:richtext-bg-destructive/90",outline:"richtext-border richtext-border-input richtext-bg-background hover:richtext-bg-accent hover:richtext-text-accent-foreground",secondary:"richtext-bg-secondary richtext-text-secondary-foreground hover:richtext-bg-secondary/80",ghost:"hover:richtext-bg-accent hover:richtext-text-accent-foreground",link:"richtext-text-primary richtext-underline-offset-4 hover:richtext-underline"},size:{default:"richtext-h-10 richtext-px-4 richtext-py-2",sm:"richtext-h-9 richtext-rounded-md richtext-px-3",lg:"richtext-h-11 richtext-rounded-md richtext-px-8",icon:"richtext-h-10 richtext-w-10"}},defaultVariants:{variant:"default",size:"default"}}),F=B.forwardRef(({className:e,variant:t,size:i,asChild:r=!1,...a},o)=>{const s=r?Mt.Slot:"button";return n.jsx(s,{className:P(Ni({variant:t,size:i,className:e})),ref:o,...a})});F.displayName="Button";const de=W.Root,he=W.Trigger,qt=W.Portal,Gt=W.Sub,yt=B.forwardRef(({className:e,inset:t,children:i,...r},a)=>n.jsxs(W.SubTrigger,{ref:a,className:P("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",t&&"richtext-pl-8",e),...r,children:[i,n.jsx(_.ChevronRight,{className:"richtext-ml-auto richtext-h-4 richtext-w-4"})]}));yt.displayName=W.SubTrigger.displayName;const jt=B.forwardRef(({className:e,...t},i)=>n.jsx(W.SubContent,{ref:i,className:P("richtext-z-50 richtext-min-w-[8rem] richtext-overflow-hidden richtext-rounded-md !richtext-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",e),...t}));jt.displayName=W.SubContent.displayName;const ce=B.forwardRef(({className:e,sideOffset:t=4,...i},r)=>n.jsx(W.Portal,{children:n.jsx(W.Content,{ref:r,sideOffset:t,className:P("richtext-z-50 richtext-min-w-[8rem] richtext-overflow-hidden richtext-rounded-md !richtext-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",e),...i})}));ce.displayName=W.Content.displayName;const ne=B.forwardRef(({className:e,inset:t,...i},r)=>n.jsx(W.Item,{ref:r,className:P("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",t&&"richtext-pl-8",e),...i}));ne.displayName=W.Item.displayName;const ve=B.forwardRef(({className:e,children:t,checked:i,...r},a)=>n.jsxs(W.CheckboxItem,{ref:a,className:P("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",e),checked:i,...r,children:[n.jsx("span",{className:"richtext-absolute richtext-left-2 richtext-flex richtext-h-3.5 richtext-w-3.5 richtext-items-center richtext-justify-center",children:n.jsx(W.ItemIndicator,{children:n.jsx(_.Check,{className:"richtext-h-4 richtext-w-4"})})}),t]}));ve.displayName=W.CheckboxItem.displayName;const Si=B.forwardRef(({className:e,children:t,...i},r)=>n.jsxs(W.RadioItem,{ref:r,className:P("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",e),...i,children:[n.jsx("span",{className:"richtext-absolute richtext-left-2 richtext-flex richtext-h-3.5 richtext-w-3.5 richtext-items-center richtext-justify-center",children:n.jsx(W.ItemIndicator,{children:n.jsx(_.Circle,{className:"richtext-h-2 richtext-w-2 richtext-fill-current"})})}),t]}));Si.displayName=W.RadioItem.displayName;const Ti=B.forwardRef(({className:e,inset:t,...i},r)=>n.jsx(W.Label,{ref:r,className:P("richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-font-semibold",t&&"richtext-pl-8",e),...i}));Ti.displayName=W.Label.displayName;const st=B.forwardRef(({className:e,...t},i)=>n.jsx(W.Separator,{ref:i,className:P("richtext--mx-1 richtext-my-1 richtext-h-px richtext-bg-muted",e),...t}));st.displayName=W.Separator.displayName;function _n({className:e,...t}){return n.jsx("span",{className:P("richtext-ml-auto richtext-text-xs richtext-tracking-widest richtext-opacity-60",e),...t})}_n.displayName="DropdownMenuShortcut";const Z=B.forwardRef(({className:e,type:t,...i},r)=>n.jsx("input",{type:t,className:P("richtext-flex richtext-h-10 richtext-w-full richtext-rounded-md !richtext-border richtext-border-input richtext-bg-background richtext-px-3 richtext-py-2 richtext-text-sm richtext-ring-offset-background file:richtext-border-0 file:richtext-bg-transparent file:richtext-text-sm file:richtext-font-medium placeholder:richtext-text-muted-foreground focus-visible:richtext-outline-none disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50",e),ref:r,...i}));Z.displayName="Input";const Ai=w.cva("richtext-text-sm richtext-font-medium richtext-leading-none peer-disabled:richtext-cursor-not-allowed peer-disabled:richtext-opacity-70"),X=B.forwardRef(({className:e,...t},i)=>n.jsx(gn.Root,{ref:i,className:P(Ai(),e),...t}));X.displayName=gn.Root.displayName;const ee=Ue.Root,te=Ue.Trigger,Y=B.forwardRef(({className:e,align:t="center",sideOffset:i=4,...r},a)=>n.jsx(Ue.Portal,{children:n.jsx(Ue.Content,{ref:a,align:t,sideOffset:i,className:P("richtext-z-50 richtext-w-72 richtext-rounded-md !richtext-border richtext-bg-popover richtext-p-4 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none 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",e),...r})}));Y.displayName=Ue.Content.displayName;const ie=B.forwardRef(({className:e,orientation:t="horizontal",decorative:i=!0,...r},a)=>n.jsx(bn.Root,{ref:a,decorative:i,orientation:t,className:P("richtext-shrink-0 richtext-bg-border",t==="horizontal"?"richtext-h-[1px] richtext-w-full":"richtext-h-full richtext-w-[1px]",e),...r}));ie.displayName=bn.Root.displayName;const Ht=B.forwardRef(({className:e,...t},i)=>n.jsx(vt.Root,{className:P("richtext-peer richtext-inline-flex richtext-h-6 richtext-w-11 richtext-shrink-0 richtext-cursor-pointer richtext-items-center richtext-rounded-full richtext-border-2 richtext-border-transparent richtext-transition-colors focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 focus-visible:richtext-ring-offset-background disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50 data-[state=checked]:richtext-bg-primary data-[state=unchecked]:richtext-bg-input",e),...t,ref:i,children:n.jsx(vt.Thumb,{className:P("richtext-pointer-events-none richtext-block richtext-h-5 richtext-w-5 richtext-rounded-full richtext-bg-background richtext-shadow-lg richtext-ring-0 richtext-transition-transform data-[state=checked]:richtext-translate-x-5 data-[state=unchecked]:richtext-translate-x-0")})}));Ht.displayName=vt.Root.displayName;const zt=we.Root,ct=B.forwardRef(({className:e,...t},i)=>n.jsx(we.List,{ref:i,className:P("richtext-inline-flex richtext-h-10 richtext-items-center richtext-justify-center richtext-rounded-md richtext-bg-muted richtext-p-1 richtext-text-muted-foreground",e),...t}));ct.displayName=we.List.displayName;const Me=B.forwardRef(({className:e,...t},i)=>n.jsx(we.Trigger,{ref:i,className:P("richtext-inline-flex richtext-items-center richtext-justify-center richtext-whitespace-nowrap richtext-rounded-sm richtext-px-3 richtext-py-1.5 richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-all focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 disabled:richtext-pointer-events-none disabled:richtext-opacity-50 data-[state=active]:richtext-bg-background data-[state=active]:richtext-text-foreground data-[state=active]:richtext-shadow-sm",e),...t}));Me.displayName=we.Trigger.displayName;const Ee=B.forwardRef(({className:e,...t},i)=>n.jsx(we.Content,{ref:i,className:P("richtext-mt-2 richtext-ring-offset-background focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2",e),...t}));Ee.displayName=we.Content.displayName;const Li=w.cva("richtext-inline-flex richtext-items-center richtext-justify-center richtext-rounded-md richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-colors hover:richtext-bg-muted hover:richtext-text-muted-foreground focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 disabled:richtext-pointer-events-none disabled:richtext-opacity-50 data-[state=on]:richtext-bg-accent data-[state=on]:richtext-text-accent-foreground",{variants:{variant:{default:"richtext-bg-transparent",outline:"richtext-border richtext-border-input richtext-bg-transparent hover:richtext-bg-accent hover:richtext-text-accent-foreground"},size:{default:"richtext-h-10 richtext-px-3",sm:"richtext-h-9 richtext-px-2",lg:"richtext-h-11 richtext-px-5"}},defaultVariants:{variant:"default",size:"default"}}),Ke=B.forwardRef(({className:e,variant:t,size:i,...r},a)=>n.jsx(pn.Root,{ref:a,className:P(Li({variant:t,size:i,className:e})),...r}));Ke.displayName=pn.Root.displayName;const Mi=We.Provider,ze=We.Root,Oe=We.Trigger,ye=B.forwardRef(({className:e,sideOffset:t=4,...i},r)=>n.jsx(We.Content,{ref:r,sideOffset:t,className:P("richtext-z-50 richtext-overflow-hidden richtext-rounded-md !richtext-border richtext-bg-popover richtext-px-3 richtext-py-1.5 richtext-text-sm richtext-text-popover-foreground richtext-shadow-md richtext-animate-in richtext-fade-in-0 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",e),...i}));ye.displayName=We.Content.displayName;const Ei=G.Root,Ii=G.Value,wn=B.forwardRef(({className:e,children:t,...i},r)=>n.jsxs(G.Trigger,{ref:r,className:P("richtext-flex richtext-h-10 richtext-w-full richtext-items-center richtext-justify-between richtext-rounded-md richtext-border richtext-border-input richtext-bg-background richtext-px-3 richtext-py-2 richtext-text-sm richtext-ring-offset-background placeholder:richtext-text-muted-foreground focus:richtext-outline-none focus:richtext-ring-2 focus:richtext-ring-ring focus:richtext-ring-offset-2 disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50 [&>span]:richtext-line-clamp-1",e),...i,children:[t,n.jsx(G.Icon,{asChild:!0,children:n.jsx(_.ChevronDown,{className:"richtext-h-4 richtext-w-4 richtext-opacity-50"})})]}));wn.displayName=G.Trigger.displayName;const vn=B.forwardRef(({className:e,...t},i)=>n.jsx(G.ScrollUpButton,{ref:i,className:P("richtext-flex richtext-cursor-default richtext-items-center richtext-justify-center richtext-py-1",e),...t,children:n.jsx(_.ChevronUp,{className:"richtext-h-4 richtext-w-4"})}));vn.displayName=G.ScrollUpButton.displayName;const yn=B.forwardRef(({className:e,...t},i)=>n.jsx(G.ScrollDownButton,{ref:i,className:P("richtext-flex richtext-cursor-default richtext-items-center richtext-justify-center richtext-py-1",e),...t,children:n.jsx(_.ChevronDown,{className:"richtext-h-4 richtext-w-4"})}));yn.displayName=G.ScrollDownButton.displayName;const jn=B.forwardRef(({className:e,children:t,position:i="popper",...r},a)=>n.jsx(G.Portal,{children:n.jsxs(G.Content,{ref:a,className:P("richtext-relative richtext-z-50 richtext-max-h-60 richtext-overflow-y-auto richtext-min-w-[8rem] richtext-overflow-hidden richtext-rounded-md richtext-border richtext-bg-popover 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",i==="popper"&&"data-[side=bottom]:richtext-translate-y-1 data-[side=left]:richtext--translate-x-1 data-[side=right]:richtext-translate-x-1 data-[side=top]:richtext--translate-y-1",e),position:i,...r,children:[n.jsx(vn,{}),n.jsx(G.Viewport,{className:P("richtext-p-1",i==="popper"&&"richtext-h-[var(--radix-select-trigger-height)] richtext-w-full richtext-min-w-[var(--radix-select-trigger-width)]"),children:t}),n.jsx(yn,{})]})}));jn.displayName=G.Content.displayName;const Ri=B.forwardRef(({className:e,...t},i)=>n.jsx(G.Label,{ref:i,className:P("richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-font-semibold",e),...t}));Ri.displayName=G.Label.displayName;const kt=B.forwardRef(({className:e,children:t,...i},r)=>n.jsxs(G.Item,{ref:r,className:P("richtext-relative richtext-flex richtext-w-full 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 focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",e),...i,children:[n.jsx("span",{className:"richtext-absolute richtext-left-2 richtext-flex richtext-h-3.5 richtext-w-3.5 richtext-items-center richtext-justify-center",children:n.jsx(G.ItemIndicator,{children:n.jsx(_.Check,{className:"richtext-h-4 richtext-w-4"})})}),n.jsx(G.ItemText,{children:t})]}));kt.displayName=G.Item.displayName;const Hi=B.forwardRef(({className:e,...t},i)=>n.jsx(G.Separator,{ref:i,className:P("richtext--mx-1 richtext-my-1 richtext-h-px richtext-bg-muted",e),...t}));Hi.displayName=G.Separator.displayName;const kn=B.forwardRef(({className:e,...t},i)=>n.jsx(wt.Root,{ref:i,className:P("!richtext-peer !richtext-h-4 !richtext-w-4 !richtext-p-0 !richtext-shrink-0 !richtext-rounded-sm !richtext-border !richtext-border-primary !richtext-ring-offset-background focus-visible:!richtext-outline-none focus-visible:!richtext-ring-2 focus-visible:!richtext-ring-ring focus-visible:!richtext-ring-offset-2 disabled:!richtext-cursor-not-allowed disabled:!richtext-opacity-50 data-[state=checked]:!richtext-bg-primary data-[state=checked]:!richtext-text-primary-foreground",e),...t,children:n.jsx(wt.Indicator,{className:P("!richtext-flex !richtext-p-0 !richtext-items-center !richtext-justify-center !richtext-text-current"),children:n.jsx(_.Check,{className:"!richtext-h-4 !richtext-w-4"})})}));kn.displayName=wt.Root.displayName;function zi({editor:e,...t}){const i=qe(e,_e.name,{text:"",defaultShowPicker:!1}),{text:r,defaultShowPicker:a}=i,[o,s]=d.useState(""),[c,l]=d.useState(!1),h=d.useCallback(()=>e.isActive(_e.name),[e]),u=d.useCallback(()=>He(_e.name,e),[e]),x=d.useCallback(()=>{e.chain().focus().setKatex({text:o}).run(),l(!1)},[e,o]);d.useEffect(()=>{a&&(l(!0),e.chain().updateAttributes(_e.name,{defaultShowPicker:!1}).focus().run())},[e,a,l]),d.useEffect(()=>{c&&s(r||"")},[c]);const m=d.useMemo(()=>{try{return It.renderToString(`${o}`)}catch{return o}},[o]),f=d.useMemo(()=>`${o}`.trim()?n.jsx("span",{contentEditable:!1,dangerouslySetInnerHTML:{__html:m||""}}):null,[o,m]);return n.jsx(g.BubbleMenu,{editor:e,pluginKey:"Katex-bubble-menu",shouldShow:h,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{l(!1)}},children:t!=null&&t.disabled?n.jsx(n.Fragment,{}):n.jsx("div",{className:"richtext-p-2 richtext-bg-white !richtext-border richtext-rounded-lg richtext-shadow-sm dark:richtext-bg-black richtext-border-neutral-200 dark:richtext-border-neutral-800",children:c?n.jsxs(n.Fragment,{children:[n.jsx(Ge,{value:o,onChange:p=>s(p.target.value),autoFocus:!0,placeholder:"Formula text",rows:3,defaultValue:r,style:{marginBottom:8}}),f&&n.jsx("div",{className:"richtext-my-[10px] richtext-p-[10px] richtext-rounded-[6px] !richtext-border-[1px] richtext-whitespace-nowrap richtext-overflow-auto",children:f}),n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-justify-between richtext-gap-[6px]",children:[n.jsx(F,{onClick:x,className:"richtext-flex-1",children:"Submit"}),n.jsx("a",{href:"https://katex.org/docs/supported",target:"_blank",rel:"noreferrer noopener",children:n.jsx(_.HelpCircle,{size:16})})]})]}):n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-gap-[6px]",children:[n.jsx(y,{tooltip:"Edit",action:()=>l(!c),children:n.jsx(_.Pencil,{size:16})}),n.jsx(y,{tooltip:"Delete",action:u,children:n.jsx(_.Trash2,{size:16})})]})})})}function Cn(e){return e=e||new Map,{all:e,on(t,i){const r=e.get(t);r?r.push(i):e.set(t,[i])},off(t,i){const r=e.get(t);r&&(i?r.splice(r.indexOf(i)>>>0,1):e.set(t,[]))},emit(t,i){let r=e.get(t);r&&[...r].map(a=>{a(i)}),r=e.get("*"),r&&[...r].map(a=>{a(t,i)})}}}const Oi={padding:"0 12px 12px"},Nn=({width:e,maxWidth:t,height:i,onOk:r,children:a})=>{const{t:o}=b.useLocale(),[s,c]=d.useState({width:"",height:"",maxWidth:""});d.useEffect(()=>{c({width:e,height:i,maxWidth:t})},[i,t,e]);function l(h){h.preventDefault(),h.stopPropagation(),r(s)}return n.jsxs(ee,{modal:!0,children:[n.jsx(te,{asChild:!0,children:a}),n.jsx(Y,{children:n.jsx("div",{style:Oi,children:n.jsxs("form",{className:"richtext-flex richtext-flex-col richtext-gap-2",onSubmit:l,children:[n.jsx(X,{className:"mb-[6px]",children:"Width"}),n.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:n.jsx("div",{className:"richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm",children:n.jsx(Z,{type:"number",value:s.width,required:!0,onChange:h=>c({...s,width:h.target.value})})})}),n.jsx(X,{className:"mb-[6px]",children:"Max Width"}),n.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:n.jsx("div",{className:"richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm",children:n.jsx(Z,{type:"number",value:s.maxWidth,required:!0,onChange:h=>c({...s,maxWidth:h.target.value})})})}),n.jsx(X,{className:"mb-[6px]",children:"Height"}),n.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:n.jsx("div",{className:"richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm",children:n.jsx(Z,{type:"number",value:s.height,required:!0,onChange:h=>c({...s,height:h.target.value})})})}),n.jsx(F,{type:"submit",className:"richtext-self-end richtext-mt-2",children:o("editor.link.dialog.button.apply")})]})})})]})},Pi="_wrap_15k3c_1",Di="_renderWrap_15k3c_7",Bi="_title_15k3c_14",$i="_icon_15k3c_20",Fi="_handlerWrap_15k3c_30",De={wrap:Pi,renderWrap:Di,title:Bi,icon:$i,handlerWrap:Fi};function Sn(e,t,i){return e<t?t:e>i?i:e}const Vi=e=>typeof e=="number",Ui=e=>typeof e=="string",Wi=e=>typeof e=="function";function qi(e,t="px"){if(!e)return e;const i=Vi(e)?String(e):e,r=Number.parseFloat(i),a=i.match(/[a-z%]+$/i),o=a?a[0]:t;return Number.isNaN(r)?e:r+o}function Tn(e,t){if(!e)return!1;const{extensions:i=[]}=(e==null?void 0:e.extensionManager)??{};return!!i.find(a=>a.name===t)}function Ct(e){return e.map(t=>Ui(t)?{value:t,name:t}:t)}const Gi=10,Ki=200,Kt=15,Zt={width:"100%",height:"100%",maxWidth:"100%"};function Zi({editor:e,node:t,updateAttributes:i}){const r=d.useRef(null),a=e.isActive(ge.name),{data:o,width:s,height:c}=t.attrs,[l,h]=d.useState(null),[u,x]=d.useState(!0),[m,f]=d.useState(null),[p,v]=d.useState(!1),[N,A]=d.useState(100),k=d.useCallback(T=>{T&&v(!0)},[v]),j=d.useCallback(T=>()=>{A(I=>Sn(T==="minus"?I-Kt:I+Kt,Gi,Ki))},[]);d.useEffect(()=>{let T=!1;return import("@excalidraw/excalidraw").then(I=>{T||(r.current=I.exportToSvg)}).catch(I=>!T&&f(I)).finally(()=>!T&&x(!1)),()=>{T=!0}},[x,o]),d.useEffect(()=>{let T=!1;return(async()=>{if(T||u||m||!p||!o)return;const O=await r.current(o);T||(O.setAttribute("width","100%"),O.setAttribute("height","100%"),O.setAttribute("display","block"),h(O))})(),()=>{T=!0}},[o,u,m,p]);const S=T=>{i({width:T.width,height:T.height})};return n.jsx(g.NodeViewWrapper,{className:w.clsx(De.wrap,a&&De.isActive),children:n.jsx(w.VisibilitySensor,{onChange:k,children:n.jsx(fn.Resizable,{size:{width:Number.parseInt(s),height:Number.parseInt(c)},onResizeStop:(T,I,O,E)=>{S({width:Number.parseInt(s)+E.width,height:Number.parseInt(c)+E.height})},children:n.jsxs("div",{className:w.clsx(De.renderWrap,"render-wrapper"),style:{...Zt,overflow:"hidden"},children:[m&&n.jsx("div",{style:Zt,children:n.jsx("p",{children:m.message||m})}),u&&n.jsx("p",{children:"Loading..."}),!u&&!m&&p&&n.jsx("div",{style:{height:"100%",maxHeight:"100%",padding:24,overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",transform:`scale(${N/100})`,transition:"all ease-in-out .3s"},dangerouslySetInnerHTML:{__html:(l==null?void 0:l.outerHTML)??""}}),n.jsx("div",{className:De.title}),n.jsxs("div",{className:De.handlerWrap,children:[n.jsx(y,{icon:"ZoomOut",action:j("minus"),tooltip:"Zoom Out"}),n.jsx(y,{icon:"ZoomIn",action:j("plus"),tooltip:"Zoom In"})]})]})})})})}const Xi=d.memo(Zi,(e,t)=>!!w.deepEqual(e.node.attrs,t.node.attrs));function Yi(e,t="{}"){try{return JSON.stringify(e)}catch{return t}}function Ji(e){try{return JSON.stringify(e)}catch{return JSON.stringify({})}}function K(e,t=!1){return i=>{const r=e.startsWith("data-")?e:`data-${e}`;let a=decodeURIComponent(i.getAttribute(r));if(a==null||typeof a=="string"&&a==="null")try{const c=i.outerHTML.match(/([\s\S])+?="([\s\S])+?"/g);c&&c.length&&(a=(c.map(h=>h.trim()).reduce((h,u)=>{const x=u.indexOf("="),m=[u.slice(0,x),u.slice(x+1).slice(1,-1)];return h[m[0]]=m[1],h},{})[e.toLowerCase()]||"").replaceAll(""",'"'))}catch(s){console.error("Error getDatasetAttribute ",s.message,i)}if(t)try{return JSON.parse(a)}catch{return{}}if(a.includes("%")||a.includes("auto"))return a;const o=Number.parseInt(a);return o!==o?a:o}}function Qi(e){const{attrs:t}=e;return Object.keys(t).reduce((i,r)=>{const a=t[r];if(a==null)return i;let o="";return typeof a=="object"?o=Ji(a):o=a,i[r]=o,i},Object.create(null))}const je=J.Root,ke=J.Trigger,er=J.Portal,An=B.forwardRef(({className:e,...t},i)=>n.jsx(J.Overlay,{ref:i,className:P("richtext-fixed richtext-inset-0 richtext-z-50 richtext-bg-black/80 richtext- 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",e),...t}));An.displayName=J.Overlay.displayName;const ue=B.forwardRef(({className:e,children:t,...i},r)=>n.jsxs(er,{children:[n.jsx(An,{}),n.jsxs(J.Content,{ref:r,className:P("richtext-dialog-content richtext-fixed richtext-left-[50%] richtext-top-[50%] richtext-z-50 richtext-grid richtext-w-full richtext-max-w-lg richtext-translate-x-[-50%] richtext-translate-y-[-50%] richtext-gap-4 richtext-border richtext-bg-background richtext-p-6 richtext-shadow-lg richtext-duration-200 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-[state=closed]:richtext-slide-out-to-left-1/2 data-[state=closed]:richtext-slide-out-to-top-[48%] data-[state=open]:richtext-slide-in-from-left-1/2 data-[state=open]:richtext-slide-in-from-top-[48%] sm:richtext-rounded-lg",e),...i,children:[t,n.jsxs(J.Close,{className:"richtext-absolute richtext-right-4 richtext-top-4 richtext-rounded-sm richtext-opacity-70 richtext-ring-offset-background richtext-transition-opacity hover:richtext-opacity-100 focus:richtext-outline-none focus:richtext-ring-2 focus:richtext-ring-ring focus:richtext-ring-offset-2 disabled:richtext-pointer-events-none data-[state=open]:richtext-bg-accent data-[state=open]:richtext-text-muted-foreground",children:[n.jsx(_.X,{className:"richtext-h-4 richtext-w-4"}),n.jsx("span",{className:"richtext-sr-only",children:"Close"})]})]})]}));ue.displayName=J.Content.displayName;function Ln({className:e,...t}){return n.jsx("div",{className:P("richtext-flex richtext-flex-col richtext-space-y-1.5 richtext-text-center sm:richtext-text-left",e),...t})}Ln.displayName="DialogHeader";function Pe({className:e,...t}){return n.jsx("div",{className:P("richtext-flex richtext-flex-col-reverse sm:richtext-flex-row sm:richtext-justify-end sm:richtext-space-x-2",e),...t})}Pe.displayName="DialogFooter";const me=B.forwardRef(({className:e,...t},i)=>n.jsx(J.Title,{ref:i,className:P("richtext-text-lg richtext-font-semibold richtext-leading-none richtext-tracking-tight",e),...t}));me.displayName=J.Title.displayName;const tr=B.forwardRef(({className:e,...t},i)=>n.jsx(J.Description,{ref:i,className:P("richtext-text-sm richtext-text-muted-foreground",e),...t}));tr.displayName=J.Description.displayName;let xt;function Ot(){try{return xt||(xt=Cn()),xt}catch{throw new Error("Error EventEmitter")}}const Nt="OPEN_EXCALIDRAW_SETTING_MODAL";function nr(e,t){Ot().on(e,t)}function ir(e,t){Ot().off(e,t)}function rr(e){Ot().emit(Nt,e)}const ar=({editor:e})=>{const[t,i]=d.useState(null),[r,a]=d.useState({}),[o,s]=d.useState({elements:[],appState:{isLoading:!1},files:null}),[c,l]=d.useState(!1),[h,u]=d.useState(!0),[x,m]=d.useState(null),f=d.useCallback(A=>{A&&import("@excalidraw/excalidraw").then(k=>{i(k.Excalidraw)}).catch(m).finally(()=>u(!1))},[u]),p=d.useCallback(A=>{setTimeout(()=>{A.refresh()})},[]),v=d.useCallback((A,k,j)=>{a({elements:A,appState:{isLoading:!1},files:j})},[]),N=d.useCallback(()=>{if(!t){l(!1);return}e.chain().focus().setExcalidraw({data:r}).run(),l(!1)},[t,e,r,l]);return d.useEffect(()=>{const A=k=>{l(!0),k&&s(k.data)};return nr(Nt,A),()=>{ir(Nt,A)}},[e,l]),n.jsxs(je,{open:c,onOpenChange:l,children:[n.jsx(ke,{asChild:!0,children:n.jsx(y,{icon:"Excalidraw",tooltip:"Excalidraw",action:()=>l(!0)})}),n.jsxs(ue,{className:"!richtext-max-w-[1300px] richtext-z-[99999]",children:[n.jsx(me,{children:"Excalidraw"}),n.jsxs("div",{style:{height:"100%",borderWidth:1},children:[h&&n.jsx("p",{children:"Loading..."}),x&&n.jsx("p",{children:x&&x.message||"Error"}),n.jsx("div",{style:{width:"100%",height:600},ref:f,children:!h&&!x&&t?n.jsx(t,{ref:p,onChange:v,langCode:"en",initialData:o}):null})]}),n.jsx(Pe,{children:n.jsx(F,{type:"button",onClick:N,children:"Save changes"})})]})]})},Xt={elements:[]},ge=g.Node.create({name:"excalidraw",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addAttributes(){return{defaultShowPicker:{default:!1},createUser:{default:null},width:{default:"100%",parseHTML:K("width")},height:{default:240,parseHTML:K("height")},data:{default:Xt,parseHTML:K("data",!0)}}},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"excalidraw"},button:({editor:t})=>({component:ar,componentProps:{editor:t}})}},parseHTML(){return[{tag:"div[class=excalidraw]"}]},renderHTML({HTMLAttributes:e,node:t}){return["div",g.mergeAttributes(this.options.HTMLAttributes,e,Qi(t))]},addCommands(){return{setExcalidraw:e=>({tr:t,commands:i,chain:r})=>{var a,o,s;return e=e||{},e.data=e.data||Xt,((s=(o=(a=t.selection)==null?void 0:a.node)==null?void 0:o.type)==null?void 0:s.name)==this.name?i.updateAttributes(this.name,e):r().insertContent({type:this.name,attrs:e}).run()}}},addNodeView(){return g.ReactNodeViewRenderer(Xi)},addInputRules(){return[g.nodeInputRule({find:/^\$excalidraw\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]}}),xe=new Map;function or(e){const t=e.options.element;xe.has("width")||xe.set("width",t.clientWidth),xe.has("width")&&xe.get("width")<=0&&xe.set("width",t.clientWidth);const i={attributes:!0,childList:!0,subtree:!0},r=function(){xe.set("width",t.clientWidth)},a=new MutationObserver(r);return a.observe(t,i),e.on("destroy",()=>{a.disconnect()}),{width:xe.get("width")}}function sr({editor:e}){const{t}=b.useLocale(),{width:i}=or(e),r=qe(e,ge.name,{defaultShowPicker:!1,createUser:"",width:0,height:0}),{defaultShowPicker:a,createUser:o,width:s,height:c}=r,l=d.useCallback(m=>{e.chain().updateAttributes(ge.name,m).setNodeSelection(e.state.selection.from).focus().run()},[e]),h=d.useCallback(()=>{rr(r)},[e,r]),u=d.useCallback(()=>e.isActive(ge.name),[e]),x=d.useCallback(()=>He(ge.name,e),[e]);return d.useEffect(()=>{a&&(h(),e.chain().updateAttributes(ge.name,{defaultShowPicker:!1}).focus().run())},[o,a,e,h]),n.jsx(g.BubbleMenu,{className:"bubble-menu",editor:e,pluginKey:"excalidraw-bubble-menu",shouldShow:u,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999},children:n.jsxs("div",{className:"richtext-w-auto richtext-px-3 richtext-py-2 richtext-transition-all !richtext-border richtext-rounded-sm richtext-shadow-sm richtext-pointer-events-auto richtext-select-none richtext-border-neutral-200 dark:richtext-border-neutral-800 richtext-bg-background",children:[n.jsx(y,{icon:"Pencil",action:h,tooltip:t("editor.edit")}),n.jsx(Nn,{width:s,maxWidth:i,height:c,onOk:l,children:n.jsx(y,{icon:"Settings",tooltip:t("editor.settings")})}),n.jsx(y,{icon:"Trash2",action:x,tooltip:t("editor.delete")})]})})}const cr="_wrap_5y04w_1",lr="_handlerWrap_5y04w_11",dr="_innerWrap_5y04w_15",hr="_emptyWrap_5y04w_23",Yt={wrap:cr,handlerWrap:lr,innerWrap:dr,emptyWrap:hr},Mn=w.g(!1);function lt(){return w._(Mn)}const ur={setDisable:e=>{Mn.set(e)}};function mr({editor:e,node:t,updateAttributes:i}){const r=lt(),{url:a,width:o,height:s}=t.attrs,[c,l]=d.useState("");function h(){c&&e.chain().updateAttributes(be.name,{url:c}).setNodeSelection(e.state.selection.from).focus().run()}const u=d.useCallback(x=>{i({width:x.width,height:x.height})},[i]);return n.jsxs(g.NodeViewWrapper,{children:[!a&&n.jsxs("div",{className:"richtext-max-w-[600px] richtext-mx-[auto] richtext-my-[12px] richtext-flex richtext-items-center richtext-justify-center richtext-gap-[10px] richtext-p-[10px] richtext-border-[1px] richtext-border-solid richtext-border-[#ccc] richtext-rounded-[12px]",children:[n.jsx(Z,{value:c,onInput:x=>l(x.target.value),type:"url",className:"richtext-flex-1",autoFocus:!0,placeholder:"Enter link"}),n.jsx(F,{className:"richtext-w-[60px]",onClick:h,children:"OK"})]}),a&&n.jsx(fn.Resizable,{size:{width:Number.parseInt(o),height:Number.parseInt(s)},onResizeStop:(x,m,f,p)=>{u({width:Number.parseInt(o)+p.width,height:Number.parseInt(s)+p.height})},children:n.jsx("div",{className:w.clsx(Yt.wrap,"render-wrapper"),children:n.jsx("div",{className:Yt.innerWrap,style:{pointerEvents:r?"none":"auto"},children:n.jsx("iframe",{src:a,className:"richtext-my-[12px] "})})})})]})}const be=g.Node.create({name:"iframe",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"iframe"},button:({editor:t,extension:i,t:r})=>({component:y,componentProps:{action:a=>t.commands.setIframe(a),upload:i.options.upload,disabled:!t.can().setIframe({}),icon:"Iframe",tooltip:r("editor.iframe.tooltip")}})}},addAttributes(){return{width:{default:600,parseHTML:K("width")},height:{default:300,parseHTML:K("height")},url:{default:null,parseHTML:K("url")},defaultShowPicker:{default:!1},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:e}){return["iframe",g.mergeAttributes(this.options.HTMLAttributes,e)]},addCommands(){return{setIframe:e=>({tr:t,commands:i,chain:r})=>{var o,s,c;if(((c=(s=(o=t.selection)==null?void 0:o.node)==null?void 0:s.type)==null?void 0:c.name)==this.name)return i.updateAttributes(this.name,e);const a=e||{url:""};return r().insertContent({type:this.name,attrs:a}).run()}}},addInputRules(){return[g.nodeInputRule({find:/^\$iframe\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]},addNodeView(){return g.ReactNodeViewRenderer(mr)}});function xr({editor:e}){const{t}=b.useLocale(),{width:i,height:r,url:a}=qe(e,be.name,{width:0,height:0,url:"",defaultShowPicker:!1}),[o,s]=d.useState(!1),[c,l]=d.useState(""),h=d.useCallback(()=>{s(!1)},[s]);d.useEffect(()=>{o&&l(a)},[o,a]);const u=d.useCallback(()=>{e.chain().updateAttributes(be.name,{url:c}).setNodeSelection(e.state.selection.from).focus().run(),s(!1)},[e,c,s]),x=d.useCallback(()=>{window.open(a,"_blank")},[a]),m=d.useCallback(()=>{s(!0)},[s]),f=d.useCallback(N=>{e.chain().updateAttributes(be.name,N).setNodeSelection(e.state.selection.from).focus().run()},[e]),p=d.useCallback(()=>e.isActive(be.name)&&!a,[e,a]),v=d.useCallback(()=>He(be.name,e),[e]);return n.jsxs(n.Fragment,{children:[n.jsx(g.BubbleMenu,{className:"bubble-menu",editor:e,pluginKey:"iframe-bubble-menu",shouldShow:p,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999},children:n.jsxs("div",{className:"richtext-w-auto richtext-px-3 richtext-py-2 richtext-transition-all !richtext-border richtext-rounded-sm richtext-shadow-sm richtext-pointer-events-auto richtext-select-none richtext-border-neutral-200 dark:richtext-border-neutral-800 richtext-bg-background",children:[n.jsx(y,{action:x,icon:"Eye",tooltip:"Visit Link"}),n.jsx(y,{action:m,icon:"Pencil",tooltip:"Open Edit Link"}),n.jsx(Nn,{width:i,height:r,onOk:f,children:n.jsx(y,{icon:"Settings",tooltip:t("editor.settings")})}),n.jsx(y,{action:v,icon:"Trash2",tooltip:t("editor.delete")})]})}),n.jsxs(je,{open:o,onOpenChange:s,children:[n.jsx(ke,{}),n.jsxs(ue,{children:[n.jsx(Ln,{children:n.jsx(me,{children:"Edit Link Iframe"})}),n.jsx(Z,{value:c,onInput:N=>l(N.target.value),type:"url",autoFocus:!0,placeholder:"Enter link"}),n.jsxs(Pe,{children:[n.jsx(F,{onClick:h,children:"Cancel"}),n.jsx(F,{onClick:u,children:"OK"})]})]})]})]})}function En(e=8){return Math.random().toString(36).substring(2,e+2)}function fr(e){return e.replace(/^.*\/|\..+$/g,"")}function gr(e){return e.split(".").pop()}function In(e){return e<1024?`${e} Byte`:e<1024*1024?`${(e/1024).toFixed(2)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function br(e){return e?e==="application/pdf"?"pdf":e.startsWith("application/")&&[".document","word"].some(t=>e.includes(t))?"word":e.startsWith("application/")&&["presentation"].some(t=>e.includes(t))?"excel":e.startsWith("application/")&&["sheet"].some(t=>e.includes(t))?"ppt":e.startsWith("image")?"image":e.startsWith("audio")?"audio":e.startsWith("video")?"video":"file":"file"}function pr(e){return new Promise(t=>{const i=new FileReader;i.addEventListener("load",()=>{t({alt:e.name,src:i.result})},!1),i.readAsDataURL(e)})}function Pt(e,t){const i=e.split(","),r=i[0].match(/:(.*?);/)[1],a=atob(i[i.length-1]);let o=a.length;const s=new Uint8Array(o);for(;o--;)s[o]=a.charCodeAt(o);return new File([s],t,{type:r})}const Jt=`graph TB
|
|
2
|
+
a-->b`,_r=({editor:e,attrs:t,extension:i})=>{const{alt:r,align:a}=t,[o,s]=d.useState(decodeURIComponent(r??Jt)),[c,l]=d.useState(""),[h,u]=d.useState(!1),x=d.useRef(null),m=i==null?void 0:i.options.upload,f=async N=>{try{const{svg:A}=await nt.render("mermaid-svg",N);l(A)}catch{l("")}},p=()=>{nt.initialize({darkMode:!1,startOnLoad:!1,fontSize:12,theme:"base"}),f(o)};d.useEffect(()=>{h&&p()},[h]),d.useEffect(()=>{h&&f(o)},[o]);const v=async()=>{if(o!==""){if(o){const N=x.current.querySelector("svg"),{width:A,height:k}=N.getBoundingClientRect(),j=`mermaid-${En()}.svg`;let S=w.i(N.outerHTML);if(m){const T=Pt(S,j);S=await m(T)}e==null||e.chain().focus().setMermaid({type:"mermaid",src:S,alt:encodeURIComponent(o),width:A,height:k},!!o).run(),e==null||e.commands.setAlignImageMermaid(a)}u(!1)}};return n.jsxs(je,{open:h,onOpenChange:u,children:[n.jsx(ke,{asChild:!0,children:n.jsx(y,{icon:"Pencil",tooltip:"Edit Mermaid",action:()=>u(!0)})}),n.jsxs(ue,{className:"!richtext-max-w-[1300px] richtext-z-[99999]",children:[n.jsx(me,{children:"Edit Mermaid"}),n.jsx("div",{style:{height:"100%",border:"1px solid hsl(var(--border))"},children:n.jsxs("div",{className:"richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]",children:[n.jsx(Ge,{className:"richtext-flex-1",value:o,onChange:N=>s(N.target.value),autoFocus:!0,required:!0,rows:10,defaultValue:Jt,placeholder:"Text",style:{color:"hsl(var(--richtext-foreground))"}}),n.jsx("div",{className:"richtext-flex-1 richtext-flex richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",style:{height:"100%",border:"1px solid hsl(var(--border))",minHeight:500,background:"#fff"},ref:x,dangerouslySetInnerHTML:{__html:c}})]})}),n.jsx(Pe,{children:n.jsx(F,{type:"button",onClick:v,children:"Save changes"})})]})]})};function wr(e,t){const[i,r]=d.useState(void 0);return d.useEffect(()=>{const a=()=>{const o=e.extensionManager.extensions.find(s=>s.name===t);o&&r(o)};return e.on("selectionUpdate",a),e.on("transaction",a),()=>{e.off("selectionUpdate",a),e.off("transaction",a)}},[e,t]),i}const vr={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"};function yr({item:e,disabled:t,editor:i}){var a;const r=e.component;return r?n.jsx(d.Fragment,{children:e.type==="divider"?n.jsx(ie,{orientation:"vertical",className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]"}):n.jsx(r,{...e.componentProps,editor:i,disabled:t||((a=e==null?void 0:e.componentProps)==null?void 0:a.disabled)})}):n.jsx(n.Fragment,{})}function jr(e){return e.type.name==="mermaid"}function kr(e){const{lang:t}=b.useLocale(),i=qe(e.editor,Lt.name),r=wr(e.editor,Lt.name),a=({editor:s})=>{const{selection:c}=s.view.state,{$from:l,to:h}=c;let u=!1;return s.view.state.doc.nodesBetween(l.pos,h,x=>{if(jr(x))return u=!0,!1}),u},o=d.useMemo(()=>e.disabled?[]:pa(e.editor),[e.disabled,e.editor,t]);return n.jsx(n.Fragment,{children:n.jsx(g.BubbleMenu,{shouldShow:a,editor:e==null?void 0:e.editor,tippyOptions:vr,children:o!=null&&o.length?n.jsx("div",{className:"richtext-w-auto richtext-px-3 richtext-py-2 richtext-transition-all !richtext-border richtext-rounded-sm richtext-shadow-sm richtext-pointer-events-auto richtext-select-none richtext-border-neutral-200 dark:richtext-border-neutral-800 richtext-bg-background",children:n.jsx("div",{className:"richtext-flex richtext-items-center richtext-flex-nowrap richtext-whitespace-nowrap richtext-h-[26px] richtext-justify-start richtext-relative",children:o==null?void 0:o.map((s,c)=>s.type==="edit"&&(i!=null&&i.src)?n.jsx(_r,{editor:e.editor,attrs:i,extension:r},`bubbleMenu-mermaid-${c}`):n.jsx(yr,{item:s,disabled:e.disabled,editor:e.editor},`bubbleMenu-mermaid-${c}`))})}):n.jsx(n.Fragment,{})})})}function Cr({node:e}){var r;const t=((r=e==null?void 0:e.attrs)==null?void 0:r.src)||"",i=t==null?void 0:t.split("/").pop();return i?n.jsx(g.NodeViewWrapper,{children:n.jsx("div",{"data-twitter":"",children:n.jsx(_i.Tweet,{id:i})})}):null}function Nr(e){function t(i){e.action&&e.action(i)}return n.jsxs(ee,{modal:!0,children:[n.jsx(te,{disabled:e==null?void 0:e.disabled,asChild:!0,children:n.jsx(y,{tooltip:e==null?void 0:e.tooltip,isActive:e==null?void 0:e.isActive,disabled:e==null?void 0:e.disabled,children:n.jsx($,{name:e==null?void 0:e.icon})})}),n.jsx(Y,{hideWhenDetached:!0,className:"richtext-w-full",align:"start",side:"bottom",children:n.jsx(Rn,{editor:e.editor,onSetLink:t})})]})}const Sr=/(https?:\/\/)?(www\.)?x\.com\/(\w{1,15})(\/status\/(\d+))?(\/\S*)?/g,Tr=/^https?:\/\/(www\.)?x\.com\/(\w{1,15})(\/status\/(\d+))?(\/\S*)?$/;function Qt(e){return e.match(Tr)}const it=g.Node.create({name:"twitter",draggable:!0,selectable:!0,addOptions(){return{addPasteHandler:!0,HTMLAttributes:{},inline:!1,origin:"",button:({editor:e,t})=>({component:Nr,componentProps:{action:i=>{e.commands.setTweet({src:i})},isActive:()=>!1,disabled:!1,icon:"Twitter",tooltip:t("editor.twitter.tooltip"),editor:e}})}},addNodeView(){return g.ReactNodeViewRenderer(Cr,{attrs:this.options.HTMLAttributes})},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},addAttributes(){return{src:{default:null}}},parseHTML(){return[{tag:"div[data-twitter]"}]},addCommands(){return{setTweet:e=>({commands:t})=>Qt(e.src)?t.insertContent({type:this.name,attrs:e}):!1,updateTweet:e=>({commands:t})=>Qt(e.src)?t.updateAttributes(this.name,{src:e.src}):!1}},addPasteRules(){return this.options.addPasteHandler?[g.nodePasteRule({find:Sr,type:this.type,getAttributes:e=>({src:e.input})})]:[]},renderHTML({HTMLAttributes:e}){return["div",g.mergeAttributes({"data-twitter":""},e)]}});function Rn(e){const{t}=b.useLocale(),[i,r]=d.useState("");d.useEffect(()=>{var o;if(e!=null&&e.editor){const{src:s}=(o=e.editor)==null?void 0:o.getAttributes(it.name);s&&r(s)}},[e==null?void 0:e.editor]);function a(o){o.preventDefault(),o.stopPropagation(),e==null||e.onSetLink(i)}return n.jsx("div",{className:"richtext-p-2 richtext-bg-white !richtext-border richtext-rounded-lg richtext-shadow-sm dark:richtext-bg-black border-neutral-200 dark:richtext-border-neutral-800",children:n.jsxs("form",{className:"richtext-flex richtext-flex-col richtext-gap-2",onSubmit:a,children:[n.jsx(X,{className:"mb-[6px]",children:t("editor.link.dialog.text")}),n.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5 richtext-mb-[10px]",children:n.jsx("div",{className:"richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm",children:n.jsx(Z,{type:"text",value:i,required:!0,className:"richtext-w-80",placeholder:"Text",onChange:o=>r(o.target.value)})})}),n.jsx(F,{type:"submit",className:"richtext-self-end richtext-mt-2",children:t("editor.link.dialog.button.apply")})]})})}function Ar({editor:e,disabled:t}){const[i,r]=d.useState(!1),{t:a}=b.useLocale(),o=d.useCallback(({editor:l})=>l.isActive(it.name),[]),s=l=>{e.commands.updateTweet({src:l}),r(!1)},c=d.useCallback(()=>He(it.name,e),[e]);return n.jsx(n.Fragment,{children:n.jsx(g.BubbleMenu,{editor:e,shouldShow:o,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{r(!1)}},children:t?n.jsx(n.Fragment,{}):n.jsx(n.Fragment,{children:i?n.jsx(Rn,{onSetLink:s,editor:e}):n.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-p-2 richtext-bg-white !richtext-border richtext-rounded-lg richtext-shadow-sm dark:richtext-bg-black richtext-border-neutral-200 dark:richtext-border-neutral-800",children:n.jsxs("div",{className:"richtext-flex richtext-flex-nowrap",children:[n.jsx(y,{icon:"Pencil",tooltip:a("editor.link.edit.tooltip"),action:()=>{r(!0)},tooltipOptions:{sideOffset:15}}),n.jsx(y,{icon:"Trash",tooltip:a("editor.delete"),action:c,tooltipOptions:{sideOffset:15}})]})})})})})}function Lr({editor:e,disabled:t,bubbleMenu:i}){const r=e.extensionManager.extensions.map(o=>o.name),a=()=>{var o,s,c,l,h,u,x,m,f,p,v,N,A;return[r.includes("columns")&&!((o=i==null?void 0:i.columnConfig)!=null&&o.hidden)?n.jsx(Oa,{editor:e},"columns"):null,r.includes("table")&&!((s=i==null?void 0:i.tableConfig)!=null&&s.hidden)?n.jsx(Ta,{editor:e},"table"):null,r.includes("link")&&!((c=i==null?void 0:i.linkConfig)!=null&&c.hidden)?n.jsx(La,{editor:e,disabled:t},"link"):null,r.includes("image")&&!((l=i==null?void 0:i.imageConfig)!=null&&l.hidden)?n.jsx(Ra,{editor:e,disabled:t},"image"):null,r.includes(Ft.name)&&!((h=i==null?void 0:i.imageGifConfig)!=null&&h.hidden)?n.jsx(Ha,{editor:e,disabled:t},"imageGif"):null,r.includes("video")&&!((u=i==null?void 0:i.videoConfig)!=null&&u.hidden)?n.jsx(za,{editor:e,disabled:t},"video"):null,r.includes("katex")&&!((x=i==null?void 0:i.katexConfig)!=null&&x.hidden)?n.jsx(zi,{editor:e,disabled:t},"katex"):null,r.includes("excalidraw")&&!((m=i==null?void 0:i.excalidrawConfig)!=null&&m.hidden)?n.jsx(sr,{editor:e,disabled:t},"excalidraw"):null,r.includes("mermaid")&&!((f=i==null?void 0:i.mermaidConfig)!=null&&f.hidden)?n.jsx(kr,{editor:e,disabled:t},"mermaid"):null,r.includes("iframe")&&!((p=i==null?void 0:i.iframeConfig)!=null&&p.hidden)?n.jsx(xr,{editor:e,disabled:t},"iframe"):null,r.includes("twitter")&&!((v=i==null?void 0:i.twitterConfig)!=null&&v.hidden)?n.jsx(Ar,{editor:e,disabled:t},"twitter"):null,(N=i==null?void 0:i.floatingMenuConfig)!=null&&N.hidden?null:n.jsx(ja,{editor:e,disabled:t},"content"),(A=i==null?void 0:i.textConfig)!=null&&A.hidden?null:n.jsx(Na,{editor:e,disabled:t},"text")]};return i!=null&&i.render?i.render({editor:e,disabled:t||!1,bubbleMenu:i},a()):a().filter(Boolean)}function en(){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:n.jsx("path",{fill:"currentColor",d:"M18 14c0-4-6-10.8-6-10.8s-1.33 1.51-2.73 3.52l8.59 8.59c.09-.42.14-.86.14-1.31m-.88 3.12L12.5 12.5L5.27 5.27L4 6.55l3.32 3.32C6.55 11.32 6 12.79 6 14c0 3.31 2.69 6 6 6c1.52 0 2.9-.57 3.96-1.5l2.63 2.63l1.27-1.27z"})})}function Hn(e){const{t}=b.useLocale(),{highlight:i=!1,disabled:r=!1,selectedColor:a,setSelectedColor:o,onChange:s,colors:c=b.COLORS_LIST}=e,l=d.useMemo(()=>{const f=c,p=[];for(let v=0;v<f.length;v+=10)p.push(f.slice(v,v+10));return p},[c]),[h,u]=d.useState([]),x=f=>{const p=[...h],v=p.indexOf(f);v!==-1&&p.splice(v,1),p.unshift(f),p.length>10&&p.pop(),u(p)};function m(f){if(f===void 0){o==null||o(f),s==null||s(f);return}/^#([\da-f]{3}){1,2}$/i.test(f)&&(o==null||o(f),s==null||s(f),x(f))}return n.jsxs(ee,{modal:!0,children:[n.jsx(te,{className:"!richtext-p-0",disabled:r,asChild:!0,children:e==null?void 0:e.children}),n.jsx(Y,{hideWhenDetached:!0,className:"richtext-w-full richtext-h-full richtext-p-2",align:"start",side:"bottom",children:n.jsxs("div",{className:"richtext-flex richtext-flex-col",children:[i?n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-p-1 richtext-cursor-pointer rd-1 richtext-gap-[4px] hover:richtext-bg-accent",onClick:()=>m(void 0),children:[n.jsx(en,{}),n.jsx("span",{className:"richtext-ml-1 richtext-text-sm",children:t("editor.nofill")})]}):n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-p-1 richtext-cursor-pointer rd-1 richtext-gap-[4px] hover:richtext-bg-accent",onClick:()=>{m(void 0)},children:[n.jsx(en,{}),n.jsx("span",{className:"richtext-ml-1 richtext-text-sm",children:t("editor.default")})]}),l.map((f,p)=>n.jsx("span",{className:"richtext-relative richtext-flex richtext-w-full richtext-h-auto richtext-p-0 last:richtext-pb-2",children:f.map((v,N)=>n.jsx("span",{className:"richtext-w-6 richtext-h-6 richtext-p-0.5 richtext-inline-block richtext-rounded-sm !richtext-border richtext-border-transparent richtext-flex-[0_0_auto] richtext-cursor-pointer hover:richtext-border-border hover:richtext-shadow-sm",onClick:()=>m(v),children:n.jsx("span",{style:{backgroundColor:v},className:"richtext-relative richtext-w-[18px] richtext-h-[18px] richtext-block richtext-rounded-[2px] richtext-border-transparent",children:v===a?n.jsx("svg",{className:"richtext-absolute richtext-block richtext-top-[-1px] richtext-left-[1px] richtext-w-3 richtext-h-3",viewBox:"0 0 18 18",style:{fill:"rgb(255, 255, 255)"},children:n.jsx("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})}):n.jsx("svg",{viewBox:"0 0 18 18",style:{fill:"rgb(255, 255, 255)",display:"none"},children:n.jsx("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})})})},`sub-color-${N}`))},p)),n.jsxs("div",{children:[n.jsx("div",{className:"richtext-my-1 richtext-text-sm",children:t("editor.recent")}),n.jsx("span",{className:"richtext-relative richtext-flex richtext-w-full richtext-h-auto richtext-p-0 last:richtext-pb-2",children:h==null?void 0:h.map((f,p)=>n.jsx("span",{className:"richtext-w-6 richtext-h-6 richtext-p-0.5 richtext-inline-block richtext-rounded-sm !richtext-border richtext-border-transparent richtext-flex-[0_0_auto] richtext-cursor-pointer hover:richtext-border-border hover:richtext-shadow-sm",onClick:()=>m(f),children:n.jsx("span",{className:"richtext-relative richtext-w-[18px] richtext-h-[18px] richtext-block richtext-rounded-[2px] richtext-border-transparent",style:{backgroundColor:f},children:n.jsx("svg",{viewBox:"0 0 18 18",style:{fill:"rgb(255, 255, 255)",display:"none"},children:n.jsx("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})})})},`sub-color-recent-${p}`))})]}),n.jsx(Mr,{setColor:m})]})})]})}function Mr({setColor:e}){const[t,i]=d.useState("#000000"),[r,a]=d.useState(!1),{t:o}=b.useLocale();return d.useEffect(()=>()=>{a(!1)},[]),n.jsxs(ee,{open:r,children:[n.jsx(te,{asChild:!0,children:n.jsxs("div",{onClick:s=>{s.preventDefault(),a(!0)},className:"richtext-text-sm hover:richtext-cursor-pointer hover:richtext-bg-accent richtext-py-1.5 richtext-px-1.5",children:[o("editor.color.more"),"..."]})}),n.jsxs(Y,{children:[n.jsxs("div",{className:"richtext-flex richtext-flex-col richtext-items-center richtext-justify-center",children:[n.jsx(wi.HexColorPicker,{color:t,onChange:i}),n.jsx(Z,{className:"richtext-mt-[8px] richtext-w-full",type:"text",onChange:s=>{s.preventDefault(),i(`#${s.target.value}`)},value:t.slice(1)})]}),n.jsx(ie,{className:"richtext-my-[10px]"}),n.jsx(F,{onClick:s=>{s.preventDefault(),e(t),a(!1)},className:"richtext-w-full",children:n.jsx(_.Plus,{size:16})})]})]})}const Er=`
|
|
3
|
+
.reactjs-tiptap-editor, .richtext-dialog-content {
|
|
4
|
+
button,
|
|
5
|
+
input:where([type=button]),
|
|
6
|
+
input:where([type=reset]),
|
|
7
|
+
input:where([type=submit]) {
|
|
8
|
+
-webkit-appearance: button;
|
|
9
|
+
background-color: transparent;
|
|
10
|
+
background-image: none
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
input,
|
|
14
|
+
optgroup,
|
|
15
|
+
select,
|
|
16
|
+
textarea {
|
|
17
|
+
font-family: inherit;
|
|
18
|
+
font-feature-settings: inherit;
|
|
19
|
+
font-variation-settings: inherit;
|
|
20
|
+
font-size: 100%;
|
|
21
|
+
font-weight: inherit;
|
|
22
|
+
line-height: inherit;
|
|
23
|
+
letter-spacing: inherit;
|
|
24
|
+
color: inherit;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
button {
|
|
28
|
+
font-family: inherit;
|
|
29
|
+
font-feature-settings: inherit;
|
|
30
|
+
font-variation-settings: inherit;
|
|
31
|
+
font-size: 100%;
|
|
32
|
+
font-weight: inherit;
|
|
33
|
+
line-height: inherit;
|
|
34
|
+
letter-spacing: inherit;
|
|
35
|
+
color: inherit;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.reactjs-tiptap-editor,
|
|
40
|
+
.richtext-dialog-content,
|
|
41
|
+
div[data-radix-popper-content-wrapper],
|
|
42
|
+
div[data-tippy-root] {
|
|
43
|
+
*,
|
|
44
|
+
:before,
|
|
45
|
+
:after {
|
|
46
|
+
box-sizing: border-box;
|
|
47
|
+
border-width: 0;
|
|
48
|
+
border-style: solid;
|
|
49
|
+
border-color: hsl(var(--richtext-border));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
background-color: hsl(var(--richtext-background));
|
|
53
|
+
color: hsl(var(--richtext-foreground));
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
html,
|
|
57
|
+
:host {
|
|
58
|
+
line-height: 1.5;
|
|
59
|
+
-webkit-text-size-adjust: 100%;
|
|
60
|
+
-moz-tab-size: 4;
|
|
61
|
+
tab-size: 4;
|
|
62
|
+
font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", Segoe UI Symbol, "Noto Color Emoji";
|
|
63
|
+
font-feature-settings: normal;
|
|
64
|
+
font-variation-settings: normal;
|
|
65
|
+
-webkit-tap-highlight-color: transparent
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
hr {
|
|
69
|
+
height: 0;
|
|
70
|
+
color: inherit;
|
|
71
|
+
border-top-width: 1px
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
a {
|
|
75
|
+
color: inherit;
|
|
76
|
+
text-decoration: inherit
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
b,
|
|
80
|
+
strong {
|
|
81
|
+
font-weight: bolder
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
code,
|
|
85
|
+
kbd,
|
|
86
|
+
samp,
|
|
87
|
+
pre {
|
|
88
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;
|
|
89
|
+
font-feature-settings: normal;
|
|
90
|
+
font-variation-settings: normal;
|
|
91
|
+
font-size: 1em
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
table {
|
|
95
|
+
text-indent: 0;
|
|
96
|
+
border-color: inherit;
|
|
97
|
+
border-collapse: collapse
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
input, textarea {
|
|
101
|
+
border-width: 1px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
textarea {
|
|
105
|
+
resize: vertical
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
input::placeholder,
|
|
109
|
+
textarea::placeholder {
|
|
110
|
+
opacity: 1;
|
|
111
|
+
color: #9ca3af
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
button, input, textarea {
|
|
115
|
+
cursor: pointer;
|
|
116
|
+
color: inherit;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
img,
|
|
120
|
+
svg,
|
|
121
|
+
video,
|
|
122
|
+
canvas,
|
|
123
|
+
audio,
|
|
124
|
+
iframe,
|
|
125
|
+
embed,
|
|
126
|
+
object {
|
|
127
|
+
display: block;
|
|
128
|
+
vertical-align: middle
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
img,
|
|
132
|
+
video {
|
|
133
|
+
max-width: 100%;
|
|
134
|
+
height: auto
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
`,zn=w.g("light");function Ir(){return w._(zn)}const Rr={setTheme:e=>{zn.set(e)}},tn="data-rc-order",nn="data-rc-priority",Hr="rc-util-key",St=new Map;function zr(e,t){if(!e)return!1;if(e.contains)return e.contains(t);let i=t;for(;i;){if(i===e)return!0;i=i.parentNode}return!1}function On({mark:e}={}){return e?e.startsWith("data-")?e:`data-${e}`:Hr}function Dt(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function Or(e){return e==="queue"?"prependQueue":e?"prepend":"append"}function Pn(e){return[...(St.get(e)||e).children].filter(t=>t.tagName==="STYLE")}function Dn(e,t={}){const{csp:i,prepend:r,priority:a=0}=t,o=Or(r),s=o==="prependQueue",c=document.createElement("style");c.setAttribute(tn,o),s&&a&&c.setAttribute(nn,`${a}`),i!=null&&i.nonce&&(c.nonce=i==null?void 0:i.nonce),c.innerHTML=e;const l=Dt(t),{firstChild:h}=l;if(r){if(s){const u=Pn(l).filter(x=>{if(!["prepend","prependQueue"].includes(x.getAttribute(tn)))return!1;const m=Number(x.getAttribute(nn)||0);return a>=m});if(u.length>0)return l.insertBefore(c,u.at(-1).nextSibling),c}h.before(c)}else l.append(c);return c}function Bn(e,t={}){const i=Dt(t);return Pn(i).find(r=>r.getAttribute(On(t))===e)}function Pr(e,t={}){const i=Bn(e,t);i&&i.remove()}function Dr(e,t){const i=St.get(e);if(!i||!zr(document,i)){const r=Dn("",t),{parentNode:a}=r;St.set(e,a),r.remove()}}function Br(e,t,i={}){var s,c,l;const r=Dt(i);Dr(r,i);const a=Bn(t,i);if(a)return(s=i.csp)!=null&&s.nonce&&a.nonce!==((c=i.csp)==null?void 0:c.nonce)&&(a.nonce=(l=i.csp)==null?void 0:l.nonce),a.innerHTML!==e&&(a.innerHTML=e),a;const o=Dn(e,i);return o.setAttribute(On(i),t),o}function $r({editor:e,extensions:t}){const{t:i}=b.useLocale(),r=d.useMemo(()=>{var a,o,s;return(s=(o=(a=t==null?void 0:t.find(c=>c.name==="base-kit"))==null?void 0:a.options)==null?void 0:o.characterCount)==null?void 0:s.limit},[t]);return r?n.jsx("div",{className:"richtext-flex richtext-items-center richtext-justify-between richtext-p-3 richtext-border-t",children:n.jsx("div",{className:"richtext-flex richtext-flex-col",children:n.jsx("div",{className:"richtext-flex richtext-justify-end richtext-gap-3 richtext-text-sm",children:n.jsxs("span",{children:[e.storage.characterCount.characters(),"/",r," ",i("editor.characters")]})})})}):n.jsx("div",{className:"richtext-flex richtext-items-center richtext-justify-between richtext-p-3 richtext-border-t",children:n.jsx("div",{className:"richtext-flex richtext-flex-col",children:n.jsx("div",{className:"richtext-flex richtext-justify-end richtext-gap-3 richtext-text-sm",children:n.jsxs("span",{children:[e.storage.characterCount.characters()," ",i("editor.characters")]})})})})}function Fr(e,t){const{content:i,extensions:r,useEditorOptions:a={}}=e,o=d.useMemo(()=>{const u=w.differenceBy(r,r,"name");return[...r.map(m=>{const f=r.find(p=>p.name===m.name);return f?m.configure(f.options):m}),...u].map((m,f)=>m.configure({sort:f}))},[r]),s=w.throttle(u=>{var m;const x=l(u,e.output);(m=e==null?void 0:e.onChangeContent)==null||m.call(e,x)},b.EDITOR_UPDATE_WATCH_THROTTLE_WAIT_TIME),c=g.useEditor({extensions:o,content:i,onUpdate:({editor:u})=>{s&&s(u)},...a});d.useImperativeHandle(t,()=>({editor:c})),d.useEffect(()=>{document.documentElement.classList.toggle("dark",e.dark),Rr.setTheme(e.dark?"dark":"light")},[e.dark]),d.useEffect(()=>{c==null||c.setEditable(!(e!=null&&e.disabled)),ur.setDisable(!(e!=null&&e.disabled))},[c,e==null?void 0:e.disabled]),d.useEffect(()=>((e==null?void 0:e.resetCSS)!==!1&&Br(Er,"react-tiptap-reset"),()=>{Pr("react-tiptap-reset")}),[e==null?void 0:e.resetCSS]);function l(u,x){return e!=null&&e.removeDefaultWrapper?x==="html"?u.isEmpty?"":u.getHTML():x==="json"?u.isEmpty?{}:u.getJSON():x==="text"?u.isEmpty?"":u.getText():"":x==="html"?u.getHTML():x==="json"?u.getJSON():x==="text"?u.getText():""}d.useEffect(()=>()=>{var u;(u=c==null?void 0:c.destroy)==null||u.call(c)},[]);const h=Tn(c,"characterCount");return c?n.jsx("div",{className:"reactjs-tiptap-editor",children:n.jsx(Mi,{delayDuration:0,disableHoverableContent:!0,children:n.jsx("div",{className:"richtext-rounded-[0.5rem] richtext-bg-background richtext-shadow richtext-overflow-hidden richtext-outline richtext-outline-1",children:n.jsxs("div",{className:"richtext-flex richtext-flex-col richtext-w-full richtext-max-h-full",children:[!(e!=null&&e.hideToolbar)&&n.jsx(Ur,{editor:c,disabled:!!(e!=null&&e.disabled)}),n.jsx(g.EditorContent,{className:`richtext-relative ${(e==null?void 0:e.contentClass)||""}`,editor:c}),h&&n.jsx($r,{editor:c,extensions:r}),!(e!=null&&e.hideBubble)&&n.jsx(Lr,{bubbleMenu:e==null?void 0:e.bubbleMenu,editor:c,disabled:e==null?void 0:e.disabled})]})})})}):n.jsx(n.Fragment,{})}const Vr=d.forwardRef(Fr);function Ur({editor:e,disabled:t}){const{t:i,lang:r}=b.useLocale(),a=d.useMemo(()=>{const s=[...e.extensionManager.extensions].sort((l,h)=>{const u=l.options.sort??-1,x=h.options.sort??-1;return u-x});let c=[];for(const l of s){const{button:h,divider:u=!1,spacer:x=!1,toolbar:m=!0}=l.options;if(!h||!Wi(h)||!m)continue;const f=h({editor:e,extension:l,t:i});if(Array.isArray(f)){const p=f.map((v,N)=>({button:v,divider:N===f.length-1?u:!1,spacer:N===0?x:!1}));c=[...c,...p];continue}c.push({button:f,divider:u,spacer:x})}return c},[e,i,r]);return n.jsx("div",{className:"richtext-px-1 richtext-py-2 !richtext-border-b",style:{pointerEvents:t?"none":"auto",opacity:t?.5:1},children:n.jsx("div",{className:"richtext-relative richtext-flex richtext-flex-wrap richtext-h-auto richtext-gap-y-1 richtext-gap-x-1",children:a.map((o,s)=>{var l,h;const c=o.button.component;return n.jsxs("div",{className:"richtext-flex richtext-items-center",children:[(o==null?void 0:o.spacer)&&n.jsx(ie,{orientation:"vertical",className:"!richtext-h-[16px] !richtext-mx-[10px]"}),n.jsx(c,{...o.button.componentProps,disabled:t||((h=(l=o==null?void 0:o.button)==null?void 0:l.componentProps)==null?void 0:h.disabled)}),(o==null?void 0:o.divider)&&n.jsx(ie,{orientation:"vertical",className:"!richtext-h-auto !richtext-mx-2"})]},`toolbar-item-${s}`)})})})}function Wr(e){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:n.jsx("path",{fill:"currentColor",d:"M19 12h-2v3h-3v2h5zM7 9h3V7H5v5h2zm14-6H3a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2m0 16H3V5h18z"})})}function qr(e){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:n.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 15h15m0 4H6m9-8h6m0-4h-6M9 9h1a1 1 0 1 1-1 1V7.5a2 2 0 0 1 2-2M3 9h1a1 1 0 1 1-1 1V7.5a2 2 0 0 1 2-2"})})}function Gr(){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",className:"richtext-w-4 richtext-h-4",width:"1em",height:"1em",viewBox:"0 0 24 24",children:n.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M5.5 3c1.404 0 2.107 0 2.611.38c.219.164.406.375.552.62C9 4.568 9 5.358 9 6.938v10.125c0 1.58 0 2.37-.337 2.937a2.1 2.1 0 0 1-.552.621c-.504.38-1.207.38-2.611.38s-2.107 0-2.611-.38a2.1 2.1 0 0 1-.552-.62C2 19.432 2 18.642 2 17.062V6.938c0-1.58 0-2.37.337-2.938a2.1 2.1 0 0 1 .552-.62C3.393 3 4.096 3 5.5 3M20 11.938v5.124c0 1.58 0 2.37-.337 2.938a2.1 2.1 0 0 1-.552.62c-.504.38-1.207.38-2.611.38s-2.107 0-2.611-.38a2.1 2.1 0 0 1-.552-.62C13 19.433 13 18.642 13 17.063V6.938c0-1.58 0-2.37.337-2.938M22 9l-6-6m6 0l-6 6",color:"currentColor"})})}function Kr(){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",className:"richtext-w-4 richtext-h-4",width:"1em",height:"1em",viewBox:"0 0 24 24",children:n.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M21 18.5c0 1.404 0 2.107-.38 2.611a2.1 2.1 0 0 1-.62.552c-.567.337-1.358.337-2.937.337H6.938c-1.58 0-2.37 0-2.938-.337a2.1 2.1 0 0 1-.62-.552C3 20.607 3 19.904 3 18.5s0-2.107.38-2.611c.163-.218.374-.406.62-.552C4.567 15 5.357 15 6.938 15h10.125c1.58 0 2.37 0 2.937.337c.246.146.457.334.62.552c.38.504.38 1.207.38 2.611M12.063 4H6.937C5.358 4 4.568 4 4 4.337a2.1 2.1 0 0 0-.62.552C3 5.393 3 6.096 3 7.5s0 2.107.38 2.611c.163.218.374.406.62.552C4.567 11 5.357 11 6.938 11h10.125c1.58 0 2.37 0 2.937-.337M21 8l-6-6m6 0l-6 6",color:"currentColor"})})}function Zr(e){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:n.jsx("path",{fill:"currentColor",d:"M14 2H6a2 2 0 0 0-2 2v16c0 1.11.89 2 2 2h12c1.11 0 2-.89 2-2V8zm4 18H6V4h7v5h5zm-.65-10l-2.1 9h-1.4l-1.8-6.79l-1.8 6.79h-1.4l-2.2-9h1.5l1.4 6.81l1.8-6.81h1.3l1.8 6.81l1.4-6.81z"})})}function $(e){const t=Ze[e.name];return t?n.jsx(t,{onClick:e==null?void 0:e.onClick,className:`richtext-w-4 richtext-h-4 ${(e==null?void 0:e.className)||""}`}):null}function Xr(e){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:n.jsx("path",{fill:"currentColor",d:"M21 22H3v-2h18zm0-18H3V2h18zm-11 9.7h4l-2-5.4zM11.2 6h1.7l4.7 12h-2l-.9-2.6H9.4L8.5 18h-2z"})})}function $n(e){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 48 48",...e,children:n.jsx("path",{fill:"currentColor",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:4,d:"M36 19L24 31L12 19z"})})}function Yr(e){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:n.jsx("path",{fill:"currentColor",d:"M9 7v10h6v-2h-4V7z"})})}function Jr(e){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:n.jsx("path",{fill:"currentColor",d:"M9 7c-1.1 0-2 .9-2 2v8h2V9h2v7h2V9h2v8h2V9a2 2 0 0 0-2-2z"})})}function Qr(e){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:n.jsx("path",{fill:"currentColor",d:"M11 7c-1.1 0-2 .9-2 2v2a2 2 0 0 0 2 2h2v2H9v2h4c1.11 0 2-.89 2-2v-2a2 2 0 0 0-2-2h-2V9h4V7z"})})}function ea(){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",children:n.jsx("path",{fill:"currentColor",d:"M14 2H6a2 2 0 0 0-2 2v16c0 1.11.89 2 2 2h12c1.11 0 2-.89 2-2V8zm4 18H6V4h7v5h5zm-.65-10l-2.1 9h-1.4l-1.8-6.79l-1.8 6.79h-1.4l-2.2-9h1.5l1.4 6.81l1.8-6.81h1.3l1.8 6.81l1.4-6.81z"})})}function Fn(){return n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 32 32",children:[n.jsx("path",{fill:"currentColor",d:"M30 18v-2h-6v10h2v-4h3v-2h-3v-2zm-11 8h-4V16h4a3.003 3.003 0 0 1 3 3v4a3.003 3.003 0 0 1-3 3m-2-2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2zm-6-8H6v10h2v-3h3a2.003 2.003 0 0 0 2-2v-3a2 2 0 0 0-2-2m-3 5v-3h3l.001 3z"}),n.jsx("path",{fill:"currentColor",d:"M22 14v-4a.91.91 0 0 0-.3-.7l-7-7A.9.9 0 0 0 14 2H4a2.006 2.006 0 0 0-2 2v24a2 2 0 0 0 2 2h16v-2H4V4h8v6a2.006 2.006 0 0 0 2 2h6v2Zm-8-4V4.4l5.6 5.6Z"})]})}function Vn(){return n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",className:"icon",viewBox:"0 0 1024 1024",children:[n.jsx("path",{fill:"currentColor",d:"M679.253 402.364 618.77 561.015l-60.348-158.651a30.04 30.04 0 0 0-30.447-18.637 29.76 29.76 0 0 0-30.447 18.637l-60.416 158.651-60.416-158.651a30.515 30.515 0 0 0-38.843-17.272 28.945 28.945 0 0 0-17.954 37.547l88.815 233.267c4.369 11.469 15.7 19.115 28.398 19.115a30.31 30.31 0 0 0 28.468-19.115l62.395-163.908 62.396 163.84c4.437 11.605 15.701 19.183 28.4 19.183a30.31 30.31 0 0 0 28.466-19.115l88.747-233.267a28.945 28.945 0 0 0-17.886-37.547 30.447 30.447 0 0 0-38.912 17.272zm219.478 395.605-51.883-29.218c-28.672-16.18-52.224-3.072-52.224 29.082v.273H643.209a29.833 29.833 0 0 0-30.31 29.354c0 16.18 13.584 29.218 30.31 29.218h151.825c1.092 30.516 24.03 43.077 52.224 27.648l51.063-27.989c29.013-15.906 29.15-42.189.41-58.368"}),n.jsx("path",{fill:"currentColor",d:"m810.667 913.135-.478.068H201.796c-19.865 0-36.727-11.673-36.727-25.6v-618.36h154.965c51.268 0 92.911-39.39 92.911-87.858v-87.86H810.19c19.797 0 36.522 11.742 36.522 25.669V739.26h61.987V119.262c0-46.421-44.169-84.241-98.51-84.241H328.364l-225.28 194.56v658.09c0 46.285 44.236 84.105 98.713 84.105H810.19c43.759 0 80.554-24.713 93.32-58.573h-92.842zM350.89 94.89v86.562c0 16.11-13.858 29.286-30.925 29.286H216.815L350.959 94.891z"})]})}function ta(){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:n.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M14 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1m-9 8h4m-2-2v4"})})}function na(){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:n.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1m9 8h4m-2-2v4"})})}function ia(){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:n.jsx("path",{fill:"currentColor",d:"M23.943 19.806a.2.2 0 0 0-.168-.034c-1.26-1.855-2.873-3.61-4.419-5.315l-.252-.284c-.001-.073-.067-.12-.134-.15l-.084-.084c-.05-.1-.169-.167-.286-.1c-.47.234-.907.585-1.327.919c-.554.434-1.109.87-1.63 1.354a5 5 0 0 0-.588.618c-.084.117-.017.217.084.267c-.37.368-.74.736-1.109 1.12a.2.2 0 0 0-.05.134c0 .05.033.1.067.117l.655.502v.016c.924.92 2.554 2.173 4.285 3.527c.251.201.52.402.773.602c.117.134.234.285.335.418c.05.066.169.084.236.033c.033.034.084.067.118.1a.24.24 0 0 0 .1.034a.15.15 0 0 0 .135-.066a.24.24 0 0 0 .033-.1c.017 0 .017.016.034.016a.2.2 0 0 0 .134-.05l3.058-3.327c.12-.116.014-.267 0-.267m-7.628-.134l-1.546-1.17l-.15-.1c-.035-.017-.068-.05-.102-.067l-.117-.1c.66-.66 1.33-1.308 2-1.956c-.488.484-1.463 1.906-1.261 2.373c.002 0 .018.042.067.084zm4.1 3.126l-1.277-.97a27 27 0 0 0-1.58-1.504c.69.518 1.277.97 1.361 1.053c.673.585.638.485 1.093.87l.554.4c-.074.103-.151.148-.151.151m.336.25l-.034-.016a1 1 0 0 0 .152-.117zM.588 3.476c.033.217.084.435.117.636c.201 1.103.403 2.106.772 2.858l.152.568c.05.217.134.485.219.552a67 67 0 0 0 3.578 2.942a.18.18 0 0 0 .219 0s0 .016.016.016a.15.15 0 0 0 .118.05a.2.2 0 0 0 .134-.05c1.798-1.989 3.142-3.627 4.1-4.998c.068-.066.084-.167.084-.25c.067-.067.118-.151.185-.201c.067-.067.067-.184 0-.235l-.017-.016c0-.033-.017-.084-.05-.1c-.42-.401-.722-.685-1.042-.986a94 94 0 0 1-2.352-2.273c-.017-.017-.034-.034-.067-.034c-.336-.117-1.025-.234-1.882-.385c-1.277-.216-3.008-.517-4.57-.986c0 0-.101 0-.118.017l-.05.05C.05.714.022.707 0 .718c.017.1.017.167.05.284c0 .033.068.301.068.334zm7.19 4.78l-.033.034a.036.036 0 0 1 .033-.034M6.553 2.238c.101.1.521.502.622.585c-.437-.2-1.529-.702-2.034-.869c.505.1 1.194.201 1.412.284M.79 1.403c.252.434.454 1.939.655 3.41c-.118-.469-.201-.936-.302-1.372C.992 2.673.84 1.988.638 1.386c.124 0 .152.021.152.017m-.286-.369c0-.016 0-.033-.017-.033c.085 0 .135.017.202.05c0 .006-.145-.017-.185-.017m23.17-.217c.017-.066-.336-.367-.219-.384c.253-.017.253-.401 0-.401c-.335.017-.688.1-1.008.15c-.587.117-1.192.234-1.78.367a80 80 0 0 0-3.949.937c-.403.117-.857.2-1.243.401c-.135.067-.118.2-.05.284c-.034.017-.051.017-.085.034c-.117.017-.218.034-.335.05c-.102.017-.152.1-.135.2c0 .017.017.05.017.067c-.706.936-1.496 1.923-2.353 2.976c-.84.969-1.73 1.989-2.62 3.042c-2.84 3.31-6.05 7.07-9.594 10.38a.16.16 0 0 0 0 .234c.016.016.033.033.05.033c-.05.05-.101.085-.152.134q-.05.05-.05.1a.4.4 0 0 0-.067.084c-.067.067-.067.184.017.234c.067.066.185.066.235-.017c.017-.017.017-.033.033-.033a.265.265 0 0 1 .37 0c.202.217.404.435.588.618l-.42-.35c-.067-.067-.184-.05-.234.016c-.068.066-.051.184.016.234l4.469 3.727c.034.034.067.034.118.034a.15.15 0 0 0 .117-.05l.101-.1c.017.016.05.016.067.016c.05 0 .084-.016.118-.05c6.049-6.05 10.922-10.614 16.5-14.693c.05-.033.067-.1.067-.15c.067 0 .118-.05.15-.117c1.026-3.125 1.228-5.9 1.295-7.27c0-.059.016-.038.016-.068c.017-.033.017-.05.017-.05a.98.98 0 0 0-.067-.619m-10.82 4.915c.268-.301.537-.619.806-.903c-1.73 2.273-4.603 5.767-8.67 9.929c2.773-3.059 5.562-6.218 7.864-9.026M5.14 23.466c-.016-.017-.016-.017 0-.017zm2.504-2.156c.135-.15.27-.284.42-.434c0 0 0 .016.017.016c-.224.198-.433.418-.437.418m.69-.668c.099-.1.14-.173.284-.318c.992-1.02 2.017-2.04 3.059-3.076l.016-.016c.252-.2.555-.418.824-.619a228 228 0 0 0-4.184 4.029M14.852 3.91c-.554.719-1.176 1.671-1.697 2.423c-1.646 2.374-6.94 8.174-7.057 8.274a1190 1190 0 0 1-4.839 4.597l-.1.1c-.085-.1-.085-.25.016-.334C8.652 11.966 13.19 6.133 15.021 3.576c-.05.116-.084.216-.168.334zm2.906 3.427c-.671-.386-.99-.987-.806-1.572l.05-.2a.8.8 0 0 1 .085-.167a1.9 1.9 0 0 1 .756-.703c.016 0 .033 0 .05-.016c-.017-.034-.017-.084-.017-.134c.017-.1.085-.167.202-.167c.202 0 .824.184 1.059.384c.067.05.134.117.202.184c.084.1.218.268.285.401c.034.017.067.184.118.268c.033.134.067.284.05.418c-.017.016 0 .116-.017.116a1.6 1.6 0 0 1-.218.619c-.03.03.006.012-.05.067a1.2 1.2 0 0 1-.32.334a1.49 1.49 0 0 1-1.26.234a2 2 0 0 0-.169-.066m4.37 1.403c0 .017-.017.05 0 .067c-.034 0-.05.017-.085.034a110 110 0 0 0-3.915 3.025c1.11-.986 2.218-1.989 3.378-2.975c.336-.301.571-.686.638-1.12l.168-1.003v-.033c.085-.201.404-.118.353.1c-.004-.001-.173.795-.537 1.905"})})}function ra(){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:n.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 21v-4m0-4V9m0-4V3m-2 18h4M8 5v4h11l2-2l-2-2zm6 8v4H6l-2-2l2-2z"})})}function aa(){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 20 20",children:n.jsx("path",{fill:"currentColor",d:"M6.5 3a.75.75 0 0 1 .697.471l3 7.5a.75.75 0 0 1-1.393.557L7.992 9.5H5.008l-.811 2.028a.75.75 0 0 1-1.393-.556l3-7.5A.75.75 0 0 1 6.5 3m0 2.77L5.608 8h1.784zm8.28-1.55a.75.75 0 1 0-1.06 1.06l.72.72h-3.69a.75.75 0 0 0 0 1.5h3.69l-.72.72a.75.75 0 0 0 1.06 1.06l2-2a.75.75 0 0 0 0-1.06zm0 7.5a.75.75 0 1 0-1.06 1.06l.72.72H3.75a.75.75 0 0 0 0 1.5h10.69l-.72.72a.75.75 0 1 0 1.06 1.06l2-2a.75.75 0 0 0 0-1.06z"})})}function oa(){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 20 20",children:n.jsx("path",{fill:"currentColor",d:"M13.5 3a.75.75 0 0 0-.697.471l-3 7.5a.75.75 0 0 0 1.393.557l.812-2.028h2.984l.811 2.028a.75.75 0 0 0 1.393-.556l-3-7.5A.75.75 0 0 0 13.5 3m0 2.77L14.392 8h-1.784zM5.22 4.22a.75.75 0 0 1 1.06 1.06L5.56 6h3.69a.75.75 0 0 1 0 1.5H5.56l.72.72a.75.75 0 0 1-1.06 1.06l-2-2a.75.75 0 0 1 0-1.06zm0 7.5a.75.75 0 0 1 1.06 1.06l-.72.72h10.69a.75.75 0 0 1 0 1.5H5.56l.72.72a.75.75 0 1 1-1.06 1.06l-2-2a.75.75 0 0 1 0-1.06z"})})}function sa(){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:n.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",color:"currentColor",children:[n.jsx("path",{d:"M14.86 22h-4.312c-3.291 0-4.937 0-6.08-.798a4.2 4.2 0 0 1-.863-.805c-.855-1.066-.855-2.6-.855-5.67v-2.545c0-2.963 0-4.445.473-5.628c.761-1.903 2.37-3.403 4.41-4.113C8.9 2 10.49 2 13.667 2c1.816 0 2.723 0 3.448.252c1.166.406 2.085 1.263 2.52 2.35c.27.676.27 1.523.27 3.216V10"}),n.jsx("path",{d:"M2.75 12c0-1.84 1.506-3.333 3.364-3.333c.672 0 1.464.116 2.117-.057a1.67 1.67 0 0 0 1.19-1.179c.174-.647.057-1.432.057-2.098C9.478 3.493 10.984 2 12.84 2m.002 16h2.523m-4.949-4.15c-.126-.8-.281-.801-1.61-.85h-1.01c-.557 0-1.009.448-1.009 1v3c0 .552.452 1 1.01 1h1.816c.39 0 .803-.313.803-.7v-1.1c0-.11-.113-.304-.224-.304H9.068M12.842 13h1.261m0 0h1.262m-1.262 0v4.875M21.251 13h-2.523c-.557 0-1.009.448-1.009 1v1.5m0 0V18m0-2.5h2.523"})]})})}function ca(){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 48 48",children:n.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"4",children:[n.jsx("circle",{cx:"10",cy:"24",r:"4"}),n.jsx("circle",{cx:"38",cy:"10",r:"4"}),n.jsx("circle",{cx:"38",cy:"24",r:"4"}),n.jsx("circle",{cx:"38",cy:"38",r:"4"}),n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M34 38H22V10h12M14 24h20"})]})})}function la(){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:n.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"m3 21l7.548-7.548M21 3l-7.548 7.548m0 0L8 3H3l7.548 10.452m2.904-2.904L21 21h-5l-5.452-7.548",color:"currentColor"})})}const Ze={Bold:_.Bold,LoaderCircle:_.LoaderCircle,Italic:_.Italic,Underline:_.Underline,Quote:_.Quote,TextQuote:qr,Strikethrough:_.Strikethrough,Minus:_.Minus,Eraser:_.Eraser,PaintRoller:_.PaintRoller,Redo2:_.Redo2,Undo2:_.Undo2,AlignCenter:Xe.TextAlignCenterIcon,AlignJustify:Xe.TextAlignJustifyIcon,AlignLeft:Xe.TextAlignLeftIcon,AlignRight:Xe.TextAlignRightIcon,ChevronDown:_.ChevronDown,Subscript:_.Subscript,Superscript:_.Superscript,Code:_.Code,Code2:_.CodeXml,Type:_.Type,IndentIncrease:_.IndentIncrease,IndentDecrease:_.IndentDecrease,List:_.List,ListOrdered:_.ListOrdered,ListTodo:_.ListTodo,Link:_.Link,ImageUp:_.ImageUp,Video:_.Video,Maximize:_.Maximize,Minimize:_.Minimize,Table:_.Table,Sparkles:_.Sparkles,Pencil:_.Pencil,Unlink:_.Unlink,BetweenHorizonalEnd:_.BetweenHorizonalEnd,BetweenHorizonalStart:_.BetweenHorizonalStart,BetweenVerticalStart:_.BetweenVerticalStart,BetweenVerticalEnd:_.BetweenVerticalEnd,TableCellsMerge:_.TableCellsMerge,TableCellsSplit:_.TableCellsSplit,Trash2:_.Trash2,Trash:_.Trash,Replace:_.Replace,ChevronsUpDown:_.ChevronsUpDown,LineHeight:Xr,Word:Zr,Heading1:_.Heading1,Heading2:_.Heading2,Heading3:_.Heading3,Heading4:_.Heading4,Heading5:_.Heading5,Heading6:_.Heading6,Columns2:_.Columns2,Columns3:_.Columns3,Columns4:_.Columns4,Plus:_.Plus,Grip:_.GripVertical,Copy:_.Copy,Clipboard:_.Clipboard,PanelLeft:_.PanelLeft,PanelRight:_.PanelRight,Columns:_.Columns2,Iframe:_.Frame,MenuDown:$n,SizeS:Qr,SizeM:Jr,SizeL:Yr,AspectRatio:Wr,Emoji:_.SmilePlus,DeleteColumn:Gr,DeleteRow:Kr,SearchAndReplace:_.Replace,EmojiIcon:_.SmilePlusIcon,KatexIcon:_.Sigma,ExportPdf:Fn,ExportWord:Vn,ImportWord:ea,ColumnAddLeft:ta,ColumnAddRight:na,BookMarked:_.BookMarked,Excalidraw:ia,ZoomIn:_.ZoomIn,ZoomOut:_.ZoomOut,Settings:_.Settings,Eye:_.Eye,TextDirection:ra,LeftToRight:aa,RightToLeft:oa,Attachment:_.Paperclip,GifIcon:sa,ChevronUp:_.ChevronUp,Crop:_.CropIcon,Mermaid:ca,Twitter:la,FlipX:_.FlipVertical,FlipY:_.FlipHorizontal};function da(e){const t=["size-small","size-medium","size-large"],i=["SizeS","SizeM","SizeL"];return t.map((r,a)=>({type:`image-${r}`,component:y,componentProps:{tooltip:b.localeActions.t(`editor.${r.replace("-",".")}.tooltip`),icon:i[a],action:()=>e.commands.updateImage({width:b.IMAGE_SIZE[r]}),isActive:()=>e.isActive("image",{width:b.IMAGE_SIZE[r]})}}))}function ha(e){const t=["size-small","size-medium","size-large"],i=["SizeS","SizeM","SizeL"];return t.map((r,a)=>({type:`image-${r}`,component:y,componentProps:{tooltip:b.localeActions.t(`editor.${r.replace("-",".")}.tooltip`),icon:i[a],action:()=>e.commands.updateImageGif({width:b.IMAGE_SIZE[r]}),isActive:()=>e.isActive("image",{width:b.IMAGE_SIZE[r]})}}))}function ua(e){const t=["left","center","right"],i={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map(r=>({type:`image-${r}`,component:y,componentProps:{tooltip:b.localeActions.t(`editor.textalign.${r}.tooltip`),icon:i[r],action:()=>{var a,o;return(o=(a=e.commands)==null?void 0:a.setAlignImage)==null?void 0:o.call(a,r)},isActive:()=>e.isActive({align:r})||!1,disabled:!1}}))}function ma(e){const t=["left","center","right"],i={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map(r=>({type:`image-${r}`,component:y,componentProps:{tooltip:b.localeActions.t(`editor.textalign.${r}.tooltip`),icon:i[r],action:()=>{var a,o;return(o=(a=e.commands)==null?void 0:a.setAlignImageGif)==null?void 0:o.call(a,r)},isActive:()=>e.isActive({align:r})||!1,disabled:!1}}))}function xa(e){const t=["left","center","right"],i={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map(r=>({type:`image-${r}`,component:y,componentProps:{tooltip:b.localeActions.t(`editor.textalign.${r}.tooltip`),icon:i[r],action:()=>{var a,o;return(o=(a=e.commands)==null?void 0:a.setAlignImageMermaid)==null?void 0:o.call(a,r)},isActive:()=>e.isActive({align:r})||!1,disabled:!1}}))}function fa(e){const t=["size-small","size-medium","size-large"],i=["SizeS","SizeM","SizeL"];return t.map((r,a)=>({type:`video-${r}`,component:y,componentProps:{tooltip:b.localeActions.t(`editor.${r.replace("-",".")}.tooltip`),icon:i[a],action:()=>e.commands.updateVideo({width:b.VIDEO_SIZE[r]}),isActive:()=>e.isActive("video",{width:b.VIDEO_SIZE[r]})}}))}function ga(e){return[{type:"flipX",component:y,componentProps:{editor:e,tooltip:b.localeActions.t("editor.tooltip.flipX"),icon:"FlipX",action:()=>{const t=e.getAttributes("image"),{flipX:i}=t;e.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipX:!i}).run()}}},{type:"flipY",component:y,componentProps:{editor:e,tooltip:b.localeActions.t("editor.tooltip.flipY"),icon:"FlipY",action:()=>{const t=e.getAttributes("image"),{flipY:i}=t;e.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipY:!i}).run()}}},...da(e),...ua(e),{type:"remove",component:y,componentProps:{editor:e,tooltip:b.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:i}=e.view;w.deleteSelection(t,i)}}}]}function ba(e){return[...ha(e),...ma(e),{type:"remove",component:y,componentProps:{editor:e,tooltip:b.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:i}=e.view;w.deleteSelection(t,i)}}}]}function pa(e){return[...xa(e),{type:"edit",component:y,componentProps:{editor:e,tooltip:b.localeActions.t("editor.edit"),icon:"Pencil",action:()=>{}}},{type:"remove",component:y,componentProps:{editor:e,tooltip:b.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:i}=e.view;w.deleteSelection(t,i)}}}]}function _a(e){return[...fa(e),{type:"remove",component:y,componentProps:{editor:e,tooltip:b.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:i}=e.view;w.deleteSelection(t,i)}}}]}function wa(e,t){return b.BUBBLE_TEXT_LIST.reduce((i,r)=>{if(r==="divider"&&i.length>0)return[...i,{type:"divider",component:void 0,componentProps:{}}];const a=e.extensionManager.extensions.find(o=>o.name===r);return a?[...i,a.configure().options.button({editor:e,t,extension:a})]:i},[])}var pe=(e=>(e[e.max=7]="max",e[e.min=0]="min",e[e.more=1]="more",e[e.less=-1]="less",e))(pe||{});function va(e,t,i){return e<t?t:e>i?i:e}function ya(e,t,i,r){const{doc:a,selection:o}=e;if(!a||!o||!(o instanceof w.TextSelection||o instanceof w.AllSelection))return e;const{from:s,to:c}=o;return a.nodesBetween(s,c,(l,h)=>{const u=l.type;return i.includes(u.name)?(e=Tt(e,h,t),!1):!g.isList(l.type.name,r.extensionManager.extensions)}),e}function Tt(e,t,i){if(!e.doc)return e;const r=e.doc.nodeAt(t);if(!r)return e;const s=va((r.attrs.indent||0)+i,0,7);if(s===r.attrs.indent)return e;const c={...r.attrs,indent:s};return e.setNodeMarkup(t,r.type,c,r.marks)}function rn({delta:e,types:t}){return({state:i,dispatch:r,editor:a})=>{const{selection:o}=i;let{tr:s}=i;return s=s.setSelection(o),s=ya(s,e,t,a),s.docChanged?(r&&r(s),!0):!1}}function ja(e){var E,L,M;const{pluginKey:t=g.dragHandlePluginDefaultKey}=e,{t:i}=b.useLocale(),[r,a]=d.useState(null),[o,s]=d.useState(-1),c=d.useRef(null),l=d.useRef(null),[h,u]=d.useState(!1),x=e.editor.extensionManager.extensions.some(C=>C.name==="textAlign"),m=e.editor.extensionManager.extensions.some(C=>C.name==="indent"),f=e.editor.extensionManager.extensions.some(C=>C.name==="clear");d.useEffect(()=>{c.current&&!e.editor.isDestroyed&&(l.current=g.DragHandlePlugin({editor:e.editor,element:c.current,pluginKey:"ContentItemMenu",tippyOptions:{offset:[-2,16],zIndex:99,moveTransition:"transform 0.15s ease-out"},onNodeChange:T}),e.editor.registerPlugin(l.current))},[e.editor,c]);function p(){const C=e.editor.chain();C.setNodeSelection(o).unsetAllMarks(),(r==null?void 0:r.type.name)!=="paragraph"&&C.setParagraph(),C.run()}function v(){e.editor.chain().focus().setNodeSelection(o).run(),document.execCommand("copy")}function N(){e.editor.commands.setNodeSelection(o);const{$anchor:C}=e.editor.state.selection,D=C.node(1)||e.editor.state.selection.node;e.editor.chain().setMeta("hideDragHandle",!0).insertContentAt(o+((r==null?void 0:r.nodeSize)||0),D.toJSON()).run()}function A(C){e.editor.commands.setTextAlign(C)}function k(){const C=Tt(e.editor.state.tr,o,1);C.setMeta("hideDragHandle",!0),e.editor.view.dispatch&&e.editor.view.dispatch(C)}function j(){const C=Tt(e.editor.state.tr,o,-1);e.editor.view.dispatch&&e.editor.view.dispatch(C)}function S(){e.editor.chain().setMeta("hideDragHandle",!0).setNodeSelection(o).deleteSelection().run()}function T(C){C.node&&a(C.node),s(C.pos)}function I(){var C;if(o!==-1){const D=(r==null?void 0:r.nodeSize)||0,z=o+D,H=(r==null?void 0:r.type.name)==="paragraph"&&((C=r==null?void 0:r.content)==null?void 0:C.size)===0,R=H?o+2:z+2;e.editor.chain().command(({dispatch:U,tr:q,state:Ce})=>U?(H?q.insertText("/",o,o+1):q.insert(z,Ce.schema.nodes.paragraph.create(null,[Ce.schema.text("/")])),U(q)):!0).focus(R).run()}}d.useEffect(()=>(h?e.editor.commands.setMeta("lockDragHandle",!0):e.editor.commands.setMeta("lockDragHandle",!1),()=>{e.editor.commands.setMeta("lockDragHandle",!1)}),[h]),d.useEffect(()=>()=>{l.current&&(e.editor.unregisterPlugin(t),l.current=null)},[]),d.useEffect(()=>{var C;(C=e.editor)!=null&&C.isDestroyed&&l.current&&(e.editor.unregisterPlugin(t),l.current=null)},[(E=e.editor)==null?void 0:E.isDestroyed]);const O=C=>{e!=null&&e.disabled||u(C)};return n.jsx("div",{className:`drag-handle [transition-property:top,_left] richtext-ease-in-out richtext-duration-200 ${e==null?void 0:e.className}`,style:{opacity:e!=null&&e.disabled?0:1},ref:c,children:n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-0.5 [transition-property:top,_left] richtext-ease-in-out richtext-duration-200",children:[n.jsx(F,{variant:"ghost",size:"icon",className:"richtext-w-7 richtext-h-7 richtext-cursor-grab",disabled:e==null?void 0:e.disabled,onClick:I,type:"button",children:n.jsx($,{name:"Plus",className:"richtext-text-lg richtext-text-neutral-600 dark:richtext-text-neutral-200"})}),n.jsxs(de,{open:h,onOpenChange:O,children:[n.jsxs("div",{className:"richtext-relative richtext-flex richtext-flex-col",children:[n.jsxs(ze,{children:[n.jsx(Oe,{asChild:!0,disabled:e==null?void 0:e.disabled,children:n.jsx(F,{variant:"ghost",size:"icon",className:"richtext-w-7 richtext-h-7 richtext-cursor-grab richtext-relative richtext-z-[1]",disabled:e==null?void 0:e.disabled,onMouseUp:C=>{C.preventDefault(),!(e!=null&&e.disabled)&&u(!0)},type:"button",children:n.jsx($,{name:"Grip",className:"richtext-text-sm dark:richtext-text-neutral-200 richtext-text-neutral-600"})})}),n.jsx(ye,{children:i("editor.draghandle.tooltip")})]}),n.jsx(he,{className:"richtext-absolute richtext-top-0 richtext-left-0 richtext-w-[28px] richtext-h-[28px] richtext-z-0"})]}),n.jsxs(ce,{className:"richtext-w-48",align:"start",side:"bottom",sideOffset:0,children:[n.jsxs(ne,{onClick:S,className:"richtext-flex richtext-gap-3 focus:richtext-text-red-500 focus:richtext-bg-red-400 hover:richtext-bg-red-400 dark:hover:richtext-text-red-500 richtext-bg-opacity-10 hover:richtext-bg-opacity-20 focus:richtext-bg-opacity-30 dark:hover:richtext-bg-opacity-20",children:[n.jsx($,{name:"Trash2"}),n.jsx("span",{children:i("editor.remove")})]}),f?n.jsxs(ne,{className:"richtext-flex richtext-gap-3",onClick:p,children:[n.jsx($,{name:"PaintRoller"}),n.jsx("span",{children:i("editor.clear.tooltip")})]}):null,n.jsxs(ne,{className:"richtext-flex richtext-gap-3",onClick:v,children:[n.jsx($,{name:"Clipboard"}),n.jsx("span",{children:i("editor.copyToClipboard")})]}),n.jsxs(ne,{className:"richtext-flex richtext-gap-3",onClick:N,children:[n.jsx($,{name:"Copy"}),n.jsx("span",{children:i("editor.copy")})]}),x||m?n.jsx(st,{}):null,x?n.jsxs(Gt,{children:[n.jsxs(yt,{className:"richtext-flex richtext-gap-3",children:[n.jsx($,{name:"AlignCenter"}),n.jsx("span",{children:i("editor.textalign.tooltip")})]}),n.jsx(qt,{children:n.jsxs(jt,{children:[n.jsxs(ne,{className:"richtext-flex richtext-gap-3",onClick:()=>A("left"),children:[n.jsx($,{name:"AlignLeft"}),n.jsx("span",{children:i("editor.textalign.left.tooltip")})]}),n.jsxs(ne,{className:"richtext-flex richtext-gap-3",onClick:()=>A("center"),children:[n.jsx($,{name:"AlignCenter"}),n.jsx("span",{children:i("editor.textalign.center.tooltip")})]}),n.jsxs(ne,{className:"richtext-flex richtext-gap-3",onClick:()=>A("right"),children:[n.jsx($,{name:"AlignRight"}),n.jsx("span",{children:i("editor.textalign.right.tooltip")})]})]})})]}):null,m?n.jsxs(Gt,{children:[n.jsxs(yt,{className:"richtext-flex richtext-gap-3",children:[n.jsx($,{name:"IndentIncrease"}),n.jsx("span",{children:i("editor.indent")})]}),n.jsx(qt,{children:n.jsxs(jt,{children:[n.jsxs(ne,{className:"richtext-flex richtext-gap-3",onClick:k,disabled:((L=r==null?void 0:r.attrs)==null?void 0:L.indent)>=pe.max,children:[n.jsx($,{name:"IndentIncrease"}),n.jsx("span",{children:i("editor.indent.tooltip")})]}),n.jsxs(ne,{className:"richtext-flex richtext-gap-3",onClick:j,disabled:((M=r==null?void 0:r.attrs)==null?void 0:M.indent)<=pe.min,children:[n.jsx($,{name:"IndentDecrease"}),n.jsx("span",{children:i("editor.outdent.tooltip")})]})]})})]}):null]})]})]})})}const ka={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"};function Ca({item:e,disabled:t,editor:i}){var a;const r=e.component;return r?n.jsx(r,{...e.componentProps,editor:i,disabled:t||((a=e==null?void 0:e.componentProps)==null?void 0:a.disabled)}):n.jsx(n.Fragment,{})}function Na(e){const{t,lang:i}=b.useLocale(),r=({editor:o})=>{const{selection:s}=o.view.state,{$from:c,to:l}=s;return c.pos===l?!1:s instanceof w.TextSelection},a=d.useMemo(()=>e.disabled||!(e!=null&&e.editor)?[]:wa(e.editor,t),[e.disabled,e.editor,i,t]);return n.jsx(g.BubbleMenu,{shouldShow:r,editor:e==null?void 0:e.editor,tippyOptions:ka,children:a!=null&&a.length?n.jsx("div",{className:"richtext-w-auto richtext-px-3 richtext-py-2 richtext-transition-all !richtext-border richtext-rounded-sm richtext-shadow-sm richtext-pointer-events-auto richtext-select-none richtext-border-neutral-200 dark:richtext-border-neutral-800 richtext-bg-background",children:n.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-[4px] richtext-flex-nowrap richtext-whitespace-nowrap richtext-h-[26px] richtext-justify-start richtext-relative",children:a==null?void 0:a.map((o,s)=>(o==null?void 0:o.type)==="divider"?n.jsx(ie,{orientation:"vertical",className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]"},`bubbleMenu-divider-${s}`):n.jsx(Ca,{item:o,disabled:e.disabled,editor:e.editor},`bubbleMenu-text-${s}`))})}):n.jsx(n.Fragment,{})})}function Sa({fill:e}){return n.jsx("svg",{width:"18px",height:"18px",viewBox:"0 0 256 256",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:n.jsx("g",{id:"icon/填充色",stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd",children:n.jsxs("g",{id:"icon/背景颜色",children:[n.jsx("g",{id:"编组",fill:"currentColor",children:n.jsxs("g",{transform:"translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)",id:"矩形",children:[n.jsx("path",{d:"M100.946943,60.8084699 L43.7469427,60.8084699 C37.2852111,60.8084699 32.0469427,66.0467383 32.0469427,72.5084699 L32.0469427,118.70847 C32.0469427,125.170201 37.2852111,130.40847 43.7469427,130.40847 L100.946943,130.40847 C107.408674,130.40847 112.646943,125.170201 112.646943,118.70847 L112.646943,72.5084699 C112.646943,66.0467383 107.408674,60.8084699 100.946943,60.8084699 Z M93.646,79.808 L93.646,111.408 L51.046,111.408 L51.046,79.808 L93.646,79.808 Z",fillRule:"nonzero"}),n.jsx("path",{d:"M87.9366521,16.90916 L87.9194966,68.2000001 C87.9183543,69.4147389 86.9334998,70.399264 85.7187607,70.4 L56.9423078,70.4 C55.7272813,70.4 54.7423078,69.4150264 54.7423078,68.2 L54.7423078,39.4621057 C54.7423078,37.2523513 55.5736632,35.1234748 57.0711706,33.4985176 L76.4832996,12.4342613 C78.9534987,9.75382857 83.1289108,9.5834005 85.8093436,12.0535996 C87.1658473,13.303709 87.9372691,15.0644715 87.9366521,16.90916 Z",fillRule:"evenodd"}),n.jsx("path",{d:"M131.3,111.241199 L11.7,111.241199 C5.23826843,111.241199 0,116.479467 0,122.941199 L0,200.541199 C0,207.002931 5.23826843,212.241199 11.7,212.241199 L131.3,212.241199 C137.761732,212.241199 143,207.002931 143,200.541199 L143,122.941199 C143,116.479467 137.761732,111.241199 131.3,111.241199 Z M124,130.241 L124,193.241 L19,193.241 L19,130.241 L124,130.241 Z",fillRule:"nonzero"})]})}),n.jsx("path",{d:"M51,218 L205,218 C211.075132,218 216,222.924868 216,229 C216,235.075132 211.075132,240 205,240 L51,240 C44.9248678,240 40,235.075132 40,229 C40,222.924868 44.9248678,218 51,218 Z",id:"矩形",fill:e||"#FBDE28"})]})})})}function Un(e){const[t,i]=d.useState(void 0);function r(s){var c;(c=e.action)==null||c.call(e,s)}function a(){var s;(s=e.action)==null||s.call(e,t)}const o=d.useCallback(w.debounce(s=>{i(s)},350),[]);return n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-h-[32px]",children:[n.jsx(y,{tooltip:e==null?void 0:e.tooltip,disabled:e==null?void 0:e.disabled,action:a,tooltipOptions:e==null?void 0:e.tooltipOptions,shortcutKeys:e==null?void 0:e.shortcutKeys,children:n.jsx("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-text-sm",children:n.jsx(Sa,{fill:t})})}),n.jsx(Hn,{selectedColor:t,setSelectedColor:o,onChange:r,highlight:!0,disabled:e==null?void 0:e.disabled,children:n.jsx(F,{variant:"ghost",size:"icon",className:"!richtext-w-3 !richtext-h-[32px]",disabled:e==null?void 0:e.disabled,children:n.jsx($,{className:"!richtext-w-3 !richtext-h-3 richtext-text-zinc-500",name:"MenuDown"})})})]})}function Ta({editor:e,disabled:t}){var v,N,A,k,j,S,T,I,O,E,L,M,C,D,z,H,R,U;const i=({editor:q})=>g.isActive(q.view.state,"table"),{t:r}=b.useLocale();function a(){e.chain().focus().addColumnBefore().run()}function o(){e.chain().focus().addColumnAfter().run()}function s(){e.chain().focus().deleteColumn().run()}function c(){e.chain().focus().addRowBefore().run()}function l(){e.chain().focus().addRowAfter().run()}function h(){e.chain().focus().deleteRow().run()}function u(){e.chain().focus().mergeCells().run()}function x(){e==null||e.chain().focus().splitCell().run()}function m(){e.chain().focus().deleteTable().run()}function f(q){e.chain().focus().setTableCellBackground(q).run()}const p=()=>{var Ut;const{view:q,state:{selection:{from:Ce}}}=e,oe=q.domAtPos(Ce).node;if(!oe)return new DOMRect(-1e3,-1e3,0,0);const Vt=(Ut=oe==null?void 0:oe.closest)==null?void 0:Ut.call(oe,".tableWrapper");return Vt?Vt.getBoundingClientRect():new DOMRect(-1e3,-1e3,0,0)};return n.jsx(g.BubbleMenu,{editor:e,pluginKey:"table",shouldShow:i,updateDelay:0,tippyOptions:{offset:[0,8],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},maxWidth:"auto",getReferenceClientRect:p,plugins:[rt.sticky],sticky:"popper"},children:t?n.jsx(n.Fragment,{}):n.jsxs("div",{className:"richtext-min-w-32 richtext-flex richtext-flex-row richtext-h-full richtext-items-center richtext-leading-none richtext-gap-0.5 richtext-p-2 richtext-w-full richtext-bg-background richtext-rounded-lg richtext-shadow-sm !richtext-border richtext-border-border",children:[n.jsx(y,{icon:"BetweenHorizonalEnd",tooltip:r("editor.table.menu.insertColumnBefore"),action:a,"tooltip-options":{sideOffset:15},disabled:!((N=(v=e==null?void 0:e.can())==null?void 0:v.addColumnBefore)!=null&&N.call(v))}),n.jsx(y,{icon:"BetweenHorizonalStart",tooltip:r("editor.table.menu.insertColumnAfter"),action:o,"tooltip-options":{sideOffset:15},disabled:!((k=(A=e==null?void 0:e.can())==null?void 0:A.addColumnAfter)!=null&&k.call(A))}),n.jsx(y,{icon:"DeleteColumn",action:s,tooltip:r("editor.table.menu.deleteColumn"),"tooltip-options":{sideOffset:15},disabled:!((S=e==null?void 0:(j=e.can()).deleteColumn)!=null&&S.call(j))}),n.jsx(ie,{orientation:"vertical",className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]"}),n.jsx(y,{icon:"BetweenVerticalEnd",action:c,tooltip:r("editor.table.menu.insertRowAbove"),"tooltip-options":{sideOffset:15},disabled:!((I=e==null?void 0:(T=e.can()).addRowBefore)!=null&&I.call(T))}),n.jsx(y,{icon:"BetweenVerticalStart",action:l,tooltip:r("editor.table.menu.insertRowBelow"),"tooltip-options":{sideOffset:15},disabled:!((E=(O=e==null?void 0:e.can())==null?void 0:O.addRowAfter)!=null&&E.call(O))}),n.jsx(y,{icon:"DeleteRow",action:h,tooltip:r("editor.table.menu.deleteRow"),"tooltip-options":{sideOffset:15},disabled:!((M=(L=e==null?void 0:e.can())==null?void 0:L.deleteRow)!=null&&M.call(L))}),n.jsx(ie,{orientation:"vertical",className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]"}),n.jsx(y,{icon:"TableCellsMerge",action:u,tooltip:r("editor.table.menu.mergeCells"),"tooltip-options":{sideOffset:15},disabled:!((D=(C=e==null?void 0:e.can())==null?void 0:C.mergeCells)!=null&&D.call(C))}),n.jsx(y,{icon:"TableCellsSplit",action:x,tooltip:r("editor.table.menu.splitCells"),"tooltip-options":{sideOffset:15},disabled:!((H=(z=e==null?void 0:e.can())==null?void 0:z.splitCell)!=null&&H.call(z))}),n.jsx(ie,{orientation:"vertical",className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]"}),n.jsx(Un,{editor:e,tooltip:r("editor.table.menu.setCellsBgColor"),action:f,tooltipOptions:{sideOffset:15}}),n.jsx(y,{icon:"Trash2",tooltip:r("editor.table.menu.deleteTable"),action:m,"tooltip-options":{sideOffset:15},disabled:!((U=(R=e==null?void 0:e.can())==null?void 0:R.deleteTable)!=null&&U.call(R))})]})})}function Wn(e){const{t}=b.useLocale(),[i,r]=d.useState({text:"",link:""}),[a,o]=d.useState(!1);d.useEffect(()=>{var c;if(e!=null&&e.editor){const{href:l,target:h}=(c=e.editor)==null?void 0:c.getAttributes("link"),{from:u,to:x}=e.editor.state.selection,m=e.editor.state.doc.textBetween(u,x," ");r({link:l,text:m}),o(h==="_blank")}},[e==null?void 0:e.editor]);function s(c){c.preventDefault(),c.stopPropagation(),e==null||e.onSetLink(i.link,i.text,a)}return n.jsx("div",{className:"richtext-p-2 richtext-bg-white !richtext-border richtext-rounded-lg richtext-shadow-sm dark:richtext-bg-black border-neutral-200 dark:richtext-border-neutral-800",children:n.jsxs("form",{className:"richtext-flex richtext-flex-col richtext-gap-2",onSubmit:s,children:[n.jsx(X,{className:"mb-[6px]",children:t("editor.link.dialog.text")}),n.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5 richtext-mb-[10px]",children:n.jsx("div",{className:"richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm",children:n.jsx(Z,{type:"text",value:i.text,required:!0,className:"richtext-w-80",placeholder:"Text",onChange:c=>r({...i,text:c.target.value})})})}),n.jsx(X,{className:"mb-[6px]",children:t("editor.link.dialog.link")}),n.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:n.jsxs("div",{className:"richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm",children:[n.jsx(Z,{type:"url",value:i.link,required:!0,className:"richtext-pl-10",onChange:c=>r({...i,link:c.target.value})}),n.jsx("span",{className:"richtext-absolute richtext-inset-y-0 richtext-flex richtext-items-center richtext-justify-center richtext-px-2 richtext-start-0",children:n.jsx($,{className:"richtext-size-5 richtext-text-muted-foreground",name:"Link"})})]})}),n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-space-x-2",children:[n.jsx(X,{children:t("editor.link.dialog.openInNewTab")}),n.jsx(Ht,{checked:a,onCheckedChange:c=>{o(c)}})]}),n.jsx(F,{type:"submit",className:"richtext-self-end richtext-mt-2",children:t("editor.link.dialog.button.apply")})]})})}function Aa(e){const{t}=b.useLocale();return n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-p-2 richtext-bg-white !richtext-border richtext-rounded-lg richtext-shadow-sm dark:richtext-bg-black richtext-border-neutral-200 dark:richtext-border-neutral-800",children:[n.jsx("a",{href:e==null?void 0:e.link,target:"_blank",rel:"noopener noreferrer",className:"richtext-text-sm richtext-underline richtext-break-all",children:w.truncate(e==null?void 0:e.link,{length:50,omission:"…"})}),(e==null?void 0:e.link)&&n.jsx(ie,{orientation:"vertical",className:"!richtext-h-4"}),n.jsxs("div",{className:"richtext-flex richtext-flex-nowrap",children:[n.jsx(y,{icon:"Pencil",tooltip:t("editor.link.edit.tooltip"),action:()=>{e==null||e.onEdit()},tooltipOptions:{sideOffset:15}}),n.jsx(y,{icon:"Unlink",tooltip:t("editor.link.unlink.tooltip"),action:()=>{e==null||e.onClear()},tooltipOptions:{sideOffset:15}})]})]})}function La({editor:e,disabled:t}){const[i,r]=d.useState(!1),a=d.useMemo(()=>{const{href:l}=e.getAttributes("link");return l},[e]),o=d.useCallback(({editor:l})=>l.isActive("link"),[]),s=(l,h,u)=>{e.chain().extendMarkRange("link").insertContent({type:"text",text:h,marks:[{type:"link",attrs:{href:l,target:u?"_blank":""}}]}).setLink({href:l}).focus().run(),r(!1)},c=d.useCallback(()=>{e.chain().extendMarkRange("link").unsetLink().focus().run(),r(!1)},[e]);return n.jsx(n.Fragment,{children:n.jsx(g.BubbleMenu,{editor:e,shouldShow:o,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{r(!1)}},children:t?n.jsx(n.Fragment,{}):n.jsx(n.Fragment,{children:i?n.jsx(Wn,{onSetLink:s,editor:e}):n.jsx(Aa,{editor:e,onClear:c,onEdit:()=>{r(!0)},link:a})})})})}const Bt={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"};function $t({item:e,disabled:t,editor:i}){var a;const r=e.component;return r?n.jsx(d.Fragment,{children:e.type==="divider"?n.jsx(ie,{orientation:"vertical",className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]"}):n.jsx(r,{...e.componentProps,editor:i,disabled:t||((a=e==null?void 0:e.componentProps)==null?void 0:a.disabled)})}):n.jsx(n.Fragment,{})}function Ma(e){return e.type.name==="image"}function Ea(e){return e.type.name===Ft.name}function Ia(e){return e.type.name==="video"}function Ra(e){const{lang:t}=b.useLocale(),i=({editor:a})=>{const{selection:o}=a.view.state,{$from:s,to:c}=o;let l=!1;return a.view.state.doc.nodesBetween(s.pos,c,h=>{if(Ma(h))return l=!0,!1}),l},r=d.useMemo(()=>e.disabled?[]:ga(e.editor),[e.disabled,e.editor,t]);return n.jsx(n.Fragment,{children:n.jsx(g.BubbleMenu,{shouldShow:i,editor:e==null?void 0:e.editor,tippyOptions:Bt,children:r!=null&&r.length?n.jsx("div",{className:"richtext-w-auto richtext-px-3 richtext-py-2 richtext-transition-all !richtext-border richtext-rounded-sm richtext-shadow-sm richtext-pointer-events-auto richtext-select-none richtext-border-neutral-200 dark:richtext-border-neutral-800 richtext-bg-background",children:n.jsx("div",{className:"richtext-flex richtext-items-center richtext-flex-nowrap richtext-whitespace-nowrap richtext-h-[26px] richtext-justify-start richtext-relative",children:r==null?void 0:r.map((a,o)=>n.jsx($t,{item:a,disabled:e.disabled,editor:e.editor},`bubbleMenu-image-${o}`))})}):n.jsx(n.Fragment,{})})})}function Ha(e){const{lang:t}=b.useLocale(),i=({editor:a})=>{const{selection:o}=a.view.state,{$from:s,to:c}=o;let l=!1;return a.view.state.doc.nodesBetween(s.pos,c,h=>{if(Ea(h))return l=!0,!1}),l},r=d.useMemo(()=>e.disabled?[]:ba(e.editor),[e.disabled,e.editor,t]);return n.jsx(n.Fragment,{children:n.jsx(g.BubbleMenu,{shouldShow:i,editor:e==null?void 0:e.editor,tippyOptions:Bt,children:r!=null&&r.length?n.jsx("div",{className:"richtext-w-auto richtext-px-3 richtext-py-2 richtext-transition-all !richtext-border richtext-rounded-sm richtext-shadow-sm richtext-pointer-events-auto richtext-select-none richtext-border-neutral-200 dark:richtext-border-neutral-800 richtext-bg-background",children:n.jsx("div",{className:"richtext-flex richtext-items-center richtext-flex-nowrap richtext-whitespace-nowrap richtext-h-[26px] richtext-justify-start richtext-relative",children:r==null?void 0:r.map((a,o)=>n.jsx($t,{item:a,disabled:e.disabled,editor:e.editor},`bubbleMenu-image-gif-${o}`))})}):n.jsx(n.Fragment,{})})})}function za(e){const{lang:t}=b.useLocale(),i=({editor:a})=>{const{selection:o}=a.view.state,{$from:s,to:c}=o;let l=!1;return a.view.state.doc.nodesBetween(s.pos,c,h=>{if(Ia(h))return l=!0,!1}),l},r=d.useMemo(()=>e.disabled?[]:_a(e.editor),[e.editor,e.disabled,t]);return n.jsx(n.Fragment,{children:n.jsx(g.BubbleMenu,{shouldShow:i,editor:e==null?void 0:e.editor,tippyOptions:Bt,children:r!=null&&r.length?n.jsx("div",{className:"richtext-w-auto richtext-px-3 richtext-py-2 richtext-transition-all !richtext-border richtext-rounded-sm richtext-shadow-sm richtext-pointer-events-auto richtext-select-none richtext-border-neutral-200 dark:richtext-border-neutral-800 richtext-bg-background",children:n.jsx("div",{className:"richtext-flex richtext-items-center richtext-flex-nowrap richtext-whitespace-nowrap richtext-h-[26px] richtext-justify-start richtext-relative",children:r==null?void 0:r.map((a,o)=>n.jsx($t,{item:a,disabled:e.disabled,editor:e.editor},`bubbleMenu-video-${o}`))})}):n.jsx(n.Fragment,{})})})}function Oa({editor:e}){const{t}=b.useLocale(),i=d.useCallback(()=>e.isActive(Ie.name),[e]),r=d.useCallback(()=>He(Ie.name,e),[e]),a=d.useCallback(()=>e.chain().focus().addColBefore().run(),[e]),o=d.useCallback(()=>e.chain().focus().addColAfter().run(),[e]),s=d.useCallback(()=>e.chain().focus().deleteCol().run(),[e]);return n.jsx(g.BubbleMenu,{pluginKey:"columns-bubble-menu",editor:e,shouldShow:i,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999},children:n.jsxs("div",{className:"richtext-w-auto richtext-px-3 richtext-py-2 richtext-transition-all !richtext-border richtext-rounded-sm richtext-shadow-sm richtext-pointer-events-auto richtext-select-none richtext-border-neutral-200 dark:richtext-border-neutral-800 richtext-bg-background",children:[n.jsx(y,{action:a,icon:"ColumnAddLeft",tooltip:t("editor.table.menu.insertColumnBefore")}),n.jsx(y,{action:o,icon:"ColumnAddRight",tooltip:t("editor.table.menu.insertColumnAfter")}),n.jsx(y,{action:s,icon:"DeleteColumn",tooltip:t("editor.table.menu.deleteColumn")}),n.jsx(y,{action:r,icon:"Trash2",tooltip:t("editor.table.menu.delete_column")})]})})}const Pa=g.Bold.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:i})=>({component:y,componentProps:{action:()=>t.commands.toggleBold(),isActive:()=>t.isActive("bold")||!1,disabled:!t.can().toggleBold(),icon:"Bold",shortcutKeys:["mod","B"],tooltip:i("editor.bold.tooltip")}})}}}),Da=g.Italic.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:i}){return{component:y,componentProps:{action:()=>t.commands.toggleItalic(),isActive:()=>t.isActive("italic")||!1,disabled:!t.can().toggleItalic(),shortcutKeys:["mod","I"],icon:"Italic",tooltip:i("editor.italic.tooltip")}}}}}}),Ba=g.Underline.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:i}){return{component:y,componentProps:{action:()=>t.commands.toggleUnderline(),isActive:()=>t.isActive("underline")||!1,disabled:!t.can().toggleUnderline(),icon:"Underline",shortcutKeys:["mod","U"],tooltip:i("editor.underline.tooltip")}}}}}}),$a=g.Strike.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:i})=>({component:y,componentProps:{action:()=>t.commands.toggleStrike(),isActive:()=>t.isActive("strike")||!1,disabled:!t.can().toggleStrike(),icon:"Strikethrough",shortcutKeys:["shift","mod","X"],tooltip:i("editor.strike.tooltip")}})}}}),Fa=g.Code.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:i})=>({component:y,componentProps:{action:()=>t.commands.toggleCode(),isActive:()=>t.isActive("code")||!1,disabled:!t.can().toggleCode(),icon:"Code",shortcutKeys:["mod","E"],tooltip:i("editor.code.tooltip")}})}}});let ae,Be;const ft=new Set,gt=new Set;function Va(){return ae}function Ua(e){if(!ae&&!Be){const t=e.themes.filter(r=>!!r&&r in Ve.bundledThemes),i=e.languages.filter(r=>!!r&&r in Ve.bundledLanguages);return Be=Ve.createHighlighter({themes:t,langs:i}).then(r=>{ae=r}),Be}if(Be)return Be}async function qn(e){return ae&&!ae.getLoadedThemes().includes(e)&&!gt.has(e)&&e in Ve.bundledThemes?(gt.add(e),await ae.loadTheme(e),gt.delete(e),!0):!1}async function Gn(e){return ae&&!ae.getLoadedLanguages().includes(e)&&!ft.has(e)&&e in Ve.bundledLanguages?(ft.add(e),await ae.loadLanguage(e),ft.delete(e),!0):!1}async function Wa({doc:e,name:t,defaultTheme:i,defaultLanguage:r}){const a=g.findChildren(e,c=>c.type.name===t),o=[...a.map(c=>c.node.attrs.theme),i],s=[...a.map(c=>c.node.attrs.language),r];ae?await Promise.all([...o.flatMap(c=>qn(c)),...s.flatMap(c=>!!c&&Gn(c))]):await Ua({languages:s,themes:o})}function an({doc:e,name:t,defaultTheme:i,defaultLanguage:r}){const a=[];return g.findChildren(e,s=>s.type.name===t).forEach(s=>{let c=s.pos+1,l=s.node.attrs.language||r;const h=s.node.attrs.theme||i,u=Va();if(!u)return;u.getLoadedLanguages().includes(l)||(l="plaintext");const x=u.getLoadedThemes().includes(h)?h:u.getLoadedThemes()[0],m=u.codeToTokensBase(s.node.textContent,{lang:l,theme:x});for(const f of m){for(const p of f){const v=c+p.content.length,N=w.Decoration.inline(c,v,{style:`color: ${p.color}`});a.push(N),c=v}c+=1}}),w.DecorationSet.create(e,a)}function qa({name:e,defaultLanguage:t,defaultTheme:i}){const r=new w.Plugin({key:new w.PluginKey("shiki"),view(a){class o{constructor(){this.initDecorations()}update(){this.checkUndecoratedBlocks()}destroy(){}async initDecorations(){const c=a.state.doc;await Wa({doc:c,name:e,defaultLanguage:t,defaultTheme:i});const l=a.state.tr.setMeta("shikiPluginForceDecoration",!0);a.dispatch(l)}async checkUndecoratedBlocks(){const c=g.findChildren(a.state.doc,u=>u.type.name===e);if((await Promise.all(c.flatMap(u=>[qn(u.node.attrs.theme),Gn(u.node.attrs.language)]))).includes(!0)){const u=a.state.tr.setMeta("shikiPluginForceDecoration",!0);a.dispatch(u)}}}return new o},state:{init:(a,{doc:o})=>an({doc:o,name:e,defaultLanguage:t,defaultTheme:i}),apply:(a,o,s,c)=>{const l=s.selection.$head.parent.type.name,h=c.selection.$head.parent.type.name,u=g.findChildren(s.doc,f=>f.type.name===e),x=g.findChildren(c.doc,f=>f.type.name===e),m=a.docChanged&&([l,h].includes(e)||x.length!==u.length||a.steps.some(f=>f.from!==void 0&&f.to!==void 0&&u.some(p=>p.pos>=f.from&&p.pos+p.node.nodeSize<=f.to)));return a.getMeta("shikiPluginForceDecoration")||m?an({doc:a.doc,name:e,defaultLanguage:t,defaultTheme:i}):o.map(a.mapping,a.doc)}},props:{decorations(a){return r.getState(a)}}});return r}function Ga({action:e,languages:t,...i}){const r=o=>{e(o)},a=d.useMemo(()=>t==null?void 0:t.map(o=>({title:b.MAP_LANGUAGE_CODE_LABELS[o]||o,language:o})),[t]);return n.jsxs(de,{children:[n.jsx(he,{disabled:i==null?void 0:i.disabled,asChild:!0,children:n.jsx(y,{tooltip:i==null?void 0:i.tooltip,disabled:i==null?void 0:i.disabled,icon:i==null?void 0:i.icon})}),n.jsx(ce,{className:"richtext-w-full !richtext-max-h-[180px] !richtext-overflow-y-scroll",children:a==null?void 0:a.map(o=>n.jsx(ne,{onClick:()=>r(o.language),children:n.jsx("div",{className:"richtext-h-full richtext-ml-1",children:o.title})},`codeblock-${o.title}`))})]})}const Ka="_wrap_134f4_1",Za="_maxHeight_134f4_10",Xa="_btnCopy_134f4_13",Ya="_btnDelete_134f4_14",Ja="_blockInfo_134f4_18",Qa="_blockInfoEditable_134f4_28",eo="_selectLang_134f4_32",to="_copied_134f4_58",le={wrap:Ka,maxHeight:Za,btnCopy:Xa,btnDelete:Ya,blockInfo:Ja,blockInfoEditable:Qa,selectLang:eo,"richtext-SelectContent":"_richtext-SelectContent_134f4_46",copied:to};function no(){const[e,t]=d.useState(!1);return{isCopied:e,copyToClipboard:async r=>{try{await navigator.clipboard.writeText(r),t(!0),setTimeout(()=>t(!1),2e3)}catch(a){console.error("Failed to copy text: ",a),t(!1)}}}}function io({editor:e,node:{attrs:t},updateAttributes:i,extension:r}){var m,f;const{isCopied:a,copyToClipboard:o}=no(),s=d.useMemo(()=>{var p;return(p=r.options.languages)!=null&&p.length?r.options.languages:b.DEFAULT_LANGUAGE_CODE_BLOCK},[r.options.languages]),c=lt(),l=(f=(m=e==null?void 0:e.options)==null?void 0:m.editorProps)==null?void 0:f.print,{language:h}=t,u=d.useRef(),x=d.useCallback(()=>He(Kn.name,e),[e]);return n.jsxs(g.NodeViewWrapper,{className:w.clsx(le.wrap,!l&&le.maxHeight,"render-wrapper"),children:[n.jsxs("div",{className:w.clsx(le.blockInfo,{[le.blockInfoEditable]:!c}),children:[n.jsx("span",{onClick:()=>o(u.current.innerText),className:w.clsx(le.btnCopy,a&&le.copied),children:a?n.jsx(_.CopyCheck,{size:16}):n.jsx(_.Copy,{size:16})}),n.jsx("span",{onClick:x,className:le.btnDelete,children:n.jsx($,{name:"Trash2"})}),n.jsx("div",{className:le.selectLang,children:n.jsxs(Ei,{defaultValue:h||"auto",disabled:!c,onValueChange:p=>i({language:p}),children:[n.jsx(wn,{children:n.jsx(Ii,{placeholder:"Language"})}),n.jsxs(jn,{className:"richtext-max-h-60 richtext-overflow-y-auto",children:[n.jsx(kt,{value:"auto",children:"Auto"}),s.map((p,v)=>n.jsx(kt,{value:p,children:p.charAt(0).toUpperCase()+p.slice(1)},`code-lang-${v}`))]})]})})]}),n.jsx("pre",{ref:u,children:n.jsx(g.NodeViewContent,{as:"code"})})]})}const Kn=g.CodeBlock.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),languages:[],button:({editor:t,t:i,extension:r})=>{var o,s,c;const a=(s=(o=r==null?void 0:r.options)==null?void 0:o.languages)!=null&&s.length?(c=r==null?void 0:r.options)==null?void 0:c.languages:b.DEFAULT_LANGUAGE_CODE_BLOCK;return{component:Ga,componentProps:{action:(l="js")=>t.commands.setCodeBlock({language:l}),isActive:()=>t.isActive("codeBlock")||!1,disabled:!t.can().toggleCodeBlock(),icon:"Code2",tooltip:i("editor.codeblock.tooltip"),languages:a}}}}},addNodeView(){return g.ReactNodeViewRenderer(io)},addProseMirrorPlugins(){var e;return[...((e=this.parent)==null?void 0:e.call(this))||[],qa({name:this.name,defaultLanguage:null,defaultTheme:this.options.defaultTheme})]}});function ro(e){var a,o,s;const{t,lang:i}=b.useLocale(),r=d.useMemo(()=>{var h;const c=(h=e==null?void 0:e.items)==null?void 0:h.find(u=>u.isActive());return c&&!c.default?{...c}:{title:e.tooltip,font:t("editor.fontFamily.default.tooltip"),isActive:()=>!1,disabled:!1,action:()=>e.editor.chain().focus().unsetFontFamily().run()}},[t,i,e]);return n.jsxs(de,{children:[n.jsx(he,{disabled:e==null?void 0:e.disabled,asChild:!0,children:n.jsx(Rt,{title:((a=r==null?void 0:r.font)==null?void 0:a.length)>7?`${(o=r==null?void 0:r.font)==null?void 0:o.slice(0,6)}...`:r==null?void 0:r.font,tooltip:e==null?void 0:e.tooltip,disabled:e==null?void 0:e.disabled,icon:"MenuDown"})}),n.jsx(ce,{className:"richtext-w-full",children:(s=e==null?void 0:e.items)==null?void 0:s.map((c,l)=>{const h=c.font===t("editor.fontFamily.default.tooltip")?{}:{fontFamily:c.font};return n.jsxs(d.Fragment,{children:[n.jsx(ve,{checked:(r==null?void 0:r.font)===c.font,onClick:c.action,children:n.jsx("div",{className:"richtext-h-full richtext-ml-1",style:h,children:c.font})}),c.font===t("editor.fontFamily.default.tooltip")&&n.jsx(st,{})]},`font-family-${l}`)})})]})}const ao=g.FontFamily.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),fontFamilyList:b.DEFAULT_FONT_FAMILY_LIST,button({editor:t,extension:i,t:r}){var h;const{extensions:a=[]}=t.extensionManager??[],o=Ct(((h=i==null?void 0:i.options)==null?void 0:h.fontFamilyList)||[]),s=a.find(u=>u.name==="base-kit"),c=o.map(u=>({action:()=>{t.chain().focus().setFontFamily(u.value).run()},isActive:()=>t.isActive("textStyle",{fontFamily:u.value})||!1,disabled:!t.can().setFontFamily(u.value),title:u.name,font:u.value}));s&&s.options.textStyle!==!1&&c.unshift({action:()=>t.chain().focus().unsetFontFamily().run(),isActive:()=>!1,disabled:!1,font:r("editor.fontFamily.default.tooltip"),title:r("editor.fontFamily.tooltip")});const l=c.filter(u=>u.disabled).length===c.length;return{component:ro,componentProps:{tooltip:r("editor.fontFamily.tooltip"),disabled:l,items:c,editor:t}}}}}});function oo(e){var i;const t=d.useMemo(()=>{var o;const r=(o=e==null?void 0:e.items)==null?void 0:o.find(s=>s.isActive());return r&&!r.default?{...r}:{title:e.tooltip,level:0,isActive:()=>!1}},[e]);return n.jsxs(de,{children:[n.jsx(he,{disabled:e==null?void 0:e.disabled,asChild:!0,children:n.jsx(Rt,{title:t==null?void 0:t.title,tooltip:e==null?void 0:e.tooltip,disabled:e==null?void 0:e.disabled,icon:"MenuDown"})}),n.jsx(ce,{className:"richtext-w-full",children:(i=e==null?void 0:e.items)==null?void 0:i.map((r,a)=>{var o,s;return n.jsxs(d.Fragment,{children:[n.jsxs(ve,{checked:(t==null?void 0:t.title)===r.title,onClick:r.action,children:[n.jsx("div",{className:`richtext-ml-1 richtext-h-full heading-${r.level}`,children:r.title}),!!((o=r==null?void 0:r.shortcutKeys)!=null&&o.length)&&n.jsx(_n,{className:"richtext-pl-4",children:(s=r==null?void 0:r.shortcutKeys)==null?void 0:s.map(c=>at(c)).join(" ")})]}),r.level===0&&n.jsx(st,{})]},`heading-k-${a}`)})})]})}const so=g.Heading.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),levels:[1,2,3,4,5,6],button({editor:t,extension:i,t:r}){var h;const{extensions:a=[]}=t.extensionManager??[],o=((h=i.options)==null?void 0:h.levels)||[],s=a.find(u=>u.name==="base-kit"),c=o.map(u=>({action:()=>t.commands.toggleHeading({level:u}),isActive:()=>t.isActive("heading",{level:u})||!1,disabled:!t.can().toggleHeading({level:u}),title:r(`editor.heading.h${u}.tooltip`),level:u,shortcutKeys:["alt","mod",`${u}`]}));s&&s.options.paragraph!==!1&&c.unshift({action:()=>t.commands.setParagraph(),isActive:()=>t.isActive("paragraph")||!1,disabled:!t.can().setParagraph(),level:0,title:r("editor.paragraph.tooltip"),shortcutKeys:["alt","mod","0"]});const l=c.filter(u=>u.disabled).length===c.length;return{component:oo,componentProps:{tooltip:r("editor.heading.tooltip"),disabled:l,items:c,editor:t}}}}}});function co(e){var i;const t=d.useMemo(()=>{var o;const r=(o=e==null?void 0:e.items)==null?void 0:o.find(s=>s.isActive());return r&&!r.default?{...r,icon:r.icon?r.icon:e.icon}:{title:e==null?void 0:e.tooltip,icon:e.icon,isActive:()=>!1}},[e]);return n.jsxs(ee,{modal:!0,children:[n.jsx(te,{disabled:e==null?void 0:e.disabled,asChild:!0,children:n.jsx(y,{customClass:"!richtext-w-12 richtext-h-12",icon:e==null?void 0:e.icon,tooltip:e==null?void 0:e.tooltip,disabled:e==null?void 0:e.disabled,children:n.jsx($,{className:"richtext-w-3 richtext-h-3 richtext-ml-1 richtext-text-zinc-500",name:"MenuDown"})})}),n.jsx(Y,{className:"richtext-min-w-4 richtext-w-full !richtext-p-[4px] richtext-flex richtext-flex-row richtext-gap-1",align:"start",side:"bottom",children:(i=e==null?void 0:e.items)==null?void 0:i.map((r,a)=>{var o,s;return n.jsxs(ze,{children:[n.jsx(Oe,{asChild:!0,children:n.jsx(Ke,{size:"sm",onClick:r==null?void 0:r.action,className:"richtext-p-1 richtext-w-7 richtext-h-7",pressed:t.title===r.title,"data-state":t.title===r.title?"on":"off",children:(r==null?void 0:r.icon)&&n.jsx($,{name:r.icon})})}),n.jsxs(ye,{className:"richtext-flex richtext-flex-col richtext-items-center",children:[n.jsx("span",{children:r.title}),!!((o=r.shortcutKeys)!=null&&o.length)&&n.jsx("span",{children:(s=r.shortcutKeys)==null?void 0:s.map(c=>at(c)).join(" ")})]})]},`text-align-${a}`)})})]})}const lo=g.TextAlign.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),types:["heading","paragraph","list_item","title"],button({editor:t,extension:i,t:r}){var h;const a=((h=i.options)==null?void 0:h.alignments)||[],o={left:["mod","Shift","L"],center:["mod","Shift","E"],right:["mod","Shift","R"],justify:["mod","Shift","J"]},s={left:"AlignLeft",center:"AlignCenter",right:"AlignRight",justify:"AlignJustify"},c=a.map(u=>{var x,m,f;return{title:r(`editor.textalign.${u}.tooltip`),icon:s[u],shortcutKeys:o[u],isActive:()=>t.isActive({textAlign:u})||!1,action:()=>{var p,v;return(v=(p=t.commands)==null?void 0:p.setTextAlign)==null?void 0:v.call(p,u)},disabled:!((f=(m=(x=t==null?void 0:t.can)==null?void 0:x.call(t))==null?void 0:m.setTextAlign)!=null&&f.call(m,u))}}),l=c.filter(u=>u.disabled).length===c.length;return{component:co,componentProps:{icon:"AlignJustify",tooltip:r("editor.textalign.tooltip"),disabled:l,items:c}}}}}});function ho(e){var r;const{t}=b.useLocale(),i=d.useMemo(()=>{const a=(e.items||[]).find(s=>s.isActive());return a||{title:t("editor.fontSize.default.tooltip"),isActive:()=>!1}},[e]);return n.jsxs(de,{children:[n.jsx(he,{disabled:e==null?void 0:e.disabled,asChild:!0,children:n.jsx(Rt,{title:i==null?void 0:i.title,tooltip:`${e==null?void 0:e.tooltip}`,disabled:e==null?void 0:e.disabled,icon:"MenuDown"})}),n.jsx(ce,{className:"richtext-w-32 richtext-overflow-y-auto richtext-max-h-96",children:(r=e==null?void 0:e.items)==null?void 0:r.map((a,o)=>n.jsx(ve,{checked:i.title===a.title,onClick:a.action,children:n.jsx("div",{className:"richtext-h-full richtext-ml-1",children:a.title})},`font-size-${o}`))})]})}const uo=g.Extension.create({name:"fontSize",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),types:["textStyle"],fontSizes:[...b.DEFAULT_FONT_SIZE_LIST],button({editor:t,extension:i,t:r}){var l;const a=Ct(((l=i.options)==null?void 0:l.fontSizes)||b.DEFAULT_FONT_SIZE_VALUE),o=Ct([b.DEFAULT_FONT_SIZE_VALUE])[0],s=a.map(h=>({title:h.value===o.value?r("editor.fontSize.default.tooltip"):String(h.name),isActive:()=>{const{fontSize:u}=t.getAttributes("textStyle");return h.value===o.value&&u===void 0?!0:t.isActive({fontSize:String(h.value)})||!1},action:()=>{if(h.value===o.value){t.commands.unsetFontSize();return}t.commands.setFontSize(String(h.value))},disabled:!t.can().setFontSize(String(h.value)),divider:h.value===o.value||!1,default:h.value===o.value||!1})),c=s.filter(h=>h.disabled).length===s.length;return{component:ho,componentProps:{editor:t,tooltip:r("editor.fontSize.tooltip"),disabled:c,items:s,maxHeight:280}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize.replaceAll(/["']+/g,""),renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>t().setMark("textStyle",{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}});function mo({fill:e}){return n.jsx("svg",{width:"18px",height:"18px",viewBox:"0 0 240 240",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:n.jsx("g",{stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd",children:n.jsx("g",{transform:"translate(0.000000, 0.500000)",children:n.jsxs("g",{transform:"translate(39.000000, 17.353553)",children:[n.jsx("path",{d:"M11,201.146447 L167,201.146447 C173.075132,201.146447 178,206.071314 178,212.146447 C178,218.221579 173.075132,223.146447 167,223.146447 L11,223.146447 C4.92486775,223.146447 7.43989126e-16,218.221579 0,212.146447 C-7.43989126e-16,206.071314 4.92486775,201.146447 11,201.146447 Z",id:"矩形",fill:e||"#DF2A3F",fillRule:"evenodd"}),n.jsx("path",{d:"M72.3425855,16.8295583 C75.799482,7.50883712 86.1577877,2.75526801 95.4785089,6.21216449 C100.284516,7.99463061 104.096358,11.7387855 105.968745,16.4968188 L106.112518,16.8745422 L159.385152,161.694068 C161.291848,166.877345 158.635655,172.624903 153.452378,174.531599 C148.358469,176.405421 142.719567,173.872338 140.716873,168.864661 L140.614848,168.598825 L89.211,28.86 L37.3759214,168.623816 C35.4885354,173.712715 29.8981043,176.351047 24.7909589,174.617647 L24.5226307,174.522368 C19.4337312,172.634982 16.7953993,167.044551 18.5287999,161.937406 L18.6240786,161.669077 L72.3425855,16.8295583 Z",id:"路径-21",fill:"currentColor",fillRule:"nonzero"}),n.jsx("path",{d:"M121,103.146447 C126.522847,103.146447 131,107.623599 131,113.146447 C131,118.575687 126.673329,122.994378 121.279905,123.142605 L121,123.146447 L55,123.146447 C49.4771525,123.146447 45,118.669294 45,113.146447 C45,107.717207 49.3266708,103.298515 54.7200952,103.150288 L55,103.146447 L121,103.146447 Z",id:"路径-22",fill:"currentColor",fillRule:"nonzero"})]})})})})}function xo(e){const[t,i]=d.useState(void 0);function r(s){var c;(c=e.action)==null||c.call(e,s)}function a(){var s;(s=e.action)==null||s.call(e,t)}const o=d.useCallback(w.debounce(s=>{i(s)},350),[]);return n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-h-[32px]",children:[n.jsx(y,{tooltip:e==null?void 0:e.tooltip,disabled:e==null?void 0:e.disabled,action:a,children:n.jsx("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-text-sm",children:n.jsx(mo,{fill:t})})}),n.jsx(Hn,{selectedColor:t,setSelectedColor:o,onChange:r,disabled:e==null?void 0:e.disabled,colors:e==null?void 0:e.colors,defaultColor:e==null?void 0:e.defaultColor,children:n.jsx(F,{variant:"ghost",size:"icon",className:"r!ichtext-h-[32px] !richtext-w-3",disabled:e==null?void 0:e.disabled,children:n.jsx($,{className:"!richtext-w-3 !richtext-h-3 richtext-text-zinc-500",name:"MenuDown"})})})]})}const fo=g.Color.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:i,extension:r}){return{component:xo,componentProps:{colors:r.options.colors,defaultColor:r.options.defaultColor,action:a=>{a===void 0&&t.chain().focus().unsetColor().run(),typeof a=="string"&&t.chain().focus().setColor(a).run()},isActive:()=>{const{color:a}=t.getAttributes("textStyle");return a&&t.isActive({color:a})||!1},editor:t,disabled:!t.can().setColor(""),tooltip:i("editor.color.tooltip")}}}}}}),go=g.Highlight.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),multicolor:!0,button:({editor:t,t:i})=>({component:Un,componentProps:{action:r=>{typeof r=="string"&&t.chain().focus().setHighlight({color:r}).run(),r===void 0&&t.chain().focus().unsetHighlight().run()},editor:t,isActive:()=>t.isActive("highlight")||!1,disabled:!t.can().setHighlight(),shortcutKeys:["⇧","mod","H"],tooltip:i("editor.highlight.tooltip")}})}}}),bo=g.BulletList.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:i})=>({component:y,componentProps:{action:()=>t.commands.toggleBulletList(),isActive:()=>t.isActive("bulletList")||!1,disabled:!1,shortcutKeys:["shift","mod","8"],icon:"List",tooltip:i("editor.bulletlist.tooltip")}})}}}),po=g.Node.create({name:"clear",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:i})=>({component:y,componentProps:{action:()=>t.chain().focus().clearNodes().unsetAllMarks().run(),disabled:!t.can().chain().focus().clearNodes().unsetAllMarks().run(),icon:"Eraser",tooltip:i("editor.clear.tooltip")}})}}}),_o=g.OrderedList.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:i})=>({component:y,componentProps:{action:()=>t.commands.toggleOrderedList(),isActive:()=>t.isActive("orderedList")||!1,disabled:!1,icon:"ListOrdered",shortcutKeys:["mod","shift","7"],tooltip:i("editor.orderedlist.tooltip")}})}}}),wo=g.TaskList.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"task-list"},taskItem:{HTMLAttributes:{class:"task-list-item"}},button:({editor:t,t:i})=>({component:y,componentProps:{action:()=>t.commands.toggleTaskList(),isActive:()=>t.isActive("taskList")||!1,disabled:!1,icon:"ListTodo",shortcutKeys:["shift","mod","9"],tooltip:i("editor.tasklist.tooltip")}})}},addExtensions(){return[g.TaskItem.configure(this.options.taskItem)]}}),vo=g.Blockquote.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"blockquote"},button:({editor:t,t:i})=>({component:y,componentProps:{action:()=>t.commands.toggleBlockquote(),isActive:()=>t.isActive("blockquote")||!1,disabled:!t.can().toggleBlockquote(),icon:"TextQuote",shortcutKeys:["shift","mod","B"],tooltip:i("editor.blockquote.tooltip")}})}}});function yo(e){const[t,i]=d.useState(!1);function r(a,o,s){e.action&&(e.action({link:a,text:o,openInNewTab:s}),i(!1))}return n.jsxs(ee,{modal:!0,open:t,onOpenChange:i,children:[n.jsx(te,{disabled:e==null?void 0:e.disabled,asChild:!0,children:n.jsx(y,{tooltip:e==null?void 0:e.tooltip,isActive:e==null?void 0:e.isActive,disabled:e==null?void 0:e.disabled,children:n.jsx($,{name:e==null?void 0:e.icon})})}),n.jsx(Y,{hideWhenDetached:!0,className:"richtext-w-full",align:"start",side:"bottom",children:n.jsx(Wn,{editor:e.editor,onSetLink:r})})]})}const jo=g.Link.extend({inclusive:!1,parseHTML(){return[{tag:'a[href]:not([data-type="button"]):not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:e}){return["a",g.mergeAttributes(this.options.HTMLAttributes,e,{class:"link"}),0]},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),openOnClick:!0,button:({editor:t,t:i})=>({component:yo,componentProps:{editor:t,action:r=>{const{link:a,text:o,openInNewTab:s}=r;t.chain().extendMarkRange("link").insertContent({type:"text",text:o,marks:[{type:"link",attrs:{href:a,target:s?"_blank":""}}]}).setLink({href:a}).focus().run()},id:"linkk",isActive:()=>t.isActive("link")||!1,disabled:!t.can().setLink({href:""}),icon:"Link",tooltip:i("editor.link.tooltip")}})}},addProseMirrorPlugins(){return[new w.Plugin({props:{handleClick:(e,t)=>{const{schema:i,doc:r,tr:a}=e.state,o=g.getMarkRange(r.resolve(t),i.marks.link);if(!o)return!1;const s=r.resolve(o.from),c=r.resolve(o.to),l=a.setSelection(new w.TextSelection(s,c));e.dispatch(l)}}})]}}),ko=g.HorizontalRule.extend({renderHTML(){return["div",g.mergeAttributes(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:i})=>({component:y,componentProps:{action:()=>t.commands.setHorizontalRule(),disabled:!t.can().setHorizontalRule(),icon:"Minus",shortcutKeys:["mod","alt","S"],tooltip:i("editor.horizontalrule.tooltip")}})}},addKeyboardShortcuts(){return{"Mod-Alt-s":()=>this.editor.commands.setHorizontalRule()}}});function Co(e){var h;const{icon:t=void 0,tooltip:i=void 0,customClass:r="",tooltipOptions:a={},action:o=void 0,isActive:s=void 0,children:c}=e,l=Ze[t];return n.jsxs(ze,{children:[n.jsx(Oe,{asChild:!0,children:n.jsxs(Ke,{size:"sm",className:`richtext-w-[32px] richtext-h-[32px] ${r}`,disabled:s==null?void 0:s(),onClick:o,children:[l&&n.jsx(l,{className:"richtext-w-4 richtext-h-4"}),c&&n.jsx(n.Fragment,{children:c})]})}),i&&n.jsx(ye,{...a,children:n.jsxs("div",{className:"richtext-flex richtext-flex-col richtext-items-center richtext-text-center richtext-max-w-24",children:[n.jsx("div",{children:i}),!!((h=e==null?void 0:e.shortcutKeys)!=null&&h.length)&&n.jsx("span",{children:ot(e==null?void 0:e.shortcutKeys)})]})})]})}const No=["undo","redo"],So=g.History.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),depth:100,newGroupDelay:500,button:({editor:t,t:i})=>No.map(r=>({component:Co,componentProps:{action:()=>{r==="undo"&&t.chain().focus().undo().run(),r==="redo"&&t.chain().focus().redo().run()},shortcutKeys:r==="undo"?["mod","Z"]:["shift","mod","Z"],disabled:r==="undo"?!t.can().undo():!t.can().redo(),isActive:()=>r==="undo"?!t.can().undo():!t.can().redo(),icon:r==="undo"?"Undo2":"Redo2",tooltip:i(`editor.${r}.tooltip`)}}))}}}),To=g.Document.extend({content:"(block|columns)+"});function Ao(e,t,i=null){return i?e.createChecked({index:t},i):e.createAndFill({index:t})}function Lo(e){if(e.cached.columnsNodeTypes)return e.cached.columnsNodeTypes;const t={columns:e.nodes.columns,column:e.nodes.column};return e.cached.columnsNodeTypes=t,t}function Mo(e,t,i=null){const r=Lo(e),a=[];for(let o=0;o<t;o+=1){const s=Ao(r.column,o,i);s&&a.push(s)}return r.columns.createChecked({cols:t},a)}function bt({state:e,dispatch:t,type:i}){const r=g.findParentNode(o=>o.type.name===Ie.name)(e.selection),a=g.findParentNode(o=>o.type.name===dt.name)(e.selection);if(t&&r&&a){const o=r.node,s=a.node.attrs.index,c=o.toJSON();let l=s;i==="delete"?(l=s-1,c.content.splice(s,1)):(l=i==="addBefore"?s:s+1,c.content.splice(l,0,{type:"column",attrs:{index:s},content:[{type:"paragraph"}]})),c.attrs.cols=c.content.length,c.content.forEach((m,f)=>{m.attrs.index=f});const h=w.Node.fromJSON(e.schema,c);let u=r.pos;h.content.forEach((m,f,p)=>{p<l&&(u+=m.nodeSize)});const x=e.tr.setTime(Date.now());x.replaceWith(r.pos,r.pos+r.node.nodeSize,h).setSelection(w.TextSelection.near(x.doc.resolve(u))),t(x)}return!0}function on({state:e,dispatch:t,type:i}){const r=g.findParentNode(o=>o.type.name===Ie.name)(e.selection),a=g.findParentNode(o=>o.type.name===dt.name)(e.selection);if(t&&r&&a){const o=r.node,s=a.node.attrs.index;let c=0;i==="before"?c=(s-1+o.attrs.cols)%o.attrs.cols:c=(s+1)%o.attrs.cols;let l=r.pos;o.content.forEach((u,x,m)=>{m<c&&(l+=u.nodeSize)});const h=e.tr.setTime(Date.now());return h.setSelection(w.TextSelection.near(h.doc.resolve(l))),t(h),!0}return!1}const Eo=200,Ie=g.Node.create({name:"columns",group:"block",defining:!0,isolating:!0,allowGapCursor:!1,content:"column{1,}",priority:Eo,addOptions(){return{HTMLAttributes:{class:"columns"}}},addAttributes(){return{cols:{default:2,parseHTML:e=>e.getAttribute("cols")}}},parseHTML(){return[{tag:"div[class=grid]"}]},renderHTML({HTMLAttributes:e}){return["div",g.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{insertColumns:e=>({tr:t,dispatch:i,editor:r})=>{const a=Mo(r.schema,e&&e.cols||3);if(i){const o=t.selection.anchor+1;t.replaceSelectionWith(a).scrollIntoView().setSelection(w.TextSelection.near(t.doc.resolve(o)))}return!0},addColBefore:()=>({dispatch:e,state:t})=>bt({dispatch:e,state:t,type:"addBefore"}),addColAfter:()=>({dispatch:e,state:t})=>bt({dispatch:e,state:t,type:"addAfter"}),deleteCol:()=>({dispatch:e,state:t})=>bt({dispatch:e,state:t,type:"delete"})}},addKeyboardShortcuts(){return{"Mod-Alt-G":()=>this.editor.commands.insertColumns(),Tab:()=>on({state:this.editor.state,dispatch:this.editor.view.dispatch,type:"after"}),"Shift-Tab":()=>on({state:this.editor.state,dispatch:this.editor.view.dispatch,type:"before"})}}}),dt=g.Node.create({name:"column",content:"block+",isolating:!0,addOptions(){return{HTMLAttributes:{class:"column"}}},addAttributes(){return{index:{default:0,parseHTML:e=>e.getAttribute("index")}}},parseHTML(){return[{tag:"div[class=column]"}]},renderHTML({HTMLAttributes:e}){return["div",g.mergeAttributes(this.options.HTMLAttributes,e),0]}}),Io=g.Extension.create({name:"columnActionButton",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:i})=>({component:y,componentProps:{action:()=>{t.chain().focus().insertColumns({cols:2}).run()},icon:"Columns",tooltip:i("editor.columns.tooltip")}})}}}),Ro=g.Extension.create({name:"selection",addProseMirrorPlugins(){const{editor:e}=this;return[new w.Plugin({key:new w.PluginKey("selection"),props:{decorations(t){return t.selection.empty||e.isFocused===!0?null:w.DecorationSet.create(t.doc,[w.Decoration.inline(t.selection.from,t.selection.to,{class:"selection"})])}}})]}});function Ho(e){const{t}=b.useLocale(),i=d.useMemo(()=>[{name:"paragraph",label:t("editor.paragraph.tooltip"),iconName:"Heading1",isActive:()=>e.editor.isActive("paragraph")&&!e.editor.isActive("orderedList")&&!e.editor.isActive("bulletList")&&!e.editor.isActive("taskList"),action:()=>e.editor.chain().focus().clearNodes().run()},{name:"heading1",label:t("editor.heading.h1.tooltip"),isActive:()=>e.editor.isActive("heading",{level:1}),iconName:"Heading1",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:1}).run()},{name:"heading2",label:t("editor.heading.h2.tooltip"),isActive:()=>e.editor.isActive("heading",{level:2}),iconName:"Heading2",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:2}).run()},{name:"heading3",label:t("editor.heading.h3.tooltip"),isActive:()=>e.editor.isActive("heading",{level:3}),iconName:"Heading3",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:3}).run()},{name:"bulletList",label:t("editor.bulletlist.tooltip"),isActive:()=>e.editor.isActive("bulletList"),iconName:"List",action:()=>e.editor.chain().focus().clearNodes().toggleBulletList().run()},{name:"numberedList",label:t("editor.orderedlist.tooltip"),isActive:()=>e.editor.isActive("orderedList"),iconName:"ListOrdered",action:()=>e.editor.chain().focus().clearNodes().toggleOrderedList().run()},{name:"taskList",label:t("editor.tasklist.tooltip"),isActive:()=>e.editor.isActive("taskList"),iconName:"ListTodo",action:()=>e.editor.chain().focus().clearNodes().toggleTaskList().run()},{name:"blockquote",label:t("editor.blockquote.tooltip"),isActive:()=>e.editor.isActive("blockquote"),iconName:"TextQuote",action:()=>e.editor.chain().focus().clearNodes().toggleBlockquote().run()},{name:"codeBlock",label:t("editor.codeblock.tooltip"),isActive:()=>e.editor.isActive("codeBlock"),iconName:"Code2",action:()=>e.editor.chain().focus().clearNodes().toggleCodeBlock().run()}],[e.editor,t]),r=d.useMemo(()=>i.filter(a=>a.isActive()).pop()??{label:"Empty"},[i]);return n.jsxs(de,{children:[n.jsx(he,{asChild:!0,children:n.jsxs(F,{variant:"ghost",className:"richtext-h-[32px] richtext-flex richtext-gap-1 richtext-px-1.5",children:[n.jsxs("span",{className:"richtext-text-sm richtext-font-normal richtext-whitespace-nowrap",children:[" ",r==null?void 0:r.label]}),n.jsx(_.ChevronDown,{className:"richtext-w-4 richtext-h-4"})]})}),n.jsx(ce,{hideWhenDetached:!0,className:"richtext-w-full richtext-p-1",align:"start",sideOffset:5,children:i.map((a,o)=>{var c;const s=Ze[a.iconName];return n.jsx(ve,{checked:((c=a.isActive)==null?void 0:c.call(a))||!1,onClick:()=>a.action(),className:"richtext-cursor-pointer",children:n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-px-2",children:[n.jsx(s,{className:"richtext-w-3 richtext-h3"}),n.jsxs("span",{children:[" ",a.label]})]})},`text-bubble-${o}`)})})]})}const zo=g.Extension.create({name:"text-bubble",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),toolbar:!1,button:()=>({component:Ho,componentProps:{}})}}});function sn({types:e,node:t}){return Array.isArray(e)&&e.includes(t.type)||t.type===e}const Oo=g.Extension.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:["paragraph"]}},addProseMirrorPlugins(){const e=new w.PluginKey(this.name),t=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>this.options.notAfter.includes(i.name));return[new w.Plugin({key:e,appendTransaction:(i,r,a)=>{const{doc:o,tr:s,schema:c}=a,l=e.getState(a),h=o.content.size,u=c.nodes[this.options.node];if(l)return s.insert(h,u.create())},state:{init:(i,r)=>{const a=r.tr.doc.lastChild;return!sn({node:a,types:t})},apply:(i,r)=>{if(!i.docChanged)return r;const a=i.doc.lastChild;return!sn({node:a,types:t})}}})]}}),Po=g.Extension.create({name:"base-kit",addExtensions(){const e=[];return this.options.document!==!1&&e.push(To.configure()),this.options.placeholder!==!1&&e.push(g.Placeholder.configure({placeholder:({node:t,pos:i,editor:r})=>{var a,o,s,c,l;return((a=t==null?void 0:t.type)==null?void 0:a.name)==="columns"||((o=t==null?void 0:t.content)==null?void 0:o.size)!==0?"":((s=t==null?void 0:t.type)==null?void 0:s.name)==="heading"?`${b.localeActions.t(`editor.heading.h${t.attrs.level}.tooltip`)}`:((c=t==null?void 0:t.type)==null?void 0:c.name)==="codeBlock"||((l=t==null?void 0:t.type)==null?void 0:l.name)==="table"?"":r.extensionManager.extensions.some(h=>h.name==="slashCommand")?b.localeActions.t("editor.slash"):b.localeActions.t("editor.content")},...this.options.placeholder})),this.options.focus!==!1&&e.push(g.FocusClasses.configure({className:"focus",...this.options.focus})),this.options.text!==!1&&e.push(g.Text.configure()),this.options.textBubble!==!1&&e.push(zo.configure()),this.options.gapcursor!==!1&&e.push(g.Gapcursor.configure()),this.options.dropcursor!==!1&&e.push(g.Dropcursor.configure({...this.options.dropcursor,width:2,class:"ProseMirror-dropcursor border-black"})),this.options.characterCount!==!1&&e.push(g.CharacterCount.configure(this.options.characterCount)),this.options.paragraph!==!1&&e.push(g.Paragraph.configure(this.options.paragraph)),this.options.hardBreak!==!1&&e.push(g.HardBreak.configure(this.options.hardBreak)),this.options.listItem!==!1&&e.push(g.ListItem.configure(this.options.listItem)),this.options.textStyle!==!1&&e.push(g.TextStyle.configure(this.options.textStyle)),this.options.trailingNode!==!1&&e.push(Oo.configure(this.options.trailingNode)),this.options.selection!==!1&&e.push(Ro),this.options.multiColumn!==!1&&(e.push(dt),e.push(Ie)),e}}),Do=g.Extension.create({name:"subAndSuperScript",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,extension:i,t:r})=>{const a=i.options.subscript,o=i.options.superscript,s={component:y,componentProps:{action:()=>t.commands.toggleSubscript(),isActive:()=>t.isActive("subscript")||!1,disabled:!t.can().toggleSubscript(),icon:"Subscript",tooltip:r("editor.subscript.tooltip")}},c={component:y,componentProps:{action:()=>t.commands.toggleSuperscript(),isActive:()=>t.isActive("superscript")||!1,disabled:!t.can().toggleSuperscript(),icon:"Superscript",tooltip:r("editor.superscript.tooltip")}},l=[];return a!==!1&&l.push(s),o!==!1&&l.push(c),l}}},addExtensions(){const e=[];return this.options.subscript!==!1&&e.push(g.Subscript.configure(this.options.subscript)),this.options.superscript!==!1&&e.push(g.Superscript.configure(this.options.superscript)),e}});function Bo(e){var i;const t=d.useMemo(()=>{var o;const r=(o=e==null?void 0:e.items)==null?void 0:o.find(s=>s.isActive());return r&&!r.default?{...r,icon:r!=null&&r.icon?r==null?void 0:r.icon:e==null?void 0:e.icon}:{title:e.tooltip,icon:e.icon,isActive:()=>!1}},[e]);return n.jsxs(de,{children:[n.jsx(he,{disabled:e==null?void 0:e.disabled,asChild:!0,children:n.jsx(y,{customClass:"!richtext-w-12 richtext-h-12",icon:e==null?void 0:e.icon,tooltip:e==null?void 0:e.tooltip,disabled:e==null?void 0:e.disabled,children:n.jsx($n,{className:"richtext-w-3 richtext-h-3 richtext-text-gray-500"})})}),n.jsx(ce,{className:"w-full",children:(i=e==null?void 0:e.items)==null?void 0:i.map((r,a)=>n.jsxs(ve,{checked:t.title===r.title,onClick:r.action,className:"richtext-flex richtext-items-center richtext-gap-3",children:[n.jsx($,{name:r==null?void 0:r.icon}),n.jsx("span",{className:"richtext-ml-1",children:r.title}),!!(r!=null&&r.shortcutKeys)&&n.jsx("span",{className:"richtext-ml-auto richtext-text-xs richtext-tracking-widest richtext-opacity-60",children:ot(r.shortcutKeys)})]},`more-mark-${a}`))})]})}const $o=g.Extension.create({name:"moreMark",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,extension:i,t:r}){const a=i.options.subscript,o=i.options.superscript,s={action:()=>t.commands.toggleSubscript(),isActive:()=>t.isActive("subscript")||!1,disabled:!t.can().toggleSubscript(),icon:"Subscript",title:r("editor.subscript.tooltip"),shortcutKeys:["mod","."]},c={action:()=>t.commands.toggleSuperscript(),isActive:()=>t.isActive("superscript")||!1,disabled:!t.can().toggleSuperscript(),icon:"Superscript",title:r("editor.superscript.tooltip"),shortcutKeys:["mod",","]},l=[];return a!==!1&&l.push(s),o!==!1&&l.push(c),{component:Bo,componentProps:{icon:"Type",tooltip:r("editor.moremark"),disabled:!t.isEditable,items:l}}}}},addExtensions(){const e=[];return this.options.subscript!==!1&&e.push(g.Subscript.configure(this.options.subscript)),this.options.superscript!==!1&&e.push(g.Superscript.configure(this.options.superscript)),e}}),Fo=g.Extension.create({name:"indent",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),types:["paragraph","heading","blockquote"],minIndent:pe.min,maxIndent:pe.max,button({editor:t,t:i}){return[{component:y,componentProps:{action:()=>{t.commands.indent()},shortcutKeys:["Tab"],icon:"IndentIncrease",tooltip:i("editor.indent.tooltip")}},{component:y,componentProps:{action:()=>{t.commands.outdent()},shortcutKeys:["Shift","Tab"],icon:"IndentDecrease",tooltip:i("editor.outdent.tooltip")}}]}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{indent:{default:0,parseHTML:e=>{const t=e.dataset.indent;return(t?Number.parseInt(t,10):0)||0},renderHTML:e=>e.indent?{"data-indent":e.indent}:{}}}}]},addCommands(){return{indent:()=>rn({delta:pe.more,types:this.options.types}),outdent:()=>rn({delta:pe.less,types:this.options.types})}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.indent(),"Shift-Tab":()=>this.editor.commands.outdent()}}});function Vo(e){return Number.parseFloat(e.replace("%",""))/100}function Uo(e){const{t}=b.useLocale(),[i,r]=d.useState("default");function a(s){s==="default"?e.editor.commands.unsetLineHeight():e.editor.commands.setLineHeight(s),r(s)}const o=d.useMemo(()=>{const l=e.editor.extensionManager.extensions.find(h=>h.name==="lineHeight").options.lineHeights.map(h=>({label:Vo(h),value:h}));return l.unshift({label:t("editor.default"),value:"default"}),l},[e]);return n.jsxs(de,{children:[n.jsx(he,{disabled:e==null?void 0:e.disabled,asChild:!0,children:n.jsx(y,{customClass:"!richtext-w-12 richtext-h-12",icon:"LineHeight",tooltip:e==null?void 0:e.tooltip,disabled:e==null?void 0:e.disabled,children:n.jsx($,{className:"richtext-w-3 richtext-h-3 richtext-ml-1 richtext-text-zinc-500",name:"MenuDown"})})}),n.jsx(ce,{className:"richtext-min-w-24",children:o==null?void 0:o.map((s,c)=>n.jsx(ve,{checked:s.value===i,onClick:()=>a(s.value),children:s.label},`lineHeight-${c}`))})]})}const Wo=["paragraph","heading","list_item","todo_item"];function qo(e,t){const{selection:i,doc:r}=e;if(!i||!r||!(i instanceof w.TextSelection||i instanceof w.AllSelection))return e;const{from:a,to:o}=i,s=[],c=t&&t!==b.DEFAULT_LINE_HEIGHT?t:null;if(r.nodesBetween(a,o,(l,h)=>{const u=l.type;return Wo.includes(u.name)?((l.attrs.lineHeight||null)!==c&&s.push({node:l,pos:h,nodeType:u}),u.name!=="list_item"&&u.name!=="todo_item"):!0}),s.length===0)return e;for(const l of s){const{node:h,pos:u,nodeType:x}=l;let{attrs:m}=h;m={...m,lineHeight:c},e=e.setNodeMarkup(u,x,m,h.marks)}return e}function Go(e){return({state:t,dispatch:i})=>{const{selection:r}=t;let{tr:a}=t;return a=a.setSelection(r),a=qo(a,e),a.docChanged?(i&&i(a),!0):!1}}const Ko=g.Extension.create({name:"lineHeight",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),types:["paragraph","heading","list_item","todo_item"],lineHeights:b.DEFAULT_LINE_HEIGHT_LIST,defaultHeight:b.DEFAULT_LINE_HEIGHT,button({editor:t,t:i}){return{component:Uo,componentProps:{editor:t,tooltip:i("editor.lineheight.tooltip")}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>e.style.lineHeight||this.options.defaultHeight,renderHTML:e=>e.lineHeight===this.options.defaultHeight||!e.lineHeight?{}:{style:`line-height: ${e.lineHeight}`}}}}]},addCommands(){return{setLineHeight:e=>Go(e),unsetLineHeight:()=>({commands:e})=>this.options.types.every(t=>e.resetAttributes(t,"lineHeight"))}}}),Zn=w.g(!1);function Zo(){return w._(Zn)}const Te={setOpen:e=>{Zn.set(e)}},Xn=w.g(!1);function Xo(){return w._(Xn)}const Fe={setOpen:e=>{Xn.set(e)}};function Yo(e){const t=[{name:"format",title:b.localeActions.t("editor.slash.format"),commands:[]},{name:"insert",title:b.localeActions.t("editor.slash.insert"),commands:[]}];return e.forEach(i=>{i.name.toLowerCase()==="heading"&&i.options.levels.forEach(r=>{t[0].commands.push({name:`heading${r}`,label:b.localeActions.t(`editor.heading.h${r}.tooltip`),aliases:[`h${r}`,"bt",`bt${r}`],iconName:`Heading${r}`,action:({editor:a,range:o})=>{a.chain().focus().deleteRange(o).setHeading({level:r}).run()}})}),i.name.toLowerCase()==="bulletlist"&&t[0].commands.push({name:"bulletList",label:b.localeActions.t("editor.bulletlist.tooltip"),aliases:["ul","yxlb"],iconName:"List",action:({editor:r,range:a})=>{r.chain().focus().deleteRange(a).toggleBulletList().run()}}),i.name.toLowerCase()==="orderedlist"&&t[0].commands.push({name:"numberedList",label:b.localeActions.t("editor.orderedlist.tooltip"),aliases:["ol","yxlb"],iconName:"ListOrdered",action:({editor:r,range:a})=>{r.chain().focus().deleteRange(a).toggleOrderedList().run()}}),i.name.toLowerCase()==="tasklist"&&t[0].commands.push({name:"taskList",label:b.localeActions.t("editor.tasklist.tooltip"),iconName:"ListTodo",description:"Task list with todo items",aliases:["todo"],action:({editor:r,range:a})=>{r.chain().focus().deleteRange(a).toggleTaskList().run()}}),i.name.toLowerCase()==="blockquote"&&t[0].commands.push({name:"blockquote",label:b.localeActions.t("editor.blockquote.tooltip"),description:"插入引入格式",aliases:["yr"],iconName:"TextQuote",action:({editor:r,range:a})=>{r.chain().focus().deleteRange(a).setBlockquote().run()}}),i.name.toLowerCase()==="codeblock"&&t[0].commands.push({name:"codeBlock",label:b.localeActions.t("editor.codeblock.tooltip"),iconName:"Code2",description:"Code block with syntax highlighting",shouldBeHidden:r=>r.isActive("columns"),action:({editor:r,range:a})=>{r.chain().focus().deleteRange(a).setCodeBlock().run()}}),i.name.toLowerCase()==="image"&&t[1].commands.push({name:"image",label:b.localeActions.t("editor.image.tooltip"),iconName:"ImageUp",description:"Insert a image",aliases:["image","tp","tupian"],shouldBeHidden:r=>r.isActive("columns"),action:({editor:r,range:a})=>{r.chain().focus().deleteRange(a).run(),Te.setOpen(!0)}}),i.name.toLowerCase()==="video"&&t[1].commands.push({name:"video",label:b.localeActions.t("editor.video.tooltip"),iconName:"Video",description:"Insert a video",aliases:["video","sp","shipin"],shouldBeHidden:r=>r.isActive("columns"),action:({editor:r,range:a})=>{r.chain().focus().deleteRange(a).run(),Fe.setOpen(!0)}}),i.name.toLowerCase()==="table"&&t[1].commands.push({name:"table",label:b.localeActions.t("editor.table.tooltip"),iconName:"Table",description:"Insert a table",aliases:["table","bg","biaoge","biao"],shouldBeHidden:r=>r.isActive("columns"),action:({editor:r,range:a})=>{r.chain().focus().deleteRange(a).insertTable({rows:3,cols:3,withHeaderRow:!1}).run()}}),i.name.toLowerCase()==="horizontalrule"&&t[1].commands.push({name:"horizontalRule",label:b.localeActions.t("editor.horizontalrule.tooltip"),iconName:"Minus",description:"Insert a horizontal divider",aliases:["hr","fgx","fg"],action:({editor:r,range:a})=>{r.chain().focus().deleteRange(a).setHorizontalRule().run()}}),i.name.toLowerCase()==="columns"&&t[1].commands.push({name:"columns",label:b.localeActions.t("editor.columns.tooltip"),iconName:"Columns2",description:"Add two column content",action:({editor:r})=>{r.chain().focus().insertColumns({cols:2}).run()}})}),t}function Jo(e,t){var N,A;const[i,r]=d.useState(0),[a,o]=d.useState(0),s=d.useRef(null),{t:c}=b.useLocale(),l=d.useRef([]);d.useImperativeHandle(t,()=>({onKeyDown:h})),d.useEffect(()=>{if(!s.current)return;const k=a*1e3+i,j=l.current[k];j&&j.scrollIntoView({behavior:"smooth",block:"nearest"})},[i,a]);function h({event:k}){return k.key==="ArrowUp"?(u(),!0):k.key==="ArrowDown"?(x(),!0):k.key==="Enter"?(m(),!0):!1}function u(){var S;if(e.items.length===0)return!1;let k=i-1,j=a;k<0&&(j=a-1,k=((S=e.items[j])==null?void 0:S.commands.length)-1||0),j<0&&(j=e.items.length-1,k=e.items[j].commands.length-1),r(k),o(j)}function x(){if(e.items.length===0)return!1;const k=e.items[a].commands;let j=i+1,S=a;k.length-1<j&&(j=0,S=a+1),e.items.length-1<S&&(S=0),r(j),o(S)}function m(){if(e.items.length===0||a===-1||i===-1)return!1;f(a,i)}function f(k,j){const S=e.items[k].commands[j];e.command(S)}function p(k,j){f(k,j)}function v(k,j,S){l.current[k*1e3+j]=S}return n.jsx("div",{className:"!richtext-bg-white richtext-rounded-lg dark:!richtext-bg-black richtext-shadow-sm !richtext-border !richtext-border-neutral-200 dark:!richtext-border-neutral-800 !richtext-text-black richtext-max-h-[min(80vh,24rem)] richtext-overflow-auto richtext-flex-wrap richtext-mb-8 richtext-p-1",ref:s,children:(N=e==null?void 0:e.items)!=null&&N.length?n.jsx("div",{className:"richtext-grid richtext-grid-cols-1 richtext-gap-0.5 richtext-min-w-48",children:(A=e==null?void 0:e.items)==null?void 0:A.map((k,j)=>n.jsxs(d.Fragment,{children:[n.jsx("div",{className:"!richtext-text-neutral-500 richtext-text-[0.65rem] richtext-col-[1/-1] richtext-mx-2 richtext-mt-2 richtext-font-semibold richtext-tracking-wider richtext-select-none richtext-uppercase first:richtext-mt-0.5",children:k.title}),k.commands.map((S,T)=>n.jsxs("button",{className:P("richtext-flex richtext-items-center richtext-gap-3 richtext-px-2 richtext-py-1.5 richtext-text-sm !richtext-text-neutral-800 dark:!richtext-text-neutral-200 richtext-text-left richtext-w-full richtext-rounded-sm richtext-outline-none richtext-transition-colors !richtext-bg-transparent hover:!richtext-bg-accent ",{"slash-command-active":a===j&&i===T}),ref:I=>v(j,T,I),onClick:()=>p(j,T),children:[S.iconUrl&&n.jsx("img",{className:"richtext-w-6 richtext-h-6",src:S.iconUrl,alt:""}),S.iconName&&n.jsx($,{name:S.iconName,className:"!richtext-mr-1 !richtext-text-lg"}),S.label]},`command-${T}`))]},`slash-${k.title}`))}):n.jsx("div",{className:"richtext-p-3",children:n.jsx("span",{className:"richtext-text-xs richtext-text-gray-800 dark:richtext-text-gray-100",children:c("editor.slash.empty")})})})}const Qo=d.forwardRef(Jo),fe="slashCommand";let V;const es=g.Extension.create({name:fe,priority:200,onCreate(){V=rt("body",{interactive:!0,trigger:"manual",placement:"bottom-start",theme:"slash-command",maxWidth:"16rem",offset:[16,8],popperOptions:{strategy:"fixed",modifiers:[{name:"flip",enabled:!1}]}})},addProseMirrorPlugins(){return[g.Suggestion({editor:this.editor,char:"/",allowSpaces:!0,startOfLine:!0,pluginKey:new w.PluginKey(fe),allow:({state:e,range:t})=>{var h,u,x;const i=e.doc.resolve(t.from),r=i.depth===1,a=i.parent.type.name==="paragraph",o=((h=i.parent.textContent)==null?void 0:h.charAt(0))==="/",s=this.editor.isActive("column"),c=(x=i.parent.textContent)==null?void 0:x.slice(Math.max(0,(u=i.parent.textContent)==null?void 0:u.indexOf("/"))),l=!(c!=null&&c.endsWith(" "));return(r&&a&&o||s&&a&&o)&&l},command:({editor:e,range:t,props:i})=>{const{view:r}=e;i.action({editor:e,range:t}),r.focus()},items:({query:e,editor:t})=>Yo(t.extensionManager.extensions).map(s=>({...s,commands:s.commands.filter(c=>{const l=c.label.toLowerCase().trim(),h=e.toLowerCase().trim();if(c.aliases){const u=c.aliases.map(f=>f.toLowerCase().trim()),x=l.match(h),m=u.some(f=>f.match(h));return x||m}return l.match(h)}).filter(c=>c.shouldBeHidden?!c.shouldBeHidden(this.editor):!0)})).filter(s=>s.commands.length>0).map(s=>({...s,commands:s.commands.map(c=>({...c,isEnabled:!0}))})),render:()=>{let e,t=null;return{onStart:i=>{var o;e=new g.ReactRenderer(Qo,{props:i,editor:i.editor});const{view:r}=i.editor,a=()=>{if(!i.clientRect)return i.editor.storage[fe].rect;const s=i.clientRect();if(!s)return i.editor.storage[fe].rect;let c=s.y;if(s.top+e.element.offsetHeight+40>window.innerHeight){const l=s.top+e.element.offsetHeight-window.innerHeight+40;c=s.y-l}return new DOMRect(s.x,c,s.width,s.height)};t=()=>{V==null||V[0].setProps({getReferenceClientRect:a})},(o=r.dom.parentElement)==null||o.addEventListener("scroll",t),V==null||V[0].setProps({getReferenceClientRect:a,appendTo:()=>document.body,content:e.element}),V==null||V[0].show()},onUpdate(i){var s;e.updateProps(i);const{view:r}=i.editor,a=()=>{if(!i.clientRect)return i.editor.storage[fe].rect;const c=i.clientRect();return c?new DOMRect(c.x,c.y,c.width,c.height):i.editor.storage[fe].rect},o=()=>{V==null||V[0].setProps({getReferenceClientRect:a})};(s=r.dom.parentElement)==null||s.addEventListener("scroll",o),i.editor.storage[fe].rect=i.clientRect?a():{width:0,height:0,left:0,top:0,right:0,bottom:0},V==null||V[0].setProps({getReferenceClientRect:a})},onKeyDown(i){var r;return i.event.key==="Escape"?(V==null||V[0].hide(),!0):(V!=null&&V[0].state.isShown||V==null||V[0].show(),(r=e.ref)==null?void 0:r.onKeyDown(i))},onExit(i){var r;if(V==null||V[0].hide(),t){const{view:a}=i.editor;(r=a.dom.parentElement)==null||r.removeEventListener("scroll",t)}e.destroy()}}}})]},addStorage(){return{rect:{width:0,height:0,left:0,top:0,right:0,bottom:0}}}}),Ye={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function ts(e){var O,E;const[t,i]=d.useState({width:b.IMAGE_MAX_SIZE,height:b.IMAGE_MAX_SIZE}),[r,a]=d.useState({width:0,height:0}),[o]=d.useState([Ye.TOP_LEFT,Ye.TOP_RIGHT,Ye.BOTTOM_LEFT,Ye.BOTTOM_RIGHT]),[s,c]=d.useState(!1),[l,h]=d.useState({x:0,y:0,w:0,h:0,dir:""}),{align:u,inline:x}=(O=e==null?void 0:e.node)==null?void 0:O.attrs,m=d.useMemo(()=>{var oe;const{src:L,alt:M,width:C,height:D,flipX:z,flipY:H}=(oe=e==null?void 0:e.node)==null?void 0:oe.attrs,R=w.isNumber(C)?`${C}px`:C,U=w.isNumber(D)?`${D}px`:D,q=[];z&&q.push("rotateX(180deg)"),H&&q.push("rotateY(180deg)");const Ce=q.join(" ");return{src:L||void 0,alt:M||void 0,style:{width:R||void 0,height:U||void 0,transform:Ce||"none"}}},[(E=e==null?void 0:e.node)==null?void 0:E.attrs]),f=d.useMemo(()=>{const{style:{width:L}}=m;return{width:L==="100%"?L:void 0}},[m]);function p(L){a({width:L.target.width,height:L.target.height})}function v(){const{editor:L,getPos:M}=e;L.commands.setNodeSelection(M())}const N=d.useCallback(w.throttle(()=>{const{editor:L}=e,{width:M}=getComputedStyle(L.view.dom);i(C=>({...C,width:Number.parseInt(M,10)}))},b.IMAGE_THROTTLE_WAIT_TIME),[e==null?void 0:e.editor]);function A(L,M){L.preventDefault(),L.stopPropagation();const C=r.width,D=r.height,z=C/D;let H=Number(e.node.attrs.width),R=Number(e.node.attrs.height);const U=t.width;H&&!R?(H=H>U?U:H,R=Math.round(H/z)):R&&!H?(H=Math.round(R*z),H=H>U?U:H):!H&&!R?(H=C>U?U:C,R=Math.round(H/z)):H=H>U?U:H,Le.flushSync(()=>{c(!0),h({x:L.clientX,y:L.clientY,w:H,h:R,dir:M})})}const k=d.useCallback(w.throttle(L=>{if(L.preventDefault(),L.stopPropagation(),!s)return;const{x:M,w:C,dir:D}=l,z=(L.clientX-M)*(/l/.test(D)?-1:1),H=w.clamp(C+z,b.IMAGE_MIN_SIZE,t.width);e.updateAttributes({width:H,height:null})},b.IMAGE_THROTTLE_WAIT_TIME),[s,l,t,e.updateAttributes]),j=d.useCallback(L=>{L.preventDefault(),L.stopPropagation(),s&&(Le.flushSync(()=>{h({x:0,y:0,w:0,h:0,dir:""}),c(!1)}),v())},[s,v]),S=d.useCallback(()=>{document==null||document.addEventListener("mousemove",k,!0),document==null||document.addEventListener("mouseup",j,!0)},[k,j]),T=d.useCallback(()=>{document==null||document.removeEventListener("mousemove",k,!0),document==null||document.removeEventListener("mouseup",j,!0)},[k,j]);d.useEffect(()=>(s?S():T(),()=>{T()}),[s,S,T]);const I=d.useMemo(()=>new ResizeObserver(()=>N()),[N]);return d.useEffect(()=>(I.observe(e.editor.view.dom),()=>{I.disconnect()}),[e.editor.view.dom,I]),n.jsx(g.NodeViewWrapper,{className:"image-view",style:{...f,textAlign:u,display:x?"inline":"block"},as:x?"span":"div",children:n.jsxs("div",{draggable:"true","data-drag-handle":!0,className:`image-view__body ${e!=null&&e.selected?"image-view__body--focused":""} ${s?"image-view__body--resizing":""}`,style:f,children:[n.jsx("img",{src:m.src,alt:m.alt,style:m.style,height:"auto",className:"image-view__body__image block",onLoad:p,onClick:v}),(e==null?void 0:e.editor.view.editable)&&((e==null?void 0:e.selected)||s)&&n.jsx("div",{className:"image-resizer",children:o==null?void 0:o.map(L=>n.jsx("span",{className:`image-resizer__handler image-resizer__handler--${L}`,onMouseDown:M=>A(M,L)},`image-dir-${L}`))})]})})}function ns({editor:e,imageInline:t,onClose:i}){const{t:r}=b.useLocale(),[a,o]=d.useState(!1),s=d.useRef(null),[c,l]=d.useState(),[h,u]=d.useState(""),x=d.useRef(null),[m,f]=d.useState({src:"",file:null});function p(j){if(s.current&&j.width&&j.height){const S=v(s.current,j);u(S)}}function v(j,S){const T=document.createElement("canvas"),I=j.naturalWidth/j.width,O=j.naturalHeight/j.height;T.width=S.width*I,T.height=S.height*O;const E=T.getContext("2d");return E&&(E.imageSmoothingEnabled=!1,E.drawImage(j,S.x*I,S.y*O,S.width*I,S.height*O,0,0,S.width*I,S.height*O)),T.toDataURL("image/png",1)}async function N(){var j,S;try{const T=await Pt(h,((j=m==null?void 0:m.file)==null?void 0:j.name)||"image.png"),I=(S=e.extensionManager.extensions.find(E=>E.name==="image"))==null?void 0:S.options;let O="";I.upload?O=await I.upload(T):O=URL.createObjectURL(T),e.chain().focus().setImageInline({src:O,inline:t}).run(),o(!1),f({src:"",file:null}),i()}catch(T){console.log("Error cropping image",T)}}function A(j){var S;j.preventDefault(),(S=x.current)==null||S.click()}const k=async j=>{var O;const S=(O=j==null?void 0:j.target)==null?void 0:O.files;if(!e||e.isDestroyed||S.length===0)return;const T=S[0],I=await pr(T);o(!0),f({src:I.src,file:T})};return n.jsxs(n.Fragment,{children:[n.jsx(F,{className:"richtext-w-full richtext-mt-1",size:"sm",onClick:A,children:r("editor.image.dialog.tab.uploadCrop")}),n.jsxs(je,{open:a,children:[n.jsx(ke,{}),n.jsxs(ue,{children:[n.jsx(me,{children:r("editor.image.dialog.tab.uploadCrop")}),n.jsx("div",{children:m.src&&n.jsx(hi,{crop:c,onChange:j=>l(j),onComplete:j=>p(j),className:"richtext-w-full",children:n.jsx("img",{ref:s,alt:"Crop me",src:m.src})})}),n.jsxs(Pe,{children:[n.jsxs(F,{onClick:()=>{o(!1),f({src:"",file:null})},children:[r("editor.imageUpload.cancel"),n.jsx($,{name:"Trash2",className:"richtext-ml-[4px]"})]}),n.jsxs(F,{className:"richtext-w-fit",onClick:N,children:[r("editor.imageUpload.crop"),n.jsx($,{name:"Crop",className:"richtext-ml-[4px]"})]})]})]})]}),n.jsx("input",{type:"file",accept:"image/*",ref:x,multiple:!0,style:{display:"none"},onChange:k})]})}function is(e){const{t}=b.useLocale(),i=Zo(),[r,a]=d.useState(""),o=d.useRef(null),[s,c]=d.useState(!1),l=d.useMemo(()=>{var f;return(f=e.editor.extensionManager.extensions.find(p=>p.name===Yn.name))==null?void 0:f.options},[e.editor]);async function h(m){var N;const f=(N=m==null?void 0:m.target)==null?void 0:N.files;if(!e.editor||e.editor.isDestroyed||f.length===0)return;const p=f[0];let v="";l.upload?v=await l.upload(p):v=URL.createObjectURL(p),e.editor.chain().focus().setImageInline({src:v,inline:s}).run(),Te.setOpen(!1),c(!1)}function u(m){m.preventDefault(),m.stopPropagation(),e.editor.chain().focus().setImageInline({src:r,inline:s}).run(),Te.setOpen(!1),c(!1)}function x(m){var f;m.preventDefault(),(f=o.current)==null||f.click()}return n.jsxs(je,{open:i,onOpenChange:Te.setOpen,children:[n.jsx(ke,{asChild:!0,children:n.jsx(y,{icon:e.icon,action:()=>Te.setOpen(!0),tooltip:e.tooltip})}),n.jsxs(ue,{children:[n.jsx(me,{children:t("editor.image.dialog.title")}),n.jsxs(zt,{defaultValue:l.resourceImage==="both"||l.resourceImage==="upload"?"upload":"link",activationMode:"manual",children:[n.jsxs(ct,{className:"richtext-grid richtext-w-full richtext-grid-cols-2",children:[l.resourceImage==="both"||l.resourceImage==="upload"?n.jsx(Me,{value:"upload",children:t("editor.image.dialog.tab.upload")}):n.jsx(n.Fragment,{}),l.resourceImage==="both"||l.resourceImage==="link"?n.jsx(Me,{value:"link",children:t("editor.image.dialog.tab.url")}):n.jsx(n.Fragment,{})]}),n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[4px] richtext-my-[10px]",children:[n.jsx(kn,{checked:s,onCheckedChange:m=>{c(m)}}),n.jsx(X,{children:t("editor.link.dialog.inline")})]}),n.jsxs(Ee,{value:"upload",children:[n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:[n.jsx(F,{className:"richtext-w-full richtext-mt-1",size:"sm",onClick:x,children:t("editor.image.dialog.tab.upload")}),n.jsx(ns,{editor:e.editor,imageInline:s,onClose:()=>Te.setOpen(!1)})]}),n.jsx("input",{type:"file",accept:"image/*",ref:o,multiple:!0,style:{display:"none"},onChange:h})]}),n.jsx(Ee,{value:"link",children:n.jsx("form",{onSubmit:u,children:n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2",children:[n.jsx(Z,{type:"url",autoFocus:!0,value:r,onChange:m=>a(m.target.value),required:!0,placeholder:t("editor.image.dialog.placeholder")}),n.jsx(F,{type:"submit",children:t("editor.image.dialog.button.apply")})]})})})]})]})]})}const Ae=new w.PluginKey("upload-image");function rs(){return new w.Plugin({key:Ae,state:{init(){return w.DecorationSet.empty},apply(e,t){t=t.map(e.mapping,e.doc);const i=e.getMeta(Ae);if(i!=null&&i.add)for(const{id:r,pos:a,src:o}of i.add){const s=as(o),c=w.Decoration.widget(a,s,{id:r});t=t.add(e.doc,[c])}else if(i!=null&&i.remove)for(const r of i.remove)t=t.remove(t.find(void 0,void 0,a=>a.id===r));return t}},props:{decorations(e){return this.getState(e)}}})}function as(e){const t=document.createElement("div"),i=document.createElement("img");return i.setAttribute("class","opacity-50"),i.src=e,i.addEventListener("load",()=>{t.setAttribute("class","img-placeholder")}),t.append(i),t}function os(e,t){var a;const r=Ae.getState(e).find(void 0,void 0,o=>o.id===t);return r.length>0?(a=r[0])==null?void 0:a.from:null}function ss({validateFn:e,onUpload:t,postUpload:i}){return(r,a,o)=>{for(const s of r){if(e&&!e(s))continue;const c=Date.now().toString(),l=a.state.tr;l.selection.empty||l.deleteSelection();const h=URL.createObjectURL(s);l.setMeta(Ae,{add:[{id:c,pos:o,src:h}]}),a.dispatch(l),t(s).then(async u=>{var A;i&&typeof u=="string"&&(u=await i(u));const{schema:x}=a.state;let m=os(a.state,c);if(m===null)return;const f=typeof u=="object"?h:u,p=(A=x.nodes.image)==null?void 0:A.create({src:f});if(!p)return;const{doc:v}=a.state;m>v.content.size&&(m=v.content.size-1);const N=a.state.tr.replaceWith(m,m,p).setMeta(Ae,{remove:[c]});a.dispatch(N)},()=>{const u=a.state.tr.delete(o,o).setMeta(Ae,{remove:[c]});a.dispatch(u)})}}}function cs(e,t,i){var a;const r=[...((a=t.clipboardData)==null?void 0:a.files)||[]];if(r.length>0){t.preventDefault();const o=e.state.selection.from;return i(r,e,o+1),!0}return!1}function ls(e,t,i,r){var o;const a=[...((o=t.dataTransfer)==null?void 0:o.files)||[]];if(!i&&a.length>0){t.preventDefault();const s=e.posAtCoords({left:t.clientX,top:t.clientY});if(s)return r(a,e,s.pos+1),!0}return!1}const ds={acceptMimes:["image/jpeg","image/gif","image/png","image/jpg"],maxSize:1024*1024*5,resourceImage:"both"},Yn=g.Image.extend({group:"inline",inline:!0,defining:!0,draggable:!0,selectable:!0,addOptions(){var e;return{...ds,...(e=this.parent)==null?void 0:e.call(this),upload:()=>Promise.reject("Image Upload Function"),button:({editor:t,extension:i,t:r})=>{var a,o;return{component:is,componentProps:{action:()=>{},upload:i.options.upload,disabled:!((o=(a=t.can()).setImage)!=null&&o.call(a,{})),icon:"ImageUp",tooltip:r("editor.image.tooltip"),editor:t}}}}},addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),flipX:{default:!1},flipY:{default:!1},width:{default:null,parseHTML:t=>{const i=t.style.width||t.getAttribute("width")||null;return i?Number.parseInt(i,10):null},renderHTML:t=>({width:t.width})},align:{default:"center",parseHTML:t=>t.getAttribute("align"),renderHTML:t=>({align:t.align})},inline:{default:!1,parseHTML:t=>!!t.getAttribute("inline"),renderHTML:t=>({inline:t.inline})}}},addNodeView(){return g.ReactNodeViewRenderer(ts)},addCommands(){var e;return{...(e=this.parent)==null?void 0:e.call(this),setImageInline:t=>({commands:i})=>i.insertContent({type:this.name,attrs:t}),updateImage:t=>({commands:i})=>i.updateAttributes(this.name,t),setAlignImage:t=>({commands:i})=>i.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:e}){const{flipX:t,flipY:i,align:r,inline:a}=e,o=t||i?`transform: rotateX(${t?"180":"0"}deg) rotateY(${i?"180":"0"}deg);`:"",s=r?`text-align: ${r};`:"";return[a?"span":"div",{style:s,class:"image"},["img",g.mergeAttributes({height:"auto",style:o},this.options.HTMLAttributes,e)]]},parseHTML(){return[{tag:"span.image img",getAttrs:e=>{var o;const t=e==null?void 0:e.parentElement,i=e==null?void 0:e.getAttribute("width"),r=(e==null?void 0:e.getAttribute("flipx"))||!1,a=(e==null?void 0:e.getAttribute("flipy"))||!1;return{src:e==null?void 0:e.getAttribute("src"),alt:e==null?void 0:e.getAttribute("alt"),caption:e==null?void 0:e.getAttribute("caption"),width:i?Number.parseInt(i,10):null,align:(e==null?void 0:e.getAttribute("align"))||((o=t==null?void 0:t.style)==null?void 0:o.textAlign)||null,inline:(e==null?void 0:e.getAttribute("inline"))||!1,flipX:r==="true",flipY:a==="true"}}},{tag:"div[class=image]",getAttrs:e=>{const t=e.querySelector("img"),i=t==null?void 0:t.getAttribute("width"),r=(t==null?void 0:t.getAttribute("flipx"))||!1,a=(t==null?void 0:t.getAttribute("flipy"))||!1;return{src:t==null?void 0:t.getAttribute("src"),alt:t==null?void 0:t.getAttribute("alt"),caption:t==null?void 0:t.getAttribute("caption"),width:i?Number.parseInt(i,10):null,align:(t==null?void 0:t.getAttribute("align"))||e.style.textAlign||null,inline:(t==null?void 0:t.getAttribute("inline"))||!1,flipX:r==="true",flipY:a==="true"}}}]},addProseMirrorPlugins(){const t=ss({validateFn:i=>!(!this.options.acceptMimes.includes(i.type)||i.size>this.options.maxSize),onUpload:this.options.upload});return[new w.Plugin({props:{handlePaste:(i,r)=>!r.clipboardData||[...r.clipboardData.files||[]].some(o=>o.type==="text/html")?!1:cs(i,r,t),handleDrop:(i,r,a,o)=>(!(r instanceof DragEvent)||!r.dataTransfer||ls(i,r,o,t),!1)}}),rs()]}});function hs(e){return/\.(?:mp4|webm|ogg|mov)$/i.test(e)}function us(e){const{t}=b.useLocale(),[i,r]=d.useState(""),a=d.useRef(null),o=Xo(),[s,c]=d.useState(""),l=d.useMemo(()=>{var f;return(f=e.editor.extensionManager.extensions.find(p=>p.name===Jn.name))==null?void 0:f.options},[e.editor]);async function h(m){var N;const f=(N=m==null?void 0:m.target)==null?void 0:N.files;if(!e.editor||e.editor.isDestroyed||f.length===0)return;const p=f[0];let v="";l.upload?v=await l.upload(p):v=URL.createObjectURL(p),e.editor.chain().setVideo({src:v,width:"100%"}).focus().run(),Fe.setOpen(!1)}function u(m){m.preventDefault(),m.stopPropagation(),i&&(e.editor.chain().setVideo({src:i,width:"100%"}).focus().run(),Fe.setOpen(!1))}function x(m){var f;m.preventDefault(),(f=a.current)==null||f.click()}return n.jsxs(je,{open:o,onOpenChange:Fe.setOpen,children:[n.jsx(ke,{asChild:!0,children:n.jsx(y,{icon:e.icon,action:()=>Fe.setOpen(!0),tooltip:e.tooltip})}),n.jsxs(ue,{children:[n.jsx(me,{children:t("editor.video.dialog.title")}),n.jsxs(zt,{defaultValue:(l==null?void 0:l.resourceVideo)==="both"||(l==null?void 0:l.resourceVideo)==="upload"?"upload":"link",activationMode:"manual",children:[n.jsxs(ct,{className:"richtext-grid richtext-w-full richtext-grid-cols-2",children:[((l==null?void 0:l.resourceVideo)==="both"||(l==null?void 0:l.resourceVideo)==="upload")&&n.jsx(Me,{value:"upload",children:t("editor.video.dialog.tab.upload")}),((l==null?void 0:l.resourceVideo)==="both"||(l==null?void 0:l.resourceVideo)==="link")&&n.jsx(Me,{value:"link",children:t("editor.video.dialog.link")})]}),n.jsxs(Ee,{value:"upload",children:[n.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:n.jsx(F,{className:"richtext-w-full richtext-mt-1",size:"sm",onClick:x,children:t("editor.video.dialog.tab.upload")})}),n.jsx("input",{type:"file",accept:"video/*",ref:a,multiple:!0,style:{display:"none"},onChange:h})]}),n.jsxs(Ee,{value:"link",children:[n.jsx("form",{onSubmit:u,children:n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2",children:[n.jsx(Z,{type:"url",autoFocus:!0,value:i,onChange:m=>{const f=m.target.value;if(!hs(f)){c("Invalid video URL"),r("");return}c(""),r(f)},required:!0,placeholder:t("editor.video.dialog.placeholder")}),n.jsx(F,{type:"submit",children:t("editor.video.dialog.button.apply")})]})}),s&&n.jsx("div",{className:"richtext-text-red-500 richtext-my-[5px]",children:s})]})]})]})]})}function ms(e){return e=e.replace("https://youtu.be/","https://www.youtube.com/watch?v=").replace("watch?v=","embed/"),e=e.replace("https://vimeo.com/","https://player.vimeo.com/video/"),/^https?:\/\/www.bilibili.com\/video\/.*/i.test(e)&&(e=e.replace(/\?.*$/,"").replace("https://www.bilibili.com/video/","https://player.bilibili.com/player.html?bvid=")),e.includes("drive.google.com")&&(e=e.replace("/view","/preview")),e}const Jn=g.Node.create({name:"video",group:"block",atom:!0,draggable:!0,addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,frameborder:!1,resourceVideo:"both",width:b.VIDEO_SIZE["size-medium"],HTMLAttributes:{class:"iframe-wrapper",style:"display: flex;justify-content: center;"},button:({editor:e,t})=>{var i,r;return{component:us,componentProps:{action:()=>{},isActive:()=>e.isActive("video")||!1,disabled:!((r=(i=e.can()).setVideo)!=null&&r.call(i,{})),icon:"Video",tooltip:t("editor.video.tooltip"),editor:e}}}}},addAttributes(){return{src:{default:null,renderHTML:({src:e})=>({src:e?ms(e):null})},width:{default:this.options.width,renderHTML:({width:e})=>({width:qi(e)})},frameborder:{default:this.options.frameborder?1:0,parseHTML:()=>this.options.frameborder?1:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen}}},parseHTML(){return[{tag:"div[data-video] iframe"}]},renderHTML({HTMLAttributes:e}){const{width:t="100%"}=e??{},i={...e,width:"100%",height:"100%"},r=`position: relative;overflow: hidden;display: flex;flex: 1;max-width: ${t};`,a=`flex: 1;padding-bottom: ${9/16*100}%;`,c=["div",{style:r},["div",{style:a}],["iframe",i]];return["div",{...this.options.HTMLAttributes,"data-video":""},c]},addCommands(){return{setVideo:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e}),updateVideo:e=>({commands:t})=>t.updateAttributes(this.name,e)}}});function xs(e,t,i){if(!e.doc)return e;const r=e.doc.nodeAt(t);if(!r||i===r.attrs.backgroundColor)return e;const a={...r.attrs,backgroundColor:i};return e.setNodeMarkup(t,r.type,a,r.marks)}function fs(e,t,i){const{doc:r,selection:a}=e;return!r||!a||!(a instanceof w.CellSelection)||a.forEachCell((o,s)=>{e=xs(e,s,i)}),e}function cn(e,t){return({tr:i,state:r,dispatch:a})=>{const{selection:o}=r;return i=i.setSelection(o),i=fs(i,t,e),i.docChanged?(a==null||a(i),!0):!1}}const gs=g.Extension.create({name:"tableCellBackground",addOptions(){return{types:["tableCell"],HTMLAttributes:{}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{parseHTML:e=>e.style.backgroundColor||"",renderHTML:e=>!e.backgroundColor||e.backgroundColor===""?{}:{style:`background-color: ${e.backgroundColor}`}}}}]},addCommands(){return{setTableCellBackground:e=>cn(e,this.options),unsetTableCellBackground:()=>cn("",this.options)}}}),bs=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,ps=/CrOS/,_s=/android|ipad|playbook|silk/i;function ln(e={}){let t=e.ua||typeof navigator<"u"&&navigator.userAgent;return t&&typeof t=="object"&&t.headers&&typeof t.headers["user-agent"]=="string"&&(t=t.headers["user-agent"]),typeof t!="string"?!1:!!(bs.test(t)&&!ps.test(t)||e.tablet&&_s.test(t)||e.tablet&&e.featureDetect&&navigator&&navigator.maxTouchPoints>1&&t.includes("Macintosh")&&t.includes("Safari"))}const dn=e=>Array.from({length:e}).map((t,i)=>i+1);function ws(e){var u;const[t,i]=d.useState(!0),[r,a]=d.useState({rows:ln()?b.TABLE_MAX_GRID_SIZE:b.TABLE_INIT_GRID_SIZE,cols:ln()?b.TABLE_MAX_GRID_SIZE:b.TABLE_INIT_GRID_SIZE}),[o,s]=d.useState({rows:b.TABLE_DEFAULT_SELECTED_GRID_SIZE,cols:b.TABLE_DEFAULT_SELECTED_GRID_SIZE});function c(x,m){x===r.rows&&a(f=>({...f,rows:Math.min(x+1,b.TABLE_MAX_GRID_SIZE)})),m===r.cols&&a(f=>({...f,cols:Math.min(m+1,b.TABLE_MAX_GRID_SIZE)})),s({rows:x,cols:m})}function l(x,m){e==null||e.createTable({rows:x,cols:m,withHeaderRow:t}),h()}function h(){i(!1),a({rows:b.TABLE_INIT_GRID_SIZE,cols:b.TABLE_INIT_GRID_SIZE}),s({rows:b.TABLE_DEFAULT_SELECTED_GRID_SIZE,cols:b.TABLE_DEFAULT_SELECTED_GRID_SIZE})}return n.jsxs(ee,{modal:!0,children:[n.jsx(te,{asChild:!0,children:e==null?void 0:e.children}),n.jsx(Y,{className:"richtext-w-full !richtext-p-2",align:"start",side:"bottom",children:n.jsxs("div",{className:"richtext-p-0 table-grid-size-editor",children:[n.jsx("div",{className:"richtext-flex richtext-flex-col richtext-flex-wrap richtext-justify-between richtext-gap-1",children:(u=dn(r==null?void 0:r.rows))==null?void 0:u.map(x=>{var m;return n.jsx("div",{className:"richtext-flex richtext-gap-1",children:(m=dn(r==null?void 0:r.cols))==null?void 0:m.map(f=>n.jsx("div",{className:`richtext-cursor-pointer richtext-border-border ${f<=o.cols&&x<=o.rows&&"!richtext-bg-foreground tableCellActive"}`,onMouseOver:()=>c(x,f),onMouseDown:()=>l(x,f),children:n.jsx("div",{className:"richtext-w-4 richtext-h-4 richtext-p-1 !richtext-border richtext-rounded-[2px] richtext-box-border richtext-border-solid !richtext-border-border"})},`c-${f}`))},`r-${x}`)})}),n.jsxs("div",{className:"richtext-mt-2 richtext-text-sm richtext-text-center richtext-text-zinc-600",children:[o.rows," ","x",o.cols]})]})})]})}function vs(e){function t(i){e.disabled||e.editor.chain().focus().insertTable({...i,withHeaderRow:!1}).run()}return n.jsx(ws,{createTable:t,children:n.jsx(y,{icon:e==null?void 0:e.icon,tooltip:e==null?void 0:e.tooltip,disabled:e==null?void 0:e.disabled,color:e==null?void 0:e.color,action:e==null?void 0:e.action,isActive:e==null?void 0:e.isActive})})}const ys=g.Table.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!1,button:({editor:t,t:i})=>({component:vs,componentProps:{disabled:t.isActive("table")||!1,icon:"Table",tooltip:i("editor.table.tooltip"),editor:t}})}},addExtensions(){return[g.TableRow.configure(this.options.tableRow),g.TableHeader.configure(this.options.tableHeader),g.TableCell.configure(this.options.tableCell),gs.configure(this.options.tableCellBackground)]}}),js=g.Extension.create({name:"painter",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:i})=>({component:y,componentProps:{action:()=>{t.commands.setPainter(t==null?void 0:t.state.selection.$head.marks())},icon:"PaintRoller",tooltip:i("editor.format")}})}},addCommands(){return{setPainter:e=>({view:{dispatch:t,state:{tr:i},dom:r}})=>{const s=`url("data:image/svg+xml;utf8,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#000" d="M9 22v-6H4V7q0-1.65 1.175-2.825T8 3h12v13h-5v6zM6 10h12V5h-1v4h-2V5h-1v2h-2V5H8q-.825 0-1.412.588T6 7zm0 4h12v-2H6zm0 0v-2z"/></svg>')}"), auto`;return r.style.cursor=s,t(i.setMeta("painterAction",{type:"start",marks:e})),!0}}},addProseMirrorPlugins(){return[new w.Plugin({key:new w.PluginKey("format-painter"),state:{init:()=>[],apply:(e,t)=>{const i=e.getMeta("painterAction");return i&&i.type==="start"?t=i.marks:i&&i.type==="end"&&(t=[]),t}},props:{handleDOMEvents:{mousedown(e,t){const i=this.getState(e.state);if(!i||i.length===0)return e.dom.style.cursor="",!1;const r=()=>{document.removeEventListener("mouseup",r);let{dispatch:a,state:{tr:o,selection:s},dom:c}=e;c.style.cursor="",o=o.removeMark(s.from,s.to);for(const l of i)l.type.name!=="link"&&(o=o.addMark(s.from,s.to,l));a(o.setMeta("painterAction",{type:"end"}))};return document.addEventListener("mouseup",r),!0}}}})]}});function ks({editor:e,...t}){const{t:i}=b.useLocale(),[r,a]=d.useState(-1),[o,s]=d.useState([]),[c,l]=d.useState(""),[h,u]=d.useState(""),[x,m]=d.useState(!1),[f,p]=d.useState(!1);return d.useEffect(()=>{x||(l(""),u(""),a(-1),s([]),e.commands.setSearchTerm(""),e.commands.setReplaceTerm(""))},[e,x]),d.useEffect(()=>{x&&e&&e.commands&&e.commands.setSearchTerm&&e.commands.setSearchTerm(c)},[x,c,e]),d.useEffect(()=>{x&&e&&e.commands&&e.commands.setReplaceTerm&&e.commands.setReplaceTerm(h)},[x,h,e]),d.useEffect(()=>{if(!e)return;const v=e.extensionManager.extensions.find(A=>A.name===Qn.name);if(!v)return;const N=()=>{if(!x)return;const A=v?v.storage.currentIndex:-1,k=v?v.storage.results:[];a(j=>j!==A?A:j),s(j=>w.deepEqual(j,k)?j:k)};return window.addEventListener(At,N),()=>{v&&window.removeEventListener(At,N)}},[x,e]),n.jsxs(ee,{open:x,onOpenChange:m,children:[n.jsx(te,{disabled:t==null?void 0:t.disabled,asChild:!0,children:n.jsx(y,{tooltip:t==null?void 0:t.tooltip,isActive:t==null?void 0:t.isActive,disabled:t==null?void 0:t.disabled,children:n.jsx($,{name:t==null?void 0:t.icon})})}),n.jsxs(Y,{hideWhenDetached:!0,className:"richtext-w-full",align:"start",side:"bottom",children:[n.jsxs("div",{className:"richtext-mb-[6px] richtext-flex richtext-items-center richtext-justify-between",children:[n.jsx(X,{children:i("editor.search.dialog.text")}),n.jsx("span",{className:"richtext-font-semibold",children:o.length?`${r+1}/${o.length}`:"0/0"})]}),n.jsxs("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5 richtext-mb-[10px]",children:[n.jsx(Z,{type:"text",required:!0,className:"richtext-w-full",placeholder:"Text",autoFocus:!0,value:c,onChange:v=>l(v.target.value)}),n.jsx(F,{disabled:!o.length,className:"richtext-flex-1",onClick:e.commands.goToPrevSearchResult,children:n.jsx($,{name:"ChevronUp"})}),n.jsx(F,{disabled:!o.length,className:"richtext-flex-1",onClick:e.commands.goToNextSearchResult,children:n.jsx($,{name:"ChevronDown"})})]}),n.jsx(X,{className:"richtext-mb-[6px]",children:i("editor.replace.dialog.text")}),n.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5 richtext-mb-[5px]",children:n.jsx("div",{className:"richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm",children:n.jsx(Z,{type:"text",required:!0,className:"richtext-w-80",placeholder:"Text",value:h,onChange:v=>u(v.target.value)})})}),n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-space-x-2 richtext-mb-[10px]",children:[n.jsx(Ht,{checked:f,onCheckedChange:v=>{p(v),e.commands.setCaseSensitive(v)}}),n.jsx(X,{children:i("editor.replace.caseSensitive")})]}),n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:[n.jsx(F,{disabled:!o.length,className:"richtext-flex-1",onClick:e.commands.replace,children:i("editor.replace.dialog.text")}),n.jsx(F,{disabled:!o.length,className:"richtext-flex-1",onClick:e.commands.replaceAll,children:i("editor.replaceAll.dialog.text")})]})]})]})}const $e=(e,t)=>t(e.tr);function Cs(e,t,i){return RegExp(t?e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"):e,i?"gu":"gui")}function Ns(e,t,i){const r=[];let a=[];const o=[];let s=0;if(!t)return{decorationsToReturn:[],results:[]};e==null||e.descendants((c,l)=>{c.isText?a[s]?a[s]={text:a[s].text+c.text,pos:a[s].pos}:a[s]={text:`${c.text}`,pos:l}:s+=1}),a=a.filter(Boolean);for(let c=0;c<a.length;c+=1){const{text:l,pos:h}=a[c],u=[...l.matchAll(t)];for(let x=0;x<u.length;x+=1){const m=u[x];if(m[0]==="")break;m.index!==void 0&&o.push({from:h+m.index,to:h+m.index+m[0].length})}}for(let c=0;c<o.length;c+=1){const l=o[c];r.push(w.Decoration.inline(l.from,l.to,{class:i}))}return{decorationsToReturn:r,results:o}}function hn(e,t,{state:i,dispatch:r}){if(!t[0])return;const{from:o,to:s}=t[0];r&&r(i.tr.insertText(e,o,s))}function Ss(e,t,i,r){const a=t+1;if(!r[a])return null;const{from:o,to:s}=r[t],c=s-o-e.length+i,{from:l,to:h}=r[a];return r[a]={to:h-c,from:l-c},[c,r]}function Ts(e,t,{tr:i,dispatch:r}){let a=0,o=t.slice();if(!o.length)return!1;for(let s=0;s<o.length;s+=1){const{from:c,to:l}=o[s];i.insertText(e,c,l);const h=Ss(e,s,a,o);h&&(a=h[0],o=h[1])}return r(i),!0}function un({view:e,tr:t,searchResults:i,searchResultCurrentClass:r,gotoIndex:a}){const o=i[a];if(o){const s=t.setMeta("directDecoration",{fromPos:o.from,toPos:o.to,attrs:{class:r}});return e==null||e.dispatch(s),setTimeout(()=>{const c=window.document.querySelector(`.${r}`);c&&Et(c,{behavior:"smooth",scrollMode:"if-needed"})},0),!0}return!1}const At="ON_SEARCH_RESULTS",Ne=new CustomEvent(At),Qn=g.Extension.create({name:"search",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),searchTerm:"",replaceTerm:"",results:[],currentIndex:0,searchResultClass:"search-result",searchResultCurrentClass:"search-result-current",caseSensitive:!1,disableRegex:!1,onChange:()=>{},button:({editor:t,t:i})=>({component:ks,componentProps:{action:()=>{},icon:"SearchAndReplace",tooltip:i("editor.searchAndReplace.tooltip"),isActive:()=>!1,disabled:!1,editor:t}})}},addStorage(){return{results:[],currentIndex:-1}},addCommands(){return{setSearchTerm:e=>({state:t,dispatch:i})=>(this.options.searchTerm=e,this.storage.results=[],this.storage.currentIndex=0,window.dispatchEvent(Ne),$e(t,i),!1),setReplaceTerm:e=>({state:t,dispatch:i})=>(this.options.replaceTerm=e,$e(t,i),!1),setCaseSensitive:e=>({state:t,dispatch:i})=>(this.options.caseSensitive=e,$e(t,i),!1),replace:()=>({state:e,dispatch:t})=>{const{replaceTerm:i}=this.options,{currentIndex:r,results:a}=this.storage,o=a[r];return o?(hn(i,[o],{state:e,dispatch:t}),this.storage.results.splice(r,1)):(hn(i,a,{state:e,dispatch:t}),this.storage.results.shift()),window.dispatchEvent(Ne),$e(e,t),!1},replaceAll:()=>({state:e,tr:t,dispatch:i})=>{const{replaceTerm:r}=this.options,{results:a}=this.storage;return Ts(r,a,{tr:t,dispatch:i}),this.storage.currentIndex=-1,this.storage.results=[],window.dispatchEvent(Ne),$e(e,i),!1},goToPrevSearchResult:()=>({view:e,tr:t})=>{const{searchResultCurrentClass:i}=this.options,{currentIndex:r,results:a}=this.storage,o=(r+a.length-1)%a.length;return this.storage.currentIndex=o,window.dispatchEvent(Ne),un({view:e,tr:t,searchResults:a,searchResultCurrentClass:i,gotoIndex:o})},goToNextSearchResult:()=>({view:e,tr:t})=>{const{searchResultCurrentClass:i}=this.options,{currentIndex:r,results:a}=this.storage,o=(r+1)%a.length;return this.storage.currentIndex=o,this.options.onChange&&this.options.onChange(),window.dispatchEvent(Ne),un({view:e,tr:t,searchResults:a,searchResultCurrentClass:i,gotoIndex:o})}}},addProseMirrorPlugins(){const e=this;return[new w.Plugin({key:new w.PluginKey("search"),state:{init(){return w.DecorationSet.empty},apply(t){const{doc:i,docChanged:r}=t,{searchTerm:a,searchResultClass:o,searchResultCurrentClass:s,disableRegex:c,caseSensitive:l}=e.options;if(r||a){const{decorationsToReturn:h,results:u}=Ns(i,Cs(a,c,l),o);if(e.storage.results=u,e.storage.currentIndex>u.length-1&&(e.storage.currentIndex=0),window.dispatchEvent(Ne),t.getMeta("directDecoration")){const{fromPos:x,toPos:m,attrs:f}=t.getMeta("directDecoration");h.push(w.Decoration.inline(x,m,f))}else u.length&&(h[0]=w.Decoration.inline(u[0].from,u[0].to,{class:s}));return w.DecorationSet.create(i,h)}return w.DecorationSet.empty}},props:{decorations(t){return this.getState(t)}}})]}}),Re={100:"💯",1234:"🔢",grinning:"😀",smiley:"😃",smile:"😄",grin:"😁",laughing:"😆",satisfied:"😆",sweat_smile:"😅",rofl:"🤣",joy:"😂",slightly_smiling_face:"🙂",upside_down_face:"🙃",wink:"😉",blush:"😊",innocent:"😇",smiling_face_with_three_hearts:"🥰",heart_eyes:"😍",star_struck:"🤩",kissing_heart:"😘",kissing:"😗",relaxed:"☺️",kissing_closed_eyes:"😚",kissing_smiling_eyes:"😙",smiling_face_with_tear:"🥲",yum:"😋",stuck_out_tongue:"😛",stuck_out_tongue_winking_eye:"😜",zany_face:"🤪",stuck_out_tongue_closed_eyes:"😝",money_mouth_face:"🤑",hugs:"🤗",hand_over_mouth:"🤭",shushing_face:"🤫",thinking:"🤔",zipper_mouth_face:"🤐",raised_eyebrow:"🤨",neutral_face:"😐",expressionless:"😑",no_mouth:"😶",smirk:"😏",unamused:"😒",roll_eyes:"🙄",grimacing:"😬",lying_face:"🤥",relieved:"😌",pensive:"😔",sleepy:"😪",drooling_face:"🤤",sleeping:"😴",mask:"😷",face_with_thermometer:"🤒",face_with_head_bandage:"🤕",nauseated_face:"🤢",vomiting_face:"🤮",sneezing_face:"🤧",hot_face:"🥵",cold_face:"🥶",woozy_face:"🥴",dizzy_face:"😵",exploding_head:"🤯",cowboy_hat_face:"🤠",partying_face:"🥳",disguised_face:"🥸",sunglasses:"😎",nerd_face:"🤓",monocle_face:"🧐",confused:"😕",worried:"😟",slightly_frowning_face:"🙁",frowning_face:"☹️",open_mouth:"😮",hushed:"😯",astonished:"😲",flushed:"😳",pleading_face:"🥺",frowning:"😦",anguished:"😧",fearful:"😨",cold_sweat:"😰",disappointed_relieved:"😥",cry:"😢",sob:"😭",scream:"😱",confounded:"😖",persevere:"😣",disappointed:"😞",sweat:"😓",weary:"😩",tired_face:"😫",yawning_face:"🥱",triumph:"😤",rage:"😡",pout:"😡",angry:"😠",cursing_face:"🤬",smiling_imp:"😈",imp:"👿",skull:"💀",skull_and_crossbones:"☠️",hankey:"💩",poop:"💩",shit:"💩",clown_face:"🤡",japanese_ogre:"👹",japanese_goblin:"👺",ghost:"👻",alien:"👽",space_invader:"👾",robot:"🤖",smiley_cat:"😺",smile_cat:"😸",joy_cat:"😹",heart_eyes_cat:"😻",smirk_cat:"😼",kissing_cat:"😽",scream_cat:"🙀",crying_cat_face:"😿",pouting_cat:"😾",see_no_evil:"🙈",hear_no_evil:"🙉",speak_no_evil:"🙊",kiss:"💋",love_letter:"💌",cupid:"💘",gift_heart:"💝",sparkling_heart:"💖",heartpulse:"💗",heartbeat:"💓",revolving_hearts:"💞",two_hearts:"💕",heart_decoration:"💟",heavy_heart_exclamation:"❣️",broken_heart:"💔",heart:"❤️",orange_heart:"🧡",yellow_heart:"💛",green_heart:"💚",blue_heart:"💙",purple_heart:"💜",brown_heart:"🤎",black_heart:"🖤",white_heart:"🤍",anger:"💢",boom:"💥",collision:"💥",dizzy:"💫",sweat_drops:"💦",dash:"💨",hole:"🕳️",bomb:"💣",speech_balloon:"💬",eye_speech_bubble:"👁️🗨️",left_speech_bubble:"🗨️",right_anger_bubble:"🗯️",thought_balloon:"💭",zzz:"💤",wave:"👋",raised_back_of_hand:"🤚",raised_hand_with_fingers_splayed:"🖐️",hand:"✋",raised_hand:"✋",vulcan_salute:"🖖",ok_hand:"👌",pinched_fingers:"🤌",pinching_hand:"🤏",v:"✌️",crossed_fingers:"🤞",love_you_gesture:"🤟",metal:"🤘",call_me_hand:"🤙",point_left:"👈",point_right:"👉",point_up_2:"👆",middle_finger:"🖕",fu:"🖕",point_down:"👇",point_up:"☝️","+1":"👍",thumbsup:"👍","-1":"👎",thumbsdown:"👎",fist_raised:"✊",fist:"✊",fist_oncoming:"👊",facepunch:"👊",punch:"👊",fist_left:"🤛",fist_right:"🤜",clap:"👏",raised_hands:"🙌",open_hands:"👐",palms_up_together:"🤲",handshake:"🤝",pray:"🙏",writing_hand:"✍️",nail_care:"💅",selfie:"🤳",muscle:"💪",mechanical_arm:"🦾",mechanical_leg:"🦿",leg:"🦵",foot:"🦶",ear:"👂",ear_with_hearing_aid:"🦻",nose:"👃",brain:"🧠",anatomical_heart:"🫀",lungs:"🫁",tooth:"🦷",bone:"🦴",eyes:"👀",eye:"👁️",tongue:"👅",lips:"👄",baby:"👶",child:"🧒",boy:"👦",girl:"👧",adult:"🧑",blond_haired_person:"👱",man:"👨",bearded_person:"🧔",red_haired_man:"👨🦰",curly_haired_man:"👨🦱",white_haired_man:"👨🦳",bald_man:"👨🦲",woman:"👩",red_haired_woman:"👩🦰",person_red_hair:"🧑🦰",curly_haired_woman:"👩🦱",person_curly_hair:"🧑🦱",white_haired_woman:"👩🦳",person_white_hair:"🧑🦳",bald_woman:"👩🦲",person_bald:"🧑🦲",blond_haired_woman:"👱♀️",blonde_woman:"👱♀️",blond_haired_man:"👱♂️",older_adult:"🧓",older_man:"👴",older_woman:"👵",frowning_person:"🙍",frowning_man:"🙍♂️",frowning_woman:"🙍♀️",pouting_face:"🙎",pouting_man:"🙎♂️",pouting_woman:"🙎♀️",no_good:"🙅",no_good_man:"🙅♂️",ng_man:"🙅♂️",no_good_woman:"🙅♀️",ng_woman:"🙅♀️",ok_person:"🙆",ok_man:"🙆♂️",ok_woman:"🙆♀️",tipping_hand_person:"💁",information_desk_person:"💁",tipping_hand_man:"💁♂️",sassy_man:"💁♂️",tipping_hand_woman:"💁♀️",sassy_woman:"💁♀️",raising_hand:"🙋",raising_hand_man:"🙋♂️",raising_hand_woman:"🙋♀️",deaf_person:"🧏",deaf_man:"🧏♂️",deaf_woman:"🧏♀️",bow:"🙇",bowing_man:"🙇♂️",bowing_woman:"🙇♀️",facepalm:"🤦",man_facepalming:"🤦♂️",woman_facepalming:"🤦♀️",shrug:"🤷",man_shrugging:"🤷♂️",woman_shrugging:"🤷♀️",health_worker:"🧑⚕️",man_health_worker:"👨⚕️",woman_health_worker:"👩⚕️",student:"🧑🎓",man_student:"👨🎓",woman_student:"👩🎓",teacher:"🧑🏫",man_teacher:"👨🏫",woman_teacher:"👩🏫",judge:"🧑⚖️",man_judge:"👨⚖️",woman_judge:"👩⚖️",farmer:"🧑🌾",man_farmer:"👨🌾",woman_farmer:"👩🌾",cook:"🧑🍳",man_cook:"👨🍳",woman_cook:"👩🍳",mechanic:"🧑🔧",man_mechanic:"👨🔧",woman_mechanic:"👩🔧",factory_worker:"🧑🏭",man_factory_worker:"👨🏭",woman_factory_worker:"👩🏭",office_worker:"🧑💼",man_office_worker:"👨💼",woman_office_worker:"👩💼",scientist:"🧑🔬",man_scientist:"👨🔬",woman_scientist:"👩🔬",technologist:"🧑💻",man_technologist:"👨💻",woman_technologist:"👩💻",singer:"🧑🎤",man_singer:"👨🎤",woman_singer:"👩🎤",artist:"🧑🎨",man_artist:"👨🎨",woman_artist:"👩🎨",pilot:"🧑✈️",man_pilot:"👨✈️",woman_pilot:"👩✈️",astronaut:"🧑🚀",man_astronaut:"👨🚀",woman_astronaut:"👩🚀",firefighter:"🧑🚒",man_firefighter:"👨🚒",woman_firefighter:"👩🚒",police_officer:"👮",cop:"👮",policeman:"👮♂️",policewoman:"👮♀️",detective:"🕵️",male_detective:"🕵️♂️",female_detective:"🕵️♀️",guard:"💂",guardsman:"💂♂️",guardswoman:"💂♀️",ninja:"🥷",construction_worker:"👷",construction_worker_man:"👷♂️",construction_worker_woman:"👷♀️",prince:"🤴",princess:"👸",person_with_turban:"👳",man_with_turban:"👳♂️",woman_with_turban:"👳♀️",man_with_gua_pi_mao:"👲",woman_with_headscarf:"🧕",person_in_tuxedo:"🤵",man_in_tuxedo:"🤵♂️",woman_in_tuxedo:"🤵♀️",person_with_veil:"👰",man_with_veil:"👰♂️",woman_with_veil:"👰♀️",bride_with_veil:"👰♀️",pregnant_woman:"🤰",breast_feeding:"🤱",woman_feeding_baby:"👩🍼",man_feeding_baby:"👨🍼",person_feeding_baby:"🧑🍼",angel:"👼",santa:"🎅",mrs_claus:"🤶",mx_claus:"🧑🎄",superhero:"🦸",superhero_man:"🦸♂️",superhero_woman:"🦸♀️",supervillain:"🦹",supervillain_man:"🦹♂️",supervillain_woman:"🦹♀️",mage:"🧙",mage_man:"🧙♂️",mage_woman:"🧙♀️",fairy:"🧚",fairy_man:"🧚♂️",fairy_woman:"🧚♀️",vampire:"🧛",vampire_man:"🧛♂️",vampire_woman:"🧛♀️",merperson:"🧜",merman:"🧜♂️",mermaid:"🧜♀️",elf:"🧝",elf_man:"🧝♂️",elf_woman:"🧝♀️",genie:"🧞",genie_man:"🧞♂️",genie_woman:"🧞♀️",zombie:"🧟",zombie_man:"🧟♂️",zombie_woman:"🧟♀️",massage:"💆",massage_man:"💆♂️",massage_woman:"💆♀️",haircut:"💇",haircut_man:"💇♂️",haircut_woman:"💇♀️",walking:"🚶",walking_man:"🚶♂️",walking_woman:"🚶♀️",standing_person:"🧍",standing_man:"🧍♂️",standing_woman:"🧍♀️",kneeling_person:"🧎",kneeling_man:"🧎♂️",kneeling_woman:"🧎♀️",person_with_probing_cane:"🧑🦯",man_with_probing_cane:"👨🦯",woman_with_probing_cane:"👩🦯",person_in_motorized_wheelchair:"🧑🦼",man_in_motorized_wheelchair:"👨🦼",woman_in_motorized_wheelchair:"👩🦼",person_in_manual_wheelchair:"🧑🦽",man_in_manual_wheelchair:"👨🦽",woman_in_manual_wheelchair:"👩🦽",runner:"🏃",running:"🏃",running_man:"🏃♂️",running_woman:"🏃♀️",woman_dancing:"💃",dancer:"💃",man_dancing:"🕺",business_suit_levitating:"🕴️",dancers:"👯",dancing_men:"👯♂️",dancing_women:"👯♀️",sauna_person:"🧖",sauna_man:"🧖♂️",sauna_woman:"🧖♀️",climbing:"🧗",climbing_man:"🧗♂️",climbing_woman:"🧗♀️",person_fencing:"🤺",horse_racing:"🏇",skier:"⛷️",snowboarder:"🏂",golfing:"🏌️",golfing_man:"🏌️♂️",golfing_woman:"🏌️♀️",surfer:"🏄",surfing_man:"🏄♂️",surfing_woman:"🏄♀️",rowboat:"🚣",rowing_man:"🚣♂️",rowing_woman:"🚣♀️",swimmer:"🏊",swimming_man:"🏊♂️",swimming_woman:"🏊♀️",bouncing_ball_person:"⛹️",bouncing_ball_man:"⛹️♂️",basketball_man:"⛹️♂️",bouncing_ball_woman:"⛹️♀️",basketball_woman:"⛹️♀️",weight_lifting:"🏋️",weight_lifting_man:"🏋️♂️",weight_lifting_woman:"🏋️♀️",bicyclist:"🚴",biking_man:"🚴♂️",biking_woman:"🚴♀️",mountain_bicyclist:"🚵",mountain_biking_man:"🚵♂️",mountain_biking_woman:"🚵♀️",cartwheeling:"🤸",man_cartwheeling:"🤸♂️",woman_cartwheeling:"🤸♀️",wrestling:"🤼",men_wrestling:"🤼♂️",women_wrestling:"🤼♀️",water_polo:"🤽",man_playing_water_polo:"🤽♂️",woman_playing_water_polo:"🤽♀️",handball_person:"🤾",man_playing_handball:"🤾♂️",woman_playing_handball:"🤾♀️",juggling_person:"🤹",man_juggling:"🤹♂️",woman_juggling:"🤹♀️",lotus_position:"🧘",lotus_position_man:"🧘♂️",lotus_position_woman:"🧘♀️",bath:"🛀",sleeping_bed:"🛌",people_holding_hands:"🧑🤝🧑",two_women_holding_hands:"👭",couple:"👫",two_men_holding_hands:"👬",couplekiss:"💏",couplekiss_man_woman:"👩❤️💋👨",couplekiss_man_man:"👨❤️💋👨",couplekiss_woman_woman:"👩❤️💋👩",couple_with_heart:"💑",couple_with_heart_woman_man:"👩❤️👨",couple_with_heart_man_man:"👨❤️👨",couple_with_heart_woman_woman:"👩❤️👩",family:"👪",family_man_woman_boy:"👨👩👦",family_man_woman_girl:"👨👩👧",family_man_woman_girl_boy:"👨👩👧👦",family_man_woman_boy_boy:"👨👩👦👦",family_man_woman_girl_girl:"👨👩👧👧",family_man_man_boy:"👨👨👦",family_man_man_girl:"👨👨👧",family_man_man_girl_boy:"👨👨👧👦",family_man_man_boy_boy:"👨👨👦👦",family_man_man_girl_girl:"👨👨👧👧",family_woman_woman_boy:"👩👩👦",family_woman_woman_girl:"👩👩👧",family_woman_woman_girl_boy:"👩👩👧👦",family_woman_woman_boy_boy:"👩👩👦👦",family_woman_woman_girl_girl:"👩👩👧👧",family_man_boy:"👨👦",family_man_boy_boy:"👨👦👦",family_man_girl:"👨👧",family_man_girl_boy:"👨👧👦",family_man_girl_girl:"👨👧👧",family_woman_boy:"👩👦",family_woman_boy_boy:"👩👦👦",family_woman_girl:"👩👧",family_woman_girl_boy:"👩👧👦",family_woman_girl_girl:"👩👧👧",speaking_head:"🗣️",bust_in_silhouette:"👤",busts_in_silhouette:"👥",people_hugging:"🫂",footprints:"👣",monkey_face:"🐵",monkey:"🐒",gorilla:"🦍",orangutan:"🦧",dog:"🐶",dog2:"🐕",guide_dog:"🦮",service_dog:"🐕🦺",poodle:"🐩",wolf:"🐺",fox_face:"🦊",raccoon:"🦝",cat:"🐱",cat2:"🐈",black_cat:"🐈⬛",lion:"🦁",tiger:"🐯",tiger2:"🐅",leopard:"🐆",horse:"🐴",racehorse:"🐎",unicorn:"🦄",zebra:"🦓",deer:"🦌",bison:"🦬",cow:"🐮",ox:"🐂",water_buffalo:"🐃",cow2:"🐄",pig:"🐷",pig2:"🐖",boar:"🐗",pig_nose:"🐽",ram:"🐏",sheep:"🐑",goat:"🐐",dromedary_camel:"🐪",camel:"🐫",llama:"🦙",giraffe:"🦒",elephant:"🐘",mammoth:"🦣",rhinoceros:"🦏",hippopotamus:"🦛",mouse:"🐭",mouse2:"🐁",rat:"🐀",hamster:"🐹",rabbit:"🐰",rabbit2:"🐇",chipmunk:"🐿️",beaver:"🦫",hedgehog:"🦔",bat:"🦇",bear:"🐻",polar_bear:"🐻❄️",koala:"🐨",panda_face:"🐼",sloth:"🦥",otter:"🦦",skunk:"🦨",kangaroo:"🦘",badger:"🦡",feet:"🐾",paw_prints:"🐾",turkey:"🦃",chicken:"🐔",rooster:"🐓",hatching_chick:"🐣",baby_chick:"🐤",hatched_chick:"🐥",bird:"🐦",penguin:"🐧",dove:"🕊️",eagle:"🦅",duck:"🦆",swan:"🦢",owl:"🦉",dodo:"🦤",feather:"🪶",flamingo:"🦩",peacock:"🦚",parrot:"🦜",frog:"🐸",crocodile:"🐊",turtle:"🐢",lizard:"🦎",snake:"🐍",dragon_face:"🐲",dragon:"🐉",sauropod:"🦕","t-rex":"🦖",whale:"🐳",whale2:"🐋",dolphin:"🐬",flipper:"🐬",seal:"🦭",fish:"🐟",tropical_fish:"🐠",blowfish:"🐡",shark:"🦈",octopus:"🐙",shell:"🐚",snail:"🐌",butterfly:"🦋",bug:"🐛",ant:"🐜",bee:"🐝",honeybee:"🐝",beetle:"🪲",lady_beetle:"🐞",cricket:"🦗",cockroach:"🪳",spider:"🕷️",spider_web:"🕸️",scorpion:"🦂",mosquito:"🦟",fly:"🪰",worm:"🪱",microbe:"🦠",bouquet:"💐",cherry_blossom:"🌸",white_flower:"💮",rosette:"🏵️",rose:"🌹",wilted_flower:"🥀",hibiscus:"🌺",sunflower:"🌻",blossom:"🌼",tulip:"🌷",seedling:"🌱",potted_plant:"🪴",evergreen_tree:"🌲",deciduous_tree:"🌳",palm_tree:"🌴",cactus:"🌵",ear_of_rice:"🌾",herb:"🌿",shamrock:"☘️",four_leaf_clover:"🍀",maple_leaf:"🍁",fallen_leaf:"🍂",leaves:"🍃",grapes:"🍇",melon:"🍈",watermelon:"🍉",tangerine:"🍊",orange:"🍊",mandarin:"🍊",lemon:"🍋",banana:"🍌",pineapple:"🍍",mango:"🥭",apple:"🍎",green_apple:"🍏",pear:"🍐",peach:"🍑",cherries:"🍒",strawberry:"🍓",blueberries:"🫐",kiwi_fruit:"🥝",tomato:"🍅",olive:"🫒",coconut:"🥥",avocado:"🥑",eggplant:"🍆",potato:"🥔",carrot:"🥕",corn:"🌽",hot_pepper:"🌶️",bell_pepper:"🫑",cucumber:"🥒",leafy_green:"🥬",broccoli:"🥦",garlic:"🧄",onion:"🧅",mushroom:"🍄",peanuts:"🥜",chestnut:"🌰",bread:"🍞",croissant:"🥐",baguette_bread:"🥖",flatbread:"🫓",pretzel:"🥨",bagel:"🥯",pancakes:"🥞",waffle:"🧇",cheese:"🧀",meat_on_bone:"🍖",poultry_leg:"🍗",cut_of_meat:"🥩",bacon:"🥓",hamburger:"🍔",fries:"🍟",pizza:"🍕",hotdog:"🌭",sandwich:"🥪",taco:"🌮",burrito:"🌯",tamale:"🫔",stuffed_flatbread:"🥙",falafel:"🧆",egg:"🥚",fried_egg:"🍳",shallow_pan_of_food:"🥘",stew:"🍲",fondue:"🫕",bowl_with_spoon:"🥣",green_salad:"🥗",popcorn:"🍿",butter:"🧈",salt:"🧂",canned_food:"🥫",bento:"🍱",rice_cracker:"🍘",rice_ball:"🍙",rice:"🍚",curry:"🍛",ramen:"🍜",spaghetti:"🍝",sweet_potato:"🍠",oden:"🍢",sushi:"🍣",fried_shrimp:"🍤",fish_cake:"🍥",moon_cake:"🥮",dango:"🍡",dumpling:"🥟",fortune_cookie:"🥠",takeout_box:"🥡",crab:"🦀",lobster:"🦞",shrimp:"🦐",squid:"🦑",oyster:"🦪",icecream:"🍦",shaved_ice:"🍧",ice_cream:"🍨",doughnut:"🍩",cookie:"🍪",birthday:"🎂",cake:"🍰",cupcake:"🧁",pie:"🥧",chocolate_bar:"🍫",candy:"🍬",lollipop:"🍭",custard:"🍮",honey_pot:"🍯",baby_bottle:"🍼",milk_glass:"🥛",coffee:"☕",teapot:"🫖",tea:"🍵",sake:"🍶",champagne:"🍾",wine_glass:"🍷",cocktail:"🍸",tropical_drink:"🍹",beer:"🍺",beers:"🍻",clinking_glasses:"🥂",tumbler_glass:"🥃",cup_with_straw:"🥤",bubble_tea:"🧋",beverage_box:"🧃",mate:"🧉",ice_cube:"🧊",chopsticks:"🥢",plate_with_cutlery:"🍽️",fork_and_knife:"🍴",spoon:"🥄",hocho:"🔪",knife:"🔪",amphora:"🏺",earth_africa:"🌍",earth_americas:"🌎",earth_asia:"🌏",globe_with_meridians:"🌐",world_map:"🗺️",japan:"🗾",compass:"🧭",mountain_snow:"🏔️",mountain:"⛰️",volcano:"🌋",mount_fuji:"🗻",camping:"🏕️",beach_umbrella:"🏖️",desert:"🏜️",desert_island:"🏝️",national_park:"🏞️",stadium:"🏟️",classical_building:"🏛️",building_construction:"🏗️",bricks:"🧱",rock:"🪨",wood:"🪵",hut:"🛖",houses:"🏘️",derelict_house:"🏚️",house:"🏠",house_with_garden:"🏡",office:"🏢",post_office:"🏣",european_post_office:"🏤",hospital:"🏥",bank:"🏦",hotel:"🏨",love_hotel:"🏩",convenience_store:"🏪",school:"🏫",department_store:"🏬",factory:"🏭",japanese_castle:"🏯",european_castle:"🏰",wedding:"💒",tokyo_tower:"🗼",statue_of_liberty:"🗽",church:"⛪",mosque:"🕌",hindu_temple:"🛕",synagogue:"🕍",shinto_shrine:"⛩️",kaaba:"🕋",fountain:"⛲",tent:"⛺",foggy:"🌁",night_with_stars:"🌃",cityscape:"🏙️",sunrise_over_mountains:"🌄",sunrise:"🌅",city_sunset:"🌆",city_sunrise:"🌇",bridge_at_night:"🌉",hotsprings:"♨️",carousel_horse:"🎠",ferris_wheel:"🎡",roller_coaster:"🎢",barber:"💈",circus_tent:"🎪",steam_locomotive:"🚂",railway_car:"🚃",bullettrain_side:"🚄",bullettrain_front:"🚅",train2:"🚆",metro:"🚇",light_rail:"🚈",station:"🚉",tram:"🚊",monorail:"🚝",mountain_railway:"🚞",train:"🚋",bus:"🚌",oncoming_bus:"🚍",trolleybus:"🚎",minibus:"🚐",ambulance:"🚑",fire_engine:"🚒",police_car:"🚓",oncoming_police_car:"🚔",taxi:"🚕",oncoming_taxi:"🚖",car:"🚗",red_car:"🚗",oncoming_automobile:"🚘",blue_car:"🚙",pickup_truck:"🛻",truck:"🚚",articulated_lorry:"🚛",tractor:"🚜",racing_car:"🏎️",motorcycle:"🏍️",motor_scooter:"🛵",manual_wheelchair:"🦽",motorized_wheelchair:"🦼",auto_rickshaw:"🛺",bike:"🚲",kick_scooter:"🛴",skateboard:"🛹",roller_skate:"🛼",busstop:"🚏",motorway:"🛣️",railway_track:"🛤️",oil_drum:"🛢️",fuelpump:"⛽",rotating_light:"🚨",traffic_light:"🚥",vertical_traffic_light:"🚦",stop_sign:"🛑",construction:"🚧",anchor:"⚓",boat:"⛵",sailboat:"⛵",canoe:"🛶",speedboat:"🚤",passenger_ship:"🛳️",ferry:"⛴️",motor_boat:"🛥️",ship:"🚢",airplane:"✈️",small_airplane:"🛩️",flight_departure:"🛫",flight_arrival:"🛬",parachute:"🪂",seat:"💺",helicopter:"🚁",suspension_railway:"🚟",mountain_cableway:"🚠",aerial_tramway:"🚡",artificial_satellite:"🛰️",rocket:"🚀",flying_saucer:"🛸",bellhop_bell:"🛎️",luggage:"🧳",hourglass:"⌛",hourglass_flowing_sand:"⏳",watch:"⌚",alarm_clock:"⏰",stopwatch:"⏱️",timer_clock:"⏲️",mantelpiece_clock:"🕰️",clock12:"🕛",clock1230:"🕧",clock1:"🕐",clock130:"🕜",clock2:"🕑",clock230:"🕝",clock3:"🕒",clock330:"🕞",clock4:"🕓",clock430:"🕟",clock5:"🕔",clock530:"🕠",clock6:"🕕",clock630:"🕡",clock7:"🕖",clock730:"🕢",clock8:"🕗",clock830:"🕣",clock9:"🕘",clock930:"🕤",clock10:"🕙",clock1030:"🕥",clock11:"🕚",clock1130:"🕦",new_moon:"🌑",waxing_crescent_moon:"🌒",first_quarter_moon:"🌓",moon:"🌔",waxing_gibbous_moon:"🌔",full_moon:"🌕",waning_gibbous_moon:"🌖",last_quarter_moon:"🌗",waning_crescent_moon:"🌘",crescent_moon:"🌙",new_moon_with_face:"🌚",first_quarter_moon_with_face:"🌛",last_quarter_moon_with_face:"🌜",thermometer:"🌡️",sunny:"☀️",full_moon_with_face:"🌝",sun_with_face:"🌞",ringed_planet:"🪐",star:"⭐",star2:"🌟",stars:"🌠",milky_way:"🌌",cloud:"☁️",partly_sunny:"⛅",cloud_with_lightning_and_rain:"⛈️",sun_behind_small_cloud:"🌤️",sun_behind_large_cloud:"🌥️",sun_behind_rain_cloud:"🌦️",cloud_with_rain:"🌧️",cloud_with_snow:"🌨️",cloud_with_lightning:"🌩️",tornado:"🌪️",fog:"🌫️",wind_face:"🌬️",cyclone:"🌀",rainbow:"🌈",closed_umbrella:"🌂",open_umbrella:"☂️",umbrella:"☔",parasol_on_ground:"⛱️",zap:"⚡",snowflake:"❄️",snowman_with_snow:"☃️",snowman:"⛄",comet:"☄️",fire:"🔥",droplet:"💧",ocean:"🌊",jack_o_lantern:"🎃",christmas_tree:"🎄",fireworks:"🎆",sparkler:"🎇",firecracker:"🧨",sparkles:"✨",balloon:"🎈",tada:"🎉",confetti_ball:"🎊",tanabata_tree:"🎋",bamboo:"🎍",dolls:"🎎",flags:"🎏",wind_chime:"🎐",rice_scene:"🎑",red_envelope:"🧧",ribbon:"🎀",gift:"🎁",reminder_ribbon:"🎗️",tickets:"🎟️",ticket:"🎫",medal_military:"🎖️",trophy:"🏆",medal_sports:"🏅","1st_place_medal":"🥇","2nd_place_medal":"🥈","3rd_place_medal":"🥉",soccer:"⚽",baseball:"⚾",softball:"🥎",basketball:"🏀",volleyball:"🏐",football:"🏈",rugby_football:"🏉",tennis:"🎾",flying_disc:"🥏",bowling:"🎳",cricket_game:"🏏",field_hockey:"🏑",ice_hockey:"🏒",lacrosse:"🥍",ping_pong:"🏓",badminton:"🏸",boxing_glove:"🥊",martial_arts_uniform:"🥋",goal_net:"🥅",golf:"⛳",ice_skate:"⛸️",fishing_pole_and_fish:"🎣",diving_mask:"🤿",running_shirt_with_sash:"🎽",ski:"🎿",sled:"🛷",curling_stone:"🥌",dart:"🎯",yo_yo:"🪀",kite:"🪁","8ball":"🎱",crystal_ball:"🔮",magic_wand:"🪄",nazar_amulet:"🧿",video_game:"🎮",joystick:"🕹️",slot_machine:"🎰",game_die:"🎲",jigsaw:"🧩",teddy_bear:"🧸",pinata:"🪅",nesting_dolls:"🪆",spades:"♠️",hearts:"♥️",diamonds:"♦️",clubs:"♣️",chess_pawn:"♟️",black_joker:"🃏",mahjong:"🀄",flower_playing_cards:"🎴",performing_arts:"🎭",framed_picture:"🖼️",art:"🎨",thread:"🧵",sewing_needle:"🪡",yarn:"🧶",knot:"🪢",eyeglasses:"👓",dark_sunglasses:"🕶️",goggles:"🥽",lab_coat:"🥼",safety_vest:"🦺",necktie:"👔",shirt:"👕",tshirt:"👕",jeans:"👖",scarf:"🧣",gloves:"🧤",coat:"🧥",socks:"🧦",dress:"👗",kimono:"👘",sari:"🥻",one_piece_swimsuit:"🩱",swim_brief:"🩲",shorts:"🩳",bikini:"👙",womans_clothes:"👚",purse:"👛",handbag:"👜",pouch:"👝",shopping:"🛍️",school_satchel:"🎒",thong_sandal:"🩴",mans_shoe:"👞",shoe:"👞",athletic_shoe:"👟",hiking_boot:"🥾",flat_shoe:"🥿",high_heel:"👠",sandal:"👡",ballet_shoes:"🩰",boot:"👢",crown:"👑",womans_hat:"👒",tophat:"🎩",mortar_board:"🎓",billed_cap:"🧢",military_helmet:"🪖",rescue_worker_helmet:"⛑️",prayer_beads:"📿",lipstick:"💄",ring:"💍",gem:"💎",mute:"🔇",speaker:"🔈",sound:"🔉",loud_sound:"🔊",loudspeaker:"📢",mega:"📣",postal_horn:"📯",bell:"🔔",no_bell:"🔕",musical_score:"🎼",musical_note:"🎵",notes:"🎶",studio_microphone:"🎙️",level_slider:"🎚️",control_knobs:"🎛️",microphone:"🎤",headphones:"🎧",radio:"📻",saxophone:"🎷",accordion:"🪗",guitar:"🎸",musical_keyboard:"🎹",trumpet:"🎺",violin:"🎻",banjo:"🪕",drum:"🥁",long_drum:"🪘",iphone:"📱",calling:"📲",phone:"☎️",telephone:"☎️",telephone_receiver:"📞",pager:"📟",fax:"📠",battery:"🔋",electric_plug:"🔌",computer:"💻",desktop_computer:"🖥️",printer:"🖨️",keyboard:"⌨️",computer_mouse:"🖱️",trackball:"🖲️",minidisc:"💽",floppy_disk:"💾",cd:"💿",dvd:"📀",abacus:"🧮",movie_camera:"🎥",film_strip:"🎞️",film_projector:"📽️",clapper:"🎬",tv:"📺",camera:"📷",camera_flash:"📸",video_camera:"📹",vhs:"📼",mag:"🔍",mag_right:"🔎",candle:"🕯️",bulb:"💡",flashlight:"🔦",izakaya_lantern:"🏮",lantern:"🏮",diya_lamp:"🪔",notebook_with_decorative_cover:"📔",closed_book:"📕",book:"📖",open_book:"📖",green_book:"📗",blue_book:"📘",orange_book:"📙",books:"📚",notebook:"📓",ledger:"📒",page_with_curl:"📃",scroll:"📜",page_facing_up:"📄",newspaper:"📰",newspaper_roll:"🗞️",bookmark_tabs:"📑",bookmark:"🔖",label:"🏷️",moneybag:"💰",coin:"🪙",yen:"💴",dollar:"💵",euro:"💶",pound:"💷",money_with_wings:"💸",credit_card:"💳",receipt:"🧾",chart:"💹",envelope:"✉️",email:"📧","e-mail":"📧",incoming_envelope:"📨",envelope_with_arrow:"📩",outbox_tray:"📤",inbox_tray:"📥",package:"📦",mailbox:"📫",mailbox_closed:"📪",mailbox_with_mail:"📬",mailbox_with_no_mail:"📭",postbox:"📮",ballot_box:"🗳️",pencil2:"✏️",black_nib:"✒️",fountain_pen:"🖋️",pen:"🖊️",paintbrush:"🖌️",crayon:"🖍️",memo:"📝",pencil:"📝",briefcase:"💼",file_folder:"📁",open_file_folder:"📂",card_index_dividers:"🗂️",date:"📅",calendar:"📆",spiral_notepad:"🗒️",spiral_calendar:"🗓️",card_index:"📇",chart_with_upwards_trend:"📈",chart_with_downwards_trend:"📉",bar_chart:"📊",clipboard:"📋",pushpin:"📌",round_pushpin:"📍",paperclip:"📎",paperclips:"🖇️",straight_ruler:"📏",triangular_ruler:"📐",scissors:"✂️",card_file_box:"🗃️",file_cabinet:"🗄️",wastebasket:"🗑️",lock:"🔒",unlock:"🔓",lock_with_ink_pen:"🔏",closed_lock_with_key:"🔐",key:"🔑",old_key:"🗝️",hammer:"🔨",axe:"🪓",pick:"⛏️",hammer_and_pick:"⚒️",hammer_and_wrench:"🛠️",dagger:"🗡️",crossed_swords:"⚔️",gun:"🔫",boomerang:"🪃",bow_and_arrow:"🏹",shield:"🛡️",carpentry_saw:"🪚",wrench:"🔧",screwdriver:"🪛",nut_and_bolt:"🔩",gear:"⚙️",clamp:"🗜️",balance_scale:"⚖️",probing_cane:"🦯",link:"🔗",chains:"⛓️",hook:"🪝",toolbox:"🧰",magnet:"🧲",ladder:"🪜",alembic:"⚗️",test_tube:"🧪",petri_dish:"🧫",dna:"🧬",microscope:"🔬",telescope:"🔭",satellite:"📡",syringe:"💉",drop_of_blood:"🩸",pill:"💊",adhesive_bandage:"🩹",stethoscope:"🩺",door:"🚪",elevator:"🛗",mirror:"🪞",window:"🪟",bed:"🛏️",couch_and_lamp:"🛋️",chair:"🪑",toilet:"🚽",plunger:"🪠",shower:"🚿",bathtub:"🛁",mouse_trap:"🪤",razor:"🪒",lotion_bottle:"🧴",safety_pin:"🧷",broom:"🧹",basket:"🧺",roll_of_paper:"🧻",bucket:"🪣",soap:"🧼",toothbrush:"🪥",sponge:"🧽",fire_extinguisher:"🧯",shopping_cart:"🛒",smoking:"🚬",coffin:"⚰️",headstone:"🪦",funeral_urn:"⚱️",moyai:"🗿",placard:"🪧",atm:"🏧",put_litter_in_its_place:"🚮",potable_water:"🚰",wheelchair:"♿",mens:"🚹",womens:"🚺",restroom:"🚻",baby_symbol:"🚼",wc:"🚾",passport_control:"🛂",customs:"🛃",baggage_claim:"🛄",left_luggage:"🛅",warning:"⚠️",children_crossing:"🚸",no_entry:"⛔",no_entry_sign:"🚫",no_bicycles:"🚳",no_smoking:"🚭",do_not_litter:"🚯","non-potable_water":"🚱",no_pedestrians:"🚷",no_mobile_phones:"📵",underage:"🔞",radioactive:"☢️",biohazard:"☣️",arrow_up:"⬆️",arrow_upper_right:"↗️",arrow_right:"➡️",arrow_lower_right:"↘️",arrow_down:"⬇️",arrow_lower_left:"↙️",arrow_left:"⬅️",arrow_upper_left:"↖️",arrow_up_down:"↕️",left_right_arrow:"↔️",leftwards_arrow_with_hook:"↩️",arrow_right_hook:"↪️",arrow_heading_up:"⤴️",arrow_heading_down:"⤵️",arrows_clockwise:"🔃",arrows_counterclockwise:"🔄",back:"🔙",end:"🔚",on:"🔛",soon:"🔜",top:"🔝",place_of_worship:"🛐",atom_symbol:"⚛️",om:"🕉️",star_of_david:"✡️",wheel_of_dharma:"☸️",yin_yang:"☯️",latin_cross:"✝️",orthodox_cross:"☦️",star_and_crescent:"☪️",peace_symbol:"☮️",menorah:"🕎",six_pointed_star:"🔯",aries:"♈",taurus:"♉",gemini:"♊",cancer:"♋",leo:"♌",virgo:"♍",libra:"♎",scorpius:"♏",sagittarius:"♐",capricorn:"♑",aquarius:"♒",pisces:"♓",ophiuchus:"⛎",twisted_rightwards_arrows:"🔀",repeat:"🔁",repeat_one:"🔂",arrow_forward:"▶️",fast_forward:"⏩",next_track_button:"⏭️",play_or_pause_button:"⏯️",arrow_backward:"◀️",rewind:"⏪",previous_track_button:"⏮️",arrow_up_small:"🔼",arrow_double_up:"⏫",arrow_down_small:"🔽",arrow_double_down:"⏬",pause_button:"⏸️",stop_button:"⏹️",record_button:"⏺️",eject_button:"⏏️",cinema:"🎦",low_brightness:"🔅",high_brightness:"🔆",signal_strength:"📶",vibration_mode:"📳",mobile_phone_off:"📴",female_sign:"♀️",male_sign:"♂️",transgender_symbol:"⚧️",heavy_multiplication_x:"✖️",heavy_plus_sign:"➕",heavy_minus_sign:"➖",heavy_division_sign:"➗",infinity:"♾️",bangbang:"‼️",interrobang:"⁉️",question:"❓",grey_question:"❔",grey_exclamation:"❕",exclamation:"❗",heavy_exclamation_mark:"❗",wavy_dash:"〰️",currency_exchange:"💱",heavy_dollar_sign:"💲",medical_symbol:"⚕️",recycle:"♻️",fleur_de_lis:"⚜️",trident:"🔱",name_badge:"📛",beginner:"🔰",o:"⭕",white_check_mark:"✅",ballot_box_with_check:"☑️",heavy_check_mark:"✔️",x:"❌",negative_squared_cross_mark:"❎",curly_loop:"➰",loop:"➿",part_alternation_mark:"〽️",eight_spoked_asterisk:"✳️",eight_pointed_black_star:"✴️",sparkle:"❇️",copyright:"©️",registered:"®️",tm:"™️",hash:"#️⃣",asterisk:"*️⃣",zero:"0️⃣",one:"1️⃣",two:"2️⃣",three:"3️⃣",four:"4️⃣",five:"5️⃣",six:"6️⃣",seven:"7️⃣",eight:"8️⃣",nine:"9️⃣",keycap_ten:"🔟",capital_abcd:"🔠",abcd:"🔡",symbols:"🔣",abc:"🔤",a:"🅰️",ab:"🆎",b:"🅱️",cl:"🆑",cool:"🆒",free:"🆓",information_source:"ℹ️",id:"🆔",m:"Ⓜ️",new:"🆕",ng:"🆖",o2:"🅾️",ok:"🆗",parking:"🅿️",sos:"🆘",up:"🆙",vs:"🆚",koko:"🈁",sa:"🈂️",ideograph_advantage:"🉐",accept:"🉑",congratulations:"㊗️",secret:"㊙️",u6e80:"🈵",red_circle:"🔴",orange_circle:"🟠",yellow_circle:"🟡",green_circle:"🟢",large_blue_circle:"🔵",purple_circle:"🟣",brown_circle:"🟤",black_circle:"⚫",white_circle:"⚪",red_square:"🟥",orange_square:"🟧",yellow_square:"🟨",green_square:"🟩",blue_square:"🟦",purple_square:"🟪",brown_square:"🟫",black_large_square:"⬛",white_large_square:"⬜",black_medium_square:"◼️",white_medium_square:"◻️",black_medium_small_square:"◾",white_medium_small_square:"◽",black_small_square:"▪️",white_small_square:"▫️",large_orange_diamond:"🔶",large_blue_diamond:"🔷",small_orange_diamond:"🔸",small_blue_diamond:"🔹",small_red_triangle:"🔺",small_red_triangle_down:"🔻",diamond_shape_with_a_dot_inside:"💠",radio_button:"🔘",white_square_button:"🔳",black_square_button:"🔲",checkered_flag:"🏁",triangular_flag_on_post:"🚩",crossed_flags:"🎌",black_flag:"🏴",white_flag:"🏳️",rainbow_flag:"🏳️🌈",transgender_flag:"🏳️⚧️",pirate_flag:"🏴☠️",ascension_island:"🇦🇨",andorra:"🇦🇩",united_arab_emirates:"🇦🇪",afghanistan:"🇦🇫",antigua_barbuda:"🇦🇬",anguilla:"🇦🇮",albania:"🇦🇱",armenia:"🇦🇲",angola:"🇦🇴",antarctica:"🇦🇶",argentina:"🇦🇷",american_samoa:"🇦🇸",austria:"🇦🇹",australia:"🇦🇺",aruba:"🇦🇼",aland_islands:"🇦🇽",azerbaijan:"🇦🇿",bosnia_herzegovina:"🇧🇦",barbados:"🇧🇧",bangladesh:"🇧🇩",belgium:"🇧🇪",burkina_faso:"🇧🇫",bulgaria:"🇧🇬",bahrain:"🇧🇭",burundi:"🇧🇮",benin:"🇧🇯",st_barthelemy:"🇧🇱",bermuda:"🇧🇲",brunei:"🇧🇳",bolivia:"🇧🇴",caribbean_netherlands:"🇧🇶",brazil:"🇧🇷",bahamas:"🇧🇸",bhutan:"🇧🇹",bouvet_island:"🇧🇻",botswana:"🇧🇼",belarus:"🇧🇾",belize:"🇧🇿",canada:"🇨🇦",cocos_islands:"🇨🇨",congo_kinshasa:"🇨🇩",central_african_republic:"🇨🇫",congo_brazzaville:"🇨🇬",switzerland:"🇨🇭",cote_divoire:"🇨🇮",cook_islands:"🇨🇰",chile:"🇨🇱",cameroon:"🇨🇲",cn:"🇨🇳",colombia:"🇨🇴",clipperton_island:"🇨🇵",costa_rica:"🇨🇷",cuba:"🇨🇺",cape_verde:"🇨🇻",curacao:"🇨🇼",christmas_island:"🇨🇽",cyprus:"🇨🇾",czech_republic:"🇨🇿",de:"🇩🇪",diego_garcia:"🇩🇬",djibouti:"🇩🇯",denmark:"🇩🇰",dominica:"🇩🇲",dominican_republic:"🇩🇴",algeria:"🇩🇿",ceuta_melilla:"🇪🇦",ecuador:"🇪🇨",estonia:"🇪🇪",egypt:"🇪🇬",western_sahara:"🇪🇭",eritrea:"🇪🇷",es:"🇪🇸",ethiopia:"🇪🇹",eu:"🇪🇺",european_union:"🇪🇺",finland:"🇫🇮",fiji:"🇫🇯",falkland_islands:"🇫🇰",micronesia:"🇫🇲",faroe_islands:"🇫🇴",fr:"🇫🇷",gabon:"🇬🇦",gb:"🇬🇧",uk:"🇬🇧",grenada:"🇬🇩",georgia:"🇬🇪",french_guiana:"🇬🇫",guernsey:"🇬🇬",ghana:"🇬🇭",gibraltar:"🇬🇮",greenland:"🇬🇱",gambia:"🇬🇲",guinea:"🇬🇳",guadeloupe:"🇬🇵",equatorial_guinea:"🇬🇶",greece:"🇬🇷",south_georgia_south_sandwich_islands:"🇬🇸",guatemala:"🇬🇹",guam:"🇬🇺",guinea_bissau:"🇬🇼",guyana:"🇬🇾",hong_kong:"🇭🇰",heard_mcdonald_islands:"🇭🇲",honduras:"🇭🇳",croatia:"🇭🇷",haiti:"🇭🇹",hungary:"🇭🇺",canary_islands:"🇮🇨",indonesia:"🇮🇩",ireland:"🇮🇪",israel:"🇮🇱",isle_of_man:"🇮🇲",india:"🇮🇳",british_indian_ocean_territory:"🇮🇴",iraq:"🇮🇶",iran:"🇮🇷",iceland:"🇮🇸",it:"🇮🇹",jersey:"🇯🇪",jamaica:"🇯🇲",jordan:"🇯🇴",jp:"🇯🇵",kenya:"🇰🇪",kyrgyzstan:"🇰🇬",cambodia:"🇰🇭",kiribati:"🇰🇮",comoros:"🇰🇲",st_kitts_nevis:"🇰🇳",north_korea:"🇰🇵",kr:"🇰🇷",kuwait:"🇰🇼",cayman_islands:"🇰🇾",kazakhstan:"🇰🇿",laos:"🇱🇦",lebanon:"🇱🇧",st_lucia:"🇱🇨",liechtenstein:"🇱🇮",sri_lanka:"🇱🇰",liberia:"🇱🇷",lesotho:"🇱🇸",lithuania:"🇱🇹",luxembourg:"🇱🇺",latvia:"🇱🇻",libya:"🇱🇾",morocco:"🇲🇦",monaco:"🇲🇨",moldova:"🇲🇩",montenegro:"🇲🇪",st_martin:"🇲🇫",madagascar:"🇲🇬",marshall_islands:"🇲🇭",macedonia:"🇲🇰",mali:"🇲🇱",myanmar:"🇲🇲",mongolia:"🇲🇳",macau:"🇲🇴",northern_mariana_islands:"🇲🇵",martinique:"🇲🇶",mauritania:"🇲🇷",montserrat:"🇲🇸",malta:"🇲🇹",mauritius:"🇲🇺",maldives:"🇲🇻",malawi:"🇲🇼",mexico:"🇲🇽",malaysia:"🇲🇾",mozambique:"🇲🇿",namibia:"🇳🇦",new_caledonia:"🇳🇨",niger:"🇳🇪",norfolk_island:"🇳🇫",nigeria:"🇳🇬",nicaragua:"🇳🇮",netherlands:"🇳🇱",norway:"🇳🇴",nepal:"🇳🇵",nauru:"🇳🇷",niue:"🇳🇺",new_zealand:"🇳🇿",oman:"🇴🇲",panama:"🇵🇦",peru:"🇵🇪",french_polynesia:"🇵🇫",papua_new_guinea:"🇵🇬",philippines:"🇵🇭",pakistan:"🇵🇰",poland:"🇵🇱",st_pierre_miquelon:"🇵🇲",pitcairn_islands:"🇵🇳",puerto_rico:"🇵🇷",palestinian_territories:"🇵🇸",portugal:"🇵🇹",palau:"🇵🇼",paraguay:"🇵🇾",qatar:"🇶🇦",reunion:"🇷🇪",romania:"🇷🇴",serbia:"🇷🇸",ru:"🇷🇺",rwanda:"🇷🇼",saudi_arabia:"🇸🇦",solomon_islands:"🇸🇧",seychelles:"🇸🇨",sudan:"🇸🇩",sweden:"🇸🇪",singapore:"🇸🇬",st_helena:"🇸🇭",slovenia:"🇸🇮",svalbard_jan_mayen:"🇸🇯",slovakia:"🇸🇰",sierra_leone:"🇸🇱",san_marino:"🇸🇲",senegal:"🇸🇳",somalia:"🇸🇴",suriname:"🇸🇷",south_sudan:"🇸🇸",sao_tome_principe:"🇸🇹",el_salvador:"🇸🇻",sint_maarten:"🇸🇽",syria:"🇸🇾",swaziland:"🇸🇿",tristan_da_cunha:"🇹🇦",turks_caicos_islands:"🇹🇨",chad:"🇹🇩",french_southern_territories:"🇹🇫",togo:"🇹🇬",thailand:"🇹🇭",tajikistan:"🇹🇯",tokelau:"🇹🇰",timor_leste:"🇹🇱",turkmenistan:"🇹🇲",tunisia:"🇹🇳",tonga:"🇹🇴",tr:"🇹🇷",trinidad_tobago:"🇹🇹",tuvalu:"🇹🇻",taiwan:"🇹🇼",tanzania:"🇹🇿",ukraine:"🇺🇦",uganda:"🇺🇬",us_outlying_islands:"🇺🇲",united_nations:"🇺🇳",us:"🇺🇸",uruguay:"🇺🇾",uzbekistan:"🇺🇿",vatican_city:"🇻🇦",st_vincent_grenadines:"🇻🇨",venezuela:"🇻🇪",british_virgin_islands:"🇻🇬",us_virgin_islands:"🇻🇮",vietnam:"🇻🇳",vanuatu:"🇻🇺",wallis_futuna:"🇼🇫",samoa:"🇼🇸",kosovo:"🇽🇰",yemen:"🇾🇪",mayotte:"🇾🇹",south_africa:"🇿🇦",zambia:"🇿🇲",zimbabwe:"🇿🇼",england:"🏴",scotland:"🏴",wales:"🏴"};Object.keys(Re).reduce((e,t)=>{const i=Re[t];return e[i]=t,e},{});const As=Object.keys(Re).map(e=>e);Object.keys(Re).map(e=>Re[e]);function Ls(e){return As.filter(t=>t.startsWith(e)).map(t=>({name:t,emoji:Re[t]}))}const ei=d.forwardRef((e,t)=>{const i=d.useRef(),[r,a]=d.useState(0),{t:o}=b.useLocale(),s=u=>{const x=e.items[u];x&&e.command(x)},c=()=>{a((r+e.items.length-1)%e.items.length)},l=()=>{a((r+1)%e.items.length)},h=()=>{s(r)};return d.useEffect(()=>a(0),[e.items]),d.useEffect(()=>{if(Number.isNaN(r+1))return;const u=i.current.querySelector(`span:nth-of-type(${r+1})`);u&&Et(u,{behavior:"smooth",scrollMode:"if-needed"})},[r]),d.useImperativeHandle(t,()=>({onKeyDown:({event:u})=>u.key==="ArrowUp"?(c(),!0):u.key==="ArrowDown"?(l(),!0):u.key==="Enter"?(h(),!0):!1})),n.jsx("div",{className:"richtext-w-[200px] richtext-max-h-[320px] richtext-overflow-x-hidden richtext-overflow-y-auto richtext-rounded-sm !richtext-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",children:n.jsx("div",{ref:i,children:e.items.length?e.items.map((u,x)=>n.jsxs("span",{className:w.clsx(" richtext-flex richtext-relative 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 hover:richtext-bg-accent",x===r?"bg-accent":""),onClick:()=>s(x),children:[u.fallbackImage?n.jsx("img",{src:u.fallbackImage,className:"richtext-w-[1em] richtext-h-[1em]"}):u.emoji,":",u.name,":"]},`emoji-list-code-${x}`)):n.jsx("div",{className:"richtext-flex richtext-relative 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",children:n.jsx("span",{children:o("no_result_found")})})})})});ei.displayName="EmojiList";const Ms=["😀","😃","😄","😁","😆","😅","😂","🤣","🥲","😊","😇","🙂","🙃","😉","😌","😍","🥰","😘","😗","😙","😚","😋","😛","😝","😜","🤪","🤨","🧐","🤓","😎","🥸","🤩","🥳","😏","😒","😞","😔","😟","😕","🙁","😣","😖","😫","😩","🥺","😢","😭","😤","😠","😡","🤬","🤯","😳","🥵","🥶","😱","😨","😰","😥","😓","🤗","🤔","🤭","🤫","🤥","😶","😐","😑","😬","🙄","😯","😦","😧","😮","😲","🥱","😴","🤤","😪","😵","🤐","🥴","🤢","🤮","🤧","😷","🤒","🤕","🤑","🤠","😈","👿","👹","👺","🤡","💩","👻","💀","☠️","👽","👾","🤖","🎃","😺","😸","😹","😻","😼","😽","🙀","😿","😾","👋","🤚","🖐","✋","🖖","👌","🤌","🤏","✌️","🤞","🤟","🤘","🤙","👈","👉","👆","🖕","👇","☝️","👍","👎","✊","👊","🤛","🤜","👏","🙌","👐","🤲","🤝","🙏","✍️","💅","🤳","💪","🦾","🦵","🦿","🦶","👣","👂","🦻","👃","🫀","🫁","🧠","🦷","🦴","👀","👁","👅","👄","💋","🩸","💋","💌","💘","💝","💖","💗","💓","💞","💕","💟","❣️","❣","💔","❤️🔥","❤🔥","❤️🩹","❤🩹","❤️","❤","🧡","💛","💚","💙","💜","🤎","🖤","🤍","💯","💢","💥","💫","💦","💨","🕳️","🕳","💣","💬","👁️🗨️","👁🗨️","👁️🗨","👁🗨","🗨️","🗨","🗯️","🗯","💭","💤"],Es=["🏧","🚮","🚰","♿","🚹","🚺","🚻","🚼","🚾","🛂","🛃","🛄","🛅","⚠️","⚠","🚸","⛔","🚫","🚳","🚭","🚯","🚱","🚷","📵","🔞","☢️","☢","☣️","☣","⬆️","⬆","↗️","↗","➡️","➡","↘️","↘","⬇️","⬇","↙️","↙","⬅️","⬅","↖️","↖","↕️","↕","↔️","↔","↩️","↩","↪️","↪","⤴️","⤴","⤵️","⤵","🔃","🔄","🔙","🔚","🔛","🔜","🔝","🛐","⚛️","⚛","🕉️","🕉","✡️","✡","☸️","☸","☯️","☯","✝️","✝","☦️","☦","☪️","☪","☮️","☮","🕎","🔯","♈","♉","♊","♋","♌","♍","♎","♏","♐","♑","♒","♓","⛎","🔀","🔁","🔂","▶️","▶","⏩","⏭️","⏭","⏯️","⏯","◀️","◀","⏪","⏮️","⏮","🔼","⏫","🔽","⏬","⏸️","⏸","⏹️","⏹","⏺️","⏺","⏏️","⏏","🎦","🔅","🔆","📶","📳","📴","♀️","♀","♂️","♂","⚧️","⚧","✖️","✖","➕","➖","➗","♾️","♾","‼️","‼","⁉️","⁉","❓","❔","❕","❗","〰️","〰","💱","💲","⚕️","⚕","♻️","♻","⚜️","⚜","🔱","📛","🔰","⭕","✅","☑️","☑","✔️","✔","❌","❎","➰","➿","〽️","〽","✳️","✳","✴️","✴","❇️","❇","©️","©","®️","®","™️","™","#️⃣","#⃣","*️⃣","*⃣","0️⃣","0⃣","1️⃣","1⃣","2️⃣","2⃣","3️⃣","3⃣","4️⃣","4⃣","5️⃣","5⃣","6️⃣","6⃣","7️⃣","7⃣","8️⃣","8⃣","9️⃣","9⃣","🔟","🔠","🔡","🔢","🔣","🔤","🅰️","🅰","🆎","🅱️","🅱","🆑","🆒","🆓","ℹ️","ℹ","🆔","Ⓜ️","Ⓜ","🆕","🆖","🅾️","🅾","🆗","🅿️","🅿","🆘","🆙","🆚","🈁","🈂️","🈂","🈷️","🈷","🈶","🈯","🉐","🈹","🈚","🈲","🉑","🈸","🈴","🈳","㊗️","㊗","㊙️","㊙","🈺","🈵","🔴","🟠","🟡","🟢","🔵","🟣","🟤","⚫","⚪","🟥","🟧","🟨","🟩","🟦","🟪","🟫","⬛","⬜","◼️","◼","◻️","◻","◾","◽","▪️","▪","▫️","▫","🔶","🔷","🔸","🔹","🔺","🔻","💠","🔘","🔳","🔲"],Is=["👓","🕶️","🕶","🥽","🥼","🦺","👔","👕","👖","🧣","🧤","🧥","🧦","👗","👘","🥻","🩱","🩲","🩳","👙","👚","👛","👜","👝","🛍️","🛍","🎒","🩴","👞","👟","🥾","🥿","👠","👡","🩰","👢","👑","👒","🎩","🎓","🧢","🪖","⛑️","⛑","📿","💄","💍","💎","🔇","🔈","🔉","🔊","📢","📣","📯","🔔","🔕","🎼","🎵","🎶","🎙️","🎙","🎚️","🎚","🎛️","🎛","🎤","🎧","📻","🎷","🪗","🎸","🎹","🎺","🎻","🪕","🥁","🪘","📱","📲","☎️","☎","📞","📟","📠","🔋","🔌","💻","🖥️","🖥","🖨️","🖨","⌨️","⌨","🖱️","🖱","🖲️","🖲","💽","💾","💿","📀","🧮","🎥","🎞️","🎞","📽️","📽","🎬","📺","📷","📸","📹","📼","🔍","🔎","🕯️","🕯","💡","🔦","🏮","🪔","📔","📕","📖","📗","📘","📙","📚","📓","📒","📃","📜","📄","📰","🗞️","🗞","📑","🔖","🏷️","🏷","💰","🪙","💴","💵","💶","💷","💸","💳","🧾","💹","✉️","✉","📧","📨","📩","📤","📥","📦","📫","📪","📬","📭","📮","🗳️","🗳","✏️","✏","✒️","✒","🖋️","🖋","🖊️","🖊","🖌️","🖌","🖍️","🖍","📝","💼","📁","📂","🗂️","🗂","📅","📆","🗒️","🗒","🗓️","🗓","📇","📈","📉","📊","📋","📌","📍","📎","🖇️","🖇","📏","📐","✂️","✂","🗃️","🗃","🗄️","🗄","🗑️","🗑","🔒","🔓","🔏","🔐","🔑","🗝️","🗝","🔨","🪓","⛏️","⛏","⚒️","⚒","🛠️","🛠","🗡️","🗡","⚔️","⚔","🔫","🪃","🏹","🛡️","🛡","🪚","🔧","🪛","🔩","⚙️","⚙","🗜️","🗜","⚖️","⚖","🦯","🔗","⛓️","⛓","🪝","🧰","🧲","🪜","⚗️","⚗","🧪","🧫","🧬","🔬","🔭","📡","💉","🩸","💊","🩹","🩺","🚪","🛗","🪞","🪟","🛏️","🛏","🛋️","🛋","🪑","🚽","🪠","🚿","🛁","🪤","🪒","🧴","🧷","🧹","🧺","🧻","🪣","🧼","🪥","🧽","🧯","🛒","🚬","⚰️","⚰","🪦","⚱️","⚱","🗿","🪧"],Rs=["🎃","🎄","🎆","🎇","🧨","✨","🎈","🎉","🎊","🎋","🎍","🎎","🎏","🎐","🎑","🧧","🎀","🎁","🎗️","🎗","🎟️","🎟","🎫","🎖️","🎖","🏆","🏅","🥇","🥈","🥉","⚽","⚾","🥎","🏀","🏐","🏈","🏉","🎾","🥏","🎳","🏏","🏑","🏒","🥍","🏓","🏸","🥊","🥋","🥅","⛳","⛸️","⛸","🎣","🤿","🎽","🎿","🛷","🥌","🎯","🪀","🪁","🎱","🔮","🪄","🧿","🎮","🕹️","🕹","🎰","🎲","🧩","🧸","🪅","🪆","♠️","♠","♥️","♥","♦️","♦","♣️","♣","♟️","♟","🃏","🀄","🎴","🎭","🖼️","🖼","🎨","🧵","🪡","🧶","🪢"],Hs=["🌍","🌎","🌏","🌐","🗺️","🗺","🗾","🧭","🏔️","🏔","⛰️","⛰","🌋","🗻","🏕️","🏕","🏖️","🏖","🏜️","🏜","🏝️","🏝","🏞️","🏞","🏟️","🏟","🏛️","🏛","🏗️","🏗","🧱","🪨","🪵","🛖","🏘️","🏘","🏚️","🏚","🏠","🏡","🏢","🏣","🏤","🏥","🏦","🏨","🏩","🏪","🏫","🏬","🏭","🏯","🏰","💒","🗼","🗽","⛪","🕌","🛕","🕍","⛩️","⛩","🕋","⛲","⛺","🌁","🌃","🏙️","🏙","🌄","🌅","🌆","🌇","🌉","♨️","♨","🎠","🎡","🎢","💈","🎪","🚂","🚃","🚄","🚅","🚆","🚇","🚈","🚉","🚊","🚝","🚞","🚋","🚌","🚍","🚎","🚐","🚑","🚒","🚓","🚔","🚕","🚖","🚗","🚘","🚙","🛻","🚚","🚛","🚜","🏎️","🏎","🏍️","🏍","🛵","🦽","🦼","🛺","🚲","🛴","🛹","🛼","🚏","🛣️","🛣","🛤️","🛤","🛢️","🛢","⛽","🚨","🚥","🚦","🛑","🚧","⚓","⛵","🛶","🚤","🛳️","🛳","⛴️","⛴","🛥️","🛥","🚢","✈️","✈","🛩️","🛩","🛫","🛬","🪂","💺","🚁","🚟","🚠","🚡","🛰️","🛰","🚀","🛸","🛎️","🛎","🧳","⌛","⏳","⌚","⏰","⏱️","⏱","⏲️","⏲","🕰️","🕰","🕛","🕧","🕐","🕜","🕑","🕝","🕒","🕞","🕓","🕟","🕔","🕠","🕕","🕡","🕖","🕢","🕗","🕣","🕘","🕤","🕙","🕥","🕚","🕦","🌑","🌒","🌓","🌔","🌕","🌖","🌗","🌘","🌙","🌚","🌛","🌜","🌡️","🌡","☀️","☀","🌝","🌞","🪐","⭐","🌟","🌠","🌌","☁️","☁","⛅","⛈️","⛈","🌤️","🌤","🌥️","🌥","🌦️","🌦","🌧️","🌧","🌨️","🌨","🌩️","🌩","🌪️","🌪","🌫️","🌫","🌬️","🌬","🌀","🌈","🌂","☂️","☂","☔","⛱️","⛱","⚡","❄️","❄","☃️","☃","⛄","☄️","☄","🔥","💧","🌊"],zs=["🏁","🚩","🎌","🏴","🏳️","🏳","🏳️🌈","🏳🌈","🏳️⚧️","🏳⚧️","🏳️⚧","🏳⚧","🏴☠️","🏴☠","🇦🇨","🇦🇩","🇦🇪","🇦🇫","🇦🇬","🇦🇮","🇦🇱","🇦🇲","🇦🇴","🇦🇶","🇦🇷","🇦🇸","🇦🇹","🇦🇺","🇦🇼","🇦🇽","🇦🇿","🇧🇦","🇧🇧","🇧🇩","🇧🇪","🇧🇫","🇧🇬","🇧🇭","🇧🇮","🇧🇯","🇧🇱","🇧🇲","🇧🇳","🇧🇴","🇧🇶","🇧🇷","🇧🇸","🇧🇹","🇧🇻","🇧🇼","🇧🇾","🇧🇿","🇨🇦","🇨🇨","🇨🇩","🇨🇫","🇨🇬","🇨🇭","🇨🇮","🇨🇰","🇨🇱","🇨🇲","🇨🇳","🇨🇴","🇨🇵","🇨🇷","🇨🇺","🇨🇻","🇨🇼","🇨🇽","🇨🇾","🇨🇿","🇩🇪","🇩🇬","🇩🇯","🇩🇰","🇩🇲","🇩🇴","🇩🇿","🇪🇦","🇪🇨","🇪🇪","🇪🇬","🇪🇭","🇪🇷","🇪🇸","🇪🇹","🇪🇺","🇫🇮","🇫🇯","🇫🇰","🇫🇲","🇫🇴","🇫🇷","🇬🇦","🇬🇧","🇬🇩","🇬🇪","🇬🇫","🇬🇬","🇬🇭","🇬🇮","🇬🇱","🇬🇲","🇬🇳","🇬🇵","🇬🇶","🇬🇷","🇬🇸","🇬🇹","🇬🇺","🇬🇼","🇬🇾","🇭🇰","🇭🇲","🇭🇳","🇭🇷","🇭🇹","🇭🇺","🇮🇨","🇮🇩","🇮🇪","🇮🇱","🇮🇲","🇮🇳","🇮🇴","🇮🇶","🇮🇷","🇮🇸","🇮🇹","🇯🇪","🇯🇲","🇯🇴","🇯🇵","🇰🇪","🇰🇬","🇰🇭","🇰🇮","🇰🇲","🇰🇳","🇰🇵","🇰🇷","🇰🇼","🇰🇾","🇰🇿","🇱🇦","🇱🇧","🇱🇨","🇱🇮","🇱🇰","🇱🇷","🇱🇸","🇱🇹","🇱🇺","🇱🇻","🇱🇾","🇲🇦","🇲🇨","🇲🇩","🇲🇪","🇲🇫","🇲🇬","🇲🇭","🇲🇰","🇲🇱","🇲🇲","🇲🇳","🇲🇴","🇲🇵","🇲🇶","🇲🇷","🇲🇸","🇲🇹","🇲🇺","🇲🇻","🇲🇼","🇲🇽","🇲🇾","🇲🇿","🇳🇦","🇳🇨","🇳🇪","🇳🇫","🇳🇬","🇳🇮","🇳🇱","🇳🇴","🇳🇵","🇳🇷","🇳🇺","🇳🇿","🇴🇲","🇵🇦","🇵🇪","🇵🇫","🇵🇬","🇵🇭","🇵🇰","🇵🇱","🇵🇲","🇵🇳","🇵🇷","🇵🇸","🇵🇹","🇵🇼","🇵🇾","🇶🇦","🇷🇪","🇷🇴","🇷🇸","🇷🇺","🇷🇼","🇸🇦","🇸🇧","🇸🇨","🇸🇩","🇸🇪","🇸🇬","🇸🇭","🇸🇮","🇸🇯","🇸🇰","🇸🇱","🇸🇲","🇸🇳","🇸🇴","🇸🇷","🇸🇸","🇸🇹","🇸🇻","🇸🇽","🇸🇾","🇸🇿","🇹🇦","🇹🇨","🇹🇩","🇹🇫","🇹🇬","🇹🇭","🇹🇯","🇹🇰","🇹🇱","🇹🇲","🇹🇳","🇹🇴","🇹🇷","🇹🇹","🇹🇻","🇹🇼","🇹🇿","🇺🇦","🇺🇬","🇺🇲","🇺🇳","🇺🇸","🇺🇾","🇺🇿","🇻🇦","🇻🇨","🇻🇪","🇻🇬","🇻🇮","🇻🇳","🇻🇺","🇼🇫","🇼🇸","🇽🇰","🇾🇪","🇾🇹","🇿🇦","🇿🇲","🇿🇼","🏴","🏴","🏴"],Os=["🐵","🐒","🦍","🦧","🐶","🐕","🦮","🐕🦺","🐩","🐺","🦊","🦝","🐱","🐈","🐈⬛","🦁","🐯","🐅","🐆","🐴","🐎","🦄","🦓","🦌","🦬","🐮","🐂","🐃","🐄","🐷","🐖","🐗","🐽","🐏","🐑","🐐","🐪","🐫","🦙","🦒","🐘","🦣","🦏","🦛","🐭","🐁","🐀","🐹","🐰","🐇","🐿️","🐿","🦫","🦔","🦇","🐻","🐻❄️","🐻❄","🐨","🐼","🦥","🦦","🦨","🦘","🦡","🐾","🦃","🐔","🐓","🐣","🐤","🐥","🐦","🐧","🕊️","🕊","🦅","🦆","🦢","🦉","🦤","🪶","🦩","🦚","🦜","🐸","🐊","🐢","🦎","🐍","🐲","🐉","🦕","🦖","🐳","🐋","🐬","🦭","🐟","🐠","🐡","🦈","🐙","🐚","🐌","🦋","🐛","🐜","🐝","🪲","🐞","🦗","🪳","🕷️","🕷","🕸️","🕸","🦂","🦟","🪰","🪱","🦠","💐","🌸","💮","🏵️","🏵","🌹","🥀","🌺","🌻","🌼","🌷","🌱","🪴","🌲","🌳","🌴","🌵","🌾","🌿","☘️","☘","🍀","🍁","🍂","🍃"],Ps=["🍇","🍈","🍉","🍊","🍋","🍌","🍍","🥭","🍎","🍏","🍐","🍑","🍒","🍓","🫐","🥝","🍅","🫒","🥥","🥑","🍆","🥔","🥕","🌽","🌶️","🌶","🫑","🥒","🥬","🥦","🧄","🧅","🍄","🥜","🌰","🍞","🥐","🥖","🫓","🥨","🥯","🥞","🧇","🧀","🍖","🍗","🥩","🥓","🍔","🍟","🍕","🌭","🥪","🌮","🌯","🫔","🥙","🧆","🥚","🍳","🥘","🍲","🫕","🥣","🥗","🍿","🧈","🧂","🥫","🍱","🍘","🍙","🍚","🍛","🍜","🍝","🍠","🍢","🍣","🍤","🍥","🥮","🍡","🥟","🥠","🥡","🦀","🦞","🦐","🦑","🦪","🍦","🍧","🍨","🍩","🍪","🎂","🍰","🧁","🥧","🍫","🍬","🍭","🍮","🍯","🍼","🥛","☕","🫖","🍵","🍶","🍾","🍷","🍸","🍹","🍺","🍻","🥂","🥃","🥤","🧋","🧃","🧉","🧊","🥢","🍽️","🍽","🍴","🥄","🔪","🏺"];function Ds(){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",children:n.jsx("path",{d:"M12 0C5.373 0 0 5.372 0 12c0 6.627 5.373 12 12 12 6.628 0 12-5.373 12-12 0-6.628-5.372-12-12-12m9.949 11H17.05c.224-2.527 1.232-4.773 1.968-6.113A9.966 9.966 0 0 1 21.949 11M13 11V2.051a9.945 9.945 0 0 1 4.432 1.564c-.858 1.491-2.156 4.22-2.392 7.385H13zm-2 0H8.961c-.238-3.165-1.536-5.894-2.393-7.385A9.95 9.95 0 0 1 11 2.051V11zm0 2v8.949a9.937 9.937 0 0 1-4.432-1.564c.857-1.492 2.155-4.221 2.393-7.385H11zm4.04 0c.236 3.164 1.534 5.893 2.392 7.385A9.92 9.92 0 0 1 13 21.949V13h2.04zM4.982 4.887C5.718 6.227 6.726 8.473 6.951 11h-4.9a9.977 9.977 0 0 1 2.931-6.113M2.051 13h4.9c-.226 2.527-1.233 4.771-1.969 6.113A9.972 9.972 0 0 1 2.051 13m16.967 6.113c-.735-1.342-1.744-3.586-1.968-6.113h4.899a9.961 9.961 0 0 1-2.931 6.113",fill:"currentColor"})})}function Bs(){return n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",children:[n.jsx("path",{d:"M15.5 8a1.5 1.5 0 1 0 .001 3.001A1.5 1.5 0 0 0 15.5 8M8.5 8a1.5 1.5 0 1 0 .001 3.001A1.5 1.5 0 0 0 8.5 8",fill:"currentColor"}),n.jsx("path",{d:"M18.933 0h-.027c-.97 0-2.138.787-3.018 1.497-1.274-.374-2.612-.51-3.887-.51-1.285 0-2.616.133-3.874.517C7.245.79 6.069 0 5.093 0h-.027C3.352 0 .07 2.67.002 7.026c-.039 2.479.276 4.238 1.04 5.013.254.258.882.677 1.295.882.191 3.177.922 5.238 2.536 6.38.897.637 2.187.949 3.2 1.102C8.04 20.6 8 20.795 8 21c0 1.773 2.35 3 4 3 1.648 0 4-1.227 4-3 0-.201-.038-.393-.072-.586 2.573-.385 5.435-1.877 5.925-7.587.396-.22.887-.568 1.104-.788.763-.774 1.079-2.534 1.04-5.013C23.929 2.67 20.646 0 18.933 0M3.223 9.135c-.237.281-.837 1.155-.884 1.238-.15-.41-.368-1.349-.337-3.291.051-3.281 2.478-4.972 3.091-5.031.256.015.731.27 1.265.646-1.11 1.171-2.275 2.915-2.352 5.125-.133.546-.398.858-.783 1.313M12 22c-.901 0-1.954-.693-2-1 0-.654.475-1.236 1-1.602V20a1 1 0 1 0 2 0v-.602c.524.365 1 .947 1 1.602-.046.307-1.099 1-2 1m3-3.48v.02a4.752 4.752 0 0 0-1.262-1.02c1.092-.516 2.239-1.334 2.239-2.217 0-1.842-1.781-2.195-3.977-2.195-2.196 0-3.978.354-3.978 2.195 0 .883 1.148 1.701 2.238 2.217A4.8 4.8 0 0 0 9 18.539v-.025c-1-.076-2.182-.281-2.973-.842-1.301-.92-1.838-3.045-1.853-6.478l.023-.041c.496-.826 1.49-1.45 1.804-3.102 0-2.047 1.357-3.631 2.362-4.522C9.37 3.178 10.555 3 11.948 3c1.447 0 2.685.192 3.733.57 1 .9 2.316 2.465 2.316 4.48.313 1.651 1.307 2.275 1.803 3.102.035.058.068.117.102.178-.059 5.967-1.949 7.01-4.902 7.19m6.628-8.202c-.037-.065-.074-.13-.113-.195a7.587 7.587 0 0 0-.739-.987c-.385-.455-.648-.768-.782-1.313-.076-2.209-1.241-3.954-2.353-5.124.531-.376 1.004-.63 1.261-.647.636.071 3.044 1.764 3.096 5.031.027 1.81-.347 3.218-.37 3.235",fill:"currentColor"})]})}function $s(){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",children:n.jsx("path",{d:"M0 0l6.084 24H8L1.916 0zM21 5h-4l-1-4H4l3 12h3l1 4h13L21 5zM6.563 3h7.875l2 8H8.563l-2-8zm8.832 10l-2.856 1.904L12.063 13h3.332zM19 13l-1.5-6h1.938l2 8H16l3-2z",fill:"currentColor"})})}function Fs(){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",children:n.jsx("path",{d:"M17 4.978c-1.838 0-2.876.396-3.68.934.513-1.172 1.768-2.934 4.68-2.934a1 1 0 0 0 0-2c-2.921 0-4.629 1.365-5.547 2.512-.064.078-.119.162-.18.244C11.73 1.838 10.798.023 9.207.023 8.579.022 7.85.306 7 .978 5.027 2.54 5.329 3.902 6.492 4.999 3.609 5.222 0 7.352 0 12.969c0 4.582 4.961 11.009 9 11.009 1.975 0 2.371-.486 3-1 .629.514 1.025 1 3 1 4.039 0 9-6.418 9-11 0-5.953-4.055-8-7-8M8.242 2.546c.641-.508.943-.523.965-.523.426.169.975 1.405 1.357 3.055-1.527-.629-2.741-1.352-2.98-1.846.059-.112.241-.356.658-.686M15 21.978c-1.08 0-1.21-.109-1.559-.402l-.176-.146c-.367-.302-.816-.452-1.266-.452s-.898.15-1.266.452l-.176.146c-.347.292-.477.402-1.557.402-2.813 0-7-5.389-7-9.009 0-5.823 4.488-5.991 5-5.991 1.939 0 2.484.471 3.387 1.251l.323.276a1.995 1.995 0 0 0 2.58 0l.323-.276c.902-.78 1.447-1.251 3.387-1.251.512 0 5 .168 5 6 0 3.617-4.187 9-7 9",fill:"currentColor"})})}function Vs(){return n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",children:[n.jsx("path",{d:"M12 0a9 9 0 0 0-5 16.482V21s2.035 3 5 3 5-3 5-3v-4.518A9 9 0 0 0 12 0zm0 2c3.86 0 7 3.141 7 7s-3.14 7-7 7-7-3.141-7-7 3.14-7 7-7zM9 17.477c.94.332 1.946.523 3 .523s2.06-.19 3-.523v.834c-.91.436-1.925.689-3 .689a6.924 6.924 0 0 1-3-.69v-.833zm.236 3.07A8.854 8.854 0 0 0 12 21c.965 0 1.888-.167 2.758-.451C14.155 21.173 13.153 22 12 22c-1.102 0-2.117-.789-2.764-1.453z",fill:"currentColor"}),n.jsx("path",{d:"M14.745 12.449h-.004c-.852-.024-1.188-.858-1.577-1.824-.421-1.061-.703-1.561-1.182-1.566h-.009c-.481 0-.783.497-1.235 1.537-.436.982-.801 1.811-1.636 1.791l-.276-.043c-.565-.171-.853-.691-1.284-1.794-.125-.313-.202-.632-.27-.913-.051-.213-.127-.53-.195-.634C7.067 9.004 7.039 9 6.99 9A1 1 0 0 1 7 7h.01c1.662.017 2.015 1.373 2.198 2.134.486-.981 1.304-2.058 2.797-2.075 1.531.018 2.28 1.153 2.731 2.141l.002-.008C14.944 8.424 15.327 7 16.979 7h.032A1 1 0 1 1 17 9h-.011c-.149.076-.256.474-.319.709a6.484 6.484 0 0 1-.311.951c-.429.973-.79 1.789-1.614 1.789",fill:"currentColor"})]})}function Us(){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",children:n.jsx("path",{d:"M0 0h11v2H0zM4 11h3V6h4V4H0v2h4zM15.5 17c1.381 0 2.5-1.116 2.5-2.493s-1.119-2.493-2.5-2.493S13 13.13 13 14.507 14.119 17 15.5 17m0-2.986c.276 0 .5.222.5.493 0 .272-.224.493-.5.493s-.5-.221-.5-.493.224-.493.5-.493M21.5 19.014c-1.381 0-2.5 1.116-2.5 2.493S20.119 24 21.5 24s2.5-1.116 2.5-2.493-1.119-2.493-2.5-2.493m0 2.986a.497.497 0 0 1-.5-.493c0-.271.224-.493.5-.493s.5.222.5.493a.497.497 0 0 1-.5.493M22 13l-9 9 1.513 1.5 8.99-9.009zM17 11c2.209 0 4-1.119 4-2.5V2s.985-.161 1.498.949C23.01 4.055 23 6 23 6s1-1.119 1-3.135C24-.02 21 0 21 0h-2v6.347A5.853 5.853 0 0 0 17 6c-2.209 0-4 1.119-4 2.5s1.791 2.5 4 2.5M10.297 20.482l-1.475-1.585a47.54 47.54 0 0 1-1.442 1.129c-.307-.288-.989-1.016-2.045-2.183.902-.836 1.479-1.466 1.729-1.892s.376-.871.376-1.336c0-.592-.273-1.178-.818-1.759-.546-.581-1.329-.871-2.349-.871-1.008 0-1.79.293-2.344.879-.556.587-.832 1.181-.832 1.784 0 .813.419 1.748 1.256 2.805-.847.614-1.444 1.208-1.794 1.784a3.465 3.465 0 0 0-.523 1.833c0 .857.308 1.56.924 2.107.616.549 1.423.823 2.42.823 1.173 0 2.444-.379 3.813-1.137L8.235 24h2.819l-2.09-2.383 1.333-1.135zm-6.736-6.389a1.02 1.02 0 0 1 .73-.286c.31 0 .559.085.747.254a.849.849 0 0 1 .283.659c0 .518-.419 1.112-1.257 1.784-.536-.651-.805-1.231-.805-1.742a.901.901 0 0 1 .302-.669M3.74 22c-.427 0-.778-.116-1.057-.349-.279-.232-.418-.487-.418-.766 0-.594.509-1.288 1.527-2.083.968 1.134 1.717 1.946 2.248 2.438-.921.507-1.686.76-2.3.76",fill:"currentColor"})})}function Ws(){return n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",children:[n.jsx("path",{d:"M6.5 12C5.122 12 4 13.121 4 14.5S5.122 17 6.5 17 9 15.879 9 14.5 7.878 12 6.5 12m0 3c-.275 0-.5-.225-.5-.5s.225-.5.5-.5.5.225.5.5-.225.5-.5.5M17.5 12c-1.378 0-2.5 1.121-2.5 2.5s1.122 2.5 2.5 2.5 2.5-1.121 2.5-2.5-1.122-2.5-2.5-2.5m0 3c-.275 0-.5-.225-.5-.5s.225-.5.5-.5.5.225.5.5-.225.5-.5.5",fill:"currentColor"}),n.jsx("path",{d:"M22.482 9.494l-1.039-.346L21.4 9h.6c.552 0 1-.439 1-.992 0-.006-.003-.008-.003-.008H23c0-1-.889-2-1.984-2h-.642l-.731-1.717C19.262 3.012 18.091 2 16.764 2H7.236C5.909 2 4.738 3.012 4.357 4.283L3.626 6h-.642C1.889 6 1 7 1 8h.003S1 8.002 1 8.008C1 8.561 1.448 9 2 9h.6l-.043.148-1.039.346a2.001 2.001 0 0 0-1.359 2.097l.751 7.508a1 1 0 0 0 .994.901H3v1c0 1.103.896 2 2 2h2c1.104 0 2-.897 2-2v-1h6v1c0 1.103.896 2 2 2h2c1.104 0 2-.897 2-2v-1h1.096a.999.999 0 0 0 .994-.901l.751-7.508a2.001 2.001 0 0 0-1.359-2.097M6.273 4.857C6.402 4.43 6.788 4 7.236 4h9.527c.448 0 .834.43.963.857L19.313 9H4.688l1.585-4.143zM7 21H5v-1h2v1zm12 0h-2v-1h2v1zm2.189-3H2.811l-.662-6.607L3 11h18l.852.393L21.189 18z",fill:"currentColor"})]})}function qs(e,t=null){if(typeof window>"u")throw new Error;const i=localStorage.getItem(e);if(!i)return t;try{return JSON.parse(i)}catch{return i}}function Gs(e,t){window.localStorage.setItem(e,`${t}`)}class pt{constructor(t,i){re(this,"key");re(this,"value");re(this,"prev");re(this,"next");this.key=t,this.value=i,this.prev=null,this.next=null}}class Ks{constructor(t){re(this,"capacity");re(this,"usedCapacity");re(this,"head");re(this,"tail");re(this,"store");this.capacity=t||20,this.usedCapacity=0,this.store={},this.head=new pt("fakeHeadNode","fakeHeadNode"),this.tail=new pt("fakeTailNode","fakeTailNode"),this.head.next=this.tail,this.tail.prev=this.head}removeNode(t){t.prev.next=t.next,t.next.prev=t.prev}addToHead(t){t.prev=this.head,t.next=this.head.next,this.head.next.prev=t,this.head.next=t}moveToHead(t){this.removeNode(t),this.addToHead(t)}removeTail(){const t=this.tail.prev;return this.removeNode(t),t}get(t){if(t in this.store){const i=this.store[t];return this.moveToHead(i),i.value}return-1}put(t,i){if(t in this.store){const r=this.store[t];r.value=i,this.moveToHead(r)}else{const r=new pt(t,i);if(this.addToHead(r),this.store[t]=r,this.usedCapacity+=1,this.usedCapacity>this.capacity){const a=this.removeTail();delete this.store[a.key],this.usedCapacity-=1}}}keys(){const t=[];let i=this.head;for(;i;)t.push(i.key),i=i.next;return t.slice(1,-1)}values(){const t=[];let i=this.head;for(;i;)t.push(i.value),i=i.next;return t.slice(1,-1)}toJSON(){return this.store}}function Zs(e,t){const i=new Ks(t);return{syncFromStorage(){(qs(e)||[]).slice().reverse().forEach(o=>{i.put(o,o)})},syncToStorage(){Gs(e,Yi(i.keys()))},put(a){i.put(a,a),this.syncToStorage()},get(a){return a?i.get(a):i.keys()}}}const Se=Zs("EMOJI_PICKER",20),mn=[{title:"Smileys & People",data:Ms,icon:_.Laugh},{title:"Animals & Nature",data:Os,icon:Bs},{title:"Food & Drink",data:Ps,icon:Fs},{title:"Activity",data:Rs,icon:Ds},{title:"Travel & Places",data:Hs,icon:Ws},{title:"Object",data:Is,icon:Vs},{title:"Symbol",data:Es,icon:Us},{title:"Flags",data:zs,icon:$s}],Xs=["😀","😃","😄","😁","😆","😅","😂","🤣"];function Ys({onSelectEmoji:e,children:t}){const[i,r]=d.useState([]),{t:a}=b.useLocale(),o=d.useMemo(()=>i.length?[{title:"Frequently used",icon:_.Clock3,data:i},...mn]:mn,[i]),s=d.useCallback(c=>{Se.put(c),r(Se.get()),e&&e(c)},[e]);return d.useEffect(()=>{Se.syncFromStorage();const c=Se.get();c!=null&&c.length||Xs.forEach(h=>{Se.put(h)});const l=Se.get();r(l)},[]),n.jsxs(ee,{modal:!0,children:[n.jsx(te,{asChild:!0,children:t}),n.jsx(Y,{hideWhenDetached:!0,className:"richtext-w-full richtext-h-full richtext-p-2",align:"start",side:"bottom",children:n.jsxs(zt,{defaultValue:"Frequently used",children:[n.jsx(ct,{className:"richtext-flex richtext-items-center richtext-gap-[4px]",children:o.map(c=>n.jsx(Me,{value:c.title,className:"!richtext-p-[6px] richtext-bg-accent hover:richtext-text-accent-foreground",children:c.icon&&n.jsx(c.icon,{size:16})},`emoji-picker-title-${c.title}`))}),o.map(c=>n.jsxs(Ee,{value:c.title,children:[n.jsx("p",{className:"richtext-mb-[6px] richtext-font-semibold",children:a(c.title)}),n.jsx("div",{className:"richtext-max-h-[280px] richtext-overflow-y-auto",children:n.jsx("div",{className:"richtext-grid richtext-grid-cols-8 richtext-gap-1 ",children:(c.data||[]).map(l=>n.jsx("div",{onClick:()=>s(l),className:"richtext-text-center richtext-cursor-pointer",children:l},`emoji-picker-${l}`))})})]},`emoji-picker-content-${c.title}`))]})})]})}function Js({editor:e,icon:t,...i}){const r=d.useCallback(a=>{const{selection:o}=e.state,{$anchor:s}=o;return e.chain().insertContentAt(s.pos,a).run()},[e]);return n.jsx(Ys,{onSelectEmoji:r,children:n.jsx(y,{tooltip:i==null?void 0:i.tooltip,icon:t})})}const Qs=200,ec=new w.PluginKey("emoji"),tc=g.Node.create({name:"emoji",content:"text*",priority:Qs,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{},suggestion:{char:":",pluginKey:ec,command:({editor:t,range:i,props:r})=>{t.chain().focus().insertContentAt(i,`${r.emoji} `).run()}},button:({editor:t,t:i})=>({component:Js,componentProps:{editor:t,action:()=>{},isActive:()=>!1,disabled:!1,icon:"EmojiIcon",tooltip:i("editor.emoji.tooltip")}})}},addCommands(){return{setEmoji:e=>({commands:t})=>t.insertContent(`${e.emoji} `)}},addProseMirrorPlugins(){return[g.Suggestion({editor:this.editor,...this.options.suggestion})]}}).configure({suggestion:{items:({query:e})=>Ls(e),render:()=>{let e,t,i;return{onStart:r=>{i=r.editor.isEditable,i&&(e=new g.ReactRenderer(ei,{props:r,editor:r.editor}),t=rt("body",{getReferenceClientRect:r.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"}))},onUpdate(r){i&&(e.updateProps(r),t[0].setProps({getReferenceClientRect:r.clientRect}))},onKeyDown(r){var a;if(i)return r.event.key==="Escape"?(t[0].hide(),!0):(a=e.ref)==null?void 0:a.onKeyDown(r)},onExit(){i&&(t[0].destroy(),e.destroy())}}}}});function nc({editor:e,...t}){const{t:i}=b.useLocale(),r=qe(e,_e.name,{text:"",defaultShowPicker:!1}),{text:a,defaultShowPicker:o}=r,[s,c]=d.useState(""),l=d.useCallback(()=>{e.chain().focus().setKatex({text:s}).run(),c("")},[e,s]);d.useEffect(()=>{o&&e.chain().updateAttributes(_e.name,{defaultShowPicker:!1}).focus().run()},[e,o]);const h=d.useMemo(()=>{try{return It.renderToString(`${s}`)}catch{return s}},[s]),u=d.useMemo(()=>`${s}`.trim()?n.jsx("span",{contentEditable:!1,dangerouslySetInnerHTML:{__html:h||""}}):null,[s,h]);return n.jsxs(ee,{modal:!0,children:[n.jsx(te,{asChild:!0,children:n.jsx(y,{tooltip:t==null?void 0:t.tooltip,icon:t==null?void 0:t.icon})}),n.jsxs(Y,{hideWhenDetached:!0,className:"richtext-w-full richtext-h-full richtext-p-2",align:"start",side:"bottom",children:[n.jsx(X,{className:"richtext-mb-[6px]",children:i("editor.formula.dialog.text")}),n.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5 richtext-mb-[16px]",children:n.jsx("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm",children:n.jsx(Ge,{value:s,onChange:x=>c(x.target.value),autoFocus:!0,required:!0,rows:3,defaultValue:a,className:"richtext-w-full",placeholder:"Text"})})}),u&&n.jsx("div",{className:"richtext-my-[10px] richtext-p-[10px] richtext-rounded-[6px] !richtext-border-[1px] richtext-max-w-[286px] richtext-whitespace-nowrap richtext-overflow-auto",children:u}),n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-justify-between richtext-gap-[6px]",children:[n.jsx(F,{onClick:l,className:"richtext-flex-1",children:"Submit"}),n.jsx("a",{href:"https://katex.org/docs/supported",target:"_blank",rel:"noreferrer noopener",children:n.jsx(_.HelpCircle,{size:16})})]})]})]})}function ic(e,t=1){let i=0,r=0,a=0;if(e.startsWith("rgb")){const o=e.replace(/\s/g,"").match(/rgb\((.*)\)$/)[1].split(",");i=+o[0],r=+o[1],a=+o[2]}else if(e.startsWith("#")){let o=e.replace("#","");o.length===3&&(o=`${o[0]}${o[0]}${o[1]}${o[1]}${o[2]}${o[2]}`),i=Number.parseInt(o.substring(0,2),16),r=Number.parseInt(o.substring(2,4),16),a=Number.parseInt(o.substring(4,6),16)}else return e;return t>1&&t<=100&&(t=t/100),`rgba(${i},${r},${a},${t})`}function rc({node:e}){const t=Ir(),{text:i}=e.attrs,r=d.useMemo(()=>{const s="rgb(254, 242, 237)";return t==="dark"?ic(s,.75):s},[t]),a=d.useMemo(()=>{try{return It.renderToString(`${i}`)}catch{return i}},[i]),o=d.useMemo(()=>i.trim()?n.jsx("span",{contentEditable:!1,dangerouslySetInnerHTML:{__html:a}}):n.jsx("span",{contentEditable:!1,children:"Not enter a formula"}),[i,a]);return n.jsx(g.NodeViewWrapper,{style:{display:"inline-block",backgroundColor:r},as:"span",children:o})}function ac(e){return t=>t.getAttribute(e)}const _e=g.Node.create({name:"katex",group:"inline",inline:!0,defining:!0,draggable:!0,selectable:!0,addOptions(){return{HTMLAttributes:{class:"katex"},button:({editor:e,t})=>({component:nc,componentProps:{editor:e,action:()=>{},isActive:()=>!1,disabled:!1,icon:"KatexIcon",tooltip:t("editor.katex.tooltip")}})}},addAttributes(){return{text:{default:"",parseHTML:ac("text")},defaultShowPicker:{default:!1}}},parseHTML(){return[{tag:"span.katex"}]},renderHTML({HTMLAttributes:e}){return["span",g.mergeAttributes(this.options&&this.options.HTMLAttributes||{},e)]},addCommands(){return{setKatex:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[g.nodeInputRule({find:/^\$katex\$$/,type:this.type,getAttributes:()=>({defaultShowPicker:!0})})]},addNodeView(){return g.ReactNodeViewRenderer(rc)}});function oc(e){const t=document.createElement("iframe");t.setAttribute("style","position: absolute; width: 0; height: 0; top: 0; left: 0;"),document.body.appendChild(t),t.textContent=`
|
|
138
|
+
<!DOCTYPE html>
|
|
139
|
+
<html lang="en">
|
|
140
|
+
<head>
|
|
141
|
+
<title>Echo Editor</title>
|
|
142
|
+
<meta charset="UTF-8">
|
|
143
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
144
|
+
</head>
|
|
145
|
+
<body class="is-print">
|
|
146
|
+
<div class="tiptap ProseMirror" translate="no" aria-expanded="false">
|
|
147
|
+
${e}
|
|
148
|
+
</div>
|
|
149
|
+
</body>
|
|
150
|
+
</html>
|
|
151
|
+
`;const i=t.contentWindow,r=t.contentDocument||t.contentWindow&&t.contentWindow.document,a=document.createElement("link");a.rel="stylesheet",a.href="https://cdn.jsdelivr.net/npm/reactjs-tiptap-editor@latest/lib/style.css",r.head.appendChild(a),r&&(r.open(),r.write(e),r.close()),i&&(t.onload=function(){try{setTimeout(()=>{i.focus();try{i.document.execCommand("print",!1)||i.print()}catch{i.print()}i.close()},10)}catch(o){console.error(o)}setTimeout(()=>{document.body.removeChild(t)},100)})}function sc(e){const t=e.getHTML();return t?(oc(t),!0):!1}const cc=g.Extension.create({name:"exportPdf",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:i})=>({component:y,componentProps:{action:()=>{sc(t)},icon:"ExportPdf",tooltip:i("editor.exportPdf.tooltip"),isActive:()=>!1,disabled:!1}})}}});function lc(e,t){const i=atob(e.split(",")[1]),r=Array.from({length:i.length});for(let o=0;o<i.length;o++)r[o]=i.charCodeAt(o);const a=new Uint8Array(r);return new Blob([a],{type:t})}function dc(e,t){return new File([e],t,{type:e.type})}function hc(e){const[t,i]=d.useState(!1),[r,a]=d.useState(),o=d.useRef();function s(){o.current.click()}function c(x){const m=x.target.files[0];a(m),m&&h()}async function l(x){var N;const f=new DOMParser().parseFromString(x,"text/html"),p=f.querySelectorAll("img");if(!p.length)return f.body.innerHTML;if(Tn(e.editor,"image")){const A=(N=e.editor.extensionManager.extensions.find(k=>k.name==="importWord"))==null?void 0:N.options;if(A&&typeof A.upload=="function"){const k=[];for(const S of p){const T=S.getAttribute("src"),I=lc(T,"image/jpeg"),O=dc(I,"image.jpeg");k.push(O)}const j=await A.upload(k);for(let S=0;S<p.length;S++){const T=p[S];T.setAttribute("src",j[S].src);const I=T.parentElement;(I==null?void 0:I.tagName)==="P"&&(I.insertAdjacentElement("beforebegin",T),!I.hasChildNodes()&&I.textContent===""&&I.remove())}return f.body.innerHTML}else return console.warn("Image Upload method found, skip image conversion"),f.body.innerHTML}else return console.error("Image extension not found, unable to convert image"),f.body.innerHTML}async function h(){if(e.convert){const x=await e.convert(r);u(x)}else{const x=new FormData,m=JSON.stringify({collaboration_features:{comments:!0,user_id:"e3",track_changes:!0},formatting:{resets:"none",defaults:"inline",styles:"inline",comments:"basic"}});x.append("config",m),x.append("file",r),i(!0),fetch("https://docx-converter.cke-cs.com/v2/convert/docx-html",{method:"POST",body:x}).then(f=>f.json()).then(async f=>{u(f.html)}).catch(f=>{console.error("Error:",f),i(!1)})}}async function u(x){const m=await l(x);e.editor.chain().setContent(m,!0).run(),i(!1)}return n.jsxs("div",{children:[n.jsx(y,{loading:t,disabled:e==null?void 0:e.disabled,icon:e==null?void 0:e.icon,tooltip:e==null?void 0:e.tooltip,action:s}),n.jsx("input",{type:"file",accept:".docx",ref:o,style:{display:"none"},onChange:c})]})}const uc=g.Extension.create({name:"importWord",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),upload:void 0,convert:void 0,button:({editor:t,extension:i,t:r})=>{const{convert:a}=i.options;return{component:hc,componentProps:{convert:a,action:()=>t.commands.setHorizontalRule(),disabled:!t.can().setHorizontalRule(),icon:"Word",shortcutKeys:["alt","mod","S"],tooltip:r("editor.importWrod.tooltip")}}}}}}),mc=typeof window<"u";function xc(e,t){if(mc){const i=window.URL.createObjectURL(e),r=document.createElement("a");return r.href=i,r.download=t,r.click(),window.URL.revokeObjectURL(i),Promise.resolve()}return console.error("Download is not supported in Node.js"),Promise.resolve()}const fc={...se.defaultNodes,hardBreak:se.defaultNodes.hard_break,codeBlock:se.defaultNodes.code_block,orderedList:se.defaultNodes.ordered_list,listItem:se.defaultNodes.list_item,bulletList:se.defaultNodes.bullet_list,horizontalRule:se.defaultNodes.horizontal_rule,image(e,t){e.renderInline(t),e.closeBlock(t)}},gc=new se.DocxSerializer(fc,se.defaultMarks),bc=g.Extension.create({name:"exportWord",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:i})=>({component:y,componentProps:{icon:"ExportWord",action:()=>{t==null||t.commands.exportToWord()},tooltip:i("editor.exportWord.tooltip"),isActive:()=>!1,disabled:!1}})}},addCommands(){return{exportToWord:()=>async({editor:e})=>{const t={getImageBuffer:async r=>{const o=await(await fetch(r)).arrayBuffer();return new Uint8Array(o)}},i=gc.serialize(e.state.doc,t);return xi.Packer.toBlob(i).then(r=>xc(new Blob([r]),"export-document.docx")),!0}}}}),pc="_toc_aag8a_1",_c="_visible_aag8a_7",wc="_list_aag8a_11",vc="_item_aag8a_16",Je={toc:pc,visible:_c,list:wc,item:vc,"item--3":"_item--3_aag8a_19","item--4":"_item--4_aag8a_22","item--5":"_item--5_aag8a_25","item--6":"_item--6_aag8a_28"};function yc(e){const t=[],i=[t];return e.forEach(r=>{let a=-1,o=i[r.level+a];for(;!o;)a-=1,o=i[r.level+a];o.push({...r,children:i[r.level]=[]})}),t}function jc({editor:e}){const t=lt(),[i,r]=d.useState([]),{t:a}=b.useLocale(),o=d.useCallback(()=>{const s=[],c=e.state.tr;e.state.doc.descendants((l,h)=>{if(l.type.name==="heading"){const u=`heading-${s.length+1}`;l.attrs.id!==u&&c.setNodeMarkup(h,void 0,{...l.attrs,id:u}),s.push({level:l.attrs.level,text:l.textContent,id:u})}}),c.setMeta("addToHistory",!1),c.setMeta("preventUpdate",!0),e.view.dispatch(c),r(s),e.eventEmitter&&e.eventEmitter.emit("TableOfContents",yc(s))},[e]);return d.useEffect(()=>{if(e){if(!e.options.editable){o();return}return e.on("update",o),()=>{e.off("update",o)}}},[e,o]),d.useEffect(()=>{o()},[]),n.jsx(g.NodeViewWrapper,{className:w.clsx("tableOfContent",Je.toc,t&&Je.visible),children:t?n.jsxs("div",{style:{position:"relative"},children:[n.jsx("p",{className:"richtext-mb-[8px] text-[20px] richtext-font-semibold",children:a("editor.table_of_content")}),n.jsx("ul",{className:Je.list,children:i.map((s,c)=>n.jsx("li",{className:Je.item,style:{paddingLeft:`${s.level-1}rem`},children:n.jsx("a",{href:`#${s.id}`,children:s.text})},`table-of-content-${c}`))})]}):null})}function kc(e){return e&&e.type.name==="title"}function Cc(e,t){const r=[e.getJSON()],a=[];for(;r.length;){const o=r.shift();o.type===t&&a.push(o),o.content&&o.content.length&&r.push(...o.content)}return a}function Nc(e,...t){const[i,r]=d.useState(!1);return d.useEffect(()=>{const a=()=>{r(e.isActive.apply(e,t))};return e.on("selectionUpdate",a),e.on("transaction",a),()=>{e.off("selectionUpdate",a),e.off("transaction",a)}},[e,t,r]),i}function Sc({editor:e,icon:t,tooltip:i}){const r=Nc(e,ti.name),a=d.useCallback(()=>{if(r){e.chain().focus().removeTableOfContents().run();return}e.chain().focus().setTableOfContents().run()},[e,r]);return n.jsx(y,{action:a,isActive:()=>r||!1,icon:t,tooltip:i})}const ti=g.Node.create({name:"tableOfContents",group:"block",atom:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),onHasOneBeforeInsert:()=>{},resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!1,button:({editor:t,t:i})=>({component:Sc,componentProps:{disabled:!1,icon:"BookMarked",tooltip:i("editor.table.tooltip"),editor:t}})}},parseHTML(){return[{tag:"toc"}]},renderHTML({HTMLAttributes:e}){return["toc",g.mergeAttributes(e)]},addNodeView(){return g.ReactNodeViewRenderer(jc)},addCommands(){return{setTableOfContents:()=>({commands:e,editor:t,view:i})=>{if(Cc(t,this.name).length){this.options.onHasOneBeforeInsert();return}const a=i.props.state.doc.content.firstChild;if(kc(a)){const o=(a.firstChild&&a.firstChild.nodeSize||0)+1;return e.insertContentAt(o,{type:this.name})}return e.insertContent({type:this.name})},removeTableOfContents:()=>({state:e,dispatch:t})=>{const{tr:i}=e,r=e.schema.nodes.tableOfContents;return e.doc.descendants((a,o)=>{if(a.type===r){const s=o,c=o+a.nodeSize;i.delete(s,c)}}),i.docChanged?(t(i),!0):!1}}},addGlobalAttributes(){return[{types:["heading"],attributes:{id:{default:null}}}]}});function Tc(e){var i;const t=d.useMemo(()=>{var o;const r=(o=e==null?void 0:e.items)==null?void 0:o.find(s=>s.isActive());return r&&!r.default?{...r,icon:r.icon?r.icon:e.icon}:{title:e==null?void 0:e.tooltip,icon:e.icon,isActive:()=>!1}},[e]);return n.jsxs(ee,{modal:!0,children:[n.jsx(te,{disabled:e==null?void 0:e.disabled,asChild:!0,children:n.jsx(y,{customClass:"!richtext-w-12 richtext-h-12",icon:e==null?void 0:e.icon,tooltip:e==null?void 0:e.tooltip,disabled:e==null?void 0:e.disabled,children:n.jsx($,{className:"richtext-w-3 richtext-h-3 richtext-ml-1 richtext-text-zinc-500",name:"MenuDown"})})}),n.jsx(Y,{className:"richtext-min-w-4 richtext-w-full !richtext-p-[4px] richtext-flex richtext-flex-row richtext-gap-1",align:"start",side:"bottom",children:(i=e==null?void 0:e.items)==null?void 0:i.map((r,a)=>{var o,s;return n.jsxs(ze,{children:[n.jsx(Oe,{asChild:!0,children:n.jsx(Ke,{size:"sm",onClick:r==null?void 0:r.action,className:"richtext-p-1 richtext-w-7 richtext-h-7",pressed:t.title===r.title,"data-state":t.title===r.title?"on":"off",children:(r==null?void 0:r.icon)&&n.jsx($,{name:r.icon})})}),n.jsxs(ye,{className:"richtext-flex richtext-flex-col richtext-items-center",children:[n.jsx("span",{children:r.title}),!!((o=r.shortcutKeys)!=null&&o.length)&&n.jsx("span",{children:(s=r.shortcutKeys)==null?void 0:s.map(c=>at(c)).join(" ")})]})]},`text-align-${a}`)})})]})}const Ac=g.Extension.create({name:"text-direction",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),types:["heading","paragraph"],directions:["auto","ltr","rtl"],defaultDirection:"auto",button({editor:t,extension:i,t:r}){var l;const a=((l=i.options)==null?void 0:l.directions)||[],o={auto:"TextDirection",ltr:"LeftToRight",rtl:"RightToLeft"},s=a.map(h=>({title:r(`editor.textDirection.${h}.tooltip`),icon:o[h],isActive:()=>!1,action:()=>{var u,x,m,f;if(h==="auto"){(x=(u=t.commands)==null?void 0:u.unsetTextDirection)==null||x.call(u);return}(f=(m=t.commands)==null?void 0:m.setTextDirection)==null||f.call(m,h)},disabled:!1})),c=s.filter(h=>h.disabled).length===s.length;return{component:Tc,componentProps:{icon:"TextDirection",tooltip:r("editor.textDirection.tooltip"),disabled:c,items:s}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{dir:{default:this.options.defaultDirection,parseHTML:e=>e.attributes.dir&&this.options.directions.includes(e.attributes.dir)?e.attributes.dir.value:this.options.defaultDirection,renderHTML:e=>({dir:e.dir})}}}]},addCommands(){return{setTextDirection:e=>({commands:t})=>this.options.directions.includes(e)?this.options.types.every(i=>t.updateAttributes(i,{dir:e})):!1,unsetTextDirection:()=>({commands:e})=>this.options.types.every(t=>e.resetAttributes(t,"dir"))}}}),Lc="_listUsers_en3pm_1",Mc="_itemUser_en3pm_10",Ec="_selectedUser_en3pm_31",Qe={listUsers:Lc,itemUser:Mc,selectedUser:Ec},Ic=d.forwardRef((e,t)=>{const i=d.useRef(),[r,a]=d.useState(0),o=h=>{const u=e.items[h];u&&e.command({id:u,label:u})},s=()=>{a((r+e.items.length-1)%e.items.length)},c=()=>{a((r+1)%e.items.length)},l=()=>{o(r)};return d.useEffect(()=>a(0),[e.items]),d.useEffect(()=>{if(Number.isNaN(r+1))return;const h=i.current.querySelector(`span:nth-of-type(${r+1})`);h&&Et(h,{behavior:"smooth",scrollMode:"if-needed"})},[r]),d.useImperativeHandle(t,()=>({onKeyDown:({event:h})=>h.key==="ArrowUp"?(s(),!0):h.key==="ArrowDown"?(c(),!0):h.key==="Enter"?(l(),!0):!1})),n.jsx("div",{className:w.clsx("listUsers",Qe.listUsers),children:n.jsx("div",{ref:i,children:e.items.length?e.items.map((h,u)=>n.jsx("span",{className:w.clsx("itemUser",Qe.itemUser,u===r?Qe.selectedUser:""),onClick:()=>o(u),children:h},u)):n.jsx("div",{className:w.clsx("itemUserEmpty",Qe.itemUser),children:"Empty"})})})}),Rc=[{id:"1",name:"John Doe"},{id:"2",name:"Jane Doe"},{id:"3",name:"Alice"},{id:"4",name:"Bob"}],Hc={items:async({query:e})=>Rc.map(i=>i.name).filter(i=>i.toLowerCase().startsWith(e.toLowerCase())),render:()=>{let e,t;return{onStart:i=>{e=new g.ReactRenderer(Ic,{props:i,editor:i.editor}),t=rt("body",{getReferenceClientRect:i.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})},onUpdate(i){e.updateProps(i),t[0].setProps({getReferenceClientRect:i.clientRect})},onKeyDown(i){var r;return i.event.key==="Escape"?(t[0].hide(),!0):(r=e.ref)==null?void 0:r.onKeyDown(i)},onExit(){t[0].destroy(),e.destroy()}}}},zc=g.Mention.extend({addAttributes(){return{id:{default:"",parseHTML:K("id")},label:{default:"",parseHTML:K("label")}}}}).configure({HTMLAttributes:{class:"mention"},suggestion:Hc});function Oc(e){const t=w.server_browser.renderToStaticMarkup(e),a=new DOMParser().parseFromString(t,"image/svg+xml").documentElement,o=["svg",{...Array.from(a.attributes).reduce((s,c)=>(s[c.name]=c.value,s),{})}];return Array.from(a.childNodes).forEach(s=>{if(s.nodeType===1){const c=[s.tagName.toLowerCase(),Array.from(s.attributes).reduce((l,h)=>(l[h.name]=h.value,l),{})];s.textContent&&c.push(s.textContent),o.push(c)}}),o}const Pc={audio:n.jsx(_.LucideAudioLines,{}),video:n.jsx(_.LucideVideo,{}),file:n.jsx(_.LucideFile,{}),image:n.jsx(_.LucideImage,{}),pdf:n.jsx(Fn,{}),word:n.jsx(Vn,{}),excel:n.jsx(_.LucideSheet,{}),ppt:n.jsx(_.LucideTableProperties,{})};function ni(e,t=!1){const i=br(e),r=Pc[i]||n.jsx(n.Fragment,{});return t?Oc(r):r}const Dc="_attachment_1x1ms_1",Bc="_wrap_1x1ms_2",_t={attachment:Dc,wrap:Bc};function $c({editor:e,node:t,updateAttributes:i,deleteNode:r,extension:a}){var T;const o=d.useRef(),s=lt(),{hasTrigger:c,fileName:l,fileSize:h,fileExt:u,fileType:x,url:m,error:f}=t.attrs,[p,v]=d.useState(!1),{t:N}=b.useLocale(),A=(T=a==null?void 0:a.options)==null?void 0:T.upload,k=d.useCallback(()=>{!s||m||s&&o.current.click()},[s,m]),j=d.useCallback(async I=>{const O=I.target.files&&I.target.files[0];if(!O)return;const E={fileName:fr(O.name),fileSize:O.size,fileType:O.type,fileExt:gr(O.name)};v(!0);try{const L=await A(O);i({...E,url:L}),v(!1)}catch(L){i({error:`File upload fail: ${L&&L.message}`||"Unknown error"}),v(!1),o.current.value=""}},[v,i]);d.useEffect(()=>{!m&&!c&&(k(),i({hasTrigger:!0}))},[m,c,k,i]);const S=d.useCallback(()=>r(),[e]);return s&&!m?n.jsx(g.NodeViewWrapper,{children:n.jsxs("div",{className:w.clsx(_t.wrap,"render-wrapper"),children:[n.jsx("p",{style:{cursor:"pointer"},onClick:k,children:p?n.jsx("span",{children:N("editor.attachment.uploading")}):n.jsx("span",{children:N("editor.attachment.please_upload")})}),n.jsx("input",{ref:o,type:"file",hidden:!0,onChange:j})]})}):m?n.jsx(g.NodeViewWrapper,{children:n.jsxs("div",{className:w.clsx(_t.wrap,"render-wrapper"),onClick:k,children:[n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[4px]",children:[n.jsx("span",{children:ni(x)}),n.jsxs("span",{children:[l,".",u]}),n.jsxs("span",{children:["(",In(h),")"]})]}),n.jsx(y,{icon:"Trash2",action:S,tooltip:N("editor.delete")})]})}):f!=="null"?n.jsx(g.NodeViewWrapper,{children:n.jsx("div",{className:w.clsx(_t.wrap,"render-wrapper"),onClick:k,children:n.jsx("p",{children:f})})}):n.jsx(n.Fragment,{})}const Fc=g.Node.create({name:"attachment",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"attachment"},button:({editor:t,t:i})=>({component:y,componentProps:{action:()=>t.chain().focus().setAttachment().run(),isActive:()=>!1,disabled:!1,icon:"Attachment",tooltip:i("editor.attachment.tooltip")}})}},parseHTML(){return[{tag:"div[class=attachment]"}]},renderHTML({HTMLAttributes:e}){const{url:t="",fileName:i="",fileSize:r="",fileType:a="",fileExt:o=""}=e||{};return["div",g.mergeAttributes(this.options.HTMLAttributes||{},e||{}),t?["a",{href:t||"#"},["span",{class:"attachment__icon"},ni(a,!0)],["span",{class:"attachment__text"},`${i}.${o} (${In(r)})`]]:["div",{class:"attachment__placeholder"}]]},addAttributes(){return{fileName:{default:null,parseHTML:K("filename")},fileSize:{default:null,parseHTML:K("filesize")},fileType:{default:null,parseHTML:K("filetype")},fileExt:{default:null,parseHTML:K("fileext")},url:{default:null,parseHTML:K("url")},hasTrigger:{default:!1,parseHTML:e=>K("hastrigger")(e)==="true"},error:{default:null,parseHTML:K("error")}}},addCommands(){return{setAttachment:(e={})=>({chain:t})=>t().insertContent({type:this.name,attrs:e}).run()}},addNodeView(){return g.ReactNodeViewRenderer($c)}}),et={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function Vc(e){var I,O;const[t,i]=d.useState({width:b.IMAGE_MAX_SIZE,height:b.IMAGE_MAX_SIZE}),[r,a]=d.useState({width:0,height:0}),[o]=d.useState([et.TOP_LEFT,et.TOP_RIGHT,et.BOTTOM_LEFT,et.BOTTOM_RIGHT]),[s,c]=d.useState(!1),[l,h]=d.useState({x:0,y:0,w:0,h:0,dir:""}),{align:u}=(I=e==null?void 0:e.node)==null?void 0:I.attrs,x=d.useMemo(()=>{var H;const{src:E,alt:L,width:M,height:C}=(H=e==null?void 0:e.node)==null?void 0:H.attrs,D=w.isNumber(M)?`${M}px`:M,z=w.isNumber(C)?`${C}px`:C;return{src:E||void 0,alt:L||void 0,style:{width:D||void 0,height:z||void 0}}},[(O=e==null?void 0:e.node)==null?void 0:O.attrs]),m=d.useMemo(()=>{const{style:{width:E}}=x;return{width:E==="100%"?E:void 0}},[x]);function f(E){a({width:E.target.width,height:E.target.height})}function p(){const{editor:E,getPos:L}=e;E.commands.setNodeSelection(L())}const v=d.useCallback(w.throttle(()=>{const{editor:E}=e,{width:L}=getComputedStyle(E.view.dom);i(M=>({...M,width:Number.parseInt(L,10)}))},b.IMAGE_THROTTLE_WAIT_TIME),[e==null?void 0:e.editor]);function N(E,L){E.preventDefault(),E.stopPropagation();const M=r.width,C=r.height,D=M/C;let z=Number(e.node.attrs.width),H=Number(e.node.attrs.height);const R=t.width;z&&!H?(z=z>R?R:z,H=Math.round(z/D)):H&&!z?(z=Math.round(H*D),z=z>R?R:z):!z&&!H?(z=M>R?R:M,H=Math.round(z/D)):z=z>R?R:z,Le.flushSync(()=>{c(!0),h({x:E.clientX,y:E.clientY,w:z,h:H,dir:L})})}const A=d.useCallback(w.throttle(E=>{if(E.preventDefault(),E.stopPropagation(),!s)return;const{x:L,w:M,dir:C}=l,D=(E.clientX-L)*(/l/.test(C)?-1:1),z=w.clamp(M+D,b.IMAGE_MIN_SIZE,t.width);e.updateAttributes({width:z,height:null})},b.IMAGE_THROTTLE_WAIT_TIME),[s,l,t,e.updateAttributes]),k=d.useCallback(E=>{E.preventDefault(),E.stopPropagation(),s&&(Le.flushSync(()=>{h({x:0,y:0,w:0,h:0,dir:""}),c(!1)}),p())},[s,p]),j=d.useCallback(()=>{document==null||document.addEventListener("mousemove",A,!0),document==null||document.addEventListener("mouseup",k,!0)},[A,k]),S=d.useCallback(()=>{document==null||document.removeEventListener("mousemove",A,!0),document==null||document.removeEventListener("mouseup",k,!0)},[A,k]);d.useEffect(()=>(s?j():S(),()=>{S()}),[s,j,S]);const T=d.useMemo(()=>new ResizeObserver(()=>v()),[v]);return d.useEffect(()=>(T.observe(e.editor.view.dom),()=>{T.disconnect()}),[e.editor.view.dom,T]),n.jsx(g.NodeViewWrapper,{className:"image-view",style:{...m,width:"100%",textAlign:u},children:n.jsxs("div",{draggable:"true","data-drag-handle":!0,className:`image-view__body ${e!=null&&e.selected?"image-view__body--focused":""} ${s?"image-view__body--resizing":""}`,style:m,children:[n.jsx("img",{src:x.src,alt:x.alt,style:x.style,height:"auto",className:"image-view__body__image block",onLoad:f,onClick:p}),(e==null?void 0:e.editor.view.editable)&&((e==null?void 0:e.selected)||s)&&n.jsx("div",{className:"image-resizer",children:o==null?void 0:o.map(E=>n.jsx("span",{className:`image-resizer__handler image-resizer__handler--${E}`,onMouseDown:L=>N(L,E)},`image-dir-${E}`))})]})})}function Uc({selectImage:e,giphyApiKey:t,children:i}){const[r,a]=d.useState([]),[o]=d.useState(15),s=d.useRef(null),c=(h,u="search")=>{if(!t)return;const m=`${u==="search"?`https://api.giphy.com/v1/gifs/search?q=${h}`:`https://api.giphy.com/v1/gifs/trending?q=${h}`}&limit=${o}&api_key=${t}`;fetch(m).then(f=>f.json()).then(f=>{a(f.data)}).catch(f=>{console.log(f)})};d.useEffect(()=>{c("","trend")},[]);const l=d.useCallback(w.debounce(h=>{if(!h.target.value){c("","trend");return}c(h.target.value)},350),[]);return n.jsxs(ee,{modal:!0,children:[n.jsx(te,{asChild:!0,children:i}),n.jsx(Y,{hideWhenDetached:!0,className:"richtext-w-full richtext-h-full richtext-p-2",align:"start",side:"bottom",children:t?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"richtext-w-full richtext-mb-[10px]",children:n.jsx(Z,{ref:s,type:"text",placeholder:"Search GIF",onChange:l})}),n.jsx("div",{className:"richtext-max-h-[280px] richtext-overflow-y-auto",children:n.jsx("div",{className:"richtext-grid richtext-grid-cols-2 richtext-gap-1 ",children:r!=null&&r.length?r==null?void 0:r.map(h=>n.jsx("img",{alt:"giphy",className:"richtext-text-center richtext-cursor-pointer",onClick:u=>e(h),height:h.images.fixed_width_downsampled.height,width:h.images.fixed_width_downsampled.width,src:h.images.fixed_width_downsampled.url},`giphy-${h.id}`)):n.jsx("p",{children:"No GIFs found"})})})]}):n.jsx("div",{children:n.jsx("p",{children:"Missing Giphy API Key"})})})]})}function Wc({editor:e,icon:t,giphyApiKey:i,...r}){const a=o=>{const{url:s}=o.images.original;e.chain().focus().setImageGif({src:s}).run()};return n.jsx(Uc,{selectImage:a,giphyApiKey:i,children:n.jsx(y,{tooltip:r==null?void 0:r.tooltip,icon:t})})}const Ft=g.Image.extend({name:"imageGif",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),inline:!1,content:"",marks:"",group:"block",GIPHY_API_KEY:"",draggable:!1,selectable:!0,atom:!0,button:({editor:t,extension:i,t:r})=>{var o;const a=((o=i==null?void 0:i.options)==null?void 0:o.GIPHY_API_KEY)||"";return{component:Wc,componentProps:{editor:t,action:()=>{},isActive:()=>!1,disabled:!1,icon:"GifIcon",tooltip:r("editor.imageGif.tooltip"),giphyApiKey:a}}}}},addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),width:{default:null,parseHTML:t=>{const i=t.style.width||t.getAttribute("width")||"10";return i===void 0?null:Number.parseInt(`${i}`,10)},renderHTML:t=>({width:t.width})},align:{default:"center",parseHTML:t=>t.getAttribute("align"),renderHTML:t=>({align:t.align})}}},addNodeView(){return g.ReactNodeViewRenderer(Vc)},addCommands(){var e;return{...(e=this.parent)==null?void 0:e.call(this),setImageGif:t=>({commands:i})=>i.insertContent({type:this.name,attrs:t}),updateImageGif:t=>({commands:i})=>i.updateAttributes(this.name,t),setAlignImageGif:t=>({commands:i})=>i.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:e}){const{align:t}=e;return["div",{style:t?`text-align: ${t};`:"",class:"imageGIf"},["img",g.mergeAttributes({height:"auto"},this.options.HTMLAttributes,e)]]},parseHTML(){return[{tag:"div[class=imageGIf]",getAttrs:e=>{const t=e.querySelector("img"),i=t==null?void 0:t.getAttribute("width");return{src:t==null?void 0:t.getAttribute("src"),alt:t==null?void 0:t.getAttribute("alt"),title:t==null?void 0:t.getAttribute("title"),width:i?Number.parseInt(i,10):null,align:(t==null?void 0:t.getAttribute("align"))||e.style.textAlign||null}}}]}}),xn=`graph TB
|
|
152
|
+
a-->b`,qc=({editor:e,upload:t})=>{const[i,r]=d.useState(xn),[a,o]=d.useState(""),[s,c]=d.useState(!1),l=d.useRef(null),h=async m=>{try{const{svg:f}=await nt.render("mermaid-svg",m);o(f)}catch{o("")}},u=()=>{nt.initialize({darkMode:!1,startOnLoad:!1,fontSize:12,theme:"base"}),h(i)};d.useEffect(()=>{s&&u()},[s]),d.useEffect(()=>{s&&h(i)},[i]);const x=async()=>{if(i!==""){if(i){const m=l.current.querySelector("svg"),{width:f,height:p}=m.getBoundingClientRect(),v=`mermaid-${En()}.svg`;let N=w.i(m.outerHTML);if(t){const A=Pt(N,v);N=await t(A)}e==null||e.chain().focus().setMermaid({type:"mermaid",src:N,alt:encodeURIComponent(i),width:f,height:p},!!i).run()}c(!1)}};return n.jsxs(je,{open:s,onOpenChange:c,children:[n.jsx(ke,{asChild:!0,children:n.jsx(y,{icon:"Mermaid",tooltip:"Mermaid",action:()=>c(!0)})}),n.jsxs(ue,{className:"!richtext-max-w-[1300px] richtext-z-[99999]",children:[n.jsx(me,{children:"Mermaid"}),n.jsx("div",{style:{height:"100%",borderWidth:1},children:n.jsxs("div",{className:"richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]",children:[n.jsx(Ge,{className:"richtext-flex-1",value:i,onChange:m=>r(m.target.value),autoFocus:!0,required:!0,rows:10,defaultValue:xn,placeholder:"Text",style:{color:"hsl(var(--richtext-foreground))"}}),n.jsx("div",{className:"richtext-flex-1 richtext-flex richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",style:{height:"100%",borderWidth:1,minHeight:500,background:"#fff"},ref:l,dangerouslySetInnerHTML:{__html:a}})]})}),n.jsx(Pe,{children:n.jsx(F,{type:"button",onClick:x,children:"Save changes"})})]})]})},tt={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function Gc({editor:e,node:t,updateAttributes:i,getPos:r,selected:a}){const[o,s]=d.useState({width:b.IMAGE_MAX_SIZE,height:b.IMAGE_MAX_SIZE}),[c,l]=d.useState({width:0,height:0}),[h]=d.useState([tt.TOP_LEFT,tt.TOP_RIGHT,tt.BOTTOM_LEFT,tt.BOTTOM_RIGHT]),[u,x]=d.useState(!1),[m,f]=d.useState({x:0,y:0,w:0,h:0,dir:""}),{align:p}=t==null?void 0:t.attrs,v=d.useMemo(()=>{const{src:M,alt:C,width:D,height:z}=t==null?void 0:t.attrs,H=g.isNumber(D)?`${D}px`:D,R=g.isNumber(z)?`${z}px`:z;return{src:M||void 0,alt:C||void 0,style:{width:H||void 0,height:R||void 0}}},[t==null?void 0:t.attrs]),N=d.useMemo(()=>{const{style:{width:M}}=v;return{width:M==="100%"?M:void 0}},[v]);function A(M){l({width:M.target.width,height:M.target.height})}function k(){e.commands.setNodeSelection(r())}const j=d.useCallback(w.throttle(()=>{const{width:M}=getComputedStyle(e.view.dom);s(C=>({...C,width:Number.parseInt(M,10)}))},b.IMAGE_THROTTLE_WAIT_TIME),[e]);function S(M,C){M.preventDefault(),M.stopPropagation();const D=c.width,z=c.height,H=D/z;let R=Number(t.attrs.width),U=Number(t.attrs.height);const q=o.width;R&&!U?(R=R>q?q:R,U=Math.round(R/H)):U&&!R?(R=Math.round(U*H),R=R>q?q:R):!R&&!U?(R=D>q?q:D,U=Math.round(R/H)):R=R>q?q:R,Le.flushSync(()=>{x(!0),f({x:M.clientX,y:M.clientY,w:R,h:U,dir:C})})}const T=d.useCallback(w.throttle(M=>{if(M.preventDefault(),M.stopPropagation(),!u)return;const{x:C,w:D,dir:z}=m,H=(M.clientX-C)*(/l/.test(z)?-1:1),R=Sn(D+H,b.IMAGE_MIN_SIZE,o.width);i({width:R,height:null})},b.IMAGE_THROTTLE_WAIT_TIME),[u,m,o,i]),I=d.useCallback(M=>{M.preventDefault(),M.stopPropagation(),u&&(Le.flushSync(()=>{f({x:0,y:0,w:0,h:0,dir:""}),x(!1)}),k())},[u,k]),O=d.useCallback(()=>{document==null||document.addEventListener("mousemove",T,!0),document==null||document.addEventListener("mouseup",I,!0)},[T,I]),E=d.useCallback(()=>{document==null||document.removeEventListener("mousemove",T,!0),document==null||document.removeEventListener("mouseup",I,!0)},[T,I]);d.useEffect(()=>(u?O():E(),()=>{E()}),[u,O,E]);const L=d.useMemo(()=>new ResizeObserver(()=>j()),[j]);return d.useEffect(()=>(L.observe(e.view.dom),()=>{L.disconnect()}),[e.view.dom,L]),n.jsx(g.NodeViewWrapper,{className:"image-view",style:{...N,width:"100%",textAlign:p},children:n.jsxs("div",{draggable:"true","data-drag-handle":!0,className:`image-view__body ${a?"image-view__body--focused":""} ${u?"image-view__body--resizing":""}`,style:{...N,background:"#fff"},children:[n.jsx("img",{src:v.src,alt:v.alt,style:v.style,height:"auto",className:"image-view__body__image block",onLoad:A,onClick:k}),e.view.editable&&(a||u)&&n.jsx("div",{className:"image-resizer",children:h==null?void 0:h.map(M=>n.jsx("span",{className:`image-resizer__handler image-resizer__handler--${M}`,onMouseDown:C=>S(C,M)},`image-dir-${M}`))})]})})}const Lt=g.Image.extend({name:"mermaid",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),inline:!1,content:"",marks:"",group:"block",draggable:!1,selectable:!0,atom:!0,HTMLAttributes:{class:"mermaid"},button:({editor:t,t:i,extension:r})=>{var a;return{component:qc,componentProps:{action:()=>{},isActive:()=>!1,disabled:!1,editor:t,icon:"Mermaid",tooltip:i("editor.mermaid.tooltip"),upload:(a=r==null?void 0:r.options)==null?void 0:a.upload}}}}},addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),width:{default:null,parseHTML:t=>{const i=t.style.width||t.getAttribute("width")||"10";return i===void 0?null:Number.parseInt(`${i}`,10)},renderHTML:t=>({width:t.width})},height:{default:null,parseHTML:t=>{const i=t.style.height||t.getAttribute("height")||"10";return i===void 0?null:Number.parseInt(`${i}`,10)},renderHTML:t=>({height:t.height})},align:{default:"center",parseHTML:t=>t.getAttribute("align"),renderHTML:t=>({align:t.align})}}},addNodeView(){return g.ReactNodeViewRenderer(Gc)},addCommands(){return{setMermaid:(e,t)=>({commands:i,editor:r})=>t?i.insertContent({type:this.name,attrs:e}):i.insertContentAt(r.state.selection.anchor,{type:this.name,attrs:e}),setAlignImageMermaid:e=>({commands:t})=>t.updateAttributes(this.name,{align:e})}},renderHTML({HTMLAttributes:e}){const{align:t}=e;return["div",{style:t?`text-align: ${t};`:"",class:"imageMermaid"},["img",g.mergeAttributes(this.options.HTMLAttributes,e)]]},parseHTML(){return[{tag:"div[class=imageMermaid]",getAttrs:e=>{const t=e.querySelector("img"),i=t==null?void 0:t.getAttribute("width"),r=t==null?void 0:t.getAttribute("height");return{src:t==null?void 0:t.getAttribute("src"),alt:t==null?void 0:t.getAttribute("alt"),width:i?Number.parseInt(i,10):null,height:r?Number.parseInt(r,10):null,align:(t==null?void 0:t.getAttribute("align"))||e.style.textAlign||null}}}]}});exports.Attachment=Fc;exports.BaseKit=Po;exports.Blockquote=vo;exports.Bold=Pa;exports.BulletList=bo;exports.Clear=po;exports.Code=Fa;exports.CodeBlock=Kn;exports.Color=fo;exports.Column=dt;exports.ColumnActionButton=Io;exports.Emoji=tc;exports.Excalidraw=ge;exports.ExportPdf=cc;exports.ExportWord=bc;exports.FontFamily=ao;exports.FontSize=uo;exports.FormatPainter=js;exports.Heading=so;exports.Highlight=go;exports.History=So;exports.HorizontalRule=ko;exports.Iframe=be;exports.Image=Yn;exports.ImageGif=Ft;exports.ImportWord=uc;exports.Indent=Fo;exports.Italic=Da;exports.Katex=_e;exports.LineHeight=Ko;exports.Link=jo;exports.Mention=zc;exports.Mermaid=Lt;exports.MoreMark=$o;exports.MultiColumn=Ie;exports.OrderedList=_o;exports.RichTextEditor=Vr;exports.SearchAndReplace=Qn;exports.SlashCommand=es;exports.Strike=$a;exports.SubAndSuperScript=Do;exports.Table=ys;exports.TableOfContents=ti;exports.TaskList=wo;exports.TextAlign=lo;exports.TextDirection=Ac;exports.Twitter=it;exports.Underline=Ba;exports.Video=Jn;exports.mitt=Cn;
|