UNPKG

md-editor-v3

Version:

Markdown editor for vue3, developed in jsx and typescript, dark theme、beautify content by prettier、render articles directly、paste or clip the picture and upload it...

182 lines 1.86 MB
(function(he,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],m):(he=typeof globalThis<"u"?globalThis:he||self,m(he.MdEditorV3={},he.Vue))})(this,function(he,m){"use strict";var Ule=Object.defineProperty;var r5=he=>{throw TypeError(he)};var Ele=(he,m,ft)=>m in he?Ule(he,m,{enumerable:!0,configurable:!0,writable:!0,value:ft}):he[m]=ft;var We=(he,m,ft)=>Ele(he,typeof m!="symbol"?m+"":m,ft),s0=(he,m,ft)=>m.has(he)||r5("Cannot "+ft);var R=(he,m,ft)=>(s0(he,m,"read from private field"),ft?ft.call(he):m.get(he)),ve=(he,m,ft)=>m.has(he)?r5("Cannot add the same private member more than once"):m instanceof WeakSet?m.add(he):m.set(he,ft),fe=(he,m,ft,wa)=>(s0(he,m,"write to private field"),wa?wa.call(he,ft):m.set(he,ft),ft),oe=(he,m,ft)=>(s0(he,m,"access private method"),ft);var Oh=(he,m,ft,wa)=>({set _(uh){fe(he,m,uh,ft)},get _(){return R(he,m,wa)}});var e5,ZO,t5,n5,zi,Vn,qi,ga,Wi,CO,jO,_t,Yi,Pt,Je,$e,sn,Zn,en,Vt,Ui,Zt,Ei,Vi,Cn,Zi,Po,un,AO,K,f0,Qa,Er,Js,jn,O5,$a,GO,eu,vo,wo,d0,lh,sh,et,h0,uu,To,p0;function ft(e,t){for(var n=0;n<t.length;n++){const i=t[n];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in e)){const o=Object.getOwnPropertyDescriptor(i,r);o&&Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const wa=e=>{const t=typeof e;return t!=="function"&&t!=="object"||e===null},uh=e=>{const t=e.flags===""?void 0:e.flags;return new RegExp(e.source,t)},HO=(e,t=new WeakMap)=>{if(e===null||wa(e))return e;if(t.has(e))return t.get(e);if(e instanceof RegExp)return uh(e);if(e instanceof Date)return new Date(e.getTime());if(e instanceof Function)return e;if(e instanceof Map){const i=new Map;return t.set(e,i),e.forEach((r,o)=>{i.set(o,HO(r,t))}),i}if(e instanceof Set){const i=new Set;t.set(e,i);for(const r of e)i.add(HO(r,t));return i}if(Array.isArray(e)){const i=[];return t.set(e,i),e.forEach(r=>{i.push(HO(r,t))}),i}const n={};t.set(e,n);for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=HO(e[i],t));return n},m0=(e,t=200)=>{let n=0;return(...i)=>new Promise(r=>{n&&(clearTimeout(n),r("cancel")),n=window.setTimeout(()=>{e.apply(void 0,i),n=0,r("done")},t)})},s5=(e,t={_blank:!0,nofollow:!0})=>{const n=document.createElement("a");n.href=e,t._blank&&(n.target="_blank"),t.nofollow&&(n.rel="noopener noreferrer"),n.click()},g0=()=>{let e=-1;return(t,n,i,r=100)=>{const o=()=>{i&&(typeof r=="number"?setTimeout(i,r):i())};e!==-1&&(cancelAnimationFrame(e),o());let a=t.scrollTop;const O=()=>{e=-1;const l=n-a;a=a+l/5,Math.abs(l)<1?(t.scrollTo(0,n),o()):(t.scrollTo(0,a),e=requestAnimationFrame(O))};e=requestAnimationFrame(O)}},u5=(e,t=200)=>{let n=0,i=null;const r=o=>{n===0&&(n=o),o-n>=t?(e.apply(void 0,i),i=null,n=0):window.requestAnimationFrame(r)};return(...o)=>{i===null&&window.requestAnimationFrame(r),i=o}},c5=e=>{const t=n=>{const{scrollHeight:i,scrollWidth:r,offsetHeight:o,offsetWidth:a,scrollLeft:O,scrollTop:l}=e,s=n.x,u=n.y,c=d=>{const p=l+u-d.y,$=O+s-d.x,b=i-o,g=r-a,Q={};$>=0&&$<=g&&(Q.left=$),p>=0&&p<=b&&(Q.top=p),e.scroll(Q)};document.addEventListener("mousemove",c);const f=()=>{document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",f)};document.addEventListener("mouseup",f)};return e.addEventListener("mousedown",t),()=>{e.removeEventListener("mousedown",t)}},ch=()=>`${Date.now().toString(36)}${Math.random().toString(36).substring(2)}`,Q0=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),fh=(e,t,n={})=>{const{excludeKeys:i}=n;for(const r in t)i&&i(r)?e[r]=t[r]:Q0(t[r])&&Q0(e[r])?e[r]=fh(e[r],t[r],n):e[r]=t[r];return e},X="md-editor",Be="https://unpkg.com",f5=`${Be}/@highlightjs/cdn-assets@11.10.0/highlight.min.js`,$0={main:`${Be}/prettier@3.3.3/standalone.js`,markdown:`${Be}/prettier@3.3.3/plugins/markdown.js`},d5={css:`${Be}/cropperjs@1.6.2/dist/cropper.min.css`,js:`${Be}/cropperjs@1.6.2/dist/cropper.min.js`},h5=`${Be}/screenfull@5.2.0/dist/screenfull.js`,p5=`${Be}/mermaid@11.9.0/dist/mermaid.min.js`,m5={js:`${Be}/katex@0.16.22/dist/katex.min.js`,css:`${Be}/katex@0.16.22/dist/katex.min.css`},dh={a11y:{light:`${Be}/@highlightjs/cdn-assets@11.10.0/styles/a11y-light.min.css`,dark:`${Be}/@highlightjs/cdn-assets@11.10.0/styles/a11y-dark.min.css`},atom:{light:`${Be}/@highlightjs/cdn-assets@11.10.0/styles/atom-one-light.min.css`,dark:`${Be}/@highlightjs/cdn-assets@11.10.0/styles/atom-one-dark.min.css`},github:{light:`${Be}/@highlightjs/cdn-assets@11.10.0/styles/github.min.css`,dark:`${Be}/@highlightjs/cdn-assets@11.10.0/styles/github-dark.min.css`},gradient:{light:`${Be}/@highlightjs/cdn-assets@11.10.0/styles/gradient-light.min.css`,dark:`${Be}/@highlightjs/cdn-assets@11.10.0/styles/gradient-dark.min.css`},kimbie:{light:`${Be}/@highlightjs/cdn-assets@11.10.0/styles/kimbie-light.min.css`,dark:`${Be}/@highlightjs/cdn-assets@11.10.0/styles/kimbie-dark.min.css`},paraiso:{light:`${Be}/@highlightjs/cdn-assets@11.10.0/styles/paraiso-light.min.css`,dark:`${Be}/@highlightjs/cdn-assets@11.10.0/styles/paraiso-dark.min.css`},qtcreator:{light:`${Be}/@highlightjs/cdn-assets@11.10.0/styles/qtcreator-light.min.css`,dark:`${Be}/@highlightjs/cdn-assets@11.10.0/styles/qtcreator-dark.min.css`},stackoverflow:{light:`${Be}/@highlightjs/cdn-assets@11.10.0/styles/stackoverflow-light.min.css`,dark:`${Be}/@highlightjs/cdn-assets@11.10.0/styles/stackoverflow-dark.min.css`}},g5={highlight:{js:{integrity:"sha384-GdEWAbCjn+ghjX0gLx7/N1hyTVmPAjdC2OvoAA0RyNcAOhqwtT8qnbCxWle2+uJX",crossOrigin:"anonymous"},css:{a11y:{light:{integrity:"sha384-qdZDAN3jffvh670RHw1wxLekabidEFaNRninYgIzBvMbL6WlHdXeHS/Bt+vx33lN",crossOrigin:"anonymous"},dark:{integrity:"sha384-2QAAjX8pqaM5azX68KWI2wExF6Q13kY4kEiQFY4b/1zPe6rpgmTByNpDEllH3sb+",crossOrigin:"anonymous"}},atom:{light:{integrity:"sha384-w6Ujm1VWa9HYFqGc89oAPn/DWDi2gUamjNrq9DRvEYm2X3ClItg9Y9xs1ViVo5b5",crossOrigin:"anonymous"},dark:{integrity:"sha384-oaMLBGEzBOJx3UHwac0cVndtX5fxGQIfnAeFZ35RTgqPcYlbprH9o9PUV/F8Le07",crossOrigin:"anonymous"}},github:{light:{integrity:"sha384-eFTL69TLRZTkNfYZOLM+G04821K1qZao/4QLJbet1pP4tcF+fdXq/9CdqAbWRl/L",crossOrigin:"anonymous"},dark:{integrity:"sha384-wH75j6z1lH97ZOpMOInqhgKzFkAInZPPSPlZpYKYTOqsaizPvhQZmAtLcPKXpLyH",crossOrigin:"anonymous"}},gradient:{light:{integrity:"sha384-yErHBR8aEZPxRl3XmR8dGSRAclMlnSRRw8sXQLcmPWzWUvb56BzQmBw3EWHl7QGI",crossOrigin:"anonymous"},dark:{integrity:"sha384-lUCvtSOdvDbp5hLWKgwz/taFu1HxlpqES2OVP5UG2JMTfnU481gXcBhGF9lAGoSr",crossOrigin:"anonymous"}},kimbie:{light:{integrity:"sha384-tloeSLUPczAvoZ48TUz+OxRie0oYLCRwlkadUXovGzzJEIbNQB2TkfUuvJ6SW5Mi",crossOrigin:"anonymous"},dark:{integrity:"sha384-o5F1vUaMNOmou1sQrsWiFo4/QUGSV0svqNZW+EesmKxWC8MpFJcveBhAyfvTHbGb",crossOrigin:"anonymous"}},paraiso:{light:{integrity:"sha384-5j6QHU2Hwg1ehtlIQNDebhETDB8bga3/88hzBFsMRaGmgQHCftqIN7GZNDNw0vTL",crossOrigin:"anonymous"},dark:{integrity:"sha384-I5vnnMQu0LWDQnHpT61xyoMwKarAB8jpZkB2ioFOlmzUFnIFaV4QbUwlBBOMKhTH",crossOrigin:"anonymous"}},qtcreator:{light:{integrity:"sha384-iEBgHrwi8Hv4dSZBz+MOGvS05rF7I7fGKM2fASQyE9jn2Istg9Qd5dSoK18WyRTB",crossOrigin:"anonymous"},dark:{integrity:"sha384-D6LXJGWNR4QV7gnpuP3ccbvOYoR02td3cU0y7lESABPg/tzCSC4m+y+M2TtrmpHc",crossOrigin:"anonymous"}},stackoverflow:{light:{integrity:"sha384-FMwt7cTGo4aLxZnno5k0xTj0W4gmi48Kwept+y/oQmE6cFk36Kr+QJZOKNOQwORe",crossOrigin:"anonymous"},dark:{integrity:"sha384-iL+x+BroCyHm/p2c6sMA9umXhdCWp2cKe4QUjPeMzHgwXAk+ZxHyIGP3NZTZensU",crossOrigin:"anonymous"}}}},prettier:{standaloneJs:{integrity:"sha384-92h6ALm8/lHpNGn6MfGlgZ+I8c/4yn/nSN8dV9ZmDxqbP9L93gk/Jj2i0LtV+AVd",crossOrigin:"anonymous"},parserMarkdownJs:{integrity:"sha384-5ufuUgoSsr/2oihBZ5d+c+yt0qaUmzLtUz41VZNJ4txtyJ6mBve3ZwuKoq/IygYX",crossOrigin:"anonymous"}},cropper:{js:{integrity:"sha384-jrOgQzBlDeUNdmQn3rUt/PZD+pdcRBdWd/HWRqRo+n2OR2QtGyjSaJC0GiCeH+ir",crossOrigin:"anonymous"},css:{integrity:"sha384-6LFfkTKLRlzFtgx8xsWyBdKGpcMMQTkv+dB7rAbugeJAu1Ym2q1Aji1cjHBG12Xh",crossOrigin:"anonymous"}},screenfull:{js:{integrity:"sha384-Qfbv8upMDu/ikv42M0Jnym2hahbDQ77Nm8PGU0G+iA6UIwt1+scE6P1qKXA0anWU",crossOrigin:"anonymous"}},mermaid:{js:{integrity:"sha384-UzWEhMP22MxNnr2bzqAdmtf1FDy5iKDUq6hLXJFLqC7dfGkc6W/hshbx9m71zyt5",crossOrigin:"anonymous"}},katex:{js:{integrity:"sha384-cMkvdD8LoxVzGF/RPUKAcvmm49FQ0oxwDF3BGKtDXcEc+T1b2N+teh/OJfpU0jr6",crossOrigin:"anonymous"},css:{integrity:"sha384-5TcZemv2l/9On385z///+d7MSYlvIEw9FuZTIdZ14vJLqWphw7e7ZPuOiCHJcFCP",crossOrigin:"anonymous"}}},hh=["bold","underline","italic","strikeThrough","-","title","sub","sup","quote","unorderedList","orderedList","task","-","codeRow","code","link","image","table","mermaid","katex","-","revoke","next","save","=","prettier","pageFullscreen","fullscreen","preview","previewOnly","htmlPreview","catalog","github"],ph=["markdownTotal","=","scrollSwitch"],cu={"zh-CN":{toolbarTips:{bold:"加粗",underline:"下划线",italic:"斜体",strikeThrough:"删除线",title:"标题",sub:"下标",sup:"上标",quote:"引用",unorderedList:"无序列表",orderedList:"有序列表",task:"任务列表",codeRow:"行内代码",code:"块级代码",link:"链接",image:"图片",table:"表格",mermaid:"mermaid图",katex:"katex公式",revoke:"后退",next:"前进",save:"保存",prettier:"美化",pageFullscreen:"浏览器全屏",fullscreen:"屏幕全屏",preview:"预览",previewOnly:"仅预览",htmlPreview:"html代码预览",catalog:"目录",github:"源码地址"},titleItem:{h1:"一级标题",h2:"二级标题",h3:"三级标题",h4:"四级标题",h5:"五级标题",h6:"六级标题"},imgTitleItem:{link:"添加链接",upload:"上传图片",clip2upload:"裁剪上传"},linkModalTips:{linkTitle:"添加链接",imageTitle:"添加图片",descLabel:"链接描述:",descLabelPlaceHolder:"请输入描述...",urlLabel:"链接地址:",urlLabelPlaceHolder:"请输入链接...",buttonOK:"确定"},clipModalTips:{title:"裁剪图片上传",buttonUpload:"上传"},copyCode:{text:"复制代码",successTips:"已复制!",failTips:"复制失败!"},mermaid:{flow:"流程图",sequence:"时序图",gantt:"甘特图",class:"类图",state:"状态图",pie:"饼图",relationship:"关系图",journey:"旅程图"},katex:{inline:"行内公式",block:"块级公式"},footer:{markdownTotal:"字数",scrollAuto:"同步滚动"}},"en-US":{toolbarTips:{bold:"bold",underline:"underline",italic:"italic",strikeThrough:"strikeThrough",title:"title",sub:"subscript",sup:"superscript",quote:"quote",unorderedList:"unordered list",orderedList:"ordered list",task:"task list",codeRow:"inline code",code:"block-level code",link:"link",image:"image",table:"table",mermaid:"mermaid",katex:"formula",revoke:"revoke",next:"undo revoke",save:"save",prettier:"prettier",pageFullscreen:"fullscreen in page",fullscreen:"fullscreen",preview:"preview",previewOnly:"preview only",htmlPreview:"html preview",catalog:"catalog",github:"source code"},titleItem:{h1:"Lv1 Heading",h2:"Lv2 Heading",h3:"Lv3 Heading",h4:"Lv4 Heading",h5:"Lv5 Heading",h6:"Lv6 Heading"},imgTitleItem:{link:"Add Image Link",upload:"Upload Images",clip2upload:"Crop And Upload"},linkModalTips:{linkTitle:"Add Link",imageTitle:"Add Image",descLabel:"Desc:",descLabelPlaceHolder:"Enter a description...",urlLabel:"Link:",urlLabelPlaceHolder:"Enter a link...",buttonOK:"OK"},clipModalTips:{title:"Crop Image",buttonUpload:"Upload"},copyCode:{text:"Copy",successTips:"Copied!",failTips:"Copy failed!"},mermaid:{flow:"flow",sequence:"sequence",gantt:"gantt",class:"class",state:"state",pie:"pie",relationship:"relationship",journey:"journey"},katex:{inline:"inline",block:"block"},footer:{markdownTotal:"Character Count",scrollAuto:"Scroll Auto"}}},dt={editorExtensions:{highlight:{js:f5,css:dh},prettier:{standaloneJs:$0.main,parserMarkdownJs:$0.markdown},cropper:{...d5},screenfull:{js:h5},mermaid:{js:p5,enableZoom:!0},katex:{...m5}},editorExtensionsAttrs:{},editorConfig:{languageUserDefined:{},mermaidTemplate:{},renderDelay:500,zIndex:2e4},codeMirrorExtensions:(e,t)=>t,markdownItConfig:()=>{},markdownItPlugins:e=>e,mermaidConfig:e=>e,katexConfig:e=>e},Q5=e=>fh(dt,e,{excludeKeys(t){return/[iI]{1}nstance/.test(t)}}),fu=.1,$5=m.defineComponent({name:`${X}-divider`,setup(){return()=>m.createVNode("div",{class:`${X}-divider`},null)}}),tn=({instance:e,ctx:t,props:n={}},i="default")=>{const r=(e==null?void 0:e.$slots[i])||(t==null?void 0:t.slots[i]);return(r?r(e):"")||n[i]},b5={overlay:{type:[String,Object],default:""},visible:{type:Boolean,default:!1},onChange:{type:Function,default:()=>{}},relative:{type:String,default:"html"},disabled:{type:Boolean,default:void 0}},Ta=m.defineComponent({name:`${X}-dropdown`,props:b5,setup(e,t){const n=`${X}-dropdown-hidden`,i=m.reactive({overlayClass:[n],overlayStyle:{},triggerHover:!1,overlayHover:!1}),r=m.ref(),o=m.ref(),a=()=>{var y,T;if(e.disabled)return!1;i.triggerHover=!0;const u=r.value,c=o.value;if(!u||!c)return;const f=u.getBoundingClientRect(),d=u.offsetTop,p=u.offsetLeft,$=f.height,b=f.width,g=u.getRootNode(),Q=((y=g.querySelector(e.relative))==null?void 0:y.scrollLeft)||0,S=((T=g.querySelector(e.relative))==null?void 0:T.clientWidth)||0;let k=p-c.offsetWidth/2+b/2-Q;k+c.offsetWidth>Q+S&&(k=Q+S-c.offsetWidth),k<0&&(k=0),i.overlayStyle={...i.overlayStyle,top:d+$+"px",left:k+"px"},e.onChange(!0)},O=()=>{if(e.disabled)return!1;i.overlayHover=!0};m.watch(()=>e.visible,u=>{u?i.overlayClass=i.overlayClass.filter(c=>c!==n):i.overlayClass.push(n)});let l=-1;const s=u=>{r.value===u.target?i.triggerHover=!1:i.overlayHover=!1,clearTimeout(l),l=window.setTimeout(()=>{!i.overlayHover&&!i.triggerHover&&e.onChange(!1)},10)};return m.onMounted(()=>{r.value.addEventListener("mouseenter",a),r.value.addEventListener("mouseleave",s),o.value.addEventListener("mouseenter",O),o.value.addEventListener("mouseleave",s)}),m.onBeforeUnmount(()=>{r.value.removeEventListener("mouseenter",a),r.value.removeEventListener("mouseleave",s),o.value.removeEventListener("mouseenter",O),o.value.removeEventListener("mouseleave",s)}),()=>{const u=tn({ctx:t}),c=tn({props:e,ctx:t},"overlay"),f=m.cloneVNode(u instanceof Array?u[0]:u,{ref:r,key:"cloned-dropdown-trigger"}),d=m.createVNode("div",{class:[`${X}-dropdown`,i.overlayClass],style:i.overlayStyle,ref:o},[m.createVNode("div",{class:`${X}-dropdown-overlay`},[c instanceof Array?c[0]:c])]);return[f,d]}}});class y5{constructor(){We(this,"pools",{})}remove(t,n,i){const o=this.pools[t]&&this.pools[t][n];o&&(this.pools[t][n]=o.filter(a=>a!==i))}clear(t){this.pools[t]={}}on(t,n){return this.pools[t]||(this.pools[t]={}),this.pools[t][n.name]||(this.pools[t][n.name]=[]),this.pools[t][n.name].push(n.callback),this.pools[t][n.name].includes(n.callback)}emit(t,n,...i){this.pools[t]||(this.pools[t]={});const o=this.pools[t][n];o&&o.forEach(a=>{try{a(...i)}catch(O){console.error(`${n} monitor event exception!`,O)}})}}const F=new y5,S5={noPrettier:{type:Boolean},toolbars:{type:Array,default:()=>[]},toolbarsExclude:{type:Array,default:()=>[]},setting:{type:Object,default:()=>({})},screenfull:{type:Object,default:null},screenfullJs:{type:String,default:""},updateSetting:{type:Function,default:()=>{}},tableShape:{type:Array,default:()=>[6,4]},defToolbars:{type:Object},noUploadImg:{type:Boolean},showToolbarName:{type:Boolean},catalogVisible:{type:Boolean},codeTheme:{type:String},insertLinkDirect:{type:Boolean}},du="onSave",mh="changeCatalogVisible",b0="changeFullscreen",y0="pageFullscreenChanged",S0="fullscreenChanged",P0="previewChanged",k0="previewOnlyChanged",x0="htmlPreviewChanged",v0="catalogVisibleChanged",hu="buildFinished",Ar="errorCatcher",je="replace",pu="uploadImage",gh="openModals",w0="ctrlZ",T0="ctrlShiftZ",KO="catalogChanged",X0="pushCatalog",Qh="rerender",_0="eventListener",R0="taskStateChanged",z0="sendEditorView",mu="getEditorView",P5={copy:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy ${X}-icon"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`,"collapse-tips":`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-chevron-left ${X}-icon"><circle cx="12" cy="12" r="10"/><path d="m14 16-4-4 4-4"/></svg>`,pin:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-pin"><path d="M12 17v5"/><path d="M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"/></svg>',"pin-off":'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-pin-off"><path d="M12 17v5"/><path d="M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89"/><path d="m2 2 20 20"/><path d="M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11"/></svg>'},JO=(e,t)=>typeof t[e]=="string"?t[e]:P5[e],q0=(e,t)=>{const n=i=>{const r=e.parentElement||document.body,o=r.offsetWidth,a=r.offsetHeight,{clientWidth:O,clientHeight:l}=document.documentElement,s=i.offsetX,u=i.offsetY,c=d=>{let p=d.x+document.body.scrollLeft-document.body.clientLeft-s,$=d.y+document.body.scrollTop-document.body.clientTop-u;p=p<1?1:p<O-o-1?p:O-o-1,$=$<1?1:$<l-a-1?$:l-a-1,t?t(p,$):(r.style.left=`${p}px`,r.style.top=`${$}px`)};document.addEventListener("mousemove",c);const f=()=>{document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",f)};document.addEventListener("mouseup",f)};return e.addEventListener("mousedown",n),()=>{e.removeEventListener("mousedown",n)}},In=(e,t,n="")=>{var r;const i=document.getElementById(t.id);if(i)n!==""&&(Reflect.get(window,n)?(r=t.onload)==null||r.call(i,new Event("load")):t.onload&&i.addEventListener("load",t.onload));else{const o={...t};o.onload=null;const a=x5(e,o);t.onload&&a.addEventListener("load",t.onload),document.head.appendChild(a)}},k5=(e,t)=>{const n=document.getElementById(t.id);n==null||n.remove(),In(e,t)},x5=(e,t)=>{const n=document.createElement(e);return Object.keys(t).forEach(i=>{t[i]!==void 0&&(n[i]=t[i])}),n},W0=(()=>{const e=n=>{if(!n)return()=>{};const i=n.firstChild;let r=1,o=0,a=0,O=!1,l,s,u,c=1;const f=()=>{i.style.transform=`translate(${o}px, ${a}px) scale(${r})`},d=y=>{y.touches.length===1?(O=!0,l=y.touches[0].clientX-o,s=y.touches[0].clientY-a):y.touches.length===2&&(u=Math.hypot(y.touches[0].clientX-y.touches[1].clientX,y.touches[0].clientY-y.touches[1].clientY),c=r)},p=y=>{if(y.preventDefault(),O&&y.touches.length===1)o=y.touches[0].clientX-l,a=y.touches[0].clientY-s,f();else if(y.touches.length===2){const x=Math.hypot(y.touches[0].clientX-y.touches[1].clientX,y.touches[0].clientY-y.touches[1].clientY)/u,w=r;r=c*(1+(x-1));const v=(y.touches[0].clientX+y.touches[1].clientX)/2,E=(y.touches[0].clientY+y.touches[1].clientY)/2,V=i.getBoundingClientRect(),q=(v-V.left)/w,Y=(E-V.top)/w;o-=q*(r-w),a-=Y*(r-w),f()}},$=()=>{O=!1},b=y=>{y.preventDefault();const T=.02,x=r;y.deltaY<0?r+=T:r=Math.max(.1,r-T);const w=i.getBoundingClientRect(),v=y.clientX-w.left,E=y.clientY-w.top;o-=v/x*(r-x),a-=E/x*(r-x),f()},g=y=>{O=!0,l=y.clientX-o,s=y.clientY-a},Q=y=>{O&&(o=y.clientX-l,a=y.clientY-s,f())},S=()=>{O=!1},k=()=>{O=!1};return n.addEventListener("touchstart",d,{passive:!1}),n.addEventListener("touchmove",p,{passive:!1}),n.addEventListener("touchend",$),n.addEventListener("wheel",b,{passive:!1}),n.addEventListener("mousedown",g),n.addEventListener("mousemove",Q),n.addEventListener("mouseup",S),n.addEventListener("mouseleave",k),()=>{n.removeEventListener("touchstart",d),n.removeEventListener("touchmove",p),n.removeEventListener("touchend",$),n.removeEventListener("wheel",b),n.removeEventListener("mousedown",g),n.removeEventListener("mousemove",Q),n.removeEventListener("mouseup",S),n.removeEventListener("mouseleave",k)}};return(n,i)=>{const r=new Map;return n==null||n.forEach(o=>{let a=o.querySelector(`.${X}-mermaid-action`);a||(o.insertAdjacentHTML("beforeend",`<div class="${X}-mermaid-action">${JO("pin-off",i.customIcon)}</div>`),a=o.querySelector(`.${X}-mermaid-action`));const O=()=>{const l=r.get(o);if(l!=null&&l.removeEvent)l.removeEvent(),o.removeAttribute("data-grab"),r.set(o,{removeClick:l.removeClick}),a.innerHTML=JO("pin-off",i.customIcon);else{const s=e(o);o.setAttribute("data-grab",""),r.set(o,{removeEvent:s,removeClick:l==null?void 0:l.removeClick}),a.innerHTML=JO("pin",i.customIcon)}};a.addEventListener("click",O),r.set(o,{removeClick:()=>a.removeEventListener("click",O)})}),()=>{r.forEach(({removeEvent:o,removeClick:a})=>{o==null||o(),a==null||a()}),r.clear()}}})(),cn={hljs:`${X}-hljs`,hlcss:`${X}-hlCss`,prettier:`${X}-prettier`,prettierMD:`${X}-prettierMD`,cropperjs:`${X}-cropper`,croppercss:`${X}-cropperCss`,screenfull:`${X}-screenfull`,mermaidM:`${X}-mermaid-m`,mermaid:`${X}-mermaid`,katexjs:`${X}-katex`,katexcss:`${X}-katexCss`},v5=e=>{const t=m.inject("editorId"),{editorExtensions:n,editorExtensionsAttrs:i}=dt;let r=n.screenfull.instance;const o=m.ref(!1),a=s=>{if(!r){F.emit(t,Ar,{name:"fullscreen",message:"fullscreen is undefined"});return}r.isEnabled?(o.value=!0,(s===void 0?!r.isFullscreen:s)?r.request():r.exit()):console.error("browser does not support screenfull!")},O=()=>{r&&r.isEnabled&&r.on("change",()=>{(o.value||e.setting.fullscreen)&&(o.value=!1,e.updateSetting("fullscreen"))})},l=()=>{r=window.screenfull,O()};return m.onMounted(()=>{var s;O(),r||In("script",{...(s=i.screenfull)==null?void 0:s.js,src:n.screenfull.js,id:cn.screenfull,onload:l},"screenfull")}),m.onMounted(()=>{F.on(t,{name:b0,callback:a})}),{fullscreenHandler:a}},w5={tableShape:{type:Array,default:()=>[6,4]},onSelected:{type:Function,default:()=>{}}},T5=m.defineComponent({name:"TableShape",props:w5,setup(e){const t=m.reactive({x:-1,y:-1}),n=m.computed(()=>JSON.stringify(e.tableShape)),i=()=>{const o=[...JSON.parse(n.value)];return(!o[2]||o[2]<o[0])&&(o[2]=o[0]),(!o[3]||o[3]<o[3])&&(o[3]=o[1]),o},r=m.ref(i());return m.watch([n],()=>{r.value=i()}),()=>m.createVNode("div",{class:`${X}-table-shape`,onMouseleave:()=>{r.value=i(),t.x=-1,t.y=-1}},[new Array(r.value[1]).fill("").map((o,a)=>m.createVNode("div",{class:`${X}-table-shape-row`,key:`table-shape-row-${a}`},[new Array(r.value[0]).fill("").map((O,l)=>m.createVNode("div",{class:`${X}-table-shape-col`,key:`table-shape-col-${l}`,onMouseenter:()=>{t.x=a,t.y=l,l+1===r.value[0]&&l+1<r.value[2]?r.value[0]++:l+2<r.value[0]&&r.value[0]>e.tableShape[0]&&r.value[0]--,a+1===r.value[1]&&a+1<r.value[3]?r.value[1]++:a+2<r.value[1]&&r.value[1]>e.tableShape[1]&&r.value[1]--},onClick:()=>{e.onSelected(t)}},[m.createVNode("div",{class:[`${X}-table-shape-col-default`,a<=t.x&&l<=t.y&&`${X}-table-shape-col-include`]},null)]))]))])}});/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X5=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var gu={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _5=({size:e,strokeWidth:t=2,absoluteStrokeWidth:n,color:i,iconNode:r,name:o,class:a,...O},{slots:l})=>m.h("svg",{...gu,width:e||gu.width,height:e||gu.height,stroke:i||gu.stroke,"stroke-width":n?Number(t)*24/Number(e):t,class:["lucide",`lucide-${X5(o??"icon")}`],...O},[...r.map(s=>m.h(...s)),...l.default?[l.default()]:[]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ye=(e,t)=>(n,{slots:i})=>m.h(_5,{...n,iconNode:t,name:e},i);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R5=Ye("BoldIcon",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z5=Ye("ChartAreaIcon",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z",key:"q0gr47"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q5=Ye("CodeXmlIcon",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W5=Ye("CodeIcon",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y5=Ye("ExpandIcon",[["path",{d:"m21 21-6-6m6 6v-4.8m0 4.8h-4.8",key:"1c15vz"}],["path",{d:"M3 16.2V21m0 0h4.8M3 21l6-6",key:"1fsnz2"}],["path",{d:"M21 7.8V3m0 0h-4.8M21 3l-6 6",key:"hawz9i"}],["path",{d:"M3 7.8V3m0 0h4.8M3 3l6 6",key:"u9ee12"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U5=Ye("EyeIcon",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E5=Ye("ForwardIcon",[["polyline",{points:"15 17 20 12 15 7",key:"1w3sku"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V5=Ye("HeadingIcon",[["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M6 20V4",key:"1w1bmo"}],["path",{d:"M18 20V4",key:"o2hl4u"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z5=Ye("ImageIcon",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C5=Ye("ItalicIcon",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j5=Ye("LinkIcon",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A5=Ye("ListOrderedIcon",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G5=Ye("ListTodoIcon",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I5=Ye("ListTreeIcon",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D5=Ye("ListIcon",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L5=Ye("Maximize2Icon",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N5=Ye("Minimize2Icon",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M5=Ye("QuoteIcon",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F5=Ye("ReplyIcon",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B5=Ye("SaveIcon",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H5=Ye("ShrinkIcon",[["path",{d:"m15 15 6 6m-6-6v4.8m0-4.8h4.8",key:"17vawe"}],["path",{d:"M9 19.8V15m0 0H4.2M9 15l-6 6",key:"chjx8e"}],["path",{d:"M15 4.2V9m0 0h4.8M15 9l6-6",key:"lav6yq"}],["path",{d:"M9 4.2V9m0 0H4.2M9 9 3 3",key:"1pxi2q"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y0=Ye("SquareCodeIcon",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K5=Ye("SquareSigmaIcon",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M16 8.9V7H8l4 5-4 5h8v-1.9",key:"9nih0i"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J5=Ye("StrikethroughIcon",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eq=Ye("SubscriptIcon",[["path",{d:"m4 5 8 8",key:"1eunvl"}],["path",{d:"m12 5-8 8",key:"1ah0jp"}],["path",{d:"M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07",key:"e8ta8j"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tq=Ye("SuperscriptIcon",[["path",{d:"m4 19 8-8",key:"hr47gm"}],["path",{d:"m12 19-8-8",key:"1dhhmo"}],["path",{d:"M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06",key:"1dfcux"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nq=Ye("TableIcon",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iq=Ye("Trash2Icon",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rq=Ye("UnderlineIcon",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oq=Ye("UploadIcon",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aq=Ye("ViewIcon",[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]);/** * @license lucide-vue-next v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oq=Ye("XIcon",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),lq={bold:R5,underline:rq,italic:C5,"strike-through":J5,title:V5,sub:eq,sup:tq,quote:M5,"unordered-list":D5,"ordered-list":A5,task:G5,"code-row":W5,code:Y0,link:j5,image:Z5,table:nq,revoke:F5,next:E5,save:B5,prettier:Y0,minimize:N5,maximize:L5,"fullscreen-exit":H5,fullscreen:Y5,"preview-only":aq,preview:U5,"preview-html":q5,catalog:I5,github:()=>m.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-github-icon"},[m.createVNode("path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"},null),m.createVNode("path",{d:"M9 18c-4.51 2-5-2-7-2"},null)]),mermaid:z5,formula:K5,close:Oq,delete:iq,upload:oq},sq=m.defineComponent({name:`${X}-icon-set`,props:{name:{type:String,default:""}},setup(e){return()=>m.h(lq[e.name],{class:`${X}-icon`})}}),we=m.defineComponent({name:`${X}-icon`,props:{name:{type:String,default:""}},setup(e){const t=m.inject("customIcon");return()=>{const n=t.value[e.name];return typeof n=="object"?typeof n.component=="object"?m.h(n.component,n.props):m.createVNode("span",{innerHTML:n.component},null):m.createVNode(sq,{name:e.name},null)}}}),uq=(e,t="image.png")=>{const n=e.split(","),i=n[0].match(/:(.*?);/);if(i){const r=i[1],o=atob(n[1]);let a=o.length;const O=new Uint8Array(a);for(;a--;)O[a]=o.charCodeAt(a);return new File([O],t,{type:r})}return null},cq=(e,t)=>{if(!e)return e;const n=t.split(` `),i=['<span rn-wrapper aria-hidden="true">'];return n.forEach(()=>{i.push("<span></span>")}),i.push("</span>"),`<span class="${X}-code-block">${e}</span>${i.join("")}`},fq=(e,t)=>{if(!e||!t)return 0;const n=e==null?void 0:e.getBoundingClientRect();if(t===document.documentElement)return n.top-t.clientTop;const i=t==null?void 0:t.getBoundingClientRect();return n.top-i.top},U0=(()=>{let e=0;return()=>++e})(),dq={title:{type:[String,Object],default:""},visible:{type:Boolean,default:!1},width:{type:String,default:"auto"},height:{type:String,default:"auto"},onClose:{type:Function},showAdjust:{type:Boolean,default:!1},isFullscreen:{type:Boolean,default:!1},onAdjust:{type:Function,default:()=>{}},class:{type:String,default:void 0},style:{type:[Object,String],default:()=>({})},showMask:{type:Boolean,default:!0}},Xo=m.defineComponent({name:"MdModal",props:dq,emits:["onClose"],setup(e,t){const n=m.inject("theme"),i=m.inject("rootRef"),r=m.ref(e.visible),o=m.ref([`${X}-modal`]),a=m.ref(),O=m.ref(),l=m.ref(),s=m.shallowRef();let u=()=>{};const c=m.reactive({maskStyle:{zIndex:-1},modalStyle:{zIndex:-1},initPos:{left:"0px",top:"0px"},historyPos:{left:"0px",top:"0px"}}),f=m.computed(()=>e.isFullscreen?{width:"100%",height:"100%"}:{width:e.width,height:e.height});m.watch(()=>e.isFullscreen,$=>{$?u():m.nextTick(()=>{u=q0(O.value,(b,g)=>{c.initPos.left=b+"px",c.initPos.top=g+"px"})})}),m.watch(()=>e.visible,$=>{$?(c.maskStyle.zIndex=dt.editorConfig.zIndex+U0(),c.modalStyle.zIndex=dt.editorConfig.zIndex+U0(),o.value.push("zoom-in"),r.value=$,m.nextTick(()=>{const b=a.value.offsetWidth/2,g=a.value.offsetHeight/2,Q=document.documentElement.clientWidth/2,S=document.documentElement.clientHeight/2;c.initPos.left=Q-b+"px",c.initPos.top=S-g+"px",e.isFullscreen||(u=q0(O.value,(k,y)=>{c.initPos.left=k+"px",c.initPos.top=y+"px"}))}),setTimeout(()=>{o.value=o.value.filter(b=>b!=="zoom-in")},140)):(o.value.push("zoom-out"),u(),setTimeout(()=>{o.value=o.value.filter(b=>b!=="zoom-out"),r.value=$},130))});const d=m.computed(()=>({display:r.value?"block":"none"})),p=m.computed(()=>typeof e.style=="string"?[e.style,d.value].join("; "):e.style instanceof Object?{...d.value,...e.style}:d.value);return m.onMounted(()=>{var b;const $=(b=i.value)==null?void 0:b.getRootNode();l.value=$ instanceof Document?document.body:$}),()=>{const $=tn({ctx:t}),b=tn({props:e,ctx:t},"title");return l.value?m.createVNode(m.Teleport,{to:l.value},{default:()=>[m.createVNode("div",{ref:s,class:`${X}-modal-container`,"data-theme":n.value},[m.createVNode("div",{class:e.class,style:p.value},[e.showMask&&m.createVNode("div",{class:`${X}-modal-mask`,style:c.maskStyle,onClick:()=>{var g;(g=e.onClose)==null||g.call(e),t.emit("onClose")}},null),m.createVNode("div",{class:o.value,style:{...c.modalStyle,...c.initPos,...f.value},ref:a},[m.createVNode("div",{class:`${X}-modal-header`,ref:O},[b||""]),m.createVNode("div",{class:`${X}-modal-body`},[$]),m.createVNode("div",{class:`${X}-modal-func`},[e.showAdjust&&m.createVNode("div",{class:`${X}-modal-adjust`,onClick:g=>{g.stopPropagation(),e.isFullscreen?c.initPos=c.historyPos:(c.historyPos=c.initPos,c.initPos={left:"0",top:"0"}),e.onAdjust(!e.isFullscreen)}},[m.createVNode(we,{name:e.isFullscreen?"minimize":"maximize"},null)]),m.createVNode("div",{class:`${X}-modal-close`,onClick:g=>{var Q;g.stopPropagation(),(Q=e.onClose)==null||Q.call(e),t.emit("onClose")}},[m.createVNode(we,{name:"close"},null)])])])])])]}):""}}});Xo.install=e=>(e.component(Xo.name,Xo),e);const hq={type:{type:String,default:"link"},visible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}}},pq=m.defineComponent({name:`${X}-modal-link`,props:hq,setup(e){const t=m.inject("usedLanguageText"),n=m.inject("editorId"),i=m.computed(()=>{var o,a;switch(e.type){case"link":return(o=t.value.linkModalTips)==null?void 0:o.linkTitle;case"image":return(a=t.value.linkModalTips)==null?void 0:a.imageTitle;default:return""}}),r=m.reactive({desc:"",url:""});return m.watch(()=>e.visible,o=>{o||setTimeout(()=>{r.desc="",r.url=""},200)}),()=>m.createVNode(Xo,{title:i.value,visible:e.visible,onClose:e.onCancel},{default:()=>{var o,a,O,l,s;return[m.createVNode("div",{class:`${X}-form-item`},[m.createVNode("label",{class:`${X}-label`,for:`link-desc-${n}`},[(o=t.value.linkModalTips)==null?void 0:o.descLabel]),m.createVNode("input",{placeholder:(a=t.value.linkModalTips)==null?void 0:a.descLabelPlaceHolder,class:`${X}-input`,id:`link-desc-${n}`,type:"text",value:r.desc,onChange:u=>{r.desc=u.target.value},autocomplete:"off"},null)]),m.createVNode("div",{class:`${X}-form-item`},[m.createVNode("label",{class:`${X}-label`,for:`link-url-${n}`},[(O=t.value.linkModalTips)==null?void 0:O.urlLabel]),m.createVNode("input",{placeholder:(l=t.value.linkModalTips)==null?void 0:l.urlLabelPlaceHolder,class:`${X}-input`,id:`link-url-${n}`,type:"text",value:r.url,onChange:u=>{r.url=u.target.value},autocomplete:"off"},null)]),m.createVNode("div",{class:`${X}-form-item`},[m.createVNode("button",{class:[`${X}-btn`,`${X}-btn-row`],type:"button",onClick:()=>{e.onOk(r),r.desc="",r.url=""}},[(s=t.value.linkModalTips)==null?void 0:s.buttonOK])])]}})}}),mq={visible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}}},gq=m.defineComponent({name:`${X}-modal-clip`,props:mq,setup(e){const t=m.inject("usedLanguageText"),n=m.inject("editorId"),i=m.inject("rootRef");let r=dt.editorExtensions.cropper.instance;const o=m.ref(),a=m.ref(),O=m.ref(),l=m.reactive({cropperInited:!1,imgSelected:!1,imgSrc:"",isFullscreen:!1});let s=null;m.watch(()=>e.visible,()=>{e.visible&&!l.cropperInited&&(r=r||window.Cropper,o.value.onchange=()=>{if(!r){F.emit(n,Ar,{name:"Cropper",message:"Cropper is undefined"});return}const c=o.value.files||[];if(l.imgSelected=!0,(c==null?void 0:c.length)>0){const f=new FileReader;f.onload=d=>{l.imgSrc=d.target.result},f.readAsDataURL(c[0])}})}),m.watch(()=>[l.imgSelected],()=>{O.value.style=""}),m.watch([m.toRef(()=>l.isFullscreen),m.toRef(()=>l.imgSrc)],()=>{l.imgSrc&&m.nextTick(()=>{s==null||s.destroy(),O.value.style="",a.value&&(s=new r(a.value,{viewMode:2,preview:i.value.getRootNode().querySelector(`.${X}-clip-preview-target`)}))})});const u=()=>{s.clear(),s.destroy(),s=null,o.value.value="",l.imgSelected=!1};return()=>{var c;return m.createVNode(Xo,{class:`${X}-modal-clip`,title:(c=t.value.clipModalTips)==null?void 0:c.title,visible:e.visible,onClose:e.onCancel,showAdjust:!0,isFullscreen:l.isFullscreen,onAdjust:f=>{l.isFullscreen=f},width:"668px",height:"421px"},{default:()=>{var f,d,p;return[m.createVNode("div",{class:`${X}-form-item ${X}-clip`},[m.createVNode("div",{class:`${X}-clip-main`},[l.imgSelected?m.createVNode("div",{class:`${X}-clip-cropper`},[m.createVNode("img",{src:l.imgSrc,ref:a,style:{display:"none"},alt:""},null),m.createVNode("div",{class:`${X}-clip-delete`,onClick:u},[m.createVNode(we,{name:"delete"},null)])]):m.createVNode("div",{class:`${X}-clip-upload`,onClick:()=>{o.value.click()},role:"button",tabindex:"0","aria-label":(f=t.value.imgTitleItem)==null?void 0:f.upload},[m.createVNode(we,{name:"upload"},null)])]),m.createVNode("div",{class:`${X}-clip-preview`},[m.createVNode("div",{class:`${X}-clip-preview-target`,ref:O},null)])]),m.createVNode("div",{class:`${X}-form-item`},[m.createVNode("button",{class:`${X}-btn`,type:"button",onClick:()=>{if(s){const $=s.getCroppedCanvas();F.emit(n,pu,[uq($.toDataURL("image/png"))],e.onOk),u()}}},[((d=t.value.clipModalTips)==null?void 0:d.buttonUpload)||((p=t.value.linkModalTips)==null?void 0:p.buttonOK)])]),m.createVNode("input",{ref:o,accept:"image/*",type:"file",multiple:!1,style:{display:"none"},"aria-hidden":"true"},null)]}})}}}),Qq={type:{type:String,default:"link"},linkVisible:{type:Boolean,default:!1},clipVisible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}}},$q=m.defineComponent({name:`${X}-modals`,props:Qq,setup(e){return()=>m.createVNode(m.Fragment,null,[m.createVNode(pq,{type:e.type,visible:e.linkVisible,onOk:e.onOk,onCancel:e.onCancel},null),m.createVNode(gq,{visible:e.clipVisible,onOk:e.onOk,onCancel:e.onCancel},null)])}}),bq=m.defineComponent({name:"MDEditorToolbar",props:S5,setup(e){const t=m.inject("editorId"),n=m.inject("usedLanguageText"),i=m.inject("theme"),r=m.inject("previewTheme"),o=m.inject("language"),a=m.inject("disabled"),{fullscreenHandler:O}=v5(e),l=`${t}-toolbar-wrapper`,s=m.ref(),u=m.reactive({title:!1,catalog:!1,image:!1,table:!1,mermaid:!1,katex:!1}),c=(Q,S)=>{if(a!=null&&a.value)return!1;F.emit(t,je,Q,S)},f=m.reactive({type:"link",linkVisible:!1,clipVisible:!1}),d=m.ref();m.onMounted(()=>{F.on(t,{name:gh,callback(Q){f.type=Q,f.linkVisible=!0}})});const p=m.computed(()=>{const Q=e.toolbars.filter(T=>!e.toolbarsExclude.includes(T)),S=Q.indexOf("="),k=S===-1?Q:Q.slice(0,S+1),y=S===-1?[]:Q.slice(S,Number.MAX_SAFE_INTEGER);return[k,y]}),$=m.ref(),b=()=>{F.emit(t,pu,Array.from($.value.files||[])),$.value.value=""};m.onMounted(()=>{$.value.addEventListener("change",b)});const g=Q=>{var S,k,y,T,x,w,v,E,V,q,Y,_,W,U,Z,G,D,I,N,ee,Oe,ze,M,ue,xe,De,kt,fi,An,Ci,IO,ba,Vr,DO,LO,ya,Ld,Nd,Sa,Md,fr,xt,ko,Pa,Zr,Fd,tu,Bd,Ze,Hd,NO,xo,MO,Kd,FO,di,Jd,ka,eh,BO,yn,nu,th,ji,nh,iu,ru,ih,Cr,Ai,jr,ou,dr,rh,au,xa,hi,va,oh,Ou,ah;if(hh.includes(Q))switch(Q){case"-":return m.createVNode($5,null,null);case"bold":return m.createVNode("div",{class:[`${X}-toolbar-item`,(a==null?void 0:a.value)&&`${X}-disabled`],title:(S=n.value.toolbarTips)==null?void 0:S.bold,onClick:()=>{c("bold")}},[m.createVNode(we,{name:"bold"},null),e.showToolbarName&&m.createVNode("div",{class:`${X}-toolbar-item-name`},[(k=n.value.toolbarTips)==null?void 0:k.bold])]);case"underline":return m.createVNode("div",{class:[`${X}-toolbar-item`,(a==null?void 0:a.value)&&`${X}-disabled`],title:(y=n.value.toolbarTips)==null?void 0:y.underline,onClick:()=>{c("underline")}},[m.createVNode(we,{name:"underline"},null),e.showToolbarName&&m.createVNode("div",{class:`${X}-toolbar-item-name`},[(T=n.value.toolbarTips)==null?void 0:T.underline])]);case"italic":return m.createVNode("div",{class:[`${X}-toolbar-item`,(a==null?void 0:a.value)&&`${X}-disabled`],title:(x=n.value.toolbarTips)==null?void 0:x.italic,onClick:()=>{c("italic")}},[m.createVNode(we,{name:"italic"},null),e.showToolbarName&&m.createVNode("div",{class:`${X}-toolbar-item-name`},[(w=n.value.toolbarTips)==null?void 0:w.italic])]);case"strikeThrough":return m.createVNode("div",{class:[`${X}-toolbar-item`,(a==null?void 0:a.value)&&`${X}-disabled`],title:(v=n.value.toolbarTips)==null?void 0:v.strikeThrough,onClick:()=>{c("strikeThrough")}},[m.createVNode(we,{name:"strike-through"},null),e.showToolbarName&&m.createVNode("div",{class:`${X}-toolbar-item-name`},[(E=n.value.toolbarTips)==null?void 0:E.strikeThrough])]);case"title":return m.createVNode(Ta,{relative:`#${l}`,visible:u.title,onChange:ge=>{u.title=ge},disabled:a==null?void 0:a.value,overlay:m.createVNode("ul",{class:`${X}-menu`,onClick:()=>{u.title=!1},role:"menu"},[m.createVNode("li",{class:`${X}-menu-item ${X}-menu-item-title`,onClick:()=>{c("h1")},role:"menuitem",tabindex:"0"},[(V=n.value.titleItem)==null?void 0:V.h1]),m.createVNode("li",{class:`${X}-menu-item ${X}-menu-item-title`,onClick:()=>{c("h2")},role:"menuitem",tabindex:"0"},[(q=n.value.titleItem)==null?void 0:q.h2]),m.createVNode("li",{class:`${X}-menu-item ${X}-menu-item-title`,onClick:()=>{c("h3")},role:"menuitem",tabindex:"0"},[(Y=n.value.titleItem)==null?void 0:Y.h3]),m.createVNode("li",{class:`${X}-menu-item ${X}-menu-item-title`,onClick:()=>{c("h4")},role:"menuitem",tabindex:"0"},[(_=n.value.titleItem)==null?void 0:_.h4]),m.createVNode("li",{class:`${X}-menu-ite