wysimark-lite 0.25.23 → 0.25.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -34,7 +34,7 @@
34
34
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
35
35
  Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
36
36
  box-sizing: border-box;
37
- `;import{jsx as Rd}from"react/jsx-runtime";function ti(e){let t=Sd();Pd(()=>{Cd.normalize(t,{force:!0})},[t]);let{plugins:o}=t.sink,r=ei(()=>({...e,decorate:Wn(e.decorate,o),renderElement:Yn(e.renderElement,o),renderLeaf:Jn(e.renderLeaf,o),renderPlaceholder:Zn(e.renderPlaceholder,o),onKeyDown:qn(e.onKeyDown,o),onKeyUp:Qn(e.onKeyUp,o),onPaste:Xn(e.onPaste,o),onDrop:jn(e.onDrop,o)}),[e.decorate,e.renderElement,e.renderLeaf,e.renderPlaceholder,e.onKeyDown,e.onKeyUp,e.onPaste,e.onDrop,e.placeholder,e.className,o]),n=ei(()=>Gn(o),[o]);return Rd(n,{...r})}function He(e,t,o){let r=e[t],n=o.filter(i=>i.editor?.[t]);return function(a){for(let m of n){let c=m.editor?.[t],d=c?.(a);if(typeof d=="boolean")return d}return r(a)}}function me(e,t,o){let r=e[t],n=o.filter(i=>i.editor?.[t]);return function(...a){let l=!1,m=[];for(let s of n){let c=s.editor?.[t]?.(...a);if(typeof c=="function")m.push(c);else if(c===!0){l=!0;break}}l||r(...a),m.forEach(s=>s())}}function oi(e){return(t,o)=>{let r=t,n=e.map(i=>i(r,o,{createPolicy:a=>a}));return r.sink={plugins:n},r.isMaster="isMaster"in r?r.isMaster:()=>!1,r.isSlave="isSlave"in r?r.isSlave:()=>!1,r.isStandalone="isStandalone"in r?r.isStandalone:()=>!1,Object.assign(r,{normalizeNode:me(r,"normalizeNode",n),deleteBackward:me(r,"deleteBackward",n),deleteForward:me(r,"deleteForward",n),deleteFragment:me(r,"deleteFragment",n),insertBreak:me(r,"insertBreak",n),insertFragment:me(r,"insertFragment",n),insertNode:me(r,"insertNode",n),insertText:me(r,"insertText",n),isInline:He(r,"isInline",n),isVoid:He(r,"isVoid",n),isMaster:He(r,"isMaster",n),isSlave:He(r,"isSlave",n),isStandalone:He(r,"isStandalone",n)}),r}}var ri=e=>{let t=e.map(n=>n.fn);return{withSink:oi(t),SinkEditable:ti}};import{Element as Ld}from"slate";import{ReactEditor as Bd}from"slate-react";function ni(e,t){return Ld.isElement(t)?Bd.findPath(e,t):t}function f(e,t){return e.bind(null,t)}function q(e,t,o){return e.bind(null,t,o)}var zd=/mac os x|macintosh/i,ct;function Lt(){if(ct!==void 0)return ct;try{let{userAgent:e}=window.navigator;ct=zd.test(e)}catch{ct=!1}return ct}function Me(e){e.preventDefault(),e.stopPropagation()}import{Editor as li,Path as Dd}from"slate";import{Element as ii}from"slate";function ai(e){if(typeof e=="function")return e;if(typeof e=="string")return o=>ii.isElement(o)&&o.type===e;if(Array.isArray(e))return o=>ii.isElement(o)&&e.includes(o.type);let t=e;throw new Error(`Expected matchNode to be a function, string or array but is ${t}`)}function x(e,t,{at:o=e.selection}={}){if(o===null)return;let r=ni(e,o),n=ai(t);if(Dd.isPath(r)){let i=li.node(e,r);if(i&&n(i[0]))return i}return li.above(e,{at:r,match:n})}function Ae(...e){return x(...e)?.[1]}import{jsx as Nd}from"react/jsx-runtime";var y=({strokeWidth:e=1.5,...t})=>Nd("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",strokeWidth:e,stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",viewBox:"0 0 24 24",...t});import{Range as $d}from"slate";function ce(e){return e==null?!1:$d.isCollapsed(e)}import{Element as si}from"slate";function Bt(e){return Array.isArray(e)?t=>si.isElement(t)&&e.includes(t.type):t=>si.isElement(t)&&e==t.type}import{Editor as Hd}from"slate";function mi(e,t){let{selection:o}=e;if(!ce(o))return!1;let r=x(e,t,{at:o});return!!r&&Hd.isEnd(e,o.anchor,r[1])}import{Editor as Bv}from"slate";import{Editor as Ad}from"slate";function Pe(e,t){let{selection:o}=e;if(!ce(o))return!1;let r=x(e,t,{at:o});return!!r&&Ad.isStart(e,o.anchor,r[1])}import{isHotkey as ci}from"is-hotkey";import{Editor as zo,Element as Od,Range as Ud,Transforms as Fd}from"slate";var Vd=ci(" "),Kd=ci("SHIFT+SPACE");function pi(e,t){return o=>{if(!Vd(o.nativeEvent)&&!Kd(o.nativeEvent))return!1;let{selection:r}=e;if(r===null||Ud.isExpanded(r))return!1;let n=x(e,s=>Od.isElement(s)&&e.convertElement.isConvertibleElement(s));if(!n)return!1;let i={anchor:zo.start(e,n[1]),focus:r.focus},a=zo.string(e,i),l=t[a];if(!l)return!1;Me(o);let m={anchor:zo.start(e,n[1]),focus:r.focus};return Fd.delete(e,{at:m}),l(),!0}}import{isHotkey as _d}from"is-hotkey";function di(e){let t=e.replace(/\bsuper\b/g,Lt()?"cmd+alt":"ctrl+shift");return _d(t)}function H(e){let t=null;return function(r){t==null&&(t=Object.entries(e).map(([n,i])=>[di(n),i]));for(let[n,i]of t)if(n(r.nativeEvent)){let a=i();if(a===!0||a===void 0)return r.preventDefault(),r.stopPropagation(),!0}return!1}}import{Editor as Wd,Transforms as ui}from"slate";function fi(e,t){Wd.withoutNormalizing(e,()=>{ui.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:"123"},{at:t}),ui.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:null},{at:t})})}import{Editor as hi}from"slate";function xe(e,t,o){let[,r]=t,n=hi.previous(e,{at:r});if(n&&o(n,t))return!0;let i=hi.next(e,{at:r});return!!(i&&o(t,i))}import{Editor as gi,Transforms as bi}from"slate";function Q(e,t){bi.select(e,gi.start(e,t))}function Ei(e,t){bi.select(e,gi.end(e,t))}function xi(e,t){return typeof t!="function"?t:t(e)}import{Editor as Do,Element as Gd,Path as qd,Transforms as pt}from"slate";function yi(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=x(e,n=>Gd.isElement(n)&&e.isMaster(n));if(r==null){let n=e.selection;Do.withoutNormalizing(e,()=>{pt.insertNodes(e,t,{at:o}),n&&(pt.select(e,n),pt.move(e))})}else{let n=qd.next(r[1]);Do.withoutNormalizing(e,()=>{pt.insertNodes(e,t,{at:n}),pt.select(e,Do.start(e,n))})}return!0}import{Editor as ki,Transforms as vi}from"slate";function dt(e,t,o){ki.withoutNormalizing(e,()=>{let r=ki.node(e,o),n=xi(r[0],t);vi.wrapNodes(e,n,{at:o}),vi.unwrapNodes(e,{at:[...o,0]})})}import{Editor as Qd,Transforms as Xd}from"slate";function zt(e,t,o){let r=Array.from(Qd.nodes(e,o));if(r.length===0)return!1;for(let n of r){let[i]=n;Xd.setNodes(e,t(i),{at:n[1]})}return!0}function Ti(e,t){let o=t.clipboardData,{types:r}=o;if(r.length>1||r[0]!=="text/plain")return!1;let n=o.getData("text/plain");return jd(n)?(t.preventDefault(),t.stopPropagation(),e.anchor.insertLink(n),!0):!1}function jd(e){let t;try{t=new URL(e)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"||t.protocol==="mailto:"}import{Editor as Yd,Node as Jd,Transforms as No}from"slate";function wi(e,{href:t,title:o,text:r},{at:n}){let i=x(e,"anchor",{at:n});if(!i)return!1;let[a,l]=i;if(No.setNodes(e,{href:t,title:o},{at:l}),r!==void 0){let m=Jd.string(a);r!==m&&Yd.withoutNormalizing(e,()=>{let s=a.children.length;for(let c=s-1;c>=0;c--)No.removeNodes(e,{at:[...l,c]});No.insertNodes(e,{text:r},{at:[...l,0]})})}return!0}import{Editor as Dt,Element as Zd,Range as eu,Text as tu,Transforms as $o}from"slate";function Ii(e,t,o=t,{select:r=!0,title:n}={}){let i=e.selection||{anchor:Dt.start(e,[0]),focus:Dt.start(e,[0])};if(eu.isCollapsed(i)){if($o.insertNodes(e,{type:"anchor",href:t,title:n,children:[{text:o}]},{select:r,at:i}),r&&e.selection){let a=Dt.node(e,e.selection);$o.select(e,a[1])}}else $o.wrapNodes(e,{type:"anchor",href:t,title:n,children:[]},{split:!0,match:a=>tu.isText(a)||Zd.isElement(a)&&Dt.isInline(e,a)})}import{Transforms as ou}from"slate";function Mi(e,{at:t}){let o=x(e,"anchor",{at:t});return o?(ou.unwrapNodes(e,{at:o[1]}),!0):!1}function Pi(e){return{insertLink:f(Ii,e),removeLink:f(Mi,e),editLink:f(wi,e)}}import{Element as Ci,Transforms as ru}from"slate";function Si(e,t){if(!Ci.isElement(t[0])||t[0].type!=="anchor")return!1;let o=t[0].children;for(let r=0;r<o.length;r++){let n=o[r];if(!(!Ci.isElement(n)||n.type!=="anchor"))return ru.unwrapNodes(e,{at:[...t[1],r]}),!0}return!1}import{clsx as Yu}from"clsx";import{useEffect as Ju,useRef as ga}from"react";import{useSelected as Zu,useSlate as ef}from"slate-react";import{createContext as Li,useState as iu}from"react";import{createPortal as nu}from"react-dom";function Ri({children:e}){return typeof document>"u"||!document.body?null:nu(e,document.body)}import{jsx as Ho,jsxs as lu}from"react/jsx-runtime";var Ao=Li({}),au=Li({});function Bi({children:e}){let[t,o]=iu({});function r(i){o(a=>({...a,[i.type]:i}))}function n(i){o(a=>{let l={...a};return delete l[i],l})}return lu(Ao.Provider,{value:{layers:t,setLayers:o,openLayer:r,closeLayer:n},children:[e,Object.entries(t).map(([,i])=>Ho(Ri,{children:Ho(au.Provider,{value:i,children:Ho(i.Component,{})})},i.type))]})}import{useContext as su}from"react";function O(e){let{openLayer:t,closeLayer:o,layers:r}=su(Ao);function n(a){t({type:e,Component:a})}function i(){o(e)}return{open:n,close:i,layer:r[e],type:e}}import Nt from"@emotion/styled";var zi=Nt("a")`
37
+ `;import{jsx as Rd}from"react/jsx-runtime";function ti(e){let t=Sd();Pd(()=>{Cd.normalize(t,{force:!0})},[t]);let{plugins:o}=t.sink,r=ei(()=>({...e,decorate:Wn(e.decorate,o),renderElement:Yn(e.renderElement,o),renderLeaf:Jn(e.renderLeaf,o),renderPlaceholder:Zn(e.renderPlaceholder,o),onKeyDown:qn(e.onKeyDown,o),onKeyUp:Qn(e.onKeyUp,o),onPaste:Xn(e.onPaste,o),onDrop:jn(e.onDrop,o)}),[e.decorate,e.renderElement,e.renderLeaf,e.renderPlaceholder,e.onKeyDown,e.onKeyUp,e.onPaste,e.onDrop,e.placeholder,e.className,o]),n=ei(()=>Gn(o),[o]);return Rd(n,{...r})}function He(e,t,o){let r=e[t],n=o.filter(i=>i.editor?.[t]);return function(a){for(let m of n){let c=m.editor?.[t],d=c?.(a);if(typeof d=="boolean")return d}return r(a)}}function se(e,t,o){let r=e[t],n=o.filter(i=>i.editor?.[t]);return function(...a){let l=!1,m=[];for(let s of n){let c=s.editor?.[t]?.(...a);if(typeof c=="function")m.push(c);else if(c===!0){l=!0;break}}l||r(...a),m.forEach(s=>s())}}function oi(e){return(t,o)=>{let r=t,n=e.map(i=>i(r,o,{createPolicy:a=>a}));return r.sink={plugins:n},r.isMaster="isMaster"in r?r.isMaster:()=>!1,r.isSlave="isSlave"in r?r.isSlave:()=>!1,r.isStandalone="isStandalone"in r?r.isStandalone:()=>!1,Object.assign(r,{normalizeNode:se(r,"normalizeNode",n),deleteBackward:se(r,"deleteBackward",n),deleteForward:se(r,"deleteForward",n),deleteFragment:se(r,"deleteFragment",n),insertBreak:se(r,"insertBreak",n),insertFragment:se(r,"insertFragment",n),insertNode:se(r,"insertNode",n),insertText:se(r,"insertText",n),isInline:He(r,"isInline",n),isVoid:He(r,"isVoid",n),isMaster:He(r,"isMaster",n),isSlave:He(r,"isSlave",n),isStandalone:He(r,"isStandalone",n)}),r}}var ri=e=>{let t=e.map(n=>n.fn);return{withSink:oi(t),SinkEditable:ti}};import{Element as Ld}from"slate";import{ReactEditor as Bd}from"slate-react";function ni(e,t){return Ld.isElement(t)?Bd.findPath(e,t):t}function f(e,t){return e.bind(null,t)}function q(e,t,o){return e.bind(null,t,o)}var zd=/mac os x|macintosh/i,ct;function Lt(){if(ct!==void 0)return ct;try{let{userAgent:e}=window.navigator;ct=zd.test(e)}catch{ct=!1}return ct}function Me(e){e.preventDefault(),e.stopPropagation()}import{Editor as li,Path as Dd}from"slate";import{Element as ii}from"slate";function ai(e){if(typeof e=="function")return e;if(typeof e=="string")return o=>ii.isElement(o)&&o.type===e;if(Array.isArray(e))return o=>ii.isElement(o)&&e.includes(o.type);let t=e;throw new Error(`Expected matchNode to be a function, string or array but is ${t}`)}function x(e,t,{at:o=e.selection}={}){if(o===null)return;let r=ni(e,o),n=ai(t);if(Dd.isPath(r)){let i=li.node(e,r);if(i&&n(i[0]))return i}return li.above(e,{at:r,match:n})}function Ae(...e){return x(...e)?.[1]}import{jsx as Nd}from"react/jsx-runtime";var y=({strokeWidth:e=1.5,...t})=>Nd("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",strokeWidth:e,stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",viewBox:"0 0 24 24",...t});import{Range as $d}from"slate";function me(e){return e==null?!1:$d.isCollapsed(e)}import{Element as si}from"slate";function Bt(e){return Array.isArray(e)?t=>si.isElement(t)&&e.includes(t.type):t=>si.isElement(t)&&e==t.type}import{Editor as Hd}from"slate";function mi(e,t){let{selection:o}=e;if(!me(o))return!1;let r=x(e,t,{at:o});return!!r&&Hd.isEnd(e,o.anchor,r[1])}import{Editor as B1}from"slate";import{Editor as Ad}from"slate";function Pe(e,t){let{selection:o}=e;if(!me(o))return!1;let r=x(e,t,{at:o});return!!r&&Ad.isStart(e,o.anchor,r[1])}import{isHotkey as ci}from"is-hotkey";import{Editor as zo,Element as Od,Range as Ud,Transforms as Fd}from"slate";var Vd=ci(" "),Kd=ci("SHIFT+SPACE");function pi(e,t){return o=>{if(!Vd(o.nativeEvent)&&!Kd(o.nativeEvent))return!1;let{selection:r}=e;if(r===null||Ud.isExpanded(r))return!1;let n=x(e,s=>Od.isElement(s)&&e.convertElement.isConvertibleElement(s));if(!n)return!1;let i={anchor:zo.start(e,n[1]),focus:r.focus},a=zo.string(e,i),l=t[a];if(!l)return!1;Me(o);let m={anchor:zo.start(e,n[1]),focus:r.focus};return Fd.delete(e,{at:m}),l(),!0}}import{isHotkey as _d}from"is-hotkey";function di(e){let t=e.replace(/\bsuper\b/g,Lt()?"cmd+alt":"ctrl+shift");return _d(t)}function H(e){let t=null;return function(r){t==null&&(t=Object.entries(e).map(([n,i])=>[di(n),i]));for(let[n,i]of t)if(n(r.nativeEvent)){let a=i();if(a===!0||a===void 0)return r.preventDefault(),r.stopPropagation(),!0}return!1}}import{Editor as Wd,Transforms as ui}from"slate";function fi(e,t){Wd.withoutNormalizing(e,()=>{ui.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:"123"},{at:t}),ui.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:null},{at:t})})}import{Editor as hi}from"slate";function xe(e,t,o){let[,r]=t,n=hi.previous(e,{at:r});if(n&&o(n,t))return!0;let i=hi.next(e,{at:r});return!!(i&&o(t,i))}import{Editor as gi,Transforms as bi}from"slate";function Q(e,t){bi.select(e,gi.start(e,t))}function Ei(e,t){bi.select(e,gi.end(e,t))}function xi(e,t){return typeof t!="function"?t:t(e)}import{Editor as Do,Element as Gd,Path as qd,Transforms as pt}from"slate";function yi(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=x(e,n=>Gd.isElement(n)&&e.isMaster(n));if(r==null){let n=e.selection;Do.withoutNormalizing(e,()=>{pt.insertNodes(e,t,{at:o}),n&&(pt.select(e,n),pt.move(e))})}else{let n=qd.next(r[1]);Do.withoutNormalizing(e,()=>{pt.insertNodes(e,t,{at:n}),pt.select(e,Do.start(e,n))})}return!0}import{Editor as ki,Transforms as vi}from"slate";function dt(e,t,o){ki.withoutNormalizing(e,()=>{let r=ki.node(e,o),n=xi(r[0],t);vi.wrapNodes(e,n,{at:o}),vi.unwrapNodes(e,{at:[...o,0]})})}import{Editor as Qd,Transforms as Xd}from"slate";function zt(e,t,o){let r=Array.from(Qd.nodes(e,o));if(r.length===0)return!1;for(let n of r){let[i]=n;Xd.setNodes(e,t(i),{at:n[1]})}return!0}function Ti(e,t){let o=t.clipboardData,{types:r}=o;if(r.length>1||r[0]!=="text/plain")return!1;let n=o.getData("text/plain");return jd(n)?(t.preventDefault(),t.stopPropagation(),e.anchor.insertLink(n),!0):!1}function jd(e){let t;try{t=new URL(e)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"||t.protocol==="mailto:"}import{Editor as Yd,Node as Jd,Transforms as No}from"slate";function wi(e,{href:t,title:o,text:r},{at:n}){let i=x(e,"anchor",{at:n});if(!i)return!1;let[a,l]=i;if(No.setNodes(e,{href:t,title:o},{at:l}),r!==void 0){let m=Jd.string(a);r!==m&&Yd.withoutNormalizing(e,()=>{let s=a.children.length;for(let c=s-1;c>=0;c--)No.removeNodes(e,{at:[...l,c]});No.insertNodes(e,{text:r},{at:[...l,0]})})}return!0}import{Editor as Dt,Element as Zd,Range as eu,Text as tu,Transforms as $o}from"slate";function Ii(e,t,o=t,{select:r=!0,title:n}={}){let i=e.selection||{anchor:Dt.start(e,[0]),focus:Dt.start(e,[0])};if(eu.isCollapsed(i)){if($o.insertNodes(e,{type:"anchor",href:t,title:n,children:[{text:o}]},{select:r,at:i}),r&&e.selection){let a=Dt.node(e,e.selection);$o.select(e,a[1])}}else $o.wrapNodes(e,{type:"anchor",href:t,title:n,children:[]},{split:!0,match:a=>tu.isText(a)||Zd.isElement(a)&&Dt.isInline(e,a)})}import{Transforms as ou}from"slate";function Mi(e,{at:t}){let o=x(e,"anchor",{at:t});return o?(ou.unwrapNodes(e,{at:o[1]}),!0):!1}function Pi(e){return{insertLink:f(Ii,e),removeLink:f(Mi,e),editLink:f(wi,e)}}import{Element as Ci,Transforms as ru}from"slate";function Si(e,t){if(!Ci.isElement(t[0])||t[0].type!=="anchor")return!1;let o=t[0].children;for(let r=0;r<o.length;r++){let n=o[r];if(!(!Ci.isElement(n)||n.type!=="anchor"))return ru.unwrapNodes(e,{at:[...t[1],r]}),!0}return!1}import{clsx as Yu}from"clsx";import{useEffect as Ju,useRef as ga}from"react";import{useSelected as Zu,useSlate as ef}from"slate-react";import{createContext as Li,useState as iu}from"react";import{createPortal as nu}from"react-dom";function Ri({children:e}){return typeof document>"u"||!document.body?null:nu(e,document.body)}import{jsx as Ho,jsxs as lu}from"react/jsx-runtime";var Ao=Li({}),au=Li({});function Bi({children:e}){let[t,o]=iu({});function r(i){o(a=>({...a,[i.type]:i}))}function n(i){o(a=>{let l={...a};return delete l[i],l})}return lu(Ao.Provider,{value:{layers:t,setLayers:o,openLayer:r,closeLayer:n},children:[e,Object.entries(t).map(([,i])=>Ho(Ri,{children:Ho(au.Provider,{value:i,children:Ho(i.Component,{})})},i.type))]})}import{useContext as su}from"react";function O(e){let{openLayer:t,closeLayer:o,layers:r}=su(Ao);function n(a){t({type:e,Component:a})}function i(){o(e)}return{open:n,close:i,layer:r[e],type:e}}import Nt from"@emotion/styled";var zi=Nt("a")`
38
38
  /**
39
39
  * Link colors
40
40
  */
@@ -949,7 +949,7 @@
949
949
  display: inline-block;
950
950
  width: 2em;
951
951
  } */
952
- `;import{jsx as Et,jsxs as $l}from"react/jsx-runtime";function Hl({element:e,attributes:t,children:o}){let r=ch(null),n=ph(),i=O("code-block-dropdown"),a=mh(()=>{i.layer&&i.close();let l=r.current;if(l===null)return;let m=Cl.map(s=>({icon:()=>Et("span",{}),title:s,action:c=>{c.codeBlock.setCodeBlockLanguage(s,{at:e})}}));i.open(()=>Et(Ue,{dest:l,items:m,close:i.close}))},[e]);return $l(Bl,{className:n?"--selected":"",...t,children:[$l(Dl,{contentEditable:!1,onClick:a,ref:r,children:[Et("span",{children:e.language}),Et(Ll,{})]}),Et(zl,{children:o})]})}import{useSelected as dh}from"slate-react";import{jsx as uh}from"react/jsx-runtime";function Al({attributes:e,children:t}){let o=dh();return uh(Nl,{className:o?"--selected":"",...e,spellCheck:"false",children:t})}import{jsx as Ol}from"react/jsx-runtime";function Ul({element:e,attributes:t,children:o}){if(e.type==="code-block")return Ol(Hl,{element:e,attributes:t,children:o});if(e.type==="code-block-line")return Ol(Al,{element:e,attributes:t,children:o})}import{Fragment as gh,jsx as Vl}from"react/jsx-runtime";var Kl=v((e,t,{createPolicy:o})=>{e.codeBlock=vl(e);function r(){let{selection:n}=e;if(!ce(n))return!1;let i=x(e,"code-block");return i==null?!1:fh.string(e,i[1])===""?(Fl.removeNodes(e,{at:i[1]}),!0):!1}return o({name:"code-block",editor:{deleteBackward:r,deleteForward:r,isInline(n){if(n.type==="code-block"||n.type==="code-block-line")return!1},isVoid(n){if(n.type==="code-block"||n.type==="code-block-line")return!1},isMaster(n){if(n.type==="code-block")return!0},normalizeNode:f(Sl,e)},editableProps:{decorate:xl,onKeyDown:H({"super+`":()=>e.codeBlock.createCodeBlock({language:"text"}),"mod+a":()=>{let n=x(e,i=>hh.isElement(i)&&i.type==="code-block");return n?(Fl.select(e,n[1]),!0):!1}}),renderElement:Ul,renderLeaf:({leaf:n,children:i})=>{let a=n.prismToken&&Pl[n.prismToken]||null;return a===null?Vl(gh,{children:i}):Vl("span",{style:a,children:i})}}})});import{Transforms as Eh}from"slate";import _l from"@emotion/styled";var Wl=_l("div")`
952
+ `;import{jsx as Et,jsxs as $l}from"react/jsx-runtime";function Hl({element:e,attributes:t,children:o}){let r=ch(null),n=ph(),i=O("code-block-dropdown"),a=mh(()=>{i.layer&&i.close();let l=r.current;if(l===null)return;let m=Cl.map(s=>({icon:()=>Et("span",{}),title:s,action:c=>{c.codeBlock.setCodeBlockLanguage(s,{at:e})}}));i.open(()=>Et(Ue,{dest:l,items:m,close:i.close}))},[e]);return $l(Bl,{className:n?"--selected":"",...t,children:[$l(Dl,{contentEditable:!1,onClick:a,ref:r,children:[Et("span",{children:e.language}),Et(Ll,{})]}),Et(zl,{children:o})]})}import{useSelected as dh}from"slate-react";import{jsx as uh}from"react/jsx-runtime";function Al({attributes:e,children:t}){let o=dh();return uh(Nl,{className:o?"--selected":"",...e,spellCheck:"false",children:t})}import{jsx as Ol}from"react/jsx-runtime";function Ul({element:e,attributes:t,children:o}){if(e.type==="code-block")return Ol(Hl,{element:e,attributes:t,children:o});if(e.type==="code-block-line")return Ol(Al,{element:e,attributes:t,children:o})}import{Fragment as gh,jsx as Vl}from"react/jsx-runtime";var Kl=v((e,t,{createPolicy:o})=>{e.codeBlock=vl(e);function r(){let{selection:n}=e;if(!me(n))return!1;let i=x(e,"code-block");return i==null?!1:fh.string(e,i[1])===""?(Fl.removeNodes(e,{at:i[1]}),!0):!1}return o({name:"code-block",editor:{deleteBackward:r,deleteForward:r,isInline(n){if(n.type==="code-block"||n.type==="code-block-line")return!1},isVoid(n){if(n.type==="code-block"||n.type==="code-block-line")return!1},isMaster(n){if(n.type==="code-block")return!0},normalizeNode:f(Sl,e)},editableProps:{decorate:xl,onKeyDown:H({"super+`":()=>e.codeBlock.createCodeBlock({language:"text"}),"mod+a":()=>{let n=x(e,i=>hh.isElement(i)&&i.type==="code-block");return n?(Fl.select(e,n[1]),!0):!1}}),renderElement:Ul,renderLeaf:({leaf:n,children:i})=>{let a=n.prismToken&&Pl[n.prismToken]||null;return a===null?Vl(gh,{children:i}):Vl("span",{style:a,children:i})}}})});import{Transforms as Eh}from"slate";import _l from"@emotion/styled";var Wl=_l("div")`
953
953
  position: relative;
954
954
  background-color: var(--shade-100);
955
955
  border: 1px solid var(--shade-300);
@@ -975,7 +975,7 @@
975
975
  color: var(--shade-500);
976
976
  text-transform: uppercase;
977
977
  letter-spacing: 0.5px;
978
- `;import{jsx as ql,jsxs as bh}from"react/jsx-runtime";function Ql({attributes:e,children:t,element:o}){return bh(Wl,{...e,contentEditable:!1,children:[ql(Gl,{children:"HTML"}),ql("div",{children:nt(o.html)}),t]})}import{jsx as xh}from"react/jsx-runtime";var Xl=v((e,t,{createPolicy:o})=>{function r(){let{selection:n}=e;if(!ce(n))return!1;let i=x(e,"html-block");return i==null?!1:(Eh.removeNodes(e,{at:i[1]}),!0)}return o({name:"html-block",editor:{deleteBackward:r,deleteForward:r,isInline(n){if(n.type==="html-block")return!1},isVoid(n){if(n.type==="html-block")return!0},isMaster(n){if(n.type==="html-block")return!0}},editableProps:{renderElement:({element:n,attributes:i,children:a})=>{if(n.type==="html-block")return xh(Ql,{element:n,attributes:i,children:a})}}})});import{Editor as rs}from"slate";import{Element as wh}from"slate";import{Element as yh,Transforms as kh}from"slate";function jl(e){return yh.isElement(e)&&e.type==="paragraph"}function Yl(e,t){return xe(e,t,(o,r)=>!jl(o[0])||!jl(r[0])?!1:o[0].__collapsible&&r[0].__collapsible?(kh.removeNodes(e,{at:o[1]}),!0):!1)}import{Element as vh,Transforms as Th}from"slate";function or(e,t){return vh.isElement(t)?e.isVoid(t)||e.isMaster(t):!1}function Jl(e,t){return or(e,t[0])?xe(e,t,(o,r)=>!or(e,o[0])||!or(e,r[0])?!1:(Th.insertNodes(e,{type:"paragraph",__collapsible:!0,children:[{text:""}]},{at:r[1]}),!0)):!1}function Zl(e,t){let[o,r]=t;return wh.isElement(o)?!!(Jl(e,[o,r])||Yl(e,[o,r])):!1}import{clsx as Ph}from"clsx";import{useSelected as Ch}from"slate-react";import Ih from"@emotion/styled";var es=Ih("p")`
978
+ `;import{jsx as ql,jsxs as bh}from"react/jsx-runtime";function Ql({attributes:e,children:t,element:o}){return bh(Wl,{...e,contentEditable:!1,children:[ql(Gl,{children:"HTML"}),ql("div",{children:nt(o.html)}),t]})}import{jsx as xh}from"react/jsx-runtime";var Xl=v((e,t,{createPolicy:o})=>{function r(){let{selection:n}=e;if(!me(n))return!1;let i=x(e,"html-block");return i==null?!1:(Eh.removeNodes(e,{at:i[1]}),!0)}return o({name:"html-block",editor:{deleteBackward:r,deleteForward:r,isInline(n){if(n.type==="html-block")return!1},isVoid(n){if(n.type==="html-block")return!0},isMaster(n){if(n.type==="html-block")return!0}},editableProps:{renderElement:({element:n,attributes:i,children:a})=>{if(n.type==="html-block")return xh(Ql,{element:n,attributes:i,children:a})}}})});import{Editor as rs}from"slate";import{Element as wh}from"slate";import{Element as yh,Transforms as kh}from"slate";function jl(e){return yh.isElement(e)&&e.type==="paragraph"}function Yl(e,t){return xe(e,t,(o,r)=>!jl(o[0])||!jl(r[0])?!1:o[0].__collapsible&&r[0].__collapsible?(kh.removeNodes(e,{at:o[1]}),!0):!1)}import{Element as vh,Transforms as Th}from"slate";function or(e,t){return vh.isElement(t)?e.isVoid(t)||e.isMaster(t):!1}function Jl(e,t){return or(e,t[0])?xe(e,t,(o,r)=>!or(e,o[0])||!or(e,r[0])?!1:(Th.insertNodes(e,{type:"paragraph",__collapsible:!0,children:[{text:""}]},{at:r[1]}),!0)):!1}function Zl(e,t){let[o,r]=t;return wh.isElement(o)?!!(Jl(e,[o,r])||Yl(e,[o,r])):!1}import{clsx as Ph}from"clsx";import{useSelected as Ch}from"slate-react";import Ih from"@emotion/styled";var es=Ih("p")`
979
979
  padding: 0;
980
980
  margin: 0;
981
981
  &:first-of-type {
@@ -1172,7 +1172,7 @@
1172
1172
  &.--highlight {
1173
1173
  background-color: #ffff00;
1174
1174
  }
1175
- `;import{jsx as xg}from"react/jsx-runtime";var sm=v(e=>{e.marksPlugin=am(e),e.activeMarks={};let t=H({"mod+b":e.marksPlugin.toggleBold,"mod+i":e.marksPlugin.toggleItalic,"mod+u":e.marksPlugin.toggleUnderline,"super+0":e.marksPlugin.removeMarks,"super+k":e.marksPlugin.toggleStrike,"mod+h":e.marksPlugin.toggleHighlight}),{insertText:o}=e;e.insertText=n=>{if(e.activeMarks&&Object.keys(e.activeMarks).length>0){let{activeMarks:i}=e;Object.entries(i).forEach(([a,l])=>{l&&e.addMark(a,!0)})}o(n)};let{removeMarks:r}=e.marksPlugin;return e.marksPlugin.removeMarks=()=>{if(r(),e.selection&&Eg.isRange(e.selection)){let n=e.selection.focus;(dr.after(e,n)===null||dr.isEnd(e,n,dr.end(e,[])))&&(e.activeMarks={})}},{name:"marks",editableProps:{renderLeaf:({leaf:n,children:i})=>xg(lm,{className:bg({"--bold":n.bold,"--italic":n.italic,"--underline":n.underline,"--strike":n.strike,"--highlight":n.highlight}),children:i}),onKeyDown:n=>!!t(n)}}});import{Editor as xt,Point as mm}from"slate";function cm(e){if(!e.selection)return;let t=xt.parent(e,e.selection);fi(e,t[1])}var pm=v(e=>(e.normalizeAfterDelete=!0,{name:"normalize-after-delete",editor:{deleteBackward(){if(!e.selection)return!1;let t=xt.parent(e,e.selection);return mm.equals(xt.start(e,t[1]),e.selection.anchor)?function(){cm(e)}:!1},deleteForward(){if(!e.selection)return!1;let t=xt.parent(e,e.selection);return mm.equals(xt.end(e,t[1]),e.selection.anchor)?function(){cm(e)}:!1}},editableProps:{}}));import{Element as ab}from"slate";import{Editor as um,Path as vg,Transforms as fm}from"slate";import{Editor as yg,Path as kg}from"slate";function dm(e,t,o){let r=[...yg.positions(e,{at:t})],n=[],i,a,l;i=a=r[0],l=Ae(e,o,{at:i});for(let s of r){let c=Ae(e,o,{at:s});if(l&&c&&kg.equals(l,c)||l==null&&c==null)a=s;else{let d={anchor:i,focus:a};n.push(d),i=a=s,l=c}}let m={anchor:i,focus:a};return n.push(m),n.reverse(),n}function hm(e,t){if(e.selection==null)return!1;let[o,r]=um.edges(e,e.selection),n=Ae(e,t,{at:o}),i=Ae(e,t,{at:r});if(!n&&!i||n&&i&&vg.equals(n,i))return!1;let a=dm(e,e.selection,t);return um.withoutNormalizing(e,()=>{for(let l of a)fm.delete(e,{at:l});fm.collapse(e,{edge:"start"})}),!0}import{Transforms as Og}from"slate";function D(e,{at:t=e.selection}={}){if(t==null)return;let o=x(e,"table-cell",{at:t});if(!o)return;let r=x(e,"table-row",{at:t});if(!r)return;let n=x(e,"table",{at:t});if(!n)return;let[i,a]=n,[l,m]=r,[s,c]=o;return{tableElement:i,tablePath:a,tableColumns:i.columns,rowElement:l,rowPath:m,rowIndex:m.slice(-1)[0],rowCount:i.children.length,cellElement:s,cellPath:c,cellIndex:c.slice(-1)[0],cellCount:l.children.length}}import{Editor as Tg,Transforms as gm}from"slate";function je(e,t=[{type:"table-content",children:[{text:""}]}]){return{type:"table-cell",children:t}}function bm(e,{offset:t=0,at:o=e.selection}={}){let r=D(e,{at:o});if(r===void 0)return!1;let{tableElement:n,tablePath:i,cellIndex:a}=r,l=a+t;return Tg.withoutNormalizing(e,()=>{let{columns:m}=n,s=[...m],c=Math.min(l,m.length-1);s.splice(l,0,m[c]),gm.setNodes(e,{columns:s},{at:i}),n.children.forEach((d,p)=>{gm.insertNodes(e,je(l),{at:[...i,p,l]})})}),!0}import{Transforms as wg}from"slate";function Ig(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>je(t))}}function ur(e,{at:t=e.selection,offset:o=0}={}){let r=D(e,{at:t});if(!r)return!1;let n=Ig(r.tableElement.columns.length);return wg.insertNodes(e,n,{at:[...r.tablePath,r.rowIndex+o]}),!0}function Em(e,{at:t}={}){return ur(e,{at:t,offset:1})}import{Editor as fr,Element as Mg,Path as Pg,Transforms as yt}from"slate";function xm(e){return[...Array(e).keys()]}function Cg(e){return xm(e).map(()=>({align:"left"}))}function Sg(e,t){return{type:"table",columns:Cg(e),children:xm(t).map(()=>Rg(e))}}function Rg(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>je(t))}}function ym(e,t,o,{at:r=e.selection}={}){let n=Sg(t,o);return Lg(e,n,{at:r})}function Lg(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=x(e,n=>Mg.isElement(n)&&e.isMaster(n));if(r==null){let n=e.selection;fr.withoutNormalizing(e,()=>{yt.insertNodes(e,t,{at:o}),n&&(yt.select(e,n),yt.move(e))})}else{let n=Pg.next(r[1]);fr.withoutNormalizing(e,()=>{yt.insertNodes(e,t,{at:n}),yt.select(e,fr.start(e,n))})}return!0}import{Path as km}from"slate";function vm(e,t){let{cellIndex:o,rowIndex:r,rowCount:n,tablePath:i}=t;if(r<n-1)return Q(e,[...i,r+1,o]),!0;try{return Q(e,km.next(i)),!0}catch{return!1}}function Tm(e,t){let{cellIndex:o,rowIndex:r,tablePath:n}=t;if(r>0)return Q(e,[...n,r-1,o]),!0;try{return Ei(e,km.previous(n)),!0}catch{return!1}}import{ReactEditor as Bg}from"slate-react";function zg(){let e=window.getSelection();if(!e||e.rangeCount===0)return null;try{return e.getRangeAt(0).getBoundingClientRect()}catch{return null}}function Dg(e,t){return Bg.toDOMNode(e,t).getBoundingClientRect()}function hr(e,t){let o=zg();if(!o)return!1;let r=Dg(e,t);return o.right<r.right&&o.left>r.left&&o.bottom<r.bottom&&o.top>r.top}function wm(e){let t=D(e);return t&&setTimeout(()=>{hr(e,t.cellElement)||vm(e,t)}),!1}function Im(e){let t=D(e);return t&&setTimeout(()=>{hr(e,t.cellElement)||Tm(e,t)}),!1}import{Editor as Mm,Transforms as gr}from"slate";import{Transforms as Ng}from"slate";function Ye(e){let t=e.tablePlugin.getTableInfo();return t===void 0?!1:(Ng.removeNodes(e,{at:t.tablePath}),!0)}function Pm(e,{at:t=e.selection}={}){let o=D(e,{at:t});if(!o)return!1;let{tableElement:r,tablePath:n,rowIndex:i,cellIndex:a,cellCount:l}=o;if(l===1)return Ye(e);Mm.withoutNormalizing(e,()=>{let m=[...r.columns];m.splice(a,1),gr.setNodes(e,{columns:m},{at:n}),r.children.forEach((c,d)=>{gr.removeNodes(e,{at:[...n,d,a]})});let s=Mm.start(e,[...n,i,Math.min(a,l-2)]);gr.select(e,s)})}import{Editor as Cm,Transforms as Sm}from"slate";function Rm(e,{at:t=e.selection}={}){let o=D(e,{at:t});return o===void 0?!1:o.rowCount===1?(Ye(e),!0):(Cm.withoutNormalizing(e,()=>{Sm.removeNodes(e,{at:o.rowPath}),Sm.select(e,Cm.start(e,[...o.tablePath,Math.min(o.rowIndex,o.rowCount-2),o.cellIndex]))}),!0)}import{Transforms as $g}from"slate";function Lm(e,t){let o=D(e);if(o===void 0)return!1;let{tableElement:r,tablePath:n,cellIndex:i}=o,a=r.columns.slice();return a.splice(i,1,{align:t.align}),$g.setNodes(e,{columns:a},{at:n}),!0}import{Path as Hg,Transforms as Ag}from"slate";function Bm(e){let t=D(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,rowCount:i,tablePath:a}=t;if(o<r-1)return Q(e,[...a,n,o+1]),!0;if(n<i-1)return Q(e,[...a,n+1,0]),!0;let l=Hg.next(a);return Ag.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:l}),Q(e,l),!0}function zm(e){let t=D(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,tablePath:i}=t;if(o>0)return Q(e,[...i,n,o-1]),!0;if(n>0)return Q(e,[...i,n-1,r-1]),!0}function Dm(e){let t=D(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,rowCount:i,tablePath:a}=t;return o<r-1?(Q(e,[...a,n,o+1]),!0):n<i-1?(Q(e,[...a,n+1,0]),!0):(Em(e),Q(e,[...a,n+1,0]),!0)}function Nm(e){return{getTableInfo:f(D,e),insertTable:f(ym,e),insertColumn:f(bm,e),insertRow:f(ur,e),removeTable:f(Ye,e),removeColumn:f(Pm,e),removeRow:f(Rm,e),tabForward:f(Bm,e),tabBackward:f(zm,e),shiftEnterForward:f(Dm,e),selectCell:f(Ug,e),down:f(wm,e),up:f(Im,e),setTableColumnAlign:f(Lm,e)}}function Ug(e,{at:t=e.selection}={}){let o=D(e,{at:t});if(o===void 0)return!1;let{cellPath:r}=o;return Og.select(e,r),!0}import{Transforms as Fg}from"slate";function lo(e,t){let o=!1;return t[0].children.forEach((n,i)=>{n.children.forEach((l,m)=>{(l.x!==m||l.y!==i)&&(Fg.setNodes(e,{x:m,y:i},{at:[...t[1],i,m]}),o=!0)})}),o}import{Editor as Vg,Transforms as br}from"slate";function $m(e,t){let[o,r]=t;return o.children.length===1&&o.children[0].type==="table-content"?!1:(Vg.withoutNormalizing(e,()=>{br.insertNodes(e,{type:"table-content",children:[{text:"X"}]},{at:[...t[1],0]});for(let n=o.children.length;n>=0;n--)br.mergeNodes(e,{at:[...r,n]});br.delete(e,{at:{path:[...r,0,0],offset:0},unit:"character"})}),!0)}import{useEffect as _g}from"react";import{ReactEditor as Wg,useSelected as Gg,useSlateStatic as qg}from"slate-react";import mo from"@emotion/styled";import pe from"@emotion/styled";var Hm=pe("div")`
1175
+ `;import{jsx as xg}from"react/jsx-runtime";var sm=v(e=>{e.marksPlugin=am(e),e.activeMarks={};let t=H({"mod+b":e.marksPlugin.toggleBold,"mod+i":e.marksPlugin.toggleItalic,"mod+u":e.marksPlugin.toggleUnderline,"super+0":e.marksPlugin.removeMarks,"super+k":e.marksPlugin.toggleStrike,"mod+h":e.marksPlugin.toggleHighlight}),{insertText:o}=e;e.insertText=n=>{if(e.activeMarks&&Object.keys(e.activeMarks).length>0){let{activeMarks:i}=e;Object.entries(i).forEach(([a,l])=>{l&&e.addMark(a,!0)})}o(n)};let{removeMarks:r}=e.marksPlugin;return e.marksPlugin.removeMarks=()=>{if(r(),e.selection&&Eg.isRange(e.selection)){let n=e.selection.focus;(dr.after(e,n)===null||dr.isEnd(e,n,dr.end(e,[])))&&(e.activeMarks={})}},{name:"marks",editableProps:{renderLeaf:({leaf:n,children:i})=>xg(lm,{className:bg({"--bold":n.bold,"--italic":n.italic,"--underline":n.underline,"--strike":n.strike,"--highlight":n.highlight}),children:i}),onKeyDown:n=>!!t(n)}}});import{Editor as xt,Point as mm}from"slate";function cm(e){if(!e.selection)return;let t=xt.parent(e,e.selection);fi(e,t[1])}var pm=v(e=>(e.normalizeAfterDelete=!0,{name:"normalize-after-delete",editor:{deleteBackward(){if(!e.selection)return!1;let t=xt.parent(e,e.selection);return mm.equals(xt.start(e,t[1]),e.selection.anchor)?function(){cm(e)}:!1},deleteForward(){if(!e.selection)return!1;let t=xt.parent(e,e.selection);return mm.equals(xt.end(e,t[1]),e.selection.anchor)?function(){cm(e)}:!1}},editableProps:{}}));import{Element as ab}from"slate";import{Editor as um,Path as vg,Transforms as fm}from"slate";import{Editor as yg,Path as kg}from"slate";function dm(e,t,o){let r=[...yg.positions(e,{at:t})],n=[],i,a,l;i=a=r[0],l=Ae(e,o,{at:i});for(let s of r){let c=Ae(e,o,{at:s});if(l&&c&&kg.equals(l,c)||l==null&&c==null)a=s;else{let d={anchor:i,focus:a};n.push(d),i=a=s,l=c}}let m={anchor:i,focus:a};return n.push(m),n.reverse(),n}function hm(e,t){if(e.selection==null)return!1;let[o,r]=um.edges(e,e.selection),n=Ae(e,t,{at:o}),i=Ae(e,t,{at:r});if(!n&&!i||n&&i&&vg.equals(n,i))return!1;let a=dm(e,e.selection,t);return um.withoutNormalizing(e,()=>{for(let l of a)fm.delete(e,{at:l});fm.collapse(e,{edge:"start"})}),!0}import{Transforms as Og}from"slate";function D(e,{at:t=e.selection}={}){if(t==null)return;let o=x(e,"table-cell",{at:t});if(!o)return;let r=x(e,"table-row",{at:t});if(!r)return;let n=x(e,"table",{at:t});if(!n)return;let[i,a]=n,[l,m]=r,[s,c]=o;return{tableElement:i,tablePath:a,tableColumns:i.columns,rowElement:l,rowPath:m,rowIndex:m.slice(-1)[0],rowCount:i.children.length,cellElement:s,cellPath:c,cellIndex:c.slice(-1)[0],cellCount:l.children.length}}import{Editor as Tg,Transforms as gm}from"slate";function je(e,t=[{type:"table-content",children:[{text:""}]}]){return{type:"table-cell",children:t}}function bm(e,{offset:t=0,at:o=e.selection}={}){let r=D(e,{at:o});if(r===void 0)return!1;let{tableElement:n,tablePath:i,cellIndex:a}=r,l=a+t;return Tg.withoutNormalizing(e,()=>{let{columns:m}=n,s=[...m],c=Math.min(l,m.length-1);s.splice(l,0,m[c]),gm.setNodes(e,{columns:s},{at:i}),n.children.forEach((d,p)=>{gm.insertNodes(e,je(l),{at:[...i,p,l]})})}),!0}import{Transforms as wg}from"slate";function Ig(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>je(t))}}function ur(e,{at:t=e.selection,offset:o=0}={}){let r=D(e,{at:t});if(!r)return!1;let n=Ig(r.tableElement.columns.length);return wg.insertNodes(e,n,{at:[...r.tablePath,r.rowIndex+o]}),!0}function Em(e,{at:t}={}){return ur(e,{at:t,offset:1})}import{Editor as fr,Element as Mg,Path as Pg,Transforms as yt}from"slate";function xm(e){return[...Array(e).keys()]}function Cg(e){return xm(e).map(()=>({align:"left"}))}function Sg(e,t){return{type:"table",columns:Cg(e),children:xm(t).map(()=>Rg(e))}}function Rg(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>je(t))}}function ym(e,t,o,{at:r=e.selection}={}){let n=Sg(t,o);return Lg(e,n,{at:r})}function Lg(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=x(e,n=>Mg.isElement(n)&&e.isMaster(n));if(r==null){let n=e.selection;fr.withoutNormalizing(e,()=>{yt.insertNodes(e,t,{at:o}),n&&(yt.select(e,n),yt.move(e))})}else{let n=Pg.next(r[1]);fr.withoutNormalizing(e,()=>{yt.insertNodes(e,t,{at:n}),yt.select(e,fr.start(e,n))})}return!0}import{Path as km}from"slate";function vm(e,t){let{cellIndex:o,rowIndex:r,rowCount:n,tablePath:i}=t;if(r<n-1)return Q(e,[...i,r+1,o]),!0;try{return Q(e,km.next(i)),!0}catch{return!1}}function Tm(e,t){let{cellIndex:o,rowIndex:r,tablePath:n}=t;if(r>0)return Q(e,[...n,r-1,o]),!0;try{return Ei(e,km.previous(n)),!0}catch{return!1}}import{ReactEditor as Bg}from"slate-react";function zg(){let e=window.getSelection();if(!e||e.rangeCount===0)return null;try{return e.getRangeAt(0).getBoundingClientRect()}catch{return null}}function Dg(e,t){return Bg.toDOMNode(e,t).getBoundingClientRect()}function hr(e,t){let o=zg();if(!o)return!1;let r=Dg(e,t);return o.right<r.right&&o.left>r.left&&o.bottom<r.bottom&&o.top>r.top}function wm(e){let t=D(e);return t&&setTimeout(()=>{hr(e,t.cellElement)||vm(e,t)}),!1}function Im(e){let t=D(e);return t&&setTimeout(()=>{hr(e,t.cellElement)||Tm(e,t)}),!1}import{Editor as Mm,Transforms as gr}from"slate";import{Transforms as Ng}from"slate";function Ye(e){let t=e.tablePlugin.getTableInfo();return t===void 0?!1:(Ng.removeNodes(e,{at:t.tablePath}),!0)}function Pm(e,{at:t=e.selection}={}){let o=D(e,{at:t});if(!o)return!1;let{tableElement:r,tablePath:n,rowIndex:i,cellIndex:a,cellCount:l}=o;if(l===1)return Ye(e);Mm.withoutNormalizing(e,()=>{let m=[...r.columns];m.splice(a,1),gr.setNodes(e,{columns:m},{at:n}),r.children.forEach((c,d)=>{gr.removeNodes(e,{at:[...n,d,a]})});let s=Mm.start(e,[...n,i,Math.min(a,l-2)]);gr.select(e,s)})}import{Editor as Cm,Transforms as Sm}from"slate";function Rm(e,{at:t=e.selection}={}){let o=D(e,{at:t});return o===void 0?!1:o.rowCount===1?(Ye(e),!0):(Cm.withoutNormalizing(e,()=>{Sm.removeNodes(e,{at:o.rowPath}),Sm.select(e,Cm.start(e,[...o.tablePath,Math.min(o.rowIndex,o.rowCount-2),o.cellIndex]))}),!0)}import{Transforms as $g}from"slate";function Lm(e,t){let o=D(e);if(o===void 0)return!1;let{tableElement:r,tablePath:n,cellIndex:i}=o,a=r.columns.slice();return a.splice(i,1,{align:t.align}),$g.setNodes(e,{columns:a},{at:n}),!0}import{Path as Hg,Transforms as Ag}from"slate";function Bm(e){let t=D(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,rowCount:i,tablePath:a}=t;if(o<r-1)return Q(e,[...a,n,o+1]),!0;if(n<i-1)return Q(e,[...a,n+1,0]),!0;let l=Hg.next(a);return Ag.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:l}),Q(e,l),!0}function zm(e){let t=D(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,tablePath:i}=t;if(o>0)return Q(e,[...i,n,o-1]),!0;if(n>0)return Q(e,[...i,n-1,r-1]),!0}function Dm(e){let t=D(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,rowCount:i,tablePath:a}=t;return o<r-1?(Q(e,[...a,n,o+1]),!0):n<i-1?(Q(e,[...a,n+1,0]),!0):(Em(e),Q(e,[...a,n+1,0]),!0)}function Nm(e){return{getTableInfo:f(D,e),insertTable:f(ym,e),insertColumn:f(bm,e),insertRow:f(ur,e),removeTable:f(Ye,e),removeColumn:f(Pm,e),removeRow:f(Rm,e),tabForward:f(Bm,e),tabBackward:f(zm,e),shiftEnterForward:f(Dm,e),selectCell:f(Ug,e),down:f(wm,e),up:f(Im,e),setTableColumnAlign:f(Lm,e)}}function Ug(e,{at:t=e.selection}={}){let o=D(e,{at:t});if(o===void 0)return!1;let{cellPath:r}=o;return Og.select(e,r),!0}import{Transforms as Fg}from"slate";function lo(e,t){let o=!1;return t[0].children.forEach((n,i)=>{n.children.forEach((l,m)=>{(l.x!==m||l.y!==i)&&(Fg.setNodes(e,{x:m,y:i},{at:[...t[1],i,m]}),o=!0)})}),o}import{Editor as Vg,Transforms as br}from"slate";function $m(e,t){let[o,r]=t;return o.children.length===1&&o.children[0].type==="table-content"?!1:(Vg.withoutNormalizing(e,()=>{br.insertNodes(e,{type:"table-content",children:[{text:"X"}]},{at:[...t[1],0]});for(let n=o.children.length;n>=0;n--)br.mergeNodes(e,{at:[...r,n]});br.delete(e,{at:{path:[...r,0,0],offset:0},unit:"character"})}),!0)}import{useEffect as _g}from"react";import{ReactEditor as Wg,useSelected as Gg,useSlateStatic as qg}from"slate-react";import mo from"@emotion/styled";import ce from"@emotion/styled";var Hm=ce("div")`
1176
1176
  position: absolute;
1177
1177
  /**
1178
1178
  * very slightly shaded
@@ -1196,7 +1196,7 @@
1196
1196
  background: rgba(0, 0, 0, 0.15);
1197
1197
  }
1198
1198
  }
1199
- `,Am=pe(Hm)`
1199
+ `,Am=ce(Hm)`
1200
1200
  cursor: pointer;
1201
1201
  /**
1202
1202
  * hangs out on top
@@ -1206,7 +1206,7 @@
1206
1206
  right: 0;
1207
1207
  height: 3em;
1208
1208
  top: -3em;
1209
- `,Om=pe(Hm)`
1209
+ `,Om=ce(Hm)`
1210
1210
  /**
1211
1211
  * hangs out on left
1212
1212
  */
@@ -1214,7 +1214,7 @@
1214
1214
  bottom: -1px;
1215
1215
  width: 3em;
1216
1216
  left: -3em;
1217
- `,Um=pe("div")`
1217
+ `,Um=ce("div")`
1218
1218
  position: absolute;
1219
1219
  background: rgba(0, 0, 0, 0.05);
1220
1220
  border: 1px solid rgba(0, 0, 0, 0.05);
@@ -1226,7 +1226,7 @@
1226
1226
  left: 0;
1227
1227
  right: 0;
1228
1228
  bottom: 0;
1229
- `,Fm=pe(Um)`
1229
+ `,Fm=ce(Um)`
1230
1230
  top: 50%;
1231
1231
  border-bottom: none;
1232
1232
  border-right: none;
@@ -1252,7 +1252,7 @@
1252
1252
 
1253
1253
  /* border-top-left-radius: 0.5em;
1254
1254
  border-top-right-radius: 0.5em; */
1255
- `,Vm=pe(Um)`
1255
+ `,Vm=ce(Um)`
1256
1256
  left: 50%;
1257
1257
  border-right: none;
1258
1258
  border-bottom: none;
@@ -1278,7 +1278,7 @@
1278
1278
 
1279
1279
  /* border-top-left-radius: 0.5em;
1280
1280
  border-bottom-left-radius: 0.5em; */
1281
- `,Km=pe("div")`
1281
+ `,Km=ce("div")`
1282
1282
  position: absolute;
1283
1283
  font-size: 1.5em;
1284
1284
  background: white;
@@ -1287,12 +1287,12 @@
1287
1287
  svg {
1288
1288
  display: block;
1289
1289
  }
1290
- `,Je=pe(Km)`
1290
+ `,Je=ce(Km)`
1291
1291
  color: #c0c0c0;
1292
1292
  &:hover {
1293
1293
  color: royalblue;
1294
1294
  }
1295
- `,so=pe(Km)`
1295
+ `,so=ce(Km)`
1296
1296
  color: #c0c0c0;
1297
1297
  &:hover {
1298
1298
  color: firebrick;
@@ -1339,7 +1339,7 @@
1339
1339
  color: rgba(0, 0, 0, 0.6);
1340
1340
  font-size: 0.875em; /* 14px */
1341
1341
  }
1342
- `;import{createContext as Kg}from"react";var co=Kg({isSelected:!1});import{jsx as Er}from"react/jsx-runtime";function Qm({element:e,attributes:t,children:o}){let r=qg(),n=Gg();return _g(()=>{try{let i=Wg.findPath(r,e);lo(r,[e,i])}catch{}},[]),Er(co.Provider,{value:{isSelected:n},children:Er(_m,{...t,columns:e.columns,children:Er("tbody",{children:o})})})}import{useContext as tb}from"react";import{useSelected as ob}from"slate-react";import{useCallback as xr,useRef as Qg,useState as Xg}from"react";import{useSlateStatic as jg}from"slate-react";import{jsx as ee}from"react/jsx-runtime";var Ze=e=>ee("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"1em",height:"1em",...e,children:ee("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm.75-11.25a.75.75 0 0 0-1.5 0v2.5h-2.5a.75.75 0 0 0 0 1.5h2.5v2.5a.75.75 0 0 0 1.5 0v-2.5h2.5a.75.75 0 0 0 0-1.5h-2.5v-2.5z",clipRule:"evenodd"})}),po=e=>ee("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"1em",height:"1em",...e,children:ee("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16zM6.75 9.25a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5z",clipRule:"evenodd"})}),uo=()=>ee(y,{children:ee("path",{d:"M4 6h16M4 12h16M4 18h16"})}),Xm=()=>ee(y,{children:ee("path",{d:"M4 6h16M4 12h10M4 18h14"})}),jm=()=>ee(y,{children:ee("path",{d:"M4 6h16M8 12h8M6 18h12"})}),Ym=()=>ee(y,{children:ee("path",{d:"M4 6h16M10 12h10M6 18h14"})});import{Fragment as Yg,jsx as de,jsxs as Jm}from"react/jsx-runtime";function Zm({cellElement:e}){let t=jg(),o=O("column-menu"),r=Qg(null),[n,i]=Xg(!1),a=xr(()=>{i(!0)},[]),l=xr(()=>{i(!1)},[]),m=xr(()=>{o.layer&&o.close();let s=r.current;if(s===null)return;let c=[{icon:Xm,title:"\u5DE6\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"left"})}},{icon:jm,title:"\u4E2D\u592E\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"center"})}},{icon:Ym,title:"\u53F3\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"right"})}}];o.open(()=>de(Ue,{dest:s,items:c,close:o.close}))},[]);return Jm(Am,{ref:r,contentEditable:!1,onClick:m,onMouseEnter:a,onMouseLeave:l,children:[de(Fm,{className:"--tile",children:de(uo,{})}),n?Jm(Yg,{children:[de(so,{style:{top:0,left:"50%",marginLeft:"-0.5em"},onMouseDown:()=>t.tablePlugin.removeColumn({at:e}),children:de(po,{})}),de(Je,{style:{left:"-0.5em",top:0},onMouseDown:()=>t.tablePlugin.insertColumn({at:e}),children:de(Ze,{})}),de(Je,{style:{right:"-0.5em",top:0},onMouseDown:()=>t.tablePlugin.insertColumn({at:e,offset:1}),children:de(Ze,{})})]}):null]})}import{useState as Jg}from"react";import{useSlateStatic as Zg}from"slate-react";import{Fragment as eb,jsx as Ie,jsxs as ec}from"react/jsx-runtime";function tc({cellElement:e}){let t=Zg(),[o,r]=Jg(!1);return ec(Om,{contentEditable:!1,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[Ie(Vm,{className:"--tile",children:Ie(uo,{})}),o?ec(eb,{children:[Ie(so,{style:{top:"50%",left:"0.5em",marginTop:"-0.5em"},onMouseDown:()=>t.tablePlugin.removeRow({at:e}),children:Ie(po,{})}),Ie(Je,{style:{top:"-0.5em",left:"0.5em"},onMouseDown:()=>t.tablePlugin.insertRow({at:e}),children:Ie(Ze,{})}),Ie(Je,{style:{bottom:"-0.5em",left:"0.5em"},onMouseDown:()=>t.tablePlugin.insertRow({at:e,offset:1}),children:Ie(Ze,{})})]}):null]})}import oc from"@emotion/styled";var rc=oc("div")`
1342
+ `;import{createContext as Kg}from"react";var co=Kg({isSelected:!1});import{jsx as Er}from"react/jsx-runtime";function Qm({element:e,attributes:t,children:o}){let r=qg(),n=Gg();return _g(()=>{try{let i=Wg.findPath(r,e);lo(r,[e,i])}catch{}},[]),Er(co.Provider,{value:{isSelected:n},children:Er(_m,{...t,columns:e.columns,children:Er("tbody",{children:o})})})}import{useContext as tb}from"react";import{useSelected as ob}from"slate-react";import{useCallback as xr,useRef as Qg,useState as Xg}from"react";import{useSlateStatic as jg}from"slate-react";import{jsx as ee}from"react/jsx-runtime";var Ze=e=>ee("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"1em",height:"1em",...e,children:ee("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm.75-11.25a.75.75 0 0 0-1.5 0v2.5h-2.5a.75.75 0 0 0 0 1.5h2.5v2.5a.75.75 0 0 0 1.5 0v-2.5h2.5a.75.75 0 0 0 0-1.5h-2.5v-2.5z",clipRule:"evenodd"})}),po=e=>ee("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"1em",height:"1em",...e,children:ee("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16zM6.75 9.25a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5z",clipRule:"evenodd"})}),uo=()=>ee(y,{children:ee("path",{d:"M4 6h16M4 12h16M4 18h16"})}),Xm=()=>ee(y,{children:ee("path",{d:"M4 6h16M4 12h10M4 18h14"})}),jm=()=>ee(y,{children:ee("path",{d:"M4 6h16M8 12h8M6 18h12"})}),Ym=()=>ee(y,{children:ee("path",{d:"M4 6h16M10 12h10M6 18h14"})});import{Fragment as Yg,jsx as pe,jsxs as Jm}from"react/jsx-runtime";function Zm({cellElement:e}){let t=jg(),o=O("column-menu"),r=Qg(null),[n,i]=Xg(!1),a=xr(()=>{i(!0)},[]),l=xr(()=>{i(!1)},[]),m=xr(()=>{o.layer&&o.close();let s=r.current;if(s===null)return;let c=[{icon:Xm,title:"\u5DE6\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"left"})}},{icon:jm,title:"\u4E2D\u592E\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"center"})}},{icon:Ym,title:"\u53F3\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"right"})}}];o.open(()=>pe(Ue,{dest:s,items:c,close:o.close}))},[]);return Jm(Am,{ref:r,contentEditable:!1,onClick:m,onMouseEnter:a,onMouseLeave:l,children:[pe(Fm,{className:"--tile",children:pe(uo,{})}),n?Jm(Yg,{children:[pe(so,{style:{top:0,left:"50%",marginLeft:"-0.5em"},onMouseDown:()=>t.tablePlugin.removeColumn({at:e}),children:pe(po,{})}),pe(Je,{style:{left:"-0.5em",top:0},onMouseDown:()=>t.tablePlugin.insertColumn({at:e}),children:pe(Ze,{})}),pe(Je,{style:{right:"-0.5em",top:0},onMouseDown:()=>t.tablePlugin.insertColumn({at:e,offset:1}),children:pe(Ze,{})})]}):null]})}import{useState as Jg}from"react";import{useSlateStatic as Zg}from"slate-react";import{Fragment as eb,jsx as Ie,jsxs as ec}from"react/jsx-runtime";function tc({cellElement:e}){let t=Zg(),[o,r]=Jg(!1);return ec(Om,{contentEditable:!1,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[Ie(Vm,{className:"--tile",children:Ie(uo,{})}),o?ec(eb,{children:[Ie(so,{style:{top:"50%",left:"0.5em",marginTop:"-0.5em"},onMouseDown:()=>t.tablePlugin.removeRow({at:e}),children:Ie(po,{})}),Ie(Je,{style:{top:"-0.5em",left:"0.5em"},onMouseDown:()=>t.tablePlugin.insertRow({at:e}),children:Ie(Ze,{})}),Ie(Je,{style:{bottom:"-0.5em",left:"0.5em"},onMouseDown:()=>t.tablePlugin.insertRow({at:e,offset:1}),children:Ie(Ze,{})})]}):null]})}import oc from"@emotion/styled";var rc=oc("div")`
1343
1343
  position: absolute;
1344
1344
  /**
1345
1345
  * very slightly shaded
@@ -1445,11 +1445,11 @@
1445
1445
  &.--selected {
1446
1446
  background: var(--blue-100);
1447
1447
  }
1448
- `;import{Fragment as Eb,jsx as ho,jsxs as xb}from"react/jsx-runtime";function xc(e){return[...Array(e).keys()]}function yc({dest:e,close:t}){let[o,r]=hb({x:0,y:0}),n=bb(),i=fb(null),a=j({src:i,dest:e},({dest:d})=>d?{left:d.left-8,top:d.top+d.height}:{left:0,top:0}),l=xc(5).map(d=>d+1),m=xc(5).map(d=>d+1),s=Ec((d,p)=>{r({x:d,y:p})},[r]),c=Ec((d,p)=>{n.tablePlugin.insertTable(d,p),gb.focus(n),t()},[n]);return xb(Eb,{children:[ho(ye,{close:t}),ho(hc,{ref:i,style:a,children:ho(gc,{onMouseLeave:()=>s(0,0),children:l.map(d=>m.map(p=>{let u=p<=o.x&&d<=o.y;return ho(bc,{className:ub({"--selected":u}),onMouseEnter:()=>s(p,d),onClick:()=>c(p,d)},`${p},${d}`)}))})})]})}import{useEffect as Kb,useRef as _b,useState as Wb}from"react";import{useSlateStatic as Gb}from"slate-react";import{jsx as b,jsxs as et}from"react/jsx-runtime";var kc=()=>b(y,{children:b("path",{d:"M7 12h10M7 5v14M17 5v14M15 19h4M15 5h4M5 19h4M5 5h4"})}),vc=()=>b(y,{className:"--more-icon",width:"0.5em",viewBox:"0 0 12 24",children:b("path",{d:"m2 12 4 4 4-4"})}),Tc=()=>b(y,{width:"0.5em",viewBox:"6 0 12 24",children:b("path",{d:"M9 12h6M12 9v6"})}),wc=()=>b(y,{children:b("path",{d:"M19 18v-8l-2 2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})}),Ic=()=>b(y,{children:b("path",{d:"M17 12a2 2 0 1 1 4 0c0 .591-.417 1.318-.816 1.858L17 18.001h4M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})}),Mc=()=>b(y,{children:b("path",{d:"M19 14a2 2 0 1 0-2-2M17 16a2 2 0 1 0 2-2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})});var Pc=()=>b(y,{children:b("path",{d:"M8 18V6h2l6 9V6h2v12h-2l-6-9v9H8z"})}),vr=()=>b(y,{children:b("path",{d:"M7 5h6a3.5 3.5 0 0 1 0 7H7zM13 12h1a3.5 3.5 0 0 1 0 7H7v-7"})}),Cc=()=>b(y,{children:b("path",{d:"M11 5h6M7 19h6M14 5l-4 14"})});var go=()=>et(y,{children:[b("path",{d:"M10 14a3.5 3.5 0 0 0 5 0l4-4a3.5 3.5 0 0 0-5-5l-.5.5"}),b("path",{d:"M14 10a3.5 3.5 0 0 0-5 0l-4 4a3.5 3.5 0 0 0 5 5l.5-.5"})]});var Tr=()=>b(y,{children:b("path",{d:"M10 11H6a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v6c0 2.667-1.333 4.333-4 5M19 11h-4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v6c0 2.667-1.333 4.333-4 5"})}),Sc=()=>et(y,{children:[b("path",{d:"M10 9l4 3-4 3"}),b("path",{d:"M16 9l4 3-4 3"})]});var Rc=()=>b(y,{children:b("path",{d:"M9 6h11M9 12h11M9 18h11M5 6v.01M5 12v.01M5 18v.01"})}),Lc=()=>et(y,{children:[b("rect",{x:4,y:4,width:16,height:16,rx:2}),b("path",{d:"M4 10h16M10 4v16"})]}),Bc=()=>b(y,{children:b("path",{d:"m7 8-4 4 4 4M17 8l4 4-4 4M14 4l-4 16"})}),zc=()=>b(y,{children:b("path",{d:"M9 8L5 12L9 16M15 8L19 12L15 16"})}),Dc=()=>et(y,{children:[b("path",{d:"M15 8h.01"}),b("rect",{x:4,y:4,width:16,height:16,rx:3}),b("path",{d:"m4 15 4-4a3 5 0 0 1 3 0l5 5"}),b("path",{d:"m14 14 1-1a3 5 0 0 1 3 0l2 2"})]});var Nc=()=>b(y,{children:b("path",{d:"M12 5v14M5 12h14"})}),$c=()=>b(y,{children:b("path",{d:"M5 12h14M16 6.5A4 2 0 0 0 12 5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1-4-1.5"})}),Hc=()=>b(y,{children:b("path",{d:"M7 5v5a5 5 0 0 0 10 0V5M5 19h14"})});var Ac=()=>et(y,{children:[b("path",{d:"m9 11 3 3 8-8"}),b("path",{d:"M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9"})]}),wr=()=>b(y,{children:b("path",{d:"M11 6h9M11 12h9M12 18h8M4 16a2 2 0 1 1 4 0c0 .591-.5 1-1 1.5L4 20h4M6 10V4L4 6"})}),Oc=()=>b(y,{children:b("path",{d:"M4 6h16M8 12h12M12 18h8M7 12l-3-3M7 12l-3 3"})}),Uc=()=>b(y,{children:b("path",{d:"M4 6h16M8 12h12M12 18h8M4 12l3-3M4 12l3 3"})});var Fc=()=>b(y,{children:b("path",{d:"M18 6L6 18M6 6l12 12"})}),Vc=()=>et(y,{children:[b("path",{d:"M4 20h4l10.5-10.5a2.828 2.828 0 1 0-4-4L4 16v4"}),b("path",{d:"M13.5 6.5l4 4"}),b("path",{d:"m14 19 6-6M18 15l2 2M5 21h4"})]}),Kc=()=>b(y,{children:b("path",{d:"M5 12h14"})});var Ir=[{icon:Oc,title:h("increaseDepth"),hotkey:"tab",action:e=>e.list.increaseDepth(),active:e=>e.list.canIncreaseDepth()},{icon:Uc,title:h("decreaseDepth"),hotkey:"shift+tab",action:e=>e.list.decreaseDepth(),active:e=>e.list.canDecreaseDepth()}],_c=[{icon:Pc,title:h("normal"),hotkey:"super+0",action:e=>{e.collapsibleParagraph.convertParagraph()}},{icon:wc,title:h("heading1"),hotkey:"super+1",action:e=>e.heading.convertHeading(1,!0),active:e=>e.heading.isHeadingActive(1)},{icon:Ic,title:h("heading2"),hotkey:"super+2",action:e=>e.heading.convertHeading(2,!0),active:e=>e.heading.isHeadingActive(2)},{icon:Mc,title:h("heading3"),hotkey:"super+3",action:e=>e.heading.convertHeading(3,!0),active:e=>e.heading.isHeadingActive(3)}],Wc=[..._c],Mr=[{icon:kc,title:h("paragraphStyle"),more:!0,children:_c}];import{useState as ue,useRef as qc,useEffect as kb,useCallback as Pr}from"react";import{useSlateStatic as vb}from"slate-react";import yb from"@emotion/styled";var Gc=yb(Y)`
1448
+ `;import{Fragment as Eb,jsx as ho,jsxs as xb}from"react/jsx-runtime";function xc(e){return[...Array(e).keys()]}function yc({dest:e,close:t}){let[o,r]=hb({x:0,y:0}),n=bb(),i=fb(null),a=j({src:i,dest:e},({dest:d})=>d?{left:d.left-8,top:d.top+d.height}:{left:0,top:0}),l=xc(5).map(d=>d+1),m=xc(5).map(d=>d+1),s=Ec((d,p)=>{r({x:d,y:p})},[r]),c=Ec((d,p)=>{n.tablePlugin.insertTable(d,p),gb.focus(n),t()},[n]);return xb(Eb,{children:[ho(ye,{close:t}),ho(hc,{ref:i,style:a,children:ho(gc,{onMouseLeave:()=>s(0,0),children:l.map(d=>m.map(p=>{let u=p<=o.x&&d<=o.y;return ho(bc,{className:ub({"--selected":u}),onMouseEnter:()=>s(p,d),onClick:()=>c(p,d)},`${p},${d}`)}))})})]})}import{useEffect as Kb,useRef as _b,useState as Wb}from"react";import{useSlateStatic as Gb}from"slate-react";import{jsx as b,jsxs as et}from"react/jsx-runtime";var kc=()=>b(y,{children:b("path",{d:"M7 12h10M7 5v14M17 5v14M15 19h4M15 5h4M5 19h4M5 5h4"})}),vc=()=>b(y,{className:"--more-icon",width:"0.5em",viewBox:"0 0 12 24",children:b("path",{d:"m2 12 4 4 4-4"})}),Tc=()=>b(y,{width:"0.5em",viewBox:"6 0 12 24",children:b("path",{d:"M9 12h6M12 9v6"})}),wc=()=>b(y,{children:b("path",{d:"M19 18v-8l-2 2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})}),Ic=()=>b(y,{children:b("path",{d:"M17 12a2 2 0 1 1 4 0c0 .591-.417 1.318-.816 1.858L17 18.001h4M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})}),Mc=()=>b(y,{children:b("path",{d:"M19 14a2 2 0 1 0-2-2M17 16a2 2 0 1 0 2-2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})});var Pc=()=>b(y,{children:b("path",{d:"M8 18V6h2l6 9V6h2v12h-2l-6-9v9H8z"})}),vr=()=>b(y,{children:b("path",{d:"M7 5h6a3.5 3.5 0 0 1 0 7H7zM13 12h1a3.5 3.5 0 0 1 0 7H7v-7"})}),Cc=()=>b(y,{children:b("path",{d:"M11 5h6M7 19h6M14 5l-4 14"})});var go=()=>et(y,{children:[b("path",{d:"M10 14a3.5 3.5 0 0 0 5 0l4-4a3.5 3.5 0 0 0-5-5l-.5.5"}),b("path",{d:"M14 10a3.5 3.5 0 0 0-5 0l-4 4a3.5 3.5 0 0 0 5 5l.5-.5"})]});var Tr=()=>b(y,{children:b("path",{d:"M10 11H6a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v6c0 2.667-1.333 4.333-4 5M19 11h-4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v6c0 2.667-1.333 4.333-4 5"})}),Sc=()=>et(y,{children:[b("path",{d:"M10 9l4 3-4 3"}),b("path",{d:"M16 9l4 3-4 3"})]});var Rc=()=>b(y,{children:b("path",{d:"M9 6h11M9 12h11M9 18h11M5 6v.01M5 12v.01M5 18v.01"})}),Lc=()=>et(y,{children:[b("rect",{x:4,y:4,width:16,height:16,rx:2}),b("path",{d:"M4 10h16M10 4v16"})]}),Bc=()=>b(y,{children:b("path",{d:"m7 8-4 4 4 4M17 8l4 4-4 4M14 4l-4 16"})}),zc=()=>b(y,{children:b("path",{d:"M9 8L5 12L9 16M15 8L19 12L15 16"})}),Dc=()=>et(y,{children:[b("path",{d:"M15 8h.01"}),b("rect",{x:4,y:4,width:16,height:16,rx:3}),b("path",{d:"m4 15 4-4a3 5 0 0 1 3 0l5 5"}),b("path",{d:"m14 14 1-1a3 5 0 0 1 3 0l2 2"})]});var Nc=()=>b(y,{children:b("path",{d:"M12 5v14M5 12h14"})}),$c=()=>b(y,{children:b("path",{d:"M5 12h14M16 6.5A4 2 0 0 0 12 5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1-4-1.5"})}),Hc=()=>b(y,{children:b("path",{d:"M7 5v5a5 5 0 0 0 10 0V5M5 19h14"})});var Ac=()=>et(y,{children:[b("path",{d:"m9 11 3 3 8-8"}),b("path",{d:"M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9"})]}),wr=()=>b(y,{children:b("path",{d:"M11 6h9M11 12h9M12 18h8M4 16a2 2 0 1 1 4 0c0 .591-.5 1-1 1.5L4 20h4M6 10V4L4 6"})}),Oc=()=>b(y,{children:b("path",{d:"M4 6h16M8 12h12M12 18h8M7 12l-3-3M7 12l-3 3"})}),Uc=()=>b(y,{children:b("path",{d:"M4 6h16M8 12h12M12 18h8M4 12l3-3M4 12l3 3"})});var Fc=()=>b(y,{children:b("path",{d:"M18 6L6 18M6 6l12 12"})}),Vc=()=>et(y,{children:[b("path",{d:"M4 20h4l10.5-10.5a2.828 2.828 0 1 0-4-4L4 16v4"}),b("path",{d:"M13.5 6.5l4 4"}),b("path",{d:"m14 19 6-6M18 15l2 2M5 21h4"})]}),Kc=()=>b(y,{children:b("path",{d:"M5 12h14"})});var Ir=[{icon:Oc,title:h("increaseDepth"),hotkey:"tab",action:e=>e.list.increaseDepth(),active:e=>e.list.canIncreaseDepth()},{icon:Uc,title:h("decreaseDepth"),hotkey:"shift+tab",action:e=>e.list.decreaseDepth(),active:e=>e.list.canDecreaseDepth()}],_c=[{icon:Pc,title:h("normal"),hotkey:"super+0",action:e=>{e.collapsibleParagraph.convertParagraph()}},{icon:wc,title:h("heading1"),hotkey:"super+1",action:e=>e.heading.convertHeading(1,!0),active:e=>e.heading.isHeadingActive(1)},{icon:Ic,title:h("heading2"),hotkey:"super+2",action:e=>e.heading.convertHeading(2,!0),active:e=>e.heading.isHeadingActive(2)},{icon:Mc,title:h("heading3"),hotkey:"super+3",action:e=>e.heading.convertHeading(3,!0),active:e=>e.heading.isHeadingActive(3)}],Wc=[..._c],Mr=[{icon:kc,title:h("paragraphStyle"),more:!0,children:_c}];import{useState as de,useRef as qc,useEffect as kb,useCallback as Pr}from"react";import{useSlateStatic as vb}from"slate-react";import yb from"@emotion/styled";var Gc=yb(Y)`
1449
1449
  width: 18em;
1450
1450
  padding: 0;
1451
1451
  overflow: hidden;
1452
- `;import{Fragment as Tb,jsx as A,jsxs as F}from"react/jsx-runtime";function Qc({dest:e,close:t}){let o=vb(),r=qc(null),n=qc(null),[i,a]=ue({x:0,y:0}),l=Pr((R,V)=>{a(he=>({x:he.x+R,y:he.y+V}))},[]),m=o.wysimark?.imageDialogState,s=!!o.wysimark?.onImageChange,c=!!o.wysimark?.onFileSelect,d=m?.imageSource??(s?"file":c?"select":"url"),[p,u]=ue(m?.url??""),[g,T]=ue(m?.alt??""),[S,L]=ue(m?.title??""),[M,N]=ue(!1),[w,B]=ue(d),[I,E]=ue(!1),[k,P]=ue(m?.uploadedUrl??""),C=R=>{B(R),P(""),fe("")},[se,fe]=ue(""),Ip=Pr(R=>{let V=R.target.value;T(V),M||L(V)},[M]),Mp=Pr(R=>{L(R.target.value),N(!0)},[]);kb(()=>{o.wysimark&&(o.wysimark.imageDialogState={url:p,alt:g,title:S,imageSource:w,uploadedUrl:k})},[o,p,g,S,w,k]);let Hr=()=>{o.wysimark&&(o.wysimark.imageDialogState=void 0)},yo=j({src:r,dest:e},({src:R,dest:V},he)=>ke(R,he,{left:V.left-16,top:V.top+V.height},{margin:16})),Pp={...yo,left:yo.left+i.x,top:yo.top+i.y};function Cp(R){R.preventDefault();let V=w==="file"||w==="select"?k:p;V.trim()!==""&&(o.image.insertImageFromUrl(V,g,S),Hr(),t())}function Sp(){Hr(),t()}async function Rp(R){let V=R.target.files?.[0];if(!(!V||!o.wysimark?.onImageChange)){fe(V.name),E(!0);try{let he=await o.wysimark.onImageChange(V);P(he)}catch(he){}finally{E(!1)}}}function Lp(){n.current?.click()}async function Bp(){if(o.wysimark?.onFileSelect){E(!0);try{let R=await o.wysimark.onFileSelect();R&&P(R)}catch(R){}finally{E(!1)}}}let ko=w==="file"||w==="select"?k.trim()===""||I:p.trim()==="";return F(Tb,{children:[A(ye,{close:t}),F(Gc,{ref:r,style:Pp,children:[A(Te,{onDrag:l}),F("form",{onSubmit:R=>{Cp(R)},style:{padding:"8px"},children:[(s||c)&&F("div",{style:{marginBottom:"12px"},children:[s&&F("label",{style:{display:"inline-flex",alignItems:"center",marginRight:"16px",cursor:"pointer"},children:[A("input",{type:"radio",name:"imageSource",value:"file",checked:w==="file",onChange:()=>C("file"),style:{marginRight:"4px"}}),h("imageSourceFile")]}),c&&F("label",{style:{display:"inline-flex",alignItems:"center",marginRight:"16px",cursor:"pointer"},children:[A("input",{type:"radio",name:"imageSource",value:"select",checked:w==="select",onChange:()=>C("select"),style:{marginRight:"4px"}}),h("imageSourceSelect")]}),F("label",{style:{display:"inline-flex",alignItems:"center",cursor:"pointer"},children:[A("input",{type:"radio",name:"imageSource",value:"url",checked:w==="url",onChange:()=>C("url"),style:{marginRight:"4px"}}),h("imageSourceUrl")]})]}),w==="url"?F("div",{style:{marginBottom:"8px"},children:[A("label",{style:{display:"block",marginBottom:"4px"},children:h("imageUrlRequired")}),A("input",{type:"text",value:p,onChange:R=>u(R.target.value),style:{width:"100%",padding:"6px",boxSizing:"border-box",border:"1px solid var(--shade-300)",borderRadius:"4px",backgroundColor:"var(--shade-50)",color:"var(--shade-700)"},placeholder:"https://example.com/image.jpg"})]}):w==="select"?F("div",{style:{marginBottom:"8px"},children:[A("button",{type:"button",onClick:()=>{Bp()},disabled:I,style:{padding:"8px 16px",backgroundColor:I?"#ccc":"#0078d4",color:I?"#666":"white",border:"none",borderRadius:"4px",cursor:I?"not-allowed":"pointer",marginBottom:"8px",fontWeight:"bold"},children:I?h("uploading"):h("imageSourceSelect")}),k&&A("div",{style:{marginTop:"8px",padding:"8px",backgroundColor:"var(--shade-100)",borderRadius:"4px"},children:F("div",{style:{color:"green",marginBottom:"4px"},children:["\u2713 ",h("uploadComplete")]})})]}):F("div",{style:{marginBottom:"8px"},children:[A("input",{ref:n,type:"file",accept:"image/*",onChange:R=>{Rp(R)},style:{display:"none"}}),A("button",{type:"button",onClick:Lp,disabled:I,style:{padding:"8px 16px",backgroundColor:I?"#ccc":"#0078d4",color:I?"#666":"white",border:"none",borderRadius:"4px",cursor:I?"not-allowed":"pointer",marginBottom:"8px",fontWeight:"bold"},children:I?h("uploading"):h("selectFile")}),k&&F("div",{style:{marginTop:"8px",padding:"8px",backgroundColor:"var(--shade-100)",borderRadius:"4px"},children:[F("div",{style:{color:"green",marginBottom:"4px"},children:["\u2713 ",h("uploadComplete")]}),se&&A("div",{style:{fontSize:"12px",color:"var(--shade-500)"},children:se})]})]}),F("div",{style:{marginBottom:"8px"},children:[A("label",{style:{display:"block",marginBottom:"4px"},children:h("altText")}),A("input",{type:"text",value:g,onChange:Ip,style:{width:"100%",padding:"6px",boxSizing:"border-box",border:"1px solid var(--shade-300)",borderRadius:"4px",backgroundColor:"var(--shade-50)",color:"var(--shade-700)"},placeholder:h("imageDescription")})]}),F("div",{style:{marginBottom:"8px"},children:[A("label",{style:{display:"block",marginBottom:"4px"},children:h("title")}),A("input",{type:"text",value:S,onChange:Mp,style:{width:"100%",padding:"6px",boxSizing:"border-box",border:"1px solid var(--shade-300)",borderRadius:"4px",backgroundColor:"var(--shade-50)",color:"var(--shade-700)"},placeholder:h("imageTitle")})]}),F("div",{style:{display:"flex",gap:"8px"},children:[A("button",{type:"submit",disabled:ko,style:{display:"flex",alignItems:"center",padding:"8px 16px",backgroundColor:ko?"#ccc":"#0078d4",color:"white",border:"none",borderRadius:"4px",cursor:ko?"not-allowed":"pointer",fontWeight:"bold"},children:h("register")}),A("button",{type:"button",onClick:Sp,style:{padding:"8px 16px",backgroundColor:"var(--shade-100)",color:"var(--shade-700)",border:"1px solid var(--shade-300)",borderRadius:"4px",cursor:"pointer"},children:h("cancel")})]})]})]})]})}import{isHotkey as wb}from"is-hotkey";import{useCallback as bo,useMemo as Ib,useRef as Mb,useState as kt}from"react";import{Editor as Pb,Range as Cb}from"slate";import{ReactEditor as Sb,useSlateStatic as Rb}from"slate-react";import Xc from"@emotion/styled";var Cr=Xc("div")`
1452
+ `;import{Fragment as Tb,jsx as A,jsxs as V}from"react/jsx-runtime";function Qc({dest:e,close:t}){let o=vb(),r=qc(null),n=qc(null),[i,a]=de({x:0,y:0}),l=Pr((R,F)=>{a(he=>({x:he.x+R,y:he.y+F}))},[]),m=o.wysimark?.imageDialogState,s=!!o.wysimark?.onImageChange,c=!!o.wysimark?.onFileSelect,d=m?.imageSource??(s?"file":c?"select":"url"),[p,u]=de(m?.url??""),[g,T]=de(m?.alt??""),[S,L]=de(m?.title??""),[M,N]=de(!1),[w,B]=de(d),[I,E]=de(!1),[k,P]=de(m?.uploadedUrl??""),C=R=>{B(R),P(""),fe("")},[ue,fe]=de(""),Ip=Pr(R=>{let F=R.target.value;T(F),M||L(F)},[M]),Mp=Pr(R=>{L(R.target.value),N(!0)},[]);kb(()=>{o.wysimark&&(o.wysimark.imageDialogState={url:p,alt:g,title:S,imageSource:w,uploadedUrl:k})},[o,p,g,S,w,k]);let Hr=()=>{o.wysimark&&(o.wysimark.imageDialogState=void 0)},yo=j({src:r,dest:e},({src:R,dest:F},he)=>ke(R,he,{left:F.left-16,top:F.top+F.height},{margin:16})),Pp={...yo,left:yo.left+i.x,top:yo.top+i.y};function Cp(R){R.preventDefault();let F=w==="file"||w==="select"?k:p;F.trim()!==""&&(o.image.insertImageFromUrl(F,g,S),Hr(),t())}function Sp(){Hr(),t()}async function Rp(R){let F=R.target.files?.[0];if(!(!F||!o.wysimark?.onImageChange)){fe(F.name),E(!0);try{let he=await o.wysimark.onImageChange(F);P(he)}catch(he){}finally{E(!1)}}}function Lp(){n.current?.click()}async function Bp(){if(o.wysimark?.onFileSelect){E(!0);try{let R=await o.wysimark.onFileSelect();R&&P(R)}catch(R){}finally{E(!1)}}}let ko=w==="file"||w==="select"?k.trim()===""||I:p.trim()==="";return V(Tb,{children:[A(ye,{close:t}),V(Gc,{ref:r,style:Pp,children:[A(Te,{onDrag:l}),V("form",{onSubmit:R=>{Cp(R)},style:{padding:"8px"},children:[(s||c)&&V("div",{style:{marginBottom:"12px"},children:[s&&V("label",{style:{display:"inline-flex",alignItems:"center",marginRight:"16px",cursor:"pointer"},children:[A("input",{type:"radio",name:"imageSource",value:"file",checked:w==="file",onChange:()=>C("file"),style:{marginRight:"4px"}}),h("imageSourceFile")]}),c&&V("label",{style:{display:"inline-flex",alignItems:"center",marginRight:"16px",cursor:"pointer"},children:[A("input",{type:"radio",name:"imageSource",value:"select",checked:w==="select",onChange:()=>C("select"),style:{marginRight:"4px"}}),h("imageSourceSelect")]}),V("label",{style:{display:"inline-flex",alignItems:"center",cursor:"pointer"},children:[A("input",{type:"radio",name:"imageSource",value:"url",checked:w==="url",onChange:()=>C("url"),style:{marginRight:"4px"}}),h("imageSourceUrl")]})]}),w==="url"?V("div",{style:{marginBottom:"8px"},children:[A("label",{style:{display:"block",marginBottom:"4px"},children:h("imageUrlRequired")}),A("input",{type:"text",value:p,onChange:R=>u(R.target.value),style:{width:"100%",padding:"6px",boxSizing:"border-box",border:"1px solid var(--shade-300)",borderRadius:"4px",backgroundColor:"var(--shade-50)",color:"var(--shade-700)"},placeholder:"https://example.com/image.jpg"})]}):w==="select"?V("div",{style:{marginBottom:"8px"},children:[A("button",{type:"button",onClick:()=>{Bp()},disabled:I,style:{padding:"8px 16px",backgroundColor:I?"#ccc":"#0078d4",color:I?"#666":"white",border:"none",borderRadius:"4px",cursor:I?"not-allowed":"pointer",marginBottom:"8px",fontWeight:"bold"},children:I?h("uploading"):h("imageSourceSelect")}),k&&A("div",{style:{marginTop:"8px",padding:"8px",backgroundColor:"var(--shade-100)",borderRadius:"4px"},children:V("div",{style:{color:"green",marginBottom:"4px"},children:["\u2713 ",k.split("/").pop()]})})]}):V("div",{style:{marginBottom:"8px"},children:[A("input",{ref:n,type:"file",accept:"image/*",onChange:R=>{Rp(R)},style:{display:"none"}}),A("button",{type:"button",onClick:Lp,disabled:I,style:{padding:"8px 16px",backgroundColor:I?"#ccc":"#0078d4",color:I?"#666":"white",border:"none",borderRadius:"4px",cursor:I?"not-allowed":"pointer",marginBottom:"8px",fontWeight:"bold"},children:I?h("uploading"):h("selectFile")}),k&&A("div",{style:{marginTop:"8px",padding:"8px",backgroundColor:"var(--shade-100)",borderRadius:"4px"},children:V("div",{style:{color:"green",marginBottom:"4px"},children:["\u2713 ",ue]})})]}),V("div",{style:{marginBottom:"8px"},children:[A("label",{style:{display:"block",marginBottom:"4px"},children:h("altText")}),A("input",{type:"text",value:g,onChange:Ip,style:{width:"100%",padding:"6px",boxSizing:"border-box",border:"1px solid var(--shade-300)",borderRadius:"4px",backgroundColor:"var(--shade-50)",color:"var(--shade-700)"},placeholder:h("imageDescription")})]}),V("div",{style:{marginBottom:"8px"},children:[A("label",{style:{display:"block",marginBottom:"4px"},children:h("title")}),A("input",{type:"text",value:S,onChange:Mp,style:{width:"100%",padding:"6px",boxSizing:"border-box",border:"1px solid var(--shade-300)",borderRadius:"4px",backgroundColor:"var(--shade-50)",color:"var(--shade-700)"},placeholder:h("imageTitle")})]}),V("div",{style:{display:"flex",gap:"8px"},children:[A("button",{type:"submit",disabled:ko,style:{display:"flex",alignItems:"center",padding:"8px 16px",backgroundColor:ko?"#ccc":"#0078d4",color:"white",border:"none",borderRadius:"4px",cursor:ko?"not-allowed":"pointer",fontWeight:"bold"},children:h("register")}),A("button",{type:"button",onClick:Sp,style:{padding:"8px 16px",backgroundColor:"var(--shade-100)",color:"var(--shade-700)",border:"1px solid var(--shade-300)",borderRadius:"4px",cursor:"pointer"},children:h("cancel")})]})]})]})]})}import{isHotkey as wb}from"is-hotkey";import{useCallback as bo,useMemo as Ib,useRef as Mb,useState as kt}from"react";import{Editor as Pb,Range as Cb}from"slate";import{ReactEditor as Sb,useSlateStatic as Rb}from"slate-react";import Xc from"@emotion/styled";var Cr=Xc("div")`
1453
1453
  /* Center vertically and horizontally */
1454
1454
  display: flex;
1455
1455
  align-items: center;
@@ -1478,4 +1478,4 @@
1478
1478
  margin-top: 0.5em;
1479
1479
  color: var(--shade-500);
1480
1480
  line-height: 1.375;
1481
- `;import{Fragment as Bb,jsx as te,jsxs as vt}from"react/jsx-runtime";var Lb=wb("enter");function Yc({dest:e,close:t}){let o=Rb(),r=Mb(null),[n,i]=kt({x:0,y:0}),a=bo((E,k)=>{i(P=>({x:P.x+E,y:P.y+k}))},[]),l=j({src:r,dest:e},({src:E,dest:k},P)=>!E||!k?{left:0,top:0}:ke(E,P,{left:k.left-12,top:k.top+k.height},{margin:16})),m={...l,left:l.left+n.x,top:l.top+n.y},s=Ib(()=>{let{selection:E}=o;return E&&!Cb.isCollapsed(E)?Pb.string(o,E):""},[]),[c,d]=kt(""),[p,u]=kt(s),[g,T]=kt(s),[S,L]=kt(!1),M=()=>{let E=p.trim()||c,k=g.trim()||void 0;o.anchor.insertLink(c,E,{select:!0,title:k}),Sb.focus(o),t()},N=bo(E=>{d(E.currentTarget.value)},[d]),w=bo(E=>{let k=E.currentTarget.value;u(k),S||T(k)},[u,T,S]),B=bo(E=>{T(E.currentTarget.value),L(!0)},[T]),I=E=>{Lb(E)&&(E.preventDefault(),E.stopPropagation(),M())};return vt(Bb,{children:[te(ye,{close:t}),vt(Oi,{ref:r,style:m,children:[te(Te,{onDrag:a}),vt("div",{style:{padding:"0.75em"},children:[te(At,{children:te(Ot,{type:"text",value:c,autoFocus:!0,placeholder:h("linkUrl"),onChange:N,onKeyDown:I})}),te(At,{style:{marginTop:"0.5em"},children:te(Ot,{type:"text",value:p,placeholder:h("linkText"),onChange:w,onKeyDown:I})}),vt(At,{style:{marginTop:"0.5em"},children:[te(Ot,{type:"text",value:g,placeholder:h("tooltipText"),onChange:B,onKeyDown:I}),vt(Cr,{onClick:M,children:[te(go,{}),te(Tc,{})]}),te(Cr,{onClick:t,style:{marginLeft:"0.25em",background:"var(--shade-400)"},children:te(Fc,{})})]}),te(jc,{children:h("tooltipHint")})]})]})]})}var Sr=[{icon:go,title:h("insertLink"),more:!0,hotkey:"mod+k",Component:Yc},{icon:Dc,title:h("insertImageFromUrl"),more:!0,Component:Qc},{icon:Lc,title:h("insertTable"),more:!0,Component:yc},{icon:Kc,title:h("horizontalRule"),hotkey:"super+-",action:e=>e.horizontalRule.insertHorizontalRule()}],Jc=Sr,Zc=Sr,ep=[{icon:Nc,title:h("insert"),more:!0,children:Sr}];import{Editor as zb}from"slate";function tt(e){let t=zb.marks(e);return{bold:t?.bold||!1,italic:t?.italic||!1,strike:t?.strike||!1,code:t?.code||!1,underline:t?.underline||!1,highlight:t?.highlight||!1}}var tp=[{icon:vr,title:h("bold"),hotkey:"mod+b",action:e=>e.marksPlugin.toggleBold(),active:e=>tt(e).bold},{icon:Cc,title:h("italic"),hotkey:"mod+i",action:e=>e.marksPlugin.toggleItalic(),active:e=>tt(e).italic},{icon:$c,title:h("strike"),hotkey:"super+k",action:e=>e.marksPlugin.toggleStrike(),active:e=>tt(e).strike},{icon:Bc,title:h("inlineCode"),hotkey:"mod+j",action:e=>e.inlineCode.toggleInlineCode(),active:e=>tt(e).code},{icon:Hc,title:h("underline"),hotkey:"mod+u",action:e=>e.marksPlugin.toggleUnderline(),active:e=>tt(e).underline},{icon:Vc,title:h("highlight"),hotkey:"mod+h",action:e=>e.marksPlugin.toggleHighlight(),active:e=>tt(e).highlight,show:e=>!e.wysimark.disableHighlight}],Rr=tp,op=[{icon:vr,title:h("format"),more:!0,children:tp}];var rp=[{icon:Rc,title:h("bulletList"),hotkey:"super+8",action:e=>e.list.convertUnorderedList(!0)},{icon:wr,title:h("numberedList"),hotkey:"super+7",action:e=>e.list.convertOrderedList(!0)},{icon:Ac,title:h("checkList"),hotkey:"super+9",action:e=>e.list.convertTaskList(!0),show:e=>!e.wysimark.disableTaskList}],Lr=[...rp,"divider",...Ir],np=[{icon:wr,title:h("list"),more:!0,children:[...rp,"divider",...Ir]}];import{Editor as ip,Path as Db,Transforms as Eo}from"slate";var ap=[{icon:Tr,title:h("quote"),hotkey:"super+.",action:e=>{e.blockQuotePlugin.isActive()?e.blockQuotePlugin.outdent():e.blockQuotePlugin.indent()},active:e=>e.blockQuotePlugin.isActive()},{icon:Sc,title:h("increaseQuoteDepth"),action:e=>e.blockQuotePlugin.increaseDepth(),active:e=>e.blockQuotePlugin.canIncreaseDepth()},{icon:zc,title:h("codeBlock"),action:e=>{let{selection:t}=e,o=x(e,"code-block");if(o){let[,r]=o,n=ip.string(e,r);Eo.removeNodes(e,{at:r}),Eo.insertNodes(e,{type:"paragraph",children:[{text:n}]},{at:r});return}if(t&&!Db.equals(t.anchor.path,t.focus.path)){e.codeBlock.createCodeBlock({language:"text"});return}if(t&&t.anchor.offset!==t.focus.offset){let r=ip.string(e,t);Eo.delete(e),Eo.insertNodes(e,{type:"code-block",language:"text",children:[{type:"code-block-line",children:[{text:r}]}]});return}e.codeBlock.createCodeBlock({language:"text"})},active:e=>!!x(e,"code-block"),show:e=>!e.wysimark.disableCodeBlock}],Br=ap,lp=[{icon:Tr,title:h("quote"),more:!0,children:ap}];var Nb=[...Wc,"divider",...Lr,"divider",...Rr,"divider",...Jc,"divider",...Br],$b=[...Mr,"divider",...Lr,"divider",...Rr,"divider",...Zc,"divider",...Br],sp=[...Mr,"divider",...np,"divider",...op,"divider",...ep,"divider",...lp],mp=sp;var ot=[Nb,$b,sp];import{clsx as Hb}from"clsx";import{useCallback as zr,useRef as Ab}from"react";import{ReactEditor as Ob,useSlate as Ub,useSlateStatic as Fb}from"slate-react";import{jsx as xo,jsxs as Vb}from"react/jsx-runtime";function cp({item:e}){let t=Fb(),o=Ub(),r=e.active?e.active(o):!1,n=Ab(null),i=J({title:e.title,hotkey:()=>e.hotkey?$t(e.hotkey):void 0}),a=O("menu"),l=zr(()=>{let c=n.current,d=e.children,p=e.Component;c&&(d?a.open(()=>xo(Ue,{dest:c,items:d,close:a.close})):p&&a.open(()=>xo(p,{dest:c,close:a.close})))},[e]),m=zr(()=>{if(e.action){e.action(t),Ob.focus(t);return}a.layer?a.close():l()},[a.layer,e]),s=zr(c=>{i.onMouseEnter(c),a.layer&&l()},[a.layer,l,i.onMouseEnter]);return Vb(Yi,{"data-item-type":"button",ref:n,onMouseEnter:s,onMouseLeave:i.onMouseLeave,onClick:m,className:Hb({"--active":r&&!Bo(e?.title)?.includes("Depth"),"--more":e.more,"--disabled":!r&&Bo(e?.title)?.includes("Depth")}),children:[xo(e.icon,{}),e.more?xo(vc,{}):null]})}import{jsx as rt}from"react/jsx-runtime";function qb({item:e}){let t=Gb();return e==="divider"?rt(Xi,{"data-item-type":"divider",children:rt(ji,{})}):(e.show===void 0?!0:e.show(t))?rt(cp,{item:e}):null}function Qb(e){let t=e.querySelector("[data-item-type=button]"),o=e.querySelector("[data-item-type=divider]");return!t||!o?null:{toolbar:e.offsetWidth,button:t.offsetWidth,divider:o.offsetWidth}}function Xb(e,t,o){let r=0;for(let n of e)r+=n==="divider"?o:t;return r}var jb=4;function pp(){let e=_b(null),[t,o]=Wb(mp);return Kb(()=>{let r=e.current;if(!r)return;let n=()=>{let a=Qb(r);if(a){for(let l=0;l<ot.length-1;l++)if(Xb(ot[l],a.button,a.divider)<a.toolbar-jb){o(ot[l]);return}o(ot[ot.length-1])}},i=new ResizeObserver(n);return i.observe(r),()=>{i.disconnect()}},[]),rt(qi,{ref:e,children:rt(Qi,{children:t.map((r,n)=>rt(qb,{item:r},typeof r=="string"?n:r.title))})})}import{jsx as Dr,jsxs as iE}from"react/jsx-runtime";function dp({attributes:e,Editable:t}){let o=Zb(null),r=nE(),n=rE(),i=Jb(a=>{a.target===a.currentTarget&&(tE.select(r,eE.end(r,[])),oE.focus(r))},[r]);return Dr(Bi,{children:iE(Ki,{ref:o,className:Yb({"--focused":n}),style:{height:r.toolbar.height,minHeight:r.toolbar.minHeight,maxHeight:r.toolbar.maxHeight},onClick:i,children:[Dr(pp,{}),Dr(t,{as:Vi,...e,style:{overflowY:"auto"}})]})})}var up=v((e,t)=>(e.toolbar={height:t.toolbar?.height,minHeight:t.toolbar?.minHeight,maxHeight:t.toolbar?.maxHeight,showUploadButtons:t.toolbar?.showUploadButtons??!0},{name:"toolbar",editor:{},renderEditable:dp,editableProps:{}}));import{Editor as Nr,Node as aE,Path as lE,Transforms as sE}from"slate";var fp=v(e=>(e.allowTrailingBlock=!0,{name:"trailing-block",editor:{normalizeNode:t=>{if(!Nr.isEditor(t[0]))return!1;let o=[e.children.length-1],r=aE.child(e,e.children.length-1);return(Nr.hasBlocks(e,r)||Nr.isVoid(e,r))&&sE.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:lE.next(o)}),!0}}}));import{Transforms as mE}from"slate";function cE(e,t){let o=ge(t),r=Ee(o);mE.insertNodes(e,r)}function hp(e){return{pasteMarkdown:f(cE,e)}}var gp=v(e=>(e.pasteMarkdown=hp(e),{name:"paste-markdown",editor:{},editableProps:{onPaste(t){let{types:o}=t.clipboardData;if(o.length!==1||o[0]!=="text/plain")return!1;let r=t.clipboardData.getData("text/plain");return e.pasteMarkdown.pasteMarkdown(r),Me(t),!0}}}));import{jsx as dE}from"react/jsx-runtime";function pE(e){let t={...e.attributes,style:{...e.attributes.style,width:void 0,maxWidth:void 0}};return dE("span",{...t,children:e.children})}var bp=v((e,t,{createPolicy:o})=>(e.placeholder={},o({name:"placeholder",editableProps:{renderPlaceholder:pE}})));var Ep=[gp,ps,Ea,ks,sm,Ls,El,Kl,Xl,pc,Ps,fp,rm,va,pm,ns,fc,up,hl,bp];var uE=ri(Ep),{withSink:xp,SinkEditable:yp}=uE;import{useState as fE}from"react";import{createEditor as hE,Editor as gE,Transforms as bE}from"slate";import{withHistory as EE}from"slate-history";import{withReact as xE}from"slate-react";function $r({authToken:e,height:t,minHeight:o,maxHeight:r,disableRawMode:n,disableTaskList:i,disableCodeBlock:a,disableHighlight:l}={}){let[m]=fE(()=>{let s=hE(),c=xp(xE(EE(s)),{toolbar:{height:t,minHeight:o,maxHeight:r,showUploadButtons:!!e},image:{}});return c.convertElement.addConvertElementType("paragraph"),s.wysimark={disableRawMode:n??!0,disableTaskList:i,disableCodeBlock:a,disableHighlight:l??!0},s.getMarkdown=()=>st(s.children),s.setMarkdown=d=>{let p=ge(d),u=Ee(p);s.children=u,s.selection=null,bE.select(s,gE.start(s,[0]))},c});return m}import{jsx as oe,jsxs as vp}from"react/jsx-runtime";function IE({children:e,attributes:t}){return oe("span",{...t,children:e})}function Tp({editor:e,value:t,onChange:o,throttleInMs:r=1e3,placeholder:n,className:i,style:a,onImageChange:l,onFileSelect:m}){let[s,c]=kp(!1),[d,p]=kp(t),u=wt(!1),g=wt(void 0),T=wt(void 0),S=wt(null),L=wt(o);L.current=o;let M=Tt(yE(()=>{let C=st(e.children);e.wysimark.prevValue={markdown:C,children:e.children},L.current(C)},r,{leading:!1,trailing:!0}),[e,r]),N=Tt(()=>{T.current!==e.children&&(T.current=e.children,M())},[M]);if(!s){let C=S.current??t;if(S.current!==null&&(S.current=null),e.wysimark.prevValue==null||g.current==null){u.current=!0;let se=ge(C),fe=Ee(se);e.children=fe,T.current=g.current=fe,e.wysimark.prevValue={markdown:C,children:fe}}else if(C!==e.wysimark.prevValue.markdown){u.current=!0;let se=ge(C),fe=Ee(se);e.children=fe,e.selection=null,vE.select(e,kE.start(e,[0]))}}let w=Tt(()=>{navigator.userAgent.toLowerCase().includes("firefox")&&TE.focus(e)},[e]),B=Tt(()=>{M.flush()},[M]),I=C=>{let se=C.target.value;p(se),o(se)},E=Tt(()=>{let C=e.getMarkdown();p(C)},[e]),k=()=>{s?(S.current=d,e.wysimark.prevValue=void 0,g.current=void 0,T.current=void 0):E(),c(!s)};e.wysimark.onImageChange=l,e.wysimark.onFileSelect=m,e.wysimark.onChange=o;let P=e.wysimark.disableRawMode;return vp("div",{style:{position:"relative",display:"flex",flexDirection:"column",flex:1,minHeight:0},children:[!P&&oe("div",{style:{position:"absolute",top:"5px",right:"25px",zIndex:10},children:oe("div",{onClick:k,style:{background:"none",border:s?"1px solid #4a90e2":"1px solid transparent",cursor:"pointer",padding:"6px",borderRadius:"4px",backgroundColor:s?"rgba(74, 144, 226, 0.1)":"transparent",boxShadow:s?"0 1px 3px rgba(0, 0, 0, 0.1)":"none",transition:"all 0.2s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center"},title:s?h("switchToVisualEditor"):h("switchToRawMarkdown"),role:"button",tabIndex:0,onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(k(),C.preventDefault())},children:vp("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[oe("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",fill:s?"rgba(74, 144, 226, 0.05)":"transparent"}),oe("path",{d:"M7 15V9L10 12L13 9V15",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),oe("path",{d:"M16 9H18V15",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),oe("path",{d:"M16 12H18",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})}),oe("div",{style:{display:s?"block":"none",textAlign:"center"},children:oe("textarea",{value:nt(d),onChange:I,placeholder:n,className:i,style:{width:"calc(100% - 60px)",margin:"0 auto",minHeight:"200px",padding:"20px",fontFamily:"monospace",fontSize:"1rem",color:"#333",lineHeight:"1.5",backgroundColor:"#fff",border:"1px solid #ddd",borderRadius:"4px",...a}})}),oe("div",{style:{display:s?"none":"flex",flexDirection:"column",flex:1,minHeight:0},children:oe(wE,{editor:e,initialValue:g.current,onChange:N,children:oe(yp,{renderLeaf:IE,onMouseDown:w,onBlur:B,placeholder:n,className:i,style:a})})})]})}import{jsx as wp}from"react/jsx-runtime";function BE({standaloneOptions:{onChange:e,placeholder:t,className:o,...r},standaloneMethodsRef:n}){let[i,a]=RE(r.initialMarkdown||""),l=SE(i),m=$r(r);l.current=i,CE(n,()=>({getMarkdown(){return l.current},setMarkdown(c){l.current=c,a(c)}}),[l,a]);let s=PE(c=>{l.current=c,a(c),e?.(c)},[m]);return wp(Tp,{editor:m,value:i,className:o||"",onChange:s,placeholder:t})}function zA(e,t){let o=ME(),r=LE(e);return r.render(wp(BE,{standaloneMethodsRef:o,standaloneOptions:t})),{unmount(){try{r.unmount()}catch{}},getMarkdown(){return o.current?.getMarkdown()||""},setMarkdown(n){o.current?.setMarkdown(n)}}}export{Tp as Editable,zA as createWysimark,$r as useEditor};
1481
+ `;import{Fragment as Bb,jsx as te,jsxs as vt}from"react/jsx-runtime";var Lb=wb("enter");function Yc({dest:e,close:t}){let o=Rb(),r=Mb(null),[n,i]=kt({x:0,y:0}),a=bo((E,k)=>{i(P=>({x:P.x+E,y:P.y+k}))},[]),l=j({src:r,dest:e},({src:E,dest:k},P)=>!E||!k?{left:0,top:0}:ke(E,P,{left:k.left-12,top:k.top+k.height},{margin:16})),m={...l,left:l.left+n.x,top:l.top+n.y},s=Ib(()=>{let{selection:E}=o;return E&&!Cb.isCollapsed(E)?Pb.string(o,E):""},[]),[c,d]=kt(""),[p,u]=kt(s),[g,T]=kt(s),[S,L]=kt(!1),M=()=>{let E=p.trim()||c,k=g.trim()||void 0;o.anchor.insertLink(c,E,{select:!0,title:k}),Sb.focus(o),t()},N=bo(E=>{d(E.currentTarget.value)},[d]),w=bo(E=>{let k=E.currentTarget.value;u(k),S||T(k)},[u,T,S]),B=bo(E=>{T(E.currentTarget.value),L(!0)},[T]),I=E=>{Lb(E)&&(E.preventDefault(),E.stopPropagation(),M())};return vt(Bb,{children:[te(ye,{close:t}),vt(Oi,{ref:r,style:m,children:[te(Te,{onDrag:a}),vt("div",{style:{padding:"0.75em"},children:[te(At,{children:te(Ot,{type:"text",value:c,autoFocus:!0,placeholder:h("linkUrl"),onChange:N,onKeyDown:I})}),te(At,{style:{marginTop:"0.5em"},children:te(Ot,{type:"text",value:p,placeholder:h("linkText"),onChange:w,onKeyDown:I})}),vt(At,{style:{marginTop:"0.5em"},children:[te(Ot,{type:"text",value:g,placeholder:h("tooltipText"),onChange:B,onKeyDown:I}),vt(Cr,{onClick:M,children:[te(go,{}),te(Tc,{})]}),te(Cr,{onClick:t,style:{marginLeft:"0.25em",background:"var(--shade-400)"},children:te(Fc,{})})]}),te(jc,{children:h("tooltipHint")})]})]})]})}var Sr=[{icon:go,title:h("insertLink"),more:!0,hotkey:"mod+k",Component:Yc},{icon:Dc,title:h("insertImageFromUrl"),more:!0,Component:Qc},{icon:Lc,title:h("insertTable"),more:!0,Component:yc},{icon:Kc,title:h("horizontalRule"),hotkey:"super+-",action:e=>e.horizontalRule.insertHorizontalRule()}],Jc=Sr,Zc=Sr,ep=[{icon:Nc,title:h("insert"),more:!0,children:Sr}];import{Editor as zb}from"slate";function tt(e){let t=zb.marks(e);return{bold:t?.bold||!1,italic:t?.italic||!1,strike:t?.strike||!1,code:t?.code||!1,underline:t?.underline||!1,highlight:t?.highlight||!1}}var tp=[{icon:vr,title:h("bold"),hotkey:"mod+b",action:e=>e.marksPlugin.toggleBold(),active:e=>tt(e).bold},{icon:Cc,title:h("italic"),hotkey:"mod+i",action:e=>e.marksPlugin.toggleItalic(),active:e=>tt(e).italic},{icon:$c,title:h("strike"),hotkey:"super+k",action:e=>e.marksPlugin.toggleStrike(),active:e=>tt(e).strike},{icon:Bc,title:h("inlineCode"),hotkey:"mod+j",action:e=>e.inlineCode.toggleInlineCode(),active:e=>tt(e).code},{icon:Hc,title:h("underline"),hotkey:"mod+u",action:e=>e.marksPlugin.toggleUnderline(),active:e=>tt(e).underline},{icon:Vc,title:h("highlight"),hotkey:"mod+h",action:e=>e.marksPlugin.toggleHighlight(),active:e=>tt(e).highlight,show:e=>!e.wysimark.disableHighlight}],Rr=tp,op=[{icon:vr,title:h("format"),more:!0,children:tp}];var rp=[{icon:Rc,title:h("bulletList"),hotkey:"super+8",action:e=>e.list.convertUnorderedList(!0)},{icon:wr,title:h("numberedList"),hotkey:"super+7",action:e=>e.list.convertOrderedList(!0)},{icon:Ac,title:h("checkList"),hotkey:"super+9",action:e=>e.list.convertTaskList(!0),show:e=>!e.wysimark.disableTaskList}],Lr=[...rp,"divider",...Ir],np=[{icon:wr,title:h("list"),more:!0,children:[...rp,"divider",...Ir]}];import{Editor as ip,Path as Db,Transforms as Eo}from"slate";var ap=[{icon:Tr,title:h("quote"),hotkey:"super+.",action:e=>{e.blockQuotePlugin.isActive()?e.blockQuotePlugin.outdent():e.blockQuotePlugin.indent()},active:e=>e.blockQuotePlugin.isActive()},{icon:Sc,title:h("increaseQuoteDepth"),action:e=>e.blockQuotePlugin.increaseDepth(),active:e=>e.blockQuotePlugin.canIncreaseDepth()},{icon:zc,title:h("codeBlock"),action:e=>{let{selection:t}=e,o=x(e,"code-block");if(o){let[,r]=o,n=ip.string(e,r);Eo.removeNodes(e,{at:r}),Eo.insertNodes(e,{type:"paragraph",children:[{text:n}]},{at:r});return}if(t&&!Db.equals(t.anchor.path,t.focus.path)){e.codeBlock.createCodeBlock({language:"text"});return}if(t&&t.anchor.offset!==t.focus.offset){let r=ip.string(e,t);Eo.delete(e),Eo.insertNodes(e,{type:"code-block",language:"text",children:[{type:"code-block-line",children:[{text:r}]}]});return}e.codeBlock.createCodeBlock({language:"text"})},active:e=>!!x(e,"code-block"),show:e=>!e.wysimark.disableCodeBlock}],Br=ap,lp=[{icon:Tr,title:h("quote"),more:!0,children:ap}];var Nb=[...Wc,"divider",...Lr,"divider",...Rr,"divider",...Jc,"divider",...Br],$b=[...Mr,"divider",...Lr,"divider",...Rr,"divider",...Zc,"divider",...Br],sp=[...Mr,"divider",...np,"divider",...op,"divider",...ep,"divider",...lp],mp=sp;var ot=[Nb,$b,sp];import{clsx as Hb}from"clsx";import{useCallback as zr,useRef as Ab}from"react";import{ReactEditor as Ob,useSlate as Ub,useSlateStatic as Fb}from"slate-react";import{jsx as xo,jsxs as Vb}from"react/jsx-runtime";function cp({item:e}){let t=Fb(),o=Ub(),r=e.active?e.active(o):!1,n=Ab(null),i=J({title:e.title,hotkey:()=>e.hotkey?$t(e.hotkey):void 0}),a=O("menu"),l=zr(()=>{let c=n.current,d=e.children,p=e.Component;c&&(d?a.open(()=>xo(Ue,{dest:c,items:d,close:a.close})):p&&a.open(()=>xo(p,{dest:c,close:a.close})))},[e]),m=zr(()=>{if(e.action){e.action(t),Ob.focus(t);return}a.layer?a.close():l()},[a.layer,e]),s=zr(c=>{i.onMouseEnter(c),a.layer&&l()},[a.layer,l,i.onMouseEnter]);return Vb(Yi,{"data-item-type":"button",ref:n,onMouseEnter:s,onMouseLeave:i.onMouseLeave,onClick:m,className:Hb({"--active":r&&!Bo(e?.title)?.includes("Depth"),"--more":e.more,"--disabled":!r&&Bo(e?.title)?.includes("Depth")}),children:[xo(e.icon,{}),e.more?xo(vc,{}):null]})}import{jsx as rt}from"react/jsx-runtime";function qb({item:e}){let t=Gb();return e==="divider"?rt(Xi,{"data-item-type":"divider",children:rt(ji,{})}):(e.show===void 0?!0:e.show(t))?rt(cp,{item:e}):null}function Qb(e){let t=e.querySelector("[data-item-type=button]"),o=e.querySelector("[data-item-type=divider]");return!t||!o?null:{toolbar:e.offsetWidth,button:t.offsetWidth,divider:o.offsetWidth}}function Xb(e,t,o){let r=0;for(let n of e)r+=n==="divider"?o:t;return r}var jb=4;function pp(){let e=_b(null),[t,o]=Wb(mp);return Kb(()=>{let r=e.current;if(!r)return;let n=()=>{let a=Qb(r);if(a){for(let l=0;l<ot.length-1;l++)if(Xb(ot[l],a.button,a.divider)<a.toolbar-jb){o(ot[l]);return}o(ot[ot.length-1])}},i=new ResizeObserver(n);return i.observe(r),()=>{i.disconnect()}},[]),rt(qi,{ref:e,children:rt(Qi,{children:t.map((r,n)=>rt(qb,{item:r},typeof r=="string"?n:r.title))})})}import{jsx as Dr,jsxs as iE}from"react/jsx-runtime";function dp({attributes:e,Editable:t}){let o=Zb(null),r=nE(),n=rE(),i=Jb(a=>{a.target===a.currentTarget&&(tE.select(r,eE.end(r,[])),oE.focus(r))},[r]);return Dr(Bi,{children:iE(Ki,{ref:o,className:Yb({"--focused":n}),style:{height:r.toolbar.height,minHeight:r.toolbar.minHeight,maxHeight:r.toolbar.maxHeight},onClick:i,children:[Dr(pp,{}),Dr(t,{as:Vi,...e,style:{overflowY:"auto"}})]})})}var up=v((e,t)=>(e.toolbar={height:t.toolbar?.height,minHeight:t.toolbar?.minHeight,maxHeight:t.toolbar?.maxHeight,showUploadButtons:t.toolbar?.showUploadButtons??!0},{name:"toolbar",editor:{},renderEditable:dp,editableProps:{}}));import{Editor as Nr,Node as aE,Path as lE,Transforms as sE}from"slate";var fp=v(e=>(e.allowTrailingBlock=!0,{name:"trailing-block",editor:{normalizeNode:t=>{if(!Nr.isEditor(t[0]))return!1;let o=[e.children.length-1],r=aE.child(e,e.children.length-1);return(Nr.hasBlocks(e,r)||Nr.isVoid(e,r))&&sE.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:lE.next(o)}),!0}}}));import{Transforms as mE}from"slate";function cE(e,t){let o=ge(t),r=Ee(o);mE.insertNodes(e,r)}function hp(e){return{pasteMarkdown:f(cE,e)}}var gp=v(e=>(e.pasteMarkdown=hp(e),{name:"paste-markdown",editor:{},editableProps:{onPaste(t){let{types:o}=t.clipboardData;if(o.length!==1||o[0]!=="text/plain")return!1;let r=t.clipboardData.getData("text/plain");return e.pasteMarkdown.pasteMarkdown(r),Me(t),!0}}}));import{jsx as dE}from"react/jsx-runtime";function pE(e){let t={...e.attributes,style:{...e.attributes.style,width:void 0,maxWidth:void 0}};return dE("span",{...t,children:e.children})}var bp=v((e,t,{createPolicy:o})=>(e.placeholder={},o({name:"placeholder",editableProps:{renderPlaceholder:pE}})));var Ep=[gp,ps,Ea,ks,sm,Ls,El,Kl,Xl,pc,Ps,fp,rm,va,pm,ns,fc,up,hl,bp];var uE=ri(Ep),{withSink:xp,SinkEditable:yp}=uE;import{useState as fE}from"react";import{createEditor as hE,Editor as gE,Transforms as bE}from"slate";import{withHistory as EE}from"slate-history";import{withReact as xE}from"slate-react";function $r({authToken:e,height:t,minHeight:o,maxHeight:r,disableRawMode:n,disableTaskList:i,disableCodeBlock:a,disableHighlight:l}={}){let[m]=fE(()=>{let s=hE(),c=xp(xE(EE(s)),{toolbar:{height:t,minHeight:o,maxHeight:r,showUploadButtons:!!e},image:{}});return c.convertElement.addConvertElementType("paragraph"),s.wysimark={disableRawMode:n??!0,disableTaskList:i,disableCodeBlock:a,disableHighlight:l??!0},s.getMarkdown=()=>st(s.children),s.setMarkdown=d=>{let p=ge(d),u=Ee(p);s.children=u,s.selection=null,bE.select(s,gE.start(s,[0]))},c});return m}import{jsx as oe,jsxs as vp}from"react/jsx-runtime";function IE({children:e,attributes:t}){return oe("span",{...t,children:e})}function Tp({editor:e,value:t,onChange:o,throttleInMs:r=1e3,placeholder:n,className:i,style:a,onImageChange:l,onFileSelect:m}){let[s,c]=kp(!1),[d,p]=kp(t),u=wt(!1),g=wt(void 0),T=wt(void 0),S=wt(null),L=wt(o);L.current=o;let M=Tt(yE(()=>{let C=st(e.children);e.wysimark.prevValue={markdown:C,children:e.children},L.current(C)},r,{leading:!1,trailing:!0}),[e,r]),N=Tt(()=>{T.current!==e.children&&(T.current=e.children,M())},[M]);if(!s){let C=S.current??t;if(S.current!==null&&(S.current=null),e.wysimark.prevValue==null||g.current==null){u.current=!0;let ue=ge(C),fe=Ee(ue);e.children=fe,T.current=g.current=fe,e.wysimark.prevValue={markdown:C,children:fe}}else if(C!==e.wysimark.prevValue.markdown){u.current=!0;let ue=ge(C),fe=Ee(ue);e.children=fe,e.selection=null,vE.select(e,kE.start(e,[0]))}}let w=Tt(()=>{navigator.userAgent.toLowerCase().includes("firefox")&&TE.focus(e)},[e]),B=Tt(()=>{M.flush()},[M]),I=C=>{let ue=C.target.value;p(ue),o(ue)},E=Tt(()=>{let C=e.getMarkdown();p(C)},[e]),k=()=>{s?(S.current=d,e.wysimark.prevValue=void 0,g.current=void 0,T.current=void 0):E(),c(!s)};e.wysimark.onImageChange=l,e.wysimark.onFileSelect=m,e.wysimark.onChange=o;let P=e.wysimark.disableRawMode;return vp("div",{style:{position:"relative",display:"flex",flexDirection:"column",flex:1,minHeight:0},children:[!P&&oe("div",{style:{position:"absolute",top:"5px",right:"25px",zIndex:10},children:oe("div",{onClick:k,style:{background:"none",border:s?"1px solid #4a90e2":"1px solid transparent",cursor:"pointer",padding:"6px",borderRadius:"4px",backgroundColor:s?"rgba(74, 144, 226, 0.1)":"transparent",boxShadow:s?"0 1px 3px rgba(0, 0, 0, 0.1)":"none",transition:"all 0.2s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center"},title:s?h("switchToVisualEditor"):h("switchToRawMarkdown"),role:"button",tabIndex:0,onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(k(),C.preventDefault())},children:vp("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[oe("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",fill:s?"rgba(74, 144, 226, 0.05)":"transparent"}),oe("path",{d:"M7 15V9L10 12L13 9V15",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),oe("path",{d:"M16 9H18V15",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),oe("path",{d:"M16 12H18",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})}),oe("div",{style:{display:s?"block":"none",textAlign:"center"},children:oe("textarea",{value:nt(d),onChange:I,placeholder:n,className:i,style:{width:"calc(100% - 60px)",margin:"0 auto",minHeight:"200px",padding:"20px",fontFamily:"monospace",fontSize:"1rem",color:"#333",lineHeight:"1.5",backgroundColor:"#fff",border:"1px solid #ddd",borderRadius:"4px",...a}})}),oe("div",{style:{display:s?"none":"flex",flexDirection:"column",flex:1,minHeight:0},children:oe(wE,{editor:e,initialValue:g.current,onChange:N,children:oe(yp,{renderLeaf:IE,onMouseDown:w,onBlur:B,placeholder:n,className:i,style:a})})})]})}import{jsx as wp}from"react/jsx-runtime";function BE({standaloneOptions:{onChange:e,placeholder:t,className:o,...r},standaloneMethodsRef:n}){let[i,a]=RE(r.initialMarkdown||""),l=SE(i),m=$r(r);l.current=i,CE(n,()=>({getMarkdown(){return l.current},setMarkdown(c){l.current=c,a(c)}}),[l,a]);let s=PE(c=>{l.current=c,a(c),e?.(c)},[m]);return wp(Tp,{editor:m,value:i,className:o||"",onChange:s,placeholder:t})}function zA(e,t){let o=ME(),r=LE(e);return r.render(wp(BE,{standaloneMethodsRef:o,standaloneOptions:t})),{unmount(){try{r.unmount()}catch{}},getMarkdown(){return o.current?.getMarkdown()||""},setMarkdown(n){o.current?.setMarkdown(n)}}}export{Tp as Editable,zA as createWysimark,$r as useEditor};
package/dist/index.mjs CHANGED
@@ -8632,7 +8632,7 @@ function ImageUrlDialog({
8632
8632
  ),
8633
8633
  uploadedUrl && /* @__PURE__ */ jsx61("div", { style: { marginTop: "8px", padding: "8px", backgroundColor: "var(--shade-100)", borderRadius: "4px" }, children: /* @__PURE__ */ jsxs29("div", { style: { color: "green", marginBottom: "4px" }, children: [
8634
8634
  "\u2713 ",
8635
- t("uploadComplete")
8635
+ uploadedUrl.split("/").pop()
8636
8636
  ] }) })
8637
8637
  ] }) : /* @__PURE__ */ jsxs29("div", { style: { marginBottom: "8px" }, children: [
8638
8638
  /* @__PURE__ */ jsx61(
@@ -8664,13 +8664,10 @@ function ImageUrlDialog({
8664
8664
  children: isUploading ? t("uploading") : t("selectFile")
8665
8665
  }
8666
8666
  ),
8667
- uploadedUrl && /* @__PURE__ */ jsxs29("div", { style: { marginTop: "8px", padding: "8px", backgroundColor: "var(--shade-100)", borderRadius: "4px" }, children: [
8668
- /* @__PURE__ */ jsxs29("div", { style: { color: "green", marginBottom: "4px" }, children: [
8669
- "\u2713 ",
8670
- t("uploadComplete")
8671
- ] }),
8672
- uploadedFileName && /* @__PURE__ */ jsx61("div", { style: { fontSize: "12px", color: "var(--shade-500)" }, children: uploadedFileName })
8673
- ] })
8667
+ uploadedUrl && /* @__PURE__ */ jsx61("div", { style: { marginTop: "8px", padding: "8px", backgroundColor: "var(--shade-100)", borderRadius: "4px" }, children: /* @__PURE__ */ jsxs29("div", { style: { color: "green", marginBottom: "4px" }, children: [
8668
+ "\u2713 ",
8669
+ uploadedFileName
8670
+ ] }) })
8674
8671
  ] }),
8675
8672
  /* @__PURE__ */ jsxs29("div", { style: { marginBottom: "8px" }, children: [
8676
8673
  /* @__PURE__ */ jsx61("label", { style: { display: "block", marginBottom: "4px" }, children: t("altText") }),