wysimark-lite 0.25.3 → 0.25.5

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
@@ -1,38 +1,38 @@
1
- "use client";import{createRef as pE,useCallback as dE,useImperativeHandle as uE,useRef as fE,useState as hE}from"react";import{createRoot as gE}from"react-dom/client";import iE from"lodash.throttle";import{useCallback as yt,useRef as go,useState as bp}from"react";import{Editor as aE,Transforms as lE}from"slate";import{ReactEditor as sE,Slate as mE}from"slate-react";import Xp from"remark-parse";import{unified as Yp}from"unified";function yo(){return{enter:{table:Pp,tableData:Dr,tableHeader:Dr,tableRow:Sp},exit:{codeText:Rp,table:Cp,tableData:xo,tableHeader:xo,tableRow:xo}}}function Pp(e){let t=e._align;this.enter({type:"table",align:t.map(function(o){return o==="none"?null:o}),children:[]},e),this.data.inTable=!0}function Cp(e){this.exit(e),this.data.inTable=void 0}function Sp(e){this.enter({type:"tableRow",children:[]},e)}function xo(e){this.exit(e)}function Dr(e){this.enter({type:"tableCell",children:[]},e)}function Rp(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Lp));let o=this.stack[this.stack.length-1];o.type,o.value=t,this.exit(e)}function Lp(e,t){return t==="|"?t:e}import{gfm as Bp}from"micromark-extension-gfm";import{gfmToMarkdown as zp}from"mdast-util-gfm";function Nr(e){if(e)return function(t){return this.data||(this.data={}),e.call(this,t)}}function $r(){return function(){if(!this)return;let e=this.data(),t=e.micromarkExtensions||(e.micromarkExtensions=[]),o=e.fromMarkdownExtensions||(e.fromMarkdownExtensions=[]),r=e.toMarkdownExtensions||(e.toMarkdownExtensions=[]);t.push(Bp());let n=function(){let i=yo();if(i.enter)for(let a of Object.keys(i.enter))i.enter[a]=Nr(i.enter[a]);if(i.exit)for(let a of Object.keys(i.exit))i.exit[a]=Nr(i.exit[a]);return i};o.push(n()),r.push(zp())}}function ue(e){let t=/\[([^\]]+)\]\(([^)]+)\)/g,o=[],r=0,n=e.replace(t,s=>(o.push(s),`__MARKDOWN_LINK_${r++}__`)),i=/(https?:\/\/[^\s]+)/g,l=n.replace(i,s=>s.replace(/\//g,"\\/"));for(let s=0;s<o.length;s++)l=l.replace(`__MARKDOWN_LINK_${s}__`,o[s]);return l}function tt(e){return e.replace(/\\(.)/g,(t,o)=>o)}function Hr(e,t){if(!e)throw new Error(`${t}`)}function kt(e,t){if(e.type!==t)throw new Error(`Expected element to be of type ${JSON.stringify(e)} but is ${JSON.stringify(e,null,2)}`)}function fe(e){throw new Error(`Didn't expect to get here with value ${JSON.stringify(e,null,2)}`)}function Ar(e){return[{type:"block-quote",children:Be(e.children)}]}function Or(e){let t=e.value.split(`
2
- `);return[{type:"code-block",language:e.lang||"text",children:t.map(o=>({type:"code-block-line",children:[{text:o}]}))}]}function Ur(e){return[{type:"block-quote",children:[{type:"paragraph",children:[{text:`[${e.identifier}]`}]},...Be(e.children)]}]}import{Text as Xr}from"slate";import{Text as Qr}from"slate";import*as ot from"slate";function A(e){return ot.Text.isText(e)}function oe(e){return ot.Element.isElement(e)}function R(e){return ot.Text.isText(e)&&!!e.text.match(/^\s+$/)&&!e.code}var Fr={bold:"**",italic:"_",strike:"~~",highlight:"<mark>",code:""},Vr={bold:"**",italic:"_",strike:"~~",highlight:"</mark>",code:""};function Dp(e){if(e in Fr)return Fr[e];throw new Error(`Could not find mark ${JSON.stringify(e)} in MARK_KEY_TO_OPEN_TOKEN lookup`)}function Np(e){if(e in Vr)return Vr[e];throw new Error(`Could not find mark ${JSON.stringify(e)} in MARK_KEY_TO_CLOSE_TOKEN lookup`)}function Kr(e){return e.map(Dp).join("")}function _r(e){return e.map(Np).join("")}import{Text as $p}from"slate";function rt(e){let{text:t,...o}=e;return Object.keys(o)}function ko(e){if($p.isText(e)){if(R(e))throw new Error("You probably didn't mean to do this. We should only be getting marks from segments that are not plain space segments.");return rt(e)}else{if(e.type==="anchor")return vo(e.children);throw new Error(`Unhandled type ${e.type}`)}}function vo(e){let t;for(let o of e){if(!A(o)){if(o.type==="image-inline")continue;throw new Error("Expected every segment in an anchor to be a Text segment")}if(R(o))continue;let r=rt(o);if(t===void 0){t=r;continue}t=t.filter(n=>r.includes(n))}if(t===void 0)throw new Error("No text segments were found as children in this anchor which should not be possible");return t}var Wr=["bold","italic","underline","strike","highlight","code"];function Gr(e){return e.slice().sort((t,o)=>Wr.indexOf(t)-Wr.indexOf(o))}var Hp=["\\","`","*","_","[","]","(",")","#","+","-",".","!","|","^","~","<",">","{","}","=",":",";","$","%","&","?",'"',"'",",","\\","/","@"],Ap=new RegExp(`(${Hp.map(e=>`\\${e}`).join("|")})`,"g");function qr(e){return e.replace(Ap,t=>`\\${t}`)}function Op(e,t){let o=rt(e),r=rt(t);return o.length==r.length&&o.every(n=>r.includes(n))}function jr(e,t){let o=Qr.isText(e),r=Qr.isText(t);return t&&!r&&!o?[{text:""},e]:o?t===void 0||!r?[e]:Op(t,e)?(t.text=[t.text,e.text].join(""),[]):[e]:[e]}function Yr(e){let t=[];for(let o=0;o<e.length;o++){let r=t[t.length-1];t.push(...jr(e[o],r))}return t.length===0&&t.push({text:""}),Xr.isText(t[0])||t.unshift({text:""}),Xr.isText(t[t.length-1])||t.push({text:""}),t}function Jr(e){return{url:e.url,title:e.title||void 0,alt:e.alt||void 0}}var Up=/^(\/[^?#]*)(?:\?([^#]*))?(#.*)?$/;function ze(e){try{let t=new URL(e);return{origin:t.origin,hostname:t.hostname,pathname:t.pathname,searchParams:t.searchParams,hash:t.hash}}catch{let t=e.match(Up);if(t===null)throw new Error(`Invalid format should not happen: ${e}`);let[,o,r,n]=[...t];return{origin:"",hostname:"",pathname:o||"",searchParams:new URLSearchParams(r),hash:n||""}}}function nt(e){if(typeof e!="string")return null;let t=e.match(/^(\d+)x(\d+)$/);return t===null?null:{width:parseInt(t[1]),height:parseInt(t[2])}}function Zr(e){let t=ze(e.url);if(!t.hostname.match(/[.]portive[.]com$/i))return;let o=t.searchParams.get("size");if(o===null)return;let r=nt(o);if(r===null)return;let n=t.pathname.match(/[-][-](\d+)x(\d+)[.][a-zA-Z]+$/);if(n!==null)return{url:`${t.origin}${t.pathname}`,title:e.title||void 0,alt:e.alt||void 0,width:r.width,height:r.height,srcWidth:parseInt(n[1]),srcHeight:parseInt(n[2])}}function en(e){let t=ze(e.url);if(t.hash.length===0)return;let o=new URLSearchParams(t.hash.slice(1)),r=nt(o.get("size")),n=nt(o.get("srcSize"));if(!(!r||!n))return{url:`${t.origin}${t.pathname}`,title:e.title||void 0,alt:e.alt||void 0,width:r.width,height:r.height,srcWidth:n.width,srcHeight:n.height}}var tn=[Zr,en,Jr];function on(e){for(let t of tn){let o=t(e);if(o)return[{type:"image-inline",...o,children:[{text:""}]}]}throw new Error("Shouldn't get here because last parser always returns data")}function Fp(e,t){let o=e.match(/^<mark>(.+?)<\/mark>$/s);return o?[{text:o[1],...t,highlight:!0}]:[{text:e,code:!0}]}function F(e,t={}){let o=[];for(let n of e)o.push(...Vp(n,t));return Yr(o)}function Vp(e,t={}){switch(e.type){case"delete":return F(e.children,{...t,strike:!0});case"emphasis":return F(e.children,{...t,italic:!0});case"footnoteReference":return[{text:`[${e.identifier}]`}];case"html":return Fp(e.value,t);case"image":return on(e);case"inlineCode":return[{text:e.value,...t,code:!0}];case"link":return[{type:"anchor",href:e.url,title:e.title==null?void 0:e.title,children:F(e.children,t)}];case"strong":return F(e.children,{...t,bold:!0});case"text":return[{text:e.value,...t}];case"linkReference":case"imageReference":throw new Error("linkReference and imageReference should be converted to link and image through our transformInlineLinks function");case"break":return[{text:`
3
- `}];case"footnote":throw new Error("footnote is not supported yet")}fe(e)}function rn(e){return[{type:"heading",level:e.depth,children:F(e.children)}]}function nn(e){return[{type:"html-block",html:e.value,children:[{text:""}]}]}function an(e,{depth:t,ordered:o,checked:r}){switch(e.type){case"paragraph":return r===!0||r===!1?[{type:"task-list-item",depth:t,checked:r,children:F(e.children)}]:o?[{type:"ordered-list-item",depth:t,children:F(e.children)}]:[{type:"unordered-list-item",depth:t,children:F(e.children)}];case"list":return vt(e,t+1);default:return To(e)}}function ln(e,t){let o=[];for(let r of e.children)o.push(...an(r,{...t,checked:e.checked}));return o}function vt(e,t=0){let o=[];for(let r of e.children)o.push(...ln(r,{depth:t,ordered:!!e.ordered}));return o}function Kp(e){return!(e.length!==3||!("text"in e[0])||e[0].text!==""||!("text"in e[2])||e[2].text!==""||!("type"in e[1])||e[1].type!=="image-inline")}var _p="\xA0";function Wp(e){return!(e.length!==1||!("text"in e[0])||e[0].text!==_p)}function sn(e){let t=F(e.children);return Kp(t)?[{...t[1],type:"image-block"}]:Wp(t)?[{type:"paragraph",children:[{text:""}]}]:[{type:"paragraph",children:t}]}function mn(e){if(e.align==null)throw new Error("Expected an array of AlignType for table.align");return[{type:"table",columns:e.align.map(t=>({align:t||"left"})),children:e.children.map(Gp)}]}function Gp(e){if(e.type!=="tableRow")throw new Error("Expected a tableRow");return{type:"table-row",children:e.children.map(qp)}}function qp(e){if(e.type!=="tableCell")throw new Error("Expected a tableCell");return{type:"table-cell",children:[{type:"table-content",children:F(e.children)}]}}function cn(){return[{type:"horizontal-rule",children:[{text:""}]}]}function Be(e){let t=[];for(let o of e)t.push(...To(o));return t}function To(e){switch(e.type){case"blockquote":return Ar(e);case"code":return Or(e);case"definition":throw new Error('The type "definition" should not exist. See comments');case"footnoteDefinition":return Ur(e);case"heading":return rn(e);case"html":return nn(e);case"list":return vt(e);case"paragraph":return sn(e);case"table":return mn(e);case"thematicBreak":return cn();case"yaml":return[]}fe(e)}import{definitions as Qp}from"mdast-util-definitions";import{SKIP as pn,visit as jp}from"unist-util-visit";function dn(e){let t=Qp(e);jp(e,(o,r,n)=>{let i=o,a=n;if(i.type==="definition"&&a!==null&&typeof r=="number")return a.children.splice(r,1),[pn,r];if(i.type==="imageReference"||i.type==="linkReference"){let l="identifier"in i&&typeof i.identifier=="string"?i.identifier:"",s=t(l);if(s&&a!==null&&typeof r=="number"){let m=i.type==="imageReference"?{type:"image",url:s.url,title:s.title,alt:i.alt}:{type:"link",url:s.url,title:s.title,children:i.children};return a.children[r]=m,[pn,r]}}})}var Jp=Yp().use(Xp).use($r());function Zp(e){let t=Jp.parse(e);return dn(t),t}function he(e){let t=Zp(e);return t.children.length===0?[{type:"paragraph",children:[{text:""}]}]:Be(t.children)}function ed(e){return e.type==="ordered-list-item"||e.type==="unordered-list-item"||e.type==="task-list-item"}function un(e){let t=[],o=-1;for(let r of e){if(!ed(r)){t.push(r),o=-1;continue}let n=r.depth>o+1?o+1:r.depth;t.push({...r,depth:n}),o=n}return t}function fn(e){if(e.type!=="code-block-line")throw new Error(`Expected all children of code-block to be a codeline but is ${JSON.stringify(e,null,2)}`);return e.children.map(t=>t.text).join("")}function hn(e){let t=[],o=3;for(let r of e.children){let n=fn(r),i=n.match(/^([`]+)/);i&&(o=Math.max(o,i[1].length+1)),t.push(n)}return t.unshift(`${"`".repeat(o)}${e.language}`),t.push(`${"`".repeat(o)}`),`${t.join(`
1
+ "use client";import{createRef as xE,useCallback as yE,useImperativeHandle as kE,useRef as TE,useState as vE}from"react";import{createRoot as wE}from"react-dom/client";import uE from"lodash.throttle";import{useCallback as kt,useRef as Tt,useState as yp}from"react";import{Editor as fE,Transforms as hE}from"slate";import{ReactEditor as gE,Slate as bE}from"slate-react";import od from"remark-parse";import{unified as rd}from"unified";function ko(){return{enter:{table:Sp,tableData:$r,tableHeader:$r,tableRow:Lp},exit:{codeText:Bp,table:Rp,tableData:yo,tableHeader:yo,tableRow:yo}}}function Sp(e){let t=e._align;this.enter({type:"table",align:t.map(function(o){return o==="none"?null:o}),children:[]},e),this.data.inTable=!0}function Rp(e){this.exit(e),this.data.inTable=void 0}function Lp(e){this.enter({type:"tableRow",children:[]},e)}function yo(e){this.exit(e)}function $r(e){this.enter({type:"tableCell",children:[]},e)}function Bp(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,zp));let o=this.stack[this.stack.length-1];o.type,o.value=t,this.exit(e)}function zp(e,t){return t==="|"?t:e}import{gfm as Dp}from"micromark-extension-gfm";import{gfmToMarkdown as Np}from"mdast-util-gfm";function Hr(e){if(e)return function(t){return this.data||(this.data={}),e.call(this,t)}}function Ar(){return function(){if(!this)return;let e=this.data(),t=e.micromarkExtensions||(e.micromarkExtensions=[]),o=e.fromMarkdownExtensions||(e.fromMarkdownExtensions=[]),r=e.toMarkdownExtensions||(e.toMarkdownExtensions=[]);t.push(Dp());let n=function(){let i=ko();if(i.enter)for(let a of Object.keys(i.enter))i.enter[a]=Hr(i.enter[a]);if(i.exit)for(let a of Object.keys(i.exit))i.exit[a]=Hr(i.exit[a]);return i};o.push(n()),r.push(Np())}}function fe(e){let t=/\[([^\]]+)\]\(([^)]+)\)/g,o=[],r=0,n=e.replace(t,s=>(o.push(s),`__MARKDOWN_LINK_${r++}__`)),i=[];n=Hp(n,i);let l=/(https?:\/\/[^\s]+)/g;n=n.replace(l,s=>s.replace(/\//g,"\\/"));for(let s=0;s<i.length;s++)n=n.replace(`__HTML_BLOCK_${s}__`,i[s]);for(let s=0;s<o.length;s++)n=n.replace(`__MARKDOWN_LINK_${s}__`,o[s]);return n}function ot(e){return e.replace(/\\(.)/g,(t,o)=>o)}var $p=new Set(["script","style"]);function Hp(e,t){let o="",r=0;for(;r<e.length;){let n=e.indexOf("<",r);if(n===-1){o+=e.slice(r);break}if(o+=e.slice(r,n),e.startsWith("<!--",n)){let d=e.indexOf("-->",n+4);if(d===-1){o+=e.slice(n);break}let p=e.slice(n,d+3);t.push(p),o+=`__HTML_BLOCK_${t.length-1}__`,r=d+3;continue}if(e.startsWith("<![CDATA[",n)){let d=e.indexOf("]]>",n+9);if(d===-1){o+=e.slice(n);break}let p=e.slice(n,d+3);t.push(p),o+=`__HTML_BLOCK_${t.length-1}__`,r=d+3;continue}let i=To(e,n);if(!i){o+="<",r=n+1;continue}let l=`__HTML_BLOCK_${t.length}__`;if(!i.name){let d=e.slice(n,i.endIndex+1);t.push(d),o+=l,r=i.endIndex+1;continue}let s=i.name.toLowerCase();if(i.isClosing||i.isSelfClosing){let d=e.slice(n,i.endIndex+1);t.push(d),o+=l,r=i.endIndex+1;continue}if($p.has(s)){let d=e.toLowerCase().indexOf(`</${s}`,i.endIndex+1);if(d!==-1){let p=To(e,d);if(p){let g=e.slice(n,p.endIndex+1);t.push(g),o+=l,r=p.endIndex+1;continue}}}let m=Op(e,s,i.endIndex+1);if(m!==null){let d=e.slice(n,m+1);t.push(d),o+=l,r=m+1;continue}let c=e.slice(n,i.endIndex+1);t.push(c),o+=l,r=i.endIndex+1}return o}function To(e,t){if(e[t]!=="<")return null;let o=Ap(e,t);if(o===-1)return null;let r=t+1;if(r>=e.length)return null;let n=e[r];if(n==="!"||n==="?")return{name:null,endIndex:o,isClosing:!1,isSelfClosing:!0};let i=!1;n==="/"&&(i=!0,r+=1);let a=/^[A-Za-z][A-Za-z0-9-]*/.exec(e.slice(r));if(!a)return null;let l=a[0],s=e.slice(t,o+1),m=/\/\s*>$/.test(s);return{name:l,endIndex:o,isClosing:i,isSelfClosing:m}}function Ap(e,t){let o=null;for(let r=t+1;r<e.length;r++){let n=e[r];if(o){n===o&&(o=null);continue}if(n==="'"||n==='"'){o=n;continue}if(n===">")return r}return-1}function Op(e,t,o){let r=1,n=o,i=t.toLowerCase();for(;n<e.length;){let a=e.indexOf("<",n);if(a===-1)return null;let l=To(e,a);if(!l||!l.name){n=a+1;continue}if(l.name.toLowerCase()===i&&(l.isClosing?r-=1:l.isSelfClosing||(r+=1),r===0))return l.endIndex;n=l.endIndex+1}return null}function Or(e,t){if(!e)throw new Error(`${t}`)}function vt(e,t){if(e.type!==t)throw new Error(`Expected element to be of type ${JSON.stringify(e)} but is ${JSON.stringify(e,null,2)}`)}function he(e){throw new Error(`Didn't expect to get here with value ${JSON.stringify(e,null,2)}`)}function Ur(e){return[{type:"block-quote",children:ze(e.children)}]}function _r(e){let t=e.value.split(`
2
+ `);return[{type:"code-block",language:e.lang||"text",children:t.map(o=>({type:"code-block-line",children:[{text:o}]}))}]}function Fr(e){return[{type:"block-quote",children:[{type:"paragraph",children:[{text:`[${e.identifier}]`}]},...ze(e.children)]}]}import{Text as Jr}from"slate";import{Text as jr}from"slate";import*as rt from"slate";function A(e){return rt.Text.isText(e)}function oe(e){return rt.Element.isElement(e)}function L(e){return rt.Text.isText(e)&&!!e.text.match(/^\s+$/)&&!e.code}var Vr={bold:"**",italic:"_",strike:"~~",highlight:"<mark>",code:""},Kr={bold:"**",italic:"_",strike:"~~",highlight:"</mark>",code:""};function Up(e){if(e in Vr)return Vr[e];throw new Error(`Could not find mark ${JSON.stringify(e)} in MARK_KEY_TO_OPEN_TOKEN lookup`)}function _p(e){if(e in Kr)return Kr[e];throw new Error(`Could not find mark ${JSON.stringify(e)} in MARK_KEY_TO_CLOSE_TOKEN lookup`)}function Wr(e){return e.map(Up).join("")}function Gr(e){return e.map(_p).join("")}import{Text as Fp}from"slate";function nt(e){let{text:t,...o}=e;return Object.keys(o)}function vo(e){if(Fp.isText(e)){if(L(e))throw new Error("You probably didn't mean to do this. We should only be getting marks from segments that are not plain space segments.");return nt(e)}else{if(e.type==="anchor")return wo(e.children);throw new Error(`Unhandled type ${e.type}`)}}function wo(e){let t;for(let o of e){if(!A(o)){if(o.type==="image-inline")continue;throw new Error("Expected every segment in an anchor to be a Text segment")}if(L(o))continue;let r=nt(o);if(t===void 0){t=r;continue}t=t.filter(n=>r.includes(n))}if(t===void 0)throw new Error("No text segments were found as children in this anchor which should not be possible");return t}var qr=["bold","italic","underline","strike","highlight","code"];function Qr(e){return e.slice().sort((t,o)=>qr.indexOf(t)-qr.indexOf(o))}var Vp=["\\","`","*","_","[","]","~","|","<"],Kp=new RegExp(`(${Vp.map(e=>`\\${e}`).join("|")})`,"g");function Xr(e){let t=e.replace(Kp,o=>`\\${o}`);return t=t.replace(/^(#{1,6})(\s)/m,"\\$1$2"),t=t.replace(/^(\d+)([.)]\s)/m,"$1\\$2"),t=t.replace(/^([-+>])\s/m,"\\$1 "),t}function Wp(e,t){let o=nt(e),r=nt(t);return o.length==r.length&&o.every(n=>r.includes(n))}function Yr(e,t){let o=jr.isText(e),r=jr.isText(t);return t&&!r&&!o?[{text:""},e]:o?t===void 0||!r?[e]:Wp(t,e)?(t.text=[t.text,e.text].join(""),[]):[e]:[e]}function Zr(e){let t=[];for(let o=0;o<e.length;o++){let r=t[t.length-1];t.push(...Yr(e[o],r))}return t.length===0&&t.push({text:""}),Jr.isText(t[0])||t.unshift({text:""}),Jr.isText(t[t.length-1])||t.push({text:""}),t}function en(e){return{url:e.url,title:e.title||void 0,alt:e.alt||void 0}}var Gp=/^([^?#]*)(?:\?([^#]*))?(#.*)?$/;function De(e){try{let t=new URL(e);return{origin:t.origin,hostname:t.hostname,pathname:t.pathname,searchParams:t.searchParams,hash:t.hash}}catch{let t=e.match(Gp);if(t===null)throw new Error(`Invalid format should not happen: ${e}`);let[,o,r,n]=[...t];return{origin:"",hostname:"",pathname:o||"",searchParams:new URLSearchParams(r),hash:n||""}}}function it(e){if(typeof e!="string")return null;let t=e.match(/^(\d+)x(\d+)$/);return t===null?null:{width:parseInt(t[1],10),height:parseInt(t[2],10)}}function tn(e){let t=De(e.url);if(!t.hostname.match(/[.]portive[.]com$/i))return;let o=t.searchParams.get("size");if(o===null)return;let r=it(o);if(r===null)return;let n=t.pathname.match(/[-][-](\d+)x(\d+)[.][a-zA-Z]+$/);if(n!==null)return{url:`${t.origin}${t.pathname}`,title:e.title||void 0,alt:e.alt||void 0,width:r.width,height:r.height,srcWidth:parseInt(n[1],10),srcHeight:parseInt(n[2],10)}}function on(e){let t=De(e.url);if(t.hash.length===0)return;let o=new URLSearchParams(t.hash.slice(1)),r=it(o.get("size")),n=it(o.get("srcSize"));if(!(!r||!n))return{url:`${t.origin}${t.pathname}`,title:e.title||void 0,alt:e.alt||void 0,width:r.width,height:r.height,srcWidth:n.width,srcHeight:n.height}}var rn=[tn,on,en];function nn(e){for(let t of rn){let o=t(e);if(o)return[{type:"image-inline",...o,children:[{text:""}]}]}throw new Error("Shouldn't get here because last parser always returns data")}function qp(e,t){let o=e.match(/^<mark>(.+?)<\/mark>$/s);return o?[{text:o[1],...t,highlight:!0}]:[{text:e,code:!0}]}function _(e,t={}){let o=[];for(let n of e)o.push(...Qp(n,t));return Zr(o)}function Qp(e,t={}){switch(e.type){case"delete":return _(e.children,{...t,strike:!0});case"emphasis":return _(e.children,{...t,italic:!0});case"footnoteReference":return[{text:`[${e.identifier}]`}];case"html":return qp(e.value,t);case"image":return nn(e);case"inlineCode":return[{text:e.value,...t,code:!0}];case"link":return[{type:"anchor",href:e.url,title:e.title==null?void 0:e.title,children:_(e.children,t)}];case"strong":return _(e.children,{...t,bold:!0});case"text":return[{text:e.value,...t}];case"linkReference":case"imageReference":throw new Error("linkReference and imageReference should be converted to link and image through our transformInlineLinks function");case"break":return[{text:`
3
+ `}];case"footnote":throw new Error("footnote is not supported yet")}he(e)}function an(e){return[{type:"heading",level:e.depth,children:_(e.children)}]}function ln(e){return[{type:"html-block",html:e.value,children:[{text:""}]}]}function sn(e,{depth:t,ordered:o,checked:r}){switch(e.type){case"paragraph":return r===!0||r===!1?[{type:"task-list-item",depth:t,checked:r,children:_(e.children)}]:o?[{type:"ordered-list-item",depth:t,children:_(e.children)}]:[{type:"unordered-list-item",depth:t,children:_(e.children)}];case"list":return wt(e,t+1);default:return Io(e)}}function mn(e,t){let o=[];for(let r of e.children)o.push(...sn(r,{...t,checked:e.checked}));return o}function wt(e,t=0){let o=[];for(let r of e.children)o.push(...mn(r,{depth:t,ordered:!!e.ordered}));return o}function Xp(e){return!(e.length!==3||!("text"in e[0])||e[0].text!==""||!("text"in e[2])||e[2].text!==""||!("type"in e[1])||e[1].type!=="image-inline")}var jp="\xA0";function Yp(e){return!(e.length!==1||!("text"in e[0])||e[0].text!==jp)}function cn(e){let t=_(e.children);return Xp(t)?[{...t[1],type:"image-block"}]:Yp(t)?[{type:"paragraph",children:[{text:""}]}]:[{type:"paragraph",children:t}]}function pn(e){if(e.align==null)throw new Error("Expected an array of AlignType for table.align");return[{type:"table",columns:e.align.map(t=>({align:t||"left"})),children:e.children.map(Jp)}]}function Jp(e){if(e.type!=="tableRow")throw new Error("Expected a tableRow");return{type:"table-row",children:e.children.map(Zp)}}function Zp(e){if(e.type!=="tableCell")throw new Error("Expected a tableCell");return{type:"table-cell",children:[{type:"table-content",children:_(e.children)}]}}function dn(){return[{type:"horizontal-rule",children:[{text:""}]}]}function ze(e){let t=[];for(let o of e)t.push(...Io(o));return t}function Io(e){switch(e.type){case"blockquote":return Ur(e);case"code":return _r(e);case"definition":throw new Error('The type "definition" should not exist. See comments');case"footnoteDefinition":return Fr(e);case"heading":return an(e);case"html":return ln(e);case"list":return wt(e);case"paragraph":return cn(e);case"table":return pn(e);case"thematicBreak":return dn();case"yaml":return[]}he(e)}import{definitions as ed}from"mdast-util-definitions";import{SKIP as un,visit as td}from"unist-util-visit";function fn(e){let t=ed(e);td(e,(o,r,n)=>{let i=o,a=n;if(i.type==="definition"&&a!==null&&typeof r=="number")return a.children.splice(r,1),[un,r];if(i.type==="imageReference"||i.type==="linkReference"){let l="identifier"in i&&typeof i.identifier=="string"?i.identifier:"",s=t(l);if(s&&a!==null&&typeof r=="number"){let m=i.type==="imageReference"?{type:"image",url:s.url,title:s.title,alt:i.alt}:{type:"link",url:s.url,title:s.title,children:i.children};return a.children[r]=m,[un,r]}}})}var nd=rd().use(od).use(Ar());function id(e){let t=nd.parse(e);return fn(t),t}function ge(e){let t=id(e);return t.children.length===0?[{type:"paragraph",children:[{text:""}]}]:ze(t.children)}function ad(e){return e.type==="ordered-list-item"||e.type==="unordered-list-item"||e.type==="task-list-item"}function hn(e){let t=[],o=-1;for(let r of e){if(!ad(r)){t.push(r),o=-1;continue}let n=r.depth>o+1?o+1:r.depth;t.push({...r,depth:n}),o=n}return t}function gn(e){if(e.type!=="code-block-line")throw new Error(`Expected all children of code-block to be a codeline but is ${JSON.stringify(e,null,2)}`);return e.children.map(t=>t.text).join("")}function bn(e){let t=[],o=3;for(let r of e.children){let n=gn(r),i=n.match(/^([`]+)/);i&&(o=Math.max(o,i[1].length+1)),t.push(n)}return t.unshift(`${"`".repeat(o)}${e.language}`),t.push(`${"`".repeat(o)}`),`${t.join(`
4
4
  `)}
5
5
 
6
- `}function gn(e){return e.url}function bn(e){if(e.url.startsWith("$"))return"";let{hostname:t}=ze(e.url);if(t.match(/[.]portive[.]com$/i)&&e.width&&e.height)return`${e.url}?size=${e.width}x${e.height}`}function En(e){if(e.width&&e.height&&e.srcWidth&&e.srcHeight)return`${e.url}#srcSize=${e.srcWidth}x${e.srcHeight}&size=${e.width}x${e.height}`}var td=[bn,En,gn];function Tt(e){for(let t of td){let o=t(e);if(typeof o=="string")return o===""?"":`![${e.alt}](${o}${typeof e.title=="string"?` "${e.title}"`:""})`}throw new Error("Shouldn't get here")}function xn(e){let t=Tt(e);return t?`${t}
6
+ `}function En(e){return e.url}function xn(e){if(e.url.startsWith("$"))return"";let{hostname:t}=De(e.url);if(t.match(/[.]portive[.]com$/i)&&e.width&&e.height)return`${e.url}?size=${e.width}x${e.height}`}function yn(e){if(e.width&&e.height&&e.srcWidth&&e.srcHeight)return`${e.url}#srcSize=${e.srcWidth}x${e.srcHeight}&size=${e.width}x${e.height}`}var ld=[xn,yn,En];function It(e){for(let t of ld){let o=t(e);if(typeof o=="string")return o===""?"":`![${e.alt}](${o}${typeof e.title=="string"?` "${e.title}"`:""})`}throw new Error("Shouldn't get here")}function kn(e){let t=It(e);return t?`${t}
7
7
 
8
- `:""}import{Element as ad,Text as ld}from"slate";function yn(e,t){let o=t.filter(n=>!e.includes(n));return{orderedMarksToAdd:Gr(o)}}function kn(e,t){let o=[...e],r=e.filter(i=>!t.includes(i)),n=[];for(let i=0;i<e.length&&r.length!==0;i++){let a=o.pop();if(a===void 0)throw new Error("This shouldn't happen unless we made a mistake in the algorithm");n.push(a);let l=r.indexOf(a);l!==-1&&r.splice(l,1)}return{orderedMarksToRemove:n,nextOrderedMarks:o}}function wo(e,t){let{orderedMarksToRemove:o,nextOrderedMarks:r}=kn(e,t),{orderedMarksToAdd:n}=yn(r,t);return{remove:o,add:n,nextOrderedMarks:[...r,...n]}}import{Element as rd}from"slate";function vn({node:e,nextNode:t,nodes:o,index:r}){return!A(e)||!R(e)||e.code||!A(t)||!R(t)||e.code?!1:(o.splice(r,2,{text:`${e.text}${t.text}`}),!0)}function Tn({node:e,nodes:t,prevNode:o,index:r}){if(!oe(e)||e.type!=="anchor")return!1;let n=e.children[0];return A(n)&&R(n)?(e.children.splice(0,1),A(o)&&R(o)?o.text=`${o.text}${n.text}`:t.splice(r,0,{text:n.text}),!0):!1}function wn({node:e,nodes:t,nextNode:o,index:r}){if(!oe(e)||e.type!=="anchor")return!1;let n=e.children[e.children.length-1];return A(n)&&R(n)?(e.children.splice(e.children.length-1,1),A(o)&&R(o)?o.text=`${n.text}${o.text}`:t.splice(r+1,0,{text:n.text}),!0):!1}function In({node:e}){return!oe(e)||e.type!=="line"||e.children.length>0?!1:(e.children.push({text:""}),!0)}function Mn({node:e,nodes:t,index:o}){if(!A(e)||R(e)||e.code)return!1;let r=e.text.match(/^(\s*)(.*?)(\s*)$/);if(!r||r[1].length===0&&r[3].length===0)return!1;let n=[{text:r[1]},{...e,text:r[2]},{text:r[3]}].filter(i=>i.text!=="");return t.splice(o,1,...n),!0}function Pn({index:e,nodes:t,node:o,parent:r}){return e!==t.length-1||t.length<=1||!A(o)||!R(o)?!1:r&&oe(r)&&r.type==="line"?(t.splice(t.length-1,1),!0):!1}function Cn({index:e,nodes:t,node:o,parent:r}){return e!==0||t.length===0||!A(o)||!R(o)?!1:r&&oe(r)&&r.type==="line"?(t.splice(0,1),!0):!1}var Sn=[Mn,Tn,wn,vn,Cn,Pn,In];function Rn(e){for(let t of Sn)if(t(e))return!0;return!1}var od=72;function Io(e,t){let o=!1,r,n=0,i=(e.length+1)*od;do{if(r=!1,n=n+1,n>i)throw new Error(`There have been ${n} normalization passes (72x the number of nodes at this level). This likely indicates a bug in the code.`);e:for(let a=0;a<e.length;a++){let l=e[a];if(oe(l)&&Io(l.children,l)){r=!0,o=!0;break e}let s=e[a-1],m=e[a+1];if(Rn({parent:t,node:l,prevNode:s,nextNode:m,index:a,nodes:e})){r=!0,o=!0;break e}}}while(r);return o}var Ln=e=>e.map(t=>rd.isElement(t)&&t.type==="anchor"?{...t,children:Ln(t.children)}:t);function Bn(e){let t={type:"line",children:Ln(e)};return Io([t],void 0),t.children}import{Text as id}from"slate";function zn(e){let t=0;for(let o of e.text.matchAll(/[`]+/g))t=Math.max(t,o[0].length);return t===0?`\`${e.text.replace(/[`]/g,"\\`")}\``:`${"`".repeat(t+1)} ${e.text} ${"`".repeat(t+1)}`}function nd(e){return e.replace(/"/g,'\\"')}function Dn(e){let t=vo(e.children);return e.href.startsWith("$")?_(e.children,t,t):typeof e.title=="string"&&e.title.length>0?`[${_(e.children,t,t)}](${e.href} "${nd(e.title)}")`:`[${_(e.children,t,t)}](${e.href})`}function Nn(e){return qr(e.text)}function $n(e){if(id.isText(e))return e.code?zn(e):Nn(e);switch(e.type){case"anchor":return Dn(e);case"image-inline":return Tt(e);default:fe(e)}}function _(e,t=[],o=[]){let r=Bn(e),n=[],i=wo(t,ko(r[0]));for(let a=0;a<r.length;a++){let l=r[a];if(ld.isText(l)&&R(l)){n.push(l.text);continue}n.push(Kr(i.add)),n.push($n(l));let s=sd(r,a,o),m=wo(i.nextOrderedMarks,s);n.push(_r(m.remove)),i=m}return n.join("")}function sd(e,t,o){for(let r=t+1;r<e.length;r++){let n=e[r];if(!R(n)&&!(ad.isElement(n)&&n.type==="image-inline"))return ko(n)}return o}function An(e){let t=[];return t.push(Hn(e.children[0])),t.push(md(e.columns)),e.children.slice(1).forEach(o=>{t.push(Hn(o))}),`${t.join(`
8
+ `:""}import{Element as dd,Text as ud}from"slate";function Tn(e,t){let o=t.filter(n=>!e.includes(n));return{orderedMarksToAdd:Qr(o)}}function vn(e,t){let o=[...e],r=e.filter(i=>!t.includes(i)),n=[];for(let i=0;i<e.length&&r.length!==0;i++){let a=o.pop();if(a===void 0)throw new Error("This shouldn't happen unless we made a mistake in the algorithm");n.push(a);let l=r.indexOf(a);l!==-1&&r.splice(l,1)}return{orderedMarksToRemove:n,nextOrderedMarks:o}}function Mo(e,t){let{orderedMarksToRemove:o,nextOrderedMarks:r}=vn(e,t),{orderedMarksToAdd:n}=Tn(r,t);return{remove:o,add:n,nextOrderedMarks:[...r,...n]}}import{Element as md}from"slate";function wn({node:e,nextNode:t,nodes:o,index:r}){return!A(e)||!L(e)||e.code||!A(t)||!L(t)||t.code?!1:(o.splice(r,2,{text:`${e.text}${t.text}`}),!0)}function In({node:e,nodes:t,prevNode:o,index:r}){if(!oe(e)||e.type!=="anchor")return!1;let n=e.children[0];return A(n)&&L(n)?(e.children.splice(0,1),A(o)&&L(o)?o.text=`${o.text}${n.text}`:t.splice(r,0,{text:n.text}),!0):!1}function Mn({node:e,nodes:t,nextNode:o,index:r}){if(!oe(e)||e.type!=="anchor")return!1;let n=e.children[e.children.length-1];return A(n)&&L(n)?(e.children.splice(e.children.length-1,1),A(o)&&L(o)?o.text=`${n.text}${o.text}`:t.splice(r+1,0,{text:n.text}),!0):!1}function Pn({node:e}){return!oe(e)||e.type!=="line"||e.children.length>0?!1:(e.children.push({text:""}),!0)}function Cn({node:e,nodes:t,index:o}){if(!A(e)||L(e)||e.code)return!1;let r=e.text.match(/^(\s*)(.*?)(\s*)$/);if(!r||r[1].length===0&&r[3].length===0)return!1;let n=[{text:r[1]},{...e,text:r[2]},{text:r[3]}].filter(i=>i.text!=="");return t.splice(o,1,...n),!0}function Sn({index:e,nodes:t,node:o,parent:r}){return e!==t.length-1||t.length<=1||!A(o)||!L(o)?!1:r&&oe(r)&&r.type==="line"?(t.splice(t.length-1,1),!0):!1}function Rn({index:e,nodes:t,node:o,parent:r}){return e!==0||t.length===0||!A(o)||!L(o)?!1:r&&oe(r)&&r.type==="line"?(t.splice(0,1),!0):!1}var Ln=[Cn,In,Mn,wn,Rn,Sn,Pn];function Bn(e){for(let t of Ln)if(t(e))return!0;return!1}var sd=72;function Po(e,t){let o=!1,r,n=0,i=(e.length+1)*sd;do{if(r=!1,n=n+1,n>i)throw new Error(`There have been ${n} normalization passes (72x the number of nodes at this level). This likely indicates a bug in the code.`);e:for(let a=0;a<e.length;a++){let l=e[a];if(oe(l)&&Po(l.children,l)){r=!0,o=!0;break e}let s=e[a-1],m=e[a+1];if(Bn({parent:t,node:l,prevNode:s,nextNode:m,index:a,nodes:e})){r=!0,o=!0;break e}}}while(r);return o}var zn=e=>e.map(t=>md.isElement(t)&&t.type==="anchor"?{...t,children:zn(t.children)}:t);function Dn(e){let t={type:"line",children:zn(e)};return Po([t],void 0),t.children}import{Text as pd}from"slate";function Nn(e){let t=0;for(let o of e.text.matchAll(/[`]+/g))t=Math.max(t,o[0].length);return t===0?`\`${e.text.replace(/[`]/g,"\\`")}\``:`${"`".repeat(t+1)} ${e.text} ${"`".repeat(t+1)}`}function cd(e){return e.replace(/"/g,'\\"')}function $n(e){let t=wo(e.children);return e.href.startsWith("$")?K(e.children,t,t):typeof e.title=="string"&&e.title.length>0?`[${K(e.children,t,t)}](${e.href} "${cd(e.title)}")`:`[${K(e.children,t,t)}](${e.href})`}function Hn(e){return Xr(e.text)}function An(e){if(pd.isText(e))return e.code?Nn(e):Hn(e);switch(e.type){case"anchor":return $n(e);case"image-inline":return It(e);default:he(e)}}function K(e,t=[],o=[]){let r=Dn(e),n=[],i=Mo(t,vo(r[0]));for(let a=0;a<r.length;a++){let l=r[a];if(ud.isText(l)&&L(l)){n.push(l.text);continue}n.push(Wr(i.add)),n.push(An(l));let s=fd(r,a,o),m=Mo(i.nextOrderedMarks,s);n.push(Gr(m.remove)),i=m}return n.join("")}function fd(e,t,o){for(let r=t+1;r<e.length;r++){let n=e[r];if(!L(n)&&!(dd.isElement(n)&&n.type==="image-inline"))return vo(n)}return o}function Un(e){let t=[];return t.push(On(e.children[0])),t.push(hd(e.columns)),e.children.slice(1).forEach(o=>{t.push(On(o))}),`${t.join(`
9
9
  `)}
10
10
 
11
- `}function md(e){return e.every(o=>o.align==="left")?`|${e.map(()=>"---").join("|")}|`:`|${e.map(o=>cd(o.align)).join("|")}|`}function cd(e){switch(e){case"left":return":---";case"center":return":---:";case"right":return"---:"}}function Hn(e){return kt(e,"table-row"),`|${e.children.map(pd).join("|")}|`}function pd(e){return kt(e,"table-cell"),Hr(e.children.length===1,`Expected table-cell to have one child but is ${JSON.stringify(e.children)}`),e.children.map(dd).join()}function dd(e){return kt(e,"table-content"),_(e.children)}var Mo=4;function On(e,t){switch(e.type){case"anchor":return`[${_(e.children)}](${e.href})`;case"block-quote":return`${wt(e.children).split(`
12
- `).map(r=>`> ${r}`.trim()).join(`
11
+ `}function hd(e){return e.every(o=>o.align==="left")?`|${e.map(()=>"---").join("|")}|`:`|${e.map(o=>gd(o.align)).join("|")}|`}function gd(e){switch(e){case"left":return":---";case"center":return":---:";case"right":return"---:"}}function On(e){return vt(e,"table-row"),`|${e.children.map(bd).join("|")}|`}function bd(e){return vt(e,"table-cell"),Or(e.children.length===1,`Expected table-cell to have one child but is ${JSON.stringify(e.children)}`),e.children.map(Ed).join("")}function Ed(e){return vt(e,"table-content"),K(e.children)}var Co=4;function _n(e,t){switch(e.type){case"anchor":return`[${K(e.children)}](${e.href})`;case"block-quote":return`${Mt(e.children).split(`
12
+ `).map(r=>r?`> ${r}`:">").join(`
13
13
  `)}
14
14
 
15
- `;case"heading":return`${"#".repeat(e.level)} ${_(e.children)}
15
+ `;case"heading":return`${"#".repeat(e.level)} ${K(e.children)}
16
16
 
17
17
  `;case"horizontal-rule":return`---
18
18
 
19
- `;case"paragraph":return`${_(e.children)}
19
+ `;case"paragraph":return`${K(e.children)}
20
20
 
21
- `;case"table":return An(e);case"table-row":case"table-cell":case"table-content":throw new Error(`Table elements should only be present as children of table which should be handled by serializeTable. Got ${e.type} may indicate an error in normalization.`);case"unordered-list-item":return`${" ".repeat(e.depth*Mo)}- ${_(e.children)}
22
- `;case"ordered-list-item":return`${" ".repeat(e.depth*Mo)}${t[e.depth]}. ${_(e.children)}
23
- `;case"task-list-item":{let o=" ".repeat(e.depth*Mo),r=_(e.children);return r.trim()===""&&(r="&#32;"),`${o}- [${e.checked?"x":" "}] ${r}
24
- `}case"image-block":return xn(e);case"code-block":return hn(e);case"code-block-line":throw new Error("Code block line elements should only be present as children of code-block which should be handled by serializeCodeBlock. Got code-block-line may indicate an error in normalization.");case"html-block":return`${e.html}
21
+ `;case"table":return Un(e);case"table-row":case"table-cell":case"table-content":throw new Error(`Table elements should only be present as children of table which should be handled by serializeTable. Got ${e.type} may indicate an error in normalization.`);case"unordered-list-item":return`${" ".repeat(e.depth*Co)}- ${K(e.children)}
22
+ `;case"ordered-list-item":return`${" ".repeat(e.depth*Co)}${t[e.depth]}. ${K(e.children)}
23
+ `;case"task-list-item":{let o=" ".repeat(e.depth*Co),r=K(e.children);return r.trim()===""&&(r="&#32;"),`${o}- [${e.checked?"x":" "}] ${r}
24
+ `}case"image-block":return kn(e);case"image-inline":return`![${e.alt||""}](${e.url})`;case"code-block":return bn(e);case"code-block-line":throw new Error("Code block line elements should only be present as children of code-block which should be handled by serializeCodeBlock. Got code-block-line may indicate an error in normalization.");case"html-block":return`${e.html}
25
25
 
26
- `}fe(e)}function wt(e){let t=[],o=[];for(let n=0;n<e.length;n++){let i=e[n],a=n<e.length-1?e[n+1]:null;i.type==="ordered-list-item"?(o[i.depth]=(o[i.depth]||0)+1,o=o.slice(0,i.depth+1)):i.type==="unordered-list-item"||i.type==="task-list-item"?o=o.slice(0,i.depth):o=[];let l=On(i,o);(i.type==="ordered-list-item"||i.type==="unordered-list-item"||i.type==="task-list-item")&&(!a||a.type!=="ordered-list-item"&&a.type!=="unordered-list-item"&&a.type!=="task-list-item")&&(l=l.replace(/\n$/,`
26
+ `}he(e)}function Mt(e){let t=[],o=[];for(let n=0;n<e.length;n++){let i=e[n],a=n<e.length-1?e[n+1]:null;i.type==="ordered-list-item"?(o[i.depth]=(o[i.depth]||0)+1,o=o.slice(0,i.depth+1)):i.type==="unordered-list-item"||i.type==="task-list-item"?o=o.slice(0,i.depth):o=[];let l=_n(i,o);(i.type==="ordered-list-item"||i.type==="unordered-list-item"||i.type==="task-list-item")&&(!a||a.type!=="ordered-list-item"&&a.type!=="unordered-list-item"&&a.type!=="task-list-item")&&(l=l.replace(/\n$/,`
27
27
 
28
- `)),t.push(l)}let r=t.join("");return r.trim()===""?"":r.replace(/^\n+/,"").trim()}function it(e){let t=un(e);return wt(t)}var Po={ja:{bold:"\u592A\u5B57",italic:"\u659C\u4F53",strike:"\u53D6\u308A\u6D88\u3057\u7DDA",inlineCode:"\u30A4\u30F3\u30E9\u30A4\u30F3\u30B3\u30FC\u30C9",underline:"\u4E0B\u7DDA",highlight:"\u30CF\u30A4\u30E9\u30A4\u30C8",increaseDepth:"\u968E\u5C64\u3092\u6DF1\u304F\u3059\u308B",decreaseDepth:"\u968E\u5C64\u3092\u6D45\u304F\u3059\u308B",heading1:"\u898B\u51FA\u30571",heading2:"\u898B\u51FA\u30572",heading3:"\u898B\u51FA\u30573",normal:"\u6A19\u6E96",paragraph:"\u6BB5\u843D",paragraphStyle:"\u6BB5\u843D\u30B9\u30BF\u30A4\u30EB",bulletList:"\u7B87\u6761\u66F8\u304D",numberedList:"\u756A\u53F7\u4ED8\u304D\u30EA\u30B9\u30C8",checkList:"\u30C1\u30A7\u30C3\u30AF\u30EA\u30B9\u30C8",list:"\u30EA\u30B9\u30C8",linkUrl:"\u30EA\u30F3\u30AF\u306EURL",linkText:"\u30EA\u30F3\u30AF\u30C6\u30AD\u30B9\u30C8",linkTextHint:"\u30EA\u30F3\u30AF\u3068\u3057\u3066\u8868\u793A\u3055\u308C\u308B\u30C6\u30AD\u30B9\u30C8",tooltipText:"\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7\u30C6\u30AD\u30B9\u30C8",tooltipHint:"\u30DE\u30A6\u30B9\u30DB\u30D0\u30FC\u6642\u306B\u8868\u793A\u3055\u308C\u308B\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7",apply:"\u9069\u7528",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",insertLink:"\u30EA\u30F3\u30AF",quote:"\u5F15\u7528",insertTable:"\u8868",insertImage:"\u753B\u50CF",insertImageFromUrl:"\u753B\u50CF",insert:"\u633F\u5165",format:"\u66F8\u5F0F",imageUrlRequired:"\u753B\u50CFURL\uFF08\u5FC5\u9808\uFF09\uFF1A",altText:"\u4EE3\u66FF\u30C6\u30AD\u30B9\u30C8\uFF1A",title:"\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7\uFF1A",imageDescription:"\u753B\u50CF\u306E\u8AAC\u660E",imageTitle:"\u753B\u50CF\u306E\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7",switchToVisualEditor:"\u30D3\u30B8\u30E5\u30A2\u30EB\u30A8\u30C7\u30A3\u30BF\u306B\u5207\u308A\u66FF\u3048",switchToRawMarkdown:"\u30DE\u30FC\u30AF\u30C0\u30A6\u30F3\u8868\u793A\u306B\u5207\u308A\u66FF\u3048",codeBlock:"\u30B3\u30FC\u30C9\u30D6\u30ED\u30C3\u30AF",increaseQuoteDepth:"\u5F15\u7528\u3092\u91CD\u306D\u308B",horizontalRule:"\u533A\u5207\u308A\u7DDA",register:"\u767B\u9332",imageSourceUrl:"URL",imageSourceFile:"\u30D5\u30A1\u30A4\u30EB",selectFile:"\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E",uploading:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u4E2D...",saving:"\u4FDD\u5B58\u4E2D...",uploadComplete:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u5B8C\u4E86",vaultPath:"\u4FDD\u5B58\u5148\u30D1\u30B9\uFF1A",vaultPathHint:"vault\u5185\u306E\u4FDD\u5B58\u5148\u30D1\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},en:{bold:"Bold",italic:"Italic",strike:"Strikethrough",inlineCode:"Inline Code",underline:"Underline",highlight:"Highlight",increaseDepth:"Increase Depth",decreaseDepth:"Decrease Depth",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",normal:"Normal",paragraph:"Paragraph",paragraphStyle:"Paragraph Style",bulletList:"Bullet List",numberedList:"Numbered List",checkList:"Check List",list:"List",linkUrl:"Link URL",linkText:"Link Text",linkTextHint:"Text displayed as the link",tooltipText:"Tooltip Text",tooltipHint:"Tooltip shown on mouse hover",apply:"Apply",cancel:"Cancel",insertLink:"Link",quote:"Quote",insertTable:"Table",insertImage:"Image",insertImageFromUrl:"Image",insert:"Insert",format:"Format",imageUrlRequired:"Image URL (required):",altText:"Alt Text:",title:"tooltip:",imageDescription:"Description of the image",imageTitle:"tooltip",switchToVisualEditor:"Switch to visual editor",switchToRawMarkdown:"Switch to raw markdown",codeBlock:"Code Block",increaseQuoteDepth:"Increase Quote Depth",horizontalRule:"Horizontal Rule",register:"Register",imageSourceUrl:"URL",imageSourceFile:"File",selectFile:"Select File",uploading:"Uploading...",saving:"Saving...",uploadComplete:"Upload Complete",vaultPath:"Save Path:",vaultPathHint:"Enter the path within the vault to save the file"}},Un=()=>{try{if(typeof window<"u"&&window.navigator)return window.navigator.language.split("-")[0]}catch{}return"en"},f=e=>{let t=Un();return Po[t==="ja"?"ja":"en"][e]},Co=e=>{let t=Un();return Object.keys(Po[t==="ja"?"ja":"en"]).find(r=>Po[t==="ja"?"ja":"en"][r]===e)||""};var y=e=>({fn:e});import{useEffect as bd,useMemo as Xn}from"react";import{Editor as Ed}from"slate";import{useSlateStatic as xd}from"slate-react";function ne(e){return!!e}function Fn(e,t){let o=t.map(r=>r.editableProps?.decorate).filter(ne);return function(r){let n=[];for(let i of o){let a=i(r);n.push(...a)}return e&&n.push(...e(r)),n}}import{Editable as ud}from"slate-react";import{jsx as fd}from"react/jsx-runtime";function Vn(e){let t=e.map(r=>r.renderEditable).filter(ne),o=r=>fd(ud,{...r});for(let r of t){let n=o;o=i=>r({attributes:i,Editable:n})}return o}function It(e,t){let o=[];for(let r of e){let n=r.editableProps?.[t];n&&o.push(n)}return o}function Mt(e,t){return function(o){for(let r of e)if(r(o))return;t?.(o)}}var Kn=(e,t)=>{let o=It(t,"onKeyDown");return Mt(o,e)},_n=(e,t)=>{let o=It(t,"onKeyUp");return Mt(o,e)},Wn=(e,t)=>{let o=It(t,"onPaste");return Mt(o,e)},Gn=(e,t)=>{let o=It(t,"onDrop");return Mt(o,e)};function qn(e,t){let o=t.map(r=>r.editableProps?.renderElement).filter(ne);return function(n){for(let i of o){let a=i(n);if(a)return a}if(e===void 0)throw new Error(`Element with type ${n.element.type} not handled. Note that renderElement is not defined on SinkEditable so this is only the result of checking the Sink Plugins.`);return e(n)}}import{cloneElement as hd}from"react";function Qn(e,t){if(e===void 0)throw new Error("renderLeaf was not defined on SinkEditable");let o=t.map(r=>r.editableProps?.renderLeaf).filter(ne).reverse();return function(r){let n=e({...r,attributes:{}});for(let i of o){let a=i({...r,children:n});a&&(n=a)}return n=hd(n,r.attributes),n}}function jn(e,t){if(e)return e;let o=t.map(r=>r.editableProps?.renderPlaceholder).filter(ne);if(o.length!==0)return function(r){if(o.length>1)throw new Error(`Only one plugin can define renderPlaceholder but there are ${o.length}`);let n=o[0];if(n==null)throw new Error("Expected fn to be defined");return n(r)}}import gd from"@emotion/styled";var at=gd("div")`
28
+ `)),t.push(l)}let r=t.join("");return r.trim()===""?"":r.replace(/^\n+/,"").trim()}function at(e){let t=hn(e);return Mt(t)}var So={ja:{bold:"\u592A\u5B57",italic:"\u659C\u4F53",strike:"\u53D6\u308A\u6D88\u3057\u7DDA",inlineCode:"\u30A4\u30F3\u30E9\u30A4\u30F3\u30B3\u30FC\u30C9",underline:"\u4E0B\u7DDA",highlight:"\u30CF\u30A4\u30E9\u30A4\u30C8",increaseDepth:"\u968E\u5C64\u3092\u6DF1\u304F\u3059\u308B",decreaseDepth:"\u968E\u5C64\u3092\u6D45\u304F\u3059\u308B",heading1:"\u898B\u51FA\u30571",heading2:"\u898B\u51FA\u30572",heading3:"\u898B\u51FA\u30573",normal:"\u6A19\u6E96",paragraph:"\u6BB5\u843D",paragraphStyle:"\u6BB5\u843D\u30B9\u30BF\u30A4\u30EB",bulletList:"\u7B87\u6761\u66F8\u304D",numberedList:"\u756A\u53F7\u4ED8\u304D\u30EA\u30B9\u30C8",checkList:"\u30C1\u30A7\u30C3\u30AF\u30EA\u30B9\u30C8",list:"\u30EA\u30B9\u30C8",linkUrl:"\u30EA\u30F3\u30AF\u306EURL",linkText:"\u30EA\u30F3\u30AF\u30C6\u30AD\u30B9\u30C8",linkTextHint:"\u30EA\u30F3\u30AF\u3068\u3057\u3066\u8868\u793A\u3055\u308C\u308B\u30C6\u30AD\u30B9\u30C8",tooltipText:"\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7\u30C6\u30AD\u30B9\u30C8",tooltipHint:"\u30DE\u30A6\u30B9\u30DB\u30D0\u30FC\u6642\u306B\u8868\u793A\u3055\u308C\u308B\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7",apply:"\u9069\u7528",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",insertLink:"\u30EA\u30F3\u30AF",quote:"\u5F15\u7528",insertTable:"\u8868",insertImage:"\u753B\u50CF",insertImageFromUrl:"\u753B\u50CF",insert:"\u633F\u5165",format:"\u66F8\u5F0F",imageUrlRequired:"\u753B\u50CFURL\uFF08\u5FC5\u9808\uFF09\uFF1A",altText:"\u4EE3\u66FF\u30C6\u30AD\u30B9\u30C8\uFF1A",title:"\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7\uFF1A",imageDescription:"\u753B\u50CF\u306E\u8AAC\u660E",imageTitle:"\u753B\u50CF\u306E\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7",switchToVisualEditor:"\u30D3\u30B8\u30E5\u30A2\u30EB\u30A8\u30C7\u30A3\u30BF\u306B\u5207\u308A\u66FF\u3048",switchToRawMarkdown:"\u30DE\u30FC\u30AF\u30C0\u30A6\u30F3\u8868\u793A\u306B\u5207\u308A\u66FF\u3048",codeBlock:"\u30B3\u30FC\u30C9\u30D6\u30ED\u30C3\u30AF",increaseQuoteDepth:"\u5F15\u7528\u3092\u91CD\u306D\u308B",horizontalRule:"\u533A\u5207\u308A\u7DDA",register:"\u767B\u9332",imageSourceUrl:"URL",imageSourceFile:"\u30D5\u30A1\u30A4\u30EB",selectFile:"\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E",uploading:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u4E2D...",saving:"\u4FDD\u5B58\u4E2D...",uploadComplete:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u5B8C\u4E86",vaultPath:"\u4FDD\u5B58\u5148\u30D1\u30B9\uFF1A",vaultPathHint:"vault\u5185\u306E\u4FDD\u5B58\u5148\u30D1\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},en:{bold:"Bold",italic:"Italic",strike:"Strikethrough",inlineCode:"Inline Code",underline:"Underline",highlight:"Highlight",increaseDepth:"Increase Depth",decreaseDepth:"Decrease Depth",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",normal:"Normal",paragraph:"Paragraph",paragraphStyle:"Paragraph Style",bulletList:"Bullet List",numberedList:"Numbered List",checkList:"Check List",list:"List",linkUrl:"Link URL",linkText:"Link Text",linkTextHint:"Text displayed as the link",tooltipText:"Tooltip Text",tooltipHint:"Tooltip shown on mouse hover",apply:"Apply",cancel:"Cancel",insertLink:"Link",quote:"Quote",insertTable:"Table",insertImage:"Image",insertImageFromUrl:"Image",insert:"Insert",format:"Format",imageUrlRequired:"Image URL (required):",altText:"Alt Text:",title:"tooltip:",imageDescription:"Description of the image",imageTitle:"tooltip",switchToVisualEditor:"Switch to visual editor",switchToRawMarkdown:"Switch to raw markdown",codeBlock:"Code Block",increaseQuoteDepth:"Increase Quote Depth",horizontalRule:"Horizontal Rule",register:"Register",imageSourceUrl:"URL",imageSourceFile:"File",selectFile:"Select File",uploading:"Uploading...",saving:"Saving...",uploadComplete:"Upload Complete",vaultPath:"Save Path:",vaultPathHint:"Enter the path within the vault to save the file"}},Fn=()=>{try{if(typeof window<"u"&&window.navigator)return window.navigator.language.split("-")[0]}catch{}return"en"},f=e=>{let t=Fn();return So[t==="ja"?"ja":"en"][e]},Ro=e=>{let t=Fn();return Object.keys(So[t==="ja"?"ja":"en"]).find(r=>So[t==="ja"?"ja":"en"][r]===e)||""};var y=e=>({fn:e});import{useEffect as vd,useMemo as Jn}from"react";import{Editor as wd}from"slate";import{useSlateStatic as Id}from"slate-react";function ne(e){return!!e}function Vn(e,t){let o=t.map(r=>r.editableProps?.decorate).filter(ne);return function(r){let n=[];for(let i of o){let a=i(r);n.push(...a)}return e&&n.push(...e(r)),n}}import{Editable as xd}from"slate-react";import{jsx as yd}from"react/jsx-runtime";function Kn(e){let t=e.map(r=>r.renderEditable).filter(ne),o=r=>yd(xd,{...r});for(let r of t){let n=o;o=i=>r({attributes:i,Editable:n})}return o}function Pt(e,t){let o=[];for(let r of e){let n=r.editableProps?.[t];n&&o.push(n)}return o}function Ct(e,t){return function(o){for(let r of e)if(r(o))return;t?.(o)}}var Wn=(e,t)=>{let o=Pt(t,"onKeyDown");return Ct(o,e)},Gn=(e,t)=>{let o=Pt(t,"onKeyUp");return Ct(o,e)},qn=(e,t)=>{let o=Pt(t,"onPaste");return Ct(o,e)},Qn=(e,t)=>{let o=Pt(t,"onDrop");return Ct(o,e)};function Xn(e,t){let o=t.map(r=>r.editableProps?.renderElement).filter(ne);return function(n){for(let i of o){let a=i(n);if(a)return a}if(e===void 0)throw new Error(`Element with type ${n.element.type} not handled. Note that renderElement is not defined on SinkEditable so this is only the result of checking the Sink Plugins.`);return e(n)}}import{cloneElement as kd}from"react";function jn(e,t){if(e===void 0)throw new Error("renderLeaf was not defined on SinkEditable");let o=t.map(r=>r.editableProps?.renderLeaf).filter(ne).reverse();return function(r){let n=e({...r,attributes:{}});for(let i of o){let a=i({...r,children:n});a&&(n=a)}return n=kd(n,r.attributes),n}}function Yn(e,t){if(e)return e;let o=t.map(r=>r.editableProps?.renderPlaceholder).filter(ne);if(o.length!==0)return function(r){if(o.length>1)throw new Error(`Only one plugin can define renderPlaceholder but there are ${o.length}`);let n=o[0];if(n==null)throw new Error("Expected fn to be defined");return n(r)}}import Td from"@emotion/styled";var lt=Td("div")`
29
29
  -webkit-font-smoothing: antialiased;
30
30
  -moz-osx-font-smoothing: grayscale;
31
31
  font-size: 16px;
32
32
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
33
33
  Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
34
34
  box-sizing: border-box;
35
- `;import{jsx as yd}from"react/jsx-runtime";function Yn(e){let t=xd();bd(()=>{Ed.normalize(t,{force:!0})},[]);let{plugins:o}=t.sink,r=Xn(()=>({...e,decorate:Fn(e.decorate,o),renderElement:qn(e.renderElement,o),renderLeaf:Qn(e.renderLeaf,o),renderPlaceholder:jn(e.renderPlaceholder,o),onKeyDown:Kn(e.onKeyDown,o),onKeyUp:_n(e.onKeyUp,o),onPaste:Wn(e.onPaste,o),onDrop:Gn(e.onDrop,o)}),Object.values(e)),n=Xn(()=>Vn(o),[o]);return yd(n,{...r})}function De(e,t,o){let r=e[t],n=o.filter(i=>i.editor?.[t]);return function(a){for(let s of n){let c=s.editor?.[t],d=c?.(a);if(typeof d=="boolean")return d}return r(a)}}function le(e,t,o){let r=e[t],n=o.filter(i=>i.editor?.[t]);return function(...a){let l=!1,s=[];for(let m of n){let c=m.editor?.[t]?.(...a);if(typeof c=="function")s.push(c);else if(c===!0){l=!0;break}}l||r(...a),s.forEach(m=>m())}}function Jn(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:le(r,"normalizeNode",n),deleteBackward:le(r,"deleteBackward",n),deleteForward:le(r,"deleteForward",n),deleteFragment:le(r,"deleteFragment",n),insertBreak:le(r,"insertBreak",n),insertFragment:le(r,"insertFragment",n),insertNode:le(r,"insertNode",n),insertText:le(r,"insertText",n),isInline:De(r,"isInline",n),isVoid:De(r,"isVoid",n),isMaster:De(r,"isMaster",n),isSlave:De(r,"isSlave",n),isStandalone:De(r,"isStandalone",n)}),r}}var Zn=e=>{let t=e.map(n=>n.fn);return{withSink:Jn(t),SinkEditable:Yn}};import{Element as kd}from"slate";import{ReactEditor as vd}from"slate-react";function ei(e,t){return kd.isElement(t)?vd.findPath(e,t):t}function u(e,t){return e.bind(null,t)}function W(e,t,o){return e.bind(null,t,o)}var Td=/mac os x|macintosh/i,lt;function Pt(){if(lt!==void 0)return lt;try{let{userAgent:e}=window.navigator;lt=Td.test(e)}catch{lt=!1}return lt}function Te(e){e.preventDefault(),e.stopPropagation()}import{Editor as ri,Path as wd}from"slate";import{Element as ti}from"slate";function oi(e){if(typeof e=="function")return e;if(typeof e=="string")return o=>ti.isElement(o)&&o.type===e;if(Array.isArray(e))return o=>ti.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 E(e,t,{at:o=e.selection}={}){if(o===null)return;let r=ei(e,o),n=oi(t);if(wd.isPath(r)){let i=ri.node(e,r);if(i&&n(i[0]))return i}return ri.above(e,{at:r,match:n})}function Ne(...e){return E(...e)?.[1]}import{jsx as Id}from"react/jsx-runtime";var x=({strokeWidth:e=1.5,...t})=>Id("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 Md}from"slate";function se(e){return e==null?!1:Md.isCollapsed(e)}import{Element as ni}from"slate";function Ct(e){return Array.isArray(e)?t=>ni.isElement(t)&&e.includes(t.type):t=>ni.isElement(t)&&e==t.type}import{Editor as Pd}from"slate";function ii(e,t){let{selection:o}=e;if(!se(o))return!1;let r=E(e,t,{at:o});return!!r&&Pd.isEnd(e,o.anchor,r[1])}import{Editor as bv}from"slate";import{Editor as Cd}from"slate";function we(e,t){let{selection:o}=e;if(!se(o))return!1;let r=E(e,t,{at:o});return!!r&&Cd.isStart(e,o.anchor,r[1])}import{isHotkey as ai}from"is-hotkey";import{Editor as So,Element as Sd,Range as Rd,Transforms as Ld}from"slate";var Bd=ai(" "),zd=ai("SHIFT+SPACE");function li(e,t){return o=>{if(!Bd(o.nativeEvent)&&!zd(o.nativeEvent))return!1;let{selection:r}=e;if(r===null||Rd.isExpanded(r))return!1;let n=E(e,m=>Sd.isElement(m)&&e.convertElement.isConvertibleElement(m));if(!n)return!1;let i={anchor:So.start(e,n[1]),focus:r.focus},a=So.string(e,i),l=t[a];if(!l)return!1;Te(o);let s={anchor:So.start(e,n[1]),focus:r.focus};return Ld.delete(e,{at:s}),l(),!0}}import{isHotkey as Dd}from"is-hotkey";function si(e){let t=e.replace(/\bsuper\b/g,Pt()?"cmd+alt":"ctrl+shift");return Dd(t)}function D(e){let t=null;return function(r){t==null&&(t=Object.entries(e).map(([n,i])=>[si(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 Nd,Transforms as mi}from"slate";function ci(e,t){Nd.withoutNormalizing(e,()=>{mi.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:"123"},{at:t}),mi.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:null},{at:t})})}import{Editor as pi}from"slate";function ge(e,t,o){let[,r]=t,n=pi.previous(e,{at:r});if(n&&o(n,t))return!0;let i=pi.next(e,{at:r});return!!(i&&o(t,i))}import{Editor as di,Transforms as ui}from"slate";function G(e,t){ui.select(e,di.start(e,t))}function fi(e,t){ui.select(e,di.end(e,t))}function hi(e,t){return typeof t!="function"?t:t(e)}import{Editor as Ro,Element as $d,Path as Hd,Transforms as st}from"slate";function gi(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=E(e,n=>$d.isElement(n)&&e.isMaster(n));if(r==null){let n=e.selection;Ro.withoutNormalizing(e,()=>{st.insertNodes(e,t,{at:o}),n&&(st.select(e,n),st.move(e))})}else{let n=Hd.next(r[1]);Ro.withoutNormalizing(e,()=>{st.insertNodes(e,t,{at:n}),st.select(e,Ro.start(e,n))})}return!0}import{Editor as bi,Transforms as Ei}from"slate";function mt(e,t,o){bi.withoutNormalizing(e,()=>{let r=bi.node(e,o),n=hi(r[0],t);Ei.wrapNodes(e,n,{at:o}),Ei.unwrapNodes(e,{at:[...o,0]})})}import{Editor as Ad,Transforms as Od}from"slate";function St(e,t,o){let r=Array.from(Ad.nodes(e,o));if(r.length===0)return!1;for(let n of r){let[i]=n;Od.setNodes(e,t(i),{at:n[1]})}return!0}function xi(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 Ud(n)?(t.preventDefault(),t.stopPropagation(),e.anchor.insertLink(n),!0):!1}function Ud(e){let t;try{t=new URL(e)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"||t.protocol==="mailto:"}import{Editor as Fd,Node as Vd,Transforms as Lo}from"slate";function yi(e,{href:t,title:o,text:r},{at:n}){let i=E(e,"anchor",{at:n});if(!i)return!1;let[a,l]=i;if(Lo.setNodes(e,{href:t,title:o},{at:l}),r!==void 0){let s=Vd.string(a);r!==s&&Fd.withoutNormalizing(e,()=>{let m=a.children.length;for(let c=m-1;c>=0;c--)Lo.removeNodes(e,{at:[...l,c]});Lo.insertNodes(e,{text:r},{at:[...l,0]})})}return!0}import{Editor as Rt,Range as Kd,Text as _d,Transforms as Bo}from"slate";function ki(e,t,o=t,{select:r=!0,title:n}={}){let i=e.selection||{anchor:Rt.start(e,[0]),focus:Rt.start(e,[0])};if(Kd.isCollapsed(i)){if(Bo.insertNodes(e,{type:"anchor",href:t,title:n,children:[{text:o}]},{select:r,at:i}),r&&e.selection){let a=Rt.node(e,e.selection);Bo.select(e,a[1])}}else Bo.wrapNodes(e,{type:"anchor",href:t,title:n,children:[]},{split:!0,match:a=>_d.isText(a)||Rt.isInline(e,a)})}import{Transforms as Wd}from"slate";function vi(e,{at:t}){let o=E(e,"anchor",{at:t});return o?(Wd.unwrapNodes(e,{at:o[1]}),!0):!1}function Ti(e){return{insertLink:u(ki,e),removeLink:u(vi,e),editLink:u(yi,e)}}import{Element as wi,Transforms as Gd}from"slate";function Ii(e,t){if(!wi.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(!(!wi.isElement(n)||n.type!=="anchor"))return Gd.unwrapNodes(e,{at:[...t[1],r]}),!0}return!1}import{clsx as Ou}from"clsx";import{useEffect as Uu,useRef as pa}from"react";import{useSelected as Fu,useSlate as Vu}from"slate-react";import{createContext as Pi,useState as Qd}from"react";import{createPortal as qd}from"react-dom";function Mi({children:e}){return qd(e,document.body)}import{jsx as zo,jsxs as Xd}from"react/jsx-runtime";var Do=Pi({}),jd=Pi({});function Ci({children:e}){let[t,o]=Qd({});function r(i){o(a=>({...a,[i.type]:i}))}function n(i){o(a=>{let l={...a};return delete l[i],l})}return Xd(Do.Provider,{value:{layers:t,setLayers:o,openLayer:r,closeLayer:n},children:[e,Object.entries(t).map(([,i])=>zo(Mi,{children:zo(jd.Provider,{value:i,children:zo(i.Component,{})})},i.type))]})}import{useContext as Yd}from"react";function H(e){let{openLayer:t,closeLayer:o,layers:r}=Yd(Do);function n(a){t({type:e,Component:a})}function i(){o(e)}return{open:n,close:i,layer:r[e],type:e}}import Lt from"@emotion/styled";var Si=Lt("a")`
35
+ `;import{jsx as Md}from"react/jsx-runtime";function Zn(e){let t=Id();vd(()=>{wd.normalize(t,{force:!0})},[t]);let{plugins:o}=t.sink,r=Jn(()=>({...e,decorate:Vn(e.decorate,o),renderElement:Xn(e.renderElement,o),renderLeaf:jn(e.renderLeaf,o),renderPlaceholder:Yn(e.renderPlaceholder,o),onKeyDown:Wn(e.onKeyDown,o),onKeyUp:Gn(e.onKeyUp,o),onPaste:qn(e.onPaste,o),onDrop:Qn(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=Jn(()=>Kn(o),[o]);return Md(n,{...r})}function Ne(e,t,o){let r=e[t],n=o.filter(i=>i.editor?.[t]);return function(a){for(let s of n){let c=s.editor?.[t],d=c?.(a);if(typeof d=="boolean")return d}return r(a)}}function le(e,t,o){let r=e[t],n=o.filter(i=>i.editor?.[t]);return function(...a){let l=!1,s=[];for(let m of n){let c=m.editor?.[t]?.(...a);if(typeof c=="function")s.push(c);else if(c===!0){l=!0;break}}l||r(...a),s.forEach(m=>m())}}function ei(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:le(r,"normalizeNode",n),deleteBackward:le(r,"deleteBackward",n),deleteForward:le(r,"deleteForward",n),deleteFragment:le(r,"deleteFragment",n),insertBreak:le(r,"insertBreak",n),insertFragment:le(r,"insertFragment",n),insertNode:le(r,"insertNode",n),insertText:le(r,"insertText",n),isInline:Ne(r,"isInline",n),isVoid:Ne(r,"isVoid",n),isMaster:Ne(r,"isMaster",n),isSlave:Ne(r,"isSlave",n),isStandalone:Ne(r,"isStandalone",n)}),r}}var ti=e=>{let t=e.map(n=>n.fn);return{withSink:ei(t),SinkEditable:Zn}};import{Element as Pd}from"slate";import{ReactEditor as Cd}from"slate-react";function oi(e,t){return Pd.isElement(t)?Cd.findPath(e,t):t}function u(e,t){return e.bind(null,t)}function W(e,t,o){return e.bind(null,t,o)}var Sd=/mac os x|macintosh/i,st;function St(){if(st!==void 0)return st;try{let{userAgent:e}=window.navigator;st=Sd.test(e)}catch{st=!1}return st}function we(e){e.preventDefault(),e.stopPropagation()}import{Editor as ii,Path as Rd}from"slate";import{Element as ri}from"slate";function ni(e){if(typeof e=="function")return e;if(typeof e=="string")return o=>ri.isElement(o)&&o.type===e;if(Array.isArray(e))return o=>ri.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 E(e,t,{at:o=e.selection}={}){if(o===null)return;let r=oi(e,o),n=ni(t);if(Rd.isPath(r)){let i=ii.node(e,r);if(i&&n(i[0]))return i}return ii.above(e,{at:r,match:n})}function $e(...e){return E(...e)?.[1]}import{jsx as Ld}from"react/jsx-runtime";var x=({strokeWidth:e=1.5,...t})=>Ld("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 Bd}from"slate";function se(e){return e==null?!1:Bd.isCollapsed(e)}import{Element as ai}from"slate";function Rt(e){return Array.isArray(e)?t=>ai.isElement(t)&&e.includes(t.type):t=>ai.isElement(t)&&e==t.type}import{Editor as zd}from"slate";function li(e,t){let{selection:o}=e;if(!se(o))return!1;let r=E(e,t,{at:o});return!!r&&zd.isEnd(e,o.anchor,r[1])}import{Editor as I1}from"slate";import{Editor as Dd}from"slate";function Ie(e,t){let{selection:o}=e;if(!se(o))return!1;let r=E(e,t,{at:o});return!!r&&Dd.isStart(e,o.anchor,r[1])}import{isHotkey as si}from"is-hotkey";import{Editor as Lo,Element as Nd,Range as $d,Transforms as Hd}from"slate";var Ad=si(" "),Od=si("SHIFT+SPACE");function mi(e,t){return o=>{if(!Ad(o.nativeEvent)&&!Od(o.nativeEvent))return!1;let{selection:r}=e;if(r===null||$d.isExpanded(r))return!1;let n=E(e,m=>Nd.isElement(m)&&e.convertElement.isConvertibleElement(m));if(!n)return!1;let i={anchor:Lo.start(e,n[1]),focus:r.focus},a=Lo.string(e,i),l=t[a];if(!l)return!1;we(o);let s={anchor:Lo.start(e,n[1]),focus:r.focus};return Hd.delete(e,{at:s}),l(),!0}}import{isHotkey as Ud}from"is-hotkey";function ci(e){let t=e.replace(/\bsuper\b/g,St()?"cmd+alt":"ctrl+shift");return Ud(t)}function D(e){let t=null;return function(r){t==null&&(t=Object.entries(e).map(([n,i])=>[ci(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 _d,Transforms as pi}from"slate";function di(e,t){_d.withoutNormalizing(e,()=>{pi.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:"123"},{at:t}),pi.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:null},{at:t})})}import{Editor as ui}from"slate";function be(e,t,o){let[,r]=t,n=ui.previous(e,{at:r});if(n&&o(n,t))return!0;let i=ui.next(e,{at:r});return!!(i&&o(t,i))}import{Editor as fi,Transforms as hi}from"slate";function G(e,t){hi.select(e,fi.start(e,t))}function gi(e,t){hi.select(e,fi.end(e,t))}function bi(e,t){return typeof t!="function"?t:t(e)}import{Editor as Bo,Element as Fd,Path as Vd,Transforms as mt}from"slate";function Ei(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=E(e,n=>Fd.isElement(n)&&e.isMaster(n));if(r==null){let n=e.selection;Bo.withoutNormalizing(e,()=>{mt.insertNodes(e,t,{at:o}),n&&(mt.select(e,n),mt.move(e))})}else{let n=Vd.next(r[1]);Bo.withoutNormalizing(e,()=>{mt.insertNodes(e,t,{at:n}),mt.select(e,Bo.start(e,n))})}return!0}import{Editor as xi,Transforms as yi}from"slate";function ct(e,t,o){xi.withoutNormalizing(e,()=>{let r=xi.node(e,o),n=bi(r[0],t);yi.wrapNodes(e,n,{at:o}),yi.unwrapNodes(e,{at:[...o,0]})})}import{Editor as Kd,Transforms as Wd}from"slate";function Lt(e,t,o){let r=Array.from(Kd.nodes(e,o));if(r.length===0)return!1;for(let n of r){let[i]=n;Wd.setNodes(e,t(i),{at:n[1]})}return!0}function ki(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 Gd(n)?(t.preventDefault(),t.stopPropagation(),e.anchor.insertLink(n),!0):!1}function Gd(e){let t;try{t=new URL(e)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"||t.protocol==="mailto:"}import{Editor as qd,Node as Qd,Transforms as zo}from"slate";function Ti(e,{href:t,title:o,text:r},{at:n}){let i=E(e,"anchor",{at:n});if(!i)return!1;let[a,l]=i;if(zo.setNodes(e,{href:t,title:o},{at:l}),r!==void 0){let s=Qd.string(a);r!==s&&qd.withoutNormalizing(e,()=>{let m=a.children.length;for(let c=m-1;c>=0;c--)zo.removeNodes(e,{at:[...l,c]});zo.insertNodes(e,{text:r},{at:[...l,0]})})}return!0}import{Editor as Bt,Element as Xd,Range as jd,Text as Yd,Transforms as Do}from"slate";function vi(e,t,o=t,{select:r=!0,title:n}={}){let i=e.selection||{anchor:Bt.start(e,[0]),focus:Bt.start(e,[0])};if(jd.isCollapsed(i)){if(Do.insertNodes(e,{type:"anchor",href:t,title:n,children:[{text:o}]},{select:r,at:i}),r&&e.selection){let a=Bt.node(e,e.selection);Do.select(e,a[1])}}else Do.wrapNodes(e,{type:"anchor",href:t,title:n,children:[]},{split:!0,match:a=>Yd.isText(a)||Xd.isElement(a)&&Bt.isInline(e,a)})}import{Transforms as Jd}from"slate";function wi(e,{at:t}){let o=E(e,"anchor",{at:t});return o?(Jd.unwrapNodes(e,{at:o[1]}),!0):!1}function Ii(e){return{insertLink:u(vi,e),removeLink:u(wi,e),editLink:u(Ti,e)}}import{Element as Mi,Transforms as Zd}from"slate";function Pi(e,t){if(!Mi.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(!(!Mi.isElement(n)||n.type!=="anchor"))return Zd.unwrapNodes(e,{at:[...t[1],r]}),!0}return!1}import{clsx as qu}from"clsx";import{useEffect as Qu,useRef as ua}from"react";import{useSelected as Xu,useSlate as ju}from"slate-react";import{createContext as Si,useState as tu}from"react";import{createPortal as eu}from"react-dom";function Ci({children:e}){return eu(e,document.body)}import{jsx as No,jsxs as ru}from"react/jsx-runtime";var $o=Si({}),ou=Si({});function Ri({children:e}){let[t,o]=tu({});function r(i){o(a=>({...a,[i.type]:i}))}function n(i){o(a=>{let l={...a};return delete l[i],l})}return ru($o.Provider,{value:{layers:t,setLayers:o,openLayer:r,closeLayer:n},children:[e,Object.entries(t).map(([,i])=>No(Ci,{children:No(ou.Provider,{value:i,children:No(i.Component,{})})},i.type))]})}import{useContext as nu}from"react";function H(e){let{openLayer:t,closeLayer:o,layers:r}=nu($o);function n(a){t({type:e,Component:a})}function i(){o(e)}return{open:n,close:i,layer:r[e],type:e}}import zt from"@emotion/styled";var Li=zt("a")`
36
36
  /**
37
37
  * Link colors
38
38
  */
@@ -51,10 +51,10 @@
51
51
  &.--selected {
52
52
  background: var(--blue-50);
53
53
  }
54
- `,No=Lt("span")`
54
+ `,Ho=zt("span")`
55
55
  display: inline;
56
56
  padding: 0 1px 0 0;
57
- `,v1=Lt("span")`
57
+ `,Rv=zt("span")`
58
58
  position: fixed;
59
59
  width: 100px;
60
60
  background: var(--shade-50);
@@ -63,14 +63,14 @@
63
63
  border: 1px solid var(--shade-400);
64
64
  overflow: hidden;
65
65
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
66
- `,T1=Lt("span")`
66
+ `,Lv=zt("span")`
67
67
  position: absolute;
68
68
  left: 0;
69
69
  top: 0;
70
70
  height: 14px;
71
71
  background: var(--blue-400);
72
72
  transition: width 100ms linear;
73
- `;import Du from"@emotion/styled";import{useCallback as Ft,useState as Nu}from"react";import{useSlateStatic as $u}from"slate-react";import{useRef as Zd}from"react";import Jd from"@emotion/styled";var Ri=Jd("div")`
73
+ `;import Fu from"@emotion/styled";import{useCallback as Vt,useState as Vu}from"react";import{useSlateStatic as Ku}from"slate-react";import{useRef as au}from"react";import iu from"@emotion/styled";var Bi=iu("div")`
74
74
  position: fixed;
75
75
  user-select: none;
76
76
  top: 0;
@@ -79,7 +79,7 @@
79
79
  bottom: 0;
80
80
  overflow-y: auto;
81
81
  background: rgba(0, 0, 0, 0.01);
82
- `;import{jsx as eu}from"react/jsx-runtime";function be({close:e}){let t=Zd(null);return eu(Ri,{ref:t,onClick:e})}var ie={cmd:"\u2318",ctrl:"\u2303",shift:"\u21E7",opt:"\u2325",enter:"\u23CE"},tu={shift:ie.shift,opt:ie.opt,alt:ie.opt,ctrl:ie.ctrl,mod:ie.cmd,cmd:ie.cmd,enter:ie.enter,super:`${ie.opt}${ie.cmd}`},ou={alt:"ALT",ctrl:"CTRL",opt:"ALT",shift:"SHIFT",mod:"CTRL",cmd:"CTRL",enter:ie.enter,super:"CTRL+SHIFT"};function Li(e,t){let o=e.findIndex(r=>r===t);o!==-1&&e.splice(o,1)}function ru(e){let t=[];return Object.entries(tu).forEach(([o,r])=>{e.includes(o)&&(t.push(r),Li(e,o))}),t.push(...e.map(o=>o.toUpperCase())),t.join("")}function nu(e){let t=[];return Object.entries(ou).forEach(([o,r])=>{e.includes(o)&&(t.push(r),Li(e,o))}),t.push(...e.map(o=>o.toUpperCase())),t.join("+")}function Bt(e){let t=e.toLowerCase().split("+");return Pt()?ru(t):nu(t)}import{useRef as hu}from"react";import{useSlateStatic as gu}from"slate-react";function $o(e){let t=e.getBoundingClientRect();return{top:t.top,right:t.right,bottom:t.bottom,left:t.left,width:t.width,height:t.height}}function Bi(e){let t=$o(e),{scrollY:o}=window;return Object.assign(t,{top:t.top+o,bottom:t.bottom+o})}function Ho(){let e=document.documentElement.clientWidth||document.body.clientWidth;return{top:0,right:e,bottom:window.innerHeight,left:0,width:e,height:window.innerHeight}}function zi(){let e=Ho();return Object.assign(e,{top:window.scrollY,bottom:window.scrollY+e.height})}var Di=iu;function iu(e,t){for(var o={},r=Object.keys(e),n=r.length,i=0;i<n;i++){var a=r[i];o[a]=t(e[a],a,e)}return o}function Ao(e,t){return Di(e,r=>{let n=r instanceof HTMLElement?r:r.current;return n?t(n):null})}import{useEffect as su}from"react";import au from"lodash.throttle";import{useState as lu}from"react";function zt(e=100){let[t,o]=lu(0),r=au(()=>{o(n=>n+1)},e,{trailing:!0});return Object.assign(r,{counter:t})}function Oo(){let e=zt();return su(()=>(e(),window.addEventListener("resize",e),window.addEventListener("scroll",e),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e)}),[]),e}function j(e,t){let o=Oo(),r=Ao(e,n=>Bi(n));return t(r,zi(),o)}function Dt(e,t,o,{margin:r=0}={}){if(e==null)return{...o,left:-1024};let{top:n}=o,{left:i}=o,a=t.right-t.left-r*2;return e.width>=a?i=t.left+r:(i+e.width>t.right-r&&(i=t.right-e.width-r),i<t.left+r&&(i=t.left+r)),{left:i,top:n}}import Uo from"@emotion/styled";import mu from"@emotion/styled";var X=mu(at)`
82
+ `;import{jsx as lu}from"react/jsx-runtime";function Ee({close:e}){let t=au(null);return lu(Bi,{ref:t,onClick:e})}var ie={cmd:"\u2318",ctrl:"\u2303",shift:"\u21E7",opt:"\u2325",enter:"\u23CE"},su={shift:ie.shift,opt:ie.opt,alt:ie.opt,ctrl:ie.ctrl,mod:ie.cmd,cmd:ie.cmd,enter:ie.enter,super:`${ie.opt}${ie.cmd}`},mu={alt:"ALT",ctrl:"CTRL",opt:"ALT",shift:"SHIFT",mod:"CTRL",cmd:"CTRL",enter:ie.enter,super:"CTRL+SHIFT"};function zi(e,t){let o=e.findIndex(r=>r===t);o!==-1&&e.splice(o,1)}function cu(e){let t=[];return Object.entries(su).forEach(([o,r])=>{e.includes(o)&&(t.push(r),zi(e,o))}),t.push(...e.map(o=>o.toUpperCase())),t.join("")}function pu(e){let t=[];return Object.entries(mu).forEach(([o,r])=>{e.includes(o)&&(t.push(r),zi(e,o))}),t.push(...e.map(o=>o.toUpperCase())),t.join("+")}function Dt(e){let t=e.toLowerCase().split("+");return St()?cu(t):pu(t)}import{useRef as vu}from"react";import{useSlateStatic as wu}from"slate-react";function Ao(e){let t=e.getBoundingClientRect();return{top:t.top,right:t.right,bottom:t.bottom,left:t.left,width:t.width,height:t.height}}function Di(e){let t=Ao(e),{scrollY:o}=window;return Object.assign(t,{top:t.top+o,bottom:t.bottom+o})}function Oo(){let e=document.documentElement.clientWidth||document.body.clientWidth;return{top:0,right:e,bottom:window.innerHeight,left:0,width:e,height:window.innerHeight}}function Ni(){let e=Oo();return Object.assign(e,{top:window.scrollY,bottom:window.scrollY+e.height})}var $i=du;function du(e,t){for(var o={},r=Object.keys(e),n=r.length,i=0;i<n;i++){var a=r[i];o[a]=t(e[a],a,e)}return o}function Uo(e,t){return $i(e,r=>{let n=r instanceof HTMLElement?r:r.current;return n?t(n):null})}import{useEffect as gu}from"react";import uu from"lodash.throttle";import{useMemo as fu,useState as hu}from"react";function Nt(e=100){let[t,o]=hu(0),r=fu(()=>uu(()=>{o(n=>n+1)},e,{trailing:!0}),[e]);return Object.assign(r,{counter:t})}function _o(){let e=Nt();return gu(()=>(e(),window.addEventListener("resize",e),window.addEventListener("scroll",e),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e)}),[]),e}function X(e,t){let o=_o(),r=Uo(e,n=>Di(n));return t(r,Ni(),o)}function $t(e,t,o,{margin:r=0}={}){if(e==null)return{...o,left:-1024};let{top:n}=o,{left:i}=o,a=t.right-t.left-r*2;return e.width>=a?i=t.left+r:(i+e.width>t.right-r&&(i=t.right-e.width-r),i<t.left+r&&(i=t.left+r)),{left:i,top:n}}import Fo from"@emotion/styled";import bu from"@emotion/styled";var j=bu(lt)`
83
83
  position: absolute;
84
84
  z-index: 1000;
85
85
  border: 1px solid var(--table-border-color);
@@ -105,14 +105,14 @@
105
105
  * even if we did, it looks better this way.
106
106
  */
107
107
  /* transition: left 100ms, top 100ms; */
108
- `;var Ni=Uo(X)`
108
+ `;var Hi=Fo(j)`
109
109
  width: 24em;
110
110
  padding: 0;
111
111
  overflow: hidden;
112
- `,Nt=Uo("div")`
112
+ `,Ht=Fo("div")`
113
113
  display: flex;
114
114
  gap: 0.5em;
115
- `,$t=Uo("input")`
115
+ `,At=Fo("input")`
116
116
  flex: 1 1 auto;
117
117
  padding: 0.5em 0.75em;
118
118
  border-radius: 0.25em;
@@ -123,7 +123,7 @@
123
123
  &:focus {
124
124
  outline: 2px solid var(--blue-200);
125
125
  }
126
- `;import Hi from"@emotion/styled";import cu from"@emotion/styled";var $i=cu(at)`
126
+ `;import Oi from"@emotion/styled";import Eu from"@emotion/styled";var Ai=Eu(lt)`
127
127
  border: 1px solid var(--shade-300); /* shade-300 */
128
128
  border-radius: 0.5em;
129
129
  color: rgb(39 39 42); /* shade-800 */
@@ -139,9 +139,9 @@
139
139
  */
140
140
  outline: 2px solid var(--select-editor-color) !important;
141
141
  }
142
- `;var Ai=Hi("div")`
142
+ `;var Ui=Oi("div")`
143
143
  padding: 2em;
144
- `,Oi=Hi($i)`
144
+ `,_i=Oi(Ai)`
145
145
  /**
146
146
  * We use this to make sure the top of the container is rounded even though
147
147
  * the toolbar inside is square. We keep the toolbar square so that as the
@@ -162,7 +162,7 @@
162
162
  overflow-y: clip;
163
163
  display: flex;
164
164
  flex-direction: column;
165
- `;import Fo from"@emotion/styled";var Ui=Fo(X)`
165
+ `;import Vo from"@emotion/styled";var Fi=Vo(j)`
166
166
  position: absolute;
167
167
  padding-top: 0.5em;
168
168
  padding-bottom: 0.5em;
@@ -172,7 +172,7 @@
172
172
  * Prevent clicks from stealing focus from the editor
173
173
  */
174
174
  user-select: none;
175
- `,Fi=Fo("div")`
175
+ `,Vi=Vo("div")`
176
176
  display: flex;
177
177
  z-index: 10;
178
178
  padding: 0 1em 0 1.5em;
@@ -212,12 +212,12 @@
212
212
  &:hover {
213
213
  background: var(--blue-50);
214
214
  }
215
- `,Vi=Fo("div")`
215
+ `,Ki=Vo("div")`
216
216
  height: 1px;
217
217
  background: var(--shade-200);
218
218
  margin-top: 0.25em;
219
219
  margin-bottom: 0.25em;
220
- `;import ct from"@emotion/styled";var Ki=ct("div")`
220
+ `;import pt from"@emotion/styled";var Wi=pt("div")`
221
221
  /**
222
222
  * This flex rule applies to the "display: flex;" of the parent container.
223
223
  * Ensures the toolbar does not shrink or grow vertically.
@@ -256,22 +256,22 @@
256
256
  3em + 1px
257
257
  ); // $ToolbarDivider height + border-bottom of 1px above
258
258
  overflow: hidden;
259
- `,_i=ct("div")`
259
+ `,Gi=pt("div")`
260
260
  display: inline-block;
261
261
  height: calc(
262
262
  3em + 1px
263
263
  ); // $ToolbarDivider height + border-bottom of 1px above
264
- `,Wi=ct("div")`
264
+ `,qi=pt("div")`
265
265
  display: inline-block;
266
266
  height: 3em;
267
267
  padding: 0 0.375em;
268
- `,Gi=ct("div")`
268
+ `,Qi=pt("div")`
269
269
  display: inline-block;
270
270
  background: var(--shade-300);
271
271
  opacity: 50%;
272
272
  width: 1px;
273
273
  height: 3em;
274
- `,qi=ct("div")`
274
+ `,Xi=pt("div")`
275
275
  box-sizing: border-box;
276
276
  position: relative;
277
277
  display: inline-block;
@@ -321,7 +321,7 @@
321
321
  margin-left: -0.25em;
322
322
  opacity: 0.375;
323
323
  }
324
- `;import{useCallback as pu}from"react";import{ReactEditor as du}from"slate-react";import{Fragment as fu,jsx as $e,jsxs as uu}from"react/jsx-runtime";function Qi({editor:e,item:t,close:o,dest:r}){let n=H("menu"),i=pu(()=>{if(t.Component){let a=t.Component;n.open(()=>$e(a,{dest:r,close:n.close}))}else t.action&&(t.action(e),du.focus(e),o())},[e,t]);return $e(fu,{children:uu(Fi,{onClick:i,children:[$e("div",{className:"--icon",children:$e(t.icon,{})}),$e("div",{className:"--title",children:t.title}),$e("div",{className:"--hotkey",children:t.hotkey?Bt(t.hotkey):void 0})]})})}import{Fragment as bu,jsx as Ht,jsxs as Eu}from"react/jsx-runtime";function He({dest:e,items:t,close:o}){let r=gu(),n=hu(null),i=j({src:n,dest:e},({dest:a})=>({left:a.left-8,top:a.top+a.height}));return Eu(bu,{children:[Ht(be,{close:o}),Ht(Ui,{ref:n,style:i,children:t.map((a,l)=>a==="divider"?Ht(Vi,{},l):a.show&&!a.show(r)?null:Ht(Qi,{editor:r,item:a,close:o,dest:e},l))})]})}import{useCallback as Ji}from"react";import ji from"@emotion/styled";import{jsx as ku,jsxs as vu}from"react/jsx-runtime";function Vo(e){return e.getBoundingClientRect()}var xu=ji("div")`
324
+ `;import{useCallback as xu}from"react";import{ReactEditor as yu}from"slate-react";import{Fragment as Tu,jsx as He,jsxs as ku}from"react/jsx-runtime";function ji({editor:e,item:t,close:o,dest:r}){let n=H("menu"),i=xu(()=>{if(t.Component){let a=t.Component;n.open(()=>He(a,{dest:r,close:n.close}))}else t.action&&(t.action(e),yu.focus(e),o())},[e,t]);return He(Tu,{children:ku(Vi,{onClick:i,children:[He("div",{className:"--icon",children:He(t.icon,{})}),He("div",{className:"--title",children:t.title}),He("div",{className:"--hotkey",children:t.hotkey?Dt(t.hotkey):void 0})]})})}import{Fragment as Iu,jsx as Ot,jsxs as Mu}from"react/jsx-runtime";function Ae({dest:e,items:t,close:o}){let r=wu(),n=vu(null),i=X({src:n,dest:e},({dest:a})=>a?{left:a.left-8,top:a.top+a.height}:{left:0,top:0});return Mu(Iu,{children:[Ot(Ee,{close:o}),Ot(Fi,{ref:n,style:i,children:t.map((a,l)=>a==="divider"?Ot(Ki,{},l):a.show&&!a.show(r)?null:Ot(ji,{editor:r,item:a,close:o,dest:e},l))})]})}import{useCallback as ea}from"react";import Yi from"@emotion/styled";import{jsx as Su,jsxs as Ru}from"react/jsx-runtime";function Ko(e){return e.getBoundingClientRect()}var Pu=Yi("div")`
325
325
  position: fixed;
326
326
  z-index: 10;
327
327
  -webkit-font-smoothing: antialiased;
@@ -337,12 +337,12 @@
337
337
  background: var(--shade-700);
338
338
  border-radius: 0.25em;
339
339
  white-space: nowrap;
340
- `,yu=ji("span")`
340
+ `,Cu=Yi("span")`
341
341
  margin-left: 0.75em;
342
342
  font-size: 0.875em;
343
343
  font-weight: 500;
344
344
  color: var(--shade-400);
345
- `;function Xi({title:e,hotkey:t,dest:o}){let r=Vo(o);return vu(xu,{style:{left:r.left,top:`calc(${r.top}px - 2em)`},children:[e,t?ku(yu,{children:t}):null]})}import Tu from"@emotion/styled";import{jsx as Iu}from"react/jsx-runtime";var wu=Tu("span")`
345
+ `;function Ji({title:e,hotkey:t,dest:o}){let r=Ko(o);return Ru(Pu,{style:{left:r.left,top:`calc(${r.top}px - 2em)`},children:[e,t?Su(Cu,{children:t}):null]})}import Lu from"@emotion/styled";import{jsx as zu}from"react/jsx-runtime";var Bu=Lu("span")`
346
346
  position: fixed;
347
347
  z-index: 10;
348
348
  width: 0;
@@ -350,7 +350,7 @@
350
350
  border-left: 0.375em solid transparent;
351
351
  border-right: 0.375em solid transparent;
352
352
  border-top: 0.375em solid var(--shade-700);
353
- `;function Yi({dest:e}){let t=Vo(e);return Iu(wu,{style:{left:`calc(${t.left+t.width/2}px - 0.375em)`,top:`calc(${t.top}px - 0.5em)`}})}import{jsx as Zi}from"react/jsx-runtime";function Y({title:e,hotkey:t},o=[]){let r=H("tooltip-label"),n=H("tooltip-triangle"),i=Ji(l=>{let s=l.currentTarget;e!==void 0&&(r.open(()=>Zi(Xi,{title:e,hotkey:typeof t=="function"?t():t,dest:s})),n.open(()=>Zi(Yi,{dest:s})))},o),a=Ji(()=>{r.close(),n.close()},o);return{onMouseEnter:i,onMouseLeave:a}}import Su from"@emotion/styled";import{useCallback as Oe,useRef as Ru,useState as Ot}from"react";import{Node as Lu}from"slate";import{useSlateStatic as Bu}from"slate-react";import Ee from"@emotion/styled";var Ae=Ee("div")`
353
+ `;function Zi({dest:e}){let t=Ko(e);return zu(Bu,{style:{left:`calc(${t.left+t.width/2}px - 0.375em)`,top:`calc(${t.top}px - 0.5em)`}})}import{jsx as ta}from"react/jsx-runtime";function Y({title:e,hotkey:t},o=[]){let r=H("tooltip-label"),n=H("tooltip-triangle"),i=ea(l=>{let s=l.currentTarget;e!==void 0&&(r.open(()=>ta(Ji,{title:e,hotkey:typeof t=="function"?t():t,dest:s})),n.open(()=>ta(Zi,{dest:s})))},o),a=ea(()=>{r.close(),n.close()},o);return{onMouseEnter:i,onMouseLeave:a}}import Hu from"@emotion/styled";import{useCallback as Ue,useRef as Au,useState as _t}from"react";import{Node as Ou}from"slate";import{useSlateStatic as Uu}from"slate-react";import xe from"@emotion/styled";var Oe=xe("div")`
354
354
  margin: 0.5em 0;
355
355
  &:first-of-type {
356
356
  margin-top: 0;
@@ -358,15 +358,15 @@
358
358
  &:last-of-type {
359
359
  margin-bottom: 0;
360
360
  }
361
- `,At=Ee("div")`
361
+ `,Ut=xe("div")`
362
362
  font-size: 0.9375em;
363
363
  margin-bottom: 0.25em;
364
364
  color: var(--shade-700);
365
- `,Ko=Ee("div")`
365
+ `,Wo=xe("div")`
366
366
  font-size: 0.875em;
367
367
  margin-top: 0.25em;
368
368
  color: var(--shade-500);
369
- `,ea=Ee("input")`
369
+ `,oa=xe("input")`
370
370
  box-sizing: border-box;
371
371
  width: 100%;
372
372
  height: 6em;
@@ -380,7 +380,7 @@
380
380
  &:focus {
381
381
  outline: 2px solid var(--blue-200);
382
382
  }
383
- `,_o=Ee("input")`
383
+ `,Go=xe("input")`
384
384
  box-sizing: border-box;
385
385
  width: 100%;
386
386
  padding: 0.5em 0.75em;
@@ -392,7 +392,7 @@
392
392
  &:focus {
393
393
  outline: 2px solid var(--blue-200);
394
394
  }
395
- `,ta=Ee("div")`
395
+ `,ra=xe("div")`
396
396
  /* Center vertically and horizontally */
397
397
  display: flex;
398
398
  align-items: center;
@@ -406,7 +406,7 @@
406
406
  font-size: 1.25em;
407
407
  stroke-width: 2px;
408
408
  }
409
- `,oa=Ee(ta)`
409
+ `,na=xe(ra)`
410
410
  color: var(--blue-50);
411
411
  background: var(--blue-500);
412
412
  outline: 0px solid white;
@@ -418,7 +418,7 @@
418
418
  svg {
419
419
  color: var(--blue-200);
420
420
  }
421
- `,ra=Ee(ta)`
421
+ `,ia=xe(ra)`
422
422
  color: var(--shade-500);
423
423
  background: var(--shade-200);
424
424
  outline: 0px solid white;
@@ -430,7 +430,7 @@
430
430
  svg {
431
431
  color: var(--shade-400);
432
432
  }
433
- `;import{useRef as Mu,useCallback as Ie}from"react";import ia from"@emotion/styled";import{jsx as na}from"react/jsx-runtime";var Pu=ia.div`
433
+ `;import{useRef as Du,useCallback as Me}from"react";import la from"@emotion/styled";import{jsx as aa}from"react/jsx-runtime";var Nu=la.div`
434
434
  display: flex;
435
435
  align-items: center;
436
436
  justify-content: center;
@@ -445,17 +445,17 @@
445
445
  &:active {
446
446
  cursor: grabbing;
447
447
  }
448
- `,Cu=ia.div`
448
+ `,$u=la.div`
449
449
  width: 32px;
450
450
  height: 4px;
451
451
  background: #ccc;
452
452
  border-radius: 2px;
453
- `;function xe({onDrag:e}){let t=Mu(null),o=Ie((m,c)=>{t.current={x:m,y:c}},[]),r=Ie((m,c)=>{if(!t.current)return;let d=m-t.current.x,p=c-t.current.y;t.current={x:m,y:c},e(d,p)},[e]),n=Ie(()=>{t.current=null},[]),i=Ie(m=>{m.preventDefault(),o(m.clientX,m.clientY);let c=p=>{r(p.clientX,p.clientY)},d=()=>{n(),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",d)};document.addEventListener("mousemove",c),document.addEventListener("mouseup",d)},[o,r,n]),a=Ie(m=>{if(m.touches.length!==1)return;let c=m.touches[0];o(c.clientX,c.clientY)},[o]),l=Ie(m=>{if(m.touches.length!==1)return;let c=m.touches[0];r(c.clientX,c.clientY)},[r]),s=Ie(()=>{n()},[n]);return na(Pu,{onMouseDown:i,onTouchStart:a,onTouchMove:l,onTouchEnd:s,children:na(Cu,{})})}import{jsx as V,jsxs as pt}from"react/jsx-runtime";var zu=Su(X)`
453
+ `;function ye({onDrag:e}){let t=Du(null),o=Me((m,c)=>{t.current={x:m,y:c}},[]),r=Me((m,c)=>{if(!t.current)return;let d=m-t.current.x,p=c-t.current.y;t.current={x:m,y:c},e(d,p)},[e]),n=Me(()=>{t.current=null},[]),i=Me(m=>{m.preventDefault(),o(m.clientX,m.clientY);let c=p=>{r(p.clientX,p.clientY)},d=()=>{n(),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",d)};document.addEventListener("mousemove",c),document.addEventListener("mouseup",d)},[o,r,n]),a=Me(m=>{if(m.touches.length!==1)return;let c=m.touches[0];o(c.clientX,c.clientY)},[o]),l=Me(m=>{if(m.touches.length!==1)return;let c=m.touches[0];r(c.clientX,c.clientY)},[r]),s=Me(()=>{n()},[n]);return aa(Nu,{onMouseDown:i,onTouchStart:a,onTouchMove:l,onTouchEnd:s,children:aa($u,{})})}import{jsx as F,jsxs as dt}from"react/jsx-runtime";var _u=Hu(j)`
454
454
  position: absolute;
455
455
  width: 20em;
456
456
  padding: 0;
457
457
  overflow: hidden;
458
- `;function aa({destAnchor:e,destStartEdge:t,element:o}){let r=H("dialog"),[n,i]=Ot({x:0,y:0}),a=Oe((T,I)=>{i(k=>({x:k.x+T,y:k.y+I}))},[]),l=j({destAnchor:e,destStartEdge:t},({destAnchor:T,destStartEdge:I})=>({left:I.left,top:T.top+T.height})),s={...l,left:l.left+n.x,top:l.top+n.y},m=Bu(),[c,d]=Ot(o.href),[p,b]=Ot(Lu.string(o)),[g,v]=Ot(o.title||""),C=Ru({href:c,text:p,title:g});C.current={href:c,text:p,title:g};let P=Oe(T=>{d(T.target.value)},[]),w=Oe(T=>{b(T.target.value)},[]),S=Oe(T=>{v(T.target.value)},[]),M=Oe(()=>{r.open(()=>V(Ut,{destAnchor:e,destStartEdge:t,element:o}))},[e,t,o]),N=Oe(()=>{let{href:T,text:I,title:k}=C.current;m.anchor.editLink({href:T,text:I,title:k},{at:o}),M()},[M]);return pt(zu,{contentEditable:!1,style:s,children:[V(xe,{onDrag:a}),pt("div",{style:{padding:"1em"},children:[pt(Ae,{children:[V(At,{children:f("linkUrl")}),V(ea,{as:"textarea",value:c,onChange:P})]}),pt(Ae,{children:[V(At,{children:f("linkText")}),V(_o,{type:"text",value:p,onChange:w}),V(Ko,{children:f("linkTextHint")})]}),pt(Ae,{children:[V(At,{children:f("tooltipText")}),V(_o,{type:"text",value:g,onChange:S}),V(Ko,{children:f("tooltipHint")})]}),V(Ae,{children:V(oa,{onClick:N,children:f("apply")})}),V(Ae,{children:V(ra,{onClick:M,children:f("cancel")})})]})]})}import{jsx as ye}from"react/jsx-runtime";var la=e=>ye(x,{...e,children:ye("path",{d:"M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6M11 13l9-9M15 4h5v5"})}),sa=e=>ye(x,{...e,children:ye("path",{d:"m9 15 3-3m2-2 1-1M11 6l.463-.536a5 5 0 0 1 7.071 7.072L18 13M3 3l18 18M13 18l-.397.534a5.068 5.068 0 0 1-7.127 0 4.972 4.972 0 0 1 0-7.071L6 11"})}),ma=e=>ye(x,{...e,children:ye("path",{d:"M4 20h4L18.5 9.5a1.5 1.5 0 0 0-4-4L4 16v4M13.5 6.5l4 4"})}),ca=e=>ye(x,{...e,children:ye("path",{d:"M18 6L6 18M6 6l12 12"})});import{jsx as J,jsxs as dt}from"react/jsx-runtime";var Hu=Du(X)`
458
+ `;function sa({destAnchor:e,destStartEdge:t,element:o}){let r=H("dialog"),[n,i]=_t({x:0,y:0}),a=Ue((v,T)=>{i(C=>({x:C.x+v,y:C.y+T}))},[]),l=X({destAnchor:e,destStartEdge:t},({destAnchor:v,destStartEdge:T})=>({left:T.left,top:v.top+v.height})),s={...l,left:l.left+n.x,top:l.top+n.y},m=Uu(),[c,d]=_t(o.href),[p,g]=_t(Ou.string(o)),[b,k]=_t(o.title||""),S=Au({href:c,text:p,title:b});S.current={href:c,text:p,title:b};let I=Ue(v=>{d(v.target.value)},[]),w=Ue(v=>{g(v.target.value)},[]),R=Ue(v=>{k(v.target.value)},[]),M=Ue(()=>{r.open(()=>F(Ft,{destAnchor:e,destStartEdge:t,element:o}))},[e,t,o]),N=Ue(()=>{let{href:v,text:T,title:C}=S.current;m.anchor.editLink({href:v,text:T,title:C},{at:o}),M()},[M]);return dt(_u,{contentEditable:!1,style:s,children:[F(ye,{onDrag:a}),dt("div",{style:{padding:"1em"},children:[dt(Oe,{children:[F(Ut,{children:f("linkUrl")}),F(oa,{as:"textarea",value:c,onChange:I})]}),dt(Oe,{children:[F(Ut,{children:f("linkText")}),F(Go,{type:"text",value:p,onChange:w}),F(Wo,{children:f("linkTextHint")})]}),dt(Oe,{children:[F(Ut,{children:f("tooltipText")}),F(Go,{type:"text",value:b,onChange:R}),F(Wo,{children:f("tooltipHint")})]}),F(Oe,{children:F(na,{onClick:N,children:f("apply")})}),F(Oe,{children:F(ia,{onClick:M,children:f("cancel")})})]})]})}import{jsx as ke}from"react/jsx-runtime";var ma=e=>ke(x,{...e,children:ke("path",{d:"M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6M11 13l9-9M15 4h5v5"})}),ca=e=>ke(x,{...e,children:ke("path",{d:"m9 15 3-3m2-2 1-1M11 6l.463-.536a5 5 0 0 1 7.071 7.072L18 13M3 3l18 18M13 18l-.397.534a5.068 5.068 0 0 1-7.127 0 4.972 4.972 0 0 1 0-7.071L6 11"})}),pa=e=>ke(x,{...e,children:ke("path",{d:"M4 20h4L18.5 9.5a1.5 1.5 0 0 0-4-4L4 16v4M13.5 6.5l4 4"})}),da=e=>ke(x,{...e,children:ke("path",{d:"M18 6L6 18M6 6l12 12"})});import{jsx as J,jsxs as ut}from"react/jsx-runtime";var Wu=Fu(j)`
459
459
  position: absolute;
460
460
  width: 20em;
461
461
  z-index: 1000;
@@ -539,10 +539,10 @@
539
539
  height: 1.25em;
540
540
  stroke-width: 1.5;
541
541
  }
542
- `;function Au(e){try{let t=new URL(e);return{hostname:t.hostname,pathname:t.pathname}}catch{return{hostname:"",pathname:""}}}function Ut({destAnchor:e,destStartEdge:t,element:o}){let r=H("dialog"),n=$u(),i=Au(o.href),[a,l]=Nu({x:0,y:0}),s=Ft((P,w)=>{l(S=>({x:S.x+P,y:S.y+w}))},[]),m=j({destAnchor:e,destStartEdge:t},({destAnchor:P,destStartEdge:w})=>({left:w.left,top:P.top+P.height})),c={...m,left:m.left+a.x,top:m.top+a.y},d=Y({title:"\u30EA\u30F3\u30AF\u3092\u524A\u9664"}),p=Y({title:"\u30EA\u30F3\u30AF\u3092\u7DE8\u96C6"}),b=Y({title:"\u9589\u3058\u308B"}),g=Ft(()=>{r.close()},[r]),v=Ft(()=>{n.anchor.removeLink({at:o}),r.close()},[n,r]),C=Ft(()=>{p.onMouseLeave(),r.open(()=>J(aa,{destAnchor:e,destStartEdge:t,element:o}))},[e,t,o]);return dt(Hu,{contentEditable:!1,style:c,children:[J(xe,{onDrag:s}),dt("div",{style:{display:"flex",padding:"1em"},children:[dt("a",{className:"--link",href:o.href,target:"_blank",rel:"noreferrer",children:[J(la,{}),dt("div",{className:"--url",children:[J("div",{className:"--hostname",children:i.hostname}),i.pathname===""||i.pathname==="/"?null:J("div",{className:"--pathname",children:i.pathname}),o.title==null||o.title===""?null:J("div",{className:"--tooltip",children:o.title})]})]}),dt("span",{className:"--icons",children:[J("span",{className:"--icon",onClick:v,onMouseEnter:d.onMouseEnter,onMouseLeave:d.onMouseLeave,children:J(sa,{})}),J("span",{className:"--icon",onMouseEnter:p.onMouseEnter,onMouseLeave:p.onMouseLeave,onClick:C,children:J(ma,{})}),J("span",{className:"--icon",onClick:g,onMouseEnter:b.onMouseEnter,onMouseLeave:b.onMouseLeave,children:J(ca,{})})]})]})]})}import{jsx as Vt,jsxs as Ku}from"react/jsx-runtime";function da({element:e,attributes:t,children:o}){let r=pa(null),n=pa(null),i=Fu(),a=Vu(),l=H("dialog");return Uu(()=>{let s=n.current,m=r.current;if(!s||!m)return;let c=a.selection&&a.selection.anchor.offset!==a.selection.focus.offset;i&&!c?setTimeout(()=>{l.open(()=>Vt(Ut,{destAnchor:s,destStartEdge:m,element:e}))}):l.close()},[i,e]),Ku(Si,{className:Ou({"--selected":i}),href:e.href,target:e.target,...t,ref:n,children:[Vt(No,{ref:r,contentEditable:!1}),Vt("span",{children:o}),Vt(No,{contentEditable:!1})]})}import{jsx as _u}from"react/jsx-runtime";var ua=y((e,t,{createPolicy:o})=>(e.anchor=Ti(e),o({name:"anchor",editor:{isInline(r){if(r.type==="anchor")return!0},normalizeNode:u(Ii,e)},editableProps:{onPaste:u(xi,e),renderElement:({element:r,attributes:n,children:i})=>{if(r.type==="anchor")return _u(da,{element:r,attributes:n,children:i})}}})));import{Editor as Kt,Transforms as ga}from"slate";import{Element as fa,Path as ha}from"slate";function Wo(e,t,o){if(!t||!o||ha.equals(t[1],o[1]))return!0;let r=E(e,i=>fa.isElement(i)&&e.isMaster(i),{at:t[1]}),n=E(e,i=>fa.isElement(i)&&e.isMaster(i),{at:o[1]});return!!(!r&&!n||r&&n&&ha.equals(r[1],n[1]))}var ba=y(e=>(e.atomicDelete=!0,{name:"atomic-delete",editor:{deleteBackward(){if(e.selection==null)return!1;let t=Kt.node(e,e.selection),o=Kt.previous(e,{mode:"lowest"});return Wo(e,t,o)?!1:(ga.move(e,{unit:"character",reverse:!0}),!0)},deleteForward(){if(e.selection==null)return!1;let t=Kt.node(e,e.selection),o=Kt.next(e,{mode:"lowest"});return Wo(e,t,o)?!1:(ga.move(e,{unit:"character"}),!0)}}}));import{Transforms as Bf}from"slate";import{ReactEditor as zf}from"slate-react";import{Editor as Wu,Transforms as Ea}from"slate";import{ReactEditor as Gu}from"slate-react";function qu(e){}function Qu(e,t,o,r){let{selection:n}=e;if(Ea.insertNodes(e,{type:"image-block",url:t,alt:o||"",title:r||"",width:320,height:240,children:[{text:""}]}),!n){let i=Wu.end(e,[]);Ea.select(e,i),Gu.focus(e)}}function xa(e){return{noop:u(qu,e),insertImageFromUrl:u(Qu,e)}}function ya(e,t){return!1}import{useSlateStatic as Pf}from"slate-react";import ju from"@emotion/styled";var ka=ju("div")`
542
+ `;function Gu(e){try{let t=new URL(e);return{hostname:t.hostname,pathname:t.pathname}}catch{return{hostname:"",pathname:""}}}function Ft({destAnchor:e,destStartEdge:t,element:o}){let r=H("dialog"),n=Ku(),i=Gu(o.href),[a,l]=Vu({x:0,y:0}),s=Vt((I,w)=>{l(R=>({x:R.x+I,y:R.y+w}))},[]),m=X({destAnchor:e,destStartEdge:t},({destAnchor:I,destStartEdge:w})=>({left:w.left,top:I.top+I.height})),c={...m,left:m.left+a.x,top:m.top+a.y},d=Y({title:"\u30EA\u30F3\u30AF\u3092\u524A\u9664"}),p=Y({title:"\u30EA\u30F3\u30AF\u3092\u7DE8\u96C6"}),g=Y({title:"\u9589\u3058\u308B"}),b=Vt(()=>{r.close()},[r]),k=Vt(()=>{n.anchor.removeLink({at:o}),r.close()},[n,r]),S=Vt(()=>{p.onMouseLeave(),r.open(()=>J(sa,{destAnchor:e,destStartEdge:t,element:o}))},[e,t,o]);return ut(Wu,{contentEditable:!1,style:c,children:[J(ye,{onDrag:s}),ut("div",{style:{display:"flex",padding:"1em"},children:[ut("a",{className:"--link",href:o.href,target:"_blank",rel:"noreferrer",children:[J(ma,{}),ut("div",{className:"--url",children:[J("div",{className:"--hostname",children:i.hostname}),i.pathname===""||i.pathname==="/"?null:J("div",{className:"--pathname",children:i.pathname}),o.title==null||o.title===""?null:J("div",{className:"--tooltip",children:o.title})]})]}),ut("span",{className:"--icons",children:[J("span",{className:"--icon",onClick:k,onMouseEnter:d.onMouseEnter,onMouseLeave:d.onMouseLeave,children:J(ca,{})}),J("span",{className:"--icon",onMouseEnter:p.onMouseEnter,onMouseLeave:p.onMouseLeave,onClick:S,children:J(pa,{})}),J("span",{className:"--icon",onClick:b,onMouseEnter:g.onMouseEnter,onMouseLeave:g.onMouseLeave,children:J(da,{})})]})]})]})}import{jsx as Kt,jsxs as Yu}from"react/jsx-runtime";function fa({element:e,attributes:t,children:o}){let r=ua(null),n=ua(null),i=Xu(),a=ju(),l=H("dialog");return Qu(()=>{let s=n.current,m=r.current;if(!s||!m)return;let c=a.selection&&a.selection.anchor.offset!==a.selection.focus.offset;i&&!c?setTimeout(()=>{l.open(()=>Kt(Ft,{destAnchor:s,destStartEdge:m,element:e}))}):l.close()},[i,e]),Yu(Li,{className:qu({"--selected":i}),href:e.href,target:e.target,...t,ref:n,children:[Kt(Ho,{ref:r,contentEditable:!1}),Kt("span",{children:o}),Kt(Ho,{contentEditable:!1})]})}import{jsx as Ju}from"react/jsx-runtime";var ha=y((e,t,{createPolicy:o})=>(e.anchor=Ii(e),o({name:"anchor",editor:{isInline(r){if(r.type==="anchor")return!0},normalizeNode:u(Pi,e)},editableProps:{onPaste:u(ki,e),renderElement:({element:r,attributes:n,children:i})=>{if(r.type==="anchor")return Ju(fa,{element:r,attributes:n,children:i})}}})));import{Editor as Wt,Transforms as Ea}from"slate";import{Element as ga,Path as ba}from"slate";function qo(e,t,o){if(!t||!o||ba.equals(t[1],o[1]))return!0;let r=E(e,i=>ga.isElement(i)&&e.isMaster(i),{at:t[1]}),n=E(e,i=>ga.isElement(i)&&e.isMaster(i),{at:o[1]});return!!(!r&&!n||r&&n&&ba.equals(r[1],n[1]))}var xa=y(e=>(e.atomicDelete=!0,{name:"atomic-delete",editor:{deleteBackward(){if(e.selection==null)return!1;let t=Wt.node(e,e.selection),o=Wt.previous(e,{mode:"lowest"});return qo(e,t,o)?!1:(Ea.move(e,{unit:"character",reverse:!0}),!0)},deleteForward(){if(e.selection==null)return!1;let t=Wt.node(e,e.selection),o=Wt.next(e,{mode:"lowest"});return qo(e,t,o)?!1:(Ea.move(e,{unit:"character"}),!0)}}}));import{Transforms as _f}from"slate";import{ReactEditor as Ff}from"slate-react";import{Editor as Zu,Transforms as ya}from"slate";import{ReactEditor as ef}from"slate-react";function tf(e){}function of(e,t,o,r){let{selection:n}=e;if(ya.insertNodes(e,{type:"image-block",url:t,alt:o||"",title:r||"",width:320,height:240,children:[{text:""}]}),!n){let i=Zu.end(e,[]);ya.select(e,i),ef.focus(e)}}function ka(e){return{noop:u(tf,e),insertImageFromUrl:u(of,e)}}function Ta(e,t){return!1}import{useSlateStatic as $f}from"slate-react";import rf from"@emotion/styled";var va=rf("div")`
543
543
  display: block;
544
544
  margin: 1em 0;
545
- `;import{clsx as wf}from"clsx";import{useState as ol}from"react";import{useSelected as If}from"slate-react";import va from"@emotion/styled";var Ta=va("span")`
545
+ `;import{clsx as zf}from"clsx";import{useState as nl}from"react";import{useSelected as Df}from"slate-react";import wa from"@emotion/styled";var Ia=wa("span")`
546
546
  /**
547
547
  * In order for this container to wrap tightly (without space), it needs to be
548
548
  * an "inline-block". If it's just an "inline" we end up with spacing
@@ -554,7 +554,7 @@
554
554
  * so that we can place UI controls for the image in and around the image.
555
555
  */
556
556
  position: relative;
557
- `,wa=va("img")`
557
+ `,Ma=wa("img")`
558
558
  /**
559
559
  * TODO:
560
560
  *
@@ -616,7 +616,7 @@
616
616
  .--dragging > & {
617
617
  transition: border-radius 250ms;
618
618
  }
619
- `;import{clsx as ef}from"clsx";import{useCallback as Ra}from"react";import{Transforms as La}from"slate";import{ReactEditor as qo,useSlateStatic as tf}from"slate-react";import{useEffect as Xu}from"react";function Ia(){let e=zt();return Xu(()=>(e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}),[]),e}import Ma from"@emotion/styled";var Pa=Ma("span")`
619
+ `;import{clsx as mf}from"clsx";import{useCallback as Ba}from"react";import{Transforms as za}from"slate";import{ReactEditor as Xo,useSlateStatic as cf}from"slate-react";import{useEffect as nf}from"react";function Pa(){let e=Nt();return nf(()=>(e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}),[]),e}import Ca from"@emotion/styled";var Sa=Ca("span")`
620
620
  position: absolute;
621
621
  display: block;
622
622
  /**
@@ -643,7 +643,7 @@
643
643
  /* background: green; */
644
644
  width: 1.25em;
645
645
  }
646
- `,Ca=Ma("span")`
646
+ `,Ra=Ca("span")`
647
647
  position: absolute;
648
648
  display: block;
649
649
  background: var(--select-color);
@@ -736,7 +736,7 @@
736
736
  .--small > & > .--bar-right {
737
737
  left: calc(50% + 1px);
738
738
  }
739
- `;function Go({value:e,min:t,max:o}){if(!(o>=t))throw new Error("Expected max >= min but is not");return Math.max(t,Math.min(o,e))}import{ReactEditor as Yu}from"slate-react";function _t(e,t){e=Math.round(e);let o=t.width/t.height;return{width:e,height:Math.round(e/o)}}function Ju(e,t){e=Math.round(e);let o=t.width/t.height;return{width:Math.round(e*o),height:e}}function Zu(e,t){let o=e.width/e.height,r=t.width/t.height;if(o>=r){if(e.width>t.width)return _t(t.width,e)}else if(e.height>t.width)return Ju(t.height,e);return e}function Me(e,t,o){switch(o.type){case"bounds":return Zu(t,o);case"scale":return{width:Math.round(t.width*o.scale),height:Math.round(t.height*o.scale)}}}function Sa(e){let t=Yu.toDOMNode(e,e),o=getComputedStyle(t),r=parseInt(o.paddingLeft)+parseInt(o.paddingRight);return t.clientWidth-r}import{Fragment as nf,jsx as ut,jsxs as rf}from"react/jsx-runtime";function of(e,t){let r=qo.toDOMNode(e,t).querySelector("img");if(!r)throw new Error("Image Element could not be found but should exist");return r.getBoundingClientRect()}function Ba({element:e,srcSize:t,size:o,setSize:r,isDragging:n,setIsDragging:i}){let a=tf();Ia();let l=Sa(a),s=o.width,m=Math.min(t.width,l),c=Math.min(12,t.width),d=Ra(g=>{Te(g),i(!0);let v=g.clientX,P=of(a,e).width,w={...o},S=N=>{let T=Go({value:P+N.clientX-v,min:c,max:m});w=_t(T,t),r(w)},M=()=>{document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",M);let N=qo.findPath(a,e),T={width:w.width,height:w.height};r(T),La.setNodes(a,T,{at:N}),i(!1)};document.addEventListener("mousemove",S),document.addEventListener("mouseup",M)},[t.width,t.height,o.width,e]),p=Ra(g=>{Te(g),i(!0);let v=g.changedTouches[0].clientX,C=o.width,P={...o},w=M=>{let N=M.changedTouches[0],T=Go({value:C+N.clientX-v,min:c,max:m});P=_t(T,t),r(P)},S=()=>{document.removeEventListener("touchmove",w),document.removeEventListener("touchend",S);let M=qo.findPath(a,e);La.setNodes(a,{width:P.width,height:P.height},{at:M}),i(!1)};document.addEventListener("touchmove",w),document.addEventListener("touchend",S)},[t.width,t.height,o.width,e]),b=ef({"--center":s<m&&s>c,"--left":s>=m&&s>c,"--right":s<=c&&s<m,"--dragging":n,"--small":s<=64||o.height<=64});return ut(nf,{children:ut(Pa,{className:b,onMouseDown:d,onTouchStart:p,children:rf(Ca,{children:[ut("span",{className:"--bar --bar-left"}),ut("span",{className:"--bar --bar-center"}),ut("span",{className:"--bar --bar-right"})]})})})}import af from"@emotion/styled";var za=af("span")`
739
+ `;function Qo({value:e,min:t,max:o}){if(!(o>=t))throw new Error("Expected max >= min but is not");return Math.max(t,Math.min(o,e))}import{ReactEditor as af}from"slate-react";function Gt(e,t){e=Math.round(e);let o=t.width/t.height;return{width:e,height:Math.round(e/o)}}function lf(e,t){e=Math.round(e);let o=t.width/t.height;return{width:Math.round(e*o),height:e}}function sf(e,t){let o=e.width/e.height,r=t.width/t.height;if(o>=r){if(e.width>t.width)return Gt(t.width,e)}else if(e.height>t.width)return lf(t.height,e);return e}function Pe(e,t,o){switch(o.type){case"bounds":return sf(t,o);case"scale":return{width:Math.round(t.width*o.scale),height:Math.round(t.height*o.scale)}}}function La(e){let t=af.toDOMNode(e,e),o=getComputedStyle(t),r=parseInt(o.paddingLeft,10)+parseInt(o.paddingRight,10);return t.clientWidth-r}import{Fragment as uf,jsx as ft,jsxs as df}from"react/jsx-runtime";function pf(e,t){let r=Xo.toDOMNode(e,t).querySelector("img");if(!r)throw new Error("Image Element could not be found but should exist");return r.getBoundingClientRect()}function Da({element:e,srcSize:t,size:o,setSize:r,isDragging:n,setIsDragging:i}){let a=cf();Pa();let l=La(a),s=o.width,m=Math.min(t.width,l),c=Math.min(12,t.width),d=Ba(b=>{we(b),i(!0);let k=b.clientX,I=pf(a,e).width,w={...o},R=N=>{let v=Qo({value:I+N.clientX-k,min:c,max:m});w=Gt(v,t),r(w)},M=()=>{document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",M);let N=Xo.findPath(a,e),v={width:w.width,height:w.height};r(v),za.setNodes(a,v,{at:N}),i(!1)};document.addEventListener("mousemove",R),document.addEventListener("mouseup",M)},[t.width,t.height,o.width,e]),p=Ba(b=>{we(b),i(!0);let k=b.changedTouches[0].clientX,S=o.width,I={...o},w=M=>{let N=M.changedTouches[0],v=Qo({value:S+N.clientX-k,min:c,max:m});I=Gt(v,t),r(I)},R=()=>{document.removeEventListener("touchmove",w),document.removeEventListener("touchend",R);let M=Xo.findPath(a,e);za.setNodes(a,{width:I.width,height:I.height},{at:M}),i(!1)};document.addEventListener("touchmove",w),document.addEventListener("touchend",R)},[t.width,t.height,o.width,e]),g=mf({"--center":s<m&&s>c,"--left":s>=m&&s>c,"--right":s<=c&&s<m,"--dragging":n,"--small":s<=64||o.height<=64});return ft(uf,{children:ft(Sa,{className:g,onMouseDown:d,onTouchStart:p,children:df(Ra,{children:[ft("span",{className:"--bar --bar-left"}),ft("span",{className:"--bar --bar-center"}),ft("span",{className:"--bar --bar-right"})]})})})}import ff from"@emotion/styled";var Na=ff("span")`
740
740
  position: absolute;
741
741
  /**
742
742
  * The status appears with a 1px gap from the outline.
@@ -758,7 +758,7 @@
758
758
 
759
759
  /* force numbers to be monospaced for better alignment */
760
760
  font-variant-numeric: tabular-nums;
761
- `;import{jsxs as lf}from"react/jsx-runtime";function Da({size:e}){return lf(za,{children:[e.width," \xD7 ",e.height]})}import sf from"@emotion/styled";var Na=sf("span")`
761
+ `;import{jsxs as hf}from"react/jsx-runtime";function $a({size:e}){return hf(Na,{children:[e.width," \xD7 ",e.height]})}import gf from"@emotion/styled";var Ha=gf("span")`
762
762
  position: absolute;
763
763
  /**
764
764
  * On top of the image +1 for space inside outline, +2 for outline,
@@ -789,7 +789,7 @@
789
789
  }
790
790
  display: flex;
791
791
  gap: 0.25em;
792
- `;import $a from"@emotion/styled";var Wt=$a("span")`
792
+ `;import Aa from"@emotion/styled";var qt=Aa("span")`
793
793
  /* font-size: 0.75em; */
794
794
  border-radius: 0.5em;
795
795
  display: flex;
@@ -802,7 +802,7 @@
802
802
  * see the border of the buttons.
803
803
  */
804
804
  outline: 1px solid white;
805
- `,Ue=$a("span")`
805
+ `,_e=Aa("span")`
806
806
  font-size: 0.75em;
807
807
  line-height: 2em;
808
808
  padding: 0 0.625em;
@@ -856,17 +856,17 @@
856
856
  font-size: 1.33em;
857
857
  line-height: 1em;
858
858
  }
859
- `;import{clsx as mf}from"clsx";import{useCallback as cf}from"react";import{Transforms as pf}from"slate";import{ReactEditor as df,useSlateStatic as uf}from"slate-react";import{jsx as ff}from"react/jsx-runtime";function Ha({element:e,preset:t,size:o,setSize:r,srcSize:n}){let i=uf(),a=Me(o,n,t),l=Y({title:t.title,hotkey:`${a.width}x${a.height}`}),s=cf(()=>{let b=df.findPath(i,e),g=Me(o,n,t);r(g),pf.setNodes(i,g,{at:b})},[e,t,o,n]),c=!(t.type==="scale"?!0:t.width<=n.width||t.height<=n.height),d=o.width===a.width&&o.height===a.height,p=mf({"--disabled":c,"--selected":!c&&d});return ff(Ue,{className:p,onClick:c?void 0:s,onMouseEnter:l.onMouseEnter,onMouseLeave:l.onMouseLeave,children:t.name})}import{jsx as Aa}from"react/jsx-runtime";function Oa({element:e,size:t,setSize:o,srcSize:r,presets:n}){return Aa(Wt,{children:n.map((i,a)=>Aa(Ha,{element:e,preset:i,size:t,setSize:o,srcSize:r},a))})}import{useCallback as bf}from"react";import{useSlateStatic as Ef}from"slate-react";import{jsx as Gt,jsxs as Va}from"react/jsx-runtime";var Ua=e=>Va(x,{...e,children:[Gt("rect",{width:6,height:6,x:4,y:5,rx:1}),Gt("path",{d:"M4 15h16M4 19h16"})]}),Fa=e=>Va(x,{...e,children:[Gt("rect",{width:6,height:6,x:9,y:5,rx:1}),Gt("path",{d:"M4 7h1M4 11h1M19 7h1M19 11h1M4 15h16M4 19h16"})]});import{Editor as hf,Transforms as Ka}from"slate";import{ReactEditor as gf}from"slate-react";function _a(e,t){if(!t.width||!t.height||!t.srcWidth||!t.srcHeight)return;let o={width:t.width,height:t.height},r={width:t.srcWidth,height:t.srcHeight},n=gf.findPath(e,t);hf.withoutNormalizing(e,()=>{let i=Me(o,r,{name:"initial-inline-image",title:"",type:"bounds",width:24,height:24});Ka.setNodes(e,{type:"image-inline",...i},{at:n}),Ka.wrapNodes(e,{type:"paragraph",children:[]},{at:n})})}import{jsx as Wa}from"react/jsx-runtime";function Ga({element:e}){let t=Ef(),o=Y({title:"Inline Image",hotkey:"In a line with text"}),r=bf(()=>{e.type==="image-block"&&_a(t,e)},[t,e]);return Wa(Ue,{className:e.type==="image-inline"?"--selected":"",onClick:e.type==="image-inline"?void 0:r,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,children:Wa(Fa,{})})}import{useCallback as yf}from"react";import{useSlateStatic as kf}from"slate-react";import{Editor as qa,Text as Qa,Transforms as qt}from"slate";import{ReactEditor as xf}from"slate-react";function ja(e,t){if(!t.width||!t.height||!t.srcWidth||!t.srcHeight)return;let o={width:t.width,height:t.height},r={width:t.srcWidth,height:t.srcHeight},n=xf.findPath(e,t);qa.withoutNormalizing(e,()=>{let i=Me(o,r,{name:"initial-block-image",title:"",type:"bounds",width:320,height:320});qt.setNodes(e,{type:"image-block",...i},{at:n});let a=E(e,v=>qa.isBlock(e,v)&&v.type!=="image-block");if(!a)throw new Error("This shouldn't happen");let[l,s]=a,m=l.children,c=l.children.length,d=n.slice(-1)[0],p=m[c-1];d===c-2&&Qa.isText(p)&&p.text===""&&qt.removeNodes(e,{at:[...s,c-1]});let b=m[0],g=d===1&&Qa.isText(b)&&b.text==="";g&&qt.removeNodes(e,{at:[...s,0]}),qt.liftNodes(e,{at:[...s,g?d-1:d]})})}import{jsx as Xa}from"react/jsx-runtime";function Ya({element:e}){let t=kf(),o=Y({title:"Block Image",hotkey:"On a line by itself"}),r=yf(()=>{e.type==="image-inline"&&ja(t,e)},[t,e]);return Xa(Ue,{className:e.type==="image-block"?"--selected":"",onClick:e.type==="image-block"?void 0:r,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,children:Xa(Ua,{})})}import{jsx as Ja,jsxs as vf}from"react/jsx-runtime";function Za({element:e}){return vf(Wt,{children:[Ja(Ya,{element:e}),Ja(Ga,{element:e})]})}import{jsx as el,jsxs as Tf}from"react/jsx-runtime";function tl({element:e,size:t,setSize:o,srcSize:r,presets:n}){return Tf(Na,{children:[el(Za,{element:e}),el(Oa,{element:e,size:t,setSize:o,srcSize:r,presets:n})]})}import{jsx as Qt,jsxs as Mf}from"react/jsx-runtime";function jt({element:e,presets:t}){let o=e.url,r=If(),[n,i]=ol(!1),[a,l]=ol(e.srcWidth&&e.srcHeight&&e.width&&e.height?{width:e.width,height:e.height}:null),s=e.srcWidth&&e.srcHeight?{width:e.srcWidth,height:e.srcHeight}:null,m=r&&a&&s,c=wf({"--selected":r,"--dragging":n,"--small":a&&(a.width<=64||a.height<=64)});return Mf(Ta,{className:c,children:[Qt(wa,{src:o,width:a?.width,height:a?.height}),m?Qt(tl,{element:e,size:a,setSize:l,srcSize:s,presets:t}):null,n&&a?Qt(Da,{size:a}):null,m?Qt(Ba,{element:e,srcSize:s,isDragging:n,setIsDragging:i,size:a,setSize:l}):null]})}import{jsx as rl,jsxs as Cf}from"react/jsx-runtime";function nl({element:e,attributes:t,children:o}){let r=Pf();return Cf("div",{...t,children:[rl(ka,{contentEditable:!1,children:rl(jt,{element:e,presets:r.image.imageBlockPresets})}),o]})}import{useSlateStatic as Rf}from"slate-react";import Sf from"@emotion/styled";var il=Sf("span")`
859
+ `;import{clsx as bf}from"clsx";import{useCallback as Ef}from"react";import{Transforms as xf}from"slate";import{ReactEditor as yf,useSlateStatic as kf}from"slate-react";import{jsx as Tf}from"react/jsx-runtime";function Oa({element:e,preset:t,size:o,setSize:r,srcSize:n}){let i=kf(),a=Pe(o,n,t),l=Y({title:t.title,hotkey:`${a.width}x${a.height}`}),s=Ef(()=>{let g=yf.findPath(i,e),b=Pe(o,n,t);r(b),xf.setNodes(i,b,{at:g})},[e,t,o,n]),c=!(t.type==="scale"?!0:t.width<=n.width||t.height<=n.height),d=o.width===a.width&&o.height===a.height,p=bf({"--disabled":c,"--selected":!c&&d});return Tf(_e,{className:p,onClick:c?void 0:s,onMouseEnter:l.onMouseEnter,onMouseLeave:l.onMouseLeave,children:t.name})}import{jsx as Ua}from"react/jsx-runtime";function _a({element:e,size:t,setSize:o,srcSize:r,presets:n}){return Ua(qt,{children:n.map((i,a)=>Ua(Oa,{element:e,preset:i,size:t,setSize:o,srcSize:r},a))})}import{useCallback as If}from"react";import{useSlateStatic as Mf}from"slate-react";import{jsx as Qt,jsxs as Ka}from"react/jsx-runtime";var Fa=e=>Ka(x,{...e,children:[Qt("rect",{width:6,height:6,x:4,y:5,rx:1}),Qt("path",{d:"M4 15h16M4 19h16"})]}),Va=e=>Ka(x,{...e,children:[Qt("rect",{width:6,height:6,x:9,y:5,rx:1}),Qt("path",{d:"M4 7h1M4 11h1M19 7h1M19 11h1M4 15h16M4 19h16"})]});import{Editor as vf,Transforms as Wa}from"slate";import{ReactEditor as wf}from"slate-react";function Ga(e,t){if(!t.width||!t.height||!t.srcWidth||!t.srcHeight)return;let o={width:t.width,height:t.height},r={width:t.srcWidth,height:t.srcHeight},n=wf.findPath(e,t);vf.withoutNormalizing(e,()=>{let i=Pe(o,r,{name:"initial-inline-image",title:"",type:"bounds",width:24,height:24});Wa.setNodes(e,{type:"image-inline",...i},{at:n}),Wa.wrapNodes(e,{type:"paragraph",children:[]},{at:n})})}import{jsx as qa}from"react/jsx-runtime";function Qa({element:e}){let t=Mf(),o=Y({title:"Inline Image",hotkey:"In a line with text"}),r=If(()=>{e.type==="image-block"&&Ga(t,e)},[t,e]);return qa(_e,{className:e.type==="image-inline"?"--selected":"",onClick:e.type==="image-inline"?void 0:r,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,children:qa(Va,{})})}import{useCallback as Sf}from"react";import{useSlateStatic as Rf}from"slate-react";import{Editor as Xa,Element as Pf,Text as ja,Transforms as Xt}from"slate";import{ReactEditor as Cf}from"slate-react";function Ya(e,t){if(!t.width||!t.height||!t.srcWidth||!t.srcHeight)return;let o={width:t.width,height:t.height},r={width:t.srcWidth,height:t.srcHeight},n=Cf.findPath(e,t);Xa.withoutNormalizing(e,()=>{let i=Pe(o,r,{name:"initial-block-image",title:"",type:"bounds",width:320,height:320});Xt.setNodes(e,{type:"image-block",...i},{at:n});let a=E(e,k=>Pf.isElement(k)&&Xa.isBlock(e,k)&&k.type!=="image-block");if(!a)throw new Error("This shouldn't happen");let[l,s]=a,m=l.children,c=l.children.length,d=n.slice(-1)[0],p=m[c-1];d===c-2&&ja.isText(p)&&p.text===""&&Xt.removeNodes(e,{at:[...s,c-1]});let g=m[0],b=d===1&&ja.isText(g)&&g.text==="";b&&Xt.removeNodes(e,{at:[...s,0]}),Xt.liftNodes(e,{at:[...s,b?d-1:d]})})}import{jsx as Ja}from"react/jsx-runtime";function Za({element:e}){let t=Rf(),o=Y({title:"Block Image",hotkey:"On a line by itself"}),r=Sf(()=>{e.type==="image-inline"&&Ya(t,e)},[t,e]);return Ja(_e,{className:e.type==="image-block"?"--selected":"",onClick:e.type==="image-block"?void 0:r,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,children:Ja(Fa,{})})}import{jsx as el,jsxs as Lf}from"react/jsx-runtime";function tl({element:e}){return Lf(qt,{children:[el(Za,{element:e}),el(Qa,{element:e})]})}import{jsx as ol,jsxs as Bf}from"react/jsx-runtime";function rl({element:e,size:t,setSize:o,srcSize:r,presets:n}){return Bf(Ha,{children:[ol(tl,{element:e}),ol(_a,{element:e,size:t,setSize:o,srcSize:r,presets:n})]})}import{jsx as jt,jsxs as Nf}from"react/jsx-runtime";function Yt({element:e,presets:t}){let o=e.url,r=Df(),[n,i]=nl(!1),[a,l]=nl(e.srcWidth&&e.srcHeight&&e.width&&e.height?{width:e.width,height:e.height}:null),s=e.srcWidth&&e.srcHeight?{width:e.srcWidth,height:e.srcHeight}:null,m=r&&a&&s,c=zf({"--selected":r,"--dragging":n,"--small":a&&(a.width<=64||a.height<=64)});return Nf(Ia,{className:c,children:[jt(Ma,{src:o,width:a?.width,height:a?.height}),m?jt(rl,{element:e,size:a,setSize:l,srcSize:s,presets:t}):null,n&&a?jt($a,{size:a}):null,m?jt(Da,{element:e,srcSize:s,isDragging:n,setIsDragging:i,size:a,setSize:l}):null]})}import{jsx as il,jsxs as Hf}from"react/jsx-runtime";function al({element:e,attributes:t,children:o}){let r=$f();return Hf("div",{...t,children:[il(va,{contentEditable:!1,children:il(Yt,{element:e,presets:r.image.imageBlockPresets})}),o]})}import{useSlateStatic as Of}from"slate-react";import Af from"@emotion/styled";var ll=Af("span")`
860
860
  display: inline;
861
- `;import{jsx as al,jsxs as Lf}from"react/jsx-runtime";function ll({element:e,attributes:t,children:o}){let r=Rf();return Lf("span",{...t,style:{display:"inline-block"},children:[al(il,{contentEditable:!1,children:al(jt,{element:e,presets:r.image.imageInlinePresets})}),o]})}import{jsx as sl}from"react/jsx-runtime";function ml({element:e,attributes:t,children:o}){switch(e.type){case"image-block":return sl(nl,{element:e,attributes:t,children:o});case"image-inline":return sl(ll,{element:e,attributes:t,children:o})}}function Df(e){return t=>{let{dataTransfer:o}=t;if(!o.files||o.files.length===0)return!1;let r=Array.from(o.files).filter(a=>a.type.startsWith("image/"));if(r.length===0)return!1;t.preventDefault(),t.stopPropagation();let n=zf.findEventRange(e,t);n&&Bf.select(e,n);let i=e.wysimark?.onImageChange;for(let a of r)if(i)i(a).then(l=>{l&&e.image.insertImageFromUrl(l,a.name,"")}).catch(()=>{});else{let l=new FileReader;l.onload=()=>{let s=l.result;e.image.insertImageFromUrl(s,a.name,"")},l.readAsDataURL(a)}return!0}}var Nf={maxInitialInlineImageSize:{width:64,height:64},maxInitialImageSize:{width:320,height:320},maxImageSize:{width:1024,height:1024},imageBlockPresets:[{name:"S",title:"Small",type:"bounds",width:160,height:160},{name:"M",title:"Medium",type:"bounds",width:320,height:320},{name:"L",title:"Large",type:"bounds",width:640,height:640},{name:"\u2153",title:"1/3 scale",type:"scale",scale:1/3},{name:"\xBD",title:"1/2 scale",type:"scale",scale:.5},{name:"Full",title:"Full size",type:"scale",scale:1}],imageInlinePresets:[{name:"16",title:"16 pixels",type:"bounds",width:16,height:16},{name:"24",title:"24 pixels",type:"bounds",width:24,height:24},{name:"32",title:"32 pixels",type:"bounds",width:32,height:32},{name:"\u2153",title:"1/3 scale",type:"scale",scale:1/3},{name:"\xBD",title:"1/2 scale",type:"scale",scale:.5},{name:"Full",title:"Full size",type:"scale",scale:1}]},cl=y((e,t,{createPolicy:o})=>{let r={...Nf,...t.image};return e.image={...xa(e),maxInitialInlineImageSize:r.maxInitialInlineImageSize,maxInitialImageSize:r.maxInitialImageSize,maxImageSize:r.maxImageSize,imageBlockPresets:r.imageBlockPresets,imageInlinePresets:r.imageInlinePresets},o({name:"image",editor:{isVoid:n=>{if(["image-block","image-inline"].includes(n.type))return!0},isInline:n=>{if(n.type==="image-inline")return!0},normalizeNode:u(ya,e)},editableProps:{renderElement:ml,onDrop:Df(e)}})});import{Editor as ft,Element as q,Transforms as Fe}from"slate";import $f from"@emotion/styled";var pl=$f("blockquote")`
861
+ `;import{jsx as sl,jsxs as Uf}from"react/jsx-runtime";function ml({element:e,attributes:t,children:o}){let r=Of();return Uf("span",{...t,style:{display:"inline-block"},children:[sl(ll,{contentEditable:!1,children:sl(Yt,{element:e,presets:r.image.imageInlinePresets})}),o]})}import{jsx as cl}from"react/jsx-runtime";function pl({element:e,attributes:t,children:o}){switch(e.type){case"image-block":return cl(al,{element:e,attributes:t,children:o});case"image-inline":return cl(ml,{element:e,attributes:t,children:o})}}function Vf(e){return t=>{let{dataTransfer:o}=t;if(!o.files||o.files.length===0)return!1;let r=Array.from(o.files).filter(a=>a.type.startsWith("image/"));if(r.length===0)return!1;t.preventDefault(),t.stopPropagation();let n=Ff.findEventRange(e,t);n&&_f.select(e,n);let i=e.wysimark?.onImageChange;for(let a of r)if(i)i(a).then(l=>{l&&e.image.insertImageFromUrl(l,a.name,"")}).catch(()=>{});else{let l=new FileReader;l.onload=()=>{let s=l.result;e.image.insertImageFromUrl(s,a.name,"")},l.readAsDataURL(a)}return!0}}var Kf={maxInitialInlineImageSize:{width:64,height:64},maxInitialImageSize:{width:320,height:320},maxImageSize:{width:1024,height:1024},imageBlockPresets:[{name:"S",title:"Small",type:"bounds",width:160,height:160},{name:"M",title:"Medium",type:"bounds",width:320,height:320},{name:"L",title:"Large",type:"bounds",width:640,height:640},{name:"\u2153",title:"1/3 scale",type:"scale",scale:1/3},{name:"\xBD",title:"1/2 scale",type:"scale",scale:.5},{name:"Full",title:"Full size",type:"scale",scale:1}],imageInlinePresets:[{name:"16",title:"16 pixels",type:"bounds",width:16,height:16},{name:"24",title:"24 pixels",type:"bounds",width:24,height:24},{name:"32",title:"32 pixels",type:"bounds",width:32,height:32},{name:"\u2153",title:"1/3 scale",type:"scale",scale:1/3},{name:"\xBD",title:"1/2 scale",type:"scale",scale:.5},{name:"Full",title:"Full size",type:"scale",scale:1}]},dl=y((e,t,{createPolicy:o})=>{let r={...Kf,...t.image};return e.image={...ka(e),maxInitialInlineImageSize:r.maxInitialInlineImageSize,maxInitialImageSize:r.maxInitialImageSize,maxImageSize:r.maxImageSize,imageBlockPresets:r.imageBlockPresets,imageInlinePresets:r.imageInlinePresets},o({name:"image",editor:{isVoid:n=>{if(["image-block","image-inline"].includes(n.type))return!0},isInline:n=>{if(n.type==="image-inline")return!0},normalizeNode:u(Ta,e)},editableProps:{renderElement:pl,onDrop:Vf(e)}})});import{Editor as ht,Element as q,Transforms as Fe}from"slate";import Wf from"@emotion/styled";var ul=Wf("blockquote")`
862
862
  position: relative;
863
863
  margin-top: 1em;
864
864
  margin-bottom: 1em;
865
865
  margin-left: 0;
866
866
  border-left: 0.25em solid rgba(0, 0, 0, 0.075);
867
867
  padding-left: 1.5em;
868
- `;import{jsx as Af}from"react/jsx-runtime";function dl(e){return q.isElement(e)&&(e.type==="paragraph"||e.type==="code-block"||e.type==="table"||e.type==="horizontal-rule"||e.type==="task-list-item"||e.type==="unordered-list-item"||e.type==="ordered-list-item"||e.type==="heading")}var Hf=2,ul=y(e=>(e.supportsBlockQuote=!0,e.blockQuotePlugin={indent:()=>{Fe.wrapNodes(e,{type:"block-quote",children:[]},{match:dl})},outdent:()=>{Fe.liftNodes(e,{match:(t,o)=>dl(t)&&o.length>1})},isActive:()=>{let[t]=ft.nodes(e,{match:o=>q.isElement(o)&&o.type==="block-quote"});return!!t},increaseDepth:()=>{let[t]=ft.nodes(e,{match:r=>q.isElement(r)&&r.type==="block-quote"});if(!t||!e.blockQuotePlugin.canIncreaseDepth())return;let[,o]=t;Fe.select(e,o),Fe.wrapNodes(e,{type:"block-quote",children:[]},{at:o,split:!1})},decreaseDepth:()=>{let[t]=ft.nodes(e,{match:i=>q.isElement(i)&&i.type==="block-quote"});if(!t||!e.blockQuotePlugin.canDecreaseDepth())return;let[o,r]=t,n=o.children;n.length===1&&q.isElement(n[0])&&n[0].type==="block-quote"&&Fe.unwrapNodes(e,{at:[...r,0],match:i=>q.isElement(i)&&i.type==="block-quote"})},canIncreaseDepth:()=>{let[t]=ft.nodes(e,{match:i=>q.isElement(i)&&i.type==="block-quote"});if(!t)return!1;let[o]=t,r=0,n=o;for(;n.children.length===1&&q.isElement(n.children[0])&&n.children[0]&&n.children[0]&&n.children[0].type==="block-quote";)r++,n=n.children[0];return r<Hf},canDecreaseDepth:()=>{let[t]=ft.nodes(e,{match:r=>q.isElement(r)&&r.type==="block-quote"});if(!t)return!1;let[o]=t;return o.children.length===1&&q.isElement(o.children[0])&&o.children[0]&&o.children[0].type==="block-quote"}},{name:"block-quote",editor:{normalizeNode(t){let[o,r]=t;return!q.isElement(o)||o.type!=="block-quote"?!1:ge(e,[o,r],(n,i)=>(q.isElement(n[0])&&q.isElement(i[0])&&n[0].type==="block-quote"&&i[0].type==="block-quote"&&Fe.mergeNodes(e,{at:i[1]}),!0))}},editableProps:{renderElement:({element:t,attributes:o,children:r})=>{if(t.type==="block-quote")return Af(pl,{...o,children:r})},onKeyDown:D({"super+.":e.blockQuotePlugin.indent,"super+,":e.blockQuotePlugin.outdent})}}));import{Editor as eh,Element as th,Transforms as $l}from"slate";import Of from"prismjs";import{Element as Vf,Node as Kf}from"slate";var{languages:Uf,tokenize:Ff}=Of;function _f(e){let t=0,o=[];for(let r of e)o.push(t),t=t+r.length;return o}function fl(e){let[t,o]=e;if(!Vf.isElement(t))return[];if(t.type!=="code-block")return[];let r=Uf[t.language];if(r===void 0)return[];let i=t.children.map(p=>`${Kf.string(p)}
869
- `),a=i.join(""),l=_f(i);function s(p){for(let b=l.length;b>=0;b--){let g=l[b];if(g<=p)return{path:[...o,b],offset:p-g}}throw new Error("This shouldn't happen and indicates a bug in the logic")}let m=[],c=Ff(a,r),d=0;for(let p of c)if(typeof p=="string")d+=p.length;else{let b=s(d),g=s(d+p.length);m.push({anchor:b,focus:g,prismToken:p.type}),d+=p.length}return m}function hl(e,{language:t}){gi(e,{type:"code-block",language:t,children:[{type:"code-block-line",children:[{text:""}]}]})}import{Element as Wf,Transforms as Gf}from"slate";function gl(e,t,o={}){let r=E(e,n=>Wf.isElement(n)&&n.type==="code-block",{at:o.at});return r?(Gf.setNodes(e,{language:t},{at:r[1]}),!0):!1}function bl(e){return{createCodeBlock:u(hl,e),setCodeBlockLanguage:u(gl,e)}}var Xt={color:"#999988",fontStyle:"italic"},qf={opacity:"0.7"},El={color:"#e3116c"},xl={color:"#393a34"},ae={color:"#36acaa"},Qo={color:"#00a4db"},yl={color:"#9a050f"},kl={color:"#00009f"},jo={fontWeight:"bold"},Qf={fontStyle:"italic"},vl={comment:Xt,prolog:Xt,doctype:Xt,cdata:Xt,namespace:qf,string:El,"attr-value":El,puncutation:xl,operator:xl,entity:ae,url:ae,symbol:ae,number:ae,boolean:ae,variable:ae,constant:ae,property:ae,regex:ae,insert:ae,atrule:Qo,keyword:Qo,"attr-name":Qo,function:{...yl,...jo},delete:yl,tag:kl,selector:kl,important:jo,bold:jo,italic:Qf};var Tl=["text","html","css","svg","javascript","java","c"];import{Element as Xo,Node as Yo,Transforms as Ve}from"slate";function wl(e,t){if(!Xo.isElement(t[0]))return!1;if(t[0].type==="code-block-line"){for(let[o,r]of Yo.children(e,t[1]))if(Xo.isElement(o))return e.isVoid(o)?(Ve.removeNodes(e,{at:r}),!0):(Ve.unwrapNodes(e,{at:r}),!0)}if(t[0].type==="code-block"){for(let[o,r]of Yo.children(e,t[1]))if(Xo.isElement(o)&&o.type!=="code-block-line")return o.type==="code-block"?(Ve.unwrapNodes(e,{at:r}),!0):e.isVoid(o)?(Ve.removeNodes(e,{at:r}),!0):(Ve.removeNodes(e,{at:r}),Ve.insertNodes(e,{type:"code-block-line",children:[{text:Yo.string(o)}]}),!0)}return!1}import{useCallback as jf,useRef as Xf}from"react";import{useSelected as Yf}from"slate-react";import{jsx as Il}from"react/jsx-runtime";var Ml=e=>Il(x,{...e,children:Il("path",{d:"m6 9 6 6 6-6"})});import Yt from"@emotion/styled";var Pl=Yt("div")`
868
+ `;import{jsx as qf}from"react/jsx-runtime";function fl(e){return q.isElement(e)&&(e.type==="paragraph"||e.type==="code-block"||e.type==="table"||e.type==="horizontal-rule"||e.type==="task-list-item"||e.type==="unordered-list-item"||e.type==="ordered-list-item"||e.type==="heading")}var Gf=2,hl=y(e=>(e.supportsBlockQuote=!0,e.blockQuotePlugin={indent:()=>{Fe.wrapNodes(e,{type:"block-quote",children:[]},{match:fl})},outdent:()=>{Fe.liftNodes(e,{match:(t,o)=>fl(t)&&o.length>1})},isActive:()=>{let[t]=ht.nodes(e,{match:o=>q.isElement(o)&&o.type==="block-quote"});return!!t},increaseDepth:()=>{let[t]=ht.nodes(e,{match:r=>q.isElement(r)&&r.type==="block-quote"});if(!t||!e.blockQuotePlugin.canIncreaseDepth())return;let[,o]=t;Fe.select(e,o),Fe.wrapNodes(e,{type:"block-quote",children:[]},{at:o,split:!1})},decreaseDepth:()=>{let[t]=ht.nodes(e,{match:i=>q.isElement(i)&&i.type==="block-quote"});if(!t||!e.blockQuotePlugin.canDecreaseDepth())return;let[o,r]=t,n=o.children;n.length===1&&q.isElement(n[0])&&n[0].type==="block-quote"&&Fe.unwrapNodes(e,{at:[...r,0],match:i=>q.isElement(i)&&i.type==="block-quote"})},canIncreaseDepth:()=>{let[t]=ht.nodes(e,{match:i=>q.isElement(i)&&i.type==="block-quote"});if(!t)return!1;let[o]=t,r=0,n=o;for(;n.children.length===1&&q.isElement(n.children[0])&&n.children[0]&&n.children[0]&&n.children[0].type==="block-quote";)r++,n=n.children[0];return r<Gf},canDecreaseDepth:()=>{let[t]=ht.nodes(e,{match:r=>q.isElement(r)&&r.type==="block-quote"});if(!t)return!1;let[o]=t;return o.children.length===1&&q.isElement(o.children[0])&&o.children[0]&&o.children[0].type==="block-quote"}},{name:"block-quote",editor:{normalizeNode(t){let[o,r]=t;return!q.isElement(o)||o.type!=="block-quote"?!1:be(e,[o,r],(n,i)=>(q.isElement(n[0])&&q.isElement(i[0])&&n[0].type==="block-quote"&&i[0].type==="block-quote"&&Fe.mergeNodes(e,{at:i[1]}),!0))}},editableProps:{renderElement:({element:t,attributes:o,children:r})=>{if(t.type==="block-quote")return qf(ul,{...o,children:r})},onKeyDown:D({"super+.":e.blockQuotePlugin.indent,"super+,":e.blockQuotePlugin.outdent})}}));import{Editor as mh,Element as ch,Transforms as Al}from"slate";import Qf from"prismjs";import{Element as Yf,Node as Jf}from"slate";var{languages:Xf,tokenize:jf}=Qf;function Zf(e){let t=0,o=[];for(let r of e)o.push(t),t=t+r.length;return o}function gl(e){let[t,o]=e;if(!Yf.isElement(t))return[];if(t.type!=="code-block")return[];let r=Xf[t.language];if(r===void 0)return[];let i=t.children.map(p=>`${Jf.string(p)}
869
+ `),a=i.join(""),l=Zf(i);function s(p){for(let g=l.length;g>=0;g--){let b=l[g];if(b<=p)return{path:[...o,g],offset:p-b}}throw new Error("This shouldn't happen and indicates a bug in the logic")}let m=[],c=jf(a,r),d=0;for(let p of c)if(typeof p=="string")d+=p.length;else{let g=s(d),b=s(d+p.length);m.push({anchor:g,focus:b,prismToken:p.type}),d+=p.length}return m}function bl(e,{language:t}){Ei(e,{type:"code-block",language:t,children:[{type:"code-block-line",children:[{text:""}]}]})}import{Element as eh,Transforms as th}from"slate";function El(e,t,o={}){let r=E(e,n=>eh.isElement(n)&&n.type==="code-block",{at:o.at});return r?(th.setNodes(e,{language:t},{at:r[1]}),!0):!1}function xl(e){return{createCodeBlock:u(bl,e),setCodeBlockLanguage:u(El,e)}}var Jt={color:"#999988",fontStyle:"italic"},oh={opacity:"0.7"},yl={color:"#e3116c"},kl={color:"#393a34"},ae={color:"#36acaa"},jo={color:"#00a4db"},Tl={color:"#9a050f"},vl={color:"#00009f"},Yo={fontWeight:"bold"},rh={fontStyle:"italic"},wl={comment:Jt,prolog:Jt,doctype:Jt,cdata:Jt,namespace:oh,string:yl,"attr-value":yl,puncutation:kl,operator:kl,entity:ae,url:ae,symbol:ae,number:ae,boolean:ae,variable:ae,constant:ae,property:ae,regex:ae,insert:ae,atrule:jo,keyword:jo,"attr-name":jo,function:{...Tl,...Yo},delete:Tl,tag:vl,selector:vl,important:Yo,bold:Yo,italic:rh};var Il=["text","html","css","svg","javascript","java","c"];import{Element as Jo,Node as Zo,Transforms as Ve}from"slate";function Ml(e,t){if(!Jo.isElement(t[0]))return!1;if(t[0].type==="code-block-line"){for(let[o,r]of Zo.children(e,t[1]))if(Jo.isElement(o))return e.isVoid(o)?(Ve.removeNodes(e,{at:r}),!0):(Ve.unwrapNodes(e,{at:r}),!0)}if(t[0].type==="code-block"){for(let[o,r]of Zo.children(e,t[1]))if(Jo.isElement(o)&&o.type!=="code-block-line")return o.type==="code-block"?(Ve.unwrapNodes(e,{at:r}),!0):e.isVoid(o)?(Ve.removeNodes(e,{at:r}),!0):(Ve.removeNodes(e,{at:r}),Ve.insertNodes(e,{type:"code-block-line",children:[{text:Zo.string(o)}]}),!0)}return!1}import{useCallback as nh,useRef as ih}from"react";import{useSelected as ah}from"slate-react";import{jsx as Pl}from"react/jsx-runtime";var Cl=e=>Pl(x,{...e,children:Pl("path",{d:"m6 9 6 6 6-6"})});import Zt from"@emotion/styled";var Sl=Zt("div")`
870
870
  position: relative;
871
871
  background: var(--code-block-bgcolor);
872
872
  margin: 1em 0;
@@ -885,11 +885,11 @@
885
885
  * Otherwise they will be square.
886
886
  */
887
887
  overflow-x: hidden;
888
- `,Cl=Yt("div")`
888
+ `,Rl=Zt("div")`
889
889
  padding: 2.25em 1em 1.5em 1em;
890
890
  border-radius: 0.5em;
891
891
  overflow-x: auto;
892
- `,Sl=Yt("span")`
892
+ `,Ll=Zt("span")`
893
893
  cursor: pointer;
894
894
  position: absolute;
895
895
  top: 0.25em;
@@ -915,7 +915,7 @@
915
915
  color: var(--shade-800);
916
916
  background: var(--shade-300);
917
917
  }
918
- `,Rl=Yt("div")`
918
+ `,Bl=Zt("div")`
919
919
  white-space: pre;
920
920
  line-height: 1.5em;
921
921
  counter-increment: line;
@@ -938,7 +938,7 @@
938
938
  display: inline-block;
939
939
  width: 2em;
940
940
  } */
941
- `;import{jsx as ht,jsxs as Ll}from"react/jsx-runtime";function Bl({element:e,attributes:t,children:o}){let r=Xf(null),n=Yf(),i=H("code-block-dropdown"),a=jf(()=>{i.layer&&i.close();let l=r.current;if(l===null)return;let s=Tl.map(m=>({icon:()=>ht("span",{}),title:m,action:c=>{c.codeBlock.setCodeBlockLanguage(m,{at:e})}}));i.open(()=>ht(He,{dest:l,items:s,close:i.close}))},[e]);return Ll(Pl,{className:n?"--selected":"",...t,children:[Ll(Sl,{contentEditable:!1,onClick:a,ref:r,children:[ht("span",{children:e.language}),ht(Ml,{})]}),ht(Cl,{children:o})]})}import{useSelected as Jf}from"slate-react";import{jsx as Zf}from"react/jsx-runtime";function zl({attributes:e,children:t}){let o=Jf();return Zf(Rl,{className:o?"--selected":"",...e,spellCheck:"false",children:t})}import{jsx as Dl}from"react/jsx-runtime";function Nl({element:e,attributes:t,children:o}){if(e.type==="code-block")return Dl(Bl,{element:e,attributes:t,children:o});if(e.type==="code-block-line")return Dl(zl,{element:e,attributes:t,children:o})}import{jsx as oh}from"react/jsx-runtime";var Hl=y((e,t,{createPolicy:o})=>{e.codeBlock=bl(e);function r(){let{selection:n}=e;if(!se(n))return!1;let i=E(e,"code-block");return i==null?!1:eh.string(e,i[1])===""?($l.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:u(wl,e)},editableProps:{decorate:fl,onKeyDown:D({"super+`":()=>e.codeBlock.createCodeBlock({language:"text"}),"mod+a":()=>{let n=E(e,i=>th.isElement(i)&&i.type==="code-block");return n?($l.select(e,n[1]),!0):!1}}),renderElement:Nl,renderLeaf:({leaf:n,children:i})=>{let a=n.prismToken&&vl[n.prismToken]||null;return a===null?i:oh("span",{style:a,children:i})}}})});import{Transforms as nh}from"slate";import Al from"@emotion/styled";var Ol=Al("div")`
941
+ `;import{jsx as gt,jsxs as zl}from"react/jsx-runtime";function Dl({element:e,attributes:t,children:o}){let r=ih(null),n=ah(),i=H("code-block-dropdown"),a=nh(()=>{i.layer&&i.close();let l=r.current;if(l===null)return;let s=Il.map(m=>({icon:()=>gt("span",{}),title:m,action:c=>{c.codeBlock.setCodeBlockLanguage(m,{at:e})}}));i.open(()=>gt(Ae,{dest:l,items:s,close:i.close}))},[e]);return zl(Sl,{className:n?"--selected":"",...t,children:[zl(Ll,{contentEditable:!1,onClick:a,ref:r,children:[gt("span",{children:e.language}),gt(Cl,{})]}),gt(Rl,{children:o})]})}import{useSelected as lh}from"slate-react";import{jsx as sh}from"react/jsx-runtime";function Nl({attributes:e,children:t}){let o=lh();return sh(Bl,{className:o?"--selected":"",...e,spellCheck:"false",children:t})}import{jsx as $l}from"react/jsx-runtime";function Hl({element:e,attributes:t,children:o}){if(e.type==="code-block")return $l(Dl,{element:e,attributes:t,children:o});if(e.type==="code-block-line")return $l(Nl,{element:e,attributes:t,children:o})}import{Fragment as ph,jsx as Ol}from"react/jsx-runtime";var Ul=y((e,t,{createPolicy:o})=>{e.codeBlock=xl(e);function r(){let{selection:n}=e;if(!se(n))return!1;let i=E(e,"code-block");return i==null?!1:mh.string(e,i[1])===""?(Al.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:u(Ml,e)},editableProps:{decorate:gl,onKeyDown:D({"super+`":()=>e.codeBlock.createCodeBlock({language:"text"}),"mod+a":()=>{let n=E(e,i=>ch.isElement(i)&&i.type==="code-block");return n?(Al.select(e,n[1]),!0):!1}}),renderElement:Hl,renderLeaf:({leaf:n,children:i})=>{let a=n.prismToken&&wl[n.prismToken]||null;return a===null?Ol(ph,{children:i}):Ol("span",{style:a,children:i})}}})});import{Transforms as uh}from"slate";import _l from"@emotion/styled";var Fl=_l("div")`
942
942
  position: relative;
943
943
  background-color: var(--shade-100);
944
944
  border: 1px solid var(--shade-300);
@@ -956,7 +956,7 @@
956
956
  &.--selected {
957
957
  outline: 2px solid var(--select-color);
958
958
  }
959
- `,Ul=Al("span")`
959
+ `,Vl=_l("span")`
960
960
  position: absolute;
961
961
  top: 0.25em;
962
962
  right: 0.5em;
@@ -964,7 +964,7 @@
964
964
  color: var(--shade-500);
965
965
  text-transform: uppercase;
966
966
  letter-spacing: 0.5px;
967
- `;import{jsx as Fl,jsxs as rh}from"react/jsx-runtime";function Vl({attributes:e,children:t,element:o}){return rh(Ol,{...e,contentEditable:!1,children:[Fl(Ul,{children:"HTML"}),Fl("div",{children:tt(o.html)}),t]})}import{jsx as ih}from"react/jsx-runtime";var Kl=y((e,t,{createPolicy:o})=>{function r(){let{selection:n}=e;if(!se(n))return!1;let i=E(e,"html-block");return i==null?!1:(nh.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 ih(Vl,{element:n,attributes:i,children:a})}}})});import{Editor as Yl}from"slate";import{Element as ch}from"slate";import{Element as ah,Transforms as lh}from"slate";function _l(e){return ah.isElement(e)&&e.type==="paragraph"}function Wl(e,t){return ge(e,t,(o,r)=>!_l(o[0])||!_l(r[0])?!1:o[0].__collapsible&&r[0].__collapsible?(lh.removeNodes(e,{at:o[1]}),!0):!1)}import{Element as sh,Transforms as mh}from"slate";function Jo(e,t){return sh.isElement(t)?e.isVoid(t)||e.isMaster(t):!1}function Gl(e,t){return Jo(e,t[0])?ge(e,t,(o,r)=>!Jo(e,o[0])||!Jo(e,r[0])?!1:(mh.insertNodes(e,{type:"paragraph",__collapsible:!0,children:[{text:""}]},{at:r[1]}),!0)):!1}function ql(e,t){let[o,r]=t;return ch.isElement(o)?!!(Gl(e,[o,r])||Wl(e,[o,r])):!1}import{clsx as uh}from"clsx";import{useSelected as fh}from"slate-react";import ph from"@emotion/styled";var Ql=ph("p")`
967
+ `;import{jsx as Kl,jsxs as dh}from"react/jsx-runtime";function Wl({attributes:e,children:t,element:o}){return dh(Fl,{...e,contentEditable:!1,children:[Kl(Vl,{children:"HTML"}),Kl("div",{children:ot(o.html)}),t]})}import{jsx as fh}from"react/jsx-runtime";var Gl=y((e,t,{createPolicy:o})=>{function r(){let{selection:n}=e;if(!se(n))return!1;let i=E(e,"html-block");return i==null?!1:(uh.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 fh(Wl,{element:n,attributes:i,children:a})}}})});import{Editor as es}from"slate";import{Element as xh}from"slate";import{Element as hh,Transforms as gh}from"slate";function ql(e){return hh.isElement(e)&&e.type==="paragraph"}function Ql(e,t){return be(e,t,(o,r)=>!ql(o[0])||!ql(r[0])?!1:o[0].__collapsible&&r[0].__collapsible?(gh.removeNodes(e,{at:o[1]}),!0):!1)}import{Element as bh,Transforms as Eh}from"slate";function er(e,t){return bh.isElement(t)?e.isVoid(t)||e.isMaster(t):!1}function Xl(e,t){return er(e,t[0])?be(e,t,(o,r)=>!er(e,o[0])||!er(e,r[0])?!1:(Eh.insertNodes(e,{type:"paragraph",__collapsible:!0,children:[{text:""}]},{at:r[1]}),!0)):!1}function jl(e,t){let[o,r]=t;return xh.isElement(o)?!!(Xl(e,[o,r])||Ql(e,[o,r])):!1}import{clsx as Th}from"clsx";import{useSelected as vh}from"slate-react";import yh from"@emotion/styled";var Yl=yh("p")`
968
968
  padding: 0;
969
969
  margin: 0;
970
970
  &:first-child {
@@ -994,42 +994,42 @@
994
994
  }
995
995
  border-radius: 8px;
996
996
  }
997
- `;import{Node as dh}from"slate";function jl(e){return e.children.length===1&&dh.string(e.children[0]).length===0}import{jsx as hh}from"react/jsx-runtime";function Xl({element:e,attributes:t,children:o}){let r=fh(),n=jl(e);return hh(Ql,{...t,className:uh({"--selected":r,"--empty":n,"--collapsible":!!e.__collapsible}),children:o})}import{jsx as gh}from"react/jsx-runtime";var Jl=y(e=>{let{insertBreak:t}=e;if(e.insertBreak=()=>{let{selection:o}=e;if(o&&o.anchor.path[0]===o.focus.path[0]){let r=[o.anchor.path[0]],n=Yl.start(e,r);Yl.string(e,{anchor:n,focus:o.anchor}).endsWith(`
997
+ `;import{Node as kh}from"slate";function Jl(e){return e.children.length===1&&kh.string(e.children[0]).length===0}import{jsx as wh}from"react/jsx-runtime";function Zl({element:e,attributes:t,children:o}){let r=vh(),n=Jl(e);return wh(Yl,{...t,className:Th({"--selected":r,"--empty":n,"--collapsible":!!e.__collapsible}),children:o})}import{jsx as Ih}from"react/jsx-runtime";var ts=y(e=>{let{insertBreak:t}=e;if(e.insertBreak=()=>{let{selection:o}=e;if(o&&o.anchor.path[0]===o.focus.path[0]){let r=[o.anchor.path[0]],n=es.start(e,r);es.string(e,{anchor:n,focus:o.anchor}).endsWith(`
998
998
  `)?t():e.insertText(`
999
- `)}else t()},e.convertElement.addConvertElementType("paragraph"),e.collapsibleParagraph={convertParagraph:()=>{e.convertElement.convertElements(()=>!1,{type:"paragraph"},!1)}},!e.normalizeAfterDelete)throw new Error("The collapsible-paragraph-plugin has a dependency on the normalize-after-delete plugin. Please add that plugin before this one.");return{name:"collapsible-paragraph",editor:{normalizeNode:u(ql,e)},editableProps:{renderElement:({element:o,attributes:r,children:n})=>{switch(o.type){case"paragraph":return gh(Xl,{element:o,attributes:r,children:n})}},onKeyDown:D({"super+0":e.collapsibleParagraph.convertParagraph})}}});function Zl(e,t){Array.isArray(t)?e.convertElement.convertElementTypes.push(...t):e.convertElement.convertElementTypes.push(t)}import{Editor as K,Element as Jt,Node as re,Point as Ke,Range as bh,Transforms as Pe}from"slate";function es(e,t,o){try{let r=K.start(e,o),n=K.end(e,o);if(Ke.isBefore(t,r)||Ke.isAfter(t,n))return-1;let i={anchor:r,focus:t};return K.string(e,i).length}catch{return-1}}function ts(e,t,o){try{let r=re.get(e,t);if(!Jt.isElement(r))return;let n=re.string(r),i=Math.min(o,n.length),a=K.start(e,t),l=0,s=a.path,m=0;for(let[d,p]of re.texts(r)){let b=d.text.length;if(l+b>=i){s=[...t,...p],m=i-l;break}l+=b}let c={path:s,offset:m};Pe.select(e,{anchor:c,focus:c})}catch{}}function Eh(e){return re.string(e).includes(`
1000
- `)}function xh(e,t,o,r){let n=re.string(t),i=n.split(`
1001
- `),a=K.start(e,o),l=K.end(e,o),s=Ke.isBefore(r.anchor,a)?a:Ke.isAfter(r.anchor,l)?l:r.anchor,m=Ke.isBefore(r.focus,a)?a:Ke.isAfter(r.focus,l)?l:r.focus,c=Math.min(K.string(e,{anchor:a,focus:s}).length,n.length),d=Math.min(K.string(e,{anchor:a,focus:m}).length,n.length),p=Math.min(c,d),b=Math.max(c,d),g=0,v=0,C=i.length-1;for(let P=0;P<i.length;P++){let w=g+i[P].length;if(g<=p&&p<=w&&(v=P),g<=b&&b<=w){C=P;break}g=w+1}return{startLineIndex:v,endLineIndex:C}}function yh(e,t,o,r){let n=re.string(t);if(!n.includes(`
999
+ `)}else t()},e.convertElement.addConvertElementType("paragraph"),e.collapsibleParagraph={convertParagraph:()=>{e.convertElement.convertElements(()=>!1,{type:"paragraph"},!1)}},!e.normalizeAfterDelete)throw new Error("The collapsible-paragraph-plugin has a dependency on the normalize-after-delete plugin. Please add that plugin before this one.");return{name:"collapsible-paragraph",editor:{normalizeNode:u(jl,e)},editableProps:{renderElement:({element:o,attributes:r,children:n})=>{switch(o.type){case"paragraph":return Ih(Zl,{element:o,attributes:r,children:n})}},onKeyDown:D({"super+0":e.collapsibleParagraph.convertParagraph})}}});function os(e,t){Array.isArray(t)?e.convertElement.convertElementTypes.push(...t):e.convertElement.convertElementTypes.push(t)}import{Editor as V,Element as eo,Node as re,Point as Ke,Range as Mh,Transforms as Ce}from"slate";function rs(e,t,o){try{let r=V.start(e,o),n=V.end(e,o);if(Ke.isBefore(t,r)||Ke.isAfter(t,n))return-1;let i={anchor:r,focus:t};return V.string(e,i).length}catch{return-1}}function ns(e,t,o){try{let r=re.get(e,t);if(!eo.isElement(r))return;let n=re.string(r),i=Math.min(o,n.length),a=V.start(e,t),l=0,s=a.path,m=0;for(let[d,p]of re.texts(r)){let g=d.text.length;if(l+g>=i){s=[...t,...p],m=i-l;break}l+=g}let c={path:s,offset:m};Ce.select(e,{anchor:c,focus:c})}catch{}}function Ph(e){return re.string(e).includes(`
1000
+ `)}function Ch(e,t,o,r){let n=re.string(t),i=n.split(`
1001
+ `),a=V.start(e,o),l=V.end(e,o),s=Ke.isBefore(r.anchor,a)?a:Ke.isAfter(r.anchor,l)?l:r.anchor,m=Ke.isBefore(r.focus,a)?a:Ke.isAfter(r.focus,l)?l:r.focus,c=Math.min(V.string(e,{anchor:a,focus:s}).length,n.length),d=Math.min(V.string(e,{anchor:a,focus:m}).length,n.length),p=Math.min(c,d),g=Math.max(c,d),b=0,k=0,S=i.length-1;for(let I=0;I<i.length;I++){let w=b+i[I].length;if(b<=p&&p<=w&&(k=I),b<=g&&g<=w){S=I;break}b=w+1}return{startLineIndex:k,endLineIndex:S}}function Sh(e,t,o,r){let n=re.string(t);if(!n.includes(`
1002
1002
  `))return o;let i=n.split(`
1003
- `);if(i.length<=1)return o;let{startLineIndex:a,endLineIndex:l}=xh(e,t,o,r),s=i.slice(0,a),m=i.slice(a,l+1),c=i.slice(l+1);return s.length===0&&c.length===0?o:(K.withoutNormalizing(e,()=>{let d=o.slice(0,-1),p=o[o.length-1];if(c.length>0){let g=c.join(`
1004
- `),v={...t,children:[{text:g}]};Pe.insertNodes(e,v,{at:[...d,p+1]})}let b=t.children.length;for(let g=b-1;g>=0;g--)Pe.removeNodes(e,{at:[...o,g]});if(s.length>0){Pe.insertNodes(e,{text:s.join(`
1005
- `)},{at:[...o,0]});let v={type:"paragraph",children:[{text:m.join(`
1006
- `)}]};Pe.insertNodes(e,v,{at:[...d,p+1]})}else Pe.insertNodes(e,{text:m.join(`
1007
- `)},{at:[...o,0]})}),s.length>0?[...o.slice(0,-1),o[o.length-1]+1]:o)}function os(e,t,o,r){let{selection:n}=e;if(!n)return!1;let i=-1,a=-1,l=bh.isCollapsed(n),s=Array.from(K.nodes(e,{match:p=>Jt.isElement(p)&&e.convertElement.isConvertibleElement(p)}));if(s.length>0){let[,p]=s[0];i=es(e,n.anchor,p),a=es(e,n.focus,p)}if(s.length===0)return!1;let m=[];K.withoutNormalizing(e,()=>{for(let p=s.length-1;p>=0;p--){let[b,g]=s[p];if(Eh(b)){let v=yh(e,b,g,n);m.unshift(v)}else m.unshift(g)}});let c=m.map(p=>{try{let b=re.get(e,p);return Jt.isElement(b)?[b,p]:null}catch{return null}}).filter(p=>p!==null);if(c.length===0)return!1;if(r&&c.every(p=>t(p[0]))?K.withoutNormalizing(e,()=>{for(let p of c)mt(e,{type:"paragraph"},p[1])}):K.withoutNormalizing(e,()=>{for(let p of c)mt(e,o,p[1])}),c.length>0&&i>=0){let[,p]=c[0];if(l)ts(e,p,i);else if(a>=0)try{let b=re.get(e,p);if(Jt.isElement(b)){let g=re.string(b),v=Math.min(i,g.length),C=Math.min(a,g.length),P=K.start(e,p),w=P.path,S=v,M=0;for(let[I,k]of re.texts(b)){let z=I.text.length;if(M+z>=v){w=[...p,...k],S=v-M;break}M+=z}let N=P.path,T=C;M=0;for(let[I,k]of re.texts(b)){let z=I.text.length;if(M+z>=C){N=[...p,...k],T=C-M;break}M+=z}Pe.select(e,{anchor:{path:w,offset:S},focus:{path:N,offset:T}})}}catch{ts(e,p,i)}}return!0}function rs(e,t){return e.convertElement.convertElementTypes.includes(t.type)}function ns(e){return{convertElementTypes:[],addConvertElementType:u(Zl,e),isConvertibleElement:u(rs,e),convertElements:u(os,e)}}var is=y(e=>(e.convertElement=ns(e),{name:"convert-element"}));import{Editor as Zo,Path as kh,Range as vh,Transforms as as}from"slate";function ls(e){let t=E(e,"heading");if(!t||!e.selection||vh.isExpanded(e.selection)||!Zo.isEnd(e,e.selection.anchor,t[1]))return!1;let o=kh.next(t[1]);return as.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:o}),as.select(e,{anchor:Zo.start(e,o),focus:Zo.start(e,o)}),!0}import{Editor as Th}from"slate";function wh(e,t,o){e.convertElement.convertElements(r=>r.type==="heading"&&r.level==t,{type:"heading",level:t},o)}function Ih(e,t){let[o]=Th.nodes(e,{match:r=>"type"in r&&"level"in r&&r.type==="heading"&&r.level===t});return!!o}function ss(e){return{convertHeading:u(wh,e),isHeadingActive:u(Ih,e)}}import{css as Mh}from"@emotion/react";import _e from"@emotion/styled";var We=Mh`
1003
+ `);if(i.length<=1)return o;let{startLineIndex:a,endLineIndex:l}=Ch(e,t,o,r),s=i.slice(0,a),m=i.slice(a,l+1),c=i.slice(l+1);return s.length===0&&c.length===0?o:(V.withoutNormalizing(e,()=>{let d=o.slice(0,-1),p=o[o.length-1];if(c.length>0){let b=c.join(`
1004
+ `),k={...t,children:[{text:b}]};Ce.insertNodes(e,k,{at:[...d,p+1]})}let g=t.children.length;for(let b=g-1;b>=0;b--)Ce.removeNodes(e,{at:[...o,b]});if(s.length>0){Ce.insertNodes(e,{text:s.join(`
1005
+ `)},{at:[...o,0]});let k={type:"paragraph",children:[{text:m.join(`
1006
+ `)}]};Ce.insertNodes(e,k,{at:[...d,p+1]})}else Ce.insertNodes(e,{text:m.join(`
1007
+ `)},{at:[...o,0]})}),s.length>0?[...o.slice(0,-1),o[o.length-1]+1]:o)}function is(e,t,o,r){let{selection:n}=e;if(!n)return!1;let i=-1,a=-1,l=Mh.isCollapsed(n),s=Array.from(V.nodes(e,{match:p=>eo.isElement(p)&&e.convertElement.isConvertibleElement(p)}));if(s.length>0){let[,p]=s[0];i=rs(e,n.anchor,p),a=rs(e,n.focus,p)}if(s.length===0)return!1;let m=[];V.withoutNormalizing(e,()=>{for(let p=s.length-1;p>=0;p--){let[g,b]=s[p];if(Ph(g)){let k=Sh(e,g,b,n);m.unshift(k)}else m.unshift(b)}});let c=m.map(p=>{try{let g=re.get(e,p);return eo.isElement(g)?[g,p]:null}catch{return null}}).filter(p=>p!==null);if(c.length===0)return!1;if(r&&c.every(p=>t(p[0]))?V.withoutNormalizing(e,()=>{for(let p of c)ct(e,{type:"paragraph"},p[1])}):V.withoutNormalizing(e,()=>{for(let p of c)ct(e,o,p[1])}),c.length>0&&i>=0){let[,p]=c[0];if(l)ns(e,p,i);else if(a>=0)try{let g=re.get(e,p);if(eo.isElement(g)){let b=re.string(g),k=Math.min(i,b.length),S=Math.min(a,b.length),I=V.start(e,p),w=I.path,R=k,M=0;for(let[T,C]of re.texts(g)){let P=T.text.length;if(M+P>=k){w=[...p,...C],R=k-M;break}M+=P}let N=I.path,v=S;M=0;for(let[T,C]of re.texts(g)){let P=T.text.length;if(M+P>=S){N=[...p,...C],v=S-M;break}M+=P}Ce.select(e,{anchor:{path:w,offset:R},focus:{path:N,offset:v}})}}catch{ns(e,p,i)}}return!0}function as(e,t){return e.convertElement.convertElementTypes.includes(t.type)}function ls(e){return{convertElementTypes:[],addConvertElementType:u(os,e),isConvertibleElement:u(as,e),convertElements:u(is,e)}}var ss=y(e=>(e.convertElement=ls(e),{name:"convert-element"}));import{Editor as tr,Path as Rh,Range as Lh,Transforms as ms}from"slate";function cs(e){let t=E(e,"heading");if(!t||!e.selection||Lh.isExpanded(e.selection)||!tr.isEnd(e,e.selection.anchor,t[1]))return!1;let o=Rh.next(t[1]);return ms.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:o}),ms.select(e,{anchor:tr.start(e,o),focus:tr.start(e,o)}),!0}import{Editor as Bh}from"slate";function zh(e,t,o){e.convertElement.convertElements(r=>r.type==="heading"&&r.level==t,{type:"heading",level:t},o)}function Dh(e,t){let[o]=Bh.nodes(e,{match:r=>"type"in r&&"level"in r&&r.type==="heading"&&r.level===t});return!!o}function ps(e){return{convertHeading:u(zh,e),isHeadingActive:u(Dh,e)}}import{css as Nh}from"@emotion/react";import We from"@emotion/styled";var Ge=Nh`
1008
1008
  margin-top: 1em;
1009
1009
  &:first-child {
1010
1010
  margin-top: 0;
1011
1011
  }
1012
1012
  font-weight: bold;
1013
- `,ms=_e("h1")`
1014
- ${We}
1013
+ `,ds=We("h1")`
1014
+ ${Ge}
1015
1015
  font-size: 2.25em;
1016
1016
  letter-spacing: -0.01em;
1017
- `,cs=_e("h2")`
1018
- ${We}
1017
+ `,us=We("h2")`
1018
+ ${Ge}
1019
1019
  font-size: 1.5em;
1020
- `,ps=_e("h3")`
1021
- ${We}
1020
+ `,fs=We("h3")`
1021
+ ${Ge}
1022
1022
  font-size: 1.25em;
1023
- `,ds=_e("h4")`
1024
- ${We}
1023
+ `,hs=We("h4")`
1024
+ ${Ge}
1025
1025
  font-size: 1em;
1026
- `,us=_e("h5")`
1027
- ${We}
1026
+ `,gs=We("h5")`
1027
+ ${Ge}
1028
1028
  font-size: 1em;
1029
- `,fs=_e("h6")`
1030
- ${We}
1029
+ `,bs=We("h6")`
1030
+ ${Ge}
1031
1031
  font-size: 1em;
1032
- `;import{jsx as Ge}from"react/jsx-runtime";var hs=y(e=>{e.convertElement.addConvertElementType("heading"),e.heading=ss(e);let t=D({"super+1":W(e.heading.convertHeading,1,!0),"super+2":W(e.heading.convertHeading,2,!0),"super+3":W(e.heading.convertHeading,3,!0),"super+4":W(e.heading.convertHeading,4,!0),"super+5":W(e.heading.convertHeading,5,!0),"super+6":W(e.heading.convertHeading,6,!0)}),o=li(e,{"#":W(e.heading.convertHeading,1,!1),"##":W(e.heading.convertHeading,2,!1),"###":W(e.heading.convertHeading,3,!1),"####":W(e.heading.convertHeading,4,!1),"#####":W(e.heading.convertHeading,5,!1),"######":W(e.heading.convertHeading,6,!1)});return{name:"heading",editor:{insertBreak:u(ls,e)},editableProps:{renderElement:({element:r,attributes:n,children:i})=>{if(r.type==="heading")switch(r.level){case 1:return Ge(ms,{...n,children:i});case 2:return Ge(cs,{...n,children:i});case 3:return Ge(ps,{...n,children:i});case 4:return Ge(ds,{...n,children:i});case 5:return Ge(us,{...n,children:i});case 6:return Ge(fs,{...n,children:i});default:{let a=r.level;throw new Error(`Expected element.level to be 1-6 but got ${a}`)}}},onKeyDown:r=>!!(t(r)||o(r))}}});import{useSelected as Ch}from"slate-react";import Ph from"@emotion/styled";var gs=Ph("hr")`
1032
+ `;import{jsx as qe}from"react/jsx-runtime";var Es=y(e=>{e.convertElement.addConvertElementType("heading"),e.heading=ps(e);let t=D({"super+1":W(e.heading.convertHeading,1,!0),"super+2":W(e.heading.convertHeading,2,!0),"super+3":W(e.heading.convertHeading,3,!0),"super+4":W(e.heading.convertHeading,4,!0),"super+5":W(e.heading.convertHeading,5,!0),"super+6":W(e.heading.convertHeading,6,!0)}),o=mi(e,{"#":W(e.heading.convertHeading,1,!1),"##":W(e.heading.convertHeading,2,!1),"###":W(e.heading.convertHeading,3,!1),"####":W(e.heading.convertHeading,4,!1),"#####":W(e.heading.convertHeading,5,!1),"######":W(e.heading.convertHeading,6,!1)});return{name:"heading",editor:{insertBreak:u(cs,e)},editableProps:{renderElement:({element:r,attributes:n,children:i})=>{if(r.type==="heading")switch(r.level){case 1:return qe(ds,{...n,children:i});case 2:return qe(us,{...n,children:i});case 3:return qe(fs,{...n,children:i});case 4:return qe(hs,{...n,children:i});case 5:return qe(gs,{...n,children:i});case 6:return qe(bs,{...n,children:i});default:{let a=r.level;throw new Error(`Expected element.level to be 1-6 but got ${a}`)}}},onKeyDown:r=>!!(t(r)||o(r))}}});import{useSelected as Hh}from"slate-react";import $h from"@emotion/styled";var xs=$h("hr")`
1033
1033
  position: relative;
1034
1034
  height: 1em;
1035
1035
  /* background-color: var(--hr-color); */
@@ -1059,7 +1059,7 @@
1059
1059
  outline: 2px solid var(--select-color, blue);
1060
1060
  }
1061
1061
  }
1062
- `;import{jsx as bs,jsxs as Sh}from"react/jsx-runtime";function Es({attributes:e,children:t}){let o=Ch();return Sh("div",{...e,draggable:!0,children:[t,bs("div",{contentEditable:!1,children:bs(gs,{className:o?"--selected":""})})]})}import{Editor as er,Element as Rh,Path as xs,Transforms as Zt}from"slate";function Lh(e){let{selection:t}=e;if(!t)return!1;let o=E(e,i=>Rh.isElement(i)&&e.isMaster(i)),r={type:"horizontal-rule",children:[{text:""}]},n={type:"paragraph",children:[{text:""}]};if(o==null)er.withoutNormalizing(e,()=>{Zt.insertNodes(e,[r,n]),Zt.move(e)});else{let i=xs.next(o[1]);er.withoutNormalizing(e,()=>{Zt.insertNodes(e,[r,n],{at:i});let a=xs.next(i);Zt.select(e,er.start(e,a))})}return!0}function ys(e){return{insertHorizontalRule:u(Lh,e)}}import{jsx as Bh}from"react/jsx-runtime";var ks=y((e,t,{createPolicy:o})=>(e.horizontalRule=ys(e),o({name:"horizontal-rule",editor:{isVoid(r){if(r.type==="horizontal-rule")return!0}},editableProps:{renderElement:r=>{if(r.element.type==="horizontal-rule")return Bh(Es,{...r})},onKeyDown:D({"super+-":e.horizontalRule.insertHorizontalRule})}})));import vs from"@emotion/styled";var Ts=vs("code")`
1062
+ `;import{jsx as ys,jsxs as Ah}from"react/jsx-runtime";function ks({attributes:e,children:t}){let o=Hh();return Ah("div",{...e,draggable:!0,children:[t,ys("div",{contentEditable:!1,children:ys(xs,{className:o?"--selected":""})})]})}import{Editor as or,Element as Oh,Path as Ts,Transforms as to}from"slate";function Uh(e){let{selection:t}=e;if(!t)return!1;let o=E(e,i=>Oh.isElement(i)&&e.isMaster(i)),r={type:"horizontal-rule",children:[{text:""}]},n={type:"paragraph",children:[{text:""}]};if(o==null)or.withoutNormalizing(e,()=>{to.insertNodes(e,[r,n]),to.move(e)});else{let i=Ts.next(o[1]);or.withoutNormalizing(e,()=>{to.insertNodes(e,[r,n],{at:i});let a=Ts.next(i);to.select(e,or.start(e,a))})}return!0}function vs(e){return{insertHorizontalRule:u(Uh,e)}}import{jsx as _h}from"react/jsx-runtime";var ws=y((e,t,{createPolicy:o})=>(e.horizontalRule=vs(e),o({name:"horizontal-rule",editor:{isVoid(r){if(r.type==="horizontal-rule")return!0}},editableProps:{renderElement:r=>{if(r.element.type==="horizontal-rule")return _h(ks,{...r})},onKeyDown:D({"super+-":e.horizontalRule.insertHorizontalRule})}})));import Is from"@emotion/styled";var Ms=Is("code")`
1063
1063
  color: var(--shade-600);
1064
1064
  background-color: var(--inline-code-bgcolor);
1065
1065
  border: 1px solid var(--inline-code-border-color);
@@ -1080,16 +1080,16 @@
1080
1080
  */
1081
1081
  font-size: 0.75em;
1082
1082
  vertical-align: baseline;
1083
- `,tr=vs("span")`
1083
+ `,rr=Is("span")`
1084
1084
  display: inline-block;
1085
1085
  opacity: 0;
1086
1086
  width: 1px;
1087
1087
  overflow: hidden;
1088
- `;import{jsx as ws,jsxs as zh}from"react/jsx-runtime";var Is=y(e=>{if(!e.marksPlugin)throw new Error("InlineCodePlugin has a dependency on the MarksPlugin but the MarksPlugin has not been added or is added after the InlineCodePlugin");return e.inlineCode={toggleInlineCode:()=>e.marksPlugin.toggleMark("code")},{name:"inline-code",editableProps:{renderLeaf:({leaf:t,children:o})=>t.code?zh(Ts,{spellCheck:!1,children:[ws(tr,{contentEditable:!1,children:"|"}),o,ws(tr,{contentEditable:!1,children:"|"})]}):o,onKeyDown:D({"mod+j":()=>e.inlineCode.toggleInlineCode()})}}});import{Editor as Xs,Path as Ys}from"slate";function Ms(e,t){return e.convertElement.convertElements(o=>o.type==="ordered-list-item",o=>({type:"ordered-list-item",depth:"depth"in o?o.depth:0}),t)}function Ps(e,t){return e.convertElement.convertElements(o=>o.type==="task-list-item",o=>({type:"task-list-item",checked:"checked"in o?o.checked:!1,depth:"depth"in o?o.depth:0}),t)}function Cs(e,t){return e.convertElement.convertElements(o=>o.type==="unordered-list-item",o=>({type:"unordered-list-item",depth:"depth"in o?o.depth:0}),t)}var Dh=2;function eo(e){let t=E(e,L);return t?t[0].depth:0}function or(e){return we(e,L)?eo(e)<Dh:!1}function rr(e){return we(e,L)?eo(e)>0:!1}function Ss(e){or(e)&&e.list.indent()}function Rs(e){rr(e)&&e.list.outdent()}function Ls(e){return St(e,t=>({depth:t.depth+1}),{match:L})}import{Editor as Nh,Transforms as nr}from"slate";function Bs(e){let t=E(e,L);if(!t)return!1;let[o,r]=t;if(Nh.isEmpty(e,o))return o.depth>0?(nr.setNodes(e,{depth:o.depth-1},{at:r}),!0):(mt(e,{type:"paragraph"},r),!0);nr.splitNodes(e,{always:!0});let n=E(e,L);return n&&n[0].type==="task-list-item"&&n[0].checked===!0&&nr.setNodes(e,{checked:!1},{at:n[1]}),!0}import{Editor as $h}from"slate";function zs(e){let t=Array.from($h.nodes(e,{match:L}));for(let o of t)if(o[0].depth===0)return!0;return St(e,o=>({depth:Math.max(0,o.depth-1)}),{match:L})}import{Transforms as Hh}from"slate";function Ds(e,{at:t=e.selection}={}){let o=E(e,"task-list-item",{at:t});if(!o)return!1;let r=!o[0].checked;Hh.setNodes(e,{checked:r},{at:o[1]})}function Ns(e){return{indent:u(Ls,e),outdent:u(zs,e),convertUnorderedList:u(Cs,e),convertOrderedList:u(Ms,e),convertTaskList:u(Ps,e),insertBreak:u(Bs,e),toggleTaskListItem:u(Ds,e),getListDepth:u(eo,e),canIncreaseDepth:u(or,e),canDecreaseDepth:u(rr,e),increaseDepth:u(Ss,e),decreaseDepth:u(Rs,e)}}import{Element as Ah,Transforms as Oh}from"slate";var $s=Ct(["ordered-list-item"]);function to(e,t){let[o,r]=t;return Ah.isElement(o)?ge(e,[o,r],(n,i)=>{if(!$s(i[0]))return!1;let a=$s(n[0])||L(n[0])?i[0].depth>n[0].depth:!0;return i[0].__firstAtDepth!==a?(Oh.setNodes(e,{__firstAtDepth:a},{at:i[1]}),!0):!1}):!1}function Hs(e,t){let[o]=t;return L(o)?to(e,t):!1}import{clsx as Fh}from"clsx";import{useEffect as Vh}from"react";import{ReactEditor as Kh,useSlateStatic as _h}from"slate-react";import oo from"@emotion/styled";var ir=oo("li")`
1088
+ `;import{jsx as Ps,jsxs as Fh}from"react/jsx-runtime";var Cs=y(e=>{if(!e.marksPlugin)throw new Error("InlineCodePlugin has a dependency on the MarksPlugin but the MarksPlugin has not been added or is added after the InlineCodePlugin");return e.inlineCode={toggleInlineCode:()=>e.marksPlugin.toggleMark("code")},{name:"inline-code",editableProps:{renderLeaf:({leaf:t,children:o})=>t.code?Fh(Ms,{spellCheck:!1,children:[Ps(rr,{contentEditable:!1,children:"|"}),o,Ps(rr,{contentEditable:!1,children:"|"})]}):o,onKeyDown:D({"mod+j":()=>e.inlineCode.toggleInlineCode()})}}});import{Editor as Zs,Path as em}from"slate";function Ss(e,t){return e.convertElement.convertElements(o=>o.type==="ordered-list-item",o=>({type:"ordered-list-item",depth:"depth"in o?o.depth:0}),t)}function Rs(e,t){return e.convertElement.convertElements(o=>o.type==="task-list-item",o=>({type:"task-list-item",checked:"checked"in o?o.checked:!1,depth:"depth"in o?o.depth:0}),t)}function Ls(e,t){return e.convertElement.convertElements(o=>o.type==="unordered-list-item",o=>({type:"unordered-list-item",depth:"depth"in o?o.depth:0}),t)}var Vh=2;function oo(e){let t=E(e,B);return t?t[0].depth:0}function nr(e){return Ie(e,B)?oo(e)<Vh:!1}function ir(e){return Ie(e,B)?oo(e)>0:!1}function Bs(e){nr(e)&&e.list.indent()}function zs(e){ir(e)&&e.list.outdent()}function Ds(e){return Lt(e,t=>({depth:t.depth+1}),{match:B})}import{Editor as Kh,Transforms as ar}from"slate";function Ns(e){let t=E(e,B);if(!t)return!1;let[o,r]=t;if(Kh.isEmpty(e,o))return o.depth>0?(ar.setNodes(e,{depth:o.depth-1},{at:r}),!0):(ct(e,{type:"paragraph"},r),!0);ar.splitNodes(e,{always:!0});let n=E(e,B);return n&&n[0].type==="task-list-item"&&n[0].checked===!0&&ar.setNodes(e,{checked:!1},{at:n[1]}),!0}import{Editor as Wh}from"slate";function $s(e){let t=Array.from(Wh.nodes(e,{match:B}));for(let o of t)if(o[0].depth===0)return!0;return Lt(e,o=>({depth:Math.max(0,o.depth-1)}),{match:B})}import{Transforms as Gh}from"slate";function Hs(e,{at:t=e.selection}={}){let o=E(e,"task-list-item",{at:t});if(!o)return!1;let r=!o[0].checked;Gh.setNodes(e,{checked:r},{at:o[1]})}function As(e){return{indent:u(Ds,e),outdent:u($s,e),convertUnorderedList:u(Ls,e),convertOrderedList:u(Ss,e),convertTaskList:u(Rs,e),insertBreak:u(Ns,e),toggleTaskListItem:u(Hs,e),getListDepth:u(oo,e),canIncreaseDepth:u(nr,e),canDecreaseDepth:u(ir,e),increaseDepth:u(Bs,e),decreaseDepth:u(zs,e)}}import{Element as qh,Transforms as Qh}from"slate";var Os=Rt(["ordered-list-item"]);function ro(e,t){let[o,r]=t;return qh.isElement(o)?be(e,[o,r],(n,i)=>{if(!Os(i[0]))return!1;let a=Os(n[0])||B(n[0])?i[0].depth>n[0].depth:!0;return i[0].__firstAtDepth!==a?(Qh.setNodes(e,{__firstAtDepth:a},{at:i[1]}),!0):!1}):!1}function Us(e,t){let[o]=t;return B(o)?ro(e,t):!1}import{clsx as jh}from"clsx";import{useEffect as Yh}from"react";import{ReactEditor as Jh,useSlateStatic as Zh}from"slate-react";import no from"@emotion/styled";var lr=no("li")`
1089
1089
  margin-top: 0.5em;
1090
1090
  margin-bottom: 0.5em;
1091
1091
  list-style-position: outside;
1092
- `,As=oo(ir)`
1092
+ `,_s=no(lr)`
1093
1093
  position: relative;
1094
1094
  list-style-type: none;
1095
1095
  .--list-item-icon {
@@ -1099,7 +1099,7 @@
1099
1099
  line-height: 1.5em;
1100
1100
  color: var(--shade-600);
1101
1101
  }
1102
- `,Os=oo(ir)`
1102
+ `,Fs=no(lr)`
1103
1103
  position: relative;
1104
1104
  list-style-type: none;
1105
1105
  counter-increment: var(--list-item-var);
@@ -1124,7 +1124,7 @@
1124
1124
  /* force numbers to be monospaced for better alignment */
1125
1125
  font-variant-numeric: tabular-nums;
1126
1126
  }
1127
- `,Us=oo(ir)`
1127
+ `,Vs=no(lr)`
1128
1128
  position: relative;
1129
1129
  list-style-type: none;
1130
1130
  .--list-item-icon {
@@ -1138,7 +1138,7 @@
1138
1138
  stroke-width: 3px;
1139
1139
  }
1140
1140
  }
1141
- `;import{jsx as Wh}from"react/jsx-runtime";function Fs({element:e,attributes:t,children:o}){let r=_h();Vh(()=>{let a=Kh.findPath(r,e);to(r,[e,a])},[]);let n={marginLeft:`${2+e.depth*2}em`,"--list-item-var":`list-item-depth-${e.depth}`},i=Fh({"--first-at-depth":e.__firstAtDepth});return Wh(Os,{...t,className:i,style:n,children:o})}import{useCallback as Gh}from"react";import{useSlateStatic as qh}from"slate-react";import{jsx as Ce,jsxs as Ws}from"react/jsx-runtime";var Vs=e=>Ws("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",strokeWidth:2,stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",viewBox:"0 0 24 24",...e,children:[Ce("path",{d:"M0 0h24v24H0z",stroke:"none"}),Ce("rect",{x:4,y:4,width:16,height:16,rx:2})]}),Ks=e=>Ws("svg",{xmlns:"http://www.w3.org/2000/svg",className:"icon icon-tabler icon-tabler-checkbox",width:"1em",height:"1em",strokeWidth:2,stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",viewBox:"0 0 24 24",...e,children:[Ce("path",{d:"M0 0h24v24H0z",stroke:"none"}),Ce("path",{d:"m9 11 3 3 8-8",className:"--checkmark"}),Ce("path",{d:"M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9"})]}),_s=e=>Ce("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"1em",height:"1em",...e,children:Ce("path",{d:"M12 8.25a3.75 3.75 0 1 0 0 7.5 3.75 3.75 0 0 0 0-7.5z"})});import{jsx as ar,jsxs as Qh}from"react/jsx-runtime";function Gs({element:e,attributes:t,children:o}){let r=qh(),n=Gh(()=>{r.list.toggleTaskListItem({at:e})},[r,e]),i=`${2+e.depth*2}em`;return Qh(Us,{...t,style:{marginLeft:i},children:[ar("div",{className:"--list-item-icon",contentEditable:!1,children:e.checked?ar(Ks,{onClick:n,style:{cursor:"pointer"}}):ar(Vs,{onClick:n,style:{cursor:"pointer"}})}),o]})}import{jsx as qs,jsxs as jh}from"react/jsx-runtime";function Qs({element:e,attributes:t,children:o}){let r=`${2+e.depth*2}em`;return jh(As,{...t,style:{marginLeft:r},children:[qs("div",{className:"--list-item-icon",contentEditable:!1,children:qs(_s,{})}),o]})}import{jsx as lr}from"react/jsx-runtime";function js({element:e,attributes:t,children:o}){switch(e.type){case"ordered-list-item":return lr(Fs,{element:e,attributes:t,children:o});case"unordered-list-item":return lr(Qs,{element:e,attributes:t,children:o});case"task-list-item":return lr(Gs,{element:e,attributes:t,children:o})}}var Js=["unordered-list-item","ordered-list-item","task-list-item"],L=Ct(Js),Zs=y((e,t,{createPolicy:o})=>{e.convertElement.addConvertElementType(Js);let r=e.list=Ns(e),n=D({tab:r.indent,"shift+tab":r.outdent,"super+7":u(r.convertOrderedList,!0),"super+8":u(r.convertUnorderedList,!0),"super+9":u(r.convertTaskList,!0)});return o({name:"list",editor:{normalizeNode:i=>Hs(e,i),insertBreak:r.insertBreak,deleteBackward:i=>{if(i!=="character"||!we(e,L))return!1;let a=E(e,L);if(!a)return!1;let l=a[1];if(!Ys.hasPrevious(l))return e.collapsibleParagraph.convertParagraph(),!0;let s=Ys.previous(l),m=Xs.node(e,s);return L(m[0])?!1:(e.collapsibleParagraph.convertParagraph(),!0)}},editableProps:{renderElement:js,onKeyDown(i){return Xs.nodes(e,{match:L})?n(i):!1}}})});import{clsx as tg}from"clsx";import{Editor as sr,Point as og,Range as rg}from"slate";import{Editor as Xh,Text as em,Transforms as Yh}from"slate";function tm(e,{at:t=e.selection}={}){if(t==null)return;let o=[...Xh.nodes(e,{match:n=>em.isText(n),at:t})],r={};for(let[n]of o)for(let i of Object.keys(n))i!=="text"&&(r[i]=null);Yh.setNodes(e,r,{match:n=>em.isText(n),split:!0,at:t})}import{Editor as Se,Point as Jh,Range as Zh}from"slate";function Re(e,t,o,{at:r=e.selection}={}){if(r==null)return;let n=Zh.isRange(r)?r.focus:r,i=Jh.isPoint(n)&&(Se.after(e,n)===null||Se.isEnd(e,n,Se.end(e,[]))),a=t,s=(Se.marks(e)||{})[a]===!0;if(i)if(!s)e.activeMarks={...e.activeMarks,[a]:!0};else{let{[a]:m,...c}=e.activeMarks||{};e.activeMarks=c}s?Se.removeMark(e,a):Se.addMark(e,a,!0),typeof o=="string"&&Se.removeMark(e,o)}function om(e){return{removeMarks:u(tm,e),toggleMark:u(Re,e),toggleBold:()=>Re(e,"bold"),toggleItalic:()=>Re(e,"italic"),toggleUnderline:()=>Re(e,"underline"),toggleStrike:()=>Re(e,"strike"),toggleHighlight:()=>Re(e,"highlight")}}import eg from"@emotion/styled";var rm=eg("span")`
1141
+ `;import{jsx as eg}from"react/jsx-runtime";function Ks({element:e,attributes:t,children:o}){let r=Zh();Yh(()=>{let a=Jh.findPath(r,e);ro(r,[e,a])},[]);let n={marginLeft:`${2+e.depth*2}em`,"--list-item-var":`list-item-depth-${e.depth}`},i=jh({"--first-at-depth":e.__firstAtDepth});return eg(Fs,{...t,className:i,style:n,children:o})}import{useCallback as tg}from"react";import{useSlateStatic as og}from"slate-react";import{jsx as Se,jsxs as Qs}from"react/jsx-runtime";var Ws=e=>Qs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",strokeWidth:2,stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",viewBox:"0 0 24 24",...e,children:[Se("path",{d:"M0 0h24v24H0z",stroke:"none"}),Se("rect",{x:4,y:4,width:16,height:16,rx:2})]}),Gs=e=>Qs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"icon icon-tabler icon-tabler-checkbox",width:"1em",height:"1em",strokeWidth:2,stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",viewBox:"0 0 24 24",...e,children:[Se("path",{d:"M0 0h24v24H0z",stroke:"none"}),Se("path",{d:"m9 11 3 3 8-8",className:"--checkmark"}),Se("path",{d:"M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9"})]}),qs=e=>Se("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"1em",height:"1em",...e,children:Se("path",{d:"M12 8.25a3.75 3.75 0 1 0 0 7.5 3.75 3.75 0 0 0 0-7.5z"})});import{jsx as sr,jsxs as rg}from"react/jsx-runtime";function Xs({element:e,attributes:t,children:o}){let r=og(),n=tg(()=>{r.list.toggleTaskListItem({at:e})},[r,e]),i=`${2+e.depth*2}em`;return rg(Vs,{...t,style:{marginLeft:i},children:[sr("div",{className:"--list-item-icon",contentEditable:!1,children:e.checked?sr(Gs,{onClick:n,style:{cursor:"pointer"}}):sr(Ws,{onClick:n,style:{cursor:"pointer"}})}),o]})}import{jsx as js,jsxs as ng}from"react/jsx-runtime";function Ys({element:e,attributes:t,children:o}){let r=`${2+e.depth*2}em`;return ng(_s,{...t,style:{marginLeft:r},children:[js("div",{className:"--list-item-icon",contentEditable:!1,children:js(qs,{})}),o]})}import{jsx as mr}from"react/jsx-runtime";function Js({element:e,attributes:t,children:o}){switch(e.type){case"ordered-list-item":return mr(Ks,{element:e,attributes:t,children:o});case"unordered-list-item":return mr(Ys,{element:e,attributes:t,children:o});case"task-list-item":return mr(Xs,{element:e,attributes:t,children:o})}}var tm=["unordered-list-item","ordered-list-item","task-list-item"],B=Rt(tm),om=y((e,t,{createPolicy:o})=>{e.convertElement.addConvertElementType(tm);let r=e.list=As(e),n=D({tab:r.indent,"shift+tab":r.outdent,"super+7":u(r.convertOrderedList,!0),"super+8":u(r.convertUnorderedList,!0),"super+9":u(r.convertTaskList,!0)});return o({name:"list",editor:{normalizeNode:i=>Us(e,i),insertBreak:r.insertBreak,deleteBackward:i=>{if(i!=="character"||!Ie(e,B))return!1;let a=E(e,B);if(!a)return!1;let l=a[1];if(!em.hasPrevious(l))return e.collapsibleParagraph.convertParagraph(),!0;let s=em.previous(l),m=Zs.node(e,s);return B(m[0])?!1:(e.collapsibleParagraph.convertParagraph(),!0)}},editableProps:{renderElement:Js,onKeyDown(i){return Zs.nodes(e,{match:B})?n(i):!1}}})});import{clsx as cg}from"clsx";import{Editor as cr,Range as pg}from"slate";import{Editor as ig,Text as rm,Transforms as ag}from"slate";function nm(e,{at:t=e.selection}={}){if(t==null)return;let o=[...ig.nodes(e,{match:n=>rm.isText(n),at:t})],r={};for(let[n]of o)for(let i of Object.keys(n))i!=="text"&&(r[i]=null);ag.setNodes(e,r,{match:n=>rm.isText(n),split:!0,at:t})}import{Editor as Re,Point as lg,Range as sg}from"slate";function Le(e,t,o,{at:r=e.selection}={}){if(r==null)return;let n=sg.isRange(r)?r.focus:r,i=lg.isPoint(n)&&(Re.after(e,n)===null||Re.isEnd(e,n,Re.end(e,[]))),a=t,s=(Re.marks(e)||{})[a]===!0;if(i)if(!s)e.activeMarks={...e.activeMarks,[a]:!0};else{let{[a]:m,...c}=e.activeMarks||{};e.activeMarks=c}s?Re.removeMark(e,a):Re.addMark(e,a,!0),typeof o=="string"&&Re.removeMark(e,o)}function im(e){return{removeMarks:u(nm,e),toggleMark:u(Le,e),toggleBold:()=>Le(e,"bold"),toggleItalic:()=>Le(e,"italic"),toggleUnderline:()=>Le(e,"underline"),toggleStrike:()=>Le(e,"strike"),toggleHighlight:()=>Le(e,"highlight")}}import mg from"@emotion/styled";var am=mg("span")`
1142
1142
  &.--bold {
1143
1143
  font-weight: bold;
1144
1144
  }
@@ -1161,7 +1161,7 @@
1161
1161
  &.--highlight {
1162
1162
  background-color: #ffff00;
1163
1163
  }
1164
- `;import{jsx as ng}from"react/jsx-runtime";var nm=y(e=>{e.marksPlugin=om(e),e.activeMarks={};let t=D({"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){let n=rg.isRange(e.selection)?e.selection.focus:e.selection;og.isPoint(n)&&(sr.after(e,n)===null||sr.isEnd(e,n,sr.end(e,[])))&&(e.activeMarks={})}},{name:"marks",editableProps:{renderLeaf:({leaf:n,children:i})=>ng(rm,{className:tg({"--bold":n.bold,"--italic":n.italic,"--underline":n.underline,"--strike":n.strike,"--highlight":n.highlight}),children:i}),onKeyDown:n=>!!t(n)}}});import{Editor as gt,Point as im}from"slate";function am(e){if(!e.selection)return;let t=gt.parent(e,e.selection);ci(e,t[1])}var lm=y(e=>(e.normalizeAfterDelete=!0,{name:"normalize-after-delete",editor:{deleteBackward(){if(!e.selection)return!1;let t=gt.parent(e,e.selection);return im.equals(gt.start(e,t[1]),e.selection.anchor)?function(){am(e)}:!1},deleteForward(){if(!e.selection)return!1;let t=gt.parent(e,e.selection);return im.equals(gt.end(e,t[1]),e.selection.anchor)?function(){am(e)}:!1}},editableProps:{}}));import{Element as Wg}from"slate";import{Editor as mm,Path as lg,Transforms as cm}from"slate";import{Editor as ig,Path as ag}from"slate";function sm(e,t,o){let r=[...ig.positions(e,{at:t})],n=[],i,a,l;i=a=r[0],l=Ne(e,o,{at:i});for(let m of r){let c=Ne(e,o,{at:m});if(l&&c&&ag.equals(l,c)||l==null&&c==null)a=m;else{let d={anchor:i,focus:a};n.push(d),i=a=m,l=c}}let s={anchor:i,focus:a};return n.push(s),n.reverse(),n}function pm(e,t){if(e.selection==null)return!1;let[o,r]=mm.edges(e,e.selection),n=Ne(e,t,{at:o}),i=Ne(e,t,{at:r});if(!n&&!i||n&&i&&lg.equals(n,i))return!1;let a=sm(e,e.selection,t);return mm.withoutNormalizing(e,()=>{for(let l of a)cm.delete(e,{at:l});cm.collapse(e,{edge:"start"})}),!0}import{Transforms as wg}from"slate";function B(e,{at:t=e.selection}={}){if(t==null)return;let o=E(e,"table-cell",{at:t});if(!o)return;let r=E(e,"table-row",{at:t});if(!r)return;let n=E(e,"table",{at:t});if(!n)return;let[i,a]=n,[l,s]=r,[m,c]=o;return{tableElement:i,tablePath:a,tableColumns:i.columns,rowElement:l,rowPath:s,rowIndex:s.slice(-1)[0],rowCount:i.children.length,cellElement:m,cellPath:c,cellIndex:c.slice(-1)[0],cellCount:l.children.length}}import{Editor as sg,Transforms as dm}from"slate";function qe(e,t=[{type:"table-content",children:[{text:""}]}]){return{type:"table-cell",children:t}}function um(e,{offset:t=0,at:o=e.selection}={}){let r=B(e,{at:o});if(r===void 0)return!1;let{tableElement:n,tablePath:i,cellIndex:a}=r,l=a+t;return sg.withoutNormalizing(e,()=>{let{columns:s}=n,m=[...s];m.splice(l,0,s[l]),dm.setNodes(e,{columns:m},{at:i}),n.children.forEach((c,d)=>{dm.insertNodes(e,qe(l),{at:[...i,d,l]})})}),!0}import{Transforms as mg}from"slate";function cg(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>qe(t))}}function mr(e,{at:t=e.selection,offset:o=0}={}){let r=B(e,{at:t});if(!r)return!1;let n=cg(r.tableElement.columns.length);return mg.insertNodes(e,n,{at:[...r.tablePath,r.rowIndex+o]}),!0}function fm(e,{at:t}={}){return mr(e,{at:t,offset:1})}import{Editor as cr,Element as pg,Path as dg,Transforms as bt}from"slate";function hm(e){return[...Array(e).keys()]}function ug(e){return hm(e).map(()=>({align:"left"}))}function fg(e,t){return{type:"table",columns:ug(e),children:hm(t).map(()=>hg(e))}}function hg(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>qe(t))}}function gm(e,t,o,{at:r=e.selection}={}){let n=fg(t,o);return gg(e,n,{at:r})}function gg(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=E(e,n=>pg.isElement(n)&&e.isMaster(n));if(r==null){let n=e.selection;cr.withoutNormalizing(e,()=>{bt.insertNodes(e,t,{at:o}),n&&(bt.select(e,n),bt.move(e))})}else{let n=dg.next(r[1]);cr.withoutNormalizing(e,()=>{bt.insertNodes(e,t,{at:n}),bt.select(e,cr.start(e,n))})}return!0}import{Path as bm}from"slate";function Em(e,t){let{cellIndex:o,rowIndex:r,rowCount:n,tablePath:i}=t;if(r<n-1)return G(e,[...i,r+1,o]),!0;try{return G(e,bm.next(i)),!0}catch{return!1}}function xm(e,t){let{cellIndex:o,rowIndex:r,tablePath:n}=t;if(r>0)return G(e,[...n,r-1,o]),!0;try{return fi(e,bm.previous(n)),!0}catch{return!1}}import{ReactEditor as bg}from"slate-react";function Eg(){let e=window.getSelection();return e?e.getRangeAt(0).getBoundingClientRect():null}function xg(e,t){return bg.toDOMNode(e,t).getBoundingClientRect()}function pr(e,t){let o=Eg();if(!o)return!1;let r=xg(e,t);return o.right<r.right&&o.left>r.left&&o.bottom<r.bottom&&o.top>r.top}function ym(e){let t=B(e);return t&&setTimeout(()=>{pr(e,t.cellElement)||Em(e,t)}),!1}function km(e){let t=B(e);return t&&setTimeout(()=>{pr(e,t.cellElement)||xm(e,t)}),!1}import{Editor as vm,Transforms as dr}from"slate";import{Transforms as yg}from"slate";function Qe(e){let t=e.tablePlugin.getTableInfo();return t===void 0?!1:(yg.removeNodes(e,{at:t.tablePath}),!0)}function Tm(e,{at:t=e.selection}={}){let o=B(e,{at:t});if(!o)return!1;let{tableElement:r,tablePath:n,rowIndex:i,cellIndex:a,cellCount:l}=o;if(l===1)return Qe(e);vm.withoutNormalizing(e,()=>{let s=[...r.columns];s.splice(a,1),dr.setNodes(e,{columns:s},{at:n}),r.children.forEach((c,d)=>{dr.removeNodes(e,{at:[...n,d,a]})});let m=vm.start(e,[...n,i,Math.min(a,l-2)]);dr.select(e,m)})}import{Editor as wm,Transforms as Im}from"slate";function Mm(e,{at:t=e.selection}={}){let o=B(e,{at:t});return o===void 0?!1:o.rowCount===1?(Qe(e),!0):(wm.withoutNormalizing(e,()=>{Im.removeNodes(e,{at:o.rowPath}),Im.select(e,wm.start(e,[...o.tablePath,Math.min(o.rowIndex,o.rowCount-2),o.cellIndex]))}),!0)}import{Transforms as kg}from"slate";function Pm(e,t){let o=B(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}),kg.setNodes(e,{columns:a},{at:n}),!0}import{Path as vg,Transforms as Tg}from"slate";function Cm(e){let t=B(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,rowCount:i,tablePath:a}=t;if(o<r-1)return G(e,[...a,n,o+1]),!0;if(n<i-1)return G(e,[...a,n+1,0]),!0;let l=vg.next(a);return Tg.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:l}),G(e,l),!0}function Sm(e){let t=B(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,tablePath:i}=t;if(o>0)return G(e,[...i,n,o-1]),!0;if(n>0)return G(e,[...i,n-1,r-1]),!0}function Rm(e){let t=B(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,rowCount:i,tablePath:a}=t;return o<r-1?(G(e,[...a,n,o+1]),!0):n<i-1?(G(e,[...a,n+1,0]),!0):(fm(e),G(e,[...a,n+1,0]),!0)}function Lm(e){return{getTableInfo:u(B,e),insertTable:u(gm,e),insertColumn:u(um,e),insertRow:u(mr,e),removeTable:u(Qe,e),removeColumn:u(Tm,e),removeRow:u(Mm,e),tabForward:u(Cm,e),tabBackward:u(Sm,e),shiftEnterForward:u(Rm,e),selectCell:u(Ig,e),down:u(ym,e),up:u(km,e),setTableColumnAlign:u(Pm,e)}}function Ig(e,{at:t=e.selection}={}){let o=B(e,{at:t});if(o===void 0)return!1;let{cellPath:r}=o;return wg.select(e,r),!0}import{Transforms as Mg}from"slate";function ro(e,t){let o=!1;return t[0].children.forEach((n,i)=>{n.children.forEach((l,s)=>{(l.x!==s||l.y!==i)&&(Mg.setNodes(e,{x:s,y:i},{at:[...t[1],i,s]}),o=!0)})}),o}import{Editor as Pg,Transforms as ur}from"slate";function Bm(e,t){let[o,r]=t;return o.children.length===1&&o.children[0].type==="table-content"?!1:(Pg.withoutNormalizing(e,()=>{ur.insertNodes(e,{type:"table-content",children:[{text:"X"}]},{at:[...t[1],0]});for(let n=o.children.length;n>=0;n--)ur.mergeNodes(e,{at:[...r,n]});ur.delete(e,{at:{path:[...r,0,0],offset:0},unit:"character"})}),!0)}import{useEffect as Sg}from"react";import{ReactEditor as Rg,useSelected as Lg,useSlateStatic as Bg}from"slate-react";import io from"@emotion/styled";import me from"@emotion/styled";var zm=me("div")`
1164
+ `;import{jsx as dg}from"react/jsx-runtime";var lm=y(e=>{e.marksPlugin=im(e),e.activeMarks={};let t=D({"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&&pg.isRange(e.selection)){let n=e.selection.focus;(cr.after(e,n)===null||cr.isEnd(e,n,cr.end(e,[])))&&(e.activeMarks={})}},{name:"marks",editableProps:{renderLeaf:({leaf:n,children:i})=>dg(am,{className:cg({"--bold":n.bold,"--italic":n.italic,"--underline":n.underline,"--strike":n.strike,"--highlight":n.highlight}),children:i}),onKeyDown:n=>!!t(n)}}});import{Editor as bt,Point as sm}from"slate";function mm(e){if(!e.selection)return;let t=bt.parent(e,e.selection);di(e,t[1])}var cm=y(e=>(e.normalizeAfterDelete=!0,{name:"normalize-after-delete",editor:{deleteBackward(){if(!e.selection)return!1;let t=bt.parent(e,e.selection);return sm.equals(bt.start(e,t[1]),e.selection.anchor)?function(){mm(e)}:!1},deleteForward(){if(!e.selection)return!1;let t=bt.parent(e,e.selection);return sm.equals(bt.end(e,t[1]),e.selection.anchor)?function(){mm(e)}:!1}},editableProps:{}}));import{Element as Zg}from"slate";import{Editor as dm,Path as hg,Transforms as um}from"slate";import{Editor as ug,Path as fg}from"slate";function pm(e,t,o){let r=[...ug.positions(e,{at:t})],n=[],i,a,l;i=a=r[0],l=$e(e,o,{at:i});for(let m of r){let c=$e(e,o,{at:m});if(l&&c&&fg.equals(l,c)||l==null&&c==null)a=m;else{let d={anchor:i,focus:a};n.push(d),i=a=m,l=c}}let s={anchor:i,focus:a};return n.push(s),n.reverse(),n}function fm(e,t){if(e.selection==null)return!1;let[o,r]=dm.edges(e,e.selection),n=$e(e,t,{at:o}),i=$e(e,t,{at:r});if(!n&&!i||n&&i&&hg.equals(n,i))return!1;let a=pm(e,e.selection,t);return dm.withoutNormalizing(e,()=>{for(let l of a)um.delete(e,{at:l});um.collapse(e,{edge:"start"})}),!0}import{Transforms as Bg}from"slate";function z(e,{at:t=e.selection}={}){if(t==null)return;let o=E(e,"table-cell",{at:t});if(!o)return;let r=E(e,"table-row",{at:t});if(!r)return;let n=E(e,"table",{at:t});if(!n)return;let[i,a]=n,[l,s]=r,[m,c]=o;return{tableElement:i,tablePath:a,tableColumns:i.columns,rowElement:l,rowPath:s,rowIndex:s.slice(-1)[0],rowCount:i.children.length,cellElement:m,cellPath:c,cellIndex:c.slice(-1)[0],cellCount:l.children.length}}import{Editor as gg,Transforms as hm}from"slate";function Qe(e,t=[{type:"table-content",children:[{text:""}]}]){return{type:"table-cell",children:t}}function gm(e,{offset:t=0,at:o=e.selection}={}){let r=z(e,{at:o});if(r===void 0)return!1;let{tableElement:n,tablePath:i,cellIndex:a}=r,l=a+t;return gg.withoutNormalizing(e,()=>{let{columns:s}=n,m=[...s],c=Math.min(l,s.length-1);m.splice(l,0,s[c]),hm.setNodes(e,{columns:m},{at:i}),n.children.forEach((d,p)=>{hm.insertNodes(e,Qe(l),{at:[...i,p,l]})})}),!0}import{Transforms as bg}from"slate";function Eg(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>Qe(t))}}function pr(e,{at:t=e.selection,offset:o=0}={}){let r=z(e,{at:t});if(!r)return!1;let n=Eg(r.tableElement.columns.length);return bg.insertNodes(e,n,{at:[...r.tablePath,r.rowIndex+o]}),!0}function bm(e,{at:t}={}){return pr(e,{at:t,offset:1})}import{Editor as dr,Element as xg,Path as yg,Transforms as Et}from"slate";function Em(e){return[...Array(e).keys()]}function kg(e){return Em(e).map(()=>({align:"left"}))}function Tg(e,t){return{type:"table",columns:kg(e),children:Em(t).map(()=>vg(e))}}function vg(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>Qe(t))}}function xm(e,t,o,{at:r=e.selection}={}){let n=Tg(t,o);return wg(e,n,{at:r})}function wg(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=E(e,n=>xg.isElement(n)&&e.isMaster(n));if(r==null){let n=e.selection;dr.withoutNormalizing(e,()=>{Et.insertNodes(e,t,{at:o}),n&&(Et.select(e,n),Et.move(e))})}else{let n=yg.next(r[1]);dr.withoutNormalizing(e,()=>{Et.insertNodes(e,t,{at:n}),Et.select(e,dr.start(e,n))})}return!0}import{Path as ym}from"slate";function km(e,t){let{cellIndex:o,rowIndex:r,rowCount:n,tablePath:i}=t;if(r<n-1)return G(e,[...i,r+1,o]),!0;try{return G(e,ym.next(i)),!0}catch{return!1}}function Tm(e,t){let{cellIndex:o,rowIndex:r,tablePath:n}=t;if(r>0)return G(e,[...n,r-1,o]),!0;try{return gi(e,ym.previous(n)),!0}catch{return!1}}import{ReactEditor as Ig}from"slate-react";function Mg(){let e=window.getSelection();return e?e.getRangeAt(0).getBoundingClientRect():null}function Pg(e,t){return Ig.toDOMNode(e,t).getBoundingClientRect()}function ur(e,t){let o=Mg();if(!o)return!1;let r=Pg(e,t);return o.right<r.right&&o.left>r.left&&o.bottom<r.bottom&&o.top>r.top}function vm(e){let t=z(e);return t&&setTimeout(()=>{ur(e,t.cellElement)||km(e,t)}),!1}function wm(e){let t=z(e);return t&&setTimeout(()=>{ur(e,t.cellElement)||Tm(e,t)}),!1}import{Editor as Im,Transforms as fr}from"slate";import{Transforms as Cg}from"slate";function Xe(e){let t=e.tablePlugin.getTableInfo();return t===void 0?!1:(Cg.removeNodes(e,{at:t.tablePath}),!0)}function Mm(e,{at:t=e.selection}={}){let o=z(e,{at:t});if(!o)return!1;let{tableElement:r,tablePath:n,rowIndex:i,cellIndex:a,cellCount:l}=o;if(l===1)return Xe(e);Im.withoutNormalizing(e,()=>{let s=[...r.columns];s.splice(a,1),fr.setNodes(e,{columns:s},{at:n}),r.children.forEach((c,d)=>{fr.removeNodes(e,{at:[...n,d,a]})});let m=Im.start(e,[...n,i,Math.min(a,l-2)]);fr.select(e,m)})}import{Editor as Pm,Transforms as Cm}from"slate";function Sm(e,{at:t=e.selection}={}){let o=z(e,{at:t});return o===void 0?!1:o.rowCount===1?(Xe(e),!0):(Pm.withoutNormalizing(e,()=>{Cm.removeNodes(e,{at:o.rowPath}),Cm.select(e,Pm.start(e,[...o.tablePath,Math.min(o.rowIndex,o.rowCount-2),o.cellIndex]))}),!0)}import{Transforms as Sg}from"slate";function Rm(e,t){let o=z(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}),Sg.setNodes(e,{columns:a},{at:n}),!0}import{Path as Rg,Transforms as Lg}from"slate";function Lm(e){let t=z(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,rowCount:i,tablePath:a}=t;if(o<r-1)return G(e,[...a,n,o+1]),!0;if(n<i-1)return G(e,[...a,n+1,0]),!0;let l=Rg.next(a);return Lg.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:l}),G(e,l),!0}function Bm(e){let t=z(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,tablePath:i}=t;if(o>0)return G(e,[...i,n,o-1]),!0;if(n>0)return G(e,[...i,n-1,r-1]),!0}function zm(e){let t=z(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,rowCount:i,tablePath:a}=t;return o<r-1?(G(e,[...a,n,o+1]),!0):n<i-1?(G(e,[...a,n+1,0]),!0):(bm(e),G(e,[...a,n+1,0]),!0)}function Dm(e){return{getTableInfo:u(z,e),insertTable:u(xm,e),insertColumn:u(gm,e),insertRow:u(pr,e),removeTable:u(Xe,e),removeColumn:u(Mm,e),removeRow:u(Sm,e),tabForward:u(Lm,e),tabBackward:u(Bm,e),shiftEnterForward:u(zm,e),selectCell:u(zg,e),down:u(vm,e),up:u(wm,e),setTableColumnAlign:u(Rm,e)}}function zg(e,{at:t=e.selection}={}){let o=z(e,{at:t});if(o===void 0)return!1;let{cellPath:r}=o;return Bg.select(e,r),!0}import{Transforms as Dg}from"slate";function io(e,t){let o=!1;return t[0].children.forEach((n,i)=>{n.children.forEach((l,s)=>{(l.x!==s||l.y!==i)&&(Dg.setNodes(e,{x:s,y:i},{at:[...t[1],i,s]}),o=!0)})}),o}import{Editor as Ng,Transforms as hr}from"slate";function Nm(e,t){let[o,r]=t;return o.children.length===1&&o.children[0].type==="table-content"?!1:(Ng.withoutNormalizing(e,()=>{hr.insertNodes(e,{type:"table-content",children:[{text:"X"}]},{at:[...t[1],0]});for(let n=o.children.length;n>=0;n--)hr.mergeNodes(e,{at:[...r,n]});hr.delete(e,{at:{path:[...r,0,0],offset:0},unit:"character"})}),!0)}import{useEffect as Hg}from"react";import{ReactEditor as Ag,useSelected as Og,useSlateStatic as Ug}from"slate-react";import lo from"@emotion/styled";import me from"@emotion/styled";var $m=me("div")`
1165
1165
  position: absolute;
1166
1166
  /**
1167
1167
  * very slightly shaded
@@ -1185,7 +1185,7 @@
1185
1185
  background: rgba(0, 0, 0, 0.15);
1186
1186
  }
1187
1187
  }
1188
- `,Dm=me(zm)`
1188
+ `,Hm=me($m)`
1189
1189
  cursor: pointer;
1190
1190
  /**
1191
1191
  * hangs out on top
@@ -1195,7 +1195,7 @@
1195
1195
  right: 0;
1196
1196
  height: 3em;
1197
1197
  top: -3em;
1198
- `,Nm=me(zm)`
1198
+ `,Am=me($m)`
1199
1199
  /**
1200
1200
  * hangs out on left
1201
1201
  */
@@ -1203,7 +1203,7 @@
1203
1203
  bottom: -1px;
1204
1204
  width: 3em;
1205
1205
  left: -3em;
1206
- `,$m=me("div")`
1206
+ `,Om=me("div")`
1207
1207
  position: absolute;
1208
1208
  background: rgba(0, 0, 0, 0.05);
1209
1209
  border: 1px solid rgba(0, 0, 0, 0.05);
@@ -1215,7 +1215,7 @@
1215
1215
  left: 0;
1216
1216
  right: 0;
1217
1217
  bottom: 0;
1218
- `,Hm=me($m)`
1218
+ `,Um=me(Om)`
1219
1219
  top: 50%;
1220
1220
  border-bottom: none;
1221
1221
  border-right: none;
@@ -1241,7 +1241,7 @@
1241
1241
 
1242
1242
  /* border-top-left-radius: 0.5em;
1243
1243
  border-top-right-radius: 0.5em; */
1244
- `,Am=me($m)`
1244
+ `,_m=me(Om)`
1245
1245
  left: 50%;
1246
1246
  border-right: none;
1247
1247
  border-bottom: none;
@@ -1267,7 +1267,7 @@
1267
1267
 
1268
1268
  /* border-top-left-radius: 0.5em;
1269
1269
  border-bottom-left-radius: 0.5em; */
1270
- `,Om=me("div")`
1270
+ `,Fm=me("div")`
1271
1271
  position: absolute;
1272
1272
  font-size: 1.5em;
1273
1273
  background: white;
@@ -1276,27 +1276,27 @@
1276
1276
  svg {
1277
1277
  display: block;
1278
1278
  }
1279
- `,je=me(Om)`
1279
+ `,je=me(Fm)`
1280
1280
  color: #c0c0c0;
1281
1281
  &:hover {
1282
1282
  color: royalblue;
1283
1283
  }
1284
- `,no=me(Om)`
1284
+ `,ao=me(Fm)`
1285
1285
  color: #c0c0c0;
1286
1286
  &:hover {
1287
1287
  color: firebrick;
1288
1288
  }
1289
- `;var Um=io("table")`
1289
+ `;var Vm=lo("table")`
1290
1290
  border-collapse: collapse;
1291
1291
  margin: 1em 0;
1292
1292
  ${({columns:e})=>e.map((t,o)=>`td:nth-of-type(${o+1}) { text-align: ${t.align}; }`).join(`
1293
1293
  `)}
1294
- `,Fm=io("tr")`
1294
+ `,Km=lo("tr")`
1295
1295
  position: relative;
1296
1296
  &:first-of-type {
1297
1297
  background: var(--table-head-bgcolor);
1298
1298
  }
1299
- `,Vm=io("td")`
1299
+ `,Wm=lo("td")`
1300
1300
  position: relative;
1301
1301
  border-width: 1px;
1302
1302
  border-style: solid;
@@ -1316,7 +1316,7 @@
1316
1316
  &:last-of-type {
1317
1317
  border-right-color: var(--table-border-color);
1318
1318
  }
1319
- `,Km=io("div")`
1319
+ `,Gm=lo("div")`
1320
1320
  /**
1321
1321
  * Smaller font inside a table than outside of it
1322
1322
  */
@@ -1328,7 +1328,7 @@
1328
1328
  color: rgba(0, 0, 0, 0.6);
1329
1329
  font-size: 0.875em; /* 14px */
1330
1330
  }
1331
- `;import{createContext as Cg}from"react";var ao=Cg({isSelected:!1});import{jsx as fr}from"react/jsx-runtime";function _m({element:e,attributes:t,children:o}){let r=Bg(),n=Lg();return Sg(()=>{let i=Rg.findPath(r,e);ro(r,[e,i])},[]),fr(ao.Provider,{value:{isSelected:n},children:fr(Um,{...t,columns:e.columns,children:fr("tbody",{children:o})})})}import{useContext as Ug}from"react";import{useSelected as Fg}from"slate-react";import{useCallback as hr,useRef as zg,useState as Dg}from"react";import{useSlateStatic as Ng}from"slate-react";import{jsx as Z}from"react/jsx-runtime";var Xe=e=>Z("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"1em",height:"1em",...e,children:Z("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"})}),lo=e=>Z("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"1em",height:"1em",...e,children:Z("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"})}),so=()=>Z(x,{children:Z("path",{d:"M4 6h16M4 12h16M4 18h16"})}),Wm=()=>Z(x,{children:Z("path",{d:"M4 6h16M4 12h10M4 18h14"})}),Gm=()=>Z(x,{children:Z("path",{d:"M4 6h16M8 12h8M6 18h12"})}),qm=()=>Z(x,{children:Z("path",{d:"M4 6h16M10 12h10M6 18h14"})});import{Fragment as $g,jsx as ce,jsxs as Qm}from"react/jsx-runtime";function jm({cellElement:e}){let t=Ng(),o=H("column-menu"),r=zg(null),[n,i]=Dg(!1),a=hr(()=>{i(!0)},[]),l=hr(()=>{i(!1)},[]),s=hr(()=>{o.layer&&o.close();let m=r.current;if(m===null)return;let c=[{icon:Wm,title:"\u5DE6\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"left"})}},{icon:Gm,title:"\u4E2D\u592E\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"center"})}},{icon:qm,title:"\u53F3\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"right"})}}];o.open(()=>ce(He,{dest:m,items:c,close:o.close}))},[]);return Qm(Dm,{ref:r,contentEditable:!1,onClick:s,onMouseEnter:a,onMouseLeave:l,children:[ce(Hm,{className:"--tile",children:ce(so,{})}),n?Qm($g,{children:[ce(no,{style:{top:0,left:"50%",marginLeft:"-0.5em"},onMouseDown:()=>t.tablePlugin.removeColumn({at:e}),children:ce(lo,{})}),ce(je,{style:{left:"-0.5em",top:0},onMouseDown:()=>t.tablePlugin.insertColumn({at:e}),children:ce(Xe,{})}),ce(je,{style:{right:"-0.5em",top:0},onMouseDown:()=>t.tablePlugin.insertColumn({at:e,offset:1}),children:ce(Xe,{})})]}):null]})}import{useState as Hg}from"react";import{useSlateStatic as Ag}from"slate-react";import{Fragment as Og,jsx as ke,jsxs as Xm}from"react/jsx-runtime";function Ym({cellElement:e}){let t=Ag(),[o,r]=Hg(!1);return Xm(Nm,{contentEditable:!1,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[ke(Am,{className:"--tile",children:ke(so,{})}),o?Xm(Og,{children:[ke(no,{style:{top:"50%",left:"0.5em",marginTop:"-0.5em"},onMouseDown:()=>t.tablePlugin.removeRow({at:e}),children:ke(lo,{})}),ke(je,{style:{top:"-0.5em",left:"0.5em"},onMouseDown:()=>t.tablePlugin.insertRow({at:e}),children:ke(Xe,{})}),ke(je,{style:{bottom:"-0.5em",left:"0.5em"},onMouseDown:()=>t.tablePlugin.insertRow({at:e,offset:1}),children:ke(Xe,{})})]}):null]})}import Jm from"@emotion/styled";var Zm=Jm("div")`
1331
+ `;import{createContext as $g}from"react";var so=$g({isSelected:!1});import{jsx as gr}from"react/jsx-runtime";function qm({element:e,attributes:t,children:o}){let r=Ug(),n=Og();return Hg(()=>{let i=Ag.findPath(r,e);io(r,[e,i])},[]),gr(so.Provider,{value:{isSelected:n},children:gr(Vm,{...t,columns:e.columns,children:gr("tbody",{children:o})})})}import{useContext as Qg}from"react";import{useSelected as Xg}from"slate-react";import{useCallback as br,useRef as _g,useState as Fg}from"react";import{useSlateStatic as Vg}from"slate-react";import{jsx as Z}from"react/jsx-runtime";var Ye=e=>Z("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"1em",height:"1em",...e,children:Z("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"})}),mo=e=>Z("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"1em",height:"1em",...e,children:Z("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"})}),co=()=>Z(x,{children:Z("path",{d:"M4 6h16M4 12h16M4 18h16"})}),Qm=()=>Z(x,{children:Z("path",{d:"M4 6h16M4 12h10M4 18h14"})}),Xm=()=>Z(x,{children:Z("path",{d:"M4 6h16M8 12h8M6 18h12"})}),jm=()=>Z(x,{children:Z("path",{d:"M4 6h16M10 12h10M6 18h14"})});import{Fragment as Kg,jsx as ce,jsxs as Ym}from"react/jsx-runtime";function Jm({cellElement:e}){let t=Vg(),o=H("column-menu"),r=_g(null),[n,i]=Fg(!1),a=br(()=>{i(!0)},[]),l=br(()=>{i(!1)},[]),s=br(()=>{o.layer&&o.close();let m=r.current;if(m===null)return;let c=[{icon:Qm,title:"\u5DE6\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"left"})}},{icon:Xm,title:"\u4E2D\u592E\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"center"})}},{icon:jm,title:"\u53F3\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"right"})}}];o.open(()=>ce(Ae,{dest:m,items:c,close:o.close}))},[]);return Ym(Hm,{ref:r,contentEditable:!1,onClick:s,onMouseEnter:a,onMouseLeave:l,children:[ce(Um,{className:"--tile",children:ce(co,{})}),n?Ym(Kg,{children:[ce(ao,{style:{top:0,left:"50%",marginLeft:"-0.5em"},onMouseDown:()=>t.tablePlugin.removeColumn({at:e}),children:ce(mo,{})}),ce(je,{style:{left:"-0.5em",top:0},onMouseDown:()=>t.tablePlugin.insertColumn({at:e}),children:ce(Ye,{})}),ce(je,{style:{right:"-0.5em",top:0},onMouseDown:()=>t.tablePlugin.insertColumn({at:e,offset:1}),children:ce(Ye,{})})]}):null]})}import{useState as Wg}from"react";import{useSlateStatic as Gg}from"slate-react";import{Fragment as qg,jsx as Te,jsxs as Zm}from"react/jsx-runtime";function ec({cellElement:e}){let t=Gg(),[o,r]=Wg(!1);return Zm(Am,{contentEditable:!1,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[Te(_m,{className:"--tile",children:Te(co,{})}),o?Zm(qg,{children:[Te(ao,{style:{top:"50%",left:"0.5em",marginTop:"-0.5em"},onMouseDown:()=>t.tablePlugin.removeRow({at:e}),children:Te(mo,{})}),Te(je,{style:{top:"-0.5em",left:"0.5em"},onMouseDown:()=>t.tablePlugin.insertRow({at:e}),children:Te(Ye,{})}),Te(je,{style:{bottom:"-0.5em",left:"0.5em"},onMouseDown:()=>t.tablePlugin.insertRow({at:e,offset:1}),children:Te(Ye,{})})]}):null]})}import tc from"@emotion/styled";var oc=tc("div")`
1332
1332
  position: absolute;
1333
1333
  /**
1334
1334
  * very slightly shaded
@@ -1360,7 +1360,7 @@
1360
1360
  background: rgba(0, 0, 0, 0.15);
1361
1361
  }
1362
1362
  }
1363
- `,ec=Jm("div")`
1363
+ `,rc=tc("div")`
1364
1364
  position: absolute;
1365
1365
  left: 0;
1366
1366
  top: 0;
@@ -1368,8 +1368,8 @@
1368
1368
  height: 1.5em;
1369
1369
  background: rgba(0, 0, 0, 0.05);
1370
1370
  border-radius: 50%;
1371
- `;import{jsx as tc}from"react/jsx-runtime";function oc(){return tc(Zm,{contentEditable:!1,children:tc(ec,{className:"--table-menu-tile"})})}import{jsx as gr,jsxs as Vg}from"react/jsx-runtime";function rc({element:e,attributes:t,children:o}){let r=Ug(ao),n=Fg(),i=r.isSelected&&e.x===0&&e.y===0,a=r.isSelected&&e.x===0,l=r.isSelected&&e.y===0;return Vg(Vm,{className:n?"--selected":"",...t,"data-x":e.x,"data-y":e.y,children:[o,i?gr(oc,{}):null,a?gr(Ym,{cellElement:e}):null,l?gr(jm,{cellElement:e}):null]})}import{jsx as Kg}from"react/jsx-runtime";function nc({attributes:e,children:t}){return Kg(Km,{...e,children:t})}import{jsx as _g}from"react/jsx-runtime";function ic({attributes:e,children:t}){return _g(Fm,{...e,children:t})}import{jsx as mo}from"react/jsx-runtime";function ac({element:e,attributes:t,children:o}){switch(e.type){case"table":return mo(_m,{element:e,attributes:t,children:o});case"table-row":return mo(ic,{element:e,attributes:t,children:o});case"table-cell":return mo(rc,{element:e,attributes:t,children:o});case"table-content":return mo(nc,{element:e,attributes:t,children:o})}}var lc=y((e,t,{createPolicy:o})=>(e.supportsTable=!0,e.tablePlugin=Lm(e),o({name:"table",editor:{deleteBackward:()=>we(e,"table-cell"),deleteForward:()=>ii(e,"table-cell"),deleteFragment:()=>pm(e,["table-cell"]),insertBreak:()=>E(e,"table-cell")?(e.insertText(`
1372
- `),!0):!1,isMaster(r){if(r.type==="table")return!0},normalizeNode:r=>{let[n]=r;if(!Wg.isElement(n))return!1;switch(n.type){case"table":return ro(e,r);case"table-cell":return Bm(e,r)}return!1}},editableProps:{renderElement:ac,onKeyDown:D({tab:e.tablePlugin.tabForward,"shift+tab":e.tablePlugin.tabBackward,"shift+enter":e.tablePlugin.shiftEnterForward,down:e.tablePlugin.down,up:e.tablePlugin.up,"mod+a":e.tablePlugin.selectCell,"super+t":()=>e.tablePlugin.insertTable(3,2),"mod+shift+enter":()=>e.tablePlugin.insertRow({offset:0}),"mod+enter":()=>e.tablePlugin.insertRow({offset:1}),"super+[":()=>e.tablePlugin.insertColumn({offset:0}),"super+]":()=>e.tablePlugin.insertColumn({offset:1}),"super+backspace":e.tablePlugin.removeTable,"mod+backspace":e.tablePlugin.removeRow,"mod+shift+backspace":e.tablePlugin.removeColumn})}})));import{Global as jg}from"@emotion/react";import{css as Gg}from"@emotion/react";var qg=`
1371
+ `;import{jsx as nc}from"react/jsx-runtime";function ic(){return nc(oc,{contentEditable:!1,children:nc(rc,{className:"--table-menu-tile"})})}import{jsx as Er,jsxs as jg}from"react/jsx-runtime";function ac({element:e,attributes:t,children:o}){let r=Qg(so),n=Xg(),i=r.isSelected&&e.x===0&&e.y===0,a=r.isSelected&&e.x===0,l=r.isSelected&&e.y===0;return jg(Wm,{className:n?"--selected":"",...t,"data-x":e.x,"data-y":e.y,children:[o,i?Er(ic,{}):null,a?Er(ec,{cellElement:e}):null,l?Er(Jm,{cellElement:e}):null]})}import{jsx as Yg}from"react/jsx-runtime";function lc({attributes:e,children:t}){return Yg(Gm,{...e,children:t})}import{jsx as Jg}from"react/jsx-runtime";function sc({attributes:e,children:t}){return Jg(Km,{...e,children:t})}import{jsx as po}from"react/jsx-runtime";function mc({element:e,attributes:t,children:o}){switch(e.type){case"table":return po(qm,{element:e,attributes:t,children:o});case"table-row":return po(sc,{element:e,attributes:t,children:o});case"table-cell":return po(ac,{element:e,attributes:t,children:o});case"table-content":return po(lc,{element:e,attributes:t,children:o})}}var cc=y((e,t,{createPolicy:o})=>(e.supportsTable=!0,e.tablePlugin=Dm(e),o({name:"table",editor:{deleteBackward:()=>Ie(e,"table-cell"),deleteForward:()=>li(e,"table-cell"),deleteFragment:()=>fm(e,["table-cell"]),insertBreak:()=>E(e,"table-cell")?(e.insertText(`
1372
+ `),!0):!1,isMaster(r){if(r.type==="table")return!0},normalizeNode:r=>{let[n]=r;if(!Zg.isElement(n))return!1;switch(n.type){case"table":return io(e,r);case"table-cell":return Nm(e,r)}return!1}},editableProps:{renderElement:mc,onKeyDown:D({tab:e.tablePlugin.tabForward,"shift+tab":e.tablePlugin.tabBackward,"shift+enter":e.tablePlugin.shiftEnterForward,down:e.tablePlugin.down,up:e.tablePlugin.up,"mod+a":e.tablePlugin.selectCell,"super+t":()=>e.tablePlugin.insertTable(3,2),"mod+shift+enter":()=>e.tablePlugin.insertRow({offset:0}),"mod+enter":()=>e.tablePlugin.insertRow({offset:1}),"super+[":()=>e.tablePlugin.insertColumn({offset:0}),"super+]":()=>e.tablePlugin.insertColumn({offset:1}),"super+backspace":e.tablePlugin.removeTable,"mod+backspace":e.tablePlugin.removeRow,"mod+shift+backspace":e.tablePlugin.removeColumn})}})));import{Global as rb}from"@emotion/react";import{css as eb}from"@emotion/react";var tb=`
1373
1373
  --blue-50: rgb(239 246 255);
1374
1374
  --blue-100: rgb(219 234 254);
1375
1375
  --blue-200: rgb(191 219 254);
@@ -1380,7 +1380,7 @@
1380
1380
  --blue-700: rgb(29 78 216);
1381
1381
  --blue-800: rgb(30 64 175);
1382
1382
  --blue-900: rgb(30 58 138);
1383
- `,Qg=`
1383
+ `,ob=`
1384
1384
  --shade-50: rgb(250 250 250);
1385
1385
  --shade-100: rgb(244 244 245);
1386
1386
  --shade-200: rgb(228 228 231);
@@ -1391,11 +1391,11 @@
1391
1391
  --shade-700: rgb(63 63 70);
1392
1392
  --shade-800: rgb(39 39 42);
1393
1393
  --shade-900: rgb(24 24 27);
1394
- `,sc=Gg`
1394
+ `,pc=eb`
1395
1395
  :root {
1396
1396
  /* Tailwind Colors */
1397
- ${qg}
1398
- ${Qg}
1397
+ ${tb}
1398
+ ${ob}
1399
1399
  /* Select Colors */
1400
1400
  --select-color: var(--blue-400);
1401
1401
  --select-editor-color: var(--blue-200);
@@ -1417,14 +1417,14 @@
1417
1417
  /* Horizontal Rule Colors */
1418
1418
  --hr-color: var(--shade-300);
1419
1419
  }
1420
- `;import{Fragment as Xg,jsx as mc,jsxs as Yg}from"react/jsx-runtime";var cc=y(e=>(e.theme=!0,{name:"theme",editor:{},renderEditable:({attributes:t,Editable:o})=>Yg(Xg,{children:[mc(jg,{styles:sc}),mc(o,{...t})]}),editableProps:{}}));import{clsx as $b}from"clsx";import{useCallback as Hb,useRef as Ab}from"react";import{Editor as Ob,Transforms as Ub}from"slate";import{ReactEditor as Fb,useFocused as Vb,useSlateStatic as Kb}from"slate-react";import{clsx as Jg}from"clsx";import{useCallback as fc,useRef as Zg,useState as eb}from"react";import{ReactEditor as tb,useSlateStatic as ob}from"slate-react";import br from"@emotion/styled";var pc=br(X)`
1420
+ `;import{Fragment as nb,jsx as dc,jsxs as ib}from"react/jsx-runtime";var uc=y(e=>(e.theme=!0,{name:"theme",editor:{},renderEditable:({attributes:t,Editable:o})=>ib(nb,{children:[dc(rb,{styles:pc}),dc(o,{...t})]}),editableProps:{}}));import{clsx as Kb}from"clsx";import{useCallback as Wb,useRef as Gb}from"react";import{Editor as qb,Transforms as Qb}from"slate";import{ReactEditor as Xb,useFocused as jb,useSlateStatic as Yb}from"slate-react";import{clsx as ab}from"clsx";import{useCallback as bc,useRef as lb,useState as sb}from"react";import{ReactEditor as mb,useSlateStatic as cb}from"slate-react";import xr from"@emotion/styled";var fc=xr(j)`
1421
1421
  padding: 0.5em;
1422
- `,dc=br("div")`
1422
+ `,hc=xr("div")`
1423
1423
  display: grid;
1424
1424
  grid-template-columns: repeat(5, 1.75em);
1425
1425
  grid-template-rows: 1.5em;
1426
1426
  /* grid-gap: 1px; */
1427
- `,uc=br("div")`
1427
+ `,gc=xr("div")`
1428
1428
  background: var(--shade-100);
1429
1429
  height: 1.5em;
1430
1430
  border-radius: 0.125em;
@@ -1434,11 +1434,11 @@
1434
1434
  &.--selected {
1435
1435
  background: var(--blue-100);
1436
1436
  }
1437
- `;import{Fragment as rb,jsx as co,jsxs as nb}from"react/jsx-runtime";function hc(e){return[...Array(e).keys()]}function gc({dest:e,close:t}){let[o,r]=eb({x:0,y:0}),n=ob(),i=Zg(null),a=j({src:i,dest:e},({dest:d})=>({left:d.left-8,top:d.top+d.height})),l=hc(5).map(d=>d+1),s=hc(5).map(d=>d+1),m=fc((d,p)=>{r({x:d,y:p})},[r]),c=fc((d,p)=>{n.tablePlugin.insertTable(d,p),tb.focus(n),t()},[n]);return nb(rb,{children:[co(be,{close:t}),co(pc,{ref:i,style:a,children:co(dc,{onMouseLeave:()=>m(0,0),children:l.map(d=>s.map(p=>{let b=p<=o.x&&d<=o.y;return co(uc,{className:Jg({"--selected":b}),onMouseEnter:()=>m(p,d),onClick:()=>c(p,d)},`${p},${d}`)}))})})]})}import Pb from"lodash.throttle";import{useEffect as Cb,useRef as Sb,useState as Rb}from"react";import{useSlateStatic as Lb}from"slate-react";import{jsx as h,jsxs as Ye}from"react/jsx-runtime";var bc=()=>h(x,{children:h("path",{d:"M7 12h10M7 5v14M17 5v14M15 19h4M15 5h4M5 19h4M5 5h4"})}),Ec=()=>h(x,{className:"--more-icon",width:"0.5em",viewBox:"0 0 12 24",children:h("path",{d:"m2 12 4 4 4-4"})}),xc=()=>h(x,{width:"0.5em",viewBox:"6 0 12 24",children:h("path",{d:"M9 12h6M12 9v6"})}),yc=()=>h(x,{children:h("path",{d:"M19 18v-8l-2 2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})}),kc=()=>h(x,{children:h("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"})}),vc=()=>h(x,{children:h("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 Tc=()=>h(x,{children:h("path",{d:"M8 18V6h2l6 9V6h2v12h-2l-6-9v9H8z"})}),Er=()=>h(x,{children:h("path",{d:"M7 5h6a3.5 3.5 0 0 1 0 7H7zM13 12h1a3.5 3.5 0 0 1 0 7H7v-7"})}),wc=()=>h(x,{children:h("path",{d:"M11 5h6M7 19h6M14 5l-4 14"})});var po=()=>Ye(x,{children:[h("path",{d:"M10 14a3.5 3.5 0 0 0 5 0l4-4a3.5 3.5 0 0 0-5-5l-.5.5"}),h("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 xr=()=>h(x,{children:h("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"})}),Ic=()=>Ye(x,{children:[h("path",{d:"M10 9l4 3-4 3"}),h("path",{d:"M16 9l4 3-4 3"})]});var Mc=()=>h(x,{children:h("path",{d:"M9 6h11M9 12h11M9 18h11M5 6v.01M5 12v.01M5 18v.01"})}),Pc=()=>Ye(x,{children:[h("rect",{x:4,y:4,width:16,height:16,rx:2}),h("path",{d:"M4 10h16M10 4v16"})]}),Cc=()=>h(x,{children:h("path",{d:"m7 8-4 4 4 4M17 8l4 4-4 4M14 4l-4 16"})}),Sc=()=>h(x,{children:h("path",{d:"M9 8L5 12L9 16M15 8L19 12L15 16"})}),Rc=()=>Ye(x,{children:[h("path",{d:"M15 8h.01"}),h("rect",{x:4,y:4,width:16,height:16,rx:3}),h("path",{d:"m4 15 4-4a3 5 0 0 1 3 0l5 5"}),h("path",{d:"m14 14 1-1a3 5 0 0 1 3 0l2 2"})]});var Lc=()=>h(x,{children:h("path",{d:"M12 5v14M5 12h14"})}),Bc=()=>h(x,{children:h("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"})}),zc=()=>h(x,{children:h("path",{d:"M7 5v5a5 5 0 0 0 10 0V5M5 19h14"})});var Dc=()=>Ye(x,{children:[h("path",{d:"m9 11 3 3 8-8"}),h("path",{d:"M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9"})]}),yr=()=>h(x,{children:h("path",{d:"M11 6h9M11 12h9M12 18h8M4 16a2 2 0 1 1 4 0c0 .591-.5 1-1 1.5L4 20h4M6 10V4L4 6"})}),Nc=()=>h(x,{children:h("path",{d:"M4 6h16M8 12h12M12 18h8M7 12l-3-3M7 12l-3 3"})}),$c=()=>h(x,{children:h("path",{d:"M4 6h16M8 12h12M12 18h8M4 12l3-3M4 12l3 3"})});var Hc=()=>h(x,{children:h("path",{d:"M18 6L6 18M6 6l12 12"})}),Ac=()=>Ye(x,{children:[h("path",{d:"M4 20h4l10.5-10.5a2.828 2.828 0 1 0-4-4L4 16v4"}),h("path",{d:"M13.5 6.5l4 4"}),h("path",{d:"m14 19 6-6M18 15l2 2M5 21h4"})]}),Oc=()=>h(x,{children:h("path",{d:"M5 12h14"})});var kr=[{icon:Nc,title:f("increaseDepth"),hotkey:"tab",action:e=>e.list.increaseDepth(),active:e=>e.list.canIncreaseDepth()},{icon:$c,title:f("decreaseDepth"),hotkey:"shift+tab",action:e=>e.list.decreaseDepth(),active:e=>e.list.canDecreaseDepth()}],Uc=[{icon:Tc,title:f("normal"),hotkey:"super+0",action:e=>{e.collapsibleParagraph.convertParagraph()}},{icon:yc,title:f("heading1"),hotkey:"super+1",action:e=>e.heading.convertHeading(1,!0),active:e=>e.heading.isHeadingActive(1)},{icon:kc,title:f("heading2"),hotkey:"super+2",action:e=>e.heading.convertHeading(2,!0),active:e=>e.heading.isHeadingActive(2)},{icon:vc,title:f("heading3"),hotkey:"super+3",action:e=>e.heading.convertHeading(3,!0),active:e=>e.heading.isHeadingActive(3)}],Fc=[...Uc],vr=[{icon:bc,title:f("paragraphStyle"),more:!0,children:Uc}];import{useState as pe,useRef as Kc,useEffect as ab,useCallback as Tr}from"react";import{useSlateStatic as lb}from"slate-react";import ib from"@emotion/styled";var Vc=ib(X)`
1437
+ `;import{Fragment as pb,jsx as uo,jsxs as db}from"react/jsx-runtime";function Ec(e){return[...Array(e).keys()]}function xc({dest:e,close:t}){let[o,r]=sb({x:0,y:0}),n=cb(),i=lb(null),a=X({src:i,dest:e},({dest:d})=>d?{left:d.left-8,top:d.top+d.height}:{left:0,top:0}),l=Ec(5).map(d=>d+1),s=Ec(5).map(d=>d+1),m=bc((d,p)=>{r({x:d,y:p})},[r]),c=bc((d,p)=>{n.tablePlugin.insertTable(d,p),mb.focus(n),t()},[n]);return db(pb,{children:[uo(Ee,{close:t}),uo(fc,{ref:i,style:a,children:uo(hc,{onMouseLeave:()=>m(0,0),children:l.map(d=>s.map(p=>{let g=p<=o.x&&d<=o.y;return uo(gc,{className:ab({"--selected":g}),onMouseEnter:()=>m(p,d),onClick:()=>c(p,d)},`${p},${d}`)}))})})]})}import Nb from"lodash.throttle";import{useEffect as $b,useRef as Hb,useState as Ab}from"react";import{useSlateStatic as Ob}from"slate-react";import{jsx as h,jsxs as Je}from"react/jsx-runtime";var yc=()=>h(x,{children:h("path",{d:"M7 12h10M7 5v14M17 5v14M15 19h4M15 5h4M5 19h4M5 5h4"})}),kc=()=>h(x,{className:"--more-icon",width:"0.5em",viewBox:"0 0 12 24",children:h("path",{d:"m2 12 4 4 4-4"})}),Tc=()=>h(x,{width:"0.5em",viewBox:"6 0 12 24",children:h("path",{d:"M9 12h6M12 9v6"})}),vc=()=>h(x,{children:h("path",{d:"M19 18v-8l-2 2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})}),wc=()=>h(x,{children:h("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"})}),Ic=()=>h(x,{children:h("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 Mc=()=>h(x,{children:h("path",{d:"M8 18V6h2l6 9V6h2v12h-2l-6-9v9H8z"})}),yr=()=>h(x,{children:h("path",{d:"M7 5h6a3.5 3.5 0 0 1 0 7H7zM13 12h1a3.5 3.5 0 0 1 0 7H7v-7"})}),Pc=()=>h(x,{children:h("path",{d:"M11 5h6M7 19h6M14 5l-4 14"})});var fo=()=>Je(x,{children:[h("path",{d:"M10 14a3.5 3.5 0 0 0 5 0l4-4a3.5 3.5 0 0 0-5-5l-.5.5"}),h("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 kr=()=>h(x,{children:h("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"})}),Cc=()=>Je(x,{children:[h("path",{d:"M10 9l4 3-4 3"}),h("path",{d:"M16 9l4 3-4 3"})]});var Sc=()=>h(x,{children:h("path",{d:"M9 6h11M9 12h11M9 18h11M5 6v.01M5 12v.01M5 18v.01"})}),Rc=()=>Je(x,{children:[h("rect",{x:4,y:4,width:16,height:16,rx:2}),h("path",{d:"M4 10h16M10 4v16"})]}),Lc=()=>h(x,{children:h("path",{d:"m7 8-4 4 4 4M17 8l4 4-4 4M14 4l-4 16"})}),Bc=()=>h(x,{children:h("path",{d:"M9 8L5 12L9 16M15 8L19 12L15 16"})}),zc=()=>Je(x,{children:[h("path",{d:"M15 8h.01"}),h("rect",{x:4,y:4,width:16,height:16,rx:3}),h("path",{d:"m4 15 4-4a3 5 0 0 1 3 0l5 5"}),h("path",{d:"m14 14 1-1a3 5 0 0 1 3 0l2 2"})]});var Dc=()=>h(x,{children:h("path",{d:"M12 5v14M5 12h14"})}),Nc=()=>h(x,{children:h("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"})}),$c=()=>h(x,{children:h("path",{d:"M7 5v5a5 5 0 0 0 10 0V5M5 19h14"})});var Hc=()=>Je(x,{children:[h("path",{d:"m9 11 3 3 8-8"}),h("path",{d:"M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9"})]}),Tr=()=>h(x,{children:h("path",{d:"M11 6h9M11 12h9M12 18h8M4 16a2 2 0 1 1 4 0c0 .591-.5 1-1 1.5L4 20h4M6 10V4L4 6"})}),Ac=()=>h(x,{children:h("path",{d:"M4 6h16M8 12h12M12 18h8M7 12l-3-3M7 12l-3 3"})}),Oc=()=>h(x,{children:h("path",{d:"M4 6h16M8 12h12M12 18h8M4 12l3-3M4 12l3 3"})});var Uc=()=>h(x,{children:h("path",{d:"M18 6L6 18M6 6l12 12"})}),_c=()=>Je(x,{children:[h("path",{d:"M4 20h4l10.5-10.5a2.828 2.828 0 1 0-4-4L4 16v4"}),h("path",{d:"M13.5 6.5l4 4"}),h("path",{d:"m14 19 6-6M18 15l2 2M5 21h4"})]}),Fc=()=>h(x,{children:h("path",{d:"M5 12h14"})});var vr=[{icon:Ac,title:f("increaseDepth"),hotkey:"tab",action:e=>e.list.increaseDepth(),active:e=>e.list.canIncreaseDepth()},{icon:Oc,title:f("decreaseDepth"),hotkey:"shift+tab",action:e=>e.list.decreaseDepth(),active:e=>e.list.canDecreaseDepth()}],Vc=[{icon:Mc,title:f("normal"),hotkey:"super+0",action:e=>{e.collapsibleParagraph.convertParagraph()}},{icon:vc,title:f("heading1"),hotkey:"super+1",action:e=>e.heading.convertHeading(1,!0),active:e=>e.heading.isHeadingActive(1)},{icon:wc,title:f("heading2"),hotkey:"super+2",action:e=>e.heading.convertHeading(2,!0),active:e=>e.heading.isHeadingActive(2)},{icon:Ic,title:f("heading3"),hotkey:"super+3",action:e=>e.heading.convertHeading(3,!0),active:e=>e.heading.isHeadingActive(3)}],Kc=[...Vc],wr=[{icon:yc,title:f("paragraphStyle"),more:!0,children:Vc}];import{useState as pe,useRef as Gc,useEffect as fb,useCallback as Ir}from"react";import{useSlateStatic as hb}from"slate-react";import ub from"@emotion/styled";var Wc=ub(j)`
1438
1438
  width: 18em;
1439
1439
  padding: 0;
1440
1440
  overflow: hidden;
1441
- `;import{Fragment as sb,jsx as U,jsxs as Q}from"react/jsx-runtime";function _c({dest:e,close:t}){let o=lb(),r=Kc(void 0),n=Kc(null),[i,a]=pe({x:0,y:0}),l=Tr(($,O)=>{a(de=>({x:de.x+$,y:de.y+O}))},[]),s=o.wysimark?.imageDialogState,m=!!o.wysimark?.onImageChange,[c,d]=pe(s?.url??""),[p,b]=pe(s?.alt??""),[g,v]=pe(s?.title??""),[C,P]=pe(!1),[w,S]=pe(s?.imageSource??(m?"file":"url")),[M,N]=pe(!1),[T,I]=pe(s?.uploadedUrl??""),[k,z]=pe(""),ve=Tr($=>{let O=$.target.value;b(O),C||v(O)},[C]),kp=Tr($=>{v($.target.value),P(!0)},[]);ab(()=>{o.wysimark&&(o.wysimark.imageDialogState={url:c,alt:p,title:g,imageSource:w,uploadedUrl:T})},[c,p,g,w,T]);let zr=()=>{o.wysimark&&(o.wysimark.imageDialogState=void 0)},bo=j({src:r,dest:e},({src:$,dest:O},de)=>Dt($,de,{left:O.left-16,top:O.top+O.height},{margin:16})),vp={...bo,left:bo.left+i.x,top:bo.top+i.y};function Tp($){$.preventDefault();let O=w==="file"?T:c;O.trim()!==""&&(o.image.insertImageFromUrl(O,p,g),zr(),t())}function wp(){zr(),t()}async function Ip($){let O=$.target.files?.[0];if(!(!O||!o.wysimark?.onImageChange)){z(O.name),N(!0);try{let de=await o.wysimark.onImageChange(O);I(de)}catch(de){console.error("Failed to upload image:",de)}finally{N(!1)}}}function Mp(){n.current?.click()}let Eo=w==="file"?T.trim()===""||M:c.trim()==="";return Q(sb,{children:[U(be,{close:t}),Q(Vc,{ref:r,style:vp,children:[U(xe,{onDrag:l}),Q("form",{onSubmit:$=>void Tp($),style:{padding:"8px"},children:[m&&Q("div",{style:{marginBottom:"12px"},children:[Q("label",{style:{display:"inline-flex",alignItems:"center",marginRight:"16px",cursor:"pointer"},children:[U("input",{type:"radio",name:"imageSource",value:"file",checked:w==="file",onChange:()=>S("file"),style:{marginRight:"4px"}}),f("imageSourceFile")]}),Q("label",{style:{display:"inline-flex",alignItems:"center",cursor:"pointer"},children:[U("input",{type:"radio",name:"imageSource",value:"url",checked:w==="url",onChange:()=>S("url"),style:{marginRight:"4px"}}),f("imageSourceUrl")]})]}),w==="url"?Q("div",{style:{marginBottom:"8px"},children:[U("label",{style:{display:"block",marginBottom:"4px"},children:f("imageUrlRequired")}),U("input",{type:"text",value:c,onChange:$=>d($.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"})]}):Q("div",{style:{marginBottom:"8px"},children:[U("input",{ref:n,type:"file",accept:"image/*",onChange:$=>void Ip($),style:{display:"none"}}),U("button",{type:"button",onClick:Mp,disabled:M,style:{padding:"8px 16px",backgroundColor:M?"#ccc":"#0078d4",color:M?"#666":"white",border:"none",borderRadius:"4px",cursor:M?"not-allowed":"pointer",marginBottom:"8px",fontWeight:"bold"},children:M?f("uploading"):f("selectFile")}),T&&Q("div",{style:{marginTop:"8px",padding:"8px",backgroundColor:"var(--shade-100)",borderRadius:"4px"},children:[Q("div",{style:{color:"green",marginBottom:"4px"},children:["\u2713 ",f("uploadComplete")]}),k&&U("div",{style:{fontSize:"12px",color:"var(--shade-500)"},children:k})]})]}),Q("div",{style:{marginBottom:"8px"},children:[U("label",{style:{display:"block",marginBottom:"4px"},children:f("altText")}),U("input",{type:"text",value:p,onChange:ve,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:f("imageDescription")})]}),Q("div",{style:{marginBottom:"8px"},children:[U("label",{style:{display:"block",marginBottom:"4px"},children:f("title")}),U("input",{type:"text",value:g,onChange:kp,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:f("imageTitle")})]}),Q("div",{style:{display:"flex",gap:"8px"},children:[U("button",{type:"submit",disabled:Eo,style:{display:"flex",alignItems:"center",padding:"8px 16px",backgroundColor:Eo?"#ccc":"#0078d4",color:"white",border:"none",borderRadius:"4px",cursor:Eo?"not-allowed":"pointer",fontWeight:"bold"},children:f("register")}),U("button",{type:"button",onClick:wp,style:{padding:"8px 16px",backgroundColor:"var(--shade-100)",color:"var(--shade-700)",border:"1px solid var(--shade-300)",borderRadius:"4px",cursor:"pointer"},children:f("cancel")})]})]})]})]})}import{isHotkey as mb}from"is-hotkey";import{useCallback as uo,useMemo as cb,useRef as pb,useState as Et}from"react";import{Editor as db,Range as ub}from"slate";import{ReactEditor as fb,useSlateStatic as hb}from"slate-react";import Wc from"@emotion/styled";var wr=Wc("div")`
1441
+ `;import{Fragment as gb,jsx as U,jsxs as Q}from"react/jsx-runtime";function qc({dest:e,close:t}){let o=hb(),r=Gc(null),n=Gc(null),[i,a]=pe({x:0,y:0}),l=Ir(($,O)=>{a(ue=>({x:ue.x+$,y:ue.y+O}))},[]),s=o.wysimark?.imageDialogState,m=!!o.wysimark?.onImageChange,[c,d]=pe(s?.url??""),[p,g]=pe(s?.alt??""),[b,k]=pe(s?.title??""),[S,I]=pe(!1),[w,R]=pe(s?.imageSource??(m?"file":"url")),[M,N]=pe(!1),[v,T]=pe(s?.uploadedUrl??""),[C,P]=pe(""),de=Ir($=>{let O=$.target.value;g(O),S||k(O)},[S]),ve=Ir($=>{k($.target.value),I(!0)},[]);fb(()=>{o.wysimark&&(o.wysimark.imageDialogState={url:c,alt:p,title:b,imageSource:w,uploadedUrl:v})},[c,p,b,w,v]);let Nr=()=>{o.wysimark&&(o.wysimark.imageDialogState=void 0)},Eo=X({src:r,dest:e},({src:$,dest:O},ue)=>$t($,ue,{left:O.left-16,top:O.top+O.height},{margin:16})),wp={...Eo,left:Eo.left+i.x,top:Eo.top+i.y};function Ip($){$.preventDefault();let O=w==="file"?v:c;O.trim()!==""&&(o.image.insertImageFromUrl(O,p,b),Nr(),t())}function Mp(){Nr(),t()}async function Pp($){let O=$.target.files?.[0];if(!(!O||!o.wysimark?.onImageChange)){P(O.name),N(!0);try{let ue=await o.wysimark.onImageChange(O);T(ue)}catch(ue){}finally{N(!1)}}}function Cp(){n.current?.click()}let xo=w==="file"?v.trim()===""||M:c.trim()==="";return Q(gb,{children:[U(Ee,{close:t}),Q(Wc,{ref:r,style:wp,children:[U(ye,{onDrag:l}),Q("form",{onSubmit:$=>void Ip($),style:{padding:"8px"},children:[m&&Q("div",{style:{marginBottom:"12px"},children:[Q("label",{style:{display:"inline-flex",alignItems:"center",marginRight:"16px",cursor:"pointer"},children:[U("input",{type:"radio",name:"imageSource",value:"file",checked:w==="file",onChange:()=>R("file"),style:{marginRight:"4px"}}),f("imageSourceFile")]}),Q("label",{style:{display:"inline-flex",alignItems:"center",cursor:"pointer"},children:[U("input",{type:"radio",name:"imageSource",value:"url",checked:w==="url",onChange:()=>R("url"),style:{marginRight:"4px"}}),f("imageSourceUrl")]})]}),w==="url"?Q("div",{style:{marginBottom:"8px"},children:[U("label",{style:{display:"block",marginBottom:"4px"},children:f("imageUrlRequired")}),U("input",{type:"text",value:c,onChange:$=>d($.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"})]}):Q("div",{style:{marginBottom:"8px"},children:[U("input",{ref:n,type:"file",accept:"image/*",onChange:$=>void Pp($),style:{display:"none"}}),U("button",{type:"button",onClick:Cp,disabled:M,style:{padding:"8px 16px",backgroundColor:M?"#ccc":"#0078d4",color:M?"#666":"white",border:"none",borderRadius:"4px",cursor:M?"not-allowed":"pointer",marginBottom:"8px",fontWeight:"bold"},children:M?f("uploading"):f("selectFile")}),v&&Q("div",{style:{marginTop:"8px",padding:"8px",backgroundColor:"var(--shade-100)",borderRadius:"4px"},children:[Q("div",{style:{color:"green",marginBottom:"4px"},children:["\u2713 ",f("uploadComplete")]}),C&&U("div",{style:{fontSize:"12px",color:"var(--shade-500)"},children:C})]})]}),Q("div",{style:{marginBottom:"8px"},children:[U("label",{style:{display:"block",marginBottom:"4px"},children:f("altText")}),U("input",{type:"text",value:p,onChange:de,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:f("imageDescription")})]}),Q("div",{style:{marginBottom:"8px"},children:[U("label",{style:{display:"block",marginBottom:"4px"},children:f("title")}),U("input",{type:"text",value:b,onChange:ve,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:f("imageTitle")})]}),Q("div",{style:{display:"flex",gap:"8px"},children:[U("button",{type:"submit",disabled:xo,style:{display:"flex",alignItems:"center",padding:"8px 16px",backgroundColor:xo?"#ccc":"#0078d4",color:"white",border:"none",borderRadius:"4px",cursor:xo?"not-allowed":"pointer",fontWeight:"bold"},children:f("register")}),U("button",{type:"button",onClick:Mp,style:{padding:"8px 16px",backgroundColor:"var(--shade-100)",color:"var(--shade-700)",border:"1px solid var(--shade-300)",borderRadius:"4px",cursor:"pointer"},children:f("cancel")})]})]})]})]})}import{isHotkey as bb}from"is-hotkey";import{useCallback as ho,useMemo as Eb,useRef as xb,useState as xt}from"react";import{Editor as yb,Range as kb}from"slate";import{ReactEditor as Tb,useSlateStatic as vb}from"slate-react";import Qc from"@emotion/styled";var Mr=Qc("div")`
1442
1442
  /* Center vertically and horizontally */
1443
1443
  display: flex;
1444
1444
  align-items: center;
@@ -1462,9 +1462,9 @@
1462
1462
  font-size: 1.25em;
1463
1463
  stroke-width: 2px;
1464
1464
  }
1465
- `,Gc=Wc("div")`
1465
+ `,Xc=Qc("div")`
1466
1466
  font-size: 0.875em;
1467
1467
  margin-top: 0.5em;
1468
1468
  color: var(--shade-500);
1469
1469
  line-height: 1.375;
1470
- `;import{Fragment as bb,jsx as ee,jsxs as xt}from"react/jsx-runtime";var gb=mb("enter");function qc({dest:e,close:t}){let o=hb(),r=pb(null),[n,i]=Et({x:0,y:0}),a=uo((I,k)=>{i(z=>({x:z.x+I,y:z.y+k}))},[]),l=j({src:r,dest:e},({src:I,dest:k},z)=>Dt(I,z,{left:k.left-12,top:k.top+k.height},{margin:16})),s={...l,left:l.left+n.x,top:l.top+n.y},m=cb(()=>{let{selection:I}=o;return I&&!ub.isCollapsed(I)?db.string(o,I):""},[]),[c,d]=Et(""),[p,b]=Et(m),[g,v]=Et(m),[C,P]=Et(!1),w=()=>{let I=p.trim()||c,k=g.trim()||void 0;o.anchor.insertLink(c,I,{select:!0,title:k}),fb.focus(o),t()},S=uo(I=>{d(I.currentTarget.value)},[d]),M=uo(I=>{let k=I.currentTarget.value;b(k),C||v(k)},[b,v,C]),N=uo(I=>{v(I.currentTarget.value),P(!0)},[v]),T=I=>{gb(I)&&(I.preventDefault(),I.stopPropagation(),w())};return xt(bb,{children:[ee(be,{close:t}),xt(Ni,{ref:r,style:s,children:[ee(xe,{onDrag:a}),xt("div",{style:{padding:"0.75em"},children:[ee(Nt,{children:ee($t,{type:"text",value:c,autoFocus:!0,placeholder:f("linkUrl"),onChange:S,onKeyDown:T})}),ee(Nt,{style:{marginTop:"0.5em"},children:ee($t,{type:"text",value:p,placeholder:f("linkText"),onChange:M,onKeyDown:T})}),xt(Nt,{style:{marginTop:"0.5em"},children:[ee($t,{type:"text",value:g,placeholder:f("tooltipText"),onChange:N,onKeyDown:T}),xt(wr,{onClick:w,children:[ee(po,{}),ee(xc,{})]}),ee(wr,{onClick:t,style:{marginLeft:"0.25em",background:"var(--shade-400)"},children:ee(Hc,{})})]}),ee(Gc,{children:f("tooltipHint")})]})]})]})}var Ir=[{icon:po,title:f("insertLink"),more:!0,hotkey:"mod+k",Component:qc},{icon:Rc,title:f("insertImageFromUrl"),more:!0,Component:_c},{icon:Pc,title:f("insertTable"),more:!0,Component:gc},{icon:Oc,title:f("horizontalRule"),hotkey:"super+-",action:e=>e.horizontalRule.insertHorizontalRule()}],Qc=Ir,jc=Ir,Xc=[{icon:Lc,title:f("insert"),more:!0,children:Ir}];import{Editor as Eb}from"slate";function Je(e){let t=Eb.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 Yc=[{icon:Er,title:f("bold"),hotkey:"mod+b",action:e=>e.marksPlugin.toggleBold(),active:e=>Je(e).bold},{icon:wc,title:f("italic"),hotkey:"mod+i",action:e=>e.marksPlugin.toggleItalic(),active:e=>Je(e).italic},{icon:Bc,title:f("strike"),hotkey:"super+k",action:e=>e.marksPlugin.toggleStrike(),active:e=>Je(e).strike},{icon:Cc,title:f("inlineCode"),hotkey:"mod+j",action:e=>e.inlineCode.toggleInlineCode(),active:e=>Je(e).code},{icon:zc,title:f("underline"),hotkey:"mod+u",action:e=>e.marksPlugin.toggleUnderline(),active:e=>Je(e).underline},{icon:Ac,title:f("highlight"),hotkey:"mod+h",action:e=>e.marksPlugin.toggleHighlight(),active:e=>Je(e).highlight,show:e=>!e.wysimark.disableHighlight}],Mr=Yc,Jc=[{icon:Er,title:f("format"),more:!0,children:Yc}];var Zc=[{icon:Mc,title:f("bulletList"),hotkey:"super+8",action:e=>e.list.convertUnorderedList(!0)},{icon:yr,title:f("numberedList"),hotkey:"super+7",action:e=>e.list.convertOrderedList(!0)},{icon:Dc,title:f("checkList"),hotkey:"super+9",action:e=>e.list.convertTaskList(!0),show:e=>!e.wysimark.disableTaskList}],Pr=[...Zc,"divider",...kr],ep=[{icon:yr,title:f("list"),more:!0,children:[...Zc,"divider",...kr]}];import{Editor as tp,Transforms as fo}from"slate";var op=[{icon:xr,title:f("quote"),hotkey:"super+.",action:e=>{e.blockQuotePlugin.isActive()?e.blockQuotePlugin.outdent():e.blockQuotePlugin.indent()},active:e=>e.blockQuotePlugin.isActive()},{icon:Ic,title:f("increaseQuoteDepth"),action:e=>e.blockQuotePlugin.increaseDepth(),active:e=>e.blockQuotePlugin.canIncreaseDepth()},{icon:Sc,title:f("codeBlock"),action:e=>{let{selection:t}=e,o=E(e,"code-block");if(o){let[,r]=o,n=tp.string(e,r);fo.removeNodes(e,{at:r}),fo.insertNodes(e,{type:"paragraph",children:[{text:n}]},{at:r});return}if(t&&JSON.stringify(t.anchor.path)!==JSON.stringify(t.focus.path)){e.codeBlock.createCodeBlock({language:"text"});return}if(t&&(t.anchor.offset!==t.focus.offset||JSON.stringify(t.anchor.path)!==JSON.stringify(t.focus.path))){let r=tp.string(e,t);fo.delete(e),fo.insertNodes(e,{type:"code-block",language:"text",children:[{type:"code-block-line",children:[{text:r}]}]});return}e.codeBlock.createCodeBlock({language:"text"})},active:e=>!!E(e,"code-block"),show:e=>!e.wysimark.disableCodeBlock}],Cr=op,rp=[{icon:xr,title:f("quote"),more:!0,children:op}];var xb=[...Fc,"divider",...Pr,"divider",...Mr,"divider",...Qc,"divider",...Cr],yb=[...vr,"divider",...Pr,"divider",...Mr,"divider",...jc,"divider",...Cr],np=[...vr,"divider",...ep,"divider",...Jc,"divider",...Xc,"divider",...rp],ip=np;var Ze=[xb,yb,np];import{clsx as kb}from"clsx";import{useCallback as Sr,useRef as vb}from"react";import{ReactEditor as Tb,useSlate as wb,useSlateStatic as Ib}from"slate-react";import{jsx as ho,jsxs as Mb}from"react/jsx-runtime";function ap({item:e}){let t=Ib(),o=wb(),r=e.active?e.active(o):!1,n=vb(null),i=Y({title:e.title,hotkey:()=>e.hotkey?Bt(e.hotkey):void 0}),a=H("menu"),l=Sr(()=>{let c=n.current,d=e.children,p=e.Component;c&&(d?a.open(()=>ho(He,{dest:c,items:d,close:a.close})):p&&a.open(()=>ho(p,{dest:c,close:a.close})))},[e]),s=Sr(()=>{if(e.action){e.action(t),Tb.focus(t);return}a.layer?a.close():l()},[a.layer,e]),m=Sr(c=>{i.onMouseEnter(c),a.layer&&l()},[a.layer]);return Mb(qi,{"data-item-type":"button",ref:n,onMouseEnter:m,onMouseLeave:i.onMouseLeave,onClick:s,className:kb({"--active":r&&!Co(e?.title)?.includes("Depth"),"--more":e.more,"--disabled":!r&&Co(e?.title)?.includes("Depth")}),children:[ho(e.icon,{}),e.more?ho(Ec,{}):null]})}import{jsx as et}from"react/jsx-runtime";function Bb({item:e}){let t=Lb();return e==="divider"?et(Wi,{"data-item-type":"divider",children:et(Gi,{})}):(e.show===void 0?!0:e.show(t))?et(ap,{item:e}):null}function zb(e){let t=e.querySelector("[data-item-type=button]"),o=e.querySelector("[data-item-type=divider]");if(!t||!o)throw new Error("Button or divider not found");return{toolbar:e.offsetWidth,button:t.offsetWidth,divider:o.offsetWidth}}function Db(e,t,o){let r=0;for(let n of e)r+=n==="divider"?o:t;return r}var Nb=48;function lp(){let e=Sb(null),[t,o]=Rb(ip);return Cb(()=>{let r=Pb(()=>{let i=e.current;if(!i)throw new Error("Toolbar not found");let a=zb(i);for(let l=0;l<Ze.length-1;l++)if(Db(Ze[l],a.button,a.divider)<a.toolbar-Nb){o(Ze[l]);return}o(Ze[Ze.length-1])},100,{trailing:!0}),n=setTimeout(r,0);return window.addEventListener("resize",r),()=>{clearTimeout(n),window.removeEventListener("resize",r)}},[]),et(Ki,{ref:e,children:et(_i,{children:t.map((r,n)=>et(Bb,{item:r},typeof r=="string"?n:r.title))})})}import{jsx as Rr,jsxs as _b}from"react/jsx-runtime";function sp({attributes:e,Editable:t}){let o=Ab(null),r=Kb(),n=Vb(),i=Hb(a=>{a.target===a.currentTarget&&(Ub.select(r,Ob.end(r,[])),Fb.focus(r))},[r]);return Rr(Ci,{children:_b(Oi,{ref:o,className:$b({"--focused":n}),style:{height:r.toolbar.height,minHeight:r.toolbar.minHeight,maxHeight:r.toolbar.maxHeight},onClick:i,children:[Rr(lp,{}),Rr(t,{as:Ai,...e,style:{overflowY:"auto"}})]})})}var mp=y((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:sp,editableProps:{}}));import{Editor as Lr,Node as Wb,Path as Gb,Transforms as qb}from"slate";var cp=y(e=>(e.allowTrailingBlock=!0,{name:"trailing-block",editor:{normalizeNode:t=>{if(!Lr.isEditor(t[0]))return!1;let o=[e.children.length-1],r=Wb.child(e,e.children.length-1);return(Lr.hasBlocks(e,r)||Lr.isVoid(e,r))&&qb.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:Gb.next(o)}),!0}}}));import{Transforms as Qb}from"slate";function jb(e,t){let o=ue(t),r=he(o);Qb.insertNodes(e,r)}function pp(e){return{pasteMarkdown:u(jb,e)}}var dp=y(e=>(e.pasteMarkdown=pp(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),Te(t),!0}}}));import{jsx as Yb}from"react/jsx-runtime";function Xb(e){let t={...e.attributes,style:{...e.attributes.style,width:void 0,maxWidth:void 0}};return Yb("span",{...t,children:e.children})}var up=y((e,t,{createPolicy:o})=>(e.placeholder={},o({name:"placeholder",editableProps:{renderPlaceholder:Xb}})));var fp=[dp,is,ua,hs,nm,Is,ul,Hl,Kl,lc,ks,cp,Zs,ba,lm,Jl,cc,mp,cl,up];var Jb=Zn(fp),{withSink:hp,SinkEditable:gp}=Jb;import{useState as Zb}from"react";import{createEditor as eE,Editor as tE,Transforms as oE}from"slate";import{withHistory as rE}from"slate-history";import{withReact as nE}from"slate-react";function Br({authToken:e,height:t,minHeight:o,maxHeight:r,disableRawMode:n,disableTaskList:i,disableCodeBlock:a,disableHighlight:l}={}){let[s]=Zb(()=>{let m=eE(),c=hp(nE(rE(m)),{toolbar:{height:t,minHeight:o,maxHeight:r,showUploadButtons:!!e},image:{}});return c.convertElement.addConvertElementType("paragraph"),m.wysimark={disableRawMode:n??!0,disableTaskList:i,disableCodeBlock:a,disableHighlight:l??!0},m.getMarkdown=()=>it(m.children),m.setMarkdown=d=>{let p=ue(d),b=he(p);m.children=b,m.selection=null,oE.select(m,tE.start(m,[0]))},c});return s}import{jsx as te,jsxs as Ep}from"react/jsx-runtime";function cE({children:e,attributes:t}){return te("span",{...t,children:e})}function xp({editor:e,value:t,onChange:o,throttleInMs:r=1e3,placeholder:n,className:i,style:a,onImageChange:l}){let[s,m]=bp(!1),[c,d]=bp(t),p=go(!1),b=go(void 0),g=go(void 0),v=go(null),C=yt(iE(()=>{let k=it(e.children);e.wysimark.prevValue={markdown:k,children:e.children},o(k)},r,{leading:!1,trailing:!0}),[e,o,r]),P=yt(()=>{g.current!==e.children&&(g.current=e.children,C())},[C]);if(!s){let k=v.current??t;if(v.current!==null&&(v.current=null),e.wysimark.prevValue==null||b.current==null){p.current=!0;let z=ue(k),ve=he(z);e.children=ve,g.current=b.current=ve,e.wysimark.prevValue={markdown:k,children:ve}}else if(k!==e.wysimark.prevValue.markdown){p.current=!0;let z=ue(k),ve=he(z);e.children=ve,e.selection=null,lE.select(e,aE.start(e,[0]))}}let w=yt(()=>{navigator.userAgent.toLowerCase().includes("firefox")&&sE.focus(e)},[e]),S=yt(()=>{C.flush()},[C]),M=k=>{let z=k.target.value;d(z),o(z)},N=yt(()=>{let k=e.getMarkdown();d(k)},[e]),T=()=>{s?(v.current=c,e.wysimark.prevValue=void 0,b.current=void 0,g.current=void 0):N(),m(!s)};e.wysimark.onImageChange=l,e.wysimark.onChange=o;let I=e.wysimark.disableRawMode;return Ep("div",{style:{position:"relative"},children:[!I&&te("div",{style:{position:"absolute",top:"5px",right:"25px",zIndex:10},children:te("div",{onClick:T,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?f("switchToVisualEditor"):f("switchToRawMarkdown"),role:"button",tabIndex:0,onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(T(),k.preventDefault())},children:Ep("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[te("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"}),te("path",{d:"M7 15V9L10 12L13 9V15",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),te("path",{d:"M16 9H18V15",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),te("path",{d:"M16 12H18",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})}),te("div",{style:{display:s?"block":"none",textAlign:"center"},children:te("textarea",{value:tt(c).replace(/&nbsp;/g,""),onChange:M,placeholder:n,className:i,style:{width:"calc(100% - 60px)",margin:"0 auto",minHeight:"200px",padding:"20px",fontFamily:"monospace",fontSize:"14px",color:"#333",lineHeight:"1.5",backgroundColor:"#fff",border:"1px solid #ddd",borderRadius:"4px",...a}})}),te("div",{style:{display:s?"none":"block"},children:te(mE,{editor:e,initialValue:b.current,onChange:P,children:te(gp,{renderLeaf:cE,onMouseDown:w,onBlur:S,placeholder:n,className:i,style:a})})})]})}import{jsx as yp}from"react/jsx-runtime";function bE({standaloneOptions:{onChange:e,placeholder:t,className:o,...r},standaloneMethodsRef:n}){let[i,a]=hE(r.initialMarkdown||""),l=fE(i),s=Br(r);l.current=i,uE(n,()=>({getMarkdown(){return l.current},setMarkdown(c){l.current=c,a(c)}}),[l,a]);let m=dE(c=>{l.current=c,a(c),e?.(c)},[s]);return yp(xp,{editor:s,value:i,className:o||"",onChange:m,placeholder:t})}function yA(e,t){let o=pE(),r=gE(e);return r.render(yp(bE,{standaloneMethodsRef:o,standaloneOptions:t})),{unmount(){try{r.unmount()}catch{}},getMarkdown(){return o.current?.getMarkdown()||""},setMarkdown(n){o.current?.setMarkdown(n)}}}export{xp as Editable,yA as createWysimark,Br as useEditor};
1470
+ `;import{Fragment as Ib,jsx as ee,jsxs as yt}from"react/jsx-runtime";var wb=bb("enter");function jc({dest:e,close:t}){let o=vb(),r=xb(null),[n,i]=xt({x:0,y:0}),a=ho((T,C)=>{i(P=>({x:P.x+T,y:P.y+C}))},[]),l=X({src:r,dest:e},({src:T,dest:C},P)=>!T||!C?{left:0,top:0}:$t(T,P,{left:C.left-12,top:C.top+C.height},{margin:16})),s={...l,left:l.left+n.x,top:l.top+n.y},m=Eb(()=>{let{selection:T}=o;return T&&!kb.isCollapsed(T)?yb.string(o,T):""},[]),[c,d]=xt(""),[p,g]=xt(m),[b,k]=xt(m),[S,I]=xt(!1),w=()=>{let T=p.trim()||c,C=b.trim()||void 0;o.anchor.insertLink(c,T,{select:!0,title:C}),Tb.focus(o),t()},R=ho(T=>{d(T.currentTarget.value)},[d]),M=ho(T=>{let C=T.currentTarget.value;g(C),S||k(C)},[g,k,S]),N=ho(T=>{k(T.currentTarget.value),I(!0)},[k]),v=T=>{wb(T)&&(T.preventDefault(),T.stopPropagation(),w())};return yt(Ib,{children:[ee(Ee,{close:t}),yt(Hi,{ref:r,style:s,children:[ee(ye,{onDrag:a}),yt("div",{style:{padding:"0.75em"},children:[ee(Ht,{children:ee(At,{type:"text",value:c,autoFocus:!0,placeholder:f("linkUrl"),onChange:R,onKeyDown:v})}),ee(Ht,{style:{marginTop:"0.5em"},children:ee(At,{type:"text",value:p,placeholder:f("linkText"),onChange:M,onKeyDown:v})}),yt(Ht,{style:{marginTop:"0.5em"},children:[ee(At,{type:"text",value:b,placeholder:f("tooltipText"),onChange:N,onKeyDown:v}),yt(Mr,{onClick:w,children:[ee(fo,{}),ee(Tc,{})]}),ee(Mr,{onClick:t,style:{marginLeft:"0.25em",background:"var(--shade-400)"},children:ee(Uc,{})})]}),ee(Xc,{children:f("tooltipHint")})]})]})]})}var Pr=[{icon:fo,title:f("insertLink"),more:!0,hotkey:"mod+k",Component:jc},{icon:zc,title:f("insertImageFromUrl"),more:!0,Component:qc},{icon:Rc,title:f("insertTable"),more:!0,Component:xc},{icon:Fc,title:f("horizontalRule"),hotkey:"super+-",action:e=>e.horizontalRule.insertHorizontalRule()}],Yc=Pr,Jc=Pr,Zc=[{icon:Dc,title:f("insert"),more:!0,children:Pr}];import{Editor as Mb}from"slate";function Ze(e){let t=Mb.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 ep=[{icon:yr,title:f("bold"),hotkey:"mod+b",action:e=>e.marksPlugin.toggleBold(),active:e=>Ze(e).bold},{icon:Pc,title:f("italic"),hotkey:"mod+i",action:e=>e.marksPlugin.toggleItalic(),active:e=>Ze(e).italic},{icon:Nc,title:f("strike"),hotkey:"super+k",action:e=>e.marksPlugin.toggleStrike(),active:e=>Ze(e).strike},{icon:Lc,title:f("inlineCode"),hotkey:"mod+j",action:e=>e.inlineCode.toggleInlineCode(),active:e=>Ze(e).code},{icon:$c,title:f("underline"),hotkey:"mod+u",action:e=>e.marksPlugin.toggleUnderline(),active:e=>Ze(e).underline},{icon:_c,title:f("highlight"),hotkey:"mod+h",action:e=>e.marksPlugin.toggleHighlight(),active:e=>Ze(e).highlight,show:e=>!e.wysimark.disableHighlight}],Cr=ep,tp=[{icon:yr,title:f("format"),more:!0,children:ep}];var op=[{icon:Sc,title:f("bulletList"),hotkey:"super+8",action:e=>e.list.convertUnorderedList(!0)},{icon:Tr,title:f("numberedList"),hotkey:"super+7",action:e=>e.list.convertOrderedList(!0)},{icon:Hc,title:f("checkList"),hotkey:"super+9",action:e=>e.list.convertTaskList(!0),show:e=>!e.wysimark.disableTaskList}],Sr=[...op,"divider",...vr],rp=[{icon:Tr,title:f("list"),more:!0,children:[...op,"divider",...vr]}];import{Editor as np,Transforms as go}from"slate";var ip=[{icon:kr,title:f("quote"),hotkey:"super+.",action:e=>{e.blockQuotePlugin.isActive()?e.blockQuotePlugin.outdent():e.blockQuotePlugin.indent()},active:e=>e.blockQuotePlugin.isActive()},{icon:Cc,title:f("increaseQuoteDepth"),action:e=>e.blockQuotePlugin.increaseDepth(),active:e=>e.blockQuotePlugin.canIncreaseDepth()},{icon:Bc,title:f("codeBlock"),action:e=>{let{selection:t}=e,o=E(e,"code-block");if(o){let[,r]=o,n=np.string(e,r);go.removeNodes(e,{at:r}),go.insertNodes(e,{type:"paragraph",children:[{text:n}]},{at:r});return}if(t&&JSON.stringify(t.anchor.path)!==JSON.stringify(t.focus.path)){e.codeBlock.createCodeBlock({language:"text"});return}if(t&&(t.anchor.offset!==t.focus.offset||JSON.stringify(t.anchor.path)!==JSON.stringify(t.focus.path))){let r=np.string(e,t);go.delete(e),go.insertNodes(e,{type:"code-block",language:"text",children:[{type:"code-block-line",children:[{text:r}]}]});return}e.codeBlock.createCodeBlock({language:"text"})},active:e=>!!E(e,"code-block"),show:e=>!e.wysimark.disableCodeBlock}],Rr=ip,ap=[{icon:kr,title:f("quote"),more:!0,children:ip}];var Pb=[...Kc,"divider",...Sr,"divider",...Cr,"divider",...Yc,"divider",...Rr],Cb=[...wr,"divider",...Sr,"divider",...Cr,"divider",...Jc,"divider",...Rr],lp=[...wr,"divider",...rp,"divider",...tp,"divider",...Zc,"divider",...ap],sp=lp;var et=[Pb,Cb,lp];import{clsx as Sb}from"clsx";import{useCallback as Lr,useRef as Rb}from"react";import{ReactEditor as Lb,useSlate as Bb,useSlateStatic as zb}from"slate-react";import{jsx as bo,jsxs as Db}from"react/jsx-runtime";function mp({item:e}){let t=zb(),o=Bb(),r=e.active?e.active(o):!1,n=Rb(null),i=Y({title:e.title,hotkey:()=>e.hotkey?Dt(e.hotkey):void 0}),a=H("menu"),l=Lr(()=>{let c=n.current,d=e.children,p=e.Component;c&&(d?a.open(()=>bo(Ae,{dest:c,items:d,close:a.close})):p&&a.open(()=>bo(p,{dest:c,close:a.close})))},[e]),s=Lr(()=>{if(e.action){e.action(t),Lb.focus(t);return}a.layer?a.close():l()},[a.layer,e]),m=Lr(c=>{i.onMouseEnter(c),a.layer&&l()},[a.layer]);return Db(Xi,{"data-item-type":"button",ref:n,onMouseEnter:m,onMouseLeave:i.onMouseLeave,onClick:s,className:Sb({"--active":r&&!Ro(e?.title)?.includes("Depth"),"--more":e.more,"--disabled":!r&&Ro(e?.title)?.includes("Depth")}),children:[bo(e.icon,{}),e.more?bo(kc,{}):null]})}import{jsx as tt}from"react/jsx-runtime";function Ub({item:e}){let t=Ob();return e==="divider"?tt(qi,{"data-item-type":"divider",children:tt(Qi,{})}):(e.show===void 0?!0:e.show(t))?tt(mp,{item:e}):null}function _b(e){let t=e.querySelector("[data-item-type=button]"),o=e.querySelector("[data-item-type=divider]");if(!t||!o)throw new Error("Button or divider not found");return{toolbar:e.offsetWidth,button:t.offsetWidth,divider:o.offsetWidth}}function Fb(e,t,o){let r=0;for(let n of e)r+=n==="divider"?o:t;return r}var Vb=48;function cp(){let e=Hb(null),[t,o]=Ab(sp);return $b(()=>{let r=Nb(()=>{let i=e.current;if(!i)throw new Error("Toolbar not found");let a=_b(i);for(let l=0;l<et.length-1;l++)if(Fb(et[l],a.button,a.divider)<a.toolbar-Vb){o(et[l]);return}o(et[et.length-1])},100,{trailing:!0}),n=setTimeout(r,0);return window.addEventListener("resize",r),()=>{clearTimeout(n),window.removeEventListener("resize",r)}},[]),tt(Wi,{ref:e,children:tt(Gi,{children:t.map((r,n)=>tt(Ub,{item:r},typeof r=="string"?n:r.title))})})}import{jsx as Br,jsxs as Jb}from"react/jsx-runtime";function pp({attributes:e,Editable:t}){let o=Gb(null),r=Yb(),n=jb(),i=Wb(a=>{a.target===a.currentTarget&&(Qb.select(r,qb.end(r,[])),Xb.focus(r))},[r]);return Br(Ri,{children:Jb(_i,{ref:o,className:Kb({"--focused":n}),style:{height:r.toolbar.height,minHeight:r.toolbar.minHeight,maxHeight:r.toolbar.maxHeight},onClick:i,children:[Br(cp,{}),Br(t,{as:Ui,...e,style:{overflowY:"auto"}})]})})}var dp=y((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:pp,editableProps:{}}));import{Editor as zr,Node as Zb,Path as eE,Transforms as tE}from"slate";var up=y(e=>(e.allowTrailingBlock=!0,{name:"trailing-block",editor:{normalizeNode:t=>{if(!zr.isEditor(t[0]))return!1;let o=[e.children.length-1],r=Zb.child(e,e.children.length-1);return(zr.hasBlocks(e,r)||zr.isVoid(e,r))&&tE.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:eE.next(o)}),!0}}}));import{Transforms as oE}from"slate";function rE(e,t){let o=fe(t),r=ge(o);oE.insertNodes(e,r)}function fp(e){return{pasteMarkdown:u(rE,e)}}var hp=y(e=>(e.pasteMarkdown=fp(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),we(t),!0}}}));import{jsx as iE}from"react/jsx-runtime";function nE(e){let t={...e.attributes,style:{...e.attributes.style,width:void 0,maxWidth:void 0}};return iE("span",{...t,children:e.children})}var gp=y((e,t,{createPolicy:o})=>(e.placeholder={},o({name:"placeholder",editableProps:{renderPlaceholder:nE}})));var bp=[hp,ss,ha,Es,lm,Cs,hl,Ul,Gl,cc,ws,up,om,xa,cm,ts,uc,dp,dl,gp];var aE=ti(bp),{withSink:Ep,SinkEditable:xp}=aE;import{useState as lE}from"react";import{createEditor as sE,Editor as mE,Transforms as cE}from"slate";import{withHistory as pE}from"slate-history";import{withReact as dE}from"slate-react";function Dr({authToken:e,height:t,minHeight:o,maxHeight:r,disableRawMode:n,disableTaskList:i,disableCodeBlock:a,disableHighlight:l}={}){let[s]=lE(()=>{let m=sE(),c=Ep(dE(pE(m)),{toolbar:{height:t,minHeight:o,maxHeight:r,showUploadButtons:!!e},image:{}});return c.convertElement.addConvertElementType("paragraph"),m.wysimark={disableRawMode:n??!0,disableTaskList:i,disableCodeBlock:a,disableHighlight:l??!0},m.getMarkdown=()=>at(m.children),m.setMarkdown=d=>{let p=fe(d),g=ge(p);m.children=g,m.selection=null,cE.select(m,mE.start(m,[0]))},c});return s}import{jsx as te,jsxs as kp}from"react/jsx-runtime";function EE({children:e,attributes:t}){return te("span",{...t,children:e})}function Tp({editor:e,value:t,onChange:o,throttleInMs:r=1e3,placeholder:n,className:i,style:a,onImageChange:l}){let[s,m]=yp(!1),[c,d]=yp(t),p=Tt(!1),g=Tt(void 0),b=Tt(void 0),k=Tt(null),S=Tt(o);S.current=o;let I=kt(uE(()=>{let P=at(e.children);e.wysimark.prevValue={markdown:P,children:e.children},S.current(P)},r,{leading:!1,trailing:!0}),[e,r]),w=kt(()=>{b.current!==e.children&&(b.current=e.children,I())},[I]);if(!s){let P=k.current??t;if(k.current!==null&&(k.current=null),e.wysimark.prevValue==null||g.current==null){p.current=!0;let de=fe(P),ve=ge(de);e.children=ve,b.current=g.current=ve,e.wysimark.prevValue={markdown:P,children:ve}}else if(P!==e.wysimark.prevValue.markdown){p.current=!0;let de=fe(P),ve=ge(de);e.children=ve,e.selection=null,hE.select(e,fE.start(e,[0]))}}let R=kt(()=>{navigator.userAgent.toLowerCase().includes("firefox")&&gE.focus(e)},[e]),M=kt(()=>{I.flush()},[I]),N=P=>{let de=P.target.value;d(de),o(de)},v=kt(()=>{let P=e.getMarkdown();d(P)},[e]),T=()=>{s?(k.current=c,e.wysimark.prevValue=void 0,g.current=void 0,b.current=void 0):v(),m(!s)};e.wysimark.onImageChange=l,e.wysimark.onChange=o;let C=e.wysimark.disableRawMode;return kp("div",{style:{position:"relative"},children:[!C&&te("div",{style:{position:"absolute",top:"5px",right:"25px",zIndex:10},children:te("div",{onClick:T,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?f("switchToVisualEditor"):f("switchToRawMarkdown"),role:"button",tabIndex:0,onKeyDown:P=>{(P.key==="Enter"||P.key===" ")&&(T(),P.preventDefault())},children:kp("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[te("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"}),te("path",{d:"M7 15V9L10 12L13 9V15",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),te("path",{d:"M16 9H18V15",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),te("path",{d:"M16 12H18",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})}),te("div",{style:{display:s?"block":"none",textAlign:"center"},children:te("textarea",{value:ot(c).replace(/&nbsp;/g,""),onChange:N,placeholder:n,className:i,style:{width:"calc(100% - 60px)",margin:"0 auto",minHeight:"200px",padding:"20px",fontFamily:"monospace",fontSize:"14px",color:"#333",lineHeight:"1.5",backgroundColor:"#fff",border:"1px solid #ddd",borderRadius:"4px",...a}})}),te("div",{style:{display:s?"none":"block"},children:te(bE,{editor:e,initialValue:g.current,onChange:w,children:te(xp,{renderLeaf:EE,onMouseDown:R,onBlur:M,placeholder:n,className:i,style:a})})})]})}import{jsx as vp}from"react/jsx-runtime";function IE({standaloneOptions:{onChange:e,placeholder:t,className:o,...r},standaloneMethodsRef:n}){let[i,a]=vE(r.initialMarkdown||""),l=TE(i),s=Dr(r);l.current=i,kE(n,()=>({getMarkdown(){return l.current},setMarkdown(c){l.current=c,a(c)}}),[l,a]);let m=yE(c=>{l.current=c,a(c),e?.(c)},[s]);return vp(Tp,{editor:s,value:i,className:o||"",onChange:m,placeholder:t})}function PA(e,t){let o=xE(),r=wE(e);return r.render(vp(IE,{standaloneMethodsRef:o,standaloneOptions:t})),{unmount(){try{r.unmount()}catch{}},getMarkdown(){return o.current?.getMarkdown()||""},setMarkdown(n){o.current?.setMarkdown(n)}}}export{Tp as Editable,PA as createWysimark,Dr as useEditor};