reactjs-tiptap-editor-pro 0.2.36 → 0.2.38
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/extension-bundle.d.cts +66 -66
- package/lib/extension-bundle.d.ts +66 -66
- package/lib/index.cjs +3 -3
- package/lib/index.d.cts +69 -67
- package/lib/index.d.ts +69 -67
- package/lib/index.js +66 -64
- package/lib/locale-bundle.d.cts +66 -66
- package/lib/locale-bundle.d.ts +66 -66
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var fn=Object.defineProperty;var mn=(e,t,n)=>t in e?fn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var X=(e,t,n)=>mn(e,typeof t!="symbol"?t+"":t,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=require("react"),o=require("react/jsx-runtime"),a=require("./ColorPicker-DGbrNkQ-.cjs"),A=require("./locale-bundle-PAhriAQT.cjs"),hn=require("@radix-ui/react-toast"),J=require("lucide-react"),Le=require("easydrawer"),gn=require("katex"),ze=require("mermaid"),vt=require("tippy.js");function yt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const G=yt(g),R=yt(hn);function pn(){var s;const e=g.useRef({editor:null}),[t,n]=g.useState(!1),[r,i]=g.useState(null);return g.useEffect(()=>{var l;(l=e.current)!=null&&l.editor&&(n(!0),i(e.current.editor))},[e,(s=e.current)==null?void 0:s.editor]),{isReady:t,editor:r,editorRef:e}}function wt(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var B=Array.isArray,Fe=a.Symbol?a.Symbol.prototype:void 0,He=Fe?Fe.toString:void 0;function Q(e){if(typeof e=="string")return e;if(B(e))return wt(e,Q)+"";if(a.isSymbol(e))return He?He.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var xn=1/0,vn=17976931348623157e292;function yn(e){if(!e)return e===0?e:0;if(e=a.toNumber(e),e===xn||e===-1/0){var t=e<0?-1:1;return t*vn}return e===e?e:0}function wn(e){var t=yn(e),n=t%1;return t===t?n?t-n:t:0}function be(e){return e}var bn="[object AsyncFunction]",jn="[object Function]",An="[object GeneratorFunction]",Cn="[object Proxy]";function bt(e){if(!a.isObject(e))return!1;var t=a.baseGetTag(e);return t==jn||t==An||t==bn||t==Cn}var se=a.root["__core-js_shared__"],Ge=function(){var e=/[^.]+$/.exec(se&&se.keys&&se.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Sn(e){return!!Ge&&Ge in e}var Tn=Function.prototype,En=Tn.toString;function F(e){if(e!=null){try{return En.call(e)}catch{}try{return e+""}catch{}}return""}var In=/[\\^$.*+?()[\]{}|]/g,Pn=/^\[object .+?Constructor\]$/,_n=Function.prototype,On=Object.prototype,Nn=_n.toString,Rn=On.hasOwnProperty,$n=RegExp("^"+Nn.call(Rn).replace(In,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Bn(e){if(!a.isObject(e)||Sn(e))return!1;var t=bt(e)?$n:Pn;return t.test(F(e))}function Dn(e,t){return e==null?void 0:e[t]}function H(e,t){var n=Dn(e,t);return Bn(n)?n:void 0}var ue=H(a.root,"WeakMap");function Mn(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var kn=800,Ln=16,zn=Date.now;function Fn(e){var t=0,n=0;return function(){var r=zn(),i=Ln-(r-n);if(n=r,i>0){if(++t>=kn)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Hn(e){return function(){return e}}var Ue=function(){try{var e=H(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Gn=Ue?function(e,t){return Ue(e,"toString",{configurable:!0,enumerable:!1,value:Hn(t),writable:!0})}:be,Un=Fn(Gn);function Wn(e,t,n,r){for(var i=e.length,s=n+-1;++s<i;)if(t(e[s],s,e))return s;return-1}function Kn(e){return e!==e}function Vn(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function qn(e,t,n){return t===t?Vn(e,t,n):Wn(e,Kn,n)}function Xn(e,t){var n=e==null?0:e.length;return!!n&&qn(e,t,0)>-1}var Yn=9007199254740991,Zn=/^(?:0|[1-9]\d*)$/;function jt(e,t){var n=typeof e;return t=t??Yn,!!t&&(n=="number"||n!="symbol"&&Zn.test(e))&&e>-1&&e%1==0&&e<t}function At(e,t){return e===t||e!==e&&t!==t}var We=Math.max;function Jn(e,t,n){return t=We(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,s=We(r.length-t,0),l=Array(s);++i<s;)l[i]=r[t+i];i=-1;for(var u=Array(t+1);++i<t;)u[i]=r[i];return u[t]=n(l),Mn(e,this,u)}}function Qn(e,t){return Un(Jn(e,t,be),e+"")}var er=9007199254740991;function je(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=er}function Ct(e){return e!=null&&je(e.length)&&!bt(e)}var tr=Object.prototype;function nr(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||tr;return e===n}function rr(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var or="[object Arguments]";function Ke(e){return a.isObjectLike(e)&&a.baseGetTag(e)==or}var St=Object.prototype,ir=St.hasOwnProperty,sr=St.propertyIsEnumerable,Ae=Ke(function(){return arguments}())?Ke:function(e){return a.isObjectLike(e)&&ir.call(e,"callee")&&!sr.call(e,"callee")};function ar(){return!1}var Tt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ve=Tt&&typeof module=="object"&&module&&!module.nodeType&&module,lr=Ve&&Ve.exports===Tt,qe=lr?a.root.Buffer:void 0,cr=qe?qe.isBuffer:void 0,de=cr||ar,ur="[object Arguments]",dr="[object Array]",fr="[object Boolean]",mr="[object Date]",hr="[object Error]",gr="[object Function]",pr="[object Map]",xr="[object Number]",vr="[object Object]",yr="[object RegExp]",wr="[object Set]",br="[object String]",jr="[object WeakMap]",Ar="[object ArrayBuffer]",Cr="[object DataView]",Sr="[object Float32Array]",Tr="[object Float64Array]",Er="[object Int8Array]",Ir="[object Int16Array]",Pr="[object Int32Array]",_r="[object Uint8Array]",Or="[object Uint8ClampedArray]",Nr="[object Uint16Array]",Rr="[object Uint32Array]",_={};_[Sr]=_[Tr]=_[Er]=_[Ir]=_[Pr]=_[_r]=_[Or]=_[Nr]=_[Rr]=!0;_[ur]=_[dr]=_[Ar]=_[fr]=_[Cr]=_[mr]=_[hr]=_[gr]=_[pr]=_[xr]=_[vr]=_[yr]=_[wr]=_[br]=_[jr]=!1;function $r(e){return a.isObjectLike(e)&&je(e.length)&&!!_[a.baseGetTag(e)]}function Ce(e){return function(t){return e(t)}}var Et=typeof exports=="object"&&exports&&!exports.nodeType&&exports,W=Et&&typeof module=="object"&&module&&!module.nodeType&&module,Br=W&&W.exports===Et,ae=Br&&a.freeGlobal.process,ee=function(){try{var e=W&&W.require&&W.require("util").types;return e||ae&&ae.binding&&ae.binding("util")}catch{}}(),Xe=ee&&ee.isTypedArray,It=Xe?Ce(Xe):$r,Dr=Object.prototype,Mr=Dr.hasOwnProperty;function kr(e,t){var n=B(e),r=!n&&Ae(e),i=!n&&!r&&de(e),s=!n&&!r&&!i&&It(e),l=n||r||i||s,u=l?rr(e.length,String):[],c=u.length;for(var d in e)Mr.call(e,d)&&!(l&&(d=="length"||i&&(d=="offset"||d=="parent")||s&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||jt(d,c)))&&u.push(d);return u}function Lr(e,t){return function(n){return e(t(n))}}var zr=Lr(Object.keys,Object),Fr=Object.prototype,Hr=Fr.hasOwnProperty;function Gr(e){if(!nr(e))return zr(e);var t=[];for(var n in Object(e))Hr.call(e,n)&&n!="constructor"&&t.push(n);return t}function Pt(e){return Ct(e)?kr(e):Gr(e)}var Ur=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Wr=/^\w*$/;function Se(e,t){if(B(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||a.isSymbol(e)?!0:Wr.test(e)||!Ur.test(e)||t!=null&&e in Object(t)}var K=H(Object,"create");function Kr(){this.__data__=K?K(null):{},this.size=0}function Vr(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var qr="__lodash_hash_undefined__",Xr=Object.prototype,Yr=Xr.hasOwnProperty;function Zr(e){var t=this.__data__;if(K){var n=t[e];return n===qr?void 0:n}return Yr.call(t,e)?t[e]:void 0}var Jr=Object.prototype,Qr=Jr.hasOwnProperty;function eo(e){var t=this.__data__;return K?t[e]!==void 0:Qr.call(t,e)}var to="__lodash_hash_undefined__";function no(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=K&&t===void 0?to:t,this}function z(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}z.prototype.clear=Kr;z.prototype.delete=Vr;z.prototype.get=Zr;z.prototype.has=eo;z.prototype.set=no;function ro(){this.__data__=[],this.size=0}function te(e,t){for(var n=e.length;n--;)if(At(e[n][0],t))return n;return-1}var oo=Array.prototype,io=oo.splice;function so(e){var t=this.__data__,n=te(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():io.call(t,n,1),--this.size,!0}function ao(e){var t=this.__data__,n=te(t,e);return n<0?void 0:t[n][1]}function lo(e){return te(this.__data__,e)>-1}function co(e,t){var n=this.__data__,r=te(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function M(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}M.prototype.clear=ro;M.prototype.delete=so;M.prototype.get=ao;M.prototype.has=lo;M.prototype.set=co;var V=H(a.root,"Map");function uo(){this.size=0,this.__data__={hash:new z,map:new(V||M),string:new z}}function fo(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function ne(e,t){var n=e.__data__;return fo(t)?n[typeof t=="string"?"string":"hash"]:n.map}function mo(e){var t=ne(this,e).delete(e);return this.size-=t?1:0,t}function ho(e){return ne(this,e).get(e)}function go(e){return ne(this,e).has(e)}function po(e,t){var n=ne(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function k(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}k.prototype.clear=uo;k.prototype.delete=mo;k.prototype.get=ho;k.prototype.has=go;k.prototype.set=po;var xo="Expected a function";function Te(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(xo);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],s=n.cache;if(s.has(i))return s.get(i);var l=e.apply(this,r);return n.cache=s.set(i,l)||s,l};return n.cache=new(Te.Cache||k),n}Te.Cache=k;var vo=500;function yo(e){var t=Te(e,function(r){return n.size===vo&&n.clear(),r}),n=t.cache;return t}var wo=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,bo=/\\(\\)?/g,jo=yo(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(wo,function(n,r,i,s){t.push(i?s.replace(bo,"$1"):r||n)}),t});function fe(e){return e==null?"":Q(e)}function _t(e,t){return B(e)?e:Se(e,t)?[e]:jo(fe(e))}function re(e){if(typeof e=="string"||a.isSymbol(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Ot(e,t){t=_t(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[re(t[n++])];return n&&n==r?e:void 0}function Ao(e,t,n){var r=e==null?void 0:Ot(e,t);return r===void 0?n:r}function Nt(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var Ye=a.Symbol?a.Symbol.isConcatSpreadable:void 0;function Co(e){return B(e)||Ae(e)||!!(Ye&&e&&e[Ye])}function So(e,t,n,r,i){var s=-1,l=e.length;for(n||(n=Co),i||(i=[]);++s<l;){var u=e[s];n(u)&&Nt(i,u)}return i}function To(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var s=Array(i);++r<i;)s[r]=e[r+t];return s}function Eo(e,t,n){var r=e.length;return n=n===void 0?r:n,n>=r?e:To(e,t,n)}var Io="\\ud800-\\udfff",Po="\\u0300-\\u036f",_o="\\ufe20-\\ufe2f",Oo="\\u20d0-\\u20ff",No=Po+_o+Oo,Ro="\\ufe0e\\ufe0f",$o="\\u200d",Bo=RegExp("["+$o+Io+No+Ro+"]");function Ee(e){return Bo.test(e)}function Do(e){return e.split("")}var Rt="\\ud800-\\udfff",Mo="\\u0300-\\u036f",ko="\\ufe20-\\ufe2f",Lo="\\u20d0-\\u20ff",zo=Mo+ko+Lo,Fo="\\ufe0e\\ufe0f",Ho="["+Rt+"]",me="["+zo+"]",he="\\ud83c[\\udffb-\\udfff]",Go="(?:"+me+"|"+he+")",$t="[^"+Rt+"]",Bt="(?:\\ud83c[\\udde6-\\uddff]){2}",Dt="[\\ud800-\\udbff][\\udc00-\\udfff]",Uo="\\u200d",Mt=Go+"?",kt="["+Fo+"]?",Wo="(?:"+Uo+"(?:"+[$t,Bt,Dt].join("|")+")"+kt+Mt+")*",Ko=kt+Mt+Wo,Vo="(?:"+[$t+me+"?",me,Bt,Dt,Ho].join("|")+")",qo=RegExp(he+"(?="+he+")|"+Vo+Ko,"g");function Xo(e){return e.match(qo)||[]}function Yo(e){return Ee(e)?Xo(e):Do(e)}function Zo(){this.__data__=new M,this.size=0}function Jo(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Qo(e){return this.__data__.get(e)}function ei(e){return this.__data__.has(e)}var ti=200;function ni(e,t){var n=this.__data__;if(n instanceof M){var r=n.__data__;if(!V||r.length<ti-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new k(r)}return n.set(e,t),this.size=n.size,this}function D(e){var t=this.__data__=new M(e);this.size=t.size}D.prototype.clear=Zo;D.prototype.delete=Jo;D.prototype.get=Qo;D.prototype.has=ei;D.prototype.set=ni;function ri(e,t){for(var n=-1,r=e==null?0:e.length,i=0,s=[];++n<r;){var l=e[n];t(l,n,e)&&(s[i++]=l)}return s}function oi(){return[]}var ii=Object.prototype,si=ii.propertyIsEnumerable,Ze=Object.getOwnPropertySymbols,ai=Ze?function(e){return e==null?[]:(e=Object(e),ri(Ze(e),function(t){return si.call(e,t)}))}:oi;function li(e,t,n){var r=t(e);return B(e)?r:Nt(r,n(e))}function Je(e){return li(e,Pt,ai)}var ge=H(a.root,"DataView"),pe=H(a.root,"Promise"),xe=H(a.root,"Set"),Qe="[object Map]",ci="[object Object]",et="[object Promise]",tt="[object Set]",nt="[object WeakMap]",rt="[object DataView]",ui=F(ge),di=F(V),fi=F(pe),mi=F(xe),hi=F(ue),L=a.baseGetTag;(ge&&L(new ge(new ArrayBuffer(1)))!=rt||V&&L(new V)!=Qe||pe&&L(pe.resolve())!=et||xe&&L(new xe)!=tt||ue&&L(new ue)!=nt)&&(L=function(e){var t=a.baseGetTag(e),n=t==ci?e.constructor:void 0,r=n?F(n):"";if(r)switch(r){case ui:return rt;case di:return Qe;case fi:return et;case mi:return tt;case hi:return nt}return t});var ot=a.root.Uint8Array,gi="__lodash_hash_undefined__";function pi(e){return this.__data__.set(e,gi),this}function xi(e){return this.__data__.has(e)}function q(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new k;++t<n;)this.add(e[t])}q.prototype.add=q.prototype.push=pi;q.prototype.has=xi;function vi(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function Lt(e,t){return e.has(t)}var yi=1,wi=2;function zt(e,t,n,r,i,s){var l=n&yi,u=e.length,c=t.length;if(u!=c&&!(l&&c>u))return!1;var d=s.get(e),m=s.get(t);if(d&&m)return d==t&&m==e;var f=-1,h=!0,p=n&wi?new q:void 0;for(s.set(e,t),s.set(t,e);++f<u;){var x=e[f],y=t[f];if(r)var b=l?r(y,x,f,t,e,s):r(x,y,f,e,t,s);if(b!==void 0){if(b)continue;h=!1;break}if(p){if(!vi(t,function(S,I){if(!Lt(p,I)&&(x===S||i(x,S,n,r,s)))return p.push(I)})){h=!1;break}}else if(!(x===y||i(x,y,n,r,s))){h=!1;break}}return s.delete(e),s.delete(t),h}function bi(e){var t=-1,n=Array(e.size);return e.forEach(function(r,i){n[++t]=[i,r]}),n}function ji(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var Ai=1,Ci=2,Si="[object Boolean]",Ti="[object Date]",Ei="[object Error]",Ii="[object Map]",Pi="[object Number]",_i="[object RegExp]",Oi="[object Set]",Ni="[object String]",Ri="[object Symbol]",$i="[object ArrayBuffer]",Bi="[object DataView]",it=a.Symbol?a.Symbol.prototype:void 0,le=it?it.valueOf:void 0;function Di(e,t,n,r,i,s,l){switch(n){case Bi:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case $i:return!(e.byteLength!=t.byteLength||!s(new ot(e),new ot(t)));case Si:case Ti:case Pi:return At(+e,+t);case Ei:return e.name==t.name&&e.message==t.message;case _i:case Ni:return e==t+"";case Ii:var u=bi;case Oi:var c=r&Ai;if(u||(u=ji),e.size!=t.size&&!c)return!1;var d=l.get(e);if(d)return d==t;r|=Ci,l.set(e,t);var m=zt(u(e),u(t),r,i,s,l);return l.delete(e),m;case Ri:if(le)return le.call(e)==le.call(t)}return!1}var Mi=1,ki=Object.prototype,Li=ki.hasOwnProperty;function zi(e,t,n,r,i,s){var l=n&Mi,u=Je(e),c=u.length,d=Je(t),m=d.length;if(c!=m&&!l)return!1;for(var f=c;f--;){var h=u[f];if(!(l?h in t:Li.call(t,h)))return!1}var p=s.get(e),x=s.get(t);if(p&&x)return p==t&&x==e;var y=!0;s.set(e,t),s.set(t,e);for(var b=l;++f<c;){h=u[f];var S=e[h],I=t[h];if(r)var P=l?r(I,S,h,t,e,s):r(S,I,h,e,t,s);if(!(P===void 0?S===I||i(S,I,n,r,s):P)){y=!1;break}b||(b=h=="constructor")}if(y&&!b){var j=e.constructor,v=t.constructor;j!=v&&"constructor"in e&&"constructor"in t&&!(typeof j=="function"&&j instanceof j&&typeof v=="function"&&v instanceof v)&&(y=!1)}return s.delete(e),s.delete(t),y}var Fi=1,st="[object Arguments]",at="[object Array]",Y="[object Object]",Hi=Object.prototype,lt=Hi.hasOwnProperty;function Gi(e,t,n,r,i,s){var l=B(e),u=B(t),c=l?at:L(e),d=u?at:L(t);c=c==st?Y:c,d=d==st?Y:d;var m=c==Y,f=d==Y,h=c==d;if(h&&de(e)){if(!de(t))return!1;l=!0,m=!1}if(h&&!m)return s||(s=new D),l||It(e)?zt(e,t,n,r,i,s):Di(e,t,c,n,r,i,s);if(!(n&Fi)){var p=m&<.call(e,"__wrapped__"),x=f&<.call(t,"__wrapped__");if(p||x){var y=p?e.value():e,b=x?t.value():t;return s||(s=new D),i(y,b,n,r,s)}}return h?(s||(s=new D),zi(e,t,n,r,i,s)):!1}function Ie(e,t,n,r,i){return e===t?!0:e==null||t==null||!a.isObjectLike(e)&&!a.isObjectLike(t)?e!==e&&t!==t:Gi(e,t,n,r,Ie,i)}var Ui=1,Wi=2;function Ki(e,t,n,r){var i=n.length,s=i;if(e==null)return!s;for(e=Object(e);i--;){var l=n[i];if(l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++i<s;){l=n[i];var u=l[0],c=e[u],d=l[1];if(l[2]){if(c===void 0&&!(u in e))return!1}else{var m=new D,f;if(!(f===void 0?Ie(d,c,Ui|Wi,r,m):f))return!1}}return!0}function Ft(e){return e===e&&!a.isObject(e)}function Vi(e){for(var t=Pt(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,Ft(i)]}return t}function Ht(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function qi(e){var t=Vi(e);return t.length==1&&t[0][2]?Ht(t[0][0],t[0][1]):function(n){return n===e||Ki(n,e,t)}}function Xi(e,t){return e!=null&&t in Object(e)}function Yi(e,t,n){t=_t(t,e);for(var r=-1,i=t.length,s=!1;++r<i;){var l=re(t[r]);if(!(s=e!=null&&n(e,l)))break;e=e[l]}return s||++r!=i?s:(i=e==null?0:e.length,!!i&&je(i)&&jt(l,i)&&(B(e)||Ae(e)))}function Zi(e,t){return e!=null&&Yi(e,t,Xi)}var Ji=1,Qi=2;function es(e,t){return Se(e)&&Ft(t)?Ht(re(e),t):function(n){var r=Ao(n,e);return r===void 0&&r===t?Zi(n,e):Ie(t,r,Ji|Qi)}}function Gt(e){return function(t){return t==null?void 0:t[e]}}function ts(e){return function(t){return Ot(t,e)}}function ns(e){return Se(e)?Gt(re(e)):ts(e)}function rs(e){return typeof e=="function"?e:e==null?be:typeof e=="object"?B(e)?es(e[0],e[1]):qi(e):ns(e)}function ce(e){return a.isObjectLike(e)&&Ct(e)}var os=200;function is(e,t,n,r){var i=-1,s=Xn,l=!0,u=e.length,c=[],d=t.length;if(!u)return c;n&&(t=wt(t,Ce(n))),t.length>=os&&(s=Lt,l=!1,t=new q(t));e:for(;++i<u;){var m=e[i],f=n==null?m:n(m);if(m=m!==0?m:0,l&&f===f){for(var h=d;h--;)if(t[h]===f)continue e;c.push(m)}else s(t,f,r)||c.push(m)}return c}function ss(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var as=Qn(function(e,t){var n=ss(t);return ce(n)&&(n=void 0),ce(e)?is(e,So(t,1,ce),rs(n)):[]}),ls="[object RegExp]";function cs(e){return a.isObjectLike(e)&&a.baseGetTag(e)==ls}var ct=ee&&ee.isRegExp,us=ct?Ce(ct):cs,ds=Gt("length"),Ut="\\ud800-\\udfff",fs="\\u0300-\\u036f",ms="\\ufe20-\\ufe2f",hs="\\u20d0-\\u20ff",gs=fs+ms+hs,ps="\\ufe0e\\ufe0f",xs="["+Ut+"]",ve="["+gs+"]",ye="\\ud83c[\\udffb-\\udfff]",vs="(?:"+ve+"|"+ye+")",Wt="[^"+Ut+"]",Kt="(?:\\ud83c[\\udde6-\\uddff]){2}",Vt="[\\ud800-\\udbff][\\udc00-\\udfff]",ys="\\u200d",qt=vs+"?",Xt="["+ps+"]?",ws="(?:"+ys+"(?:"+[Wt,Kt,Vt].join("|")+")"+Xt+qt+")*",bs=Xt+qt+ws,js="(?:"+[Wt+ve+"?",ve,Kt,Vt,xs].join("|")+")",ut=RegExp(ye+"(?="+ye+")|"+js+bs,"g");function As(e){for(var t=ut.lastIndex=0;ut.test(e);)++t;return t}function Cs(e){return Ee(e)?As(e):ds(e)}var Ss=30,Ts="...",Es=/\w*$/;function Is(e,t){var n=Ss,r=Ts;if(a.isObject(t)){var i="separator"in t?t.separator:i;n="length"in t?wn(t.length):n,r="omission"in t?Q(t.omission):r}e=fe(e);var s=e.length;if(Ee(e)){var l=Yo(e);s=l.length}if(n>=s)return e;var u=n-Cs(r);if(u<1)return r;var c=l?Eo(l,0,u).join(""):e.slice(0,u);if(i===void 0)return c+r;if(l&&(u+=c.length-u),us(i)){if(e.slice(u).search(i)){var d,m=c;for(i.global||(i=RegExp(i.source,fe(Es.exec(i))+"g")),i.lastIndex=0;d=i.exec(m);)var f=d.index;c=c.slice(0,f===void 0?u:f)}}else if(e.indexOf(Q(i),u)!=u){var h=c.lastIndexOf(i);h>-1&&(c=c.slice(0,h))}return c+r}const Ps=R.Provider,Yt=G.forwardRef(({className:e,...t},n)=>o.jsx(R.Viewport,{ref:n,className:a.cn("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));Yt.displayName=R.Viewport.displayName;const _s=a.cva("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md !border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Zt=G.forwardRef(({className:e,variant:t,...n},r)=>o.jsx(R.Root,{ref:r,className:a.cn(_s({variant:t}),e),...n}));Zt.displayName=R.Root.displayName;const Os=G.forwardRef(({className:e,...t},n)=>o.jsx(R.Action,{ref:n,className:a.cn("inline-flex h-8 shrink-0 items-center justify-center rounded-md !border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));Os.displayName=R.Action.displayName;const Jt=G.forwardRef(({className:e,...t},n)=>o.jsx(R.Close,{ref:n,className:a.cn("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:o.jsx(J.X,{className:"h-4 w-4"})}));Jt.displayName=R.Close.displayName;const Qt=G.forwardRef(({className:e,...t},n)=>o.jsx(R.Title,{ref:n,className:a.cn("text-sm font-semibold",e),...t}));Qt.displayName=R.Title.displayName;const en=G.forwardRef(({className:e,...t},n)=>o.jsx(R.Description,{ref:n,className:a.cn("text-sm opacity-90",e),...t}));en.displayName=R.Description.displayName;let U=!1;function Ns({editor:e,attrs:t,extension:n}){const[r,i]=g.useState(!1),s=g.useRef(null),l=g.useRef(null),{alt:u,align:c}=t,d=n==null?void 0:n.options.upload,m=()=>{(async()=>{const w=document.querySelector("#easydrawer");w&&(s.current=new Le.Editor(w,{wheelEventsEnabled:!1,disableZoom:!0}),l.current=Le.makeDropdownToolbar(s.current),l.current.addDefaultToolWidgets(),s.current.loadFromSVG(decodeURIComponent(u)))})()};g.useEffect(()=>{r&&setTimeout(()=>{m()},200)},[r]);const f=async()=>{if(s.current){const C=s.current.toSVG(),w=C.outerHTML,E=`drawer-${a.shortId()}.svg`;let O=a.i(C.outerHTML);if(d){const N=a.dataURLtoFile(O,E);O=await d(N)}e==null||e.chain().focus().setDrawer({type:"drawer",src:O,alt:encodeURIComponent(w),width:426,height:212},!!w).run(),e==null||e.commands.setAlignImageDrawer(c)}i(!1)},h=C=>{const w=s.current.toolController.getPrimaryTools()[2],E=l.current.getWidgetById("pen-1");w&&E&&(w.setColor(C),E.serializeState())},p=C=>{const w=s.current.toolController.getPrimaryTools()[2],E=l.current.getWidgetById("pen-1");w&&E&&(w.setThickness(C),E.serializeState())},x=C=>{const w=s.current.toolController.getPrimaryTools()[3],E=l.current.getWidgetById("pen-2");w&&E&&(w.setColor(C),E.serializeState())},y=C=>{const w=l.current.getWidgetById("shape");w&&w.setShapeType(C)},b=C=>{const w=s.current.toolController.getPrimaryTools()[5],E=l.current.getWidgetById("shape");w&&E&&(w.setColor(C),E.serializeState())},S=C=>{const w=s.current.toolController.getPrimaryTools()[5],E=l.current.getWidgetById("shape");w&&E&&(w.setThickness(C),E.serializeState())},I=C=>{const w=s.current.toolController.getPrimaryTools()[5],E=l.current.getWidgetById("shape");w&&E&&(w.setBorderColor(C),E.serializeState())},P=()=>{if(U){for(;s.current.history.redoStackSize>0;)s.current.history.redo();U=!1;return}s.current.history.undo()},j=()=>{U||s.current.history.redo()},v=()=>{if(!U){for(;s.current.history.undoStackSize>0;)P();U=!0}};return o.jsxs(a.Dialog,{onOpenChange:i,open:r,children:[o.jsx(a.DialogTrigger,{asChild:!0,children:o.jsx(a.ActionButton,{action:()=>i(!0),icon:"Pencil",tooltip:"Edit Drawer"})}),o.jsxs(a.DialogContent,{className:"z-[99999] !max-w-[1300px]",children:[o.jsx(a.DialogTitle,{children:"Edit Drawer"}),o.jsxs("div",{style:{height:"100%",borderWidth:1,background:"white",position:"relative"},children:[o.jsx("div",{className:"size-full",id:"easydrawer"}),o.jsx(a.ControlDrawer,{changeBorderColorShape:I,changeColorShape:b,changeShape:y,onClear:v,onRedo:j,onThicknessChange:S,onUndo:P,refEditor:s,setColorHighlight:x,setColorPen:h,setThicknessPen:p})]}),o.jsx(a.DialogFooter,{children:o.jsx(a.Button,{onClick:f,type:"button",children:"Save changes"})})]})]})}function tn(e,t){const[n,r]=g.useState(void 0);return g.useEffect(()=>{const i=()=>{const s=e.extensionManager.extensions.find(l=>l.name===t);s&&r(s)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,t]),n}const Rs={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"};function $s({item:e,disabled:t,editor:n}){var i;const r=e.component;return r?o.jsx(g.Fragment,{children:e.type==="divider"?o.jsx(a.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"}):o.jsx(r,{...e.componentProps,disabled:t||((i=e==null?void 0:e.componentProps)==null?void 0:i.disabled),editor:n})}):o.jsx(o.Fragment,{})}function Bs(e){return e.type.name==="drawer"}function Ds(e){const{lang:t}=A.useLocale(),n=a.useAttributes(e.editor,a.Drawer.name),r=tn(e.editor,a.Drawer.name),i=({editor:l})=>{const{selection:u}=l.view.state,{$from:c,to:d}=u;let m=!1;return l.view.state.doc.nodesBetween(c.pos,d,f=>{if(Bs(f))return m=!0,!1}),m},s=g.useMemo(()=>e.disabled?[]:ia(e.editor),[e.disabled,e.editor,t]);return o.jsx(o.Fragment,{children:o.jsx(a.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:i,tippyOptions:Rs,children:s!=null&&s.length?o.jsx("div",{className:"pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800",children:o.jsx("div",{className:"relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap",children:s==null?void 0:s.map((l,u)=>l.type==="edit"&&(n!=null&&n.src)?o.jsx(Ns,{attrs:n,editor:e.editor,extension:r},`bubbleMenu-drawer-${u}`):o.jsx($s,{disabled:e.disabled,editor:e.editor,item:l},`bubbleMenu-drawer-${u}`))})}):o.jsx(o.Fragment,{})})})}const Ms={padding:"0 12px 12px"},ks=({width:e,maxWidth:t,height:n,onOk:r,children:i})=>{const{t:s}=A.useLocale(),[l,u]=g.useState({width:"",height:"",maxWidth:""});g.useEffect(()=>{u({width:e,height:n,maxWidth:t})},[n,t,e]);function c(d){d.preventDefault(),d.stopPropagation(),r(l)}return o.jsxs(a.Popover,{modal:!0,children:[o.jsx(a.PopoverTrigger,{asChild:!0,children:i}),o.jsx(a.PopoverContent,{children:o.jsx("div",{style:Ms,children:o.jsxs("form",{className:"flex flex-col gap-2",onSubmit:c,children:[o.jsx(a.Label,{className:"mb-[6px]",children:"Width"}),o.jsx("div",{className:"flex w-full max-w-sm items-center gap-1.5",children:o.jsx("div",{className:"relative items-center w-full max-w-sm",children:o.jsx(a.Input,{type:"number",value:l.width,required:!0,onChange:d=>u({...l,width:d.target.value})})})}),o.jsx(a.Label,{className:"mb-[6px]",children:"Max Width"}),o.jsx("div",{className:"flex w-full max-w-sm items-center gap-1.5",children:o.jsx("div",{className:"relative items-center w-full max-w-sm",children:o.jsx(a.Input,{type:"number",value:l.maxWidth,required:!0,onChange:d=>u({...l,maxWidth:d.target.value})})})}),o.jsx(a.Label,{className:"mb-[6px]",children:"Height"}),o.jsx("div",{className:"flex w-full max-w-sm items-center gap-1.5",children:o.jsx("div",{className:"relative items-center w-full max-w-sm",children:o.jsx(a.Input,{type:"number",value:l.height,required:!0,onChange:d=>u({...l,height:d.target.value})})})}),o.jsx(a.Button,{type:"submit",className:"self-end mt-2",children:s("editor.link.dialog.button.apply")})]})})})]})};function Ls({editor:e}){const{t}=A.useLocale(),{width:n,height:r,url:i}=a.useAttributes(e,a.Iframe.name,{width:0,height:0,url:"",defaultShowPicker:!1}),[s,l]=g.useState(!1),[u,c]=g.useState(""),d=g.useCallback(()=>{l(!1)},[l]);g.useEffect(()=>{s&&c(i)},[s,i]);const m=g.useCallback(()=>{e.chain().updateAttributes(a.Iframe.name,{url:u}).setNodeSelection(e.state.selection.from).focus().run(),l(!1)},[e,u,l]),f=g.useCallback(()=>{window.open(i,"_blank")},[i]),h=g.useCallback(()=>{l(!0)},[l]),p=g.useCallback(b=>{e.chain().updateAttributes(a.Iframe.name,b).setNodeSelection(e.state.selection.from).focus().run()},[e]),x=g.useCallback(()=>e.isActive(a.Iframe.name)&&!i,[e,i]),y=g.useCallback(()=>a.deleteNode(a.Iframe.name,e),[e]);return o.jsxs(o.Fragment,{children:[o.jsx(a.BubbleMenu,{className:"bubble-menu",editor:e,pluginKey:"iframe-bubble-menu",shouldShow:x,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999},children:o.jsxs("div",{className:"w-auto px-3 py-2 transition-all !border rounded-sm shadow-sm pointer-events-auto select-none border-neutral-200 dark:border-neutral-800 bg-background",children:[o.jsx(a.ActionButton,{action:f,icon:"Eye",tooltip:"Visit Link"}),o.jsx(a.ActionButton,{action:h,icon:"Pencil",tooltip:"Open Edit Link"}),o.jsx(ks,{width:n,height:r,onOk:p,children:o.jsx(a.ActionButton,{icon:"Settings",tooltip:t("editor.settings")})}),o.jsx(a.ActionButton,{action:y,icon:"Trash2",tooltip:t("editor.delete")})]})}),o.jsxs(a.Dialog,{open:s,onOpenChange:l,children:[o.jsx(a.DialogTrigger,{}),o.jsxs(a.DialogContent,{children:[o.jsx(a.DialogHeader,{children:o.jsx(a.DialogTitle,{children:"Edit Link Iframe"})}),o.jsx(a.Input,{value:u,onInput:b=>c(b.target.value),type:"url",autoFocus:!0,placeholder:"Enter link"}),o.jsxs(a.DialogFooter,{children:[o.jsx(a.Button,{onClick:d,children:"Cancel"}),o.jsx(a.Button,{onClick:m,children:"OK"})]})]})]})]})}function zs({editor:e,...t}){const n=a.useAttributes(e,a.Katex.name,{text:"",defaultShowPicker:!1}),{text:r,defaultShowPicker:i}=n,[s,l]=g.useState(""),[u,c]=g.useState(!1),d=g.useCallback(()=>e.isActive(a.Katex.name),[e]),m=g.useCallback(()=>a.deleteNode(a.Katex.name,e),[e]),f=g.useCallback(()=>{e.chain().focus().setKatex({text:s}).run(),c(!1)},[e,s]);g.useEffect(()=>{i&&(c(!0),e.chain().updateAttributes(a.Katex.name,{defaultShowPicker:!1}).focus().run())},[e,i,c]),g.useEffect(()=>{u&&l(r||"")},[u]);const h=g.useMemo(()=>{try{return gn.renderToString(`${s}`)}catch{return s}},[s]),p=g.useMemo(()=>`${s}`.trim()?o.jsx("span",{contentEditable:!1,dangerouslySetInnerHTML:{__html:h||""}}):null,[s,h]);return o.jsx(a.BubbleMenu,{editor:e,pluginKey:"Katex-bubble-menu",shouldShow:d,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{c(!1)}},children:t!=null&&t.disabled?o.jsx(o.Fragment,{}):o.jsx("div",{className:"p-2 bg-white !border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800",children:u?o.jsxs(o.Fragment,{children:[o.jsx(a.Textarea,{value:s,onChange:x=>l(x.target.value),autoFocus:!0,placeholder:"Formula text",rows:3,defaultValue:r,style:{marginBottom:8}}),p&&o.jsx("div",{className:"my-[10px] p-[10px] rounded-[6px] !border-[1px] whitespace-nowrap overflow-auto",children:p}),o.jsxs("div",{className:"flex items-center justify-between gap-[6px]",children:[o.jsx(a.Button,{onClick:f,className:"flex-1",children:"Submit"}),o.jsx("a",{href:"https://katex.org/docs/supported",target:"_blank",rel:"noreferrer noopener",children:o.jsx(J.HelpCircle,{size:16})})]})]}):o.jsxs("div",{className:"flex items-center justify-center gap-[6px]",children:[o.jsx(a.ActionButton,{tooltip:"Edit",action:()=>c(!u),children:o.jsx(J.Pencil,{size:16})}),o.jsx(a.ActionButton,{tooltip:"Delete",action:m,children:o.jsx(J.Trash2,{size:16})})]})})})}const dt=`graph TB
|
|
2
|
-
a-->b`,Fs=({editor:e,attrs:t,extension:n})=>{const{alt:r,align:i}=t,[s,l]=g.useState(decodeURIComponent(r??dt)),[u,c]=g.useState(""),[d,m]=g.useState(!1),f=g.useRef(null),h=n==null?void 0:n.options.upload,p=async b=>{try{const{svg:S}=await ze.render("mermaid-svg",b);c(S)}catch{c("")}},x=()=>{ze.initialize({darkMode:!1,startOnLoad:!1,fontSize:12,theme:"base"}),p(s)};g.useEffect(()=>{d&&x()},[d]),g.useEffect(()=>{d&&p(s)},[s]);const y=async()=>{if(s!==""){if(s){const b=f.current.querySelector("svg"),{width:S,height:I}=b.getBoundingClientRect(),P=`mermaid-${a.shortId()}.svg`;let j=a.i(b.outerHTML);if(h){const v=a.dataURLtoFile(j,P);j=await h(v)}e==null||e.chain().focus().setMermaid({type:"mermaid",src:j,alt:encodeURIComponent(s),width:S,height:I},!!s).run(),e==null||e.commands.setAlignImageMermaid(i)}m(!1)}};return o.jsxs(a.Dialog,{onOpenChange:m,open:d,children:[o.jsx(a.DialogTrigger,{asChild:!0,children:o.jsx(a.ActionButton,{action:()=>m(!0),icon:"Pencil",tooltip:"Edit Mermaid"})}),o.jsxs(a.DialogContent,{className:"z-[99999] !max-w-[1300px]",children:[o.jsx(a.DialogTitle,{children:"Edit Mermaid"}),o.jsx("div",{style:{height:"100%",border:"1px solid hsl(var(--border))"},children:o.jsxs("div",{className:"flex gap-[10px] rounded-[10px] p-[10px]",children:[o.jsx(a.Textarea,{autoFocus:!0,className:"flex-1",defaultValue:dt,onChange:b=>l(b.target.value),placeholder:"Text",required:!0,rows:10,value:s,style:{color:"hsl(var(--foreground))"}}),o.jsx("div",{className:"flex flex-1 items-center justify-center rounded-[10px] p-[10px]",dangerouslySetInnerHTML:{__html:u},ref:f,style:{height:"100%",border:"1px solid hsl(var(--border))",minHeight:500,background:"#fff"}})]})}),o.jsx(a.DialogFooter,{children:o.jsx(a.Button,{onClick:y,type:"button",children:"Save changes"})})]})]})},Hs={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"};function Gs({item:e,disabled:t,editor:n}){var i;const r=e.component;return r?o.jsx(g.Fragment,{children:e.type==="divider"?o.jsx(a.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"}):o.jsx(r,{...e.componentProps,disabled:t||((i=e==null?void 0:e.componentProps)==null?void 0:i.disabled),editor:n})}):o.jsx(o.Fragment,{})}function Us(e){return e.type.name==="mermaid"}function Ws(e){const{lang:t}=A.useLocale(),n=a.useAttributes(e.editor,a.Mermaid.name),r=tn(e.editor,a.Mermaid.name),i=({editor:l})=>{const{selection:u}=l.view.state,{$from:c,to:d}=u;let m=!1;return l.view.state.doc.nodesBetween(c.pos,d,f=>{if(Us(f))return m=!0,!1}),m},s=g.useMemo(()=>e.disabled?[]:oa(e.editor),[e.disabled,e.editor,t]);return o.jsx(o.Fragment,{children:o.jsx(a.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:i,tippyOptions:Hs,children:s!=null&&s.length?o.jsx("div",{className:"pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800",children:o.jsx("div",{className:"relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap",children:s==null?void 0:s.map((l,u)=>l.type==="edit"&&(n!=null&&n.src)?o.jsx(Fs,{attrs:n,editor:e.editor,extension:r},`bubbleMenu-mermaid-${u}`):o.jsx(Gs,{disabled:e.disabled,editor:e.editor,item:l},`bubbleMenu-mermaid-${u}`))})}):o.jsx(o.Fragment,{})})})}function Ks({editor:e,disabled:t}){const[n,r]=g.useState(!1),{t:i}=A.useLocale(),s=g.useCallback(({editor:c})=>c.isActive(a.Twitter.name),[]),l=c=>{e.commands.updateTweet({src:c}),r(!1)},u=g.useCallback(()=>a.deleteNode(a.Twitter.name,e),[e]);return o.jsx(o.Fragment,{children:o.jsx(a.BubbleMenu,{editor:e,shouldShow:s,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{r(!1)}},children:t?o.jsx(o.Fragment,{}):o.jsx(o.Fragment,{children:n?o.jsx(a.FormEditLinkTwitter,{editor:e,onSetLink:l}):o.jsx("div",{className:"flex items-center gap-2 rounded-lg !border border-neutral-200 bg-white p-2 shadow-sm dark:border-neutral-800 dark:bg-black",children:o.jsxs("div",{className:"flex flex-nowrap",children:[o.jsx(a.ActionButton,{icon:"Pencil",tooltip:i("editor.link.edit.tooltip"),tooltipOptions:{sideOffset:15},action:()=>{r(!0)}}),o.jsx(a.ActionButton,{action:u,icon:"Trash",tooltip:i("editor.delete"),tooltipOptions:{sideOffset:15}})]})})})})})}function Vs({editor:e,disabled:t,bubbleMenu:n}){const r=e.extensionManager.extensions.map(s=>s.name),i=()=>{var s,l,u,c,d,m,f,h,p,x,y,b,S,I,P,j,v,C;return[r.includes("columns")&&!((s=n==null?void 0:n.columnConfig)!=null&&s.hidden)?o.jsx(Ta,{editor:e},"columns"):null,r.includes("table")&&!((l=n==null?void 0:n.tableConfig)!=null&&l.hidden)?o.jsx(xa,{editor:e,items:(u=n==null?void 0:n.tableConfig)==null?void 0:u.items,actions:(c=n==null?void 0:n.tableConfig)==null?void 0:c.actions},"table"):null,r.includes("link")&&!((d=n==null?void 0:n.linkConfig)!=null&&d.hidden)?o.jsx(ya,{disabled:t,editor:e},"link"):null,r.includes(a.Image.name)&&!((m=n==null?void 0:n.imageConfig)!=null&&m.hidden)?o.jsx(Aa,{disabled:t,editor:e},"image"):null,r.includes(a.ImageGif.name)&&!((f=n==null?void 0:n.imageGifConfig)!=null&&f.hidden)?o.jsx(Ca,{disabled:t,editor:e},"imageGif"):null,r.includes("video")&&!((h=n==null?void 0:n.videoConfig)!=null&&h.hidden)?o.jsx(Sa,{disabled:t,editor:e},"video"):null,r.includes("katex")&&!((p=n==null?void 0:n.katexConfig)!=null&&p.hidden)?o.jsx(zs,{disabled:t,editor:e},"katex"):null,r.includes("mermaid")&&!((x=n==null?void 0:n.mermaidConfig)!=null&&x.hidden)?o.jsx(Ws,{disabled:t,editor:e},"mermaid"):null,r.includes("iframe")&&!((y=n==null?void 0:n.iframeConfig)!=null&&y.hidden)?o.jsx(Ls,{disabled:t,editor:e},"iframe"):null,r.includes("twitter")&&!((b=n==null?void 0:n.twitterConfig)!=null&&b.hidden)?o.jsx(Ks,{disabled:t,editor:e},"twitter"):null,(S=n==null?void 0:n.floatingMenuConfig)!=null&&S.hidden?null:o.jsx(da,{disabled:t,editor:e},"content"),(I=n==null?void 0:n.textConfig)!=null&&I.hidden?null:o.jsx(ma,{disabled:t,editor:e,items:(P=n==null?void 0:n.textConfig)==null?void 0:P.items,showShow:(j=n==null?void 0:n.textConfig)==null?void 0:j.showShow,filterItem:(v=n==null?void 0:n.textConfig)==null?void 0:v.filterItem},"text"),r.includes("drawer")&&!((C=n==null?void 0:n.drawerConfig)!=null&&C.hidden)?o.jsx(Ds,{disabled:t,editor:e},"drawer"):null]};return n!=null&&n.render?n.render({editor:e,disabled:t||!1,bubbleMenu:n},i()):i().filter(Boolean)}function qs({editor:e,disabled:t,toolbar:n}){const{t:r,lang:i}=A.useLocale(),s=g.useMemo(()=>{const d=[...e.extensionManager.extensions].sort((f,h)=>{const p=f.options.sort??-1,x=h.options.sort??-1;return p-x});let m=[];for(const f of d){const{button:h,divider:p=!1,spacer:x=!1,toolbar:y=!0}=f.options;if(!h||!a.isFunction(h)||!y)continue;const b=h({editor:e,extension:f,t:r});if(Array.isArray(b)){const S=b.map((I,P)=>({button:I,divider:P===b.length-1?p:!1,spacer:P===0?x:!1,type:f.type,name:f.name}));m=[...m,...S];continue}m.push({button:b,divider:p,spacer:x,type:f.type,name:f.name})}return m},[e,r,i]),l=c=>o.jsx("div",{className:"toolbar px-1 py-2 !border-b",style:{pointerEvents:t?"none":"auto",opacity:t?.5:1},children:o.jsx("div",{className:"relative flex flex-wrap h-auto gap-y-1 gap-x-1",children:c})}),u=s.map((c,d)=>{var f,h;const m=c.button.component;return o.jsxs("div",{className:"flex items-center",children:[(c==null?void 0:c.spacer)&&o.jsx(a.Separator,{orientation:"vertical",className:"!h-[16px] !mx-[10px]"}),o.jsx(m,{...c.button.componentProps,disabled:t||((h=(f=c==null?void 0:c.button)==null?void 0:f.componentProps)==null?void 0:h.disabled)}),(c==null?void 0:c.divider)&&o.jsx(a.Separator,{orientation:"vertical",className:"!h-auto !mx-2"})]},`toolbar-item-${d}`)});return n&&(n!=null&&n.render)?n.render({editor:e,disabled:t||!1},s,u,l):l(u)}function Xs(e){const t=["size-small","size-medium","size-large"],n=["SizeS","SizeM","SizeL"];return t.map((r,i)=>({type:`image-${r}`,component:a.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.${r.replace("-",".")}.tooltip`),icon:n[i],action:()=>e.commands.updateImage({width:A.IMAGE_SIZE[r]}),isActive:()=>e.isActive("image",{width:A.IMAGE_SIZE[r]})}}))}function Ys(e){const t=["size-small","size-medium","size-large"],n=["SizeS","SizeM","SizeL"];return t.map((r,i)=>({type:`image-${r}`,component:a.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.${r.replace("-",".")}.tooltip`),icon:n[i],action:()=>e.commands.updateImageGif({width:A.IMAGE_SIZE[r]}),isActive:()=>e.isActive("image",{width:A.IMAGE_SIZE[r]})}}))}function Zs(e){const t=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map(r=>({type:`image-${r}`,component:a.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var i,s;return(s=(i=e.commands)==null?void 0:i.setAlignImage)==null?void 0:s.call(i,r)},isActive:()=>e.isActive({align:r})||!1,disabled:!1}}))}function Js(e){const t=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map(r=>({type:`image-${r}`,component:a.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var i,s;return(s=(i=e.commands)==null?void 0:i.setAlignImageGif)==null?void 0:s.call(i,r)},isActive:()=>e.isActive({align:r})||!1,disabled:!1}}))}function Qs(e){const t=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map(r=>({type:`image-${r}`,component:a.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var i,s;return(s=(i=e.commands)==null?void 0:i.setAlignImageMermaid)==null?void 0:s.call(i,r)},isActive:()=>e.isActive({align:r})||!1,disabled:!1}}))}function ea(e){const t=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map(r=>({type:`image-${r}`,component:a.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var i,s;return(s=(i=e.commands)==null?void 0:i.setAlignImageDrawer)==null?void 0:s.call(i,r)},isActive:()=>e.isActive({align:r})||!1,disabled:!1}}))}function ta(e){const t=["size-small","size-medium","size-large"],n=["SizeS","SizeM","SizeL"];return t.map((r,i)=>({type:`video-${r}`,component:a.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.${r.replace("-",".")}.tooltip`),icon:n[i],action:()=>e.commands.updateVideo({width:A.VIDEO_SIZE[r]}),isActive:()=>e.isActive("video",{width:A.VIDEO_SIZE[r]})}}))}function na(e){return[{type:"flipX",component:a.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.tooltip.flipX"),icon:"FlipX",action:()=>{const t=e.getAttributes("image"),{flipX:n}=t;e.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipX:!n}).run()}}},{type:"flipY",component:a.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.tooltip.flipY"),icon:"FlipY",action:()=>{const t=e.getAttributes("image"),{flipY:n}=t;e.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipY:!n}).run()}}},...Xs(e),...Zs(e),{type:"remove",component:a.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;a.deleteSelection(t,n)}}}]}function ra(e){return[...Ys(e),...Js(e),{type:"remove",component:a.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;a.deleteSelection(t,n)}}}]}function oa(e){return[...Qs(e),{type:"edit",component:a.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.edit"),icon:"Pencil",action:()=>!0}},{type:"remove",component:a.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;a.deleteSelection(t,n)}}}]}function ia(e){return[...ea(e),{type:"edit",component:a.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.edit"),icon:"Pencil",action:()=>(console.log("AAA"),!0)}},{type:"remove",component:a.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;a.deleteSelection(t,n)}}}]}function sa(e){return[...ta(e),{type:"remove",component:a.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;a.deleteSelection(t,n)}}}]}function nn(e,t,n=A.BUBBLE_TEXT_LIST){return n.reduce((r,i)=>{if(i==="divider"&&r.length>0)return[...r,{type:"divider",component:void 0,componentProps:{}}];const s=e.extensionManager.extensions.find(l=>l.name===i);return s?[...r,s.configure().options.button({editor:e,t,extension:s})]:r},[])}function Pe(e,t,n){const r=[],i=e.node(0);n=typeof n=="number"&&n>=0?n:e.sameParent(t)?Math.max(0,e.sharedDepth(t.pos)-1):e.sharedDepth(t.pos);const s=new a.NodeRange(e,t,n),l=s.depth===0?0:i.resolve(s.start).posAtIndex(0);return s.parent.forEach((u,c)=>{const d=l+c,m=d+u.nodeSize;if(d<s.start||d>=s.end)return;const f=new a.SelectionRange(i.resolve(d),i.resolve(m));r.push(f)}),r}class _e{constructor(t,n){X(this,"anchor");X(this,"head");this.anchor=t,this.head=n}map(t){return new _e(t.map(this.anchor),t.map(this.head))}resolve(t){const n=t.resolve(this.anchor),r=t.resolve(this.head);return new $(n,r)}}class $ extends a.Selection{constructor(n,r,i,s=1){const{doc:l}=n,u=n===r,c=n.pos===l.content.size&&r.pos===l.content.size,d=u&&!c?l.resolve(r.pos+(s>0?1:-1)):r,m=u&&c?l.resolve(n.pos-(s>0?1:-1)):n,f=Pe(m.min(d),m.max(d),i);super(d.pos>=n.pos?f[0].$from:f[f.length-1].$to,d.pos>=n.pos?f[f.length-1].$to:f[0].$from,f);X(this,"depth");this.depth=i}get $to(){return this.ranges[this.ranges.length-1].$to}eq(n){return n instanceof $&&n.$from.pos===this.$from.pos&&n.$to.pos===this.$to.pos}map(n,r){const i=n.resolve(r.map(this.anchor)),s=n.resolve(r.map(this.head));return new $(i,s)}toJSON(){return{type:"nodeRange",anchor:this.anchor,head:this.head}}get isForwards(){return this.head>=this.anchor}get isBackwards(){return!this.isForwards}extendBackwards(){const{doc:n}=this.$from;if(this.isForwards&&this.ranges.length>1){const s=this.ranges.slice(0,-1),l=s[0].$from,u=s[s.length-1].$to;return new $(l,u,this.depth)}const r=this.ranges[0],i=n.resolve(Math.max(0,r.$from.pos-1));return new $(this.$anchor,i,this.depth)}extendForwards(){const{doc:n}=this.$from;if(this.isBackwards&&this.ranges.length>1){const s=this.ranges.slice(1),l=s[0].$from,u=s[s.length-1].$to;return new $(u,l,this.depth)}const r=this.ranges[this.ranges.length-1],i=n.resolve(Math.min(n.content.size,r.$to.pos+1));return new $(this.$anchor,i,this.depth)}static fromJSON(n,r){return new $(n.resolve(r.anchor),n.resolve(r.head))}static create(n,r,i,s,l=1){return new this(n.resolve(r),n.resolve(i),s,l)}getBookmark(){return new _e(this.anchor,this.head)}}function aa(e){const t=e.cloneNode(!0),n=[e,...Array.from(e.getElementsByTagName("*"))],r=[t,...Array.from(t.getElementsByTagName("*"))];return n.forEach((i,s)=>{r[s].style.cssText=function(l){let u="";const c=getComputedStyle(l);for(let d=0;d<c.length;d+=1)u+=`${c[d]}:${c.getPropertyValue(c[d])};`;return u}(i)}),t}function Z(e,t){return window.getComputedStyle(e)[t]}function la(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function ft(e){e.parentNode!==null&&e.parentNode!==void 0&&e.parentNode.removeChild(e)}function rn(e){const{x:t,y:n,direction:r,editor:i}=e;let s=null,l=null,u=null,c=t;for(;l===null&&c<window.innerWidth&&c>0;){const d=document.elementsFromPoint(c,n),m=d.findIndex(h=>h.classList.contains("ProseMirror")),f=d.slice(0,m);if(f.length>0){const h=f[0];if(s=h,u=i.view.posAtDOM(h,0),u>=0){l=i.state.doc.nodeAt(Math.max(u-1,0)),(l===null||l.isText)&&(l=i.state.doc.nodeAt(Math.max(u-1,0))),l||(l=i.state.doc.nodeAt(Math.max(u,0)));break}}r==="left"?c-=1:c+=1}return{resultElement:s,resultNode:l,pos:u!==null?u:null}}function ca(e,t){const{doc:n}=t.view.state,r=rn({editor:t,x:e.clientX,y:e.clientY,direction:"right"});if(!r.resultNode||r.pos===null)return[];const i=e.clientX,s=function(m,f,h){const p=Number.parseInt(Z(m.dom,"paddingLeft"),10),x=Number.parseInt(Z(m.dom,"paddingRight"),10),y=Number.parseInt(Z(m.dom,"borderLeftWidth"),10),b=Number.parseInt(Z(m.dom,"borderLeftWidth"),10),S=m.dom.getBoundingClientRect();return{left:la(f,S.left+p+y,S.right-x-b),top:h}}(t.view,i,e.clientY),l=t.view.posAtCoords(s);if(!l)return[];const{pos:u}=l;if(!n.resolve(u).parent)return[];const c=n.resolve(r.pos),d=n.resolve(r.pos+1);return Pe(c,d,0)}function mt(e,t){const n=e.resolve(t),{depth:r}=n;return r===0?t:n.pos-n.parentOffset-1}function ht(e,t){const n=e.nodeAt(t),r=e.resolve(t);let{depth:i}=r,s=n;for(;i>0;){const l=r.node(i);i-=1,i===0&&(s=l)}return s}function gt(e,t){let n=t;for(;n&&n.parentNode&&n.parentNode!==e.dom;)n=n.parentNode;return n}const on=new a.PluginKey("dragHandle");function ua({pluginKey:e=on,element:t,editor:n,tippyOptions:r,onNodeChange:i}){const s=document.createElement("div");let l=null,u=!1,c=null,d=-1;return t.addEventListener("dragstart",m=>{const{view:f}=n;if(!m.dataTransfer)return;const{empty:h,$from:p,$to:x}=f.state.selection,y=ca(m,n),b=Pe(p,x,0),S=b.some(O=>y.find(N=>N.$from===O.$from&&N.$to===O.$to)),I=h||!S?y:b;if(I.length===0)return;const{tr:P}=f.state,j=document.createElement("div"),v=I[0].$from.pos,C=I[I.length-1].$to.pos,w=$.create(f.state.doc,v,C),E=w.content();I.forEach(O=>{const N=aa(f.nodeDOM(O.$from.pos));j.append(N)}),j.style.position="absolute",j.style.top="-10000px",document.body.append(j),m.dataTransfer.clearData(),m.dataTransfer.setDragImage(j,0,0),f.dragging={slice:E,move:!0},P.setSelection(w),f.dispatch(P),document.addEventListener("drop",()=>ft(j),{once:!0}),setTimeout(()=>{t&&(t.style.pointerEvents="none")},0)}),t.addEventListener("dragend",()=>{t&&(t.style.pointerEvents="auto")}),new a.Plugin({key:typeof e=="string"?new a.PluginKey(e):e,state:{init:()=>({locked:!1}),apply(m,f){const h=m.getMeta("lockDragHandle"),p=m.getMeta("hideDragHandle");if(h!==void 0&&(u=h),p&&l)return l.hide(),u=!1,c=null,d=-1,i==null||i({editor:n,node:null,pos:-1}),f;if(m.docChanged&&d!==-1&&t&&l){const x=m.mapping.map(d);x!==d&&(d=x)}return f}},view:m=>{return f(),h(n.view.dom),l=vt(m.dom,{...p(),...r}),{update(j,v){if(!x(t,l)||(t.draggable=!u,!y(j,v)))return;const C=b(j);C&&S(j,C)},destroy(){P()}};function f(){t.draggable=!0,t.style.pointerEvents="auto"}function h(j){var v;(v=j.parentElement)==null||v.appendChild(s),s.appendChild(t),Object.assign(s.style,{pointerEvents:"none",position:"absolute",top:"0",left:"0"})}function p(){return{getReferenceClientRect:null,interactive:!0,trigger:"manual",placement:"left-start",hideOnClick:!1,duration:100,zIndex:10,appendTo:s,content:t,popperOptions:{modifiers:[{name:"flip",enabled:!1},{name:"preventOverflow",options:{rootBoundary:"document",mainAxis:!1}}]}}}function x(j,v){return j&&v}function y(j,v){return!j.state.doc.eq(v.doc)&&d!==-1}function b(j){let v=j.nodeDOM(d);return v=gt(j,v),v===j.dom||(v==null?void 0:v.nodeType)!==1?null:v}function S(j,v){const C=j.posAtDOM(v,0),w=ht(n.state.doc,C);if(w===c)return;const E=mt(n.state.doc,C);c=w,d=E,i==null||i({editor:n,node:c,pos:d}),I(v)}function I(j){l.setProps({getReferenceClientRect:()=>j.getBoundingClientRect()}),l.show()}function P(){l==null||l.destroy(),t&&ft(s)}},props:{handleDOMEvents:{mouseleave:(m,f)=>{if(u||!h(f))return!1;return p(),x(),!1;function h(y){return y.target&&!s.contains(y.relatedTarget)}function p(){l==null||l.hide()}function x(){c=null,d=-1,i==null||i({editor:n,node:null,pos:-1})}},mousemove:a.debounce((m,f)=>{if(!t||!l||u)return!1;const h=rn({x:f.clientX,y:f.clientY,direction:"right",editor:n});if(!h.resultElement||h.resultElement===m.dom)return!1;const p=gt(m,h.resultElement);if(p===m.dom||(p==null?void 0:p.nodeType)!==1)return!1;const x=m.posAtDOM(p,0),y=ht(n.state.doc,x);if(y===c)return!1;const b=mt(n.state.doc,x);return c=y,d=b,i==null||i({editor:n,node:c,pos:d}),l.setProps({getReferenceClientRect:()=>p.getBoundingClientRect()}),l.show(),!1},100)}}})}function da(e){var E,O,N;const{pluginKey:t=on}=e,{t:n}=A.useLocale(),[r,i]=g.useState(null),[s,l]=g.useState(-1),u=g.useRef(null),c=g.useRef(null),[d,m]=g.useState(!1),f=e.editor.extensionManager.extensions.some(T=>T.name==="textAlign"),h=e.editor.extensionManager.extensions.some(T=>T.name==="indent"),p=e.editor.extensionManager.extensions.some(T=>T.name==="clear");g.useEffect(()=>{u.current&&!e.editor.isDestroyed&&(c.current=ua({editor:e.editor,element:u.current,pluginKey:"ContentItemMenu",tippyOptions:{offset:[-2,16],zIndex:99,moveTransition:"transform 0.15s ease-out"},onNodeChange:v}),e.editor.registerPlugin(c.current))},[e.editor,u]);function x(){const T=e.editor.chain();T.setNodeSelection(s).unsetAllMarks(),(r==null?void 0:r.type.name)!=="paragraph"&&T.setParagraph(),T.run()}function y(){e.editor.chain().focus().setNodeSelection(s).run(),document.execCommand("copy")}function b(){e.editor.commands.setNodeSelection(s);const{$anchor:T}=e.editor.state.selection,oe=T.node(1)||e.editor.state.selection.node;e.editor.chain().setMeta("hideDragHandle",!0).insertContentAt(s+((r==null?void 0:r.nodeSize)||0),oe.toJSON()).run()}function S(T){e.editor.commands.setTextAlign(T)}function I(){const T=a.setNodeIndentMarkup(e.editor.state.tr,s,1);T.setMeta("hideDragHandle",!0),e.editor.view.dispatch&&e.editor.view.dispatch(T)}function P(){const T=a.setNodeIndentMarkup(e.editor.state.tr,s,-1);e.editor.view.dispatch&&e.editor.view.dispatch(T)}function j(){e.editor.chain().setMeta("hideDragHandle",!0).setNodeSelection(s).deleteSelection().run()}function v(T){T.node&&i(T.node),l(T.pos)}function C(){var T;if(s!==-1){const oe=(r==null?void 0:r.nodeSize)||0,Be=s+oe,De=(r==null?void 0:r.type.name)==="paragraph"&&((T=r==null?void 0:r.content)==null?void 0:T.size)===0,dn=De?s+2:Be+2;e.editor.chain().command(({dispatch:Me,tr:ie,state:ke})=>Me?(De?ie.insertText("/",s,s+1):ie.insert(Be,ke.schema.nodes.paragraph.create(null,[ke.schema.text("/")])),Me(ie)):!0).focus(dn).run()}}g.useEffect(()=>(d?e.editor.commands.setMeta("lockDragHandle",!0):e.editor.commands.setMeta("lockDragHandle",!1),()=>{e.editor.commands.setMeta("lockDragHandle",!1)}),[d]),g.useEffect(()=>()=>{c.current&&(e.editor.unregisterPlugin(t),c.current=null)},[]),g.useEffect(()=>{var T;(T=e.editor)!=null&&T.isDestroyed&&c.current&&(e.editor.unregisterPlugin(t),c.current=null)},[(E=e.editor)==null?void 0:E.isDestroyed]);const w=T=>{e!=null&&e.disabled||m(T)};return o.jsx("div",{ref:u,className:`drag-handle duration-200 ease-in-out [transition-property:top,_left] ${e==null?void 0:e.className}`,style:{opacity:e!=null&&e.disabled?0:1},children:o.jsxs("div",{className:"flex items-center gap-0.5 duration-200 ease-in-out [transition-property:top,_left]",children:[o.jsx(a.Button,{className:"!size-7 cursor-grab",disabled:e==null?void 0:e.disabled,onClick:C,size:"icon",type:"button",variant:"ghost",children:o.jsx(a.IconComponent,{className:"text-lg text-neutral-600 dark:text-neutral-200",name:"Plus"})}),o.jsxs(a.DropdownMenu,{onOpenChange:w,open:d,children:[o.jsxs("div",{className:"relative flex flex-col",children:[o.jsxs(a.Tooltip,{children:[o.jsx(a.TooltipTrigger,{asChild:!0,disabled:e==null?void 0:e.disabled,children:o.jsx(a.Button,{className:"relative z-[1] !size-7 cursor-grab",disabled:e==null?void 0:e.disabled,size:"icon",type:"button",variant:"ghost",onMouseUp:T=>{T.preventDefault(),!(e!=null&&e.disabled)&&m(!0)},children:o.jsx(a.IconComponent,{className:"text-sm text-neutral-600 dark:text-neutral-200",name:"Grip"})})}),o.jsx(a.TooltipContent,{children:n("editor.draghandle.tooltip")})]}),o.jsx(a.DropdownMenuTrigger,{className:"absolute left-0 top-0 z-0 size-[28px]"})]}),o.jsxs(a.DropdownMenuContent,{align:"start",className:"w-48",side:"bottom",sideOffset:0,children:[o.jsxs(a.DropdownMenuItem,{className:"flex gap-3 bg-opacity-10 hover:bg-red-400 hover:bg-opacity-20 focus:bg-red-400 focus:bg-opacity-30 focus:text-red-500 dark:hover:bg-opacity-20 dark:hover:text-red-500",onClick:j,children:[o.jsx(a.IconComponent,{name:"Trash2"}),o.jsx("span",{children:n("editor.remove")})]}),p?o.jsxs(a.DropdownMenuItem,{className:"flex gap-3",onClick:x,children:[o.jsx(a.IconComponent,{name:"PaintRoller"}),o.jsx("span",{children:n("editor.clear.tooltip")})]}):null,o.jsxs(a.DropdownMenuItem,{className:"flex gap-3",onClick:y,children:[o.jsx(a.IconComponent,{name:"Clipboard"}),o.jsx("span",{children:n("editor.copyToClipboard")})]}),o.jsxs(a.DropdownMenuItem,{className:"flex gap-3",onClick:b,children:[o.jsx(a.IconComponent,{name:"Copy"}),o.jsx("span",{children:n("editor.copy")})]}),f||h?o.jsx(a.DropdownMenuSeparator,{}):null,f?o.jsxs(a.DropdownMenuSub,{children:[o.jsxs(a.DropdownMenuSubTrigger,{className:"flex gap-3",children:[o.jsx(a.IconComponent,{name:"AlignCenter"}),o.jsx("span",{children:n("editor.textalign.tooltip")})]}),o.jsx(a.DropdownMenuPortal,{children:o.jsxs(a.DropdownMenuSubContent,{children:[o.jsxs(a.DropdownMenuItem,{className:"flex gap-3",onClick:()=>S("left"),children:[o.jsx(a.IconComponent,{name:"AlignLeft"}),o.jsx("span",{children:n("editor.textalign.left.tooltip")})]}),o.jsxs(a.DropdownMenuItem,{className:"flex gap-3",onClick:()=>S("center"),children:[o.jsx(a.IconComponent,{name:"AlignCenter"}),o.jsx("span",{children:n("editor.textalign.center.tooltip")})]}),o.jsxs(a.DropdownMenuItem,{className:"flex gap-3",onClick:()=>S("right"),children:[o.jsx(a.IconComponent,{name:"AlignRight"}),o.jsx("span",{children:n("editor.textalign.right.tooltip")})]})]})})]}):null,h?o.jsxs(a.DropdownMenuSub,{children:[o.jsxs(a.DropdownMenuSubTrigger,{className:"flex gap-3",children:[o.jsx(a.IconComponent,{name:"IndentIncrease"}),o.jsx("span",{children:n("editor.indent")})]}),o.jsx(a.DropdownMenuPortal,{children:o.jsxs(a.DropdownMenuSubContent,{children:[o.jsxs(a.DropdownMenuItem,{className:"flex gap-3",disabled:((O=r==null?void 0:r.attrs)==null?void 0:O.indent)>=a.IndentProps.max,onClick:I,children:[o.jsx(a.IconComponent,{name:"IndentIncrease"}),o.jsx("span",{children:n("editor.indent.tooltip")})]}),o.jsxs(a.DropdownMenuItem,{className:"flex gap-3",disabled:((N=r==null?void 0:r.attrs)==null?void 0:N.indent)<=a.IndentProps.min,onClick:P,children:[o.jsx(a.IconComponent,{name:"IndentDecrease"}),o.jsx("span",{children:n("editor.outdent.tooltip")})]})]})})]}):null]})]})]})})}const fa={maxWidth:"auto",zIndex:20,moveTransition:"transform 0.1s ease-out"};function sn({item:e,disabled:t,editor:n}){var i;const r=e.component;return r?o.jsx(r,{...e.componentProps,disabled:t||((i=e==null?void 0:e.componentProps)==null?void 0:i.disabled),editor:n}):o.jsx(o.Fragment,{})}function ma(e){const{t,lang:n}=A.useLocale(),r=({editor:s})=>{const{selection:l}=s.view.state,{$from:u,to:c}=l;return u.pos===c?!1:l instanceof a.TextSelection},i=g.useMemo(()=>e.disabled||!(e!=null&&e.editor)?[]:nn(e.editor,t,e.items).filter(s=>e.filterItem?e.filterItem(s,e.editor):!0),[e.disabled,e.editor,e.items,e.filterItem,n,t]);return o.jsx(a.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:e.showShow??r,tippyOptions:fa,children:i!=null&&i.length?o.jsx("div",{className:"pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800",children:o.jsx("div",{className:"relative flex h-[26px] flex-nowrap items-center justify-start gap-[4px] whitespace-nowrap",children:i==null?void 0:i.map((s,l)=>(s==null?void 0:s.type)==="divider"?o.jsx(a.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"},`bubbleMenu-divider-${l}`):o.jsx(sn,{disabled:e.disabled,editor:e.editor,item:s},`bubbleMenu-text-${l}`))})}):o.jsx(o.Fragment,{})})}function Oe({children:e,vertical:t}){return o.jsx("div",{className:"pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800",children:o.jsx("div",{className:`relative flex h-[26px] flex-nowrap items-center justify-start gap-[4px] whitespace-nowrap ${t?"h-max flex-col":""}`,children:e})})}function ha({editor:e,disabled:t}){var u,c,d,m,f,h;const{t:n}=A.useLocale(),r=g.useCallback(({view:p,state:x,from:y})=>!x||!y?!1:a.isRowGripSelected({editor:e,view:p,state:x,from:y}),[e]);function i(){e.chain().focus().addRowBefore().run()}function s(){e.chain().focus().addRowAfter().run()}function l(){e.chain().focus().deleteRow().run()}return t?null:o.jsx(a.BubbleMenu,{editor:e,pluginKey:"tableRowMenu",shouldShow:r,updateDelay:0,tippyOptions:{placement:"left",offset:[0,15],popperOptions:{modifiers:[{name:"flip",enabled:!1}]}},children:o.jsxs(Oe,{vertical:!0,children:[o.jsx(a.ActionButton,{action:i,disabled:!((c=e==null?void 0:(u=e.can()).addRowBefore)!=null&&c.call(u)),icon:"BetweenVerticalEnd",tooltip:n("editor.table.menu.insertRowAbove"),"tooltip-options":{sideOffset:15}}),o.jsx(a.ActionButton,{action:s,disabled:!((m=(d=e==null?void 0:e.can())==null?void 0:d.addRowAfter)!=null&&m.call(d)),icon:"BetweenVerticalStart",tooltip:n("editor.table.menu.insertRowBelow"),"tooltip-options":{sideOffset:15}}),o.jsx(a.ActionButton,{action:l,disabled:!((h=(f=e==null?void 0:e.can())==null?void 0:f.deleteRow)!=null&&h.call(f)),icon:"DeleteRow",tooltip:n("editor.table.menu.deleteRow"),"tooltip-options":{sideOffset:15}})]})})}function ga({editor:e,disabled:t}){var u,c,d,m,f,h;const{t:n}=A.useLocale(),r=g.useCallback(({view:p,state:x,from:y})=>x?a.isColumnGripSelected({editor:e,view:p,state:x,from:y||0}):!1,[e]);function i(){e.chain().focus().addColumnBefore().run()}function s(){e.chain().focus().addColumnAfter().run()}function l(){e.chain().focus().deleteColumn().run()}return t?null:o.jsx(a.BubbleMenu,{editor:e,pluginKey:"tableColumnMenu",shouldShow:r,updateDelay:0,tippyOptions:{offset:[0,15],popperOptions:{modifiers:[{name:"flip",enabled:!1}]}},children:o.jsxs(Oe,{children:[o.jsx(a.ActionButton,{action:i,disabled:!((c=(u=e==null?void 0:e.can())==null?void 0:u.addColumnBefore)!=null&&c.call(u)),icon:"BetweenHorizonalEnd",tooltip:n("editor.table.menu.insertColumnBefore"),"tooltip-options":{sideOffset:15}}),o.jsx(a.ActionButton,{action:s,disabled:!((m=(d=e==null?void 0:e.can())==null?void 0:d.addColumnAfter)!=null&&m.call(d)),icon:"BetweenHorizonalStart",tooltip:n("editor.table.menu.insertColumnAfter"),"tooltip-options":{sideOffset:15}}),o.jsx(a.ActionButton,{action:l,disabled:!((h=e==null?void 0:(f=e.can()).deleteColumn)!=null&&h.call(f)),icon:"DeleteColumn",tooltip:n("editor.table.menu.deleteColumn"),"tooltip-options":{sideOffset:15}})]})})}function pa({editor:e,disabled:t,actions:n,...r}){var y,b,S,I,P,j;const i=({editor:v,view:C,state:w,from:E})=>{const{selection:O}=v.view.state,{$from:N,to:T}=O;return N.pos===T||!w||!E?!1:O instanceof a.TextSelection||a.isRowGripSelected({editor:v,view:C,state:w,from:E})||a.isColumnGripSelected({editor:v,view:C,state:w,from:E})},s=({editor:v})=>a.isActive(v.view.state,"table"),l=v=>s(v)&&!i(v),{t:u,lang:c}=A.useLocale();function d(){e.chain().focus().mergeCells().run()}function m(){e==null||e.chain().focus().splitCell().run()}function f(){e.chain().focus().deleteTable().run()}function h(v){e.chain().focus().setTableCellBackground(v).run()}const p=()=>{var N;const{view:v,state:{selection:{from:C}}}=e,w=v.domAtPos(C).node;if(!w)return new DOMRect(-1e3,-1e3,0,0);const E=(N=w==null?void 0:w.closest)==null?void 0:N.call(w,".tableWrapper");return E?E.getBoundingClientRect():new DOMRect(-1e3,-1e3,0,0)},x=g.useMemo(()=>t||!e?[]:nn(e,u,r.items||[]),[t,e,r.items,c,u]);return t?null:o.jsx(a.BubbleMenu,{editor:e,pluginKey:"table",shouldShow:l,updateDelay:0,tippyOptions:{offset:[0,15],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},maxWidth:"auto",getReferenceClientRect:p,plugins:[vt.sticky],sticky:"popper"},children:o.jsxs(Oe,{children:[n&&o.jsxs(o.Fragment,{children:[n.map((v,C)=>o.jsx(a.ActionButton,{...v},C)),o.jsx(a.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"})]}),r.items&&o.jsxs(o.Fragment,{children:[x.map((v,C)=>o.jsx(sn,{disabled:t,editor:e,item:v},C)),o.jsx(a.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"})]}),o.jsx(a.ActionButton,{action:d,disabled:!((b=(y=e==null?void 0:e.can())==null?void 0:y.mergeCells)!=null&&b.call(y)),icon:"TableCellsMerge",tooltip:u("editor.table.menu.mergeCells"),"tooltip-options":{sideOffset:15}}),o.jsx(a.ActionButton,{action:m,disabled:!((I=(S=e==null?void 0:e.can())==null?void 0:S.splitCell)!=null&&I.call(S)),icon:"TableCellsSplit",tooltip:u("editor.table.menu.splitCells"),"tooltip-options":{sideOffset:15}}),o.jsx(a.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"}),o.jsx(a.HighlightActionButton,{action:h,editor:e,tooltip:u("editor.table.menu.setCellsBgColor"),tooltipOptions:{sideOffset:15}}),o.jsx(a.ActionButton,{action:f,disabled:!((j=(P=e==null?void 0:e.can())==null?void 0:P.deleteTable)!=null&&j.call(P)),icon:"Trash2",tooltip:u("editor.table.menu.deleteTable"),"tooltip-options":{sideOffset:15}})]})})}function xa(e){return o.jsxs(o.Fragment,{children:[o.jsx(pa,{...e}),o.jsx(ha,{...e}),o.jsx(ga,{...e})]})}function va(e){const{t}=A.useLocale();return o.jsxs("div",{className:"flex items-center gap-2 p-2 bg-white !border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800",children:[o.jsx("a",{href:e==null?void 0:e.link,target:"_blank",rel:"noopener noreferrer",className:"text-sm underline break-all",children:Is(e==null?void 0:e.link,{length:50,omission:"…"})}),(e==null?void 0:e.link)&&o.jsx(a.Separator,{orientation:"vertical",className:"!h-4"}),o.jsxs("div",{className:"flex flex-nowrap",children:[o.jsx(a.ActionButton,{icon:"Pencil",tooltip:t("editor.link.edit.tooltip"),action:()=>{e==null||e.onEdit()},tooltipOptions:{sideOffset:15}}),o.jsx(a.ActionButton,{icon:"Unlink",tooltip:t("editor.link.unlink.tooltip"),action:()=>{e==null||e.onClear()},tooltipOptions:{sideOffset:15}})]})]})}function ya({editor:e,disabled:t}){const[n,r]=g.useState(!1),i=g.useMemo(()=>{const{href:c}=e.getAttributes("link");return c},[e]),s=g.useCallback(({editor:c})=>c.isActive("link"),[]),l=(c,d,m)=>{e.chain().extendMarkRange("link").insertContent({type:"text",text:d,marks:[{type:"link",attrs:{href:c,target:m?"_blank":""}}]}).setLink({href:c}).focus().run(),r(!1)},u=g.useCallback(()=>{e.chain().extendMarkRange("link").unsetLink().focus().run(),r(!1)},[e]);return o.jsx(o.Fragment,{children:o.jsx(a.BubbleMenu,{editor:e,shouldShow:s,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{r(!1)}},children:t?o.jsx(o.Fragment,{}):o.jsx(o.Fragment,{children:n?o.jsx(a.LinkEditBlock,{onSetLink:l,editor:e}):o.jsx(va,{editor:e,onClear:u,onEdit:()=>{r(!0)},link:i})})})})}const Ne={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"};function Re({item:e,disabled:t,editor:n}){var i;const r=e.component;return r?o.jsx(g.Fragment,{children:e.type==="divider"?o.jsx(a.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"}):o.jsx(r,{...e.componentProps,disabled:t||((i=e==null?void 0:e.componentProps)==null?void 0:i.disabled),editor:n})}):o.jsx(o.Fragment,{})}function wa(e){return e.type.name===a.Image.name}function ba(e){return e.type.name===a.ImageGif.name}function ja(e){return e.type.name===a.Video.name}function Aa(e){const{lang:t}=A.useLocale(),n=({editor:i})=>{const{selection:s}=i.view.state,{$from:l,to:u}=s;let c=!1;return i.view.state.doc.nodesBetween(l.pos,u,d=>{if(wa(d))return c=!0,!1}),c},r=g.useMemo(()=>e.disabled?[]:na(e.editor),[e.disabled,e.editor,t]);return o.jsx(o.Fragment,{children:o.jsx(a.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:n,tippyOptions:Ne,children:r!=null&&r.length?o.jsx("div",{className:"pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800",children:o.jsx("div",{className:"relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap",children:r==null?void 0:r.map((i,s)=>o.jsx(Re,{disabled:e.disabled,editor:e.editor,item:i},`bubbleMenu-image-${s}`))})}):o.jsx(o.Fragment,{})})})}function Ca(e){const{lang:t}=A.useLocale(),n=({editor:i})=>{const{selection:s}=i.view.state,{$from:l,to:u}=s;let c=!1;return i.view.state.doc.nodesBetween(l.pos,u,d=>{if(ba(d))return c=!0,!1}),c},r=g.useMemo(()=>e.disabled?[]:ra(e.editor),[e.disabled,e.editor,t]);return o.jsx(o.Fragment,{children:o.jsx(a.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:n,tippyOptions:Ne,children:r!=null&&r.length?o.jsx("div",{className:"pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800",children:o.jsx("div",{className:"relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap",children:r==null?void 0:r.map((i,s)=>o.jsx(Re,{disabled:e.disabled,editor:e.editor,item:i},`bubbleMenu-image-gif-${s}`))})}):o.jsx(o.Fragment,{})})})}function Sa(e){const{lang:t}=A.useLocale(),n=({editor:i})=>{const{selection:s}=i.view.state,{$from:l,to:u}=s;let c=!1;return i.view.state.doc.nodesBetween(l.pos,u,d=>{if(ja(d))return c=!0,!1}),c},r=g.useMemo(()=>e.disabled?[]:sa(e.editor),[e.editor,e.disabled,t]);return o.jsx(o.Fragment,{children:o.jsx(a.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:n,tippyOptions:Ne,children:r!=null&&r.length?o.jsx("div",{className:"pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800",children:o.jsx("div",{className:"relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap",children:r==null?void 0:r.map((i,s)=>o.jsx(Re,{disabled:e.disabled,editor:e.editor,item:i},`bubbleMenu-video-${s}`))})}):o.jsx(o.Fragment,{})})})}function Ta({editor:e}){const{t}=A.useLocale(),n=g.useCallback(()=>e.isActive(a.MultiColumn.name),[e]),r=g.useCallback(()=>a.deleteNode(a.MultiColumn.name,e),[e]),i=g.useCallback(()=>e.chain().focus().addColBefore().run(),[e]),s=g.useCallback(()=>e.chain().focus().addColAfter().run(),[e]),l=g.useCallback(()=>e.chain().focus().deleteCol().run(),[e]);return o.jsx(a.BubbleMenu,{pluginKey:"columns-bubble-menu",editor:e,shouldShow:n,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999},children:o.jsxs("div",{className:"w-auto px-3 py-2 transition-all !border rounded-sm shadow-sm pointer-events-auto select-none border-neutral-200 dark:border-neutral-800 bg-background",children:[o.jsx(a.ActionButton,{action:i,icon:"ColumnAddLeft",tooltip:t("editor.table.menu.insertColumnBefore")}),o.jsx(a.ActionButton,{action:s,icon:"ColumnAddRight",tooltip:t("editor.table.menu.insertColumnAfter")}),o.jsx(a.ActionButton,{action:l,icon:"DeleteColumn",tooltip:t("editor.table.menu.deleteColumn")}),o.jsx(a.ActionButton,{action:r,icon:"Trash2",tooltip:t("editor.table.menu.delete_column")})]})})}function Ea({editor:e,extensions:t}){const{t:n}=A.useLocale(),r=g.useMemo(()=>{var i,s,l;return(l=(s=(i=t==null?void 0:t.find(u=>u.name==="base-kit"))==null?void 0:i.options)==null?void 0:s.characterCount)==null?void 0:l.limit},[t]);return r?o.jsx("div",{className:"flex items-center justify-between p-3 border-t",children:o.jsx("div",{className:"flex flex-col",children:o.jsx("div",{className:"flex justify-end gap-3 text-sm",children:o.jsxs("span",{children:[e.storage.characterCount.characters(),"/",r," ",n("editor.characters")]})})})}):o.jsx("div",{className:"flex items-center justify-between p-3 border-t",children:o.jsx("div",{className:"flex flex-col",children:o.jsx("div",{className:"flex justify-end gap-3 text-sm",children:o.jsxs("span",{children:[e.storage.characterCount.characters()," ",n("editor.characters")]})})})})}function Ia(){const{toasts:e}=a.useToast();return o.jsxs(Ps,{children:[e.map(({id:t,title:n,description:r,action:i,...s})=>o.jsxs(Zt,{...s,children:[o.jsxs("div",{className:"grid gap-1",children:[n&&o.jsx(Qt,{children:n}),r&&o.jsx(en,{children:r})]}),i,o.jsx(Jt,{})]},t)),o.jsx(Yt,{})]})}const Pa=`
|
|
1
|
+
"use strict";var fn=Object.defineProperty;var mn=(e,t,n)=>t in e?fn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var X=(e,t,n)=>mn(e,typeof t!="symbol"?t+"":t,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=require("react"),o=require("react/jsx-runtime"),a=require("./ColorPicker-DGbrNkQ-.cjs"),A=require("./locale-bundle-PAhriAQT.cjs"),hn=require("@radix-ui/react-toast"),J=require("lucide-react"),Le=require("easydrawer"),gn=require("katex"),ze=require("mermaid"),vt=require("tippy.js");function yt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const G=yt(g),R=yt(hn);function pn(){var s;const e=g.useRef({editor:null}),[t,n]=g.useState(!1),[r,i]=g.useState(null);return g.useEffect(()=>{var l;(l=e.current)!=null&&l.editor&&(n(!0),i(e.current.editor))},[e,(s=e.current)==null?void 0:s.editor]),{isReady:t,editor:r,editorRef:e}}function wt(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var B=Array.isArray,Fe=a.Symbol?a.Symbol.prototype:void 0,He=Fe?Fe.toString:void 0;function Q(e){if(typeof e=="string")return e;if(B(e))return wt(e,Q)+"";if(a.isSymbol(e))return He?He.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var xn=1/0,vn=17976931348623157e292;function yn(e){if(!e)return e===0?e:0;if(e=a.toNumber(e),e===xn||e===-1/0){var t=e<0?-1:1;return t*vn}return e===e?e:0}function wn(e){var t=yn(e),n=t%1;return t===t?n?t-n:t:0}function be(e){return e}var bn="[object AsyncFunction]",jn="[object Function]",An="[object GeneratorFunction]",Cn="[object Proxy]";function bt(e){if(!a.isObject(e))return!1;var t=a.baseGetTag(e);return t==jn||t==An||t==bn||t==Cn}var se=a.root["__core-js_shared__"],Ge=function(){var e=/[^.]+$/.exec(se&&se.keys&&se.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Sn(e){return!!Ge&&Ge in e}var Tn=Function.prototype,En=Tn.toString;function F(e){if(e!=null){try{return En.call(e)}catch{}try{return e+""}catch{}}return""}var In=/[\\^$.*+?()[\]{}|]/g,Pn=/^\[object .+?Constructor\]$/,_n=Function.prototype,Nn=Object.prototype,On=_n.toString,Rn=Nn.hasOwnProperty,$n=RegExp("^"+On.call(Rn).replace(In,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Bn(e){if(!a.isObject(e)||Sn(e))return!1;var t=bt(e)?$n:Pn;return t.test(F(e))}function Dn(e,t){return e==null?void 0:e[t]}function H(e,t){var n=Dn(e,t);return Bn(n)?n:void 0}var ue=H(a.root,"WeakMap");function Mn(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var kn=800,Ln=16,zn=Date.now;function Fn(e){var t=0,n=0;return function(){var r=zn(),i=Ln-(r-n);if(n=r,i>0){if(++t>=kn)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Hn(e){return function(){return e}}var Ue=function(){try{var e=H(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Gn=Ue?function(e,t){return Ue(e,"toString",{configurable:!0,enumerable:!1,value:Hn(t),writable:!0})}:be,Un=Fn(Gn);function Wn(e,t,n,r){for(var i=e.length,s=n+-1;++s<i;)if(t(e[s],s,e))return s;return-1}function Kn(e){return e!==e}function Vn(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function qn(e,t,n){return t===t?Vn(e,t,n):Wn(e,Kn,n)}function Xn(e,t){var n=e==null?0:e.length;return!!n&&qn(e,t,0)>-1}var Yn=9007199254740991,Zn=/^(?:0|[1-9]\d*)$/;function jt(e,t){var n=typeof e;return t=t??Yn,!!t&&(n=="number"||n!="symbol"&&Zn.test(e))&&e>-1&&e%1==0&&e<t}function At(e,t){return e===t||e!==e&&t!==t}var We=Math.max;function Jn(e,t,n){return t=We(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,s=We(r.length-t,0),l=Array(s);++i<s;)l[i]=r[t+i];i=-1;for(var u=Array(t+1);++i<t;)u[i]=r[i];return u[t]=n(l),Mn(e,this,u)}}function Qn(e,t){return Un(Jn(e,t,be),e+"")}var er=9007199254740991;function je(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=er}function Ct(e){return e!=null&&je(e.length)&&!bt(e)}var tr=Object.prototype;function nr(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||tr;return e===n}function rr(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var or="[object Arguments]";function Ke(e){return a.isObjectLike(e)&&a.baseGetTag(e)==or}var St=Object.prototype,ir=St.hasOwnProperty,sr=St.propertyIsEnumerable,Ae=Ke(function(){return arguments}())?Ke:function(e){return a.isObjectLike(e)&&ir.call(e,"callee")&&!sr.call(e,"callee")};function ar(){return!1}var Tt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ve=Tt&&typeof module=="object"&&module&&!module.nodeType&&module,lr=Ve&&Ve.exports===Tt,qe=lr?a.root.Buffer:void 0,cr=qe?qe.isBuffer:void 0,de=cr||ar,ur="[object Arguments]",dr="[object Array]",fr="[object Boolean]",mr="[object Date]",hr="[object Error]",gr="[object Function]",pr="[object Map]",xr="[object Number]",vr="[object Object]",yr="[object RegExp]",wr="[object Set]",br="[object String]",jr="[object WeakMap]",Ar="[object ArrayBuffer]",Cr="[object DataView]",Sr="[object Float32Array]",Tr="[object Float64Array]",Er="[object Int8Array]",Ir="[object Int16Array]",Pr="[object Int32Array]",_r="[object Uint8Array]",Nr="[object Uint8ClampedArray]",Or="[object Uint16Array]",Rr="[object Uint32Array]",_={};_[Sr]=_[Tr]=_[Er]=_[Ir]=_[Pr]=_[_r]=_[Nr]=_[Or]=_[Rr]=!0;_[ur]=_[dr]=_[Ar]=_[fr]=_[Cr]=_[mr]=_[hr]=_[gr]=_[pr]=_[xr]=_[vr]=_[yr]=_[wr]=_[br]=_[jr]=!1;function $r(e){return a.isObjectLike(e)&&je(e.length)&&!!_[a.baseGetTag(e)]}function Ce(e){return function(t){return e(t)}}var Et=typeof exports=="object"&&exports&&!exports.nodeType&&exports,W=Et&&typeof module=="object"&&module&&!module.nodeType&&module,Br=W&&W.exports===Et,ae=Br&&a.freeGlobal.process,ee=function(){try{var e=W&&W.require&&W.require("util").types;return e||ae&&ae.binding&&ae.binding("util")}catch{}}(),Xe=ee&&ee.isTypedArray,It=Xe?Ce(Xe):$r,Dr=Object.prototype,Mr=Dr.hasOwnProperty;function kr(e,t){var n=B(e),r=!n&&Ae(e),i=!n&&!r&&de(e),s=!n&&!r&&!i&&It(e),l=n||r||i||s,u=l?rr(e.length,String):[],c=u.length;for(var d in e)Mr.call(e,d)&&!(l&&(d=="length"||i&&(d=="offset"||d=="parent")||s&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||jt(d,c)))&&u.push(d);return u}function Lr(e,t){return function(n){return e(t(n))}}var zr=Lr(Object.keys,Object),Fr=Object.prototype,Hr=Fr.hasOwnProperty;function Gr(e){if(!nr(e))return zr(e);var t=[];for(var n in Object(e))Hr.call(e,n)&&n!="constructor"&&t.push(n);return t}function Pt(e){return Ct(e)?kr(e):Gr(e)}var Ur=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Wr=/^\w*$/;function Se(e,t){if(B(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||a.isSymbol(e)?!0:Wr.test(e)||!Ur.test(e)||t!=null&&e in Object(t)}var K=H(Object,"create");function Kr(){this.__data__=K?K(null):{},this.size=0}function Vr(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var qr="__lodash_hash_undefined__",Xr=Object.prototype,Yr=Xr.hasOwnProperty;function Zr(e){var t=this.__data__;if(K){var n=t[e];return n===qr?void 0:n}return Yr.call(t,e)?t[e]:void 0}var Jr=Object.prototype,Qr=Jr.hasOwnProperty;function eo(e){var t=this.__data__;return K?t[e]!==void 0:Qr.call(t,e)}var to="__lodash_hash_undefined__";function no(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=K&&t===void 0?to:t,this}function z(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}z.prototype.clear=Kr;z.prototype.delete=Vr;z.prototype.get=Zr;z.prototype.has=eo;z.prototype.set=no;function ro(){this.__data__=[],this.size=0}function te(e,t){for(var n=e.length;n--;)if(At(e[n][0],t))return n;return-1}var oo=Array.prototype,io=oo.splice;function so(e){var t=this.__data__,n=te(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():io.call(t,n,1),--this.size,!0}function ao(e){var t=this.__data__,n=te(t,e);return n<0?void 0:t[n][1]}function lo(e){return te(this.__data__,e)>-1}function co(e,t){var n=this.__data__,r=te(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function M(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}M.prototype.clear=ro;M.prototype.delete=so;M.prototype.get=ao;M.prototype.has=lo;M.prototype.set=co;var V=H(a.root,"Map");function uo(){this.size=0,this.__data__={hash:new z,map:new(V||M),string:new z}}function fo(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function ne(e,t){var n=e.__data__;return fo(t)?n[typeof t=="string"?"string":"hash"]:n.map}function mo(e){var t=ne(this,e).delete(e);return this.size-=t?1:0,t}function ho(e){return ne(this,e).get(e)}function go(e){return ne(this,e).has(e)}function po(e,t){var n=ne(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function k(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}k.prototype.clear=uo;k.prototype.delete=mo;k.prototype.get=ho;k.prototype.has=go;k.prototype.set=po;var xo="Expected a function";function Te(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(xo);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],s=n.cache;if(s.has(i))return s.get(i);var l=e.apply(this,r);return n.cache=s.set(i,l)||s,l};return n.cache=new(Te.Cache||k),n}Te.Cache=k;var vo=500;function yo(e){var t=Te(e,function(r){return n.size===vo&&n.clear(),r}),n=t.cache;return t}var wo=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,bo=/\\(\\)?/g,jo=yo(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(wo,function(n,r,i,s){t.push(i?s.replace(bo,"$1"):r||n)}),t});function fe(e){return e==null?"":Q(e)}function _t(e,t){return B(e)?e:Se(e,t)?[e]:jo(fe(e))}function re(e){if(typeof e=="string"||a.isSymbol(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Nt(e,t){t=_t(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[re(t[n++])];return n&&n==r?e:void 0}function Ao(e,t,n){var r=e==null?void 0:Nt(e,t);return r===void 0?n:r}function Ot(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var Ye=a.Symbol?a.Symbol.isConcatSpreadable:void 0;function Co(e){return B(e)||Ae(e)||!!(Ye&&e&&e[Ye])}function So(e,t,n,r,i){var s=-1,l=e.length;for(n||(n=Co),i||(i=[]);++s<l;){var u=e[s];n(u)&&Ot(i,u)}return i}function To(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var s=Array(i);++r<i;)s[r]=e[r+t];return s}function Eo(e,t,n){var r=e.length;return n=n===void 0?r:n,n>=r?e:To(e,t,n)}var Io="\\ud800-\\udfff",Po="\\u0300-\\u036f",_o="\\ufe20-\\ufe2f",No="\\u20d0-\\u20ff",Oo=Po+_o+No,Ro="\\ufe0e\\ufe0f",$o="\\u200d",Bo=RegExp("["+$o+Io+Oo+Ro+"]");function Ee(e){return Bo.test(e)}function Do(e){return e.split("")}var Rt="\\ud800-\\udfff",Mo="\\u0300-\\u036f",ko="\\ufe20-\\ufe2f",Lo="\\u20d0-\\u20ff",zo=Mo+ko+Lo,Fo="\\ufe0e\\ufe0f",Ho="["+Rt+"]",me="["+zo+"]",he="\\ud83c[\\udffb-\\udfff]",Go="(?:"+me+"|"+he+")",$t="[^"+Rt+"]",Bt="(?:\\ud83c[\\udde6-\\uddff]){2}",Dt="[\\ud800-\\udbff][\\udc00-\\udfff]",Uo="\\u200d",Mt=Go+"?",kt="["+Fo+"]?",Wo="(?:"+Uo+"(?:"+[$t,Bt,Dt].join("|")+")"+kt+Mt+")*",Ko=kt+Mt+Wo,Vo="(?:"+[$t+me+"?",me,Bt,Dt,Ho].join("|")+")",qo=RegExp(he+"(?="+he+")|"+Vo+Ko,"g");function Xo(e){return e.match(qo)||[]}function Yo(e){return Ee(e)?Xo(e):Do(e)}function Zo(){this.__data__=new M,this.size=0}function Jo(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Qo(e){return this.__data__.get(e)}function ei(e){return this.__data__.has(e)}var ti=200;function ni(e,t){var n=this.__data__;if(n instanceof M){var r=n.__data__;if(!V||r.length<ti-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new k(r)}return n.set(e,t),this.size=n.size,this}function D(e){var t=this.__data__=new M(e);this.size=t.size}D.prototype.clear=Zo;D.prototype.delete=Jo;D.prototype.get=Qo;D.prototype.has=ei;D.prototype.set=ni;function ri(e,t){for(var n=-1,r=e==null?0:e.length,i=0,s=[];++n<r;){var l=e[n];t(l,n,e)&&(s[i++]=l)}return s}function oi(){return[]}var ii=Object.prototype,si=ii.propertyIsEnumerable,Ze=Object.getOwnPropertySymbols,ai=Ze?function(e){return e==null?[]:(e=Object(e),ri(Ze(e),function(t){return si.call(e,t)}))}:oi;function li(e,t,n){var r=t(e);return B(e)?r:Ot(r,n(e))}function Je(e){return li(e,Pt,ai)}var ge=H(a.root,"DataView"),pe=H(a.root,"Promise"),xe=H(a.root,"Set"),Qe="[object Map]",ci="[object Object]",et="[object Promise]",tt="[object Set]",nt="[object WeakMap]",rt="[object DataView]",ui=F(ge),di=F(V),fi=F(pe),mi=F(xe),hi=F(ue),L=a.baseGetTag;(ge&&L(new ge(new ArrayBuffer(1)))!=rt||V&&L(new V)!=Qe||pe&&L(pe.resolve())!=et||xe&&L(new xe)!=tt||ue&&L(new ue)!=nt)&&(L=function(e){var t=a.baseGetTag(e),n=t==ci?e.constructor:void 0,r=n?F(n):"";if(r)switch(r){case ui:return rt;case di:return Qe;case fi:return et;case mi:return tt;case hi:return nt}return t});var ot=a.root.Uint8Array,gi="__lodash_hash_undefined__";function pi(e){return this.__data__.set(e,gi),this}function xi(e){return this.__data__.has(e)}function q(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new k;++t<n;)this.add(e[t])}q.prototype.add=q.prototype.push=pi;q.prototype.has=xi;function vi(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function Lt(e,t){return e.has(t)}var yi=1,wi=2;function zt(e,t,n,r,i,s){var l=n&yi,u=e.length,c=t.length;if(u!=c&&!(l&&c>u))return!1;var d=s.get(e),m=s.get(t);if(d&&m)return d==t&&m==e;var f=-1,h=!0,p=n&wi?new q:void 0;for(s.set(e,t),s.set(t,e);++f<u;){var x=e[f],y=t[f];if(r)var b=l?r(y,x,f,t,e,s):r(x,y,f,e,t,s);if(b!==void 0){if(b)continue;h=!1;break}if(p){if(!vi(t,function(S,I){if(!Lt(p,I)&&(x===S||i(x,S,n,r,s)))return p.push(I)})){h=!1;break}}else if(!(x===y||i(x,y,n,r,s))){h=!1;break}}return s.delete(e),s.delete(t),h}function bi(e){var t=-1,n=Array(e.size);return e.forEach(function(r,i){n[++t]=[i,r]}),n}function ji(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var Ai=1,Ci=2,Si="[object Boolean]",Ti="[object Date]",Ei="[object Error]",Ii="[object Map]",Pi="[object Number]",_i="[object RegExp]",Ni="[object Set]",Oi="[object String]",Ri="[object Symbol]",$i="[object ArrayBuffer]",Bi="[object DataView]",it=a.Symbol?a.Symbol.prototype:void 0,le=it?it.valueOf:void 0;function Di(e,t,n,r,i,s,l){switch(n){case Bi:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case $i:return!(e.byteLength!=t.byteLength||!s(new ot(e),new ot(t)));case Si:case Ti:case Pi:return At(+e,+t);case Ei:return e.name==t.name&&e.message==t.message;case _i:case Oi:return e==t+"";case Ii:var u=bi;case Ni:var c=r&Ai;if(u||(u=ji),e.size!=t.size&&!c)return!1;var d=l.get(e);if(d)return d==t;r|=Ci,l.set(e,t);var m=zt(u(e),u(t),r,i,s,l);return l.delete(e),m;case Ri:if(le)return le.call(e)==le.call(t)}return!1}var Mi=1,ki=Object.prototype,Li=ki.hasOwnProperty;function zi(e,t,n,r,i,s){var l=n&Mi,u=Je(e),c=u.length,d=Je(t),m=d.length;if(c!=m&&!l)return!1;for(var f=c;f--;){var h=u[f];if(!(l?h in t:Li.call(t,h)))return!1}var p=s.get(e),x=s.get(t);if(p&&x)return p==t&&x==e;var y=!0;s.set(e,t),s.set(t,e);for(var b=l;++f<c;){h=u[f];var S=e[h],I=t[h];if(r)var P=l?r(I,S,h,t,e,s):r(S,I,h,e,t,s);if(!(P===void 0?S===I||i(S,I,n,r,s):P)){y=!1;break}b||(b=h=="constructor")}if(y&&!b){var j=e.constructor,v=t.constructor;j!=v&&"constructor"in e&&"constructor"in t&&!(typeof j=="function"&&j instanceof j&&typeof v=="function"&&v instanceof v)&&(y=!1)}return s.delete(e),s.delete(t),y}var Fi=1,st="[object Arguments]",at="[object Array]",Y="[object Object]",Hi=Object.prototype,lt=Hi.hasOwnProperty;function Gi(e,t,n,r,i,s){var l=B(e),u=B(t),c=l?at:L(e),d=u?at:L(t);c=c==st?Y:c,d=d==st?Y:d;var m=c==Y,f=d==Y,h=c==d;if(h&&de(e)){if(!de(t))return!1;l=!0,m=!1}if(h&&!m)return s||(s=new D),l||It(e)?zt(e,t,n,r,i,s):Di(e,t,c,n,r,i,s);if(!(n&Fi)){var p=m&<.call(e,"__wrapped__"),x=f&<.call(t,"__wrapped__");if(p||x){var y=p?e.value():e,b=x?t.value():t;return s||(s=new D),i(y,b,n,r,s)}}return h?(s||(s=new D),zi(e,t,n,r,i,s)):!1}function Ie(e,t,n,r,i){return e===t?!0:e==null||t==null||!a.isObjectLike(e)&&!a.isObjectLike(t)?e!==e&&t!==t:Gi(e,t,n,r,Ie,i)}var Ui=1,Wi=2;function Ki(e,t,n,r){var i=n.length,s=i;if(e==null)return!s;for(e=Object(e);i--;){var l=n[i];if(l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++i<s;){l=n[i];var u=l[0],c=e[u],d=l[1];if(l[2]){if(c===void 0&&!(u in e))return!1}else{var m=new D,f;if(!(f===void 0?Ie(d,c,Ui|Wi,r,m):f))return!1}}return!0}function Ft(e){return e===e&&!a.isObject(e)}function Vi(e){for(var t=Pt(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,Ft(i)]}return t}function Ht(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function qi(e){var t=Vi(e);return t.length==1&&t[0][2]?Ht(t[0][0],t[0][1]):function(n){return n===e||Ki(n,e,t)}}function Xi(e,t){return e!=null&&t in Object(e)}function Yi(e,t,n){t=_t(t,e);for(var r=-1,i=t.length,s=!1;++r<i;){var l=re(t[r]);if(!(s=e!=null&&n(e,l)))break;e=e[l]}return s||++r!=i?s:(i=e==null?0:e.length,!!i&&je(i)&&jt(l,i)&&(B(e)||Ae(e)))}function Zi(e,t){return e!=null&&Yi(e,t,Xi)}var Ji=1,Qi=2;function es(e,t){return Se(e)&&Ft(t)?Ht(re(e),t):function(n){var r=Ao(n,e);return r===void 0&&r===t?Zi(n,e):Ie(t,r,Ji|Qi)}}function Gt(e){return function(t){return t==null?void 0:t[e]}}function ts(e){return function(t){return Nt(t,e)}}function ns(e){return Se(e)?Gt(re(e)):ts(e)}function rs(e){return typeof e=="function"?e:e==null?be:typeof e=="object"?B(e)?es(e[0],e[1]):qi(e):ns(e)}function ce(e){return a.isObjectLike(e)&&Ct(e)}var os=200;function is(e,t,n,r){var i=-1,s=Xn,l=!0,u=e.length,c=[],d=t.length;if(!u)return c;n&&(t=wt(t,Ce(n))),t.length>=os&&(s=Lt,l=!1,t=new q(t));e:for(;++i<u;){var m=e[i],f=n==null?m:n(m);if(m=m!==0?m:0,l&&f===f){for(var h=d;h--;)if(t[h]===f)continue e;c.push(m)}else s(t,f,r)||c.push(m)}return c}function ss(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var as=Qn(function(e,t){var n=ss(t);return ce(n)&&(n=void 0),ce(e)?is(e,So(t,1,ce),rs(n)):[]}),ls="[object RegExp]";function cs(e){return a.isObjectLike(e)&&a.baseGetTag(e)==ls}var ct=ee&&ee.isRegExp,us=ct?Ce(ct):cs,ds=Gt("length"),Ut="\\ud800-\\udfff",fs="\\u0300-\\u036f",ms="\\ufe20-\\ufe2f",hs="\\u20d0-\\u20ff",gs=fs+ms+hs,ps="\\ufe0e\\ufe0f",xs="["+Ut+"]",ve="["+gs+"]",ye="\\ud83c[\\udffb-\\udfff]",vs="(?:"+ve+"|"+ye+")",Wt="[^"+Ut+"]",Kt="(?:\\ud83c[\\udde6-\\uddff]){2}",Vt="[\\ud800-\\udbff][\\udc00-\\udfff]",ys="\\u200d",qt=vs+"?",Xt="["+ps+"]?",ws="(?:"+ys+"(?:"+[Wt,Kt,Vt].join("|")+")"+Xt+qt+")*",bs=Xt+qt+ws,js="(?:"+[Wt+ve+"?",ve,Kt,Vt,xs].join("|")+")",ut=RegExp(ye+"(?="+ye+")|"+js+bs,"g");function As(e){for(var t=ut.lastIndex=0;ut.test(e);)++t;return t}function Cs(e){return Ee(e)?As(e):ds(e)}var Ss=30,Ts="...",Es=/\w*$/;function Is(e,t){var n=Ss,r=Ts;if(a.isObject(t)){var i="separator"in t?t.separator:i;n="length"in t?wn(t.length):n,r="omission"in t?Q(t.omission):r}e=fe(e);var s=e.length;if(Ee(e)){var l=Yo(e);s=l.length}if(n>=s)return e;var u=n-Cs(r);if(u<1)return r;var c=l?Eo(l,0,u).join(""):e.slice(0,u);if(i===void 0)return c+r;if(l&&(u+=c.length-u),us(i)){if(e.slice(u).search(i)){var d,m=c;for(i.global||(i=RegExp(i.source,fe(Es.exec(i))+"g")),i.lastIndex=0;d=i.exec(m);)var f=d.index;c=c.slice(0,f===void 0?u:f)}}else if(e.indexOf(Q(i),u)!=u){var h=c.lastIndexOf(i);h>-1&&(c=c.slice(0,h))}return c+r}const Ps=R.Provider,Yt=G.forwardRef(({className:e,...t},n)=>o.jsx(R.Viewport,{ref:n,className:a.cn("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));Yt.displayName=R.Viewport.displayName;const _s=a.cva("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md !border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Zt=G.forwardRef(({className:e,variant:t,...n},r)=>o.jsx(R.Root,{ref:r,className:a.cn(_s({variant:t}),e),...n}));Zt.displayName=R.Root.displayName;const Ns=G.forwardRef(({className:e,...t},n)=>o.jsx(R.Action,{ref:n,className:a.cn("inline-flex h-8 shrink-0 items-center justify-center rounded-md !border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));Ns.displayName=R.Action.displayName;const Jt=G.forwardRef(({className:e,...t},n)=>o.jsx(R.Close,{ref:n,className:a.cn("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:o.jsx(J.X,{className:"h-4 w-4"})}));Jt.displayName=R.Close.displayName;const Qt=G.forwardRef(({className:e,...t},n)=>o.jsx(R.Title,{ref:n,className:a.cn("text-sm font-semibold",e),...t}));Qt.displayName=R.Title.displayName;const en=G.forwardRef(({className:e,...t},n)=>o.jsx(R.Description,{ref:n,className:a.cn("text-sm opacity-90",e),...t}));en.displayName=R.Description.displayName;let U=!1;function Os({editor:e,attrs:t,extension:n}){const[r,i]=g.useState(!1),s=g.useRef(null),l=g.useRef(null),{alt:u,align:c}=t,d=n==null?void 0:n.options.upload,m=()=>{(async()=>{const w=document.querySelector("#easydrawer");w&&(s.current=new Le.Editor(w,{wheelEventsEnabled:!1,disableZoom:!0}),l.current=Le.makeDropdownToolbar(s.current),l.current.addDefaultToolWidgets(),s.current.loadFromSVG(decodeURIComponent(u)))})()};g.useEffect(()=>{r&&setTimeout(()=>{m()},200)},[r]);const f=async()=>{if(s.current){const C=s.current.toSVG(),w=C.outerHTML,E=`drawer-${a.shortId()}.svg`;let N=a.i(C.outerHTML);if(d){const O=a.dataURLtoFile(N,E);N=await d(O)}e==null||e.chain().focus().setDrawer({type:"drawer",src:N,alt:encodeURIComponent(w),width:426,height:212},!!w).run(),e==null||e.commands.setAlignImageDrawer(c)}i(!1)},h=C=>{const w=s.current.toolController.getPrimaryTools()[2],E=l.current.getWidgetById("pen-1");w&&E&&(w.setColor(C),E.serializeState())},p=C=>{const w=s.current.toolController.getPrimaryTools()[2],E=l.current.getWidgetById("pen-1");w&&E&&(w.setThickness(C),E.serializeState())},x=C=>{const w=s.current.toolController.getPrimaryTools()[3],E=l.current.getWidgetById("pen-2");w&&E&&(w.setColor(C),E.serializeState())},y=C=>{const w=l.current.getWidgetById("shape");w&&w.setShapeType(C)},b=C=>{const w=s.current.toolController.getPrimaryTools()[5],E=l.current.getWidgetById("shape");w&&E&&(w.setColor(C),E.serializeState())},S=C=>{const w=s.current.toolController.getPrimaryTools()[5],E=l.current.getWidgetById("shape");w&&E&&(w.setThickness(C),E.serializeState())},I=C=>{const w=s.current.toolController.getPrimaryTools()[5],E=l.current.getWidgetById("shape");w&&E&&(w.setBorderColor(C),E.serializeState())},P=()=>{if(U){for(;s.current.history.redoStackSize>0;)s.current.history.redo();U=!1;return}s.current.history.undo()},j=()=>{U||s.current.history.redo()},v=()=>{if(!U){for(;s.current.history.undoStackSize>0;)P();U=!0}};return o.jsxs(a.Dialog,{onOpenChange:i,open:r,children:[o.jsx(a.DialogTrigger,{asChild:!0,children:o.jsx(a.ActionButton,{action:()=>i(!0),icon:"Pencil",tooltip:"Edit Drawer"})}),o.jsxs(a.DialogContent,{className:"z-[99999] !max-w-[1300px]",children:[o.jsx(a.DialogTitle,{children:"Edit Drawer"}),o.jsxs("div",{style:{height:"100%",borderWidth:1,background:"white",position:"relative"},children:[o.jsx("div",{className:"size-full",id:"easydrawer"}),o.jsx(a.ControlDrawer,{changeBorderColorShape:I,changeColorShape:b,changeShape:y,onClear:v,onRedo:j,onThicknessChange:S,onUndo:P,refEditor:s,setColorHighlight:x,setColorPen:h,setThicknessPen:p})]}),o.jsx(a.DialogFooter,{children:o.jsx(a.Button,{onClick:f,type:"button",children:"Save changes"})})]})]})}function tn(e,t){const[n,r]=g.useState(void 0);return g.useEffect(()=>{const i=()=>{const s=e.extensionManager.extensions.find(l=>l.name===t);s&&r(s)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,t]),n}const Rs={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"};function $s({item:e,disabled:t,editor:n}){var i;const r=e.component;return r?o.jsx(g.Fragment,{children:e.type==="divider"?o.jsx(a.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"}):o.jsx(r,{...e.componentProps,disabled:t||((i=e==null?void 0:e.componentProps)==null?void 0:i.disabled),editor:n})}):o.jsx(o.Fragment,{})}function Bs(e){return e.type.name==="drawer"}function Ds(e){const{lang:t}=A.useLocale(),n=a.useAttributes(e.editor,a.Drawer.name),r=tn(e.editor,a.Drawer.name),i=({editor:l})=>{const{selection:u}=l.view.state,{$from:c,to:d}=u;let m=!1;return l.view.state.doc.nodesBetween(c.pos,d,f=>{if(Bs(f))return m=!0,!1}),m},s=g.useMemo(()=>e.disabled?[]:ia(e.editor),[e.disabled,e.editor,t]);return o.jsx(o.Fragment,{children:o.jsx(a.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:i,tippyOptions:Rs,children:s!=null&&s.length?o.jsx("div",{className:"pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800",children:o.jsx("div",{className:"relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap",children:s==null?void 0:s.map((l,u)=>l.type==="edit"&&(n!=null&&n.src)?o.jsx(Os,{attrs:n,editor:e.editor,extension:r},`bubbleMenu-drawer-${u}`):o.jsx($s,{disabled:e.disabled,editor:e.editor,item:l},`bubbleMenu-drawer-${u}`))})}):o.jsx(o.Fragment,{})})})}const Ms={padding:"0 12px 12px"},ks=({width:e,maxWidth:t,height:n,onOk:r,children:i})=>{const{t:s}=A.useLocale(),[l,u]=g.useState({width:"",height:"",maxWidth:""});g.useEffect(()=>{u({width:e,height:n,maxWidth:t})},[n,t,e]);function c(d){d.preventDefault(),d.stopPropagation(),r(l)}return o.jsxs(a.Popover,{modal:!0,children:[o.jsx(a.PopoverTrigger,{asChild:!0,children:i}),o.jsx(a.PopoverContent,{children:o.jsx("div",{style:Ms,children:o.jsxs("form",{className:"flex flex-col gap-2",onSubmit:c,children:[o.jsx(a.Label,{className:"mb-[6px]",children:"Width"}),o.jsx("div",{className:"flex w-full max-w-sm items-center gap-1.5",children:o.jsx("div",{className:"relative items-center w-full max-w-sm",children:o.jsx(a.Input,{type:"number",value:l.width,required:!0,onChange:d=>u({...l,width:d.target.value})})})}),o.jsx(a.Label,{className:"mb-[6px]",children:"Max Width"}),o.jsx("div",{className:"flex w-full max-w-sm items-center gap-1.5",children:o.jsx("div",{className:"relative items-center w-full max-w-sm",children:o.jsx(a.Input,{type:"number",value:l.maxWidth,required:!0,onChange:d=>u({...l,maxWidth:d.target.value})})})}),o.jsx(a.Label,{className:"mb-[6px]",children:"Height"}),o.jsx("div",{className:"flex w-full max-w-sm items-center gap-1.5",children:o.jsx("div",{className:"relative items-center w-full max-w-sm",children:o.jsx(a.Input,{type:"number",value:l.height,required:!0,onChange:d=>u({...l,height:d.target.value})})})}),o.jsx(a.Button,{type:"submit",className:"self-end mt-2",children:s("editor.link.dialog.button.apply")})]})})})]})};function Ls({editor:e}){const{t}=A.useLocale(),{width:n,height:r,url:i}=a.useAttributes(e,a.Iframe.name,{width:0,height:0,url:"",defaultShowPicker:!1}),[s,l]=g.useState(!1),[u,c]=g.useState(""),d=g.useCallback(()=>{l(!1)},[l]);g.useEffect(()=>{s&&c(i)},[s,i]);const m=g.useCallback(()=>{e.chain().updateAttributes(a.Iframe.name,{url:u}).setNodeSelection(e.state.selection.from).focus().run(),l(!1)},[e,u,l]),f=g.useCallback(()=>{window.open(i,"_blank")},[i]),h=g.useCallback(()=>{l(!0)},[l]),p=g.useCallback(b=>{e.chain().updateAttributes(a.Iframe.name,b).setNodeSelection(e.state.selection.from).focus().run()},[e]),x=g.useCallback(()=>e.isActive(a.Iframe.name)&&!i,[e,i]),y=g.useCallback(()=>a.deleteNode(a.Iframe.name,e),[e]);return o.jsxs(o.Fragment,{children:[o.jsx(a.BubbleMenu,{className:"bubble-menu",editor:e,pluginKey:"iframe-bubble-menu",shouldShow:x,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999},children:o.jsxs("div",{className:"w-auto px-3 py-2 transition-all !border rounded-sm shadow-sm pointer-events-auto select-none border-neutral-200 dark:border-neutral-800 bg-background",children:[o.jsx(a.ActionButton,{action:f,icon:"Eye",tooltip:"Visit Link"}),o.jsx(a.ActionButton,{action:h,icon:"Pencil",tooltip:"Open Edit Link"}),o.jsx(ks,{width:n,height:r,onOk:p,children:o.jsx(a.ActionButton,{icon:"Settings",tooltip:t("editor.settings")})}),o.jsx(a.ActionButton,{action:y,icon:"Trash2",tooltip:t("editor.delete")})]})}),o.jsxs(a.Dialog,{open:s,onOpenChange:l,children:[o.jsx(a.DialogTrigger,{}),o.jsxs(a.DialogContent,{children:[o.jsx(a.DialogHeader,{children:o.jsx(a.DialogTitle,{children:"Edit Link Iframe"})}),o.jsx(a.Input,{value:u,onInput:b=>c(b.target.value),type:"url",autoFocus:!0,placeholder:"Enter link"}),o.jsxs(a.DialogFooter,{children:[o.jsx(a.Button,{onClick:d,children:"Cancel"}),o.jsx(a.Button,{onClick:m,children:"OK"})]})]})]})]})}function zs({editor:e,...t}){const n=a.useAttributes(e,a.Katex.name,{text:"",defaultShowPicker:!1}),{text:r,defaultShowPicker:i}=n,[s,l]=g.useState(""),[u,c]=g.useState(!1),d=g.useCallback(()=>e.isActive(a.Katex.name),[e]),m=g.useCallback(()=>a.deleteNode(a.Katex.name,e),[e]),f=g.useCallback(()=>{e.chain().focus().setKatex({text:s}).run(),c(!1)},[e,s]);g.useEffect(()=>{i&&(c(!0),e.chain().updateAttributes(a.Katex.name,{defaultShowPicker:!1}).focus().run())},[e,i,c]),g.useEffect(()=>{u&&l(r||"")},[u]);const h=g.useMemo(()=>{try{return gn.renderToString(`${s}`)}catch{return s}},[s]),p=g.useMemo(()=>`${s}`.trim()?o.jsx("span",{contentEditable:!1,dangerouslySetInnerHTML:{__html:h||""}}):null,[s,h]);return o.jsx(a.BubbleMenu,{editor:e,pluginKey:"Katex-bubble-menu",shouldShow:d,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{c(!1)}},children:t!=null&&t.disabled?o.jsx(o.Fragment,{}):o.jsx("div",{className:"p-2 bg-white !border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800",children:u?o.jsxs(o.Fragment,{children:[o.jsx(a.Textarea,{value:s,onChange:x=>l(x.target.value),autoFocus:!0,placeholder:"Formula text",rows:3,defaultValue:r,style:{marginBottom:8}}),p&&o.jsx("div",{className:"my-[10px] p-[10px] rounded-[6px] !border-[1px] whitespace-nowrap overflow-auto",children:p}),o.jsxs("div",{className:"flex items-center justify-between gap-[6px]",children:[o.jsx(a.Button,{onClick:f,className:"flex-1",children:"Submit"}),o.jsx("a",{href:"https://katex.org/docs/supported",target:"_blank",rel:"noreferrer noopener",children:o.jsx(J.HelpCircle,{size:16})})]})]}):o.jsxs("div",{className:"flex items-center justify-center gap-[6px]",children:[o.jsx(a.ActionButton,{tooltip:"Edit",action:()=>c(!u),children:o.jsx(J.Pencil,{size:16})}),o.jsx(a.ActionButton,{tooltip:"Delete",action:m,children:o.jsx(J.Trash2,{size:16})})]})})})}const dt=`graph TB
|
|
2
|
+
a-->b`,Fs=({editor:e,attrs:t,extension:n})=>{const{alt:r,align:i}=t,[s,l]=g.useState(decodeURIComponent(r??dt)),[u,c]=g.useState(""),[d,m]=g.useState(!1),f=g.useRef(null),h=n==null?void 0:n.options.upload,p=async b=>{try{const{svg:S}=await ze.render("mermaid-svg",b);c(S)}catch{c("")}},x=()=>{ze.initialize({darkMode:!1,startOnLoad:!1,fontSize:12,theme:"base"}),p(s)};g.useEffect(()=>{d&&x()},[d]),g.useEffect(()=>{d&&p(s)},[s]);const y=async()=>{if(s!==""){if(s){const b=f.current.querySelector("svg"),{width:S,height:I}=b.getBoundingClientRect(),P=`mermaid-${a.shortId()}.svg`;let j=a.i(b.outerHTML);if(h){const v=a.dataURLtoFile(j,P);j=await h(v)}e==null||e.chain().focus().setMermaid({type:"mermaid",src:j,alt:encodeURIComponent(s),width:S,height:I},!!s).run(),e==null||e.commands.setAlignImageMermaid(i)}m(!1)}};return o.jsxs(a.Dialog,{onOpenChange:m,open:d,children:[o.jsx(a.DialogTrigger,{asChild:!0,children:o.jsx(a.ActionButton,{action:()=>m(!0),icon:"Pencil",tooltip:"Edit Mermaid"})}),o.jsxs(a.DialogContent,{className:"z-[99999] !max-w-[1300px]",children:[o.jsx(a.DialogTitle,{children:"Edit Mermaid"}),o.jsx("div",{style:{height:"100%",border:"1px solid hsl(var(--border))"},children:o.jsxs("div",{className:"flex gap-[10px] rounded-[10px] p-[10px]",children:[o.jsx(a.Textarea,{autoFocus:!0,className:"flex-1",defaultValue:dt,onChange:b=>l(b.target.value),placeholder:"Text",required:!0,rows:10,value:s,style:{color:"hsl(var(--foreground))"}}),o.jsx("div",{className:"flex flex-1 items-center justify-center rounded-[10px] p-[10px]",dangerouslySetInnerHTML:{__html:u},ref:f,style:{height:"100%",border:"1px solid hsl(var(--border))",minHeight:500,background:"#fff"}})]})}),o.jsx(a.DialogFooter,{children:o.jsx(a.Button,{onClick:y,type:"button",children:"Save changes"})})]})]})},Hs={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"};function Gs({item:e,disabled:t,editor:n}){var i;const r=e.component;return r?o.jsx(g.Fragment,{children:e.type==="divider"?o.jsx(a.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"}):o.jsx(r,{...e.componentProps,disabled:t||((i=e==null?void 0:e.componentProps)==null?void 0:i.disabled),editor:n})}):o.jsx(o.Fragment,{})}function Us(e){return e.type.name==="mermaid"}function Ws(e){const{lang:t}=A.useLocale(),n=a.useAttributes(e.editor,a.Mermaid.name),r=tn(e.editor,a.Mermaid.name),i=({editor:l})=>{const{selection:u}=l.view.state,{$from:c,to:d}=u;let m=!1;return l.view.state.doc.nodesBetween(c.pos,d,f=>{if(Us(f))return m=!0,!1}),m},s=g.useMemo(()=>e.disabled?[]:oa(e.editor),[e.disabled,e.editor,t]);return o.jsx(o.Fragment,{children:o.jsx(a.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:i,tippyOptions:Hs,children:s!=null&&s.length?o.jsx("div",{className:"pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800",children:o.jsx("div",{className:"relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap",children:s==null?void 0:s.map((l,u)=>l.type==="edit"&&(n!=null&&n.src)?o.jsx(Fs,{attrs:n,editor:e.editor,extension:r},`bubbleMenu-mermaid-${u}`):o.jsx(Gs,{disabled:e.disabled,editor:e.editor,item:l},`bubbleMenu-mermaid-${u}`))})}):o.jsx(o.Fragment,{})})})}function Ks({editor:e,disabled:t}){const[n,r]=g.useState(!1),{t:i}=A.useLocale(),s=g.useCallback(({editor:c})=>c.isActive(a.Twitter.name),[]),l=c=>{e.commands.updateTweet({src:c}),r(!1)},u=g.useCallback(()=>a.deleteNode(a.Twitter.name,e),[e]);return o.jsx(o.Fragment,{children:o.jsx(a.BubbleMenu,{editor:e,shouldShow:s,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{r(!1)}},children:t?o.jsx(o.Fragment,{}):o.jsx(o.Fragment,{children:n?o.jsx(a.FormEditLinkTwitter,{editor:e,onSetLink:l}):o.jsx("div",{className:"flex items-center gap-2 rounded-lg !border border-neutral-200 bg-white p-2 shadow-sm dark:border-neutral-800 dark:bg-black",children:o.jsxs("div",{className:"flex flex-nowrap",children:[o.jsx(a.ActionButton,{icon:"Pencil",tooltip:i("editor.link.edit.tooltip"),tooltipOptions:{sideOffset:15},action:()=>{r(!0)}}),o.jsx(a.ActionButton,{action:u,icon:"Trash",tooltip:i("editor.delete"),tooltipOptions:{sideOffset:15}})]})})})})})}function Vs({editor:e,disabled:t,bubbleMenu:n}){const r=e.extensionManager.extensions.map(s=>s.name),i=()=>{var s,l,u,c,d,m,f,h,p,x,y,b,S,I,P,j,v,C;return[r.includes("columns")&&!((s=n==null?void 0:n.columnConfig)!=null&&s.hidden)?o.jsx(Sa,{editor:e},"columns"):null,r.includes("table")&&!((l=n==null?void 0:n.tableConfig)!=null&&l.hidden)?o.jsx(pa,{editor:e,items:(u=n==null?void 0:n.tableConfig)==null?void 0:u.items,actions:(c=n==null?void 0:n.tableConfig)==null?void 0:c.actions},"table"):null,r.includes("link")&&!((d=n==null?void 0:n.linkConfig)!=null&&d.hidden)?o.jsx(va,{disabled:t,editor:e},"link"):null,r.includes(a.Image.name)&&!((m=n==null?void 0:n.imageConfig)!=null&&m.hidden)?o.jsx(ja,{disabled:t,editor:e},"image"):null,r.includes(a.ImageGif.name)&&!((f=n==null?void 0:n.imageGifConfig)!=null&&f.hidden)?o.jsx(Aa,{disabled:t,editor:e},"imageGif"):null,r.includes("video")&&!((h=n==null?void 0:n.videoConfig)!=null&&h.hidden)?o.jsx(Ca,{disabled:t,editor:e},"video"):null,r.includes("katex")&&!((p=n==null?void 0:n.katexConfig)!=null&&p.hidden)?o.jsx(zs,{disabled:t,editor:e},"katex"):null,r.includes("mermaid")&&!((x=n==null?void 0:n.mermaidConfig)!=null&&x.hidden)?o.jsx(Ws,{disabled:t,editor:e},"mermaid"):null,r.includes("iframe")&&!((y=n==null?void 0:n.iframeConfig)!=null&&y.hidden)?o.jsx(Ls,{disabled:t,editor:e},"iframe"):null,r.includes("twitter")&&!((b=n==null?void 0:n.twitterConfig)!=null&&b.hidden)?o.jsx(Ks,{disabled:t,editor:e},"twitter"):null,(S=n==null?void 0:n.floatingMenuConfig)!=null&&S.hidden?null:o.jsx(da,{disabled:t,editor:e},"content"),(I=n==null?void 0:n.textConfig)!=null&&I.hidden?null:o.jsx(fa,{disabled:t,editor:e,items:(P=n==null?void 0:n.textConfig)==null?void 0:P.items,showShow:(j=n==null?void 0:n.textConfig)==null?void 0:j.showShow,filterItem:(v=n==null?void 0:n.textConfig)==null?void 0:v.filterItem},"text"),r.includes("drawer")&&!((C=n==null?void 0:n.drawerConfig)!=null&&C.hidden)?o.jsx(Ds,{disabled:t,editor:e},"drawer"):null]};return n!=null&&n.render?n.render({editor:e,disabled:t||!1,bubbleMenu:n},i()):i().filter(Boolean)}function qs({editor:e,disabled:t,toolbar:n}){const{t:r,lang:i}=A.useLocale(),s=g.useMemo(()=>{const d=[...e.extensionManager.extensions].sort((f,h)=>{const p=f.options.sort??-1,x=h.options.sort??-1;return p-x});let m=[];for(const f of d){const{button:h,divider:p=!1,spacer:x=!1,toolbar:y=!0}=f.options;if(!h||!a.isFunction(h)||!y)continue;const b=h({editor:e,extension:f,t:r});if(Array.isArray(b)){const S=b.map((I,P)=>({button:I,divider:P===b.length-1?p:!1,spacer:P===0?x:!1,type:f.type,name:f.name}));m=[...m,...S];continue}m.push({button:b,divider:p,spacer:x,type:f.type,name:f.name})}return m},[e,r,i]),l=c=>o.jsx("div",{className:"toolbar px-1 py-2 !border-b",style:{pointerEvents:t?"none":"auto",opacity:t?.5:1},children:o.jsx("div",{className:"relative flex flex-wrap h-auto gap-y-1 gap-x-1",children:c})}),u=s.map((c,d)=>{var f,h;const m=c.button.component;return o.jsxs("div",{className:"flex items-center",children:[(c==null?void 0:c.spacer)&&o.jsx(a.Separator,{orientation:"vertical",className:"!h-[16px] !mx-[10px]"}),o.jsx(m,{...c.button.componentProps,disabled:t||((h=(f=c==null?void 0:c.button)==null?void 0:f.componentProps)==null?void 0:h.disabled)}),(c==null?void 0:c.divider)&&o.jsx(a.Separator,{orientation:"vertical",className:"!h-auto !mx-2"})]},`toolbar-item-${d}`)});return n&&(n!=null&&n.render)?n.render({editor:e,disabled:t||!1},s,u,l):l(u)}function Xs(e){const t=["size-small","size-medium","size-large"],n=["SizeS","SizeM","SizeL"];return t.map((r,i)=>({type:`image-${r}`,component:a.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.${r.replace("-",".")}.tooltip`),icon:n[i],action:()=>e.commands.updateImage({width:A.IMAGE_SIZE[r]}),isActive:()=>e.isActive("image",{width:A.IMAGE_SIZE[r]})}}))}function Ys(e){const t=["size-small","size-medium","size-large"],n=["SizeS","SizeM","SizeL"];return t.map((r,i)=>({type:`image-${r}`,component:a.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.${r.replace("-",".")}.tooltip`),icon:n[i],action:()=>e.commands.updateImageGif({width:A.IMAGE_SIZE[r]}),isActive:()=>e.isActive("image",{width:A.IMAGE_SIZE[r]})}}))}function Zs(e){const t=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map(r=>({type:`image-${r}`,component:a.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var i,s;return(s=(i=e.commands)==null?void 0:i.setAlignImage)==null?void 0:s.call(i,r)},isActive:()=>e.isActive({align:r})||!1,disabled:!1}}))}function Js(e){const t=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map(r=>({type:`image-${r}`,component:a.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var i,s;return(s=(i=e.commands)==null?void 0:i.setAlignImageGif)==null?void 0:s.call(i,r)},isActive:()=>e.isActive({align:r})||!1,disabled:!1}}))}function Qs(e){const t=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map(r=>({type:`image-${r}`,component:a.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var i,s;return(s=(i=e.commands)==null?void 0:i.setAlignImageMermaid)==null?void 0:s.call(i,r)},isActive:()=>e.isActive({align:r})||!1,disabled:!1}}))}function ea(e){const t=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map(r=>({type:`image-${r}`,component:a.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var i,s;return(s=(i=e.commands)==null?void 0:i.setAlignImageDrawer)==null?void 0:s.call(i,r)},isActive:()=>e.isActive({align:r})||!1,disabled:!1}}))}function ta(e){const t=["size-small","size-medium","size-large"],n=["SizeS","SizeM","SizeL"];return t.map((r,i)=>({type:`video-${r}`,component:a.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.${r.replace("-",".")}.tooltip`),icon:n[i],action:()=>e.commands.updateVideo({width:A.VIDEO_SIZE[r]}),isActive:()=>e.isActive("video",{width:A.VIDEO_SIZE[r]})}}))}function na(e){return[{type:"flipX",component:a.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.tooltip.flipX"),icon:"FlipX",action:()=>{const t=e.getAttributes("image"),{flipX:n}=t;e.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipX:!n}).run()}}},{type:"flipY",component:a.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.tooltip.flipY"),icon:"FlipY",action:()=>{const t=e.getAttributes("image"),{flipY:n}=t;e.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipY:!n}).run()}}},...Xs(e),...Zs(e),{type:"remove",component:a.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;a.deleteSelection(t,n)}}}]}function ra(e){return[...Ys(e),...Js(e),{type:"remove",component:a.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;a.deleteSelection(t,n)}}}]}function oa(e){return[...Qs(e),{type:"edit",component:a.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.edit"),icon:"Pencil",action:()=>!0}},{type:"remove",component:a.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;a.deleteSelection(t,n)}}}]}function ia(e){return[...ea(e),{type:"edit",component:a.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.edit"),icon:"Pencil",action:()=>(console.log("AAA"),!0)}},{type:"remove",component:a.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;a.deleteSelection(t,n)}}}]}function sa(e){return[...ta(e),{type:"remove",component:a.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;a.deleteSelection(t,n)}}}]}function nn(e,t,n=A.BUBBLE_TEXT_LIST){return n.reduce((r,i)=>{if(i==="divider"&&r.length>0)return[...r,{type:"divider",component:void 0,componentProps:{}}];const s=e.extensionManager.extensions.find(l=>l.name===i);return s?[...r,s.configure().options.button({editor:e,t,extension:s})]:r},[])}function Pe(e,t,n){const r=[],i=e.node(0);n=typeof n=="number"&&n>=0?n:e.sameParent(t)?Math.max(0,e.sharedDepth(t.pos)-1):e.sharedDepth(t.pos);const s=new a.NodeRange(e,t,n),l=s.depth===0?0:i.resolve(s.start).posAtIndex(0);return s.parent.forEach((u,c)=>{const d=l+c,m=d+u.nodeSize;if(d<s.start||d>=s.end)return;const f=new a.SelectionRange(i.resolve(d),i.resolve(m));r.push(f)}),r}class _e{constructor(t,n){X(this,"anchor");X(this,"head");this.anchor=t,this.head=n}map(t){return new _e(t.map(this.anchor),t.map(this.head))}resolve(t){const n=t.resolve(this.anchor),r=t.resolve(this.head);return new $(n,r)}}class $ extends a.Selection{constructor(n,r,i,s=1){const{doc:l}=n,u=n===r,c=n.pos===l.content.size&&r.pos===l.content.size,d=u&&!c?l.resolve(r.pos+(s>0?1:-1)):r,m=u&&c?l.resolve(n.pos-(s>0?1:-1)):n,f=Pe(m.min(d),m.max(d),i);super(d.pos>=n.pos?f[0].$from:f[f.length-1].$to,d.pos>=n.pos?f[f.length-1].$to:f[0].$from,f);X(this,"depth");this.depth=i}get $to(){return this.ranges[this.ranges.length-1].$to}eq(n){return n instanceof $&&n.$from.pos===this.$from.pos&&n.$to.pos===this.$to.pos}map(n,r){const i=n.resolve(r.map(this.anchor)),s=n.resolve(r.map(this.head));return new $(i,s)}toJSON(){return{type:"nodeRange",anchor:this.anchor,head:this.head}}get isForwards(){return this.head>=this.anchor}get isBackwards(){return!this.isForwards}extendBackwards(){const{doc:n}=this.$from;if(this.isForwards&&this.ranges.length>1){const s=this.ranges.slice(0,-1),l=s[0].$from,u=s[s.length-1].$to;return new $(l,u,this.depth)}const r=this.ranges[0],i=n.resolve(Math.max(0,r.$from.pos-1));return new $(this.$anchor,i,this.depth)}extendForwards(){const{doc:n}=this.$from;if(this.isBackwards&&this.ranges.length>1){const s=this.ranges.slice(1),l=s[0].$from,u=s[s.length-1].$to;return new $(u,l,this.depth)}const r=this.ranges[this.ranges.length-1],i=n.resolve(Math.min(n.content.size,r.$to.pos+1));return new $(this.$anchor,i,this.depth)}static fromJSON(n,r){return new $(n.resolve(r.anchor),n.resolve(r.head))}static create(n,r,i,s,l=1){return new this(n.resolve(r),n.resolve(i),s,l)}getBookmark(){return new _e(this.anchor,this.head)}}function aa(e){const t=e.cloneNode(!0),n=[e,...Array.from(e.getElementsByTagName("*"))],r=[t,...Array.from(t.getElementsByTagName("*"))];return n.forEach((i,s)=>{r[s].style.cssText=function(l){let u="";const c=getComputedStyle(l);for(let d=0;d<c.length;d+=1)u+=`${c[d]}:${c.getPropertyValue(c[d])};`;return u}(i)}),t}function Z(e,t){return window.getComputedStyle(e)[t]}function la(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function ft(e){e.parentNode!==null&&e.parentNode!==void 0&&e.parentNode.removeChild(e)}function rn(e){const{x:t,y:n,direction:r,editor:i}=e;let s=null,l=null,u=null,c=t;for(;l===null&&c<window.innerWidth&&c>0;){const d=document.elementsFromPoint(c,n),m=d.findIndex(h=>h.classList.contains("ProseMirror")),f=d.slice(0,m);if(f.length>0){const h=f[0];if(s=h,u=i.view.posAtDOM(h,0),u>=0){l=i.state.doc.nodeAt(Math.max(u-1,0)),(l===null||l.isText)&&(l=i.state.doc.nodeAt(Math.max(u-1,0))),l||(l=i.state.doc.nodeAt(Math.max(u,0)));break}}r==="left"?c-=1:c+=1}return{resultElement:s,resultNode:l,pos:u!==null?u:null}}function ca(e,t){const{doc:n}=t.view.state,r=rn({editor:t,x:e.clientX,y:e.clientY,direction:"right"});if(!r.resultNode||r.pos===null)return[];const i=e.clientX,s=function(m,f,h){const p=Number.parseInt(Z(m.dom,"paddingLeft"),10),x=Number.parseInt(Z(m.dom,"paddingRight"),10),y=Number.parseInt(Z(m.dom,"borderLeftWidth"),10),b=Number.parseInt(Z(m.dom,"borderLeftWidth"),10),S=m.dom.getBoundingClientRect();return{left:la(f,S.left+p+y,S.right-x-b),top:h}}(t.view,i,e.clientY),l=t.view.posAtCoords(s);if(!l)return[];const{pos:u}=l;if(!n.resolve(u).parent)return[];const c=n.resolve(r.pos),d=n.resolve(r.pos+1);return Pe(c,d,0)}function mt(e,t){const n=e.resolve(t),{depth:r}=n;return r===0?t:n.pos-n.parentOffset-1}function ht(e,t){const n=e.nodeAt(t),r=e.resolve(t);let{depth:i}=r,s=n;for(;i>0;){const l=r.node(i);i-=1,i===0&&(s=l)}return s}function gt(e,t){let n=t;for(;n&&n.parentNode&&n.parentNode!==e.dom;)n=n.parentNode;return n}const on=new a.PluginKey("dragHandle");function ua({pluginKey:e=on,element:t,editor:n,tippyOptions:r,onNodeChange:i}){const s=document.createElement("div");let l=null,u=!1,c=null,d=-1;return t.addEventListener("dragstart",m=>{const{view:f}=n;if(!m.dataTransfer)return;const{empty:h,$from:p,$to:x}=f.state.selection,y=ca(m,n),b=Pe(p,x,0),S=b.some(N=>y.find(O=>O.$from===N.$from&&O.$to===N.$to)),I=h||!S?y:b;if(I.length===0)return;const{tr:P}=f.state,j=document.createElement("div"),v=I[0].$from.pos,C=I[I.length-1].$to.pos,w=$.create(f.state.doc,v,C),E=w.content();I.forEach(N=>{const O=aa(f.nodeDOM(N.$from.pos));j.append(O)}),j.style.position="absolute",j.style.top="-10000px",document.body.append(j),m.dataTransfer.clearData(),m.dataTransfer.setDragImage(j,0,0),f.dragging={slice:E,move:!0},P.setSelection(w),f.dispatch(P),document.addEventListener("drop",()=>ft(j),{once:!0}),setTimeout(()=>{t&&(t.style.pointerEvents="none")},0)}),t.addEventListener("dragend",()=>{t&&(t.style.pointerEvents="auto")}),new a.Plugin({key:typeof e=="string"?new a.PluginKey(e):e,state:{init:()=>({locked:!1}),apply(m,f){const h=m.getMeta("lockDragHandle"),p=m.getMeta("hideDragHandle");if(h!==void 0&&(u=h),p&&l)return l.hide(),u=!1,c=null,d=-1,i==null||i({editor:n,node:null,pos:-1}),f;if(m.docChanged&&d!==-1&&t&&l){const x=m.mapping.map(d);x!==d&&(d=x)}return f}},view:m=>{return f(),h(n.view.dom),l=vt(m.dom,{...p(),...r}),{update(j,v){if(!x(t,l)||(t.draggable=!u,!y(j,v)))return;const C=b(j);C&&S(j,C)},destroy(){P()}};function f(){t.draggable=!0,t.style.pointerEvents="auto"}function h(j){var v;(v=j.parentElement)==null||v.appendChild(s),s.appendChild(t),Object.assign(s.style,{pointerEvents:"none",position:"absolute",top:"0",left:"0"})}function p(){return{getReferenceClientRect:null,interactive:!0,trigger:"manual",placement:"left-start",hideOnClick:!1,duration:100,zIndex:10,appendTo:s,content:t,popperOptions:{modifiers:[{name:"flip",enabled:!1},{name:"preventOverflow",options:{rootBoundary:"document",mainAxis:!1}}]}}}function x(j,v){return j&&v}function y(j,v){return!j.state.doc.eq(v.doc)&&d!==-1}function b(j){let v=j.nodeDOM(d);return v=gt(j,v),v===j.dom||(v==null?void 0:v.nodeType)!==1?null:v}function S(j,v){const C=j.posAtDOM(v,0),w=ht(n.state.doc,C);if(w===c)return;const E=mt(n.state.doc,C);c=w,d=E,i==null||i({editor:n,node:c,pos:d}),I(v)}function I(j){l.setProps({getReferenceClientRect:()=>j.getBoundingClientRect()}),l.show()}function P(){l==null||l.destroy(),t&&ft(s)}},props:{handleDOMEvents:{mouseleave:(m,f)=>{if(u||!h(f))return!1;return p(),x(),!1;function h(y){return y.target&&!s.contains(y.relatedTarget)}function p(){l==null||l.hide()}function x(){c=null,d=-1,i==null||i({editor:n,node:null,pos:-1})}},mousemove:a.debounce((m,f)=>{if(!t||!l||u)return!1;const h=rn({x:f.clientX,y:f.clientY,direction:"right",editor:n});if(!h.resultElement||h.resultElement===m.dom)return!1;const p=gt(m,h.resultElement);if(p===m.dom||(p==null?void 0:p.nodeType)!==1)return!1;const x=m.posAtDOM(p,0),y=ht(n.state.doc,x);if(y===c)return!1;const b=mt(n.state.doc,x);return c=y,d=b,i==null||i({editor:n,node:c,pos:d}),l.setProps({getReferenceClientRect:()=>p.getBoundingClientRect()}),l.show(),!1},100)}}})}function da(e){var E,N,O;const{pluginKey:t=on}=e,{t:n}=A.useLocale(),[r,i]=g.useState(null),[s,l]=g.useState(-1),u=g.useRef(null),c=g.useRef(null),[d,m]=g.useState(!1),f=e.editor.extensionManager.extensions.some(T=>T.name==="textAlign"),h=e.editor.extensionManager.extensions.some(T=>T.name==="indent"),p=e.editor.extensionManager.extensions.some(T=>T.name==="clear");g.useEffect(()=>{u.current&&!e.editor.isDestroyed&&(c.current=ua({editor:e.editor,element:u.current,pluginKey:"ContentItemMenu",tippyOptions:{offset:[-2,16],zIndex:99,moveTransition:"transform 0.15s ease-out"},onNodeChange:v}),e.editor.registerPlugin(c.current))},[e.editor,u]);function x(){const T=e.editor.chain();T.setNodeSelection(s).unsetAllMarks(),(r==null?void 0:r.type.name)!=="paragraph"&&T.setParagraph(),T.run()}function y(){e.editor.chain().focus().setNodeSelection(s).run(),document.execCommand("copy")}function b(){e.editor.commands.setNodeSelection(s);const{$anchor:T}=e.editor.state.selection,oe=T.node(1)||e.editor.state.selection.node;e.editor.chain().setMeta("hideDragHandle",!0).insertContentAt(s+((r==null?void 0:r.nodeSize)||0),oe.toJSON()).run()}function S(T){e.editor.commands.setTextAlign(T)}function I(){const T=a.setNodeIndentMarkup(e.editor.state.tr,s,1);T.setMeta("hideDragHandle",!0),e.editor.view.dispatch&&e.editor.view.dispatch(T)}function P(){const T=a.setNodeIndentMarkup(e.editor.state.tr,s,-1);e.editor.view.dispatch&&e.editor.view.dispatch(T)}function j(){e.editor.chain().setMeta("hideDragHandle",!0).setNodeSelection(s).deleteSelection().run()}function v(T){T.node&&i(T.node),l(T.pos)}function C(){var T;if(s!==-1){const oe=(r==null?void 0:r.nodeSize)||0,Be=s+oe,De=(r==null?void 0:r.type.name)==="paragraph"&&((T=r==null?void 0:r.content)==null?void 0:T.size)===0,dn=De?s+2:Be+2;e.editor.chain().command(({dispatch:Me,tr:ie,state:ke})=>Me?(De?ie.insertText("/",s,s+1):ie.insert(Be,ke.schema.nodes.paragraph.create(null,[ke.schema.text("/")])),Me(ie)):!0).focus(dn).run()}}g.useEffect(()=>(d?e.editor.commands.setMeta("lockDragHandle",!0):e.editor.commands.setMeta("lockDragHandle",!1),()=>{e.editor.commands.setMeta("lockDragHandle",!1)}),[d]),g.useEffect(()=>()=>{c.current&&(e.editor.unregisterPlugin(t),c.current=null)},[]),g.useEffect(()=>{var T;(T=e.editor)!=null&&T.isDestroyed&&c.current&&(e.editor.unregisterPlugin(t),c.current=null)},[(E=e.editor)==null?void 0:E.isDestroyed]);const w=T=>{e!=null&&e.disabled||m(T)};return o.jsx("div",{ref:u,className:`drag-handle duration-200 ease-in-out [transition-property:top,_left] ${e==null?void 0:e.className}`,style:{opacity:e!=null&&e.disabled?0:1},children:o.jsxs("div",{className:"flex items-center gap-0.5 duration-200 ease-in-out [transition-property:top,_left]",children:[o.jsx(a.Button,{className:"!size-7 cursor-grab",disabled:e==null?void 0:e.disabled,onClick:C,size:"icon",type:"button",variant:"ghost",children:o.jsx(a.IconComponent,{className:"text-lg text-neutral-600 dark:text-neutral-200",name:"Plus"})}),o.jsxs(a.DropdownMenu,{onOpenChange:w,open:d,children:[o.jsxs("div",{className:"relative flex flex-col",children:[o.jsxs(a.Tooltip,{children:[o.jsx(a.TooltipTrigger,{asChild:!0,disabled:e==null?void 0:e.disabled,children:o.jsx(a.Button,{className:"relative z-[1] !size-7 cursor-grab",disabled:e==null?void 0:e.disabled,size:"icon",type:"button",variant:"ghost",onMouseUp:T=>{T.preventDefault(),!(e!=null&&e.disabled)&&m(!0)},children:o.jsx(a.IconComponent,{className:"text-sm text-neutral-600 dark:text-neutral-200",name:"Grip"})})}),o.jsx(a.TooltipContent,{children:n("editor.draghandle.tooltip")})]}),o.jsx(a.DropdownMenuTrigger,{className:"absolute left-0 top-0 z-0 size-[28px]"})]}),o.jsxs(a.DropdownMenuContent,{align:"start",className:"w-48",side:"bottom",sideOffset:0,children:[o.jsxs(a.DropdownMenuItem,{className:"flex gap-3 bg-opacity-10 hover:bg-red-400 hover:bg-opacity-20 focus:bg-red-400 focus:bg-opacity-30 focus:text-red-500 dark:hover:bg-opacity-20 dark:hover:text-red-500",onClick:j,children:[o.jsx(a.IconComponent,{name:"Trash2"}),o.jsx("span",{children:n("editor.remove")})]}),p?o.jsxs(a.DropdownMenuItem,{className:"flex gap-3",onClick:x,children:[o.jsx(a.IconComponent,{name:"PaintRoller"}),o.jsx("span",{children:n("editor.clear.tooltip")})]}):null,o.jsxs(a.DropdownMenuItem,{className:"flex gap-3",onClick:y,children:[o.jsx(a.IconComponent,{name:"Clipboard"}),o.jsx("span",{children:n("editor.copyToClipboard")})]}),o.jsxs(a.DropdownMenuItem,{className:"flex gap-3",onClick:b,children:[o.jsx(a.IconComponent,{name:"Copy"}),o.jsx("span",{children:n("editor.copy")})]}),f||h?o.jsx(a.DropdownMenuSeparator,{}):null,f?o.jsxs(a.DropdownMenuSub,{children:[o.jsxs(a.DropdownMenuSubTrigger,{className:"flex gap-3",children:[o.jsx(a.IconComponent,{name:"AlignCenter"}),o.jsx("span",{children:n("editor.textalign.tooltip")})]}),o.jsx(a.DropdownMenuPortal,{children:o.jsxs(a.DropdownMenuSubContent,{children:[o.jsxs(a.DropdownMenuItem,{className:"flex gap-3",onClick:()=>S("left"),children:[o.jsx(a.IconComponent,{name:"AlignLeft"}),o.jsx("span",{children:n("editor.textalign.left.tooltip")})]}),o.jsxs(a.DropdownMenuItem,{className:"flex gap-3",onClick:()=>S("center"),children:[o.jsx(a.IconComponent,{name:"AlignCenter"}),o.jsx("span",{children:n("editor.textalign.center.tooltip")})]}),o.jsxs(a.DropdownMenuItem,{className:"flex gap-3",onClick:()=>S("right"),children:[o.jsx(a.IconComponent,{name:"AlignRight"}),o.jsx("span",{children:n("editor.textalign.right.tooltip")})]})]})})]}):null,h?o.jsxs(a.DropdownMenuSub,{children:[o.jsxs(a.DropdownMenuSubTrigger,{className:"flex gap-3",children:[o.jsx(a.IconComponent,{name:"IndentIncrease"}),o.jsx("span",{children:n("editor.indent")})]}),o.jsx(a.DropdownMenuPortal,{children:o.jsxs(a.DropdownMenuSubContent,{children:[o.jsxs(a.DropdownMenuItem,{className:"flex gap-3",disabled:((N=r==null?void 0:r.attrs)==null?void 0:N.indent)>=a.IndentProps.max,onClick:I,children:[o.jsx(a.IconComponent,{name:"IndentIncrease"}),o.jsx("span",{children:n("editor.indent.tooltip")})]}),o.jsxs(a.DropdownMenuItem,{className:"flex gap-3",disabled:((O=r==null?void 0:r.attrs)==null?void 0:O.indent)<=a.IndentProps.min,onClick:P,children:[o.jsx(a.IconComponent,{name:"IndentDecrease"}),o.jsx("span",{children:n("editor.outdent.tooltip")})]})]})})]}):null]})]})]})})}function sn({item:e,disabled:t,editor:n}){var i;const r=e.component;return r?o.jsx(r,{...e.componentProps,disabled:t||((i=e==null?void 0:e.componentProps)==null?void 0:i.disabled),editor:n}):o.jsx(o.Fragment,{})}function fa(e){const{t,lang:n}=A.useLocale(),r=s=>{var m;const{editor:l}=s,{selection:u}=l.view.state,{$from:c,to:d}=u;return c.pos===d?!1:u instanceof a.TextSelection||(((m=e.showShow)==null?void 0:m.call(e,s))??!1)},i=g.useMemo(()=>e.disabled||!(e!=null&&e.editor)?[]:nn(e.editor,t,e.items).filter(s=>e.filterItem?e.filterItem(s,e.editor):!0),[e.disabled,e.editor,e.items,e.filterItem,n,t]);return o.jsx(a.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:r,tippyOptions:{maxWidth:"auto",zIndex:20,moveTransition:"transform 0.1s ease-out",placement:"bottom"},children:i!=null&&i.length?o.jsx("div",{className:"pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800",children:o.jsx("div",{className:"relative flex h-[26px] flex-nowrap items-center justify-start gap-[4px] whitespace-nowrap",children:i==null?void 0:i.map((s,l)=>(s==null?void 0:s.type)==="divider"?o.jsx(a.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"},`bubbleMenu-divider-${l}`):o.jsx(sn,{disabled:e.disabled,editor:e.editor,item:s},`bubbleMenu-text-${l}`))})}):o.jsx(o.Fragment,{})})}function Ne({children:e,vertical:t}){return o.jsx("div",{className:"pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800",children:o.jsx("div",{className:`relative flex h-[26px] flex-nowrap items-center justify-start gap-[4px] whitespace-nowrap ${t?"h-max flex-col":""}`,children:e})})}function ma({editor:e,disabled:t}){var u,c,d,m,f,h;const{t:n}=A.useLocale(),r=g.useCallback(({view:p,state:x,from:y})=>!x||!y?!1:a.isRowGripSelected({editor:e,view:p,state:x,from:y}),[e]);function i(){e.chain().focus().addRowBefore().run()}function s(){e.chain().focus().addRowAfter().run()}function l(){e.chain().focus().deleteRow().run()}return t?null:o.jsx(a.BubbleMenu,{editor:e,pluginKey:"tableRowMenu",shouldShow:r,updateDelay:0,tippyOptions:{placement:"left",offset:[0,15],popperOptions:{modifiers:[{name:"flip",enabled:!1}]}},children:o.jsxs(Ne,{vertical:!0,children:[o.jsx(a.ActionButton,{action:i,disabled:!((c=e==null?void 0:(u=e.can()).addRowBefore)!=null&&c.call(u)),icon:"BetweenVerticalEnd",tooltip:n("editor.table.menu.insertRowAbove"),"tooltip-options":{sideOffset:15}}),o.jsx(a.ActionButton,{action:s,disabled:!((m=(d=e==null?void 0:e.can())==null?void 0:d.addRowAfter)!=null&&m.call(d)),icon:"BetweenVerticalStart",tooltip:n("editor.table.menu.insertRowBelow"),"tooltip-options":{sideOffset:15}}),o.jsx(a.ActionButton,{action:l,disabled:!((h=(f=e==null?void 0:e.can())==null?void 0:f.deleteRow)!=null&&h.call(f)),icon:"DeleteRow",tooltip:n("editor.table.menu.deleteRow"),"tooltip-options":{sideOffset:15}})]})})}function ha({editor:e,disabled:t}){var u,c,d,m,f,h;const{t:n}=A.useLocale(),r=g.useCallback(({view:p,state:x,from:y})=>x?a.isColumnGripSelected({editor:e,view:p,state:x,from:y||0}):!1,[e]);function i(){e.chain().focus().addColumnBefore().run()}function s(){e.chain().focus().addColumnAfter().run()}function l(){e.chain().focus().deleteColumn().run()}return t?null:o.jsx(a.BubbleMenu,{editor:e,pluginKey:"tableColumnMenu",shouldShow:r,updateDelay:0,tippyOptions:{offset:[0,15],popperOptions:{modifiers:[{name:"flip",enabled:!1}]}},children:o.jsxs(Ne,{children:[o.jsx(a.ActionButton,{action:i,disabled:!((c=(u=e==null?void 0:e.can())==null?void 0:u.addColumnBefore)!=null&&c.call(u)),icon:"BetweenHorizonalEnd",tooltip:n("editor.table.menu.insertColumnBefore"),"tooltip-options":{sideOffset:15}}),o.jsx(a.ActionButton,{action:s,disabled:!((m=(d=e==null?void 0:e.can())==null?void 0:d.addColumnAfter)!=null&&m.call(d)),icon:"BetweenHorizonalStart",tooltip:n("editor.table.menu.insertColumnAfter"),"tooltip-options":{sideOffset:15}}),o.jsx(a.ActionButton,{action:l,disabled:!((h=e==null?void 0:(f=e.can()).deleteColumn)!=null&&h.call(f)),icon:"DeleteColumn",tooltip:n("editor.table.menu.deleteColumn"),"tooltip-options":{sideOffset:15}})]})})}function ga({editor:e,disabled:t,actions:n,...r}){var y,b,S,I,P,j;const i=({editor:v,view:C,state:w,from:E})=>{const{selection:N}=v.view.state,{$from:O,to:T}=N;return O.pos===T||!w||!E?!1:N instanceof a.TextSelection||a.isRowGripSelected({editor:v,view:C,state:w,from:E})||a.isColumnGripSelected({editor:v,view:C,state:w,from:E})},s=({editor:v})=>a.isActive(v.view.state,"table"),l=v=>s(v)&&!i(v),{t:u,lang:c}=A.useLocale();function d(){e.chain().focus().mergeCells().run()}function m(){e==null||e.chain().focus().splitCell().run()}function f(){e.chain().focus().deleteTable().run()}function h(v){e.chain().focus().setTableCellBackground(v).run()}const p=()=>{var O;const{view:v,state:{selection:{from:C}}}=e,w=v.domAtPos(C).node;if(!w)return new DOMRect(-1e3,-1e3,0,0);const E=(O=w==null?void 0:w.closest)==null?void 0:O.call(w,".tableWrapper");return E?E.getBoundingClientRect():new DOMRect(-1e3,-1e3,0,0)},x=g.useMemo(()=>t||!e?[]:nn(e,u,r.items||[]),[t,e,r.items,c,u]);return t?null:o.jsx(a.BubbleMenu,{editor:e,pluginKey:"table",shouldShow:l,updateDelay:0,tippyOptions:{offset:[0,15],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},maxWidth:"auto",getReferenceClientRect:p,plugins:[vt.sticky],sticky:"popper"},children:o.jsxs(Ne,{children:[n&&o.jsxs(o.Fragment,{children:[n.map((v,C)=>o.jsx(a.ActionButton,{...v},C)),o.jsx(a.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"})]}),r.items&&o.jsxs(o.Fragment,{children:[x.map((v,C)=>o.jsx(sn,{disabled:t,editor:e,item:v},C)),o.jsx(a.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"})]}),o.jsx(a.ActionButton,{action:d,disabled:!((b=(y=e==null?void 0:e.can())==null?void 0:y.mergeCells)!=null&&b.call(y)),icon:"TableCellsMerge",tooltip:u("editor.table.menu.mergeCells"),"tooltip-options":{sideOffset:15}}),o.jsx(a.ActionButton,{action:m,disabled:!((I=(S=e==null?void 0:e.can())==null?void 0:S.splitCell)!=null&&I.call(S)),icon:"TableCellsSplit",tooltip:u("editor.table.menu.splitCells"),"tooltip-options":{sideOffset:15}}),o.jsx(a.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"}),o.jsx(a.HighlightActionButton,{action:h,editor:e,tooltip:u("editor.table.menu.setCellsBgColor"),tooltipOptions:{sideOffset:15}}),o.jsx(a.ActionButton,{action:f,disabled:!((j=(P=e==null?void 0:e.can())==null?void 0:P.deleteTable)!=null&&j.call(P)),icon:"Trash2",tooltip:u("editor.table.menu.deleteTable"),"tooltip-options":{sideOffset:15}})]})})}function pa(e){return o.jsxs(o.Fragment,{children:[o.jsx(ga,{...e}),o.jsx(ma,{...e}),o.jsx(ha,{...e})]})}function xa(e){const{t}=A.useLocale();return o.jsxs("div",{className:"flex items-center gap-2 p-2 bg-white !border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800",children:[o.jsx("a",{href:e==null?void 0:e.link,target:"_blank",rel:"noopener noreferrer",className:"text-sm underline break-all",children:Is(e==null?void 0:e.link,{length:50,omission:"…"})}),(e==null?void 0:e.link)&&o.jsx(a.Separator,{orientation:"vertical",className:"!h-4"}),o.jsxs("div",{className:"flex flex-nowrap",children:[o.jsx(a.ActionButton,{icon:"Pencil",tooltip:t("editor.link.edit.tooltip"),action:()=>{e==null||e.onEdit()},tooltipOptions:{sideOffset:15}}),o.jsx(a.ActionButton,{icon:"Unlink",tooltip:t("editor.link.unlink.tooltip"),action:()=>{e==null||e.onClear()},tooltipOptions:{sideOffset:15}})]})]})}function va({editor:e,disabled:t}){const[n,r]=g.useState(!1),i=g.useMemo(()=>{const{href:c}=e.getAttributes("link");return c},[e]),s=g.useCallback(({editor:c})=>c.isActive("link"),[]),l=(c,d,m)=>{e.chain().extendMarkRange("link").insertContent({type:"text",text:d,marks:[{type:"link",attrs:{href:c,target:m?"_blank":""}}]}).setLink({href:c}).focus().run(),r(!1)},u=g.useCallback(()=>{e.chain().extendMarkRange("link").unsetLink().focus().run(),r(!1)},[e]);return o.jsx(o.Fragment,{children:o.jsx(a.BubbleMenu,{editor:e,shouldShow:s,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{r(!1)}},children:t?o.jsx(o.Fragment,{}):o.jsx(o.Fragment,{children:n?o.jsx(a.LinkEditBlock,{onSetLink:l,editor:e}):o.jsx(xa,{editor:e,onClear:u,onEdit:()=>{r(!0)},link:i})})})})}const Oe={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"};function Re({item:e,disabled:t,editor:n}){var i;const r=e.component;return r?o.jsx(g.Fragment,{children:e.type==="divider"?o.jsx(a.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"}):o.jsx(r,{...e.componentProps,disabled:t||((i=e==null?void 0:e.componentProps)==null?void 0:i.disabled),editor:n})}):o.jsx(o.Fragment,{})}function ya(e){return e.type.name===a.Image.name}function wa(e){return e.type.name===a.ImageGif.name}function ba(e){return e.type.name===a.Video.name}function ja(e){const{lang:t}=A.useLocale(),n=({editor:i})=>{const{selection:s}=i.view.state,{$from:l,to:u}=s;let c=!1;return i.view.state.doc.nodesBetween(l.pos,u,d=>{if(ya(d))return c=!0,!1}),c},r=g.useMemo(()=>e.disabled?[]:na(e.editor),[e.disabled,e.editor,t]);return o.jsx(o.Fragment,{children:o.jsx(a.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:n,tippyOptions:Oe,children:r!=null&&r.length?o.jsx("div",{className:"pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800",children:o.jsx("div",{className:"relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap",children:r==null?void 0:r.map((i,s)=>o.jsx(Re,{disabled:e.disabled,editor:e.editor,item:i},`bubbleMenu-image-${s}`))})}):o.jsx(o.Fragment,{})})})}function Aa(e){const{lang:t}=A.useLocale(),n=({editor:i})=>{const{selection:s}=i.view.state,{$from:l,to:u}=s;let c=!1;return i.view.state.doc.nodesBetween(l.pos,u,d=>{if(wa(d))return c=!0,!1}),c},r=g.useMemo(()=>e.disabled?[]:ra(e.editor),[e.disabled,e.editor,t]);return o.jsx(o.Fragment,{children:o.jsx(a.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:n,tippyOptions:Oe,children:r!=null&&r.length?o.jsx("div",{className:"pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800",children:o.jsx("div",{className:"relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap",children:r==null?void 0:r.map((i,s)=>o.jsx(Re,{disabled:e.disabled,editor:e.editor,item:i},`bubbleMenu-image-gif-${s}`))})}):o.jsx(o.Fragment,{})})})}function Ca(e){const{lang:t}=A.useLocale(),n=({editor:i})=>{const{selection:s}=i.view.state,{$from:l,to:u}=s;let c=!1;return i.view.state.doc.nodesBetween(l.pos,u,d=>{if(ba(d))return c=!0,!1}),c},r=g.useMemo(()=>e.disabled?[]:sa(e.editor),[e.editor,e.disabled,t]);return o.jsx(o.Fragment,{children:o.jsx(a.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:n,tippyOptions:Oe,children:r!=null&&r.length?o.jsx("div",{className:"pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800",children:o.jsx("div",{className:"relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap",children:r==null?void 0:r.map((i,s)=>o.jsx(Re,{disabled:e.disabled,editor:e.editor,item:i},`bubbleMenu-video-${s}`))})}):o.jsx(o.Fragment,{})})})}function Sa({editor:e}){const{t}=A.useLocale(),n=g.useCallback(()=>e.isActive(a.MultiColumn.name),[e]),r=g.useCallback(()=>a.deleteNode(a.MultiColumn.name,e),[e]),i=g.useCallback(()=>e.chain().focus().addColBefore().run(),[e]),s=g.useCallback(()=>e.chain().focus().addColAfter().run(),[e]),l=g.useCallback(()=>e.chain().focus().deleteCol().run(),[e]);return o.jsx(a.BubbleMenu,{pluginKey:"columns-bubble-menu",editor:e,shouldShow:n,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999},children:o.jsxs("div",{className:"w-auto px-3 py-2 transition-all !border rounded-sm shadow-sm pointer-events-auto select-none border-neutral-200 dark:border-neutral-800 bg-background",children:[o.jsx(a.ActionButton,{action:i,icon:"ColumnAddLeft",tooltip:t("editor.table.menu.insertColumnBefore")}),o.jsx(a.ActionButton,{action:s,icon:"ColumnAddRight",tooltip:t("editor.table.menu.insertColumnAfter")}),o.jsx(a.ActionButton,{action:l,icon:"DeleteColumn",tooltip:t("editor.table.menu.deleteColumn")}),o.jsx(a.ActionButton,{action:r,icon:"Trash2",tooltip:t("editor.table.menu.delete_column")})]})})}function Ta({editor:e,extensions:t}){const{t:n}=A.useLocale(),r=g.useMemo(()=>{var i,s,l;return(l=(s=(i=t==null?void 0:t.find(u=>u.name==="base-kit"))==null?void 0:i.options)==null?void 0:s.characterCount)==null?void 0:l.limit},[t]);return r?o.jsx("div",{className:"flex items-center justify-between p-3 border-t",children:o.jsx("div",{className:"flex flex-col",children:o.jsx("div",{className:"flex justify-end gap-3 text-sm",children:o.jsxs("span",{children:[e.storage.characterCount.characters(),"/",r," ",n("editor.characters")]})})})}):o.jsx("div",{className:"flex items-center justify-between p-3 border-t",children:o.jsx("div",{className:"flex flex-col",children:o.jsx("div",{className:"flex justify-end gap-3 text-sm",children:o.jsxs("span",{children:[e.storage.characterCount.characters()," ",n("editor.characters")]})})})})}function Ea(){const{toasts:e}=a.useToast();return o.jsxs(Ps,{children:[e.map(({id:t,title:n,description:r,action:i,...s})=>o.jsxs(Zt,{...s,children:[o.jsxs("div",{className:"grid gap-1",children:[n&&o.jsx(Qt,{children:n}),r&&o.jsx(en,{children:r})]}),i,o.jsx(Jt,{})]},t)),o.jsx(Yt,{})]})}const Ia=`
|
|
3
3
|
.reactjs-tiptap-editor,
|
|
4
4
|
.dialog-content {
|
|
5
5
|
button,
|
|
@@ -137,4 +137,4 @@ div[data-tippy-root] {
|
|
|
137
137
|
color: inherit;
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
`,
|
|
140
|
+
`,Pa=g.memo(({children:e,id:t})=>{const[,n]=a.useStoreEditableEditor(l=>l.value),[,r]=a.useStoreTheme(l=>l.value),i=l=>{n({value:l.detail})},s=l=>{r({value:l.detail})};return g.useEffect(()=>{const l=a.listenEvent(a.EVENTS.EDIT(t),i),u=a.listenEvent(a.EVENTS.UPDATE_THEME(t),s);return()=>{l(),u()}},[]),o.jsx(o.Fragment,{children:e})});function _a({children:e,id:t}){return o.jsx(a.ProviderEditableEditor,{children:o.jsx(a.ProviderTheme,{children:o.jsx(Pa,{id:t,children:e})})})}const pt="data-rc-order",xt="data-rc-priority",Na="rc-util-key",we=new Map;function Oa(e,t){if(!e)return!1;if(e.contains)return e.contains(t);let n=t;for(;n;){if(n===e)return!0;n=n.parentNode}return!1}function an({mark:e}={}){return e?e.startsWith("data-")?e:`data-${e}`:Na}function $e(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function Ra(e){return e==="queue"?"prependQueue":e?"prepend":"append"}function ln(e){return[...(we.get(e)||e).children].filter(t=>t.tagName==="STYLE")}function cn(e,t={}){const{csp:n,prepend:r,priority:i=0}=t,s=Ra(r),l=s==="prependQueue",u=document.createElement("style");u.setAttribute(pt,s),l&&i&&u.setAttribute(xt,`${i}`),n!=null&&n.nonce&&(u.nonce=n==null?void 0:n.nonce),u.innerHTML=e;const c=$e(t),{firstChild:d}=c;if(r){if(l){const m=ln(c).filter(f=>{if(!["prepend","prependQueue"].includes(f.getAttribute(pt)))return!1;const h=Number(f.getAttribute(xt)||0);return i>=h});if(m.length>0)return c.insertBefore(u,m.at(-1).nextSibling),u}d.before(u)}else c.append(u);return u}function un(e,t={}){const n=$e(t);return ln(n).find(r=>r.getAttribute(an(t))===e)}function $a(e,t={}){const n=un(e,t);n&&n.remove()}function Ba(e,t){const n=we.get(e);if(!n||!Oa(document,n)){const r=cn("",t),{parentNode:i}=r;we.set(e,i),r.remove()}}function Da(e,t,n={}){var l,u,c;const r=$e(n);Ba(r,n);const i=un(t,n);if(i)return(l=n.csp)!=null&&l.nonce&&i.nonce!==((u=n.csp)==null?void 0:u.nonce)&&(i.nonce=(c=n.csp)==null?void 0:c.nonce),i.innerHTML!==e&&(i.innerHTML=e),i;const s=cn(e,n);return s.setAttribute(an(n),t),s}function Ma(e,t){const{content:n,extensions:r,useEditorOptions:i={}}=e,s=g.useId(),l=g.useMemo(()=>{const f=as(r,r,"name");return[...r.map(p=>{const x=r.find(y=>y.name===p.name);return x?p.configure(x.options):p}),...f].map((p,x)=>p.configure({sort:x}))},[r]),u=a.throttle(f=>{var p;const h=d(f,e.output);(p=e==null?void 0:e.onChangeContent)==null||p.call(e,h)},A.EDITOR_UPDATE_WATCH_THROTTLE_WAIT_TIME),c=a.useEditor({extensions:l,content:n,onUpdate:({editor:f})=>{u&&u(f)},...i});g.useImperativeHandle(t,()=>({editor:c})),g.useEffect(()=>{document.documentElement.classList.toggle("dark",e.dark),a.themeActions.setTheme(s,e.dark?"dark":"light")},[e.dark]),g.useEffect(()=>{c==null||c.setEditable(!(e!=null&&e.disabled)),a.editableEditorActions.setDisable(s,!(e!=null&&e.disabled))},[c,e==null?void 0:e.disabled]),g.useEffect(()=>((e==null?void 0:e.resetCSS)!==!1&&Da(Ia,"react-tiptap-reset"),()=>{$a("react-tiptap-reset")}),[e==null?void 0:e.resetCSS]);function d(f,h){return e!=null&&e.removeDefaultWrapper?h==="html"?f.isEmpty?"":f.getHTML():h==="json"?f.isEmpty?{}:f.getJSON():h==="text"?f.isEmpty?"":f.getText():"":h==="html"?f.getHTML():h==="json"?f.getJSON():h==="text"?f.getText():""}g.useLayoutEffect(()=>{c&&(c.id=s)},[s,c]),g.useEffect(()=>()=>{var f;(f=c==null?void 0:c.destroy)==null||f.call(c)},[]);const m=a.hasExtension(c,"characterCount");return c?o.jsxs("div",{className:"reactjs-tiptap-editor",children:[o.jsx(_a,{id:s,children:o.jsx(a.TooltipProvider,{delayDuration:0,disableHoverableContent:!0,children:o.jsx("div",{className:"overflow-hidden rounded-[0.5rem] bg-background",children:o.jsxs("div",{className:"flex max-h-full w-full flex-col",children:[!(e!=null&&e.hideToolbar)&&o.jsx(qs,{disabled:!!(e!=null&&e.disabled),editor:c,toolbar:e.toolbar}),o.jsx(a.EditorContent,{className:`relative ${(e==null?void 0:e.contentClass)||""}`,editor:c}),m&&o.jsx(Ta,{editor:c,extensions:r}),!(e!=null&&e.hideBubble)&&o.jsx(Vs,{bubbleMenu:e==null?void 0:e.bubbleMenu,disabled:e==null?void 0:e.disabled,editor:c})]})})})}),o.jsx(Ea,{})]}):o.jsx(o.Fragment,{})}const ka=g.forwardRef(Ma);exports.ActionButton=a.ActionButton;exports.BubbleMenu=a.BubbleMenu;exports.default=ka;exports.useEditorState=pn;
|