wysimark-lite 0.25.6 → 0.25.8

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 gE,useCallback as bE,useImperativeHandle as EE,useRef as xE,useState as yE}from"react";import{createRoot as kE}from"react-dom/client";import cE from"lodash.throttle";import{useCallback as yt,useRef as go,useState as Ep}from"react";import{Editor as pE,Transforms as dE}from"slate";import{ReactEditor as uE,Slate as fE}from"slate-react";import td from"remark-parse";import{unified as od}from"unified";function yo(){return{enter:{table:Cp,tableData:Nr,tableHeader:Nr,tableRow:Rp},exit:{codeText:Lp,table:Sp,tableData:xo,tableHeader:xo,tableRow:xo}}}function Cp(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 Sp(e){this.exit(e),this.data.inTable=void 0}function Rp(e){this.enter({type:"tableRow",children:[]},e)}function xo(e){this.exit(e)}function Nr(e){this.enter({type:"tableCell",children:[]},e)}function Lp(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Bp));let o=this.stack[this.stack.length-1];o.type,o.value=t,this.exit(e)}function Bp(e,t){return t==="|"?t:e}import{gfm as zp}from"micromark-extension-gfm";import{gfmToMarkdown as Dp}from"mdast-util-gfm";function $r(e){if(e)return function(t){return this.data||(this.data={}),e.call(this,t)}}function Hr(){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(zp());let n=function(){let i=yo();if(i.enter)for(let a of Object.keys(i.enter))i.enter[a]=$r(i.enter[a]);if(i.exit)for(let a of Object.keys(i.exit))i.exit[a]=$r(i.exit[a]);return i};o.push(n()),r.push(Dp())}}function ue(e){let t=/\[([^\]]+)\]\(([^)]+)\)/g,o=[],r=0,n=e.replace(t,s=>(o.push(s),`__MARKDOWN_LINK_${r++}__`)),i=[];n=$p(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 tt(e){return e.replace(/\\(.)/g,(t,o)=>o)}var Np=new Set(["script","style"]);function $p(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=ko(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(Np.has(s)){let d=e.toLowerCase().indexOf(`</${s}`,i.endIndex+1);if(d!==-1){let p=ko(e,d);if(p){let g=e.slice(n,p.endIndex+1);t.push(g),o+=l,r=p.endIndex+1;continue}}}let m=Ap(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 ko(e,t){if(e[t]!=="<")return null;let o=Hp(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 Hp(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 Ap(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=ko(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 Ar(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 Or(e){return[{type:"block-quote",children:Be(e.children)}]}function Ur(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}]`}]},...Be(e.children)]}]}import{Text as Yr}from"slate";import{Text as jr}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 _r={bold:"**",italic:"_",strike:"~~",highlight:"<mark>",code:""},Vr={bold:"**",italic:"_",strike:"~~",highlight:"</mark>",code:""};function Op(e){if(e in _r)return _r[e];throw new Error(`Could not find mark ${JSON.stringify(e)} in MARK_KEY_TO_OPEN_TOKEN lookup`)}function Up(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(Op).join("")}function Wr(e){return e.map(Up).join("")}import{Text as Fp}from"slate";function rt(e){let{text:t,...o}=e;return Object.keys(o)}function To(e){if(Fp.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 Gr=["bold","italic","underline","strike","highlight","code"];function qr(e){return e.slice().sort((t,o)=>Gr.indexOf(t)-Gr.indexOf(o))}var _p=["\\","`","*","_","[","]","(",")","#","+","-",".","!","|","^","~","<",">","{","}","=",":",";","$","%","&","?",'"',"'",",","\\","/","@"],Vp=new RegExp(`(${_p.map(e=>`\\${e}`).join("|")})`,"g");function Qr(e){return e.replace(Vp,t=>`\\${t}`)}function Kp(e,t){let o=rt(e),r=rt(t);return o.length==r.length&&o.every(n=>r.includes(n))}function Xr(e,t){let o=jr.isText(e),r=jr.isText(t);return t&&!r&&!o?[{text:""},e]:o?t===void 0||!r?[e]:Kp(t,e)?(t.text=[t.text,e.text].join(""),[]):[e]:[e]}function Jr(e){let t=[];for(let o=0;o<e.length;o++){let r=t[t.length-1];t.push(...Xr(e[o],r))}return t.length===0&&t.push({text:""}),Yr.isText(t[0])||t.unshift({text:""}),Yr.isText(t[t.length-1])||t.push({text:""}),t}function Zr(e){return{url:e.url,title:e.title||void 0,alt:e.alt||void 0}}var Wp=/^(\/[^?#]*)(?:\?([^#]*))?(#.*)?$/;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(Wp);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 en(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 tn(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 on=[en,tn,Zr];function rn(e){for(let t of on){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 Gp(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(...qp(n,t));return Jr(o)}function qp(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 Gp(e.value,t);case"image":return rn(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 nn(e){return[{type:"heading",level:e.depth,children:F(e.children)}]}function an(e){return[{type:"html-block",html:e.value,children:[{text:""}]}]}function ln(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 Tt(e,t+1);default:return wo(e)}}function sn(e,t){let o=[];for(let r of e.children)o.push(...ln(r,{...t,checked:e.checked}));return o}function Tt(e,t=0){let o=[];for(let r of e.children)o.push(...sn(r,{depth:t,ordered:!!e.ordered}));return o}function Qp(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 Xp(e){return!(e.length!==1||!("text"in e[0])||e[0].text!==jp)}function mn(e){let t=F(e.children);return Qp(t)?[{...t[1],type:"image-block"}]:Xp(t)?[{type:"paragraph",children:[{text:""}]}]:[{type:"paragraph",children:t}]}function cn(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(Yp)}]}function Yp(e){if(e.type!=="tableRow")throw new Error("Expected a tableRow");return{type:"table-row",children:e.children.map(Jp)}}function Jp(e){if(e.type!=="tableCell")throw new Error("Expected a tableCell");return{type:"table-cell",children:[{type:"table-content",children:F(e.children)}]}}function pn(){return[{type:"horizontal-rule",children:[{text:""}]}]}function Be(e){let t=[];for(let o of e)t.push(...wo(o));return t}function wo(e){switch(e.type){case"blockquote":return Or(e);case"code":return Ur(e);case"definition":throw new Error('The type "definition" should not exist. See comments');case"footnoteDefinition":return Fr(e);case"heading":return nn(e);case"html":return an(e);case"list":return Tt(e);case"paragraph":return mn(e);case"table":return cn(e);case"thematicBreak":return pn();case"yaml":return[]}fe(e)}import{definitions as Zp}from"mdast-util-definitions";import{SKIP as dn,visit as ed}from"unist-util-visit";function un(e){let t=Zp(e);ed(e,(o,r,n)=>{let i=o,a=n;if(i.type==="definition"&&a!==null&&typeof r=="number")return a.children.splice(r,1),[dn,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,[dn,r]}}})}var rd=od().use(td).use(Hr());function nd(e){let t=rd.parse(e);return un(t),t}function he(e){let t=nd(e);return t.children.length===0?[{type:"paragraph",children:[{text:""}]}]:Be(t.children)}function id(e){return e.type==="ordered-list-item"||e.type==="unordered-list-item"||e.type==="task-list-item"}function fn(e){let t=[],o=-1;for(let r of e){if(!id(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 hn(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 gn(e){let t=[],o=3;for(let r of e.children){let n=hn(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 kE,useCallback as vE,useImperativeHandle as TE,useRef as wE,useState as IE}from"react";import{createRoot as ME}from"react-dom/client";import hE from"lodash.throttle";import{useCallback as kt,useRef as vt,useState as kp}from"react";import{Editor as gE,Transforms as bE}from"slate";import{ReactEditor as EE,Slate as xE}from"slate-react";import rd from"remark-parse";import{unified as nd}from"unified";function vo(){return{enter:{table:Rp,tableData:Hr,tableHeader:Hr,tableRow:zp},exit:{codeText:Bp,table:Lp,tableData:ko,tableHeader:ko,tableRow:ko}}}function Rp(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 Lp(e){this.exit(e),this.data.inTable=void 0}function zp(e){this.enter({type:"tableRow",children:[]},e)}function ko(e){this.exit(e)}function Hr(e){this.enter({type:"tableCell",children:[]},e)}function Bp(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Dp));let o=this.stack[this.stack.length-1];o.type,o.value=t,this.exit(e)}function Dp(e,t){return t==="|"?t:e}import{gfm as Np}from"micromark-extension-gfm";import{gfmToMarkdown as $p}from"mdast-util-gfm";function Ar(e){if(e)return function(t){return this.data||(this.data={}),e.call(this,t)}}function Or(){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(Np());let n=function(){let i=vo();if(i.enter)for(let a of Object.keys(i.enter))i.enter[a]=Ar(i.enter[a]);if(i.exit)for(let a of Object.keys(i.exit))i.exit[a]=Ar(i.exit[a]);return i};o.push(n()),r.push($p())}}function fe(e){let t=/\[([^\]]+)\]\(([^)]+)\)/g,o="\x07WYSIMARK_",r=`${o}LINK_`,n=`${o}HTML_`,i="\x07",a=[],l=0,s=e.replace(t,p=>(a.push(p),`${r}${l++}${i}`)),m=[];s=Ap(s,m,n,i);let d=/(https?:\/\/[^\s]+)/g;s=s.replace(d,p=>p.replace(/\//g,"\\/"));for(let p=0;p<m.length;p++)s=s.replace(`${n}${p}${i}`,m[p]);for(let p=0;p<a.length;p++)s=s.replace(`${r}${p}${i}`,a[p]);return s}function ot(e){return e.replace(/\\\//g,"/")}var Hp=new Set(["script","style"]);function Ap(e,t,o,r){let n="",i=0;for(;i<e.length;){let a=e.indexOf("<",i);if(a===-1){n+=e.slice(i);break}if(n+=e.slice(i,a),e.startsWith("<!--",a)){let u=e.indexOf("-->",a+4);if(u===-1){n+=e.slice(a);break}let h=e.slice(a,u+3);t.push(h),n+=`${o}${t.length-1}${r}`,i=u+3;continue}if(e.startsWith("<![CDATA[",a)){let u=e.indexOf("]]>",a+9);if(u===-1){n+=e.slice(a);break}let h=e.slice(a,u+3);t.push(h),n+=`${o}${t.length-1}${r}`,i=u+3;continue}let l=To(e,a);if(!l){n+="<",i=a+1;continue}let s=t.length,m=`${o}${s}${r}`;if(!l.name){let u=e.slice(a,l.endIndex+1);t.push(u),n+=m,i=l.endIndex+1;continue}let c=l.name.toLowerCase();if(l.isClosing||l.isSelfClosing){let u=e.slice(a,l.endIndex+1);t.push(u),n+=m,i=l.endIndex+1;continue}if(Hp.has(c)){let u=e.toLowerCase().indexOf(`</${c}`,l.endIndex+1);if(u!==-1){let h=To(e,u);if(h){let v=e.slice(a,h.endIndex+1);t.push(v),n+=m,i=h.endIndex+1;continue}}}let d=Up(e,c,l.endIndex+1);if(d!==null){let u=e.slice(a,d+1);t.push(u),n+=m,i=d+1;continue}let p=e.slice(a,l.endIndex+1);t.push(p),n+=m,i=l.endIndex+1}return n}function To(e,t){if(e[t]!=="<")return null;let o=Op(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 Op(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 Up(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 Ur(e,t){if(!e)throw new Error(`${t}`)}function Tt(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 Fr(e){return[{type:"block-quote",children:Be(e.children)}]}function Vr(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 Kr(e){return[{type:"block-quote",children:[{type:"paragraph",children:[{text:`[${e.identifier}]`}]},...Be(e.children)]}]}import{Text as Zr}from"slate";import{Text as Yr}from"slate";import*as rt from"slate";function A(e){return rt.Text.isText(e)}function re(e){return rt.Element.isElement(e)}function R(e){return rt.Text.isText(e)&&!!e.text.match(/^\s+$/)&&!e.code}var _r={bold:"**",italic:"_",strike:"~~",highlight:"<mark>",code:""},Wr={bold:"**",italic:"_",strike:"~~",highlight:"</mark>",code:""};function Fp(e){if(e in _r)return _r[e];throw new Error(`Could not find mark ${JSON.stringify(e)} in MARK_KEY_TO_OPEN_TOKEN lookup`)}function Vp(e){if(e in Wr)return Wr[e];throw new Error(`Could not find mark ${JSON.stringify(e)} in MARK_KEY_TO_CLOSE_TOKEN lookup`)}function Gr(e){return e.map(Fp).join("")}function qr(e){return e.map(Vp).join("")}import{Text as Kp}from"slate";function nt(e){let{text:t,...o}=e;return Object.keys(o)}function wo(e){if(Kp.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 nt(e)}else{if(e.type==="anchor")return Io(e.children);throw new Error(`Unhandled type ${e.type}`)}}function Io(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=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 Xr(e){return e.slice().sort((t,o)=>Qr.indexOf(t)-Qr.indexOf(o))}var _p=["\\","`","*","_","[","]","~","|","<"],Wp=new RegExp(`(${_p.map(e=>`\\${e}`).join("|")})`,"g");function jr(e){let t=e.replace(Wp,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 Gp(e,t){let o=nt(e),r=nt(t);return o.length==r.length&&o.every(n=>r.includes(n))}function Jr(e,t){let o=Yr.isText(e),r=Yr.isText(t);return t&&!r&&!o?[{text:""},e]:o?t===void 0||!r?[e]:Gp(t,e)?(t.text=[t.text,e.text].join(""),[]):[e]:[e]}function en(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:""}),Zr.isText(t[0])||t.unshift({text:""}),Zr.isText(t[t.length-1])||t.push({text:""}),t}function tn(e){return{url:e.url,title:e.title||void 0,alt:e.alt||void 0}}var qp=/^([^?#]*)(?:\?([^#]*))?(#.*)?$/;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(qp);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 on(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 rn(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 nn=[on,rn,tn];function an(e){for(let t of nn){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 V(e,t={}){let o=[];for(let n of e)o.push(...Xp(n,t));return en(o)}function Xp(e,t={}){switch(e.type){case"delete":return V(e.children,{...t,strike:!0});case"emphasis":return V(e.children,{...t,italic:!0});case"footnoteReference":return[{text:`[${e.identifier}]`}];case"html":return Qp(e.value,t);case"image":return an(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:V(e.children,t)}];case"strong":return V(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 ln(e){return[{type:"heading",level:e.depth,children:V(e.children)}]}function sn(e){return[{type:"html-block",html:e.value,children:[{text:""}]}]}function mn(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:V(e.children)}]:o?[{type:"ordered-list-item",depth:t,children:V(e.children)}]:[{type:"unordered-list-item",depth:t,children:V(e.children)}];case"list":return wt(e,t+1);default:return Mo(e)}}function cn(e,t){let o=[];for(let r of e.children)o.push(...mn(r,{...t,checked:e.checked}));return o}function wt(e,t=0){let o=[];for(let r of e.children)o.push(...cn(r,{depth:t,ordered:!!e.ordered}));return o}function jp(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 Yp="\xA0";function Jp(e){return!(e.length!==1||!("text"in e[0])||e[0].text!==Yp)}function pn(e){let t=V(e.children);return jp(t)?[{...t[1],type:"image-block"}]:Jp(t)?[{type:"paragraph",children:[{text:""}]}]:[{type:"paragraph",children:t}]}function dn(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(Zp)}]}function Zp(e){if(e.type!=="tableRow")throw new Error("Expected a tableRow");return{type:"table-row",children:e.children.map(ed)}}function ed(e){if(e.type!=="tableCell")throw new Error("Expected a tableCell");return{type:"table-cell",children:[{type:"table-content",children:V(e.children)}]}}function un(){return[{type:"horizontal-rule",children:[{text:""}]}]}function Be(e){let t=[];for(let o of e)t.push(...Mo(o));return t}function Mo(e){switch(e.type){case"blockquote":return Fr(e);case"code":return Vr(e);case"definition":throw new Error('The type "definition" should not exist. See comments');case"footnoteDefinition":return Kr(e);case"heading":return ln(e);case"html":return sn(e);case"list":return wt(e);case"paragraph":return pn(e);case"table":return dn(e);case"thematicBreak":return un();case"yaml":return[]}he(e)}import{definitions as td}from"mdast-util-definitions";import{SKIP as fn,visit as od}from"unist-util-visit";function hn(e){let t=td(e);od(e,(o,r,n)=>{let i=o,a=n;if(i.type==="definition"&&a!==null&&typeof r=="number")return a.children.splice(r,1),[fn,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,[fn,r]}}})}var id=nd().use(rd).use(Or());function ad(e){let t=id.parse(e);return hn(t),t}function ge(e){let t=ad(e);return t.children.length===0?[{type:"paragraph",children:[{text:""}]}]:Be(t.children)}function ld(e){return e.type==="ordered-list-item"||e.type==="unordered-list-item"||e.type==="task-list-item"}function gn(e){let t=[],o=-1;for(let r of e){if(!ld(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 bn(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 En(e){let t=[],o=3;for(let r of e.children){let n=bn(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 bn(e){return e.url}function En(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 xn(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 ad=[En,xn,bn];function vt(e){for(let t of ad){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 yn(e){let t=vt(e);return t?`${t}
6
+ `}function xn(e){return e.url}function yn(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 kn(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 sd=[yn,kn,xn];function It(e){for(let t of sd){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 vn(e){let t=It(e);return t?`${t}
7
7
 
8
- `:""}import{Element as pd,Text as dd}from"slate";function kn(e,t){let o=t.filter(n=>!e.includes(n));return{orderedMarksToAdd:qr(o)}}function Tn(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 Io(e,t){let{orderedMarksToRemove:o,nextOrderedMarks:r}=Tn(e,t),{orderedMarksToAdd:n}=kn(r,t);return{remove:o,add:n,nextOrderedMarks:[...r,...n]}}import{Element as sd}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 wn({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 In({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 Mn({node:e}){return!oe(e)||e.type!=="line"||e.children.length>0?!1:(e.children.push({text:""}),!0)}function Pn({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 Cn({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 Sn({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 Rn=[Pn,wn,In,vn,Sn,Cn,Mn];function Ln(e){for(let t of Rn)if(t(e))return!0;return!1}var ld=72;function Mo(e,t){let o=!1,r,n=0,i=(e.length+1)*ld;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)&&Mo(l.children,l)){r=!0,o=!0;break e}let s=e[a-1],m=e[a+1];if(Ln({parent:t,node:l,prevNode:s,nextNode:m,index:a,nodes:e})){r=!0,o=!0;break e}}}while(r);return o}var Bn=e=>e.map(t=>sd.isElement(t)&&t.type==="anchor"?{...t,children:Bn(t.children)}:t);function zn(e){let t={type:"line",children:Bn(e)};return Mo([t],void 0),t.children}import{Text as cd}from"slate";function Dn(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 md(e){return e.replace(/"/g,'\\"')}function Nn(e){let t=vo(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} "${md(e.title)}")`:`[${K(e.children,t,t)}](${e.href})`}function $n(e){return Qr(e.text)}function Hn(e){if(cd.isText(e))return e.code?Dn(e):$n(e);switch(e.type){case"anchor":return Nn(e);case"image-inline":return vt(e);default:fe(e)}}function K(e,t=[],o=[]){let r=zn(e),n=[],i=Io(t,To(r[0]));for(let a=0;a<r.length;a++){let l=r[a];if(dd.isText(l)&&R(l)){n.push(l.text);continue}n.push(Kr(i.add)),n.push(Hn(l));let s=ud(r,a,o),m=Io(i.nextOrderedMarks,s);n.push(Wr(m.remove)),i=m}return n.join("")}function ud(e,t,o){for(let r=t+1;r<e.length;r++){let n=e[r];if(!R(n)&&!(pd.isElement(n)&&n.type==="image-inline"))return To(n)}return o}function On(e){let t=[];return t.push(An(e.children[0])),t.push(fd(e.columns)),e.children.slice(1).forEach(o=>{t.push(An(o))}),`${t.join(`
8
+ `:""}import{Element as ud,Text as fd}from"slate";function Tn(e,t){let o=t.filter(n=>!e.includes(n));return{orderedMarksToAdd:Xr(o)}}function wn(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 Po(e,t){let{orderedMarksToRemove:o,nextOrderedMarks:r}=wn(e,t),{orderedMarksToAdd:n}=Tn(r,t);return{remove:o,add:n,nextOrderedMarks:[...r,...n]}}import{Element as cd}from"slate";function In({node:e,nextNode:t,nodes:o,index:r}){return!A(e)||!R(e)||e.code||!A(t)||!R(t)||t.code?!1:(o.splice(r,2,{text:`${e.text}${t.text}`}),!0)}function Mn({node:e,nodes:t,prevNode:o,index:r}){if(!re(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 Pn({node:e,nodes:t,nextNode:o,index:r}){if(!re(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 Cn({node:e}){return!re(e)||e.type!=="line"||e.children.length>0?!1:(e.children.push({text:""}),!0)}function Sn({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 Rn({index:e,nodes:t,node:o,parent:r}){return e!==t.length-1||t.length<=1||!A(o)||!R(o)?!1:r&&re(r)&&r.type==="line"?(t.splice(t.length-1,1),!0):!1}function Ln({index:e,nodes:t,node:o,parent:r}){return e!==0||t.length===0||!A(o)||!R(o)?!1:r&&re(r)&&r.type==="line"?(t.splice(0,1),!0):!1}var zn=[Sn,Mn,Pn,In,Ln,Rn,Cn];function Bn(e){for(let t of zn)if(t(e))return!0;return!1}var md=72;function Co(e,t){let o=!1,r,n=0,i=(e.length+1)*md;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(re(l)&&Co(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 Dn=e=>e.map(t=>cd.isElement(t)&&t.type==="anchor"?{...t,children:Dn(t.children)}:t);function Nn(e){let t={type:"line",children:Dn(e)};return Co([t],void 0),t.children}import{Text as dd}from"slate";function $n(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 pd(e){return e.replace(/"/g,'\\"')}function Hn(e){let t=Io(e.children);return e.href.startsWith("$")?W(e.children,t,t):typeof e.title=="string"&&e.title.length>0?`[${W(e.children,t,t)}](${e.href} "${pd(e.title)}")`:`[${W(e.children,t,t)}](${e.href})`}function An(e){return jr(e.text)}function On(e){if(dd.isText(e))return e.code?$n(e):An(e);switch(e.type){case"anchor":return Hn(e);case"image-inline":return It(e);default:he(e)}}function W(e,t=[],o=[]){let r=Nn(e),n=[],i=Po(t,wo(r[0]));for(let a=0;a<r.length;a++){let l=r[a];if(fd.isText(l)&&R(l)){n.push(l.text);continue}n.push(Gr(i.add)),n.push(On(l));let s=hd(r,a,o),m=Po(i.nextOrderedMarks,s);n.push(qr(m.remove)),i=m}return n.join("")}function hd(e,t,o){for(let r=t+1;r<e.length;r++){let n=e[r];if(!R(n)&&!(ud.isElement(n)&&n.type==="image-inline"))return wo(n)}return o}function Fn(e){let t=[];return t.push(Un(e.children[0])),t.push(gd(e.columns)),e.children.slice(1).forEach(o=>{t.push(Un(o))}),`${t.join(`
9
9
  `)}
10
10
 
11
- `}function fd(e){return e.every(o=>o.align==="left")?`|${e.map(()=>"---").join("|")}|`:`|${e.map(o=>hd(o.align)).join("|")}|`}function hd(e){switch(e){case"left":return":---";case"center":return":---:";case"right":return"---:"}}function An(e){return kt(e,"table-row"),`|${e.children.map(gd).join("|")}|`}function gd(e){return kt(e,"table-cell"),Ar(e.children.length===1,`Expected table-cell to have one child but is ${JSON.stringify(e.children)}`),e.children.map(bd).join()}function bd(e){return kt(e,"table-content"),K(e.children)}var Po=4;function Un(e,t){switch(e.type){case"anchor":return`[${K(e.children)}](${e.href})`;case"block-quote":return`${wt(e.children).split(`
12
- `).map(r=>`> ${r}`.trim()).join(`
11
+ `}function gd(e){return e.every(o=>o.align==="left")?`|${e.map(()=>"---").join("|")}|`:`|${e.map(o=>bd(o.align)).join("|")}|`}function bd(e){switch(e){case"left":return":---";case"center":return":---:";case"right":return"---:"}}function Un(e){return Tt(e,"table-row"),`|${e.children.map(Ed).join("|")}|`}function Ed(e){return Tt(e,"table-cell"),Ur(e.children.length===1,`Expected table-cell to have one child but is ${JSON.stringify(e.children)}`),e.children.map(xd).join("")}function xd(e){return Tt(e,"table-content"),W(e.children)}var So=4;function Vn(e,t){switch(e.type){case"anchor":return`[${W(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)} ${K(e.children)}
15
+ `;case"heading":return`${"#".repeat(e.level)} ${W(e.children)}
16
16
 
17
17
  `;case"horizontal-rule":return`---
18
18
 
19
- `;case"paragraph":return`${K(e.children)}
19
+ `;case"paragraph":return`${W(e.children)}
20
20
 
21
- `;case"table":return On(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*Po)}- ${K(e.children)}
22
- `;case"ordered-list-item":return`${" ".repeat(e.depth*Po)}${t[e.depth]}. ${K(e.children)}
23
- `;case"task-list-item":{let o=" ".repeat(e.depth*Po),r=K(e.children);return r.trim()===""&&(r="&#32;"),`${o}- [${e.checked?"x":" "}] ${r}
24
- `}case"image-block":return yn(e);case"code-block":return gn(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 Fn(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*So)}- ${W(e.children)}
22
+ `;case"ordered-list-item":return`${" ".repeat(e.depth*So)}${t[e.depth]}. ${W(e.children)}
23
+ `;case"task-list-item":{let o=" ".repeat(e.depth*So),r=W(e.children);return r.trim()===""&&(r="&#32;"),`${o}- [${e.checked?"x":" "}] ${r}
24
+ `}case"image-block":return vn(e);case"image-inline":return`![${e.alt||""}](${e.url})`;case"code-block":return En(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=Un(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=Vn(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=fn(e);return wt(t)}var Co={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 Co[t==="ja"?"ja":"en"][e]},So=e=>{let t=Fn();return Object.keys(Co[t==="ja"?"ja":"en"]).find(r=>Co[t==="ja"?"ja":"en"][r]===e)||""};var y=e=>({fn:e});import{useEffect as Td,useMemo as Yn}from"react";import{Editor as vd}from"slate";import{useSlateStatic as wd}from"slate-react";function ne(e){return!!e}function _n(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 Ed}from"slate-react";import{jsx as xd}from"react/jsx-runtime";function Vn(e){let t=e.map(r=>r.renderEditable).filter(ne),o=r=>xd(Ed,{...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)},Wn=(e,t)=>{let o=It(t,"onKeyUp");return Mt(o,e)},Gn=(e,t)=>{let o=It(t,"onPaste");return Mt(o,e)},qn=(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 yd}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=yd(n,r.attributes),n}}function Xn(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 kd from"@emotion/styled";var at=kd("div")`
28
+ `)),t.push(l)}let r=t.join("");return r.trim()===""?"":r.replace(/^\n+/,"").trim()}function at(e){let t=gn(e);return Mt(t)}var Ro={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"}},Kn=()=>{try{if(typeof window<"u"&&window.navigator)return window.navigator.language.split("-")[0]}catch{}return"en"},g=e=>{let t=Kn();return Ro[t==="ja"?"ja":"en"][e]},Lo=e=>{let t=Kn();return Object.keys(Ro[t==="ja"?"ja":"en"]).find(r=>Ro[t==="ja"?"ja":"en"][r]===e)||""};var k=e=>({fn:e});import{useEffect as wd,useMemo as Zn}from"react";import{Editor as Id}from"slate";import{useSlateStatic as Md}from"slate-react";function ie(e){return!!e}function _n(e,t){let o=t.map(r=>r.editableProps?.decorate).filter(ie);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 yd}from"slate-react";import{jsx as kd}from"react/jsx-runtime";function Wn(e){let t=e.map(r=>r.renderEditable).filter(ie),o=r=>kd(yd,{...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 Gn=(e,t)=>{let o=Pt(t,"onKeyDown");return Ct(o,e)},qn=(e,t)=>{let o=Pt(t,"onKeyUp");return Ct(o,e)},Qn=(e,t)=>{let o=Pt(t,"onPaste");return Ct(o,e)},Xn=(e,t)=>{let o=Pt(t,"onDrop");return Ct(o,e)};function jn(e,t){let o=t.map(r=>r.editableProps?.renderElement).filter(ie);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 vd}from"react";function Yn(e,t){if(e===void 0)throw new Error("renderLeaf was not defined on SinkEditable");let o=t.map(r=>r.editableProps?.renderLeaf).filter(ie).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=vd(n,r.attributes),n}}function Jn(e,t){if(e)return e;let o=t.map(r=>r.editableProps?.renderPlaceholder).filter(ie);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 Id}from"react/jsx-runtime";function Jn(e){let t=wd();Td(()=>{vd.normalize(t,{force:!0})},[]);let{plugins:o}=t.sink,r=Yn(()=>({...e,decorate:_n(e.decorate,o),renderElement:Qn(e.renderElement,o),renderLeaf:jn(e.renderLeaf,o),renderPlaceholder:Xn(e.renderPlaceholder,o),onKeyDown:Kn(e.onKeyDown,o),onKeyUp:Wn(e.onKeyUp,o),onPaste:Gn(e.onPaste,o),onDrop:qn(e.onDrop,o)}),Object.values(e)),n=Yn(()=>Vn(o),[o]);return Id(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 Zn(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 ei=e=>{let t=e.map(n=>n.fn);return{withSink:Zn(t),SinkEditable:Jn}};import{Element as Md}from"slate";import{ReactEditor as Pd}from"slate-react";function ti(e,t){return Md.isElement(t)?Pd.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 Cd=/mac os x|macintosh/i,lt;function Pt(){if(lt!==void 0)return lt;try{let{userAgent:e}=window.navigator;lt=Cd.test(e)}catch{lt=!1}return lt}function ve(e){e.preventDefault(),e.stopPropagation()}import{Editor as ni,Path as Sd}from"slate";import{Element as oi}from"slate";function ri(e){if(typeof e=="function")return e;if(typeof e=="string")return o=>oi.isElement(o)&&o.type===e;if(Array.isArray(e))return o=>oi.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=ti(e,o),n=ri(t);if(Sd.isPath(r)){let i=ni.node(e,r);if(i&&n(i[0]))return i}return ni.above(e,{at:r,match:n})}function Ne(...e){return E(...e)?.[1]}import{jsx as Rd}from"react/jsx-runtime";var x=({strokeWidth:e=1.5,...t})=>Rd("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 Ld}from"slate";function se(e){return e==null?!1:Ld.isCollapsed(e)}import{Element as ii}from"slate";function Ct(e){return Array.isArray(e)?t=>ii.isElement(t)&&e.includes(t.type):t=>ii.isElement(t)&&e==t.type}import{Editor as Bd}from"slate";function ai(e,t){let{selection:o}=e;if(!se(o))return!1;let r=E(e,t,{at:o});return!!r&&Bd.isEnd(e,o.anchor,r[1])}import{Editor as TT}from"slate";import{Editor as zd}from"slate";function we(e,t){let{selection:o}=e;if(!se(o))return!1;let r=E(e,t,{at:o});return!!r&&zd.isStart(e,o.anchor,r[1])}import{isHotkey as li}from"is-hotkey";import{Editor as Ro,Element as Dd,Range as Nd,Transforms as $d}from"slate";var Hd=li(" "),Ad=li("SHIFT+SPACE");function si(e,t){return o=>{if(!Hd(o.nativeEvent)&&!Ad(o.nativeEvent))return!1;let{selection:r}=e;if(r===null||Nd.isExpanded(r))return!1;let n=E(e,m=>Dd.isElement(m)&&e.convertElement.isConvertibleElement(m));if(!n)return!1;let i={anchor:Ro.start(e,n[1]),focus:r.focus},a=Ro.string(e,i),l=t[a];if(!l)return!1;ve(o);let s={anchor:Ro.start(e,n[1]),focus:r.focus};return $d.delete(e,{at:s}),l(),!0}}import{isHotkey as Od}from"is-hotkey";function mi(e){let t=e.replace(/\bsuper\b/g,Pt()?"cmd+alt":"ctrl+shift");return Od(t)}function D(e){let t=null;return function(r){t==null&&(t=Object.entries(e).map(([n,i])=>[mi(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 Ud,Transforms as ci}from"slate";function pi(e,t){Ud.withoutNormalizing(e,()=>{ci.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:"123"},{at:t}),ci.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:null},{at:t})})}import{Editor as di}from"slate";function ge(e,t,o){let[,r]=t,n=di.previous(e,{at:r});if(n&&o(n,t))return!0;let i=di.next(e,{at:r});return!!(i&&o(t,i))}import{Editor as ui,Transforms as fi}from"slate";function G(e,t){fi.select(e,ui.start(e,t))}function hi(e,t){fi.select(e,ui.end(e,t))}function gi(e,t){return typeof t!="function"?t:t(e)}import{Editor as Lo,Element as Fd,Path as _d,Transforms as st}from"slate";function bi(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;Lo.withoutNormalizing(e,()=>{st.insertNodes(e,t,{at:o}),n&&(st.select(e,n),st.move(e))})}else{let n=_d.next(r[1]);Lo.withoutNormalizing(e,()=>{st.insertNodes(e,t,{at:n}),st.select(e,Lo.start(e,n))})}return!0}import{Editor as Ei,Transforms as xi}from"slate";function mt(e,t,o){Ei.withoutNormalizing(e,()=>{let r=Ei.node(e,o),n=gi(r[0],t);xi.wrapNodes(e,n,{at:o}),xi.unwrapNodes(e,{at:[...o,0]})})}import{Editor as Vd,Transforms as Kd}from"slate";function St(e,t,o){let r=Array.from(Vd.nodes(e,o));if(r.length===0)return!1;for(let n of r){let[i]=n;Kd.setNodes(e,t(i),{at:n[1]})}return!0}function yi(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 Wd(n)?(t.preventDefault(),t.stopPropagation(),e.anchor.insertLink(n),!0):!1}function Wd(e){let t;try{t=new URL(e)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"||t.protocol==="mailto:"}import{Editor as Gd,Node as qd,Transforms as Bo}from"slate";function ki(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(Bo.setNodes(e,{href:t,title:o},{at:l}),r!==void 0){let s=qd.string(a);r!==s&&Gd.withoutNormalizing(e,()=>{let m=a.children.length;for(let c=m-1;c>=0;c--)Bo.removeNodes(e,{at:[...l,c]});Bo.insertNodes(e,{text:r},{at:[...l,0]})})}return!0}import{Editor as Rt,Range as Qd,Text as jd,Transforms as zo}from"slate";function Ti(e,t,o=t,{select:r=!0,title:n}={}){let i=e.selection||{anchor:Rt.start(e,[0]),focus:Rt.start(e,[0])};if(Qd.isCollapsed(i)){if(zo.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);zo.select(e,a[1])}}else zo.wrapNodes(e,{type:"anchor",href:t,title:n,children:[]},{split:!0,match:a=>jd.isText(a)||Rt.isInline(e,a)})}import{Transforms as Xd}from"slate";function vi(e,{at:t}){let o=E(e,"anchor",{at:t});return o?(Xd.unwrapNodes(e,{at:o[1]}),!0):!1}function wi(e){return{insertLink:u(Ti,e),removeLink:u(vi,e),editLink:u(ki,e)}}import{Element as Ii,Transforms as Yd}from"slate";function Mi(e,t){if(!Ii.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(!(!Ii.isElement(n)||n.type!=="anchor"))return Yd.unwrapNodes(e,{at:[...t[1],r]}),!0}return!1}import{clsx as Ku}from"clsx";import{useEffect as Wu,useRef as da}from"react";import{useSelected as Gu,useSlate as qu}from"slate-react";import{createContext as Ci,useState as Zd}from"react";import{createPortal as Jd}from"react-dom";function Pi({children:e}){return Jd(e,document.body)}import{jsx as Do,jsxs as tu}from"react/jsx-runtime";var No=Ci({}),eu=Ci({});function Si({children:e}){let[t,o]=Zd({});function r(i){o(a=>({...a,[i.type]:i}))}function n(i){o(a=>{let l={...a};return delete l[i],l})}return tu(No.Provider,{value:{layers:t,setLayers:o,openLayer:r,closeLayer:n},children:[e,Object.entries(t).map(([,i])=>Do(Pi,{children:Do(eu.Provider,{value:i,children:Do(i.Component,{})})},i.type))]})}import{useContext as ou}from"react";function H(e){let{openLayer:t,closeLayer:o,layers:r}=ou(No);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 Ri=Lt("a")`
35
+ `;import{jsx as Pd}from"react/jsx-runtime";function ei(e){let t=Md();wd(()=>{Id.normalize(t,{force:!0})},[t]);let{plugins:o}=t.sink,r=Zn(()=>({...e,decorate:_n(e.decorate,o),renderElement:jn(e.renderElement,o),renderLeaf:Yn(e.renderLeaf,o),renderPlaceholder:Jn(e.renderPlaceholder,o),onKeyDown:Gn(e.onKeyDown,o),onKeyUp:qn(e.onKeyUp,o),onPaste:Qn(e.onPaste,o),onDrop:Xn(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=Zn(()=>Wn(o),[o]);return Pd(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 se(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 ti(e){return(t,o)=>{let r=t,n=e.map(i=>i(r,o,{createPolicy:a=>a}));return r.sink={plugins:n},r.isMaster="isMaster"in r?r.isMaster:()=>!1,r.isSlave="isSlave"in r?r.isSlave:()=>!1,r.isStandalone="isStandalone"in r?r.isStandalone:()=>!1,Object.assign(r,{normalizeNode:se(r,"normalizeNode",n),deleteBackward:se(r,"deleteBackward",n),deleteForward:se(r,"deleteForward",n),deleteFragment:se(r,"deleteFragment",n),insertBreak:se(r,"insertBreak",n),insertFragment:se(r,"insertFragment",n),insertNode:se(r,"insertNode",n),insertText:se(r,"insertText",n),isInline: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 oi=e=>{let t=e.map(n=>n.fn);return{withSink:ti(t),SinkEditable:ei}};import{Element as Cd}from"slate";import{ReactEditor as Sd}from"slate-react";function ri(e,t){return Cd.isElement(t)?Sd.findPath(e,t):t}function f(e,t){return e.bind(null,t)}function G(e,t,o){return e.bind(null,t,o)}var Rd=/mac os x|macintosh/i,st;function St(){if(st!==void 0)return st;try{let{userAgent:e}=window.navigator;st=Rd.test(e)}catch{st=!1}return st}function we(e){e.preventDefault(),e.stopPropagation()}import{Editor as ai,Path as Ld}from"slate";import{Element as ni}from"slate";function ii(e){if(typeof e=="function")return e;if(typeof e=="string")return o=>ni.isElement(o)&&o.type===e;if(Array.isArray(e))return o=>ni.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=ri(e,o),n=ii(t);if(Ld.isPath(r)){let i=ai.node(e,r);if(i&&n(i[0]))return i}return ai.above(e,{at:r,match:n})}function $e(...e){return E(...e)?.[1]}import{jsx as zd}from"react/jsx-runtime";var y=({strokeWidth:e=1.5,...t})=>zd("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 me(e){return e==null?!1:Bd.isCollapsed(e)}import{Element as li}from"slate";function Rt(e){return Array.isArray(e)?t=>li.isElement(t)&&e.includes(t.type):t=>li.isElement(t)&&e==t.type}import{Editor as Dd}from"slate";function si(e,t){let{selection:o}=e;if(!me(o))return!1;let r=E(e,t,{at:o});return!!r&&Dd.isEnd(e,o.anchor,r[1])}import{Editor as P1}from"slate";import{Editor as Nd}from"slate";function Ie(e,t){let{selection:o}=e;if(!me(o))return!1;let r=E(e,t,{at:o});return!!r&&Nd.isStart(e,o.anchor,r[1])}import{isHotkey as mi}from"is-hotkey";import{Editor as zo,Element as $d,Range as Hd,Transforms as Ad}from"slate";var Od=mi(" "),Ud=mi("SHIFT+SPACE");function ci(e,t){return o=>{if(!Od(o.nativeEvent)&&!Ud(o.nativeEvent))return!1;let{selection:r}=e;if(r===null||Hd.isExpanded(r))return!1;let n=E(e,m=>$d.isElement(m)&&e.convertElement.isConvertibleElement(m));if(!n)return!1;let i={anchor:zo.start(e,n[1]),focus:r.focus},a=zo.string(e,i),l=t[a];if(!l)return!1;we(o);let s={anchor:zo.start(e,n[1]),focus:r.focus};return Ad.delete(e,{at:s}),l(),!0}}import{isHotkey as Fd}from"is-hotkey";function pi(e){let t=e.replace(/\bsuper\b/g,St()?"cmd+alt":"ctrl+shift");return Fd(t)}function N(e){let t=null;return function(r){t==null&&(t=Object.entries(e).map(([n,i])=>[pi(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 Vd,Transforms as di}from"slate";function ui(e,t){Vd.withoutNormalizing(e,()=>{di.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:"123"},{at:t}),di.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:null},{at:t})})}import{Editor as fi}from"slate";function be(e,t,o){let[,r]=t,n=fi.previous(e,{at:r});if(n&&o(n,t))return!0;let i=fi.next(e,{at:r});return!!(i&&o(t,i))}import{Editor as hi,Transforms as gi}from"slate";function q(e,t){gi.select(e,hi.start(e,t))}function bi(e,t){gi.select(e,hi.end(e,t))}function Ei(e,t){return typeof t!="function"?t:t(e)}import{Editor as Bo,Element as Kd,Path as _d,Transforms as mt}from"slate";function xi(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=E(e,n=>Kd.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=_d.next(r[1]);Bo.withoutNormalizing(e,()=>{mt.insertNodes(e,t,{at:n}),mt.select(e,Bo.start(e,n))})}return!0}import{Editor as yi,Transforms as ki}from"slate";function ct(e,t,o){yi.withoutNormalizing(e,()=>{let r=yi.node(e,o),n=Ei(r[0],t);ki.wrapNodes(e,n,{at:o}),ki.unwrapNodes(e,{at:[...o,0]})})}import{Editor as Wd,Transforms as Gd}from"slate";function Lt(e,t,o){let r=Array.from(Wd.nodes(e,o));if(r.length===0)return!1;for(let n of r){let[i]=n;Gd.setNodes(e,t(i),{at:n[1]})}return!0}function vi(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 qd(n)?(t.preventDefault(),t.stopPropagation(),e.anchor.insertLink(n),!0):!1}function qd(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 Xd,Transforms as Do}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(Do.setNodes(e,{href:t,title:o},{at:l}),r!==void 0){let s=Xd.string(a);r!==s&&Qd.withoutNormalizing(e,()=>{let m=a.children.length;for(let c=m-1;c>=0;c--)Do.removeNodes(e,{at:[...l,c]});Do.insertNodes(e,{text:r},{at:[...l,0]})})}return!0}import{Editor as zt,Element as jd,Range as Yd,Text as Jd,Transforms as No}from"slate";function wi(e,t,o=t,{select:r=!0,title:n}={}){let i=e.selection||{anchor:zt.start(e,[0]),focus:zt.start(e,[0])};if(Yd.isCollapsed(i)){if(No.insertNodes(e,{type:"anchor",href:t,title:n,children:[{text:o}]},{select:r,at:i}),r&&e.selection){let a=zt.node(e,e.selection);No.select(e,a[1])}}else No.wrapNodes(e,{type:"anchor",href:t,title:n,children:[]},{split:!0,match:a=>Jd.isText(a)||jd.isElement(a)&&zt.isInline(e,a)})}import{Transforms as Zd}from"slate";function Ii(e,{at:t}){let o=E(e,"anchor",{at:t});return o?(Zd.unwrapNodes(e,{at:o[1]}),!0):!1}function Mi(e){return{insertLink:f(wi,e),removeLink:f(Ii,e),editLink:f(Ti,e)}}import{Element as Pi,Transforms as eu}from"slate";function Ci(e,t){if(!Pi.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(!(!Pi.isElement(n)||n.type!=="anchor"))return eu.unwrapNodes(e,{at:[...t[1],r]}),!0}return!1}import{clsx as Qu}from"clsx";import{useEffect as Xu,useRef as fa}from"react";import{useSelected as ju,useSlate as Yu}from"slate-react";import{createContext as Ri,useState as ou}from"react";import{createPortal as tu}from"react-dom";function Si({children:e}){return typeof document>"u"||!document.body?null:tu(e,document.body)}import{jsx as $o,jsxs as nu}from"react/jsx-runtime";var Ho=Ri({}),ru=Ri({});function Li({children:e}){let[t,o]=ou({});function r(i){o(a=>({...a,[i.type]:i}))}function n(i){o(a=>{let l={...a};return delete l[i],l})}return nu(Ho.Provider,{value:{layers:t,setLayers:o,openLayer:r,closeLayer:n},children:[e,Object.entries(t).map(([,i])=>$o(Si,{children:$o(ru.Provider,{value:i,children:$o(i.Component,{})})},i.type))]})}import{useContext as iu}from"react";function H(e){let{openLayer:t,closeLayer:o,layers:r}=iu(Ho);function n(a){t({type:e,Component:a})}function i(){o(e)}return{open:n,close:i,layer:r[e],type:e}}import Bt from"@emotion/styled";var zi=Bt("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
- `,$o=Lt("span")`
54
+ `,Ao=Bt("span")`
55
55
  display: inline;
56
56
  padding: 0 1px 0 0;
57
- `,Pv=Lt("span")`
57
+ `,zT=Bt("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
- `,Cv=Lt("span")`
66
+ `,BT=Bt("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 Ou from"@emotion/styled";import{useCallback as Ft,useState as Uu}from"react";import{useSlateStatic as Fu}from"slate-react";import{useRef as nu}from"react";import ru from"@emotion/styled";var Li=ru("div")`
73
+ `;import Ku from"@emotion/styled";import{useCallback as Kt,useState as _u}from"react";import{useSlateStatic as Wu}from"slate-react";import{useRef as lu}from"react";import au from"@emotion/styled";var Bi=au("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 iu}from"react/jsx-runtime";function be({close:e}){let t=nu(null);return iu(Li,{ref:t,onClick:e})}var ie={cmd:"\u2318",ctrl:"\u2303",shift:"\u21E7",opt:"\u2325",enter:"\u23CE"},au={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}`},lu={alt:"ALT",ctrl:"CTRL",opt:"ALT",shift:"SHIFT",mod:"CTRL",cmd:"CTRL",enter:ie.enter,super:"CTRL+SHIFT"};function Bi(e,t){let o=e.findIndex(r=>r===t);o!==-1&&e.splice(o,1)}function su(e){let t=[];return Object.entries(au).forEach(([o,r])=>{e.includes(o)&&(t.push(r),Bi(e,o))}),t.push(...e.map(o=>o.toUpperCase())),t.join("")}function mu(e){let t=[];return Object.entries(lu).forEach(([o,r])=>{e.includes(o)&&(t.push(r),Bi(e,o))}),t.push(...e.map(o=>o.toUpperCase())),t.join("+")}function Bt(e){let t=e.toLowerCase().split("+");return Pt()?su(t):mu(t)}import{useRef as yu}from"react";import{useSlateStatic as ku}from"slate-react";function Ho(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 zi(e){let t=Ho(e),{scrollY:o}=window;return Object.assign(t,{top:t.top+o,bottom:t.bottom+o})}function Ao(){let e=document.documentElement.clientWidth||document.body.clientWidth;return{top:0,right:e,bottom:window.innerHeight,left:0,width:e,height:window.innerHeight}}function Di(){let e=Ao();return Object.assign(e,{top:window.scrollY,bottom:window.scrollY+e.height})}var Ni=cu;function cu(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 Oo(e,t){return Ni(e,r=>{let n=r instanceof HTMLElement?r:r.current;return n?t(n):null})}import{useEffect as uu}from"react";import pu from"lodash.throttle";import{useState as du}from"react";function zt(e=100){let[t,o]=du(0),r=pu(()=>{o(n=>n+1)},e,{trailing:!0});return Object.assign(r,{counter:t})}function Uo(){let e=zt();return uu(()=>(e(),window.addEventListener("resize",e),window.addEventListener("scroll",e),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e)}),[]),e}function j(e,t){let o=Uo(),r=Oo(e,n=>zi(n));return t(r,Di(),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 Fo from"@emotion/styled";import fu from"@emotion/styled";var X=fu(at)`
82
+ `;import{jsx as su}from"react/jsx-runtime";function Ee({close:e}){let t=lu(null);return su(Bi,{ref:t,onClick:e})}var ae={cmd:"\u2318",ctrl:"\u2303",shift:"\u21E7",opt:"\u2325",enter:"\u23CE"},mu={shift:ae.shift,opt:ae.opt,alt:ae.opt,ctrl:ae.ctrl,mod:ae.cmd,cmd:ae.cmd,enter:ae.enter,super:`${ae.opt}${ae.cmd}`},cu={alt:"ALT",ctrl:"CTRL",opt:"ALT",shift:"SHIFT",mod:"CTRL",cmd:"CTRL",enter:ae.enter,super:"CTRL+SHIFT"};function Di(e,t){let o=e.findIndex(r=>r===t);o!==-1&&e.splice(o,1)}function pu(e){let t=[];return Object.entries(mu).forEach(([o,r])=>{e.includes(o)&&(t.push(r),Di(e,o))}),t.push(...e.map(o=>o.toUpperCase())),t.join("")}function du(e){let t=[];return Object.entries(cu).forEach(([o,r])=>{e.includes(o)&&(t.push(r),Di(e,o))}),t.push(...e.map(o=>o.toUpperCase())),t.join("+")}function Dt(e){let t=e.toLowerCase().split("+");return St()?pu(t):du(t)}import{useRef as wu}from"react";import{useSlateStatic as Iu}from"slate-react";function Oo(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 Ni(e){let t=Oo(e),{scrollY:o}=window;return Object.assign(t,{top:t.top+o,bottom:t.bottom+o})}function Uo(){let e=document.documentElement.clientWidth||document.body.clientWidth;return{top:0,right:e,bottom:window.innerHeight,left:0,width:e,height:window.innerHeight}}function $i(){let e=Uo();return Object.assign(e,{top:window.scrollY,bottom:window.scrollY+e.height})}var Hi=uu;function uu(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 Fo(e,t){return Hi(e,r=>{let n=r instanceof HTMLElement?r:r.current;return n?t(n):null})}import{useEffect as bu}from"react";import fu from"lodash.throttle";import{useMemo as hu,useState as gu}from"react";function Nt(e=100){let[t,o]=gu(0),r=hu(()=>fu(()=>{o(n=>n+1)},e,{trailing:!0}),[e]);return Object.assign(r,{counter:t})}function Vo(){let e=Nt();return bu(()=>(e(),window.addEventListener("resize",e),window.addEventListener("scroll",e),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e)}),[]),e}function j(e,t){let o=Vo(),r=Fo(e,n=>Ni(n));return t(r,$i(),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 Ko from"@emotion/styled";import Eu from"@emotion/styled";var Y=Eu(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 $i=Fo(X)`
108
+ `;var Ai=Ko(Y)`
109
109
  width: 24em;
110
110
  padding: 0;
111
111
  overflow: hidden;
112
- `,Nt=Fo("div")`
112
+ `,Ht=Ko("div")`
113
113
  display: flex;
114
114
  gap: 0.5em;
115
- `,$t=Fo("input")`
115
+ `,At=Ko("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 Ai from"@emotion/styled";import hu from"@emotion/styled";var Hi=hu(at)`
126
+ `;import Ui from"@emotion/styled";import xu from"@emotion/styled";var Oi=xu(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,10 +139,10 @@
139
139
  */
140
140
  outline: 2px solid var(--select-editor-color) !important;
141
141
  }
142
- `;var Oi=Ai("div")`
142
+ `;var Fi=Ui("div")`
143
143
  padding: 2em;
144
144
  flex: 1;
145
- `,Ui=Ai(Hi)`
145
+ `,Vi=Ui(Oi)`
146
146
  /**
147
147
  * We use this to make sure the top of the container is rounded even though
148
148
  * the toolbar inside is square. We keep the toolbar square so that as the
@@ -163,7 +163,7 @@
163
163
  overflow-y: clip;
164
164
  display: flex;
165
165
  flex-direction: column;
166
- `;import _o from"@emotion/styled";var Fi=_o(X)`
166
+ `;import _o from"@emotion/styled";var Ki=_o(Y)`
167
167
  position: absolute;
168
168
  padding-top: 0.5em;
169
169
  padding-bottom: 0.5em;
@@ -213,12 +213,12 @@
213
213
  &:hover {
214
214
  background: var(--blue-50);
215
215
  }
216
- `,Vi=_o("div")`
216
+ `,Wi=_o("div")`
217
217
  height: 1px;
218
218
  background: var(--shade-200);
219
219
  margin-top: 0.25em;
220
220
  margin-bottom: 0.25em;
221
- `;import ct from"@emotion/styled";var Ki=ct("div")`
221
+ `;import pt from"@emotion/styled";var Gi=pt("div")`
222
222
  /**
223
223
  * This flex rule applies to the "display: flex;" of the parent container.
224
224
  * Ensures the toolbar does not shrink or grow vertically.
@@ -257,22 +257,22 @@
257
257
  3em + 1px
258
258
  ); // $ToolbarDivider height + border-bottom of 1px above
259
259
  overflow: hidden;
260
- `,Wi=ct("div")`
260
+ `,qi=pt("div")`
261
261
  display: inline-block;
262
262
  height: calc(
263
263
  3em + 1px
264
264
  ); // $ToolbarDivider height + border-bottom of 1px above
265
- `,Gi=ct("div")`
265
+ `,Qi=pt("div")`
266
266
  display: inline-block;
267
267
  height: 3em;
268
268
  padding: 0 0.375em;
269
- `,qi=ct("div")`
269
+ `,Xi=pt("div")`
270
270
  display: inline-block;
271
271
  background: var(--shade-300);
272
272
  opacity: 50%;
273
273
  width: 1px;
274
274
  height: 3em;
275
- `,Qi=ct("div")`
275
+ `,ji=pt("div")`
276
276
  box-sizing: border-box;
277
277
  position: relative;
278
278
  display: inline-block;
@@ -322,7 +322,7 @@
322
322
  margin-left: -0.25em;
323
323
  opacity: 0.375;
324
324
  }
325
- `;import{useCallback as gu}from"react";import{ReactEditor as bu}from"slate-react";import{Fragment as xu,jsx as $e,jsxs as Eu}from"react/jsx-runtime";function ji({editor:e,item:t,close:o,dest:r}){let n=H("menu"),i=gu(()=>{if(t.Component){let a=t.Component;n.open(()=>$e(a,{dest:r,close:n.close}))}else t.action&&(t.action(e),bu.focus(e),o())},[e,t]);return $e(xu,{children:Eu(_i,{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 Tu,jsx as Ht,jsxs as vu}from"react/jsx-runtime";function He({dest:e,items:t,close:o}){let r=ku(),n=yu(null),i=j({src:n,dest:e},({dest:a})=>({left:a.left-8,top:a.top+a.height}));return vu(Tu,{children:[Ht(be,{close:o}),Ht(Fi,{ref:n,style:i,children:t.map((a,l)=>a==="divider"?Ht(Vi,{},l):a.show&&!a.show(r)?null:Ht(ji,{editor:r,item:a,close:o,dest:e},l))})]})}import{useCallback as Zi}from"react";import Xi from"@emotion/styled";import{jsx as Mu,jsxs as Pu}from"react/jsx-runtime";function Vo(e){return e.getBoundingClientRect()}var wu=Xi("div")`
325
+ `;import{useCallback as yu}from"react";import{ReactEditor as ku}from"slate-react";import{Fragment as Tu,jsx as He,jsxs as vu}from"react/jsx-runtime";function Yi({editor:e,item:t,close:o,dest:r}){let n=H("menu"),i=yu(()=>{if(t.Component){let a=t.Component;n.open(()=>He(a,{dest:r,close:n.close}))}else t.action&&(t.action(e),ku.focus(e),o())},[e,t]);return He(Tu,{children:vu(_i,{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 Mu,jsx as Ot,jsxs as Pu}from"react/jsx-runtime";function Ae({dest:e,items:t,close:o}){let r=Iu(),n=wu(null),i=j({src:n,dest:e},({dest:a})=>a?{left:a.left-8,top:a.top+a.height}:{left:0,top:0});return Pu(Mu,{children:[Ot(Ee,{close:o}),Ot(Ki,{ref:n,style:i,children:t.map((a,l)=>a==="divider"?Ot(Wi,{},l):a.show&&!a.show(r)?null:Ot(Yi,{editor:r,item:a,close:o,dest:e},l))})]})}import{useCallback as ta}from"react";import Ji from"@emotion/styled";import{jsx as Ru,jsxs as Lu}from"react/jsx-runtime";function Wo(e){return e.getBoundingClientRect()}var Cu=Ji("div")`
326
326
  position: fixed;
327
327
  z-index: 10;
328
328
  -webkit-font-smoothing: antialiased;
@@ -338,12 +338,12 @@
338
338
  background: var(--shade-700);
339
339
  border-radius: 0.25em;
340
340
  white-space: nowrap;
341
- `,Iu=Xi("span")`
341
+ `,Su=Ji("span")`
342
342
  margin-left: 0.75em;
343
343
  font-size: 0.875em;
344
344
  font-weight: 500;
345
345
  color: var(--shade-400);
346
- `;function Yi({title:e,hotkey:t,dest:o}){let r=Vo(o);return Pu(wu,{style:{left:r.left,top:`calc(${r.top}px - 2em)`},children:[e,t?Mu(Iu,{children:t}):null]})}import Cu from"@emotion/styled";import{jsx as Ru}from"react/jsx-runtime";var Su=Cu("span")`
346
+ `;function Zi({title:e,hotkey:t,dest:o}){let r=Wo(o);return Lu(Cu,{style:{left:r.left,top:`calc(${r.top}px - 2em)`},children:[e,t?Ru(Su,{children:t}):null]})}import zu from"@emotion/styled";import{jsx as Du}from"react/jsx-runtime";var Bu=zu("span")`
347
347
  position: fixed;
348
348
  z-index: 10;
349
349
  width: 0;
@@ -351,7 +351,7 @@
351
351
  border-left: 0.375em solid transparent;
352
352
  border-right: 0.375em solid transparent;
353
353
  border-top: 0.375em solid var(--shade-700);
354
- `;function Ji({dest:e}){let t=Vo(e);return Ru(Su,{style:{left:`calc(${t.left+t.width/2}px - 0.375em)`,top:`calc(${t.top}px - 0.5em)`}})}import{jsx as ea}from"react/jsx-runtime";function Y({title:e,hotkey:t},o=[]){let r=H("tooltip-label"),n=H("tooltip-triangle"),i=Zi(l=>{let s=l.currentTarget;e!==void 0&&(r.open(()=>ea(Yi,{title:e,hotkey:typeof t=="function"?t():t,dest:s})),n.open(()=>ea(Ji,{dest:s})))},o),a=Zi(()=>{r.close(),n.close()},o);return{onMouseEnter:i,onMouseLeave:a}}import Du from"@emotion/styled";import{useCallback as Oe,useRef as Nu,useState as Ot}from"react";import{Node as $u}from"slate";import{useSlateStatic as Hu}from"slate-react";import Ee from"@emotion/styled";var Ae=Ee("div")`
354
+ `;function ea({dest:e}){let t=Wo(e);return Du(Bu,{style:{left:`calc(${t.left+t.width/2}px - 0.375em)`,top:`calc(${t.top}px - 0.5em)`}})}import{jsx as oa}from"react/jsx-runtime";function J({title:e,hotkey:t},o=[]){let r=H("tooltip-label"),n=H("tooltip-triangle"),i=ta(l=>{let s=l.currentTarget;e!==void 0&&(r.open(()=>oa(Zi,{title:e,hotkey:typeof t=="function"?t():t,dest:s})),n.open(()=>oa(ea,{dest:s})))},o),a=ta(()=>{r.close(),n.close()},o);return{onMouseEnter:i,onMouseLeave:a}}import Au from"@emotion/styled";import{useCallback as Ue,useRef as Ou,useState as Ft}from"react";import{Node as Uu}from"slate";import{useSlateStatic as Fu}from"slate-react";import xe from"@emotion/styled";var Oe=xe("div")`
355
355
  margin: 0.5em 0;
356
356
  &:first-of-type {
357
357
  margin-top: 0;
@@ -359,15 +359,15 @@
359
359
  &:last-of-type {
360
360
  margin-bottom: 0;
361
361
  }
362
- `,At=Ee("div")`
362
+ `,Ut=xe("div")`
363
363
  font-size: 0.9375em;
364
364
  margin-bottom: 0.25em;
365
365
  color: var(--shade-700);
366
- `,Ko=Ee("div")`
366
+ `,Go=xe("div")`
367
367
  font-size: 0.875em;
368
368
  margin-top: 0.25em;
369
369
  color: var(--shade-500);
370
- `,ta=Ee("input")`
370
+ `,ra=xe("input")`
371
371
  box-sizing: border-box;
372
372
  width: 100%;
373
373
  height: 6em;
@@ -381,7 +381,7 @@
381
381
  &:focus {
382
382
  outline: 2px solid var(--blue-200);
383
383
  }
384
- `,Wo=Ee("input")`
384
+ `,qo=xe("input")`
385
385
  box-sizing: border-box;
386
386
  width: 100%;
387
387
  padding: 0.5em 0.75em;
@@ -393,7 +393,7 @@
393
393
  &:focus {
394
394
  outline: 2px solid var(--blue-200);
395
395
  }
396
- `,oa=Ee("div")`
396
+ `,na=xe("div")`
397
397
  /* Center vertically and horizontally */
398
398
  display: flex;
399
399
  align-items: center;
@@ -407,7 +407,7 @@
407
407
  font-size: 1.25em;
408
408
  stroke-width: 2px;
409
409
  }
410
- `,ra=Ee(oa)`
410
+ `,ia=xe(na)`
411
411
  color: var(--blue-50);
412
412
  background: var(--blue-500);
413
413
  outline: 0px solid white;
@@ -419,7 +419,7 @@
419
419
  svg {
420
420
  color: var(--blue-200);
421
421
  }
422
- `,na=Ee(oa)`
422
+ `,aa=xe(na)`
423
423
  color: var(--shade-500);
424
424
  background: var(--shade-200);
425
425
  outline: 0px solid white;
@@ -431,7 +431,7 @@
431
431
  svg {
432
432
  color: var(--shade-400);
433
433
  }
434
- `;import{useRef as Lu,useCallback as Ie}from"react";import aa from"@emotion/styled";import{jsx as ia}from"react/jsx-runtime";var Bu=aa.div`
434
+ `;import{useRef as Nu,useCallback as Me}from"react";import sa from"@emotion/styled";import{jsx as la}from"react/jsx-runtime";var $u=sa.div`
435
435
  display: flex;
436
436
  align-items: center;
437
437
  justify-content: center;
@@ -446,17 +446,17 @@
446
446
  &:active {
447
447
  cursor: grabbing;
448
448
  }
449
- `,zu=aa.div`
449
+ `,Hu=sa.div`
450
450
  width: 32px;
451
451
  height: 4px;
452
452
  background: #ccc;
453
453
  border-radius: 2px;
454
- `;function xe({onDrag:e}){let t=Lu(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 ia(Bu,{onMouseDown:i,onTouchStart:a,onTouchMove:l,onTouchEnd:s,children:ia(zu,{})})}import{jsx as _,jsxs as pt}from"react/jsx-runtime";var Au=Du(X)`
454
+ `;function ye({onDrag:e}){let t=Nu(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 la($u,{onMouseDown:i,onTouchStart:a,onTouchMove:l,onTouchEnd:s,children:la(Hu,{})})}import{jsx as K,jsxs as dt}from"react/jsx-runtime";var Vu=Au(Y)`
455
455
  position: absolute;
456
456
  width: 20em;
457
457
  padding: 0;
458
458
  overflow: hidden;
459
- `;function la({destAnchor:e,destStartEdge:t,element:o}){let r=H("dialog"),[n,i]=Ot({x:0,y:0}),a=Oe((v,I)=>{i(k=>({x:k.x+v,y:k.y+I}))},[]),l=j({destAnchor:e,destStartEdge:t},({destAnchor:v,destStartEdge:I})=>({left:I.left,top:v.top+v.height})),s={...l,left:l.left+n.x,top:l.top+n.y},m=Hu(),[c,d]=Ot(o.href),[p,g]=Ot($u.string(o)),[b,T]=Ot(o.title||""),C=Nu({href:c,text:p,title:b});C.current={href:c,text:p,title:b};let P=Oe(v=>{d(v.target.value)},[]),w=Oe(v=>{g(v.target.value)},[]),S=Oe(v=>{T(v.target.value)},[]),M=Oe(()=>{r.open(()=>_(Ut,{destAnchor:e,destStartEdge:t,element:o}))},[e,t,o]),N=Oe(()=>{let{href:v,text:I,title:k}=C.current;m.anchor.editLink({href:v,text:I,title:k},{at:o}),M()},[M]);return pt(Au,{contentEditable:!1,style:s,children:[_(xe,{onDrag:a}),pt("div",{style:{padding:"1em"},children:[pt(Ae,{children:[_(At,{children:f("linkUrl")}),_(ta,{as:"textarea",value:c,onChange:P})]}),pt(Ae,{children:[_(At,{children:f("linkText")}),_(Wo,{type:"text",value:p,onChange:w}),_(Ko,{children:f("linkTextHint")})]}),pt(Ae,{children:[_(At,{children:f("tooltipText")}),_(Wo,{type:"text",value:b,onChange:S}),_(Ko,{children:f("tooltipHint")})]}),_(Ae,{children:_(ra,{onClick:N,children:f("apply")})}),_(Ae,{children:_(na,{onClick:M,children:f("cancel")})})]})]})}import{jsx as ye}from"react/jsx-runtime";var sa=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"})}),ma=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"})}),ca=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"})}),pa=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 _u=Ou(X)`
459
+ `;function ma({destAnchor:e,destStartEdge:t,element:o}){let r=H("dialog"),[n,i]=Ft({x:0,y:0}),a=Ue((T,x)=>{i(I=>({x:I.x+T,y:I.y+x}))},[]),l=j({destAnchor:e,destStartEdge:t},({destAnchor:T,destStartEdge:x})=>({left:x.left,top:T.top+T.height})),s={...l,left:l.left+n.x,top:l.top+n.y},m=Fu(),[c,d]=Ft(o.href),[p,u]=Ft(Uu.string(o)),[h,v]=Ft(o.title||""),S=Ou({href:c,text:p,title:h});S.current={href:c,text:p,title:h};let P=Ue(T=>{d(T.target.value)},[]),M=Ue(T=>{u(T.target.value)},[]),B=Ue(T=>{v(T.target.value)},[]),C=Ue(()=>{r.open(()=>K(Vt,{destAnchor:e,destStartEdge:t,element:o}))},[e,t,o]),D=Ue(()=>{let{href:T,text:x,title:I}=S.current;m.anchor.editLink({href:T,text:x,title:I},{at:o}),C()},[C]);return dt(Vu,{contentEditable:!1,style:s,children:[K(ye,{onDrag:a}),dt("div",{style:{padding:"1em"},children:[dt(Oe,{children:[K(Ut,{children:g("linkUrl")}),K(ra,{as:"textarea",value:c,onChange:P})]}),dt(Oe,{children:[K(Ut,{children:g("linkText")}),K(qo,{type:"text",value:p,onChange:M}),K(Go,{children:g("linkTextHint")})]}),dt(Oe,{children:[K(Ut,{children:g("tooltipText")}),K(qo,{type:"text",value:h,onChange:B}),K(Go,{children:g("tooltipHint")})]}),K(Oe,{children:K(ia,{onClick:D,children:g("apply")})}),K(Oe,{children:K(aa,{onClick:C,children:g("cancel")})})]})]})}import{jsx as ke}from"react/jsx-runtime";var ca=e=>ke(y,{...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"})}),pa=e=>ke(y,{...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"})}),da=e=>ke(y,{...e,children:ke("path",{d:"M4 20h4L18.5 9.5a1.5 1.5 0 0 0-4-4L4 16v4M13.5 6.5l4 4"})}),ua=e=>ke(y,{...e,children:ke("path",{d:"M18 6L6 18M6 6l12 12"})});import{jsx as Z,jsxs as ut}from"react/jsx-runtime";var Gu=Ku(Y)`
460
460
  position: absolute;
461
461
  width: 20em;
462
462
  z-index: 1000;
@@ -540,10 +540,10 @@
540
540
  height: 1.25em;
541
541
  stroke-width: 1.5;
542
542
  }
543
- `;function Vu(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=Fu(),i=Vu(o.href),[a,l]=Uu({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"}),g=Y({title:"\u9589\u3058\u308B"}),b=Ft(()=>{r.close()},[r]),T=Ft(()=>{n.anchor.removeLink({at:o}),r.close()},[n,r]),C=Ft(()=>{p.onMouseLeave(),r.open(()=>J(la,{destAnchor:e,destStartEdge:t,element:o}))},[e,t,o]);return dt(_u,{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(sa,{}),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:T,onMouseEnter:d.onMouseEnter,onMouseLeave:d.onMouseLeave,children:J(ma,{})}),J("span",{className:"--icon",onMouseEnter:p.onMouseEnter,onMouseLeave:p.onMouseLeave,onClick:C,children:J(ca,{})}),J("span",{className:"--icon",onClick:b,onMouseEnter:g.onMouseEnter,onMouseLeave:g.onMouseLeave,children:J(pa,{})})]})]})]})}import{jsx as _t,jsxs as Qu}from"react/jsx-runtime";function ua({element:e,attributes:t,children:o}){let r=da(null),n=da(null),i=Gu(),a=qu(),l=H("dialog");return Wu(()=>{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(()=>_t(Ut,{destAnchor:s,destStartEdge:m,element:e}))}):l.close()},[i,e]),Qu(Ri,{className:Ku({"--selected":i}),href:e.href,target:e.target,...t,ref:n,children:[_t($o,{ref:r,contentEditable:!1}),_t("span",{children:o}),_t($o,{contentEditable:!1})]})}import{jsx as ju}from"react/jsx-runtime";var fa=y((e,t,{createPolicy:o})=>(e.anchor=wi(e),o({name:"anchor",editor:{isInline(r){if(r.type==="anchor")return!0},normalizeNode:u(Mi,e)},editableProps:{onPaste:u(yi,e),renderElement:({element:r,attributes:n,children:i})=>{if(r.type==="anchor")return ju(ua,{element:r,attributes:n,children:i})}}})));import{Editor as Vt,Transforms as ba}from"slate";import{Element as ha,Path as ga}from"slate";function Go(e,t,o){if(!t||!o||ga.equals(t[1],o[1]))return!0;let r=E(e,i=>ha.isElement(i)&&e.isMaster(i),{at:t[1]}),n=E(e,i=>ha.isElement(i)&&e.isMaster(i),{at:o[1]});return!!(!r&&!n||r&&n&&ga.equals(r[1],n[1]))}var Ea=y(e=>(e.atomicDelete=!0,{name:"atomic-delete",editor:{deleteBackward(){if(e.selection==null)return!1;let t=Vt.node(e,e.selection),o=Vt.previous(e,{mode:"lowest"});return Go(e,t,o)?!1:(ba.move(e,{unit:"character",reverse:!0}),!0)},deleteForward(){if(e.selection==null)return!1;let t=Vt.node(e,e.selection),o=Vt.next(e,{mode:"lowest"});return Go(e,t,o)?!1:(ba.move(e,{unit:"character"}),!0)}}}));import{Transforms as Hf}from"slate";import{ReactEditor as Af}from"slate-react";import{Editor as Xu,Transforms as xa}from"slate";import{ReactEditor as Yu}from"slate-react";function Ju(e){}function Zu(e,t,o,r){let{selection:n}=e;if(xa.insertNodes(e,{type:"image-block",url:t,alt:o||"",title:r||"",width:320,height:240,children:[{text:""}]}),!n){let i=Xu.end(e,[]);xa.select(e,i),Yu.focus(e)}}function ya(e){return{noop:u(Ju,e),insertImageFromUrl:u(Zu,e)}}function ka(e,t){return!1}import{useSlateStatic as Bf}from"slate-react";import ef from"@emotion/styled";var Ta=ef("div")`
543
+ `;function qu(e){try{let t=new URL(e);return{hostname:t.hostname,pathname:t.pathname}}catch{return{hostname:"",pathname:""}}}function Vt({destAnchor:e,destStartEdge:t,element:o}){let r=H("dialog"),n=Wu(),i=qu(o.href),[a,l]=_u({x:0,y:0}),s=Kt((P,M)=>{l(B=>({x:B.x+P,y:B.y+M}))},[]),m=j({destAnchor:e,destStartEdge:t},({destAnchor:P,destStartEdge:M})=>({left:M.left,top:P.top+P.height})),c={...m,left:m.left+a.x,top:m.top+a.y},d=J({title:"\u30EA\u30F3\u30AF\u3092\u524A\u9664"}),p=J({title:"\u30EA\u30F3\u30AF\u3092\u7DE8\u96C6"}),u=J({title:"\u9589\u3058\u308B"}),h=Kt(()=>{r.close()},[r]),v=Kt(()=>{n.anchor.removeLink({at:o}),r.close()},[n,r]),S=Kt(()=>{p.onMouseLeave(),r.open(()=>Z(ma,{destAnchor:e,destStartEdge:t,element:o}))},[e,t,o]);return ut(Gu,{contentEditable:!1,style:c,children:[Z(ye,{onDrag:s}),ut("div",{style:{display:"flex",padding:"1em"},children:[ut("a",{className:"--link",href:o.href,target:"_blank",rel:"noreferrer",children:[Z(ca,{}),ut("div",{className:"--url",children:[Z("div",{className:"--hostname",children:i.hostname}),i.pathname===""||i.pathname==="/"?null:Z("div",{className:"--pathname",children:i.pathname}),o.title==null||o.title===""?null:Z("div",{className:"--tooltip",children:o.title})]})]}),ut("span",{className:"--icons",children:[Z("span",{className:"--icon",onClick:v,onMouseEnter:d.onMouseEnter,onMouseLeave:d.onMouseLeave,children:Z(pa,{})}),Z("span",{className:"--icon",onMouseEnter:p.onMouseEnter,onMouseLeave:p.onMouseLeave,onClick:S,children:Z(da,{})}),Z("span",{className:"--icon",onClick:h,onMouseEnter:u.onMouseEnter,onMouseLeave:u.onMouseLeave,children:Z(ua,{})})]})]})]})}import{jsx as _t,jsxs as Ju}from"react/jsx-runtime";function ha({element:e,attributes:t,children:o}){let r=fa(null),n=fa(null),i=ju(),a=Yu(),l=H("dialog");return Xu(()=>{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(()=>_t(Vt,{destAnchor:s,destStartEdge:m,element:e}))}):l.close()},[i,e]),Ju(zi,{className:Qu({"--selected":i}),href:e.href,target:e.target,...t,ref:n,children:[_t(Ao,{ref:r,contentEditable:!1}),_t("span",{children:o}),_t(Ao,{contentEditable:!1})]})}import{jsx as Zu}from"react/jsx-runtime";var ga=k((e,t,{createPolicy:o})=>(e.anchor=Mi(e),o({name:"anchor",editor:{isInline(r){if(r.type==="anchor")return!0},normalizeNode:f(Ci,e)},editableProps:{onPaste:f(vi,e),renderElement:({element:r,attributes:n,children:i})=>{if(r.type==="anchor")return Zu(ha,{element:r,attributes:n,children:i})}}})));import{Editor as Wt,Transforms as xa}from"slate";import{Element as ba,Path as Ea}from"slate";function Qo(e,t,o){if(!t||!o||Ea.equals(t[1],o[1]))return!0;let r=E(e,i=>ba.isElement(i)&&e.isMaster(i),{at:t[1]}),n=E(e,i=>ba.isElement(i)&&e.isMaster(i),{at:o[1]});return!!(!r&&!n||r&&n&&Ea.equals(r[1],n[1]))}var ya=k(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:(xa.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:(xa.move(e,{unit:"character"}),!0)}}}));import{Transforms as Kf}from"slate";import{ReactEditor as _f}from"slate-react";import{Editor as ef,Transforms as ka}from"slate";import{ReactEditor as tf}from"slate-react";function of(e){}function rf(e,t,o,r){let{selection:n}=e;if(ka.insertNodes(e,{type:"image-block",url:t,alt:o||"",title:r||"",width:320,height:240,children:[{text:""}]}),!n){let i=ef.end(e,[]);ka.select(e,i),tf.focus(e)}}function va(e){return{noop:f(of,e),insertImageFromUrl:f(rf,e)}}function Ta(e,t){return!1}import{useSlateStatic as Af}from"slate-react";import nf from"@emotion/styled";var wa=nf("div")`
544
544
  display: block;
545
545
  margin: 1em 0;
546
- `;import{clsx as Sf}from"clsx";import{useState as rl}from"react";import{useSelected as Rf}from"slate-react";import va from"@emotion/styled";var wa=va("span")`
546
+ `;import{clsx as Nf}from"clsx";import{useState as il}from"react";import{useSelected as $f}from"slate-react";import Ia from"@emotion/styled";var Ma=Ia("span")`
547
547
  /**
548
548
  * In order for this container to wrap tightly (without space), it needs to be
549
549
  * an "inline-block". If it's just an "inline" we end up with spacing
@@ -555,7 +555,7 @@
555
555
  * so that we can place UI controls for the image in and around the image.
556
556
  */
557
557
  position: relative;
558
- `,Ia=va("img")`
558
+ `,Pa=Ia("img")`
559
559
  /**
560
560
  * TODO:
561
561
  *
@@ -617,7 +617,7 @@
617
617
  .--dragging > & {
618
618
  transition: border-radius 250ms;
619
619
  }
620
- `;import{clsx as af}from"clsx";import{useCallback as La}from"react";import{Transforms as Ba}from"slate";import{ReactEditor as Qo,useSlateStatic as lf}from"slate-react";import{useEffect as tf}from"react";function Ma(){let e=zt();return tf(()=>(e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}),[]),e}import Pa from"@emotion/styled";var Ca=Pa("span")`
620
+ `;import{clsx as cf}from"clsx";import{useCallback as Ba,useEffect as pf,useRef as qt}from"react";import{Transforms as Da}from"slate";import{ReactEditor as jo,useSlateStatic as df}from"slate-react";import{useEffect as af}from"react";function Ca(){let e=Nt();return af(()=>(e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}),[]),e}import Sa from"@emotion/styled";var Ra=Sa("span")`
621
621
  position: absolute;
622
622
  display: block;
623
623
  /**
@@ -644,7 +644,7 @@
644
644
  /* background: green; */
645
645
  width: 1.25em;
646
646
  }
647
- `,Sa=Pa("span")`
647
+ `,La=Sa("span")`
648
648
  position: absolute;
649
649
  display: block;
650
650
  background: var(--select-color);
@@ -737,7 +737,7 @@
737
737
  .--small > & > .--bar-right {
738
738
  left: calc(50% + 1px);
739
739
  }
740
- `;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 of}from"slate-react";function Kt(e,t){e=Math.round(e);let o=t.width/t.height;return{width:e,height:Math.round(e/o)}}function rf(e,t){e=Math.round(e);let o=t.width/t.height;return{width:Math.round(e*o),height:e}}function nf(e,t){let o=e.width/e.height,r=t.width/t.height;if(o>=r){if(e.width>t.width)return Kt(t.width,e)}else if(e.height>t.width)return rf(t.height,e);return e}function Me(e,t,o){switch(o.type){case"bounds":return nf(t,o);case"scale":return{width:Math.round(t.width*o.scale),height:Math.round(t.height*o.scale)}}}function Ra(e){let t=of.toDOMNode(e,e),o=getComputedStyle(t),r=parseInt(o.paddingLeft)+parseInt(o.paddingRight);return t.clientWidth-r}import{Fragment as cf,jsx as ut,jsxs as mf}from"react/jsx-runtime";function sf(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 za({element:e,srcSize:t,size:o,setSize:r,isDragging:n,setIsDragging:i}){let a=lf();Ma();let l=Ra(a),s=o.width,m=Math.min(t.width,l),c=Math.min(12,t.width),d=La(b=>{ve(b),i(!0);let T=b.clientX,P=sf(a,e).width,w={...o},S=N=>{let v=qo({value:P+N.clientX-T,min:c,max:m});w=Kt(v,t),r(w)},M=()=>{document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",M);let N=Qo.findPath(a,e),v={width:w.width,height:w.height};r(v),Ba.setNodes(a,v,{at:N}),i(!1)};document.addEventListener("mousemove",S),document.addEventListener("mouseup",M)},[t.width,t.height,o.width,e]),p=La(b=>{ve(b),i(!0);let T=b.changedTouches[0].clientX,C=o.width,P={...o},w=M=>{let N=M.changedTouches[0],v=qo({value:C+N.clientX-T,min:c,max:m});P=Kt(v,t),r(P)},S=()=>{document.removeEventListener("touchmove",w),document.removeEventListener("touchend",S);let M=Qo.findPath(a,e);Ba.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]),g=af({"--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(cf,{children:ut(Ca,{className:g,onMouseDown:d,onTouchStart:p,children:mf(Sa,{children:[ut("span",{className:"--bar --bar-left"}),ut("span",{className:"--bar --bar-center"}),ut("span",{className:"--bar --bar-right"})]})})})}import pf from"@emotion/styled";var Da=pf("span")`
740
+ `;function Xo({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 lf}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 sf(e,t){e=Math.round(e);let o=t.width/t.height;return{width:Math.round(e*o),height:e}}function mf(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.height)return sf(t.height,e);return e}function Pe(e,t,o){switch(o.type){case"bounds":return mf(t,o);case"scale":return{width:Math.round(t.width*o.scale),height:Math.round(t.height*o.scale)}}}function za(e){let t=lf.toDOMNode(e,e),o=getComputedStyle(t),r=parseInt(o.paddingLeft,10)+parseInt(o.paddingRight,10);return t.clientWidth-r}import{Fragment as hf,jsx as ft,jsxs as ff}from"react/jsx-runtime";function uf(e,t){let r=jo.toDOMNode(e,t).querySelector("img");if(!r)throw new Error("Image Element could not be found but should exist");return r.getBoundingClientRect()}function Na({element:e,srcSize:t,size:o,setSize:r,isDragging:n,setIsDragging:i}){let a=df(),l=qt(null),s=qt(null),m=qt(null),c=qt(null);Ca();let d=za(a),p=o.width,u=Math.min(t.width,d),h=Math.min(12,t.width),v=Ba(M=>{we(M),i(!0);let B=M.clientX,D=uf(a,e).width,T={...o},x=w=>{let O=Xo({value:D+w.clientX-B,min:h,max:u});T=Gt(O,t),r(T)},I=()=>{document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",I),l.current=null,s.current=null;let w=jo.findPath(a,e),O={width:T.width,height:T.height};r(O),Da.setNodes(a,O,{at:w}),i(!1)};l.current=x,s.current=I,document.addEventListener("mousemove",x),document.addEventListener("mouseup",I)},[t.width,t.height,o.width,e]),S=Ba(M=>{we(M),i(!0);let B=M.changedTouches[0].clientX,C=o.width,D={...o},T=I=>{let w=I.changedTouches[0],O=Xo({value:C+w.clientX-B,min:h,max:u});D=Gt(O,t),r(D)},x=()=>{document.removeEventListener("touchmove",T),document.removeEventListener("touchend",x),m.current=null,c.current=null;let I=jo.findPath(a,e);Da.setNodes(a,{width:D.width,height:D.height},{at:I}),i(!1)};m.current=T,c.current=x,document.addEventListener("touchmove",T),document.addEventListener("touchend",x)},[t.width,t.height,o.width,e]);pf(()=>()=>{l.current&&document.removeEventListener("mousemove",l.current),s.current&&document.removeEventListener("mouseup",s.current),m.current&&document.removeEventListener("touchmove",m.current),c.current&&document.removeEventListener("touchend",c.current)},[]);let P=cf({"--center":p<u&&p>h,"--left":p>=u&&p>h,"--right":p<=h&&p<u,"--dragging":n,"--small":p<=64||o.height<=64});return ft(hf,{children:ft(Ra,{className:P,onMouseDown:v,onTouchStart:S,children:ff(La,{children:[ft("span",{className:"--bar --bar-left"}),ft("span",{className:"--bar --bar-center"}),ft("span",{className:"--bar --bar-right"})]})})})}import gf from"@emotion/styled";var $a=gf("span")`
741
741
  position: absolute;
742
742
  /**
743
743
  * The status appears with a 1px gap from the outline.
@@ -759,7 +759,7 @@
759
759
 
760
760
  /* force numbers to be monospaced for better alignment */
761
761
  font-variant-numeric: tabular-nums;
762
- `;import{jsxs as df}from"react/jsx-runtime";function Na({size:e}){return df(Da,{children:[e.width," \xD7 ",e.height]})}import uf from"@emotion/styled";var $a=uf("span")`
762
+ `;import{jsxs as bf}from"react/jsx-runtime";function Ha({size:e}){return bf($a,{children:[e.width," \xD7 ",e.height]})}import Ef from"@emotion/styled";var Aa=Ef("span")`
763
763
  position: absolute;
764
764
  /**
765
765
  * On top of the image +1 for space inside outline, +2 for outline,
@@ -790,7 +790,7 @@
790
790
  }
791
791
  display: flex;
792
792
  gap: 0.25em;
793
- `;import Ha from"@emotion/styled";var Wt=Ha("span")`
793
+ `;import Oa from"@emotion/styled";var Qt=Oa("span")`
794
794
  /* font-size: 0.75em; */
795
795
  border-radius: 0.5em;
796
796
  display: flex;
@@ -803,7 +803,7 @@
803
803
  * see the border of the buttons.
804
804
  */
805
805
  outline: 1px solid white;
806
- `,Ue=Ha("span")`
806
+ `,Fe=Oa("span")`
807
807
  font-size: 0.75em;
808
808
  line-height: 2em;
809
809
  padding: 0 0.625em;
@@ -857,17 +857,17 @@
857
857
  font-size: 1.33em;
858
858
  line-height: 1em;
859
859
  }
860
- `;import{clsx as ff}from"clsx";import{useCallback as hf}from"react";import{Transforms as gf}from"slate";import{ReactEditor as bf,useSlateStatic as Ef}from"slate-react";import{jsx as xf}from"react/jsx-runtime";function Aa({element:e,preset:t,size:o,setSize:r,srcSize:n}){let i=Ef(),a=Me(o,n,t),l=Y({title:t.title,hotkey:`${a.width}x${a.height}`}),s=hf(()=>{let g=bf.findPath(i,e),b=Me(o,n,t);r(b),gf.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=ff({"--disabled":c,"--selected":!c&&d});return xf(Ue,{className:p,onClick:c?void 0:s,onMouseEnter:l.onMouseEnter,onMouseLeave:l.onMouseLeave,children:t.name})}import{jsx as Oa}from"react/jsx-runtime";function Ua({element:e,size:t,setSize:o,srcSize:r,presets:n}){return Oa(Wt,{children:n.map((i,a)=>Oa(Aa,{element:e,preset:i,size:t,setSize:o,srcSize:r},a))})}import{useCallback as Tf}from"react";import{useSlateStatic as vf}from"slate-react";import{jsx as Gt,jsxs as Va}from"react/jsx-runtime";var Fa=e=>Va(x,{...e,children:[Gt("rect",{width:6,height:6,x:4,y:5,rx:1}),Gt("path",{d:"M4 15h16M4 19h16"})]}),_a=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 yf,Transforms as Ka}from"slate";import{ReactEditor as kf}from"slate-react";function Wa(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=kf.findPath(e,t);yf.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 Ga}from"react/jsx-runtime";function qa({element:e}){let t=vf(),o=Y({title:"Inline Image",hotkey:"In a line with text"}),r=Tf(()=>{e.type==="image-block"&&Wa(t,e)},[t,e]);return Ga(Ue,{className:e.type==="image-inline"?"--selected":"",onClick:e.type==="image-inline"?void 0:r,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,children:Ga(_a,{})})}import{useCallback as If}from"react";import{useSlateStatic as Mf}from"slate-react";import{Editor as Qa,Text as ja,Transforms as qt}from"slate";import{ReactEditor as wf}from"slate-react";function Xa(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);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,T=>Qa.isBlock(e,T)&&T.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===""&&qt.removeNodes(e,{at:[...s,c-1]});let g=m[0],b=d===1&&ja.isText(g)&&g.text==="";b&&qt.removeNodes(e,{at:[...s,0]}),qt.liftNodes(e,{at:[...s,b?d-1:d]})})}import{jsx as Ya}from"react/jsx-runtime";function Ja({element:e}){let t=Mf(),o=Y({title:"Block Image",hotkey:"On a line by itself"}),r=If(()=>{e.type==="image-inline"&&Xa(t,e)},[t,e]);return Ya(Ue,{className:e.type==="image-block"?"--selected":"",onClick:e.type==="image-block"?void 0:r,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,children:Ya(Fa,{})})}import{jsx as Za,jsxs as Pf}from"react/jsx-runtime";function el({element:e}){return Pf(Wt,{children:[Za(Ja,{element:e}),Za(qa,{element:e})]})}import{jsx as tl,jsxs as Cf}from"react/jsx-runtime";function ol({element:e,size:t,setSize:o,srcSize:r,presets:n}){return Cf($a,{children:[tl(el,{element:e}),tl(Ua,{element:e,size:t,setSize:o,srcSize:r,presets:n})]})}import{jsx as Qt,jsxs as Lf}from"react/jsx-runtime";function jt({element:e,presets:t}){let o=e.url,r=Rf(),[n,i]=rl(!1),[a,l]=rl(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=Sf({"--selected":r,"--dragging":n,"--small":a&&(a.width<=64||a.height<=64)});return Lf(wa,{className:c,children:[Qt(Ia,{src:o,width:a?.width,height:a?.height}),m?Qt(ol,{element:e,size:a,setSize:l,srcSize:s,presets:t}):null,n&&a?Qt(Na,{size:a}):null,m?Qt(za,{element:e,srcSize:s,isDragging:n,setIsDragging:i,size:a,setSize:l}):null]})}import{jsx as nl,jsxs as zf}from"react/jsx-runtime";function il({element:e,attributes:t,children:o}){let r=Bf();return zf("div",{...t,children:[nl(Ta,{contentEditable:!1,children:nl(jt,{element:e,presets:r.image.imageBlockPresets})}),o]})}import{useSlateStatic as Nf}from"slate-react";import Df from"@emotion/styled";var al=Df("span")`
860
+ `;import{clsx as xf}from"clsx";import{useCallback as yf}from"react";import{Transforms as kf}from"slate";import{ReactEditor as vf,useSlateStatic as Tf}from"slate-react";import{jsx as wf}from"react/jsx-runtime";function Ua({element:e,preset:t,size:o,setSize:r,srcSize:n}){let i=Tf(),a=Pe(o,n,t),l=J({title:t.title,hotkey:`${a.width}x${a.height}`}),s=yf(()=>{let u=vf.findPath(i,e),h=Pe(o,n,t);r(h),kf.setNodes(i,h,{at:u})},[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=xf({"--disabled":c,"--selected":!c&&d});return wf(Fe,{className:p,onClick:c?void 0:s,onMouseEnter:l.onMouseEnter,onMouseLeave:l.onMouseLeave,children:t.name})}import{jsx as Fa}from"react/jsx-runtime";function Va({element:e,size:t,setSize:o,srcSize:r,presets:n}){return Fa(Qt,{children:n.map((i,a)=>Fa(Ua,{element:e,preset:i,size:t,setSize:o,srcSize:r},a))})}import{useCallback as Pf}from"react";import{useSlateStatic as Cf}from"slate-react";import{jsx as Xt,jsxs as Wa}from"react/jsx-runtime";var Ka=e=>Wa(y,{...e,children:[Xt("rect",{width:6,height:6,x:4,y:5,rx:1}),Xt("path",{d:"M4 15h16M4 19h16"})]}),_a=e=>Wa(y,{...e,children:[Xt("rect",{width:6,height:6,x:9,y:5,rx:1}),Xt("path",{d:"M4 7h1M4 11h1M19 7h1M19 11h1M4 15h16M4 19h16"})]});import{Editor as If,Transforms as Ga}from"slate";import{ReactEditor as Mf}from"slate-react";function qa(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=Mf.findPath(e,t);If.withoutNormalizing(e,()=>{let i=Pe(o,r,{name:"initial-inline-image",title:"",type:"bounds",width:24,height:24});Ga.setNodes(e,{type:"image-inline",...i},{at:n}),Ga.wrapNodes(e,{type:"paragraph",children:[]},{at:n})})}import{jsx as Qa}from"react/jsx-runtime";function Xa({element:e}){let t=Cf(),o=J({title:"Inline Image",hotkey:"In a line with text"}),r=Pf(()=>{e.type==="image-block"&&qa(t,e)},[t,e]);return Qa(Fe,{className:e.type==="image-inline"?"--selected":"",onClick:e.type==="image-inline"?void 0:r,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,children:Qa(_a,{})})}import{useCallback as Lf}from"react";import{useSlateStatic as zf}from"slate-react";import{Editor as ja,Element as Sf,Text as Ya,Transforms as jt}from"slate";import{ReactEditor as Rf}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=Rf.findPath(e,t);ja.withoutNormalizing(e,()=>{let i=Pe(o,r,{name:"initial-block-image",title:"",type:"bounds",width:320,height:320});jt.setNodes(e,{type:"image-block",...i},{at:n});let a=E(e,v=>Sf.isElement(v)&&ja.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&&Ya.isText(p)&&p.text===""&&jt.removeNodes(e,{at:[...s,c-1]});let u=m[0],h=d===1&&Ya.isText(u)&&u.text==="";h&&jt.removeNodes(e,{at:[...s,0]}),jt.liftNodes(e,{at:[...s,h?d-1:d]})})}import{jsx as Za}from"react/jsx-runtime";function el({element:e}){let t=zf(),o=J({title:"Block Image",hotkey:"On a line by itself"}),r=Lf(()=>{e.type==="image-inline"&&Ja(t,e)},[t,e]);return Za(Fe,{className:e.type==="image-block"?"--selected":"",onClick:e.type==="image-block"?void 0:r,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,children:Za(Ka,{})})}import{jsx as tl,jsxs as Bf}from"react/jsx-runtime";function ol({element:e}){return Bf(Qt,{children:[tl(el,{element:e}),tl(Xa,{element:e})]})}import{jsx as rl,jsxs as Df}from"react/jsx-runtime";function nl({element:e,size:t,setSize:o,srcSize:r,presets:n}){return Df(Aa,{children:[rl(ol,{element:e}),rl(Va,{element:e,size:t,setSize:o,srcSize:r,presets:n})]})}import{jsx as Yt,jsxs as Hf}from"react/jsx-runtime";function Jt({element:e,presets:t}){let o=e.url,r=$f(),[n,i]=il(!1),[a,l]=il(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=Nf({"--selected":r,"--dragging":n,"--small":a&&(a.width<=64||a.height<=64)});return Hf(Ma,{className:c,children:[Yt(Pa,{src:o,width:a?.width,height:a?.height}),m?Yt(nl,{element:e,size:a,setSize:l,srcSize:s,presets:t}):null,n&&a?Yt(Ha,{size:a}):null,m?Yt(Na,{element:e,srcSize:s,isDragging:n,setIsDragging:i,size:a,setSize:l}):null]})}import{jsx as al,jsxs as Of}from"react/jsx-runtime";function ll({element:e,attributes:t,children:o}){let r=Af();return Of("div",{...t,children:[al(wa,{contentEditable:!1,children:al(Jt,{element:e,presets:r.image.imageBlockPresets})}),o]})}import{useSlateStatic as Ff}from"slate-react";import Uf from"@emotion/styled";var sl=Uf("span")`
861
861
  display: inline;
862
- `;import{jsx as ll,jsxs as $f}from"react/jsx-runtime";function sl({element:e,attributes:t,children:o}){let r=Nf();return $f("span",{...t,style:{display:"inline-block"},children:[ll(al,{contentEditable:!1,children:ll(jt,{element:e,presets:r.image.imageInlinePresets})}),o]})}import{jsx as ml}from"react/jsx-runtime";function cl({element:e,attributes:t,children:o}){switch(e.type){case"image-block":return ml(il,{element:e,attributes:t,children:o});case"image-inline":return ml(sl,{element:e,attributes:t,children:o})}}function Of(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=Af.findEventRange(e,t);n&&Hf.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 Uf={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}]},pl=y((e,t,{createPolicy:o})=>{let r={...Uf,...t.image};return e.image={...ya(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(ka,e)},editableProps:{renderElement:cl,onDrop:Of(e)}})});import{Editor as ft,Element as q,Transforms as Fe}from"slate";import Ff from"@emotion/styled";var dl=Ff("blockquote")`
862
+ `;import{jsx as ml,jsxs as Vf}from"react/jsx-runtime";function cl({element:e,attributes:t,children:o}){let r=Ff();return Vf("span",{...t,style:{display:"inline-block"},children:[ml(sl,{contentEditable:!1,children:ml(Jt,{element:e,presets:r.image.imageInlinePresets})}),o]})}import{jsx as pl}from"react/jsx-runtime";function dl({element:e,attributes:t,children:o}){switch(e.type){case"image-block":return pl(ll,{element:e,attributes:t,children:o});case"image-inline":return pl(cl,{element:e,attributes:t,children:o})}}function Wf(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=_f.findEventRange(e,t);n&&Kf.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 Gf={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}]},ul=k((e,t,{createPolicy:o})=>{let r={...Gf,...t.image};return e.image={...va(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:f(Ta,e)},editableProps:{renderElement:dl,onDrop:Wf(e)}})});import{Editor as ht,Element as Q,Transforms as Ve}from"slate";import qf from"@emotion/styled";var fl=qf("blockquote")`
863
863
  position: relative;
864
864
  margin-top: 1em;
865
865
  margin-bottom: 1em;
866
866
  margin-left: 0;
867
867
  border-left: 0.25em solid rgba(0, 0, 0, 0.075);
868
868
  padding-left: 1.5em;
869
- `;import{jsx as Vf}from"react/jsx-runtime";function ul(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 _f=2,fl=y(e=>(e.supportsBlockQuote=!0,e.blockQuotePlugin={indent:()=>{Fe.wrapNodes(e,{type:"block-quote",children:[]},{match:ul})},outdent:()=>{Fe.liftNodes(e,{match:(t,o)=>ul(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<_f},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 Vf(dl,{...o,children:r})},onKeyDown:D({"super+.":e.blockQuotePlugin.indent,"super+,":e.blockQuotePlugin.outdent})}}));import{Editor as ih,Element as ah,Transforms as Hl}from"slate";import Kf from"prismjs";import{Element as qf,Node as Qf}from"slate";var{languages:Wf,tokenize:Gf}=Kf;function jf(e){let t=0,o=[];for(let r of e)o.push(t),t=t+r.length;return o}function hl(e){let[t,o]=e;if(!qf.isElement(t))return[];if(t.type!=="code-block")return[];let r=Wf[t.language];if(r===void 0)return[];let i=t.children.map(p=>`${Qf.string(p)}
870
- `),a=i.join(""),l=jf(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=Gf(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 gl(e,{language:t}){bi(e,{type:"code-block",language:t,children:[{type:"code-block-line",children:[{text:""}]}]})}import{Element as Xf,Transforms as Yf}from"slate";function bl(e,t,o={}){let r=E(e,n=>Xf.isElement(n)&&n.type==="code-block",{at:o.at});return r?(Yf.setNodes(e,{language:t},{at:r[1]}),!0):!1}function El(e){return{createCodeBlock:u(gl,e),setCodeBlockLanguage:u(bl,e)}}var Xt={color:"#999988",fontStyle:"italic"},Jf={opacity:"0.7"},xl={color:"#e3116c"},yl={color:"#393a34"},ae={color:"#36acaa"},jo={color:"#00a4db"},kl={color:"#9a050f"},Tl={color:"#00009f"},Xo={fontWeight:"bold"},Zf={fontStyle:"italic"},vl={comment:Xt,prolog:Xt,doctype:Xt,cdata:Xt,namespace:Jf,string:xl,"attr-value":xl,puncutation:yl,operator:yl,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:{...kl,...Xo},delete:kl,tag:Tl,selector:Tl,important:Xo,bold:Xo,italic:Zf};var wl=["text","html","css","svg","javascript","java","c"];import{Element as Yo,Node as Jo,Transforms as _e}from"slate";function Il(e,t){if(!Yo.isElement(t[0]))return!1;if(t[0].type==="code-block-line"){for(let[o,r]of Jo.children(e,t[1]))if(Yo.isElement(o))return e.isVoid(o)?(_e.removeNodes(e,{at:r}),!0):(_e.unwrapNodes(e,{at:r}),!0)}if(t[0].type==="code-block"){for(let[o,r]of Jo.children(e,t[1]))if(Yo.isElement(o)&&o.type!=="code-block-line")return o.type==="code-block"?(_e.unwrapNodes(e,{at:r}),!0):e.isVoid(o)?(_e.removeNodes(e,{at:r}),!0):(_e.removeNodes(e,{at:r}),_e.insertNodes(e,{type:"code-block-line",children:[{text:Jo.string(o)}]}),!0)}return!1}import{useCallback as eh,useRef as th}from"react";import{useSelected as oh}from"slate-react";import{jsx as Ml}from"react/jsx-runtime";var Pl=e=>Ml(x,{...e,children:Ml("path",{d:"m6 9 6 6 6-6"})});import Yt from"@emotion/styled";var Cl=Yt("div")`
869
+ `;import{jsx as Xf}from"react/jsx-runtime";function hl(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 Qf=2,gl=k(e=>(e.supportsBlockQuote=!0,e.blockQuotePlugin={indent:()=>{Ve.wrapNodes(e,{type:"block-quote",children:[]},{match:hl})},outdent:()=>{Ve.liftNodes(e,{match:(t,o)=>hl(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;Ve.select(e,o),Ve.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"&&Ve.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<Qf},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"&&Ve.mergeNodes(e,{at:i[1]}),!0))}},editableProps:{renderElement:({element:t,attributes:o,children:r})=>{if(t.type==="block-quote")return Xf(fl,{...o,children:r})},onKeyDown:N({"super+.":e.blockQuotePlugin.indent,"super+,":e.blockQuotePlugin.outdent})}}));import{Editor as ph,Element as dh,Transforms as Ol}from"slate";import jf from"prismjs";import{Element as Zf,Node as eh}from"slate";var{languages:Yf,tokenize:Jf}=jf;function th(e){let t=0,o=[];for(let r of e)o.push(t),t=t+r.length;return o}function bl(e){let[t,o]=e;if(!Zf.isElement(t))return[];if(t.type!=="code-block")return[];let r=Yf[t.language];if(r===void 0)return[];let i=t.children.map(p=>`${eh.string(p)}
870
+ `),a=i.join(""),l=th(i);function s(p){for(let u=l.length;u>=0;u--){let h=l[u];if(h<=p)return{path:[...o,u],offset:p-h}}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 u=s(d),h=s(d+p.length);m.push({anchor:u,focus:h,prismToken:p.type}),d+=p.length}return m}function El(e,{language:t}){xi(e,{type:"code-block",language:t,children:[{type:"code-block-line",children:[{text:""}]}]})}import{Element as oh,Transforms as rh}from"slate";function xl(e,t,o={}){let r=E(e,n=>oh.isElement(n)&&n.type==="code-block",{at:o.at});return r?(rh.setNodes(e,{language:t},{at:r[1]}),!0):!1}function yl(e){return{createCodeBlock:f(El,e),setCodeBlockLanguage:f(xl,e)}}var Zt={color:"#999988",fontStyle:"italic"},nh={opacity:"0.7"},kl={color:"#e3116c"},vl={color:"#393a34"},le={color:"#36acaa"},Yo={color:"#00a4db"},Tl={color:"#9a050f"},wl={color:"#00009f"},Jo={fontWeight:"bold"},ih={fontStyle:"italic"},Il={comment:Zt,prolog:Zt,doctype:Zt,cdata:Zt,namespace:nh,string:kl,"attr-value":kl,puncutation:vl,operator:vl,entity:le,url:le,symbol:le,number:le,boolean:le,variable:le,constant:le,property:le,regex:le,insert:le,atrule:Yo,keyword:Yo,"attr-name":Yo,function:{...Tl,...Jo},delete:Tl,tag:wl,selector:wl,important:Jo,bold:Jo,italic:ih};var Ml=["text","html","css","svg","javascript","java","c"];import{Element as Zo,Node as er,Transforms as Ke}from"slate";function Pl(e,t){if(!Zo.isElement(t[0]))return!1;if(t[0].type==="code-block-line"){for(let[o,r]of er.children(e,t[1]))if(Zo.isElement(o))return e.isVoid(o)?(Ke.removeNodes(e,{at:r}),!0):(Ke.unwrapNodes(e,{at:r}),!0)}if(t[0].type==="code-block"){for(let[o,r]of er.children(e,t[1]))if(Zo.isElement(o)&&o.type!=="code-block-line")return o.type==="code-block"?(Ke.unwrapNodes(e,{at:r}),!0):e.isVoid(o)?(Ke.removeNodes(e,{at:r}),!0):(Ke.removeNodes(e,{at:r}),Ke.insertNodes(e,{type:"code-block-line",children:[{text:er.string(o)}]}),!0)}return!1}import{useCallback as ah,useRef as lh}from"react";import{useSelected as sh}from"slate-react";import{jsx as Cl}from"react/jsx-runtime";var Sl=e=>Cl(y,{...e,children:Cl("path",{d:"m6 9 6 6 6-6"})});import eo from"@emotion/styled";var Rl=eo("div")`
871
871
  position: relative;
872
872
  background: var(--code-block-bgcolor);
873
873
  margin: 1em 0;
@@ -886,11 +886,11 @@
886
886
  * Otherwise they will be square.
887
887
  */
888
888
  overflow-x: hidden;
889
- `,Sl=Yt("div")`
889
+ `,Ll=eo("div")`
890
890
  padding: 2.25em 1em 1.5em 1em;
891
891
  border-radius: 0.5em;
892
892
  overflow-x: auto;
893
- `,Rl=Yt("span")`
893
+ `,zl=eo("span")`
894
894
  cursor: pointer;
895
895
  position: absolute;
896
896
  top: 0.25em;
@@ -916,7 +916,7 @@
916
916
  color: var(--shade-800);
917
917
  background: var(--shade-300);
918
918
  }
919
- `,Ll=Yt("div")`
919
+ `,Bl=eo("div")`
920
920
  white-space: pre;
921
921
  line-height: 1.5em;
922
922
  counter-increment: line;
@@ -939,7 +939,7 @@
939
939
  display: inline-block;
940
940
  width: 2em;
941
941
  } */
942
- `;import{jsx as ht,jsxs as Bl}from"react/jsx-runtime";function zl({element:e,attributes:t,children:o}){let r=th(null),n=oh(),i=H("code-block-dropdown"),a=eh(()=>{i.layer&&i.close();let l=r.current;if(l===null)return;let s=wl.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 Bl(Cl,{className:n?"--selected":"",...t,children:[Bl(Rl,{contentEditable:!1,onClick:a,ref:r,children:[ht("span",{children:e.language}),ht(Pl,{})]}),ht(Sl,{children:o})]})}import{useSelected as rh}from"slate-react";import{jsx as nh}from"react/jsx-runtime";function Dl({attributes:e,children:t}){let o=rh();return nh(Ll,{className:o?"--selected":"",...e,spellCheck:"false",children:t})}import{jsx as Nl}from"react/jsx-runtime";function $l({element:e,attributes:t,children:o}){if(e.type==="code-block")return Nl(zl,{element:e,attributes:t,children:o});if(e.type==="code-block-line")return Nl(Dl,{element:e,attributes:t,children:o})}import{jsx as lh}from"react/jsx-runtime";var Al=y((e,t,{createPolicy:o})=>{e.codeBlock=El(e);function r(){let{selection:n}=e;if(!se(n))return!1;let i=E(e,"code-block");return i==null?!1:ih.string(e,i[1])===""?(Hl.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(Il,e)},editableProps:{decorate:hl,onKeyDown:D({"super+`":()=>e.codeBlock.createCodeBlock({language:"text"}),"mod+a":()=>{let n=E(e,i=>ah.isElement(i)&&i.type==="code-block");return n?(Hl.select(e,n[1]),!0):!1}}),renderElement:$l,renderLeaf:({leaf:n,children:i})=>{let a=n.prismToken&&vl[n.prismToken]||null;return a===null?i:lh("span",{style:a,children:i})}}})});import{Transforms as mh}from"slate";import Ol from"@emotion/styled";var Ul=Ol("div")`
942
+ `;import{jsx as gt,jsxs as Dl}from"react/jsx-runtime";function Nl({element:e,attributes:t,children:o}){let r=lh(null),n=sh(),i=H("code-block-dropdown"),a=ah(()=>{i.layer&&i.close();let l=r.current;if(l===null)return;let s=Ml.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 Dl(Rl,{className:n?"--selected":"",...t,children:[Dl(zl,{contentEditable:!1,onClick:a,ref:r,children:[gt("span",{children:e.language}),gt(Sl,{})]}),gt(Ll,{children:o})]})}import{useSelected as mh}from"slate-react";import{jsx as ch}from"react/jsx-runtime";function $l({attributes:e,children:t}){let o=mh();return ch(Bl,{className:o?"--selected":"",...e,spellCheck:"false",children:t})}import{jsx as Hl}from"react/jsx-runtime";function Al({element:e,attributes:t,children:o}){if(e.type==="code-block")return Hl(Nl,{element:e,attributes:t,children:o});if(e.type==="code-block-line")return Hl($l,{element:e,attributes:t,children:o})}import{Fragment as uh,jsx as Ul}from"react/jsx-runtime";var Fl=k((e,t,{createPolicy:o})=>{e.codeBlock=yl(e);function r(){let{selection:n}=e;if(!me(n))return!1;let i=E(e,"code-block");return i==null?!1:ph.string(e,i[1])===""?(Ol.removeNodes(e,{at:i[1]}),!0):!1}return o({name:"code-block",editor:{deleteBackward:r,deleteForward:r,isInline(n){if(n.type==="code-block"||n.type==="code-block-line")return!1},isVoid(n){if(n.type==="code-block"||n.type==="code-block-line")return!1},isMaster(n){if(n.type==="code-block")return!0},normalizeNode:f(Pl,e)},editableProps:{decorate:bl,onKeyDown:N({"super+`":()=>e.codeBlock.createCodeBlock({language:"text"}),"mod+a":()=>{let n=E(e,i=>dh.isElement(i)&&i.type==="code-block");return n?(Ol.select(e,n[1]),!0):!1}}),renderElement:Al,renderLeaf:({leaf:n,children:i})=>{let a=n.prismToken&&Il[n.prismToken]||null;return a===null?Ul(uh,{children:i}):Ul("span",{style:a,children:i})}}})});import{Transforms as hh}from"slate";import Vl from"@emotion/styled";var Kl=Vl("div")`
943
943
  position: relative;
944
944
  background-color: var(--shade-100);
945
945
  border: 1px solid var(--shade-300);
@@ -957,7 +957,7 @@
957
957
  &.--selected {
958
958
  outline: 2px solid var(--select-color);
959
959
  }
960
- `,Fl=Ol("span")`
960
+ `,_l=Vl("span")`
961
961
  position: absolute;
962
962
  top: 0.25em;
963
963
  right: 0.5em;
@@ -965,7 +965,7 @@
965
965
  color: var(--shade-500);
966
966
  text-transform: uppercase;
967
967
  letter-spacing: 0.5px;
968
- `;import{jsx as _l,jsxs as sh}from"react/jsx-runtime";function Vl({attributes:e,children:t,element:o}){return sh(Ul,{...e,contentEditable:!1,children:[_l(Fl,{children:"HTML"}),_l("div",{children:tt(o.html)}),t]})}import{jsx as ch}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:(mh.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 ch(Vl,{element:n,attributes:i,children:a})}}})});import{Editor as Jl}from"slate";import{Element as hh}from"slate";import{Element as ph,Transforms as dh}from"slate";function Wl(e){return ph.isElement(e)&&e.type==="paragraph"}function Gl(e,t){return ge(e,t,(o,r)=>!Wl(o[0])||!Wl(r[0])?!1:o[0].__collapsible&&r[0].__collapsible?(dh.removeNodes(e,{at:o[1]}),!0):!1)}import{Element as uh,Transforms as fh}from"slate";function Zo(e,t){return uh.isElement(t)?e.isVoid(t)||e.isMaster(t):!1}function ql(e,t){return Zo(e,t[0])?ge(e,t,(o,r)=>!Zo(e,o[0])||!Zo(e,r[0])?!1:(fh.insertNodes(e,{type:"paragraph",__collapsible:!0,children:[{text:""}]},{at:r[1]}),!0)):!1}function Ql(e,t){let[o,r]=t;return hh.isElement(o)?!!(ql(e,[o,r])||Gl(e,[o,r])):!1}import{clsx as Eh}from"clsx";import{useSelected as xh}from"slate-react";import gh from"@emotion/styled";var jl=gh("p")`
968
+ `;import{jsx as Wl,jsxs as fh}from"react/jsx-runtime";function Gl({attributes:e,children:t,element:o}){return fh(Kl,{...e,contentEditable:!1,children:[Wl(_l,{children:"HTML"}),Wl("div",{children:ot(o.html)}),t]})}import{jsx as gh}from"react/jsx-runtime";var ql=k((e,t,{createPolicy:o})=>{function r(){let{selection:n}=e;if(!me(n))return!1;let i=E(e,"html-block");return i==null?!1:(hh.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 gh(Gl,{element:n,attributes:i,children:a})}}})});import{Editor as ts}from"slate";import{Element as kh}from"slate";import{Element as bh,Transforms as Eh}from"slate";function Ql(e){return bh.isElement(e)&&e.type==="paragraph"}function Xl(e,t){return be(e,t,(o,r)=>!Ql(o[0])||!Ql(r[0])?!1:o[0].__collapsible&&r[0].__collapsible?(Eh.removeNodes(e,{at:o[1]}),!0):!1)}import{Element as xh,Transforms as yh}from"slate";function tr(e,t){return xh.isElement(t)?e.isVoid(t)||e.isMaster(t):!1}function jl(e,t){return tr(e,t[0])?be(e,t,(o,r)=>!tr(e,o[0])||!tr(e,r[0])?!1:(yh.insertNodes(e,{type:"paragraph",__collapsible:!0,children:[{text:""}]},{at:r[1]}),!0)):!1}function Yl(e,t){let[o,r]=t;return kh.isElement(o)?!!(jl(e,[o,r])||Xl(e,[o,r])):!1}import{clsx as wh}from"clsx";import{useSelected as Ih}from"slate-react";import vh from"@emotion/styled";var Jl=vh("p")`
969
969
  padding: 0;
970
970
  margin: 0;
971
971
  &:first-child {
@@ -995,42 +995,42 @@
995
995
  }
996
996
  border-radius: 8px;
997
997
  }
998
- `;import{Node as bh}from"slate";function Xl(e){return e.children.length===1&&bh.string(e.children[0]).length===0}import{jsx as yh}from"react/jsx-runtime";function Yl({element:e,attributes:t,children:o}){let r=xh(),n=Xl(e);return yh(jl,{...t,className:Eh({"--selected":r,"--empty":n,"--collapsible":!!e.__collapsible}),children:o})}import{jsx as kh}from"react/jsx-runtime";var Zl=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=Jl.start(e,r);Jl.string(e,{anchor:n,focus:o.anchor}).endsWith(`
998
+ `;import{Node as Th}from"slate";function Zl(e){return e.children.length===1&&Th.string(e.children[0]).length===0}import{jsx as Mh}from"react/jsx-runtime";function es({element:e,attributes:t,children:o}){let r=Ih(),n=Zl(e);return Mh(Jl,{...t,className:wh({"--selected":r,"--empty":n,"--collapsible":!!e.__collapsible}),children:o})}import{jsx as Ph}from"react/jsx-runtime";var os=k(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=ts.start(e,r);ts.string(e,{anchor:n,focus:o.anchor}).endsWith(`
999
999
  `)?t():e.insertText(`
1000
- `)}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 kh(Yl,{element:o,attributes:r,children:n})}},onKeyDown:D({"super+0":e.collapsibleParagraph.convertParagraph})}}});function es(e,t){Array.isArray(t)?e.convertElement.convertElementTypes.push(...t):e.convertElement.convertElementTypes.push(t)}import{Editor as V,Element as Jt,Node as re,Point as Ve,Range as Th,Transforms as Pe}from"slate";function ts(e,t,o){try{let r=V.start(e,o),n=V.end(e,o);if(Ve.isBefore(t,r)||Ve.isAfter(t,n))return-1;let i={anchor:r,focus:t};return V.string(e,i).length}catch{return-1}}function os(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=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};Pe.select(e,{anchor:c,focus:c})}catch{}}function vh(e){return re.string(e).includes(`
1001
- `)}function wh(e,t,o,r){let n=re.string(t),i=n.split(`
1002
- `),a=V.start(e,o),l=V.end(e,o),s=Ve.isBefore(r.anchor,a)?a:Ve.isAfter(r.anchor,l)?l:r.anchor,m=Ve.isBefore(r.focus,a)?a:Ve.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,T=0,C=i.length-1;for(let P=0;P<i.length;P++){let w=b+i[P].length;if(b<=p&&p<=w&&(T=P),b<=g&&g<=w){C=P;break}b=w+1}return{startLineIndex:T,endLineIndex:C}}function Ih(e,t,o,r){let n=re.string(t);if(!n.includes(`
1000
+ `)}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:f(Yl,e)},editableProps:{renderElement:({element:o,attributes:r,children:n})=>{switch(o.type){case"paragraph":return Ph(es,{element:o,attributes:r,children:n})}},onKeyDown:N({"super+0":e.collapsibleParagraph.convertParagraph})}}});function rs(e,t){Array.isArray(t)?e.convertElement.convertElementTypes.push(...t):e.convertElement.convertElementTypes.push(t)}import{Editor as _,Element as to,Node as ne,Point as _e,Range as Ch,Transforms as Ce}from"slate";function ns(e,t,o){try{let r=_.start(e,o),n=_.end(e,o);if(_e.isBefore(t,r)||_e.isAfter(t,n))return-1;let i={anchor:r,focus:t};return _.string(e,i).length}catch{return-1}}function is(e,t,o){try{let r=ne.get(e,t);if(!to.isElement(r))return;let n=ne.string(r),i=Math.min(o,n.length),a=_.start(e,t),l=0,s=a.path,m=0;for(let[d,p]of ne.texts(r)){let u=d.text.length;if(l+u>=i){s=[...t,...p],m=i-l;break}l+=u}let c={path:s,offset:m};Ce.select(e,{anchor:c,focus:c})}catch{}}function Sh(e){return ne.string(e).includes(`
1001
+ `)}function Rh(e,t,o,r){let n=ne.string(t),i=n.split(`
1002
+ `),a=_.start(e,o),l=_.end(e,o),s=_e.isBefore(r.anchor,a)?a:_e.isAfter(r.anchor,l)?l:r.anchor,m=_e.isBefore(r.focus,a)?a:_e.isAfter(r.focus,l)?l:r.focus,c=Math.min(_.string(e,{anchor:a,focus:s}).length,n.length),d=Math.min(_.string(e,{anchor:a,focus:m}).length,n.length),p=Math.min(c,d),u=Math.max(c,d),h=0,v=0,S=i.length-1;for(let P=0;P<i.length;P++){let M=h+i[P].length;if(h<=p&&p<=M&&(v=P),h<=u&&u<=M){S=P;break}h=M+1}return{startLineIndex:v,endLineIndex:S}}function Lh(e,t,o,r){let n=ne.string(t);if(!n.includes(`
1003
1003
  `))return o;let i=n.split(`
1004
- `);if(i.length<=1)return o;let{startLineIndex:a,endLineIndex:l}=wh(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(`
1005
- `),T={...t,children:[{text:b}]};Pe.insertNodes(e,T,{at:[...d,p+1]})}let g=t.children.length;for(let b=g-1;b>=0;b--)Pe.removeNodes(e,{at:[...o,b]});if(s.length>0){Pe.insertNodes(e,{text:s.join(`
1006
- `)},{at:[...o,0]});let T={type:"paragraph",children:[{text:m.join(`
1007
- `)}]};Pe.insertNodes(e,T,{at:[...d,p+1]})}else Pe.insertNodes(e,{text:m.join(`
1008
- `)},{at:[...o,0]})}),s.length>0?[...o.slice(0,-1),o[o.length-1]+1]:o)}function rs(e,t,o,r){let{selection:n}=e;if(!n)return!1;let i=-1,a=-1,l=Th.isCollapsed(n),s=Array.from(V.nodes(e,{match:p=>Jt.isElement(p)&&e.convertElement.isConvertibleElement(p)}));if(s.length>0){let[,p]=s[0];i=ts(e,n.anchor,p),a=ts(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(vh(g)){let T=Ih(e,g,b,n);m.unshift(T)}else m.unshift(b)}});let c=m.map(p=>{try{let g=re.get(e,p);return Jt.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)mt(e,{type:"paragraph"},p[1])}):V.withoutNormalizing(e,()=>{for(let p of c)mt(e,o,p[1])}),c.length>0&&i>=0){let[,p]=c[0];if(l)os(e,p,i);else if(a>=0)try{let g=re.get(e,p);if(Jt.isElement(g)){let b=re.string(g),T=Math.min(i,b.length),C=Math.min(a,b.length),P=V.start(e,p),w=P.path,S=T,M=0;for(let[I,k]of re.texts(g)){let z=I.text.length;if(M+z>=T){w=[...p,...k],S=T-M;break}M+=z}let N=P.path,v=C;M=0;for(let[I,k]of re.texts(g)){let z=I.text.length;if(M+z>=C){N=[...p,...k],v=C-M;break}M+=z}Pe.select(e,{anchor:{path:w,offset:S},focus:{path:N,offset:v}})}}catch{os(e,p,i)}}return!0}function ns(e,t){return e.convertElement.convertElementTypes.includes(t.type)}function is(e){return{convertElementTypes:[],addConvertElementType:u(es,e),isConvertibleElement:u(ns,e),convertElements:u(rs,e)}}var as=y(e=>(e.convertElement=is(e),{name:"convert-element"}));import{Editor as er,Path as Mh,Range as Ph,Transforms as ls}from"slate";function ss(e){let t=E(e,"heading");if(!t||!e.selection||Ph.isExpanded(e.selection)||!er.isEnd(e,e.selection.anchor,t[1]))return!1;let o=Mh.next(t[1]);return ls.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:o}),ls.select(e,{anchor:er.start(e,o),focus:er.start(e,o)}),!0}import{Editor as Ch}from"slate";function Sh(e,t,o){e.convertElement.convertElements(r=>r.type==="heading"&&r.level==t,{type:"heading",level:t},o)}function Rh(e,t){let[o]=Ch.nodes(e,{match:r=>"type"in r&&"level"in r&&r.type==="heading"&&r.level===t});return!!o}function ms(e){return{convertHeading:u(Sh,e),isHeadingActive:u(Rh,e)}}import{css as Lh}from"@emotion/react";import Ke from"@emotion/styled";var We=Lh`
1004
+ `);if(i.length<=1)return o;let{startLineIndex:a,endLineIndex:l}=Rh(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:(_.withoutNormalizing(e,()=>{let d=o.slice(0,-1),p=o[o.length-1];if(c.length>0){let h=c.join(`
1005
+ `),v={...t,children:[{text:h}]};Ce.insertNodes(e,v,{at:[...d,p+1]})}let u=t.children.length;for(let h=u-1;h>=0;h--)Ce.removeNodes(e,{at:[...o,h]});if(s.length>0){Ce.insertNodes(e,{text:s.join(`
1006
+ `)},{at:[...o,0]});let v={type:"paragraph",children:[{text:m.join(`
1007
+ `)}]};Ce.insertNodes(e,v,{at:[...d,p+1]})}else Ce.insertNodes(e,{text:m.join(`
1008
+ `)},{at:[...o,0]})}),s.length>0?[...o.slice(0,-1),o[o.length-1]+1]:o)}function as(e,t,o,r){let{selection:n}=e;if(!n)return!1;let i=-1,a=-1,l=Ch.isCollapsed(n),s=Array.from(_.nodes(e,{match:p=>to.isElement(p)&&e.convertElement.isConvertibleElement(p)}));if(s.length>0){let[,p]=s[0];i=ns(e,n.anchor,p),a=ns(e,n.focus,p)}if(s.length===0)return!1;let m=[];_.withoutNormalizing(e,()=>{for(let p=s.length-1;p>=0;p--){let[u,h]=s[p];if(Sh(u)){let v=Lh(e,u,h,n);m.unshift(v)}else m.unshift(h)}});let c=m.map(p=>{try{let u=ne.get(e,p);return to.isElement(u)?[u,p]:null}catch{return null}}).filter(p=>p!==null);if(c.length===0)return!1;if(r&&c.every(p=>t(p[0]))?_.withoutNormalizing(e,()=>{for(let p of c)ct(e,{type:"paragraph"},p[1])}):_.withoutNormalizing(e,()=>{for(let p of c)ct(e,o,p[1])}),c.length>0&&i>=0){let[,p]=c[0];if(l)is(e,p,i);else if(a>=0)try{let u=ne.get(e,p);if(to.isElement(u)){let h=ne.string(u),v=Math.min(i,h.length),S=Math.min(a,h.length),P=_.start(e,p),M=P.path,B=v,C=0;for(let[x,I]of ne.texts(u)){let w=x.text.length;if(C+w>=v){M=[...p,...I],B=v-C;break}C+=w}let D=P.path,T=S;C=0;for(let[x,I]of ne.texts(u)){let w=x.text.length;if(C+w>=S){D=[...p,...I],T=S-C;break}C+=w}Ce.select(e,{anchor:{path:M,offset:B},focus:{path:D,offset:T}})}}catch{is(e,p,i)}}return!0}function ls(e,t){return e.convertElement.convertElementTypes.includes(t.type)}function ss(e){return{convertElementTypes:[],addConvertElementType:f(rs,e),isConvertibleElement:f(ls,e),convertElements:f(as,e)}}var ms=k(e=>(e.convertElement=ss(e),{name:"convert-element"}));import{Editor as or,Path as zh,Range as Bh,Transforms as cs}from"slate";function ps(e){let t=E(e,"heading");if(!t||!e.selection||Bh.isExpanded(e.selection)||!or.isEnd(e,e.selection.anchor,t[1]))return!1;let o=zh.next(t[1]);return cs.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:o}),cs.select(e,{anchor:or.start(e,o),focus:or.start(e,o)}),!0}import{Editor as Dh}from"slate";function Nh(e,t,o){e.convertElement.convertElements(r=>r.type==="heading"&&r.level==t,{type:"heading",level:t},o)}function $h(e,t){let[o]=Dh.nodes(e,{match:r=>"type"in r&&"level"in r&&r.type==="heading"&&r.level===t});return!!o}function ds(e){return{convertHeading:f(Nh,e),isHeadingActive:f($h,e)}}import{css as Hh}from"@emotion/react";import We from"@emotion/styled";var Ge=Hh`
1009
1009
  margin-top: 1em;
1010
1010
  &:first-child {
1011
1011
  margin-top: 0;
1012
1012
  }
1013
1013
  font-weight: bold;
1014
- `,cs=Ke("h1")`
1015
- ${We}
1014
+ `,us=We("h1")`
1015
+ ${Ge}
1016
1016
  font-size: 2.25em;
1017
1017
  letter-spacing: -0.01em;
1018
- `,ps=Ke("h2")`
1019
- ${We}
1018
+ `,fs=We("h2")`
1019
+ ${Ge}
1020
1020
  font-size: 1.5em;
1021
- `,ds=Ke("h3")`
1022
- ${We}
1021
+ `,hs=We("h3")`
1022
+ ${Ge}
1023
1023
  font-size: 1.25em;
1024
- `,us=Ke("h4")`
1025
- ${We}
1024
+ `,gs=We("h4")`
1025
+ ${Ge}
1026
1026
  font-size: 1em;
1027
- `,fs=Ke("h5")`
1028
- ${We}
1027
+ `,bs=We("h5")`
1028
+ ${Ge}
1029
1029
  font-size: 1em;
1030
- `,hs=Ke("h6")`
1031
- ${We}
1030
+ `,Es=We("h6")`
1031
+ ${Ge}
1032
1032
  font-size: 1em;
1033
- `;import{jsx as Ge}from"react/jsx-runtime";var gs=y(e=>{e.convertElement.addConvertElementType("heading"),e.heading=ms(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=si(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(ss,e)},editableProps:{renderElement:({element:r,attributes:n,children:i})=>{if(r.type==="heading")switch(r.level){case 1:return Ge(cs,{...n,children:i});case 2:return Ge(ps,{...n,children:i});case 3:return Ge(ds,{...n,children:i});case 4:return Ge(us,{...n,children:i});case 5:return Ge(fs,{...n,children:i});case 6:return Ge(hs,{...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 zh}from"slate-react";import Bh from"@emotion/styled";var bs=Bh("hr")`
1033
+ `;import{jsx as qe}from"react/jsx-runtime";var xs=k(e=>{e.convertElement.addConvertElementType("heading"),e.heading=ds(e);let t=N({"super+1":G(e.heading.convertHeading,1,!0),"super+2":G(e.heading.convertHeading,2,!0),"super+3":G(e.heading.convertHeading,3,!0),"super+4":G(e.heading.convertHeading,4,!0),"super+5":G(e.heading.convertHeading,5,!0),"super+6":G(e.heading.convertHeading,6,!0)}),o=ci(e,{"#":G(e.heading.convertHeading,1,!1),"##":G(e.heading.convertHeading,2,!1),"###":G(e.heading.convertHeading,3,!1),"####":G(e.heading.convertHeading,4,!1),"#####":G(e.heading.convertHeading,5,!1),"######":G(e.heading.convertHeading,6,!1)});return{name:"heading",editor:{insertBreak:f(ps,e)},editableProps:{renderElement:({element:r,attributes:n,children:i})=>{if(r.type==="heading")switch(r.level){case 1:return qe(us,{...n,children:i});case 2:return qe(fs,{...n,children:i});case 3:return qe(hs,{...n,children:i});case 4:return qe(gs,{...n,children:i});case 5:return qe(bs,{...n,children:i});case 6:return qe(Es,{...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 Oh}from"slate-react";import Ah from"@emotion/styled";var ys=Ah("hr")`
1034
1034
  position: relative;
1035
1035
  height: 1em;
1036
1036
  /* background-color: var(--hr-color); */
@@ -1060,7 +1060,7 @@
1060
1060
  outline: 2px solid var(--select-color, blue);
1061
1061
  }
1062
1062
  }
1063
- `;import{jsx as Es,jsxs as Dh}from"react/jsx-runtime";function xs({attributes:e,children:t}){let o=zh();return Dh("div",{...e,draggable:!0,children:[t,Es("div",{contentEditable:!1,children:Es(bs,{className:o?"--selected":""})})]})}import{Editor as tr,Element as Nh,Path as ys,Transforms as Zt}from"slate";function $h(e){let{selection:t}=e;if(!t)return!1;let o=E(e,i=>Nh.isElement(i)&&e.isMaster(i)),r={type:"horizontal-rule",children:[{text:""}]},n={type:"paragraph",children:[{text:""}]};if(o==null)tr.withoutNormalizing(e,()=>{Zt.insertNodes(e,[r,n]),Zt.move(e)});else{let i=ys.next(o[1]);tr.withoutNormalizing(e,()=>{Zt.insertNodes(e,[r,n],{at:i});let a=ys.next(i);Zt.select(e,tr.start(e,a))})}return!0}function ks(e){return{insertHorizontalRule:u($h,e)}}import{jsx as Hh}from"react/jsx-runtime";var Ts=y((e,t,{createPolicy:o})=>(e.horizontalRule=ks(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 Hh(xs,{...r})},onKeyDown:D({"super+-":e.horizontalRule.insertHorizontalRule})}})));import vs from"@emotion/styled";var ws=vs("code")`
1063
+ `;import{jsx as ks,jsxs as Uh}from"react/jsx-runtime";function vs({attributes:e,children:t}){let o=Oh();return Uh("div",{...e,draggable:!0,children:[t,ks("div",{contentEditable:!1,children:ks(ys,{className:o?"--selected":""})})]})}import{Editor as rr,Element as Fh,Path as Ts,Transforms as oo}from"slate";function Vh(e){let{selection:t}=e;if(!t)return!1;let o=E(e,i=>Fh.isElement(i)&&e.isMaster(i)),r={type:"horizontal-rule",children:[{text:""}]},n={type:"paragraph",children:[{text:""}]};if(o==null)rr.withoutNormalizing(e,()=>{oo.insertNodes(e,[r,n]),oo.move(e)});else{let i=Ts.next(o[1]);rr.withoutNormalizing(e,()=>{oo.insertNodes(e,[r,n],{at:i});let a=Ts.next(i);oo.select(e,rr.start(e,a))})}return!0}function ws(e){return{insertHorizontalRule:f(Vh,e)}}import{jsx as Kh}from"react/jsx-runtime";var Is=k((e,t,{createPolicy:o})=>(e.horizontalRule=ws(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 Kh(vs,{...r})},onKeyDown:N({"super+-":e.horizontalRule.insertHorizontalRule})}})));import Ms from"@emotion/styled";var Ps=Ms("code")`
1064
1064
  color: var(--shade-600);
1065
1065
  background-color: var(--inline-code-bgcolor);
1066
1066
  border: 1px solid var(--inline-code-border-color);
@@ -1081,16 +1081,16 @@
1081
1081
  */
1082
1082
  font-size: 0.75em;
1083
1083
  vertical-align: baseline;
1084
- `,or=vs("span")`
1084
+ `,nr=Ms("span")`
1085
1085
  display: inline-block;
1086
1086
  opacity: 0;
1087
1087
  width: 1px;
1088
1088
  overflow: hidden;
1089
- `;import{jsx as Is,jsxs as Ah}from"react/jsx-runtime";var Ms=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?Ah(ws,{spellCheck:!1,children:[Is(or,{contentEditable:!1,children:"|"}),o,Is(or,{contentEditable:!1,children:"|"})]}):o,onKeyDown:D({"mod+j":()=>e.inlineCode.toggleInlineCode()})}}});import{Editor as Ys,Path as Js}from"slate";function Ps(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 Cs(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 Ss(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 Oh=2;function eo(e){let t=E(e,L);return t?t[0].depth:0}function rr(e){return we(e,L)?eo(e)<Oh:!1}function nr(e){return we(e,L)?eo(e)>0:!1}function Rs(e){rr(e)&&e.list.indent()}function Ls(e){nr(e)&&e.list.outdent()}function Bs(e){return St(e,t=>({depth:t.depth+1}),{match:L})}import{Editor as Uh,Transforms as ir}from"slate";function zs(e){let t=E(e,L);if(!t)return!1;let[o,r]=t;if(Uh.isEmpty(e,o))return o.depth>0?(ir.setNodes(e,{depth:o.depth-1},{at:r}),!0):(mt(e,{type:"paragraph"},r),!0);ir.splitNodes(e,{always:!0});let n=E(e,L);return n&&n[0].type==="task-list-item"&&n[0].checked===!0&&ir.setNodes(e,{checked:!1},{at:n[1]}),!0}import{Editor as Fh}from"slate";function Ds(e){let t=Array.from(Fh.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 _h}from"slate";function Ns(e,{at:t=e.selection}={}){let o=E(e,"task-list-item",{at:t});if(!o)return!1;let r=!o[0].checked;_h.setNodes(e,{checked:r},{at:o[1]})}function $s(e){return{indent:u(Bs,e),outdent:u(Ds,e),convertUnorderedList:u(Ss,e),convertOrderedList:u(Ps,e),convertTaskList:u(Cs,e),insertBreak:u(zs,e),toggleTaskListItem:u(Ns,e),getListDepth:u(eo,e),canIncreaseDepth:u(rr,e),canDecreaseDepth:u(nr,e),increaseDepth:u(Rs,e),decreaseDepth:u(Ls,e)}}import{Element as Vh,Transforms as Kh}from"slate";var Hs=Ct(["ordered-list-item"]);function to(e,t){let[o,r]=t;return Vh.isElement(o)?ge(e,[o,r],(n,i)=>{if(!Hs(i[0]))return!1;let a=Hs(n[0])||L(n[0])?i[0].depth>n[0].depth:!0;return i[0].__firstAtDepth!==a?(Kh.setNodes(e,{__firstAtDepth:a},{at:i[1]}),!0):!1}):!1}function As(e,t){let[o]=t;return L(o)?to(e,t):!1}import{clsx as Gh}from"clsx";import{useEffect as qh}from"react";import{ReactEditor as Qh,useSlateStatic as jh}from"slate-react";import oo from"@emotion/styled";var ar=oo("li")`
1089
+ `;import{jsx as Cs,jsxs as _h}from"react/jsx-runtime";var Ss=k(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?_h(Ps,{spellCheck:!1,children:[Cs(nr,{contentEditable:!1,children:"|"}),o,Cs(nr,{contentEditable:!1,children:"|"})]}):o,onKeyDown:N({"mod+j":()=>e.inlineCode.toggleInlineCode()})}}});import{Editor as em,Path as tm}from"slate";function Rs(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 Ls(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 zs(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 Wh=2;function ro(e){let t=E(e,L);return t?t[0].depth:0}function ir(e){return Ie(e,L)?ro(e)<Wh:!1}function ar(e){return Ie(e,L)?ro(e)>0:!1}function Bs(e){ir(e)&&e.list.indent()}function Ds(e){ar(e)&&e.list.outdent()}function Ns(e){return Lt(e,t=>({depth:t.depth+1}),{match:L})}import{Editor as Gh,Transforms as lr}from"slate";function $s(e){let t=E(e,L);if(!t)return!1;let[o,r]=t;if(Gh.isEmpty(e,o))return o.depth>0?(lr.setNodes(e,{depth:o.depth-1},{at:r}),!0):(ct(e,{type:"paragraph"},r),!0);lr.splitNodes(e,{always:!0});let n=E(e,L);return n&&n[0].type==="task-list-item"&&n[0].checked===!0&&lr.setNodes(e,{checked:!1},{at:n[1]}),!0}import{Editor as qh}from"slate";function Hs(e){let t=Array.from(qh.nodes(e,{match:L}));for(let o of t)if(o[0].depth===0)return!0;return Lt(e,o=>({depth:Math.max(0,o.depth-1)}),{match:L})}import{Transforms as Qh}from"slate";function As(e,{at:t=e.selection}={}){let o=E(e,"task-list-item",{at:t});if(!o)return!1;let r=!o[0].checked;Qh.setNodes(e,{checked:r},{at:o[1]})}function Os(e){return{indent:f(Ns,e),outdent:f(Hs,e),convertUnorderedList:f(zs,e),convertOrderedList:f(Rs,e),convertTaskList:f(Ls,e),insertBreak:f($s,e),toggleTaskListItem:f(As,e),getListDepth:f(ro,e),canIncreaseDepth:f(ir,e),canDecreaseDepth:f(ar,e),increaseDepth:f(Bs,e),decreaseDepth:f(Ds,e)}}import{Element as Xh,Transforms as jh}from"slate";var Us=Rt(["ordered-list-item"]);function no(e,t){let[o,r]=t;return Xh.isElement(o)?be(e,[o,r],(n,i)=>{if(!Us(i[0]))return!1;let a=Us(n[0])||L(n[0])?i[0].depth>n[0].depth:!0;return i[0].__firstAtDepth!==a?(jh.setNodes(e,{__firstAtDepth:a},{at:i[1]}),!0):!1}):!1}function Fs(e,t){let[o]=t;return L(o)?no(e,t):!1}import{clsx as Jh}from"clsx";import{useEffect as Zh}from"react";import{ReactEditor as eg,useSlateStatic as tg}from"slate-react";import io from"@emotion/styled";var sr=io("li")`
1090
1090
  margin-top: 0.5em;
1091
1091
  margin-bottom: 0.5em;
1092
1092
  list-style-position: outside;
1093
- `,Os=oo(ar)`
1093
+ `,Vs=io(sr)`
1094
1094
  position: relative;
1095
1095
  list-style-type: none;
1096
1096
  .--list-item-icon {
@@ -1100,7 +1100,7 @@
1100
1100
  line-height: 1.5em;
1101
1101
  color: var(--shade-600);
1102
1102
  }
1103
- `,Us=oo(ar)`
1103
+ `,Ks=io(sr)`
1104
1104
  position: relative;
1105
1105
  list-style-type: none;
1106
1106
  counter-increment: var(--list-item-var);
@@ -1125,7 +1125,7 @@
1125
1125
  /* force numbers to be monospaced for better alignment */
1126
1126
  font-variant-numeric: tabular-nums;
1127
1127
  }
1128
- `,Fs=oo(ar)`
1128
+ `,_s=io(sr)`
1129
1129
  position: relative;
1130
1130
  list-style-type: none;
1131
1131
  .--list-item-icon {
@@ -1139,7 +1139,7 @@
1139
1139
  stroke-width: 3px;
1140
1140
  }
1141
1141
  }
1142
- `;import{jsx as Xh}from"react/jsx-runtime";function _s({element:e,attributes:t,children:o}){let r=jh();qh(()=>{let a=Qh.findPath(r,e);to(r,[e,a])},[]);let n={marginLeft:`${2+e.depth*2}em`,"--list-item-var":`list-item-depth-${e.depth}`},i=Gh({"--first-at-depth":e.__firstAtDepth});return Xh(Us,{...t,className:i,style:n,children:o})}import{useCallback as Yh}from"react";import{useSlateStatic as Jh}from"slate-react";import{jsx as Ce,jsxs as Gs}from"react/jsx-runtime";var Vs=e=>Gs("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=>Gs("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"})]}),Ws=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 lr,jsxs as Zh}from"react/jsx-runtime";function qs({element:e,attributes:t,children:o}){let r=Jh(),n=Yh(()=>{r.list.toggleTaskListItem({at:e})},[r,e]),i=`${2+e.depth*2}em`;return Zh(Fs,{...t,style:{marginLeft:i},children:[lr("div",{className:"--list-item-icon",contentEditable:!1,children:e.checked?lr(Ks,{onClick:n,style:{cursor:"pointer"}}):lr(Vs,{onClick:n,style:{cursor:"pointer"}})}),o]})}import{jsx as Qs,jsxs as eg}from"react/jsx-runtime";function js({element:e,attributes:t,children:o}){let r=`${2+e.depth*2}em`;return eg(Os,{...t,style:{marginLeft:r},children:[Qs("div",{className:"--list-item-icon",contentEditable:!1,children:Qs(Ws,{})}),o]})}import{jsx as sr}from"react/jsx-runtime";function Xs({element:e,attributes:t,children:o}){switch(e.type){case"ordered-list-item":return sr(_s,{element:e,attributes:t,children:o});case"unordered-list-item":return sr(js,{element:e,attributes:t,children:o});case"task-list-item":return sr(qs,{element:e,attributes:t,children:o})}}var Zs=["unordered-list-item","ordered-list-item","task-list-item"],L=Ct(Zs),em=y((e,t,{createPolicy:o})=>{e.convertElement.addConvertElementType(Zs);let r=e.list=$s(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=>As(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(!Js.hasPrevious(l))return e.collapsibleParagraph.convertParagraph(),!0;let s=Js.previous(l),m=Ys.node(e,s);return L(m[0])?!1:(e.collapsibleParagraph.convertParagraph(),!0)}},editableProps:{renderElement:Xs,onKeyDown(i){return Ys.nodes(e,{match:L})?n(i):!1}}})});import{clsx as ag}from"clsx";import{Editor as mr,Point as lg,Range as sg}from"slate";import{Editor as tg,Text as tm,Transforms as og}from"slate";function om(e,{at:t=e.selection}={}){if(t==null)return;let o=[...tg.nodes(e,{match:n=>tm.isText(n),at:t})],r={};for(let[n]of o)for(let i of Object.keys(n))i!=="text"&&(r[i]=null);og.setNodes(e,r,{match:n=>tm.isText(n),split:!0,at:t})}import{Editor as Se,Point as rg,Range as ng}from"slate";function Re(e,t,o,{at:r=e.selection}={}){if(r==null)return;let n=ng.isRange(r)?r.focus:r,i=rg.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 rm(e){return{removeMarks:u(om,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 ig from"@emotion/styled";var nm=ig("span")`
1142
+ `;import{jsx as og}from"react/jsx-runtime";function Ws({element:e,attributes:t,children:o}){let r=tg();Zh(()=>{let a=eg.findPath(r,e);no(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 og(Ks,{...t,className:i,style:n,children:o})}import{useCallback as rg}from"react";import{useSlateStatic as ng}from"slate-react";import{jsx as Se,jsxs as Xs}from"react/jsx-runtime";var Gs=e=>Xs("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})]}),qs=e=>Xs("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 mr,jsxs as ig}from"react/jsx-runtime";function js({element:e,attributes:t,children:o}){let r=ng(),n=rg(()=>{r.list.toggleTaskListItem({at:e})},[r,e]),i=`${2+e.depth*2}em`;return ig(_s,{...t,style:{marginLeft:i},children:[mr("div",{className:"--list-item-icon",contentEditable:!1,children:e.checked?mr(qs,{onClick:n,style:{cursor:"pointer"}}):mr(Gs,{onClick:n,style:{cursor:"pointer"}})}),o]})}import{jsx as Ys,jsxs as ag}from"react/jsx-runtime";function Js({element:e,attributes:t,children:o}){let r=`${2+e.depth*2}em`;return ag(Vs,{...t,style:{marginLeft:r},children:[Ys("div",{className:"--list-item-icon",contentEditable:!1,children:Ys(Qs,{})}),o]})}import{jsx as cr}from"react/jsx-runtime";function Zs({element:e,attributes:t,children:o}){switch(e.type){case"ordered-list-item":return cr(Ws,{element:e,attributes:t,children:o});case"unordered-list-item":return cr(Js,{element:e,attributes:t,children:o});case"task-list-item":return cr(js,{element:e,attributes:t,children:o})}}var om=["unordered-list-item","ordered-list-item","task-list-item"],L=Rt(om),rm=k((e,t,{createPolicy:o})=>{e.convertElement.addConvertElementType(om);let r=e.list=Os(e),n=N({tab:r.indent,"shift+tab":r.outdent,"super+7":f(r.convertOrderedList,!0),"super+8":f(r.convertUnorderedList,!0),"super+9":f(r.convertTaskList,!0)});return o({name:"list",editor:{normalizeNode:i=>Fs(e,i),insertBreak:r.insertBreak,deleteBackward:i=>{if(i!=="character"||!Ie(e,L))return!1;let a=E(e,L);if(!a)return!1;let l=a[1];if(!tm.hasPrevious(l))return e.collapsibleParagraph.convertParagraph(),!0;let s=tm.previous(l),m=em.node(e,s);return L(m[0])?!1:(e.collapsibleParagraph.convertParagraph(),!0)}},editableProps:{renderElement:Zs,onKeyDown(i){return em.nodes(e,{match:L})?n(i):!1}}})});import{clsx as dg}from"clsx";import{Editor as pr,Range as ug}from"slate";import{Editor as lg,Text as nm,Transforms as sg}from"slate";function im(e,{at:t=e.selection}={}){if(t==null)return;let o=[...lg.nodes(e,{match:n=>nm.isText(n),at:t})],r={};for(let[n]of o)for(let i of Object.keys(n))i!=="text"&&(r[i]=null);sg.setNodes(e,r,{match:n=>nm.isText(n),split:!0,at:t})}import{Editor as Re,Point as mg,Range as cg}from"slate";function Le(e,t,o,{at:r=e.selection}={}){if(r==null)return;let n=cg.isRange(r)?r.focus:r,i=mg.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 am(e){return{removeMarks:f(im,e),toggleMark:f(Le,e),toggleBold:()=>Le(e,"bold"),toggleItalic:()=>Le(e,"italic"),toggleUnderline:()=>Le(e,"underline"),toggleStrike:()=>Le(e,"strike"),toggleHighlight:()=>Le(e,"highlight")}}import pg from"@emotion/styled";var lm=pg("span")`
1143
1143
  &.--bold {
1144
1144
  font-weight: bold;
1145
1145
  }
@@ -1162,7 +1162,7 @@
1162
1162
  &.--highlight {
1163
1163
  background-color: #ffff00;
1164
1164
  }
1165
- `;import{jsx as mg}from"react/jsx-runtime";var im=y(e=>{e.marksPlugin=rm(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=sg.isRange(e.selection)?e.selection.focus:e.selection;lg.isPoint(n)&&(mr.after(e,n)===null||mr.isEnd(e,n,mr.end(e,[])))&&(e.activeMarks={})}},{name:"marks",editableProps:{renderLeaf:({leaf:n,children:i})=>mg(nm,{className:ag({"--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 am}from"slate";function lm(e){if(!e.selection)return;let t=gt.parent(e,e.selection);pi(e,t[1])}var sm=y(e=>(e.normalizeAfterDelete=!0,{name:"normalize-after-delete",editor:{deleteBackward(){if(!e.selection)return!1;let t=gt.parent(e,e.selection);return am.equals(gt.start(e,t[1]),e.selection.anchor)?function(){lm(e)}:!1},deleteForward(){if(!e.selection)return!1;let t=gt.parent(e,e.selection);return am.equals(gt.end(e,t[1]),e.selection.anchor)?function(){lm(e)}:!1}},editableProps:{}}));import{Element as Xg}from"slate";import{Editor as cm,Path as dg,Transforms as pm}from"slate";import{Editor as cg,Path as pg}from"slate";function mm(e,t,o){let r=[...cg.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&&pg.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 dm(e,t){if(e.selection==null)return!1;let[o,r]=cm.edges(e,e.selection),n=Ne(e,t,{at:o}),i=Ne(e,t,{at:r});if(!n&&!i||n&&i&&dg.equals(n,i))return!1;let a=mm(e,e.selection,t);return cm.withoutNormalizing(e,()=>{for(let l of a)pm.delete(e,{at:l});pm.collapse(e,{edge:"start"})}),!0}import{Transforms as Sg}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 ug,Transforms as um}from"slate";function qe(e,t=[{type:"table-content",children:[{text:""}]}]){return{type:"table-cell",children:t}}function fm(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 ug.withoutNormalizing(e,()=>{let{columns:s}=n,m=[...s];m.splice(l,0,s[l]),um.setNodes(e,{columns:m},{at:i}),n.children.forEach((c,d)=>{um.insertNodes(e,qe(l),{at:[...i,d,l]})})}),!0}import{Transforms as fg}from"slate";function hg(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>qe(t))}}function cr(e,{at:t=e.selection,offset:o=0}={}){let r=B(e,{at:t});if(!r)return!1;let n=hg(r.tableElement.columns.length);return fg.insertNodes(e,n,{at:[...r.tablePath,r.rowIndex+o]}),!0}function hm(e,{at:t}={}){return cr(e,{at:t,offset:1})}import{Editor as pr,Element as gg,Path as bg,Transforms as bt}from"slate";function gm(e){return[...Array(e).keys()]}function Eg(e){return gm(e).map(()=>({align:"left"}))}function xg(e,t){return{type:"table",columns:Eg(e),children:gm(t).map(()=>yg(e))}}function yg(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>qe(t))}}function bm(e,t,o,{at:r=e.selection}={}){let n=xg(t,o);return kg(e,n,{at:r})}function kg(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=E(e,n=>gg.isElement(n)&&e.isMaster(n));if(r==null){let n=e.selection;pr.withoutNormalizing(e,()=>{bt.insertNodes(e,t,{at:o}),n&&(bt.select(e,n),bt.move(e))})}else{let n=bg.next(r[1]);pr.withoutNormalizing(e,()=>{bt.insertNodes(e,t,{at:n}),bt.select(e,pr.start(e,n))})}return!0}import{Path as Em}from"slate";function xm(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,Em.next(i)),!0}catch{return!1}}function ym(e,t){let{cellIndex:o,rowIndex:r,tablePath:n}=t;if(r>0)return G(e,[...n,r-1,o]),!0;try{return hi(e,Em.previous(n)),!0}catch{return!1}}import{ReactEditor as Tg}from"slate-react";function vg(){let e=window.getSelection();return e?e.getRangeAt(0).getBoundingClientRect():null}function wg(e,t){return Tg.toDOMNode(e,t).getBoundingClientRect()}function dr(e,t){let o=vg();if(!o)return!1;let r=wg(e,t);return o.right<r.right&&o.left>r.left&&o.bottom<r.bottom&&o.top>r.top}function km(e){let t=B(e);return t&&setTimeout(()=>{dr(e,t.cellElement)||xm(e,t)}),!1}function Tm(e){let t=B(e);return t&&setTimeout(()=>{dr(e,t.cellElement)||ym(e,t)}),!1}import{Editor as vm,Transforms as ur}from"slate";import{Transforms as Ig}from"slate";function Qe(e){let t=e.tablePlugin.getTableInfo();return t===void 0?!1:(Ig.removeNodes(e,{at:t.tablePath}),!0)}function wm(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),ur.setNodes(e,{columns:s},{at:n}),r.children.forEach((c,d)=>{ur.removeNodes(e,{at:[...n,d,a]})});let m=vm.start(e,[...n,i,Math.min(a,l-2)]);ur.select(e,m)})}import{Editor as Im,Transforms as Mm}from"slate";function Pm(e,{at:t=e.selection}={}){let o=B(e,{at:t});return o===void 0?!1:o.rowCount===1?(Qe(e),!0):(Im.withoutNormalizing(e,()=>{Mm.removeNodes(e,{at:o.rowPath}),Mm.select(e,Im.start(e,[...o.tablePath,Math.min(o.rowIndex,o.rowCount-2),o.cellIndex]))}),!0)}import{Transforms as Mg}from"slate";function Cm(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}),Mg.setNodes(e,{columns:a},{at:n}),!0}import{Path as Pg,Transforms as Cg}from"slate";function Sm(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=Pg.next(a);return Cg.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:l}),G(e,l),!0}function Rm(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 Lm(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):(hm(e),G(e,[...a,n+1,0]),!0)}function Bm(e){return{getTableInfo:u(B,e),insertTable:u(bm,e),insertColumn:u(fm,e),insertRow:u(cr,e),removeTable:u(Qe,e),removeColumn:u(wm,e),removeRow:u(Pm,e),tabForward:u(Sm,e),tabBackward:u(Rm,e),shiftEnterForward:u(Lm,e),selectCell:u(Rg,e),down:u(km,e),up:u(Tm,e),setTableColumnAlign:u(Cm,e)}}function Rg(e,{at:t=e.selection}={}){let o=B(e,{at:t});if(o===void 0)return!1;let{cellPath:r}=o;return Sg.select(e,r),!0}import{Transforms as Lg}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)&&(Lg.setNodes(e,{x:s,y:i},{at:[...t[1],i,s]}),o=!0)})}),o}import{Editor as Bg,Transforms as fr}from"slate";function zm(e,t){let[o,r]=t;return o.children.length===1&&o.children[0].type==="table-content"?!1:(Bg.withoutNormalizing(e,()=>{fr.insertNodes(e,{type:"table-content",children:[{text:"X"}]},{at:[...t[1],0]});for(let n=o.children.length;n>=0;n--)fr.mergeNodes(e,{at:[...r,n]});fr.delete(e,{at:{path:[...r,0,0],offset:0},unit:"character"})}),!0)}import{useEffect as Dg}from"react";import{ReactEditor as Ng,useSelected as $g,useSlateStatic as Hg}from"slate-react";import io from"@emotion/styled";import me from"@emotion/styled";var Dm=me("div")`
1165
+ `;import{jsx as fg}from"react/jsx-runtime";var sm=k(e=>{e.marksPlugin=am(e),e.activeMarks={};let t=N({"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&&ug.isRange(e.selection)){let n=e.selection.focus;(pr.after(e,n)===null||pr.isEnd(e,n,pr.end(e,[])))&&(e.activeMarks={})}},{name:"marks",editableProps:{renderLeaf:({leaf:n,children:i})=>fg(lm,{className:dg({"--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 mm}from"slate";function cm(e){if(!e.selection)return;let t=bt.parent(e,e.selection);ui(e,t[1])}var pm=k(e=>(e.normalizeAfterDelete=!0,{name:"normalize-after-delete",editor:{deleteBackward(){if(!e.selection)return!1;let t=bt.parent(e,e.selection);return mm.equals(bt.start(e,t[1]),e.selection.anchor)?function(){cm(e)}:!1},deleteForward(){if(!e.selection)return!1;let t=bt.parent(e,e.selection);return mm.equals(bt.end(e,t[1]),e.selection.anchor)?function(){cm(e)}:!1}},editableProps:{}}));import{Element as tb}from"slate";import{Editor as um,Path as bg,Transforms as fm}from"slate";import{Editor as hg,Path as gg}from"slate";function dm(e,t,o){let r=[...hg.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&&gg.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 hm(e,t){if(e.selection==null)return!1;let[o,r]=um.edges(e,e.selection),n=$e(e,t,{at:o}),i=$e(e,t,{at:r});if(!n&&!i||n&&i&&bg.equals(n,i))return!1;let a=dm(e,e.selection,t);return um.withoutNormalizing(e,()=>{for(let l of a)fm.delete(e,{at:l});fm.collapse(e,{edge:"start"})}),!0}import{Transforms as Dg}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 Eg,Transforms as gm}from"slate";function Qe(e,t=[{type:"table-content",children:[{text:""}]}]){return{type:"table-cell",children:t}}function bm(e,{offset:t=0,at:o=e.selection}={}){let r=z(e,{at:o});if(r===void 0)return!1;let{tableElement:n,tablePath:i,cellIndex:a}=r,l=a+t;return Eg.withoutNormalizing(e,()=>{let{columns:s}=n,m=[...s],c=Math.min(l,s.length-1);m.splice(l,0,s[c]),gm.setNodes(e,{columns:m},{at:i}),n.children.forEach((d,p)=>{gm.insertNodes(e,Qe(l),{at:[...i,p,l]})})}),!0}import{Transforms as xg}from"slate";function yg(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>Qe(t))}}function dr(e,{at:t=e.selection,offset:o=0}={}){let r=z(e,{at:t});if(!r)return!1;let n=yg(r.tableElement.columns.length);return xg.insertNodes(e,n,{at:[...r.tablePath,r.rowIndex+o]}),!0}function Em(e,{at:t}={}){return dr(e,{at:t,offset:1})}import{Editor as ur,Element as kg,Path as vg,Transforms as Et}from"slate";function xm(e){return[...Array(e).keys()]}function Tg(e){return xm(e).map(()=>({align:"left"}))}function wg(e,t){return{type:"table",columns:Tg(e),children:xm(t).map(()=>Ig(e))}}function Ig(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>Qe(t))}}function ym(e,t,o,{at:r=e.selection}={}){let n=wg(t,o);return Mg(e,n,{at:r})}function Mg(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=E(e,n=>kg.isElement(n)&&e.isMaster(n));if(r==null){let n=e.selection;ur.withoutNormalizing(e,()=>{Et.insertNodes(e,t,{at:o}),n&&(Et.select(e,n),Et.move(e))})}else{let n=vg.next(r[1]);ur.withoutNormalizing(e,()=>{Et.insertNodes(e,t,{at:n}),Et.select(e,ur.start(e,n))})}return!0}import{Path as km}from"slate";function vm(e,t){let{cellIndex:o,rowIndex:r,rowCount:n,tablePath:i}=t;if(r<n-1)return q(e,[...i,r+1,o]),!0;try{return q(e,km.next(i)),!0}catch{return!1}}function Tm(e,t){let{cellIndex:o,rowIndex:r,tablePath:n}=t;if(r>0)return q(e,[...n,r-1,o]),!0;try{return bi(e,km.previous(n)),!0}catch{return!1}}import{ReactEditor as Pg}from"slate-react";function Cg(){let e=window.getSelection();return e?e.getRangeAt(0).getBoundingClientRect():null}function Sg(e,t){return Pg.toDOMNode(e,t).getBoundingClientRect()}function fr(e,t){let o=Cg();if(!o)return!1;let r=Sg(e,t);return o.right<r.right&&o.left>r.left&&o.bottom<r.bottom&&o.top>r.top}function wm(e){let t=z(e);return t&&setTimeout(()=>{fr(e,t.cellElement)||vm(e,t)}),!1}function Im(e){let t=z(e);return t&&setTimeout(()=>{fr(e,t.cellElement)||Tm(e,t)}),!1}import{Editor as Mm,Transforms as hr}from"slate";import{Transforms as Rg}from"slate";function Xe(e){let t=e.tablePlugin.getTableInfo();return t===void 0?!1:(Rg.removeNodes(e,{at:t.tablePath}),!0)}function Pm(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);Mm.withoutNormalizing(e,()=>{let s=[...r.columns];s.splice(a,1),hr.setNodes(e,{columns:s},{at:n}),r.children.forEach((c,d)=>{hr.removeNodes(e,{at:[...n,d,a]})});let m=Mm.start(e,[...n,i,Math.min(a,l-2)]);hr.select(e,m)})}import{Editor as Cm,Transforms as Sm}from"slate";function Rm(e,{at:t=e.selection}={}){let o=z(e,{at:t});return o===void 0?!1:o.rowCount===1?(Xe(e),!0):(Cm.withoutNormalizing(e,()=>{Sm.removeNodes(e,{at:o.rowPath}),Sm.select(e,Cm.start(e,[...o.tablePath,Math.min(o.rowIndex,o.rowCount-2),o.cellIndex]))}),!0)}import{Transforms as Lg}from"slate";function Lm(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}),Lg.setNodes(e,{columns:a},{at:n}),!0}import{Path as zg,Transforms as Bg}from"slate";function zm(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 q(e,[...a,n,o+1]),!0;if(n<i-1)return q(e,[...a,n+1,0]),!0;let l=zg.next(a);return Bg.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:l}),q(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 q(e,[...i,n,o-1]),!0;if(n>0)return q(e,[...i,n-1,r-1]),!0}function Dm(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?(q(e,[...a,n,o+1]),!0):n<i-1?(q(e,[...a,n+1,0]),!0):(Em(e),q(e,[...a,n+1,0]),!0)}function Nm(e){return{getTableInfo:f(z,e),insertTable:f(ym,e),insertColumn:f(bm,e),insertRow:f(dr,e),removeTable:f(Xe,e),removeColumn:f(Pm,e),removeRow:f(Rm,e),tabForward:f(zm,e),tabBackward:f(Bm,e),shiftEnterForward:f(Dm,e),selectCell:f(Ng,e),down:f(wm,e),up:f(Im,e),setTableColumnAlign:f(Lm,e)}}function Ng(e,{at:t=e.selection}={}){let o=z(e,{at:t});if(o===void 0)return!1;let{cellPath:r}=o;return Dg.select(e,r),!0}import{Transforms as $g}from"slate";function ao(e,t){let o=!1;return t[0].children.forEach((n,i)=>{n.children.forEach((l,s)=>{(l.x!==s||l.y!==i)&&($g.setNodes(e,{x:s,y:i},{at:[...t[1],i,s]}),o=!0)})}),o}import{Editor as Hg,Transforms as gr}from"slate";function $m(e,t){let[o,r]=t;return o.children.length===1&&o.children[0].type==="table-content"?!1:(Hg.withoutNormalizing(e,()=>{gr.insertNodes(e,{type:"table-content",children:[{text:"X"}]},{at:[...t[1],0]});for(let n=o.children.length;n>=0;n--)gr.mergeNodes(e,{at:[...r,n]});gr.delete(e,{at:{path:[...r,0,0],offset:0},unit:"character"})}),!0)}import{useEffect as Og}from"react";import{ReactEditor as Ug,useSelected as Fg,useSlateStatic as Vg}from"slate-react";import so from"@emotion/styled";import ce from"@emotion/styled";var Hm=ce("div")`
1166
1166
  position: absolute;
1167
1167
  /**
1168
1168
  * very slightly shaded
@@ -1186,7 +1186,7 @@
1186
1186
  background: rgba(0, 0, 0, 0.15);
1187
1187
  }
1188
1188
  }
1189
- `,Nm=me(Dm)`
1189
+ `,Am=ce(Hm)`
1190
1190
  cursor: pointer;
1191
1191
  /**
1192
1192
  * hangs out on top
@@ -1196,7 +1196,7 @@
1196
1196
  right: 0;
1197
1197
  height: 3em;
1198
1198
  top: -3em;
1199
- `,$m=me(Dm)`
1199
+ `,Om=ce(Hm)`
1200
1200
  /**
1201
1201
  * hangs out on left
1202
1202
  */
@@ -1204,7 +1204,7 @@
1204
1204
  bottom: -1px;
1205
1205
  width: 3em;
1206
1206
  left: -3em;
1207
- `,Hm=me("div")`
1207
+ `,Um=ce("div")`
1208
1208
  position: absolute;
1209
1209
  background: rgba(0, 0, 0, 0.05);
1210
1210
  border: 1px solid rgba(0, 0, 0, 0.05);
@@ -1216,7 +1216,7 @@
1216
1216
  left: 0;
1217
1217
  right: 0;
1218
1218
  bottom: 0;
1219
- `,Am=me(Hm)`
1219
+ `,Fm=ce(Um)`
1220
1220
  top: 50%;
1221
1221
  border-bottom: none;
1222
1222
  border-right: none;
@@ -1242,7 +1242,7 @@
1242
1242
 
1243
1243
  /* border-top-left-radius: 0.5em;
1244
1244
  border-top-right-radius: 0.5em; */
1245
- `,Om=me(Hm)`
1245
+ `,Vm=ce(Um)`
1246
1246
  left: 50%;
1247
1247
  border-right: none;
1248
1248
  border-bottom: none;
@@ -1268,7 +1268,7 @@
1268
1268
 
1269
1269
  /* border-top-left-radius: 0.5em;
1270
1270
  border-bottom-left-radius: 0.5em; */
1271
- `,Um=me("div")`
1271
+ `,Km=ce("div")`
1272
1272
  position: absolute;
1273
1273
  font-size: 1.5em;
1274
1274
  background: white;
@@ -1277,27 +1277,27 @@
1277
1277
  svg {
1278
1278
  display: block;
1279
1279
  }
1280
- `,je=me(Um)`
1280
+ `,je=ce(Km)`
1281
1281
  color: #c0c0c0;
1282
1282
  &:hover {
1283
1283
  color: royalblue;
1284
1284
  }
1285
- `,no=me(Um)`
1285
+ `,lo=ce(Km)`
1286
1286
  color: #c0c0c0;
1287
1287
  &:hover {
1288
1288
  color: firebrick;
1289
1289
  }
1290
- `;var Fm=io("table")`
1290
+ `;var _m=so("table")`
1291
1291
  border-collapse: collapse;
1292
1292
  margin: 1em 0;
1293
1293
  ${({columns:e})=>e.map((t,o)=>`td:nth-of-type(${o+1}) { text-align: ${t.align}; }`).join(`
1294
1294
  `)}
1295
- `,_m=io("tr")`
1295
+ `,Wm=so("tr")`
1296
1296
  position: relative;
1297
1297
  &:first-of-type {
1298
1298
  background: var(--table-head-bgcolor);
1299
1299
  }
1300
- `,Vm=io("td")`
1300
+ `,Gm=so("td")`
1301
1301
  position: relative;
1302
1302
  border-width: 1px;
1303
1303
  border-style: solid;
@@ -1317,7 +1317,7 @@
1317
1317
  &:last-of-type {
1318
1318
  border-right-color: var(--table-border-color);
1319
1319
  }
1320
- `,Km=io("div")`
1320
+ `,qm=so("div")`
1321
1321
  /**
1322
1322
  * Smaller font inside a table than outside of it
1323
1323
  */
@@ -1329,7 +1329,7 @@
1329
1329
  color: rgba(0, 0, 0, 0.6);
1330
1330
  font-size: 0.875em; /* 14px */
1331
1331
  }
1332
- `;import{createContext as zg}from"react";var ao=zg({isSelected:!1});import{jsx as hr}from"react/jsx-runtime";function Wm({element:e,attributes:t,children:o}){let r=Hg(),n=$g();return Dg(()=>{let i=Ng.findPath(r,e);ro(r,[e,i])},[]),hr(ao.Provider,{value:{isSelected:n},children:hr(Fm,{...t,columns:e.columns,children:hr("tbody",{children:o})})})}import{useContext as Wg}from"react";import{useSelected as Gg}from"slate-react";import{useCallback as gr,useRef as Ag,useState as Og}from"react";import{useSlateStatic as Ug}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"})}),Gm=()=>Z(x,{children:Z("path",{d:"M4 6h16M4 12h10M4 18h14"})}),qm=()=>Z(x,{children:Z("path",{d:"M4 6h16M8 12h8M6 18h12"})}),Qm=()=>Z(x,{children:Z("path",{d:"M4 6h16M10 12h10M6 18h14"})});import{Fragment as Fg,jsx as ce,jsxs as jm}from"react/jsx-runtime";function Xm({cellElement:e}){let t=Ug(),o=H("column-menu"),r=Ag(null),[n,i]=Og(!1),a=gr(()=>{i(!0)},[]),l=gr(()=>{i(!1)},[]),s=gr(()=>{o.layer&&o.close();let m=r.current;if(m===null)return;let c=[{icon:Gm,title:"\u5DE6\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"left"})}},{icon:qm,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 jm(Nm,{ref:r,contentEditable:!1,onClick:s,onMouseEnter:a,onMouseLeave:l,children:[ce(Am,{className:"--tile",children:ce(so,{})}),n?jm(Fg,{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 _g}from"react";import{useSlateStatic as Vg}from"slate-react";import{Fragment as Kg,jsx as ke,jsxs as Ym}from"react/jsx-runtime";function Jm({cellElement:e}){let t=Vg(),[o,r]=_g(!1);return Ym($m,{contentEditable:!1,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[ke(Om,{className:"--tile",children:ke(so,{})}),o?Ym(Kg,{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 Zm from"@emotion/styled";var ec=Zm("div")`
1332
+ `;import{createContext as Ag}from"react";var mo=Ag({isSelected:!1});import{jsx as br}from"react/jsx-runtime";function Qm({element:e,attributes:t,children:o}){let r=Vg(),n=Fg();return Og(()=>{try{let i=Ug.findPath(r,e);ao(r,[e,i])}catch{}},[]),br(mo.Provider,{value:{isSelected:n},children:br(_m,{...t,columns:e.columns,children:br("tbody",{children:o})})})}import{useContext as jg}from"react";import{useSelected as Yg}from"slate-react";import{useCallback as Er,useRef as Kg,useState as _g}from"react";import{useSlateStatic as Wg}from"slate-react";import{jsx as ee}from"react/jsx-runtime";var Ye=e=>ee("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"1em",height:"1em",...e,children:ee("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm.75-11.25a.75.75 0 0 0-1.5 0v2.5h-2.5a.75.75 0 0 0 0 1.5h2.5v2.5a.75.75 0 0 0 1.5 0v-2.5h2.5a.75.75 0 0 0 0-1.5h-2.5v-2.5z",clipRule:"evenodd"})}),co=e=>ee("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"1em",height:"1em",...e,children:ee("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16zM6.75 9.25a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5z",clipRule:"evenodd"})}),po=()=>ee(y,{children:ee("path",{d:"M4 6h16M4 12h16M4 18h16"})}),Xm=()=>ee(y,{children:ee("path",{d:"M4 6h16M4 12h10M4 18h14"})}),jm=()=>ee(y,{children:ee("path",{d:"M4 6h16M8 12h8M6 18h12"})}),Ym=()=>ee(y,{children:ee("path",{d:"M4 6h16M10 12h10M6 18h14"})});import{Fragment as Gg,jsx as pe,jsxs as Jm}from"react/jsx-runtime";function Zm({cellElement:e}){let t=Wg(),o=H("column-menu"),r=Kg(null),[n,i]=_g(!1),a=Er(()=>{i(!0)},[]),l=Er(()=>{i(!1)},[]),s=Er(()=>{o.layer&&o.close();let m=r.current;if(m===null)return;let c=[{icon:Xm,title:"\u5DE6\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"left"})}},{icon:jm,title:"\u4E2D\u592E\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"center"})}},{icon:Ym,title:"\u53F3\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"right"})}}];o.open(()=>pe(Ae,{dest:m,items:c,close:o.close}))},[]);return Jm(Am,{ref:r,contentEditable:!1,onClick:s,onMouseEnter:a,onMouseLeave:l,children:[pe(Fm,{className:"--tile",children:pe(po,{})}),n?Jm(Gg,{children:[pe(lo,{style:{top:0,left:"50%",marginLeft:"-0.5em"},onMouseDown:()=>t.tablePlugin.removeColumn({at:e}),children:pe(co,{})}),pe(je,{style:{left:"-0.5em",top:0},onMouseDown:()=>t.tablePlugin.insertColumn({at:e}),children:pe(Ye,{})}),pe(je,{style:{right:"-0.5em",top:0},onMouseDown:()=>t.tablePlugin.insertColumn({at:e,offset:1}),children:pe(Ye,{})})]}):null]})}import{useState as qg}from"react";import{useSlateStatic as Qg}from"slate-react";import{Fragment as Xg,jsx as ve,jsxs as ec}from"react/jsx-runtime";function tc({cellElement:e}){let t=Qg(),[o,r]=qg(!1);return ec(Om,{contentEditable:!1,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[ve(Vm,{className:"--tile",children:ve(po,{})}),o?ec(Xg,{children:[ve(lo,{style:{top:"50%",left:"0.5em",marginTop:"-0.5em"},onMouseDown:()=>t.tablePlugin.removeRow({at:e}),children:ve(co,{})}),ve(je,{style:{top:"-0.5em",left:"0.5em"},onMouseDown:()=>t.tablePlugin.insertRow({at:e}),children:ve(Ye,{})}),ve(je,{style:{bottom:"-0.5em",left:"0.5em"},onMouseDown:()=>t.tablePlugin.insertRow({at:e,offset:1}),children:ve(Ye,{})})]}):null]})}import oc from"@emotion/styled";var rc=oc("div")`
1333
1333
  position: absolute;
1334
1334
  /**
1335
1335
  * very slightly shaded
@@ -1361,7 +1361,7 @@
1361
1361
  background: rgba(0, 0, 0, 0.15);
1362
1362
  }
1363
1363
  }
1364
- `,tc=Zm("div")`
1364
+ `,nc=oc("div")`
1365
1365
  position: absolute;
1366
1366
  left: 0;
1367
1367
  top: 0;
@@ -1369,8 +1369,8 @@
1369
1369
  height: 1.5em;
1370
1370
  background: rgba(0, 0, 0, 0.05);
1371
1371
  border-radius: 50%;
1372
- `;import{jsx as oc}from"react/jsx-runtime";function rc(){return oc(ec,{contentEditable:!1,children:oc(tc,{className:"--table-menu-tile"})})}import{jsx as br,jsxs as qg}from"react/jsx-runtime";function nc({element:e,attributes:t,children:o}){let r=Wg(ao),n=Gg(),i=r.isSelected&&e.x===0&&e.y===0,a=r.isSelected&&e.x===0,l=r.isSelected&&e.y===0;return qg(Vm,{className:n?"--selected":"",...t,"data-x":e.x,"data-y":e.y,children:[o,i?br(rc,{}):null,a?br(Jm,{cellElement:e}):null,l?br(Xm,{cellElement:e}):null]})}import{jsx as Qg}from"react/jsx-runtime";function ic({attributes:e,children:t}){return Qg(Km,{...e,children:t})}import{jsx as jg}from"react/jsx-runtime";function ac({attributes:e,children:t}){return jg(_m,{...e,children:t})}import{jsx as mo}from"react/jsx-runtime";function lc({element:e,attributes:t,children:o}){switch(e.type){case"table":return mo(Wm,{element:e,attributes:t,children:o});case"table-row":return mo(ac,{element:e,attributes:t,children:o});case"table-cell":return mo(nc,{element:e,attributes:t,children:o});case"table-content":return mo(ic,{element:e,attributes:t,children:o})}}var sc=y((e,t,{createPolicy:o})=>(e.supportsTable=!0,e.tablePlugin=Bm(e),o({name:"table",editor:{deleteBackward:()=>we(e,"table-cell"),deleteForward:()=>ai(e,"table-cell"),deleteFragment:()=>dm(e,["table-cell"]),insertBreak:()=>E(e,"table-cell")?(e.insertText(`
1373
- `),!0):!1,isMaster(r){if(r.type==="table")return!0},normalizeNode:r=>{let[n]=r;if(!Xg.isElement(n))return!1;switch(n.type){case"table":return ro(e,r);case"table-cell":return zm(e,r)}return!1}},editableProps:{renderElement:lc,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 eb}from"@emotion/react";import{css as Yg}from"@emotion/react";var Jg=`
1372
+ `;import{jsx as ic}from"react/jsx-runtime";function ac(){return ic(rc,{contentEditable:!1,children:ic(nc,{className:"--table-menu-tile"})})}import{jsx as xr,jsxs as Jg}from"react/jsx-runtime";function lc({element:e,attributes:t,children:o}){let r=jg(mo),n=Yg(),i=r.isSelected&&e.x===0&&e.y===0,a=r.isSelected&&e.x===0,l=r.isSelected&&e.y===0;return Jg(Gm,{className:n?"--selected":"",...t,"data-x":e.x,"data-y":e.y,children:[o,i?xr(ac,{}):null,a?xr(tc,{cellElement:e}):null,l?xr(Zm,{cellElement:e}):null]})}import{jsx as Zg}from"react/jsx-runtime";function sc({attributes:e,children:t}){return Zg(qm,{...e,children:t})}import{jsx as eb}from"react/jsx-runtime";function mc({attributes:e,children:t}){return eb(Wm,{...e,children:t})}import{jsx as uo}from"react/jsx-runtime";function cc({element:e,attributes:t,children:o}){switch(e.type){case"table":return uo(Qm,{element:e,attributes:t,children:o});case"table-row":return uo(mc,{element:e,attributes:t,children:o});case"table-cell":return uo(lc,{element:e,attributes:t,children:o});case"table-content":return uo(sc,{element:e,attributes:t,children:o})}}var pc=k((e,t,{createPolicy:o})=>(e.supportsTable=!0,e.tablePlugin=Nm(e),o({name:"table",editor:{deleteBackward:()=>Ie(e,"table-cell"),deleteForward:()=>si(e,"table-cell"),deleteFragment:()=>hm(e,["table-cell"]),insertBreak:()=>E(e,"table-cell")?(e.insertText(`
1373
+ `),!0):!1,isMaster(r){if(r.type==="table")return!0},normalizeNode:r=>{let[n]=r;if(!tb.isElement(n))return!1;switch(n.type){case"table":return ao(e,r);case"table-cell":return $m(e,r)}return!1}},editableProps:{renderElement:cc,onKeyDown:N({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 ib}from"@emotion/react";import{css as ob}from"@emotion/react";var rb=`
1374
1374
  --blue-50: rgb(239 246 255);
1375
1375
  --blue-100: rgb(219 234 254);
1376
1376
  --blue-200: rgb(191 219 254);
@@ -1381,7 +1381,7 @@
1381
1381
  --blue-700: rgb(29 78 216);
1382
1382
  --blue-800: rgb(30 64 175);
1383
1383
  --blue-900: rgb(30 58 138);
1384
- `,Zg=`
1384
+ `,nb=`
1385
1385
  --shade-50: rgb(250 250 250);
1386
1386
  --shade-100: rgb(244 244 245);
1387
1387
  --shade-200: rgb(228 228 231);
@@ -1392,11 +1392,11 @@
1392
1392
  --shade-700: rgb(63 63 70);
1393
1393
  --shade-800: rgb(39 39 42);
1394
1394
  --shade-900: rgb(24 24 27);
1395
- `,mc=Yg`
1395
+ `,dc=ob`
1396
1396
  :root {
1397
1397
  /* Tailwind Colors */
1398
- ${Jg}
1399
- ${Zg}
1398
+ ${rb}
1399
+ ${nb}
1400
1400
  /* Select Colors */
1401
1401
  --select-color: var(--blue-400);
1402
1402
  --select-editor-color: var(--blue-200);
@@ -1418,14 +1418,14 @@
1418
1418
  /* Horizontal Rule Colors */
1419
1419
  --hr-color: var(--shade-300);
1420
1420
  }
1421
- `;import{Fragment as tb,jsx as cc,jsxs as ob}from"react/jsx-runtime";var pc=y(e=>(e.theme=!0,{name:"theme",editor:{},renderEditable:({attributes:t,Editable:o})=>ob(tb,{children:[cc(eb,{styles:mc}),cc(o,{...t})]}),editableProps:{}}));import{clsx as Fb}from"clsx";import{useCallback as _b,useRef as Vb}from"react";import{Editor as Kb,Transforms as Wb}from"slate";import{ReactEditor as Gb,useFocused as qb,useSlateStatic as Qb}from"slate-react";import{clsx as rb}from"clsx";import{useCallback as hc,useRef as nb,useState as ib}from"react";import{ReactEditor as ab,useSlateStatic as lb}from"slate-react";import Er from"@emotion/styled";var dc=Er(X)`
1421
+ `;import{Fragment as ab,jsx as uc,jsxs as lb}from"react/jsx-runtime";var fc=k(e=>(e.theme=!0,{name:"theme",editor:{},renderEditable:({attributes:t,Editable:o})=>lb(ab,{children:[uc(ib,{styles:dc}),uc(o,{...t})]}),editableProps:{}}));import{clsx as Gb}from"clsx";import{useCallback as qb,useRef as Qb}from"react";import{Editor as Xb,Transforms as jb}from"slate";import{ReactEditor as Yb,useFocused as Jb,useSlateStatic as Zb}from"slate-react";import{clsx as sb}from"clsx";import{useCallback as Ec,useRef as mb,useState as cb}from"react";import{ReactEditor as pb,useSlateStatic as db}from"slate-react";import yr from"@emotion/styled";var hc=yr(Y)`
1422
1422
  padding: 0.5em;
1423
- `,uc=Er("div")`
1423
+ `,gc=yr("div")`
1424
1424
  display: grid;
1425
1425
  grid-template-columns: repeat(5, 1.75em);
1426
1426
  grid-template-rows: 1.5em;
1427
1427
  /* grid-gap: 1px; */
1428
- `,fc=Er("div")`
1428
+ `,bc=yr("div")`
1429
1429
  background: var(--shade-100);
1430
1430
  height: 1.5em;
1431
1431
  border-radius: 0.125em;
@@ -1435,11 +1435,11 @@
1435
1435
  &.--selected {
1436
1436
  background: var(--blue-100);
1437
1437
  }
1438
- `;import{Fragment as sb,jsx as co,jsxs as mb}from"react/jsx-runtime";function gc(e){return[...Array(e).keys()]}function bc({dest:e,close:t}){let[o,r]=ib({x:0,y:0}),n=lb(),i=nb(null),a=j({src:i,dest:e},({dest:d})=>({left:d.left-8,top:d.top+d.height})),l=gc(5).map(d=>d+1),s=gc(5).map(d=>d+1),m=hc((d,p)=>{r({x:d,y:p})},[r]),c=hc((d,p)=>{n.tablePlugin.insertTable(d,p),ab.focus(n),t()},[n]);return mb(sb,{children:[co(be,{close:t}),co(dc,{ref:i,style:a,children:co(uc,{onMouseLeave:()=>m(0,0),children:l.map(d=>s.map(p=>{let g=p<=o.x&&d<=o.y;return co(fc,{className:rb({"--selected":g}),onMouseEnter:()=>m(p,d),onClick:()=>c(p,d)},`${p},${d}`)}))})})]})}import Bb from"lodash.throttle";import{useEffect as zb,useRef as Db,useState as Nb}from"react";import{useSlateStatic as $b}from"slate-react";import{jsx as h,jsxs as Ye}from"react/jsx-runtime";var Ec=()=>h(x,{children:h("path",{d:"M7 12h10M7 5v14M17 5v14M15 19h4M15 5h4M5 19h4M5 5h4"})}),xc=()=>h(x,{className:"--more-icon",width:"0.5em",viewBox:"0 0 12 24",children:h("path",{d:"m2 12 4 4 4-4"})}),yc=()=>h(x,{width:"0.5em",viewBox:"6 0 12 24",children:h("path",{d:"M9 12h6M12 9v6"})}),kc=()=>h(x,{children:h("path",{d:"M19 18v-8l-2 2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})}),Tc=()=>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 wc=()=>h(x,{children:h("path",{d:"M8 18V6h2l6 9V6h2v12h-2l-6-9v9H8z"})}),xr=()=>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"})}),Ic=()=>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 yr=()=>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"})}),Mc=()=>Ye(x,{children:[h("path",{d:"M10 9l4 3-4 3"}),h("path",{d:"M16 9l4 3-4 3"})]});var Pc=()=>h(x,{children:h("path",{d:"M9 6h11M9 12h11M9 18h11M5 6v.01M5 12v.01M5 18v.01"})}),Cc=()=>Ye(x,{children:[h("rect",{x:4,y:4,width:16,height:16,rx:2}),h("path",{d:"M4 10h16M10 4v16"})]}),Sc=()=>h(x,{children:h("path",{d:"m7 8-4 4 4 4M17 8l4 4-4 4M14 4l-4 16"})}),Rc=()=>h(x,{children:h("path",{d:"M9 8L5 12L9 16M15 8L19 12L15 16"})}),Lc=()=>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 Bc=()=>h(x,{children:h("path",{d:"M12 5v14M5 12h14"})}),zc=()=>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"})}),Dc=()=>h(x,{children:h("path",{d:"M7 5v5a5 5 0 0 0 10 0V5M5 19h14"})});var Nc=()=>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"})]}),kr=()=>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"})}),$c=()=>h(x,{children:h("path",{d:"M4 6h16M8 12h12M12 18h8M7 12l-3-3M7 12l-3 3"})}),Hc=()=>h(x,{children:h("path",{d:"M4 6h16M8 12h12M12 18h8M4 12l3-3M4 12l3 3"})});var Ac=()=>h(x,{children:h("path",{d:"M18 6L6 18M6 6l12 12"})}),Oc=()=>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"})]}),Uc=()=>h(x,{children:h("path",{d:"M5 12h14"})});var Tr=[{icon:$c,title:f("increaseDepth"),hotkey:"tab",action:e=>e.list.increaseDepth(),active:e=>e.list.canIncreaseDepth()},{icon:Hc,title:f("decreaseDepth"),hotkey:"shift+tab",action:e=>e.list.decreaseDepth(),active:e=>e.list.canDecreaseDepth()}],Fc=[{icon:wc,title:f("normal"),hotkey:"super+0",action:e=>{e.collapsibleParagraph.convertParagraph()}},{icon:kc,title:f("heading1"),hotkey:"super+1",action:e=>e.heading.convertHeading(1,!0),active:e=>e.heading.isHeadingActive(1)},{icon:Tc,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)}],_c=[...Fc],vr=[{icon:Ec,title:f("paragraphStyle"),more:!0,children:Fc}];import{useState as pe,useRef as Kc,useEffect as pb,useCallback as wr}from"react";import{useSlateStatic as db}from"slate-react";import cb from"@emotion/styled";var Vc=cb(X)`
1438
+ `;import{Fragment as ub,jsx as fo,jsxs as fb}from"react/jsx-runtime";function xc(e){return[...Array(e).keys()]}function yc({dest:e,close:t}){let[o,r]=cb({x:0,y:0}),n=db(),i=mb(null),a=j({src:i,dest:e},({dest:d})=>d?{left:d.left-8,top:d.top+d.height}:{left:0,top:0}),l=xc(5).map(d=>d+1),s=xc(5).map(d=>d+1),m=Ec((d,p)=>{r({x:d,y:p})},[r]),c=Ec((d,p)=>{n.tablePlugin.insertTable(d,p),pb.focus(n),t()},[n]);return fb(ub,{children:[fo(Ee,{close:t}),fo(hc,{ref:i,style:a,children:fo(gc,{onMouseLeave:()=>m(0,0),children:l.map(d=>s.map(p=>{let u=p<=o.x&&d<=o.y;return fo(bc,{className:sb({"--selected":u}),onMouseEnter:()=>m(p,d),onClick:()=>c(p,d)},`${p},${d}`)}))})})]})}import Hb from"lodash.throttle";import{useEffect as Ab,useRef as Ob,useState as Ub}from"react";import{useSlateStatic as Fb}from"slate-react";import{jsx as b,jsxs as Je}from"react/jsx-runtime";var kc=()=>b(y,{children:b("path",{d:"M7 12h10M7 5v14M17 5v14M15 19h4M15 5h4M5 19h4M5 5h4"})}),vc=()=>b(y,{className:"--more-icon",width:"0.5em",viewBox:"0 0 12 24",children:b("path",{d:"m2 12 4 4 4-4"})}),Tc=()=>b(y,{width:"0.5em",viewBox:"6 0 12 24",children:b("path",{d:"M9 12h6M12 9v6"})}),wc=()=>b(y,{children:b("path",{d:"M19 18v-8l-2 2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})}),Ic=()=>b(y,{children:b("path",{d:"M17 12a2 2 0 1 1 4 0c0 .591-.417 1.318-.816 1.858L17 18.001h4M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})}),Mc=()=>b(y,{children:b("path",{d:"M19 14a2 2 0 1 0-2-2M17 16a2 2 0 1 0 2-2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})});var Pc=()=>b(y,{children:b("path",{d:"M8 18V6h2l6 9V6h2v12h-2l-6-9v9H8z"})}),kr=()=>b(y,{children:b("path",{d:"M7 5h6a3.5 3.5 0 0 1 0 7H7zM13 12h1a3.5 3.5 0 0 1 0 7H7v-7"})}),Cc=()=>b(y,{children:b("path",{d:"M11 5h6M7 19h6M14 5l-4 14"})});var ho=()=>Je(y,{children:[b("path",{d:"M10 14a3.5 3.5 0 0 0 5 0l4-4a3.5 3.5 0 0 0-5-5l-.5.5"}),b("path",{d:"M14 10a3.5 3.5 0 0 0-5 0l-4 4a3.5 3.5 0 0 0 5 5l.5-.5"})]});var vr=()=>b(y,{children:b("path",{d:"M10 11H6a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v6c0 2.667-1.333 4.333-4 5M19 11h-4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v6c0 2.667-1.333 4.333-4 5"})}),Sc=()=>Je(y,{children:[b("path",{d:"M10 9l4 3-4 3"}),b("path",{d:"M16 9l4 3-4 3"})]});var Rc=()=>b(y,{children:b("path",{d:"M9 6h11M9 12h11M9 18h11M5 6v.01M5 12v.01M5 18v.01"})}),Lc=()=>Je(y,{children:[b("rect",{x:4,y:4,width:16,height:16,rx:2}),b("path",{d:"M4 10h16M10 4v16"})]}),zc=()=>b(y,{children:b("path",{d:"m7 8-4 4 4 4M17 8l4 4-4 4M14 4l-4 16"})}),Bc=()=>b(y,{children:b("path",{d:"M9 8L5 12L9 16M15 8L19 12L15 16"})}),Dc=()=>Je(y,{children:[b("path",{d:"M15 8h.01"}),b("rect",{x:4,y:4,width:16,height:16,rx:3}),b("path",{d:"m4 15 4-4a3 5 0 0 1 3 0l5 5"}),b("path",{d:"m14 14 1-1a3 5 0 0 1 3 0l2 2"})]});var Nc=()=>b(y,{children:b("path",{d:"M12 5v14M5 12h14"})}),$c=()=>b(y,{children:b("path",{d:"M5 12h14M16 6.5A4 2 0 0 0 12 5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1-4-1.5"})}),Hc=()=>b(y,{children:b("path",{d:"M7 5v5a5 5 0 0 0 10 0V5M5 19h14"})});var Ac=()=>Je(y,{children:[b("path",{d:"m9 11 3 3 8-8"}),b("path",{d:"M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9"})]}),Tr=()=>b(y,{children:b("path",{d:"M11 6h9M11 12h9M12 18h8M4 16a2 2 0 1 1 4 0c0 .591-.5 1-1 1.5L4 20h4M6 10V4L4 6"})}),Oc=()=>b(y,{children:b("path",{d:"M4 6h16M8 12h12M12 18h8M7 12l-3-3M7 12l-3 3"})}),Uc=()=>b(y,{children:b("path",{d:"M4 6h16M8 12h12M12 18h8M4 12l3-3M4 12l3 3"})});var Fc=()=>b(y,{children:b("path",{d:"M18 6L6 18M6 6l12 12"})}),Vc=()=>Je(y,{children:[b("path",{d:"M4 20h4l10.5-10.5a2.828 2.828 0 1 0-4-4L4 16v4"}),b("path",{d:"M13.5 6.5l4 4"}),b("path",{d:"m14 19 6-6M18 15l2 2M5 21h4"})]}),Kc=()=>b(y,{children:b("path",{d:"M5 12h14"})});var wr=[{icon:Oc,title:g("increaseDepth"),hotkey:"tab",action:e=>e.list.increaseDepth(),active:e=>e.list.canIncreaseDepth()},{icon:Uc,title:g("decreaseDepth"),hotkey:"shift+tab",action:e=>e.list.decreaseDepth(),active:e=>e.list.canDecreaseDepth()}],_c=[{icon:Pc,title:g("normal"),hotkey:"super+0",action:e=>{e.collapsibleParagraph.convertParagraph()}},{icon:wc,title:g("heading1"),hotkey:"super+1",action:e=>e.heading.convertHeading(1,!0),active:e=>e.heading.isHeadingActive(1)},{icon:Ic,title:g("heading2"),hotkey:"super+2",action:e=>e.heading.convertHeading(2,!0),active:e=>e.heading.isHeadingActive(2)},{icon:Mc,title:g("heading3"),hotkey:"super+3",action:e=>e.heading.convertHeading(3,!0),active:e=>e.heading.isHeadingActive(3)}],Wc=[..._c],Ir=[{icon:kc,title:g("paragraphStyle"),more:!0,children:_c}];import{useState as de,useRef as qc,useEffect as gb,useCallback as Mr}from"react";import{useSlateStatic as bb}from"slate-react";import hb from"@emotion/styled";var Gc=hb(Y)`
1439
1439
  width: 18em;
1440
1440
  padding: 0;
1441
1441
  overflow: hidden;
1442
- `;import{Fragment as ub,jsx as U,jsxs as Q}from"react/jsx-runtime";function Wc({dest:e,close:t}){let o=db(),r=Kc(void 0),n=Kc(null),[i,a]=pe({x:0,y:0}),l=wr(($,O)=>{a(de=>({x:de.x+$,y:de.y+O}))},[]),s=o.wysimark?.imageDialogState,m=!!o.wysimark?.onImageChange,[c,d]=pe(s?.url??""),[p,g]=pe(s?.alt??""),[b,T]=pe(s?.title??""),[C,P]=pe(!1),[w,S]=pe(s?.imageSource??(m?"file":"url")),[M,N]=pe(!1),[v,I]=pe(s?.uploadedUrl??""),[k,z]=pe(""),Te=wr($=>{let O=$.target.value;g(O),C||T(O)},[C]),Tp=wr($=>{T($.target.value),P(!0)},[]);pb(()=>{o.wysimark&&(o.wysimark.imageDialogState={url:c,alt:p,title:b,imageSource:w,uploadedUrl:v})},[c,p,b,w,v]);let Dr=()=>{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 wp($){$.preventDefault();let O=w==="file"?v:c;O.trim()!==""&&(o.image.insertImageFromUrl(O,p,b),Dr(),t())}function Ip(){Dr(),t()}async function Mp($){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 Pp(){n.current?.click()}let Eo=w==="file"?v.trim()===""||M:c.trim()==="";return Q(ub,{children:[U(be,{close:t}),Q(Vc,{ref:r,style:vp,children:[U(xe,{onDrag:l}),Q("form",{onSubmit:$=>void wp($),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 Mp($),style:{display:"none"}}),U("button",{type:"button",onClick:Pp,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")]}),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:Te,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:Tp,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:Ip,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 fb}from"is-hotkey";import{useCallback as uo,useMemo as hb,useRef as gb,useState as Et}from"react";import{Editor as bb,Range as Eb}from"slate";import{ReactEditor as xb,useSlateStatic as yb}from"slate-react";import Gc from"@emotion/styled";var Ir=Gc("div")`
1442
+ `;import{Fragment as Eb,jsx as F,jsxs as X}from"react/jsx-runtime";function Qc({dest:e,close:t}){let o=bb(),r=qc(null),n=qc(null),[i,a]=de({x:0,y:0}),l=Mr(($,U)=>{a(ue=>({x:ue.x+$,y:ue.y+U}))},[]),s=o.wysimark?.imageDialogState,m=!!o.wysimark?.onImageChange,[c,d]=de(s?.url??""),[p,u]=de(s?.alt??""),[h,v]=de(s?.title??""),[S,P]=de(!1),[M,B]=de(s?.imageSource??(m?"file":"url")),[C,D]=de(!1),[T,x]=de(s?.uploadedUrl??""),[I,w]=de(""),O=Mr($=>{let U=$.target.value;u(U),S||v(U)},[S]),Te=Mr($=>{v($.target.value),P(!0)},[]);gb(()=>{o.wysimark&&(o.wysimark.imageDialogState={url:c,alt:p,title:h,imageSource:M,uploadedUrl:T})},[c,p,h,M,T]);let $r=()=>{o.wysimark&&(o.wysimark.imageDialogState=void 0)},xo=j({src:r,dest:e},({src:$,dest:U},ue)=>$t($,ue,{left:U.left-16,top:U.top+U.height},{margin:16})),Ip={...xo,left:xo.left+i.x,top:xo.top+i.y};function Mp($){$.preventDefault();let U=M==="file"?T:c;U.trim()!==""&&(o.image.insertImageFromUrl(U,p,h),$r(),t())}function Pp(){$r(),t()}async function Cp($){let U=$.target.files?.[0];if(!(!U||!o.wysimark?.onImageChange)){w(U.name),D(!0);try{let ue=await o.wysimark.onImageChange(U);x(ue)}catch(ue){}finally{D(!1)}}}function Sp(){n.current?.click()}let yo=M==="file"?T.trim()===""||C:c.trim()==="";return X(Eb,{children:[F(Ee,{close:t}),X(Gc,{ref:r,style:Ip,children:[F(ye,{onDrag:l}),X("form",{onSubmit:$=>void Mp($),style:{padding:"8px"},children:[m&&X("div",{style:{marginBottom:"12px"},children:[X("label",{style:{display:"inline-flex",alignItems:"center",marginRight:"16px",cursor:"pointer"},children:[F("input",{type:"radio",name:"imageSource",value:"file",checked:M==="file",onChange:()=>B("file"),style:{marginRight:"4px"}}),g("imageSourceFile")]}),X("label",{style:{display:"inline-flex",alignItems:"center",cursor:"pointer"},children:[F("input",{type:"radio",name:"imageSource",value:"url",checked:M==="url",onChange:()=>B("url"),style:{marginRight:"4px"}}),g("imageSourceUrl")]})]}),M==="url"?X("div",{style:{marginBottom:"8px"},children:[F("label",{style:{display:"block",marginBottom:"4px"},children:g("imageUrlRequired")}),F("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"})]}):X("div",{style:{marginBottom:"8px"},children:[F("input",{ref:n,type:"file",accept:"image/*",onChange:$=>void Cp($),style:{display:"none"}}),F("button",{type:"button",onClick:Sp,disabled:C,style:{padding:"8px 16px",backgroundColor:C?"#ccc":"#0078d4",color:C?"#666":"white",border:"none",borderRadius:"4px",cursor:C?"not-allowed":"pointer",marginBottom:"8px",fontWeight:"bold"},children:C?g("uploading"):g("selectFile")}),T&&X("div",{style:{marginTop:"8px",padding:"8px",backgroundColor:"var(--shade-100)",borderRadius:"4px"},children:[X("div",{style:{color:"green",marginBottom:"4px"},children:["\u2713 ",g("uploadComplete")]}),I&&F("div",{style:{fontSize:"12px",color:"var(--shade-500)"},children:I})]})]}),X("div",{style:{marginBottom:"8px"},children:[F("label",{style:{display:"block",marginBottom:"4px"},children:g("altText")}),F("input",{type:"text",value:p,onChange:O,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:g("imageDescription")})]}),X("div",{style:{marginBottom:"8px"},children:[F("label",{style:{display:"block",marginBottom:"4px"},children:g("title")}),F("input",{type:"text",value:h,onChange:Te,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:g("imageTitle")})]}),X("div",{style:{display:"flex",gap:"8px"},children:[F("button",{type:"submit",disabled:yo,style:{display:"flex",alignItems:"center",padding:"8px 16px",backgroundColor:yo?"#ccc":"#0078d4",color:"white",border:"none",borderRadius:"4px",cursor:yo?"not-allowed":"pointer",fontWeight:"bold"},children:g("register")}),F("button",{type:"button",onClick:Pp,style:{padding:"8px 16px",backgroundColor:"var(--shade-100)",color:"var(--shade-700)",border:"1px solid var(--shade-300)",borderRadius:"4px",cursor:"pointer"},children:g("cancel")})]})]})]})]})}import{isHotkey as xb}from"is-hotkey";import{useCallback as go,useMemo as yb,useRef as kb,useState as xt}from"react";import{Editor as vb,Range as Tb}from"slate";import{ReactEditor as wb,useSlateStatic as Ib}from"slate-react";import Xc from"@emotion/styled";var Pr=Xc("div")`
1443
1443
  /* Center vertically and horizontally */
1444
1444
  display: flex;
1445
1445
  align-items: center;
@@ -1463,9 +1463,9 @@
1463
1463
  font-size: 1.25em;
1464
1464
  stroke-width: 2px;
1465
1465
  }
1466
- `,qc=Gc("div")`
1466
+ `,jc=Xc("div")`
1467
1467
  font-size: 0.875em;
1468
1468
  margin-top: 0.5em;
1469
1469
  color: var(--shade-500);
1470
1470
  line-height: 1.375;
1471
- `;import{Fragment as Tb,jsx as ee,jsxs as xt}from"react/jsx-runtime";var kb=fb("enter");function Qc({dest:e,close:t}){let o=yb(),r=gb(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=hb(()=>{let{selection:I}=o;return I&&!Eb.isCollapsed(I)?bb.string(o,I):""},[]),[c,d]=Et(""),[p,g]=Et(m),[b,T]=Et(m),[C,P]=Et(!1),w=()=>{let I=p.trim()||c,k=b.trim()||void 0;o.anchor.insertLink(c,I,{select:!0,title:k}),xb.focus(o),t()},S=uo(I=>{d(I.currentTarget.value)},[d]),M=uo(I=>{let k=I.currentTarget.value;g(k),C||T(k)},[g,T,C]),N=uo(I=>{T(I.currentTarget.value),P(!0)},[T]),v=I=>{kb(I)&&(I.preventDefault(),I.stopPropagation(),w())};return xt(Tb,{children:[ee(be,{close:t}),xt($i,{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:v})}),ee(Nt,{style:{marginTop:"0.5em"},children:ee($t,{type:"text",value:p,placeholder:f("linkText"),onChange:M,onKeyDown:v})}),xt(Nt,{style:{marginTop:"0.5em"},children:[ee($t,{type:"text",value:b,placeholder:f("tooltipText"),onChange:N,onKeyDown:v}),xt(Ir,{onClick:w,children:[ee(po,{}),ee(yc,{})]}),ee(Ir,{onClick:t,style:{marginLeft:"0.25em",background:"var(--shade-400)"},children:ee(Ac,{})})]}),ee(qc,{children:f("tooltipHint")})]})]})]})}var Mr=[{icon:po,title:f("insertLink"),more:!0,hotkey:"mod+k",Component:Qc},{icon:Lc,title:f("insertImageFromUrl"),more:!0,Component:Wc},{icon:Cc,title:f("insertTable"),more:!0,Component:bc},{icon:Uc,title:f("horizontalRule"),hotkey:"super+-",action:e=>e.horizontalRule.insertHorizontalRule()}],jc=Mr,Xc=Mr,Yc=[{icon:Bc,title:f("insert"),more:!0,children:Mr}];import{Editor as vb}from"slate";function Je(e){let t=vb.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 Jc=[{icon:xr,title:f("bold"),hotkey:"mod+b",action:e=>e.marksPlugin.toggleBold(),active:e=>Je(e).bold},{icon:Ic,title:f("italic"),hotkey:"mod+i",action:e=>e.marksPlugin.toggleItalic(),active:e=>Je(e).italic},{icon:zc,title:f("strike"),hotkey:"super+k",action:e=>e.marksPlugin.toggleStrike(),active:e=>Je(e).strike},{icon:Sc,title:f("inlineCode"),hotkey:"mod+j",action:e=>e.inlineCode.toggleInlineCode(),active:e=>Je(e).code},{icon:Dc,title:f("underline"),hotkey:"mod+u",action:e=>e.marksPlugin.toggleUnderline(),active:e=>Je(e).underline},{icon:Oc,title:f("highlight"),hotkey:"mod+h",action:e=>e.marksPlugin.toggleHighlight(),active:e=>Je(e).highlight,show:e=>!e.wysimark.disableHighlight}],Pr=Jc,Zc=[{icon:xr,title:f("format"),more:!0,children:Jc}];var ep=[{icon:Pc,title:f("bulletList"),hotkey:"super+8",action:e=>e.list.convertUnorderedList(!0)},{icon:kr,title:f("numberedList"),hotkey:"super+7",action:e=>e.list.convertOrderedList(!0)},{icon:Nc,title:f("checkList"),hotkey:"super+9",action:e=>e.list.convertTaskList(!0),show:e=>!e.wysimark.disableTaskList}],Cr=[...ep,"divider",...Tr],tp=[{icon:kr,title:f("list"),more:!0,children:[...ep,"divider",...Tr]}];import{Editor as op,Transforms as fo}from"slate";var rp=[{icon:yr,title:f("quote"),hotkey:"super+.",action:e=>{e.blockQuotePlugin.isActive()?e.blockQuotePlugin.outdent():e.blockQuotePlugin.indent()},active:e=>e.blockQuotePlugin.isActive()},{icon:Mc,title:f("increaseQuoteDepth"),action:e=>e.blockQuotePlugin.increaseDepth(),active:e=>e.blockQuotePlugin.canIncreaseDepth()},{icon:Rc,title:f("codeBlock"),action:e=>{let{selection:t}=e,o=E(e,"code-block");if(o){let[,r]=o,n=op.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=op.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}],Sr=rp,np=[{icon:yr,title:f("quote"),more:!0,children:rp}];var wb=[..._c,"divider",...Cr,"divider",...Pr,"divider",...jc,"divider",...Sr],Ib=[...vr,"divider",...Cr,"divider",...Pr,"divider",...Xc,"divider",...Sr],ip=[...vr,"divider",...tp,"divider",...Zc,"divider",...Yc,"divider",...np],ap=ip;var Ze=[wb,Ib,ip];import{clsx as Mb}from"clsx";import{useCallback as Rr,useRef as Pb}from"react";import{ReactEditor as Cb,useSlate as Sb,useSlateStatic as Rb}from"slate-react";import{jsx as ho,jsxs as Lb}from"react/jsx-runtime";function lp({item:e}){let t=Rb(),o=Sb(),r=e.active?e.active(o):!1,n=Pb(null),i=Y({title:e.title,hotkey:()=>e.hotkey?Bt(e.hotkey):void 0}),a=H("menu"),l=Rr(()=>{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=Rr(()=>{if(e.action){e.action(t),Cb.focus(t);return}a.layer?a.close():l()},[a.layer,e]),m=Rr(c=>{i.onMouseEnter(c),a.layer&&l()},[a.layer]);return Lb(Qi,{"data-item-type":"button",ref:n,onMouseEnter:m,onMouseLeave:i.onMouseLeave,onClick:s,className:Mb({"--active":r&&!So(e?.title)?.includes("Depth"),"--more":e.more,"--disabled":!r&&So(e?.title)?.includes("Depth")}),children:[ho(e.icon,{}),e.more?ho(xc,{}):null]})}import{jsx as et}from"react/jsx-runtime";function Hb({item:e}){let t=$b();return e==="divider"?et(Gi,{"data-item-type":"divider",children:et(qi,{})}):(e.show===void 0?!0:e.show(t))?et(lp,{item:e}):null}function Ab(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 Ob(e,t,o){let r=0;for(let n of e)r+=n==="divider"?o:t;return r}var Ub=48;function sp(){let e=Db(null),[t,o]=Nb(ap);return zb(()=>{let r=Bb(()=>{let i=e.current;if(!i)throw new Error("Toolbar not found");let a=Ab(i);for(let l=0;l<Ze.length-1;l++)if(Ob(Ze[l],a.button,a.divider)<a.toolbar-Ub){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(Wi,{children:t.map((r,n)=>et(Hb,{item:r},typeof r=="string"?n:r.title))})})}import{jsx as Lr,jsxs as jb}from"react/jsx-runtime";function mp({attributes:e,Editable:t}){let o=Vb(null),r=Qb(),n=qb(),i=_b(a=>{a.target===a.currentTarget&&(Wb.select(r,Kb.end(r,[])),Gb.focus(r))},[r]);return Lr(Si,{children:jb(Ui,{ref:o,className:Fb({"--focused":n}),style:{height:r.toolbar.height,minHeight:r.toolbar.minHeight,maxHeight:r.toolbar.maxHeight},onClick:i,children:[Lr(sp,{}),Lr(t,{as:Oi,...e,style:{overflowY:"auto"}})]})})}var cp=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:mp,editableProps:{}}));import{Editor as Br,Node as Xb,Path as Yb,Transforms as Jb}from"slate";var pp=y(e=>(e.allowTrailingBlock=!0,{name:"trailing-block",editor:{normalizeNode:t=>{if(!Br.isEditor(t[0]))return!1;let o=[e.children.length-1],r=Xb.child(e,e.children.length-1);return(Br.hasBlocks(e,r)||Br.isVoid(e,r))&&Jb.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:Yb.next(o)}),!0}}}));import{Transforms as Zb}from"slate";function eE(e,t){let o=ue(t),r=he(o);Zb.insertNodes(e,r)}function dp(e){return{pasteMarkdown:u(eE,e)}}var up=y(e=>(e.pasteMarkdown=dp(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),ve(t),!0}}}));import{jsx as oE}from"react/jsx-runtime";function tE(e){let t={...e.attributes,style:{...e.attributes.style,width:void 0,maxWidth:void 0}};return oE("span",{...t,children:e.children})}var fp=y((e,t,{createPolicy:o})=>(e.placeholder={},o({name:"placeholder",editableProps:{renderPlaceholder:tE}})));var hp=[up,as,fa,gs,im,Ms,fl,Al,Kl,sc,Ts,pp,em,Ea,sm,Zl,pc,cp,pl,fp];var rE=ei(hp),{withSink:gp,SinkEditable:bp}=rE;import{useState as nE}from"react";import{createEditor as iE,Editor as aE,Transforms as lE}from"slate";import{withHistory as sE}from"slate-history";import{withReact as mE}from"slate-react";function zr({authToken:e,height:t,minHeight:o,maxHeight:r,disableRawMode:n,disableTaskList:i,disableCodeBlock:a,disableHighlight:l}={}){let[s]=nE(()=>{let m=iE(),c=gp(mE(sE(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),g=he(p);m.children=g,m.selection=null,lE.select(m,aE.start(m,[0]))},c});return s}import{jsx as te,jsxs as xp}from"react/jsx-runtime";function hE({children:e,attributes:t}){return te("span",{...t,children:e})}function yp({editor:e,value:t,onChange:o,throttleInMs:r=1e3,placeholder:n,className:i,style:a,onImageChange:l}){let[s,m]=Ep(!1),[c,d]=Ep(t),p=go(!1),g=go(void 0),b=go(void 0),T=go(null),C=yt(cE(()=>{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(()=>{b.current!==e.children&&(b.current=e.children,C())},[C]);if(!s){let k=T.current??t;if(T.current!==null&&(T.current=null),e.wysimark.prevValue==null||g.current==null){p.current=!0;let z=ue(k),Te=he(z);e.children=Te,b.current=g.current=Te,e.wysimark.prevValue={markdown:k,children:Te}}else if(k!==e.wysimark.prevValue.markdown){p.current=!0;let z=ue(k),Te=he(z);e.children=Te,e.selection=null,dE.select(e,pE.start(e,[0]))}}let w=yt(()=>{navigator.userAgent.toLowerCase().includes("firefox")&&uE.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]),v=()=>{s?(T.current=c,e.wysimark.prevValue=void 0,g.current=void 0,b.current=void 0):N(),m(!s)};e.wysimark.onImageChange=l,e.wysimark.onChange=o;let I=e.wysimark.disableRawMode;return xp("div",{style:{position:"relative"},children:[!I&&te("div",{style:{position:"absolute",top:"5px",right:"25px",zIndex:10},children:te("div",{onClick:v,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===" ")&&(v(),k.preventDefault())},children:xp("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(fE,{editor:e,initialValue:g.current,onChange:P,children:te(bp,{renderLeaf:hE,onMouseDown:w,onBlur:S,placeholder:n,className:i,style:a})})})]})}import{jsx as kp}from"react/jsx-runtime";function TE({standaloneOptions:{onChange:e,placeholder:t,className:o,...r},standaloneMethodsRef:n}){let[i,a]=yE(r.initialMarkdown||""),l=xE(i),s=zr(r);l.current=i,EE(n,()=>({getMarkdown(){return l.current},setMarkdown(c){l.current=c,a(c)}}),[l,a]);let m=bE(c=>{l.current=c,a(c),e?.(c)},[s]);return kp(yp,{editor:s,value:i,className:o||"",onChange:m,placeholder:t})}function IA(e,t){let o=gE(),r=kE(e);return r.render(kp(TE,{standaloneMethodsRef:o,standaloneOptions:t})),{unmount(){try{r.unmount()}catch{}},getMarkdown(){return o.current?.getMarkdown()||""},setMarkdown(n){o.current?.setMarkdown(n)}}}export{yp as Editable,IA as createWysimark,zr as useEditor};
1471
+ `;import{Fragment as Pb,jsx as te,jsxs as yt}from"react/jsx-runtime";var Mb=xb("enter");function Yc({dest:e,close:t}){let o=Ib(),r=kb(null),[n,i]=xt({x:0,y:0}),a=go((x,I)=>{i(w=>({x:w.x+x,y:w.y+I}))},[]),l=j({src:r,dest:e},({src:x,dest:I},w)=>!x||!I?{left:0,top:0}:$t(x,w,{left:I.left-12,top:I.top+I.height},{margin:16})),s={...l,left:l.left+n.x,top:l.top+n.y},m=yb(()=>{let{selection:x}=o;return x&&!Tb.isCollapsed(x)?vb.string(o,x):""},[]),[c,d]=xt(""),[p,u]=xt(m),[h,v]=xt(m),[S,P]=xt(!1),M=()=>{let x=p.trim()||c,I=h.trim()||void 0;o.anchor.insertLink(c,x,{select:!0,title:I}),wb.focus(o),t()},B=go(x=>{d(x.currentTarget.value)},[d]),C=go(x=>{let I=x.currentTarget.value;u(I),S||v(I)},[u,v,S]),D=go(x=>{v(x.currentTarget.value),P(!0)},[v]),T=x=>{Mb(x)&&(x.preventDefault(),x.stopPropagation(),M())};return yt(Pb,{children:[te(Ee,{close:t}),yt(Ai,{ref:r,style:s,children:[te(ye,{onDrag:a}),yt("div",{style:{padding:"0.75em"},children:[te(Ht,{children:te(At,{type:"text",value:c,autoFocus:!0,placeholder:g("linkUrl"),onChange:B,onKeyDown:T})}),te(Ht,{style:{marginTop:"0.5em"},children:te(At,{type:"text",value:p,placeholder:g("linkText"),onChange:C,onKeyDown:T})}),yt(Ht,{style:{marginTop:"0.5em"},children:[te(At,{type:"text",value:h,placeholder:g("tooltipText"),onChange:D,onKeyDown:T}),yt(Pr,{onClick:M,children:[te(ho,{}),te(Tc,{})]}),te(Pr,{onClick:t,style:{marginLeft:"0.25em",background:"var(--shade-400)"},children:te(Fc,{})})]}),te(jc,{children:g("tooltipHint")})]})]})]})}var Cr=[{icon:ho,title:g("insertLink"),more:!0,hotkey:"mod+k",Component:Yc},{icon:Dc,title:g("insertImageFromUrl"),more:!0,Component:Qc},{icon:Lc,title:g("insertTable"),more:!0,Component:yc},{icon:Kc,title:g("horizontalRule"),hotkey:"super+-",action:e=>e.horizontalRule.insertHorizontalRule()}],Jc=Cr,Zc=Cr,ep=[{icon:Nc,title:g("insert"),more:!0,children:Cr}];import{Editor as Cb}from"slate";function Ze(e){let t=Cb.marks(e);return{bold:t?.bold||!1,italic:t?.italic||!1,strike:t?.strike||!1,code:t?.code||!1,underline:t?.underline||!1,highlight:t?.highlight||!1}}var tp=[{icon:kr,title:g("bold"),hotkey:"mod+b",action:e=>e.marksPlugin.toggleBold(),active:e=>Ze(e).bold},{icon:Cc,title:g("italic"),hotkey:"mod+i",action:e=>e.marksPlugin.toggleItalic(),active:e=>Ze(e).italic},{icon:$c,title:g("strike"),hotkey:"super+k",action:e=>e.marksPlugin.toggleStrike(),active:e=>Ze(e).strike},{icon:zc,title:g("inlineCode"),hotkey:"mod+j",action:e=>e.inlineCode.toggleInlineCode(),active:e=>Ze(e).code},{icon:Hc,title:g("underline"),hotkey:"mod+u",action:e=>e.marksPlugin.toggleUnderline(),active:e=>Ze(e).underline},{icon:Vc,title:g("highlight"),hotkey:"mod+h",action:e=>e.marksPlugin.toggleHighlight(),active:e=>Ze(e).highlight,show:e=>!e.wysimark.disableHighlight}],Sr=tp,op=[{icon:kr,title:g("format"),more:!0,children:tp}];var rp=[{icon:Rc,title:g("bulletList"),hotkey:"super+8",action:e=>e.list.convertUnorderedList(!0)},{icon:Tr,title:g("numberedList"),hotkey:"super+7",action:e=>e.list.convertOrderedList(!0)},{icon:Ac,title:g("checkList"),hotkey:"super+9",action:e=>e.list.convertTaskList(!0),show:e=>!e.wysimark.disableTaskList}],Rr=[...rp,"divider",...wr],np=[{icon:Tr,title:g("list"),more:!0,children:[...rp,"divider",...wr]}];import{Editor as ip,Transforms as bo}from"slate";var ap=[{icon:vr,title:g("quote"),hotkey:"super+.",action:e=>{e.blockQuotePlugin.isActive()?e.blockQuotePlugin.outdent():e.blockQuotePlugin.indent()},active:e=>e.blockQuotePlugin.isActive()},{icon:Sc,title:g("increaseQuoteDepth"),action:e=>e.blockQuotePlugin.increaseDepth(),active:e=>e.blockQuotePlugin.canIncreaseDepth()},{icon:Bc,title:g("codeBlock"),action:e=>{let{selection:t}=e,o=E(e,"code-block");if(o){let[,r]=o,n=ip.string(e,r);bo.removeNodes(e,{at:r}),bo.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=ip.string(e,t);bo.delete(e),bo.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}],Lr=ap,lp=[{icon:vr,title:g("quote"),more:!0,children:ap}];var Sb=[...Wc,"divider",...Rr,"divider",...Sr,"divider",...Jc,"divider",...Lr],Rb=[...Ir,"divider",...Rr,"divider",...Sr,"divider",...Zc,"divider",...Lr],sp=[...Ir,"divider",...np,"divider",...op,"divider",...ep,"divider",...lp],mp=sp;var et=[Sb,Rb,sp];import{clsx as Lb}from"clsx";import{useCallback as zr,useRef as zb}from"react";import{ReactEditor as Bb,useSlate as Db,useSlateStatic as Nb}from"slate-react";import{jsx as Eo,jsxs as $b}from"react/jsx-runtime";function cp({item:e}){let t=Nb(),o=Db(),r=e.active?e.active(o):!1,n=zb(null),i=J({title:e.title,hotkey:()=>e.hotkey?Dt(e.hotkey):void 0}),a=H("menu"),l=zr(()=>{let c=n.current,d=e.children,p=e.Component;c&&(d?a.open(()=>Eo(Ae,{dest:c,items:d,close:a.close})):p&&a.open(()=>Eo(p,{dest:c,close:a.close})))},[e]),s=zr(()=>{if(e.action){e.action(t),Bb.focus(t);return}a.layer?a.close():l()},[a.layer,e]),m=zr(c=>{i.onMouseEnter(c),a.layer&&l()},[a.layer]);return $b(ji,{"data-item-type":"button",ref:n,onMouseEnter:m,onMouseLeave:i.onMouseLeave,onClick:s,className:Lb({"--active":r&&!Lo(e?.title)?.includes("Depth"),"--more":e.more,"--disabled":!r&&Lo(e?.title)?.includes("Depth")}),children:[Eo(e.icon,{}),e.more?Eo(vc,{}):null]})}import{jsx as tt}from"react/jsx-runtime";function Vb({item:e}){let t=Fb();return e==="divider"?tt(Qi,{"data-item-type":"divider",children:tt(Xi,{})}):(e.show===void 0?!0:e.show(t))?tt(cp,{item:e}):null}function Kb(e){let t=e.querySelector("[data-item-type=button]"),o=e.querySelector("[data-item-type=divider]");return!t||!o?null:{toolbar:e.offsetWidth,button:t.offsetWidth,divider:o.offsetWidth}}function _b(e,t,o){let r=0;for(let n of e)r+=n==="divider"?o:t;return r}var Wb=48;function pp(){let e=Ob(null),[t,o]=Ub(mp);return Ab(()=>{let r=Hb(()=>{let i=e.current;if(!i)throw new Error("Toolbar not found");let a=Kb(i);if(a){for(let l=0;l<et.length-1;l++)if(_b(et[l],a.button,a.divider)<a.toolbar-Wb){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(Gi,{ref:e,children:tt(qi,{children:t.map((r,n)=>tt(Vb,{item:r},typeof r=="string"?n:r.title))})})}import{jsx as Br,jsxs as eE}from"react/jsx-runtime";function dp({attributes:e,Editable:t}){let o=Qb(null),r=Zb(),n=Jb(),i=qb(a=>{a.target===a.currentTarget&&(jb.select(r,Xb.end(r,[])),Yb.focus(r))},[r]);return Br(Li,{children:eE(Vi,{ref:o,className:Gb({"--focused":n}),style:{height:r.toolbar.height,minHeight:r.toolbar.minHeight,maxHeight:r.toolbar.maxHeight},onClick:i,children:[Br(pp,{}),Br(t,{as:Fi,...e,style:{overflowY:"auto"}})]})})}var up=k((e,t)=>(e.toolbar={height:t.toolbar?.height,minHeight:t.toolbar?.minHeight,maxHeight:t.toolbar?.maxHeight,showUploadButtons:t.toolbar?.showUploadButtons??!0},{name:"toolbar",editor:{},renderEditable:dp,editableProps:{}}));import{Editor as Dr,Node as tE,Path as oE,Transforms as rE}from"slate";var fp=k(e=>(e.allowTrailingBlock=!0,{name:"trailing-block",editor:{normalizeNode:t=>{if(!Dr.isEditor(t[0]))return!1;let o=[e.children.length-1],r=tE.child(e,e.children.length-1);return(Dr.hasBlocks(e,r)||Dr.isVoid(e,r))&&rE.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:oE.next(o)}),!0}}}));import{Transforms as nE}from"slate";function iE(e,t){let o=fe(t),r=ge(o);nE.insertNodes(e,r)}function hp(e){return{pasteMarkdown:f(iE,e)}}var gp=k(e=>(e.pasteMarkdown=hp(e),{name:"paste-markdown",editor:{},editableProps:{onPaste(t){let{types:o}=t.clipboardData;if(o.length!==1||o[0]!=="text/plain")return!1;let r=t.clipboardData.getData("text/plain");return e.pasteMarkdown.pasteMarkdown(r),we(t),!0}}}));import{jsx as lE}from"react/jsx-runtime";function aE(e){let t={...e.attributes,style:{...e.attributes.style,width:void 0,maxWidth:void 0}};return lE("span",{...t,children:e.children})}var bp=k((e,t,{createPolicy:o})=>(e.placeholder={},o({name:"placeholder",editableProps:{renderPlaceholder:aE}})));var Ep=[gp,ms,ga,xs,sm,Ss,gl,Fl,ql,pc,Is,fp,rm,ya,pm,os,fc,up,ul,bp];var sE=oi(Ep),{withSink:xp,SinkEditable:yp}=sE;import{useState as mE}from"react";import{createEditor as cE,Editor as pE,Transforms as dE}from"slate";import{withHistory as uE}from"slate-history";import{withReact as fE}from"slate-react";function Nr({authToken:e,height:t,minHeight:o,maxHeight:r,disableRawMode:n,disableTaskList:i,disableCodeBlock:a,disableHighlight:l}={}){let[s]=mE(()=>{let m=cE(),c=xp(fE(uE(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),u=ge(p);m.children=u,m.selection=null,dE.select(m,pE.start(m,[0]))},c});return s}import{jsx as oe,jsxs as vp}from"react/jsx-runtime";function yE({children:e,attributes:t}){return oe("span",{...t,children:e})}function Tp({editor:e,value:t,onChange:o,throttleInMs:r=1e3,placeholder:n,className:i,style:a,onImageChange:l}){let[s,m]=kp(!1),[c,d]=kp(t),p=vt(!1),u=vt(void 0),h=vt(void 0),v=vt(null),S=vt(o);S.current=o;let P=kt(hE(()=>{let w=at(e.children);e.wysimark.prevValue={markdown:w,children:e.children},S.current(w)},r,{leading:!1,trailing:!0}),[e,r]),M=kt(()=>{h.current!==e.children&&(h.current=e.children,P())},[P]);if(!s){let w=v.current??t;if(v.current!==null&&(v.current=null),e.wysimark.prevValue==null||u.current==null){p.current=!0;let O=fe(w),Te=ge(O);e.children=Te,h.current=u.current=Te,e.wysimark.prevValue={markdown:w,children:Te}}else if(w!==e.wysimark.prevValue.markdown){p.current=!0;let O=fe(w),Te=ge(O);e.children=Te,e.selection=null,bE.select(e,gE.start(e,[0]))}}let B=kt(()=>{navigator.userAgent.toLowerCase().includes("firefox")&&EE.focus(e)},[e]),C=kt(()=>{P.flush()},[P]),D=w=>{let O=w.target.value;d(O),o(O)},T=kt(()=>{let w=e.getMarkdown();d(w)},[e]),x=()=>{s?(v.current=c,e.wysimark.prevValue=void 0,u.current=void 0,h.current=void 0):T(),m(!s)};e.wysimark.onImageChange=l,e.wysimark.onChange=o;let I=e.wysimark.disableRawMode;return vp("div",{style:{position:"relative"},children:[!I&&oe("div",{style:{position:"absolute",top:"5px",right:"25px",zIndex:10},children:oe("div",{onClick:x,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?g("switchToVisualEditor"):g("switchToRawMarkdown"),role:"button",tabIndex:0,onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(x(),w.preventDefault())},children:vp("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[oe("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",fill:s?"rgba(74, 144, 226, 0.05)":"transparent"}),oe("path",{d:"M7 15V9L10 12L13 9V15",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),oe("path",{d:"M16 9H18V15",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),oe("path",{d:"M16 12H18",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})}),oe("div",{style:{display:s?"block":"none",textAlign:"center"},children:oe("textarea",{value:ot(c).replace(/&nbsp;/g,""),onChange:D,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}})}),oe("div",{style:{display:s?"none":"block"},children:oe(xE,{editor:e,initialValue:u.current,onChange:M,children:oe(yp,{renderLeaf:yE,onMouseDown:B,onBlur:C,placeholder:n,className:i,style:a})})})]})}import{jsx as wp}from"react/jsx-runtime";function PE({standaloneOptions:{onChange:e,placeholder:t,className:o,...r},standaloneMethodsRef:n}){let[i,a]=IE(r.initialMarkdown||""),l=wE(i),s=Nr(r);l.current=i,TE(n,()=>({getMarkdown(){return l.current},setMarkdown(c){l.current=c,a(c)}}),[l,a]);let m=vE(c=>{l.current=c,a(c),e?.(c)},[s]);return wp(Tp,{editor:s,value:i,className:o||"",onChange:m,placeholder:t})}function SA(e,t){let o=kE(),r=ME(e);return r.render(wp(PE,{standaloneMethodsRef:o,standaloneOptions:t})),{unmount(){try{r.unmount()}catch{}},getMarkdown(){return o.current?.getMarkdown()||""},setMarkdown(n){o.current?.setMarkdown(n)}}}export{Tp as Editable,SA as createWysimark,Nr as useEditor};