md-editor-v3 2.10.0 → 2.11.0

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.
@@ -0,0 +1,125 @@
1
+ (function(o,u){typeof exports=="object"&&typeof module<"u"?module.exports=u(require("vue")):typeof define=="function"&&define.amd?define(["vue"],u):(o=typeof globalThis<"u"?globalThis:o||self,o.MdEditorV3=u(o.Vue))})(this,function(o){var Je,we,me,Te,xe,tt,ne,ve,ie,Z,O,ue,ge,de,le,$e,ae,Le,Fe,Se,Ee,De,he,ut,Yt,Ue,Re,ht,pe,zt,Pn,qe,nt,ft,Ne,Pe,ze,Me,mt,Jt,it,jt,st,Ot,X,Y,gt,en,We,bt;"use strict";var Es=Object.defineProperty;var Ns=(o,u,J)=>u in o?Es(o,u,{enumerable:!0,configurable:!0,writable:!0,value:J}):o[u]=J;var se=(o,u,J)=>(Ns(o,typeof u!="symbol"?u+"":u,J),J),Qt=(o,u,J)=>{if(!u.has(o))throw TypeError("Cannot "+J)};var c=(o,u,J)=>(Qt(o,u,"read from private field"),J?J.call(o):u.get(o)),D=(o,u,J)=>{if(u.has(o))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(o):u.set(o,J)},L=(o,u,J,Ze)=>(Qt(o,u,"write to private field"),Ze?Ze.call(o,J):u.set(o,J),J),Rt=(o,u,J,Ze)=>({set _(K){L(o,u,K,J)},get _(){return c(o,u,Ze)}}),_=(o,u,J)=>(Qt(o,u,"access private method"),J);const u="md-editor",J="md-editor-v3",Ze="https://at.alicdn.com/t/c/font_2605852_u82y61ve02.js",K="https://cdnjs.cloudflare.com/ajax/libs",Mn=`${K}/highlight.js/11.7.0/highlight.min.js`,tn={main:`${K}/prettier/2.8.0/standalone.js`,markdown:`${K}/prettier/2.8.0/parser-markdown.js`},nn={css:`${K}/cropperjs/1.5.13/cropper.min.css`,js:`${K}/cropperjs/1.5.13/cropper.min.js`},Bn=`${K}/screenfull.js/5.2.0/screenfull.min.js`,sn=["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","htmlPreview","catalog","github"],ln=["markdownTotal","=","scrollSwitch"],on={"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:"预览",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",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 Img Link",upload:"Upload Img",clip2upload:"Clip 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:"Word Count",scrollAuto:"Scroll Auto"}}},Un=`${K}/mermaid/9.4.0/mermaid.min.js`,kt={js:`${K}/KaTeX/0.16.3/katex.min.js`,css:`${K}/KaTeX/0.16.3/katex.min.css`},rn={a11y:{light:`${K}/highlight.js/11.7.0/styles/a11y-light.min.css`,dark:`${K}/highlight.js/11.7.0/styles/a11y-dark.min.css`},atom:{light:`${K}/highlight.js/11.7.0/styles/atom-one-light.min.css`,dark:`${K}/highlight.js/11.7.0/styles/atom-one-dark.min.css`},github:{light:`${K}/highlight.js/11.7.0/styles/github.min.css`,dark:`${K}/highlight.js/11.7.0/styles/github-dark.min.css`},gradient:{light:`${K}/highlight.js/11.7.0/styles/gradient-light.min.css`,dark:`${K}/highlight.js/11.7.0/styles/gradient-dark.min.css`},kimbie:{light:`${K}/highlight.js/11.7.0/styles/kimbie-light.min.css`,dark:`${K}/highlight.js/11.7.0/styles/kimbie-dark.min.css`},paraiso:{light:`${K}/highlight.js/11.7.0/styles/paraiso-light.min.css`,dark:`${K}/highlight.js/11.7.0/styles/paraiso-dark.min.css`},qtcreator:{light:`${K}/highlight.js/11.7.0/styles/qtcreator-light.min.css`,dark:`${K}/highlight.js/11.7.0/styles/qtcreator-dark.min.css`},stackoverflow:{light:`${K}/highlight.js/11.7.0/styles/stackoverflow-light.min.css`,dark:`${K}/highlight.js/11.7.0/styles/stackoverflow-dark.min.css`}},ee={markedRenderer:s=>s,markedExtensions:[],markedOptions:{},editorExtensions:{},editorConfig:{}},qn=s=>{if(s)for(const t in s){const e=s[t];e&&(ee[t]=e)}};class Wn{constructor(){se(this,"pools",{})}remove(t,e,n){const l=this.pools[t]&&this.pools[t][e];l&&(this.pools[t][e]=l.filter(a=>a!==n))}clear(t){this.pools[t]={}}on(t,e){return this.pools[t]||(this.pools[t]={}),this.pools[t][e.name]||(this.pools[t][e.name]=[]),this.pools[t][e.name].push(e.callback),this.pools[t][e.name].includes(e.callback)}emit(t,e,...n){this.pools[t]||(this.pools[t]={});const l=this.pools[t][e];l&&l.forEach(a=>{try{a(...n)}catch(r){console.error(`${e} monitor event exception!`,r)}})}}const v=new Wn,_e=(s,t=0,e=t)=>new Promise((n,i)=>{s.setSelectionRange?setTimeout(()=>{s.setSelectionRange(t,e),s.focus(),n(!0)},0):(console.error("Can not reset position!"),i())}),Dt=(s,t,e)=>{const{deviationStart:n=0,deviationEnd:i=0,direct:l=!1,select:a=!1}=e;let r="";if(s.selectionStart||s.selectionStart===0){const d=s.selectionStart,f=s.selectionEnd||0,{prefixVal:h=s.value.substring(0,d),subfixVal:m=s.value.substring(f,s.value.length)}=e;r=h+t+m,_e(s,a?d+n:d+t.length+i,d+t.length+i)}else r+=t;return l&&(s.value=r),r},Kn=(s,t={newWindow:!0,nofollow:!0})=>{s||console.error("error link!");const e=document.createElement("a");e.href=s,e.style.display="none",t.newWindow&&(e.target="_blank"),t.nofollow&&(e.rel="noopener noreferrer"),document.body.appendChild(e),e.click(),document.body.removeChild(e)},an=(s,t)=>{const e=yt(()=>{s.removeEventListener("scroll",n),s.addEventListener("scroll",n),t.removeEventListener("scroll",n),t.addEventListener("scroll",n)},50),n=i=>{const l=s.clientHeight,a=t.clientHeight,r=s.scrollHeight,d=t.scrollHeight,f=(r-l)/(d-a);i.target===s?(t.removeEventListener("scroll",n),t.scrollTo({top:s.scrollTop/f}),e()):(s.removeEventListener("scroll",n),s.scrollTo({top:t.scrollTop*f}),e())};return[()=>{e().finally(()=>{s.dispatchEvent(new Event("scroll"))})},()=>{s.removeEventListener("scroll",n),t.removeEventListener("scroll",n)}]},Gn=(s,t="image.png")=>{const e=s.split(","),n=e[0].match(/:(.*?);/);if(n){const i=n[1],l=atob(e[1]);let a=l.length;const r=new Uint8Array(a);for(;a--;)r[a]=l.charCodeAt(a);return new File([r],t,{type:i})}return null},cn=s=>{if(!s.trim())return s;const t=s.split(`
2
+ `),e=['<span rn-wrapper aria-hidden="true">'];return t.forEach(()=>{e.push("<span></span>")}),e.push("</span>"),`<span class="code-block">${s}</span>${e.join("")}`},yt=(s,t=200)=>{let e=0;return(...n)=>new Promise(i=>{e&&(clearTimeout(e),i("cancel")),e=window.setTimeout(()=>{s.apply(void 0,n),e=0,i("done")},t)})},Zn=(s,t=200)=>{let e=0,n=null;return(...i)=>{const l=a=>{e===0&&(e=a),a-e>=t?(s.apply(void 0,n),n=null,e=0):window.requestAnimationFrame(l)};n===null&&window.requestAnimationFrame(l),n=i}},dn=(s,t="$")=>{const e=s.split(t);let n=t,i="";for(let l=1;l<e.length;l++)if(/\\$/.test(e[l]))n+=e[l]+"$",i+=e[l]+"$";else{n+=e[l]+t,i+=e[l];break}return[n,i]},Xn=s=>{var e;return navigator.userAgent.indexOf("Firefox")>-1?s.value.substring(s.selectionStart,s.selectionEnd):((e=window.getSelection())==null?void 0:e.toString())||""},Qn=(s,t)=>{const e=s==null?void 0:s.getBoundingClientRect();if(t===document.documentElement)return e.top-t.clientTop;const n=t==null?void 0:t.getBoundingClientRect();return e.top-n.top},Yn=(s,t)=>{const e={...s};return t.forEach(n=>{Reflect.deleteProperty(e,n)}),e},Jn=()=>`${Date.now().toString(36)}${Math.random().toString(36).substring(2)}`,un=(s,t)=>{const e=n=>{const i=s.parentElement||document.body,l=i.offsetWidth,a=i.offsetHeight,{clientWidth:r}=document.documentElement,{clientHeight:d}=document.documentElement,f=n.offsetX,h=n.offsetY,m=g=>{let $=g.x+document.body.scrollLeft-document.body.clientLeft-f,k=g.y+document.body.scrollTop-document.body.clientTop-h;$=$<1?1:$<r-l-1?$:r-l-1,k=k<1?1:k<d-a-1?k:d-a-1,t?t($,k):(i.style.left=`${$}px`,i.style.top=`${k}px`)};document.addEventListener("mousemove",m);const b=()=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",b)};document.addEventListener("mouseup",b)};return s.addEventListener("mousedown",e),()=>{s.removeEventListener("mousedown",e)}},fe=(s,t="")=>{const e=document.getElementById(s.id),n=i=>{typeof s.onload=="function"&&s.onload(i),s.removeEventListener("load",n)};e?t!==""&&typeof s.onload=="function"&&(Reflect.get(window,t)?s.dispatchEvent(new Event("load")):e.addEventListener("load",n)):(s.addEventListener("load",n),document.head.appendChild(s))},ei=yt((s,t,e)=>{const n=document.getElementById(s);n&&n.setAttribute(t,e)},10),wt="onSave",Ht="changeCatalogVisible",hn="changeFullscreen",fn="pageFullscreenChanged",mn="fullscreenChanged",Pt="previewChanged",gn="htmlPreviewChanged",pn="catalogVisibleChanged",bn="textareaFocus",ti=(s,t)=>{const{editorId:e,noPrettier:n,previewOnly:i}=s,l=o.reactive({buildFinished:!1,html:""}),a=r=>{if(r.target===document.querySelector(`#${s.editorId}-textarea`))if(v.emit(e,"selectTextChange"),r.ctrlKey||r.metaKey)switch(r.code){case"KeyS":{r.shiftKey?v.emit(e,"replace","strikeThrough"):(v.emit(e,wt,s.modelValue),r.preventDefault());break}case"KeyB":{v.emit(e,"replace","bold"),r.preventDefault();break}case"KeyU":{r.shiftKey?(v.emit(e,"replace","unorderedList"),r.preventDefault()):(v.emit(e,"replace","underline"),r.preventDefault());break}case"KeyI":{r.shiftKey?(v.emit(e,"openModals","image"),r.preventDefault()):(v.emit(e,"replace","italic"),r.preventDefault());break}case"Digit1":{v.emit(e,"replace","h1"),r.preventDefault();break}case"Digit2":{v.emit(e,"replace","h2"),r.preventDefault();break}case"Digit3":{v.emit(e,"replace","h3"),r.preventDefault();break}case"Digit4":{v.emit(e,"replace","h4"),r.preventDefault();break}case"Digit5":{v.emit(e,"replace","h5"),r.preventDefault();break}case"Digit6":{v.emit(e,"replace","h6"),r.preventDefault();break}case"ArrowUp":{v.emit(e,"replace","sup"),r.preventDefault();break}case"ArrowDown":{v.emit(e,"replace","sub"),r.preventDefault();break}case"KeyQ":{if(r.key==="a"){r.target.select();return}v.emit(e,"replace","quote"),r.preventDefault();break}case"KeyA":if(r.key==="q"){v.emit(e,"replace","quote"),r.preventDefault();break}else return;case"KeyO":{v.emit(e,"replace","orderedList"),r.preventDefault();break}case"KeyC":{if(r.shiftKey)v.emit(e,"replace","code"),r.preventDefault();else if(r.altKey)v.emit(e,"replace","codeRow"),r.preventDefault();else{r.preventDefault(),v.emit(e,"replace","ctrlC");break}break}case"KeyL":{v.emit(e,"openModals","link"),r.preventDefault();break}case"KeyZ":{if(r.key==="w")return;r.shiftKey?(v.emit(e,"ctrlShiftZ"),r.preventDefault()):(v.emit(e,"ctrlZ"),r.preventDefault());break}case"KeyW":if(r.key==="z"){r.shiftKey?(v.emit(e,"ctrlShiftZ"),r.preventDefault()):(v.emit(e,"ctrlZ"),r.preventDefault());break}else return;case"KeyF":{r.shiftKey&&(n||(v.emit(e,"replace","prettier"),r.preventDefault()));break}case"KeyT":{r.altKey&&r.shiftKey&&(v.emit(e,"replace","table"),r.preventDefault());break}case"KeyX":{v.emit(e,"replace","ctrlX"),r.preventDefault();break}case"KeyD":{r.preventDefault(),v.emit(e,"replace","ctrlD");break}}else r.code==="Tab"&&(r.preventDefault(),r.shiftKey?v.emit(e,"replace","shiftTab"):v.emit(e,"replace","tab"))};o.watch(()=>s.modelValue,()=>{l.buildFinished=!1}),o.onMounted(()=>{i||(window.addEventListener("keydown",a),v.on(e,{name:"buildFinished",callback(r){l.buildFinished=!0,l.html=r}}),v.on(e,{name:wt,callback(){const r=new Promise(d=>{if(l.buildFinished)d(l.html);else{const f=h=>{d(h),v.remove(e,"buildFinished",f)};v.on(e,{name:"buildFinished",callback:f})}});s.onSave?s.onSave(s.modelValue,r):t.emit("onSave",s.modelValue,r)}}))}),o.onBeforeUnmount(()=>{i||window.removeEventListener("keydown",a)})},ni=s=>{var l;const{editorId:t,previewOnly:e}=s,n=(l=ee==null?void 0:ee.editorExtensions)==null?void 0:l.highlight;o.provide("editorId",t),o.provide("tabWidth",s.tabWidth),o.provide("theme",o.computed(()=>s.theme)),o.provide("highlight",o.computed(()=>{const a={...rn,...n==null?void 0:n.css},r=s.codeStyleReverse&&s.codeStyleReverseList.includes(s.previewTheme)?"dark":s.theme;return{js:(n==null?void 0:n.js)||Mn,css:a[s.codeTheme]?a[s.codeTheme][r]:rn.atom[r]}})),o.provide("historyLength",s.historyLength),o.provide("previewOnly",e),o.provide("showCodeRowNumber",s.showCodeRowNumber);const i=o.computed(()=>{var r;const a={...on,...(r=ee==null?void 0:ee.editorConfig)==null?void 0:r.languageUserDefined};return a[s.language]?a[s.language]:on["zh-CN"]});o.provide("usedLanguageText",i),o.provide("previewTheme",o.computed(()=>s.previewTheme))},ii=s=>{var f,h,m,b,g,$;const{noPrettier:t,previewOnly:e,noIconfont:n,noUploadImg:i}=s,{editorExtensions:l}=ee,a=t||!!((h=(f=ee.editorExtensions)==null?void 0:f.prettier)!=null&&h.prettierInstance),r=t||!!((b=(m=ee.editorExtensions)==null?void 0:m.prettier)!=null&&b.parserMarkdownInstance),d=i||!!(($=(g=ee.editorExtensions)==null?void 0:g.cropper)!=null&&$.instance);o.onMounted(()=>{var C,V,H,T;const k=document.createElement("script");k.src=(l==null?void 0:l.iconfont)||Ze,k.id=`${u}-icon`;const y=document.createElement("script"),p=document.createElement("script");y.src=((C=l==null?void 0:l.prettier)==null?void 0:C.standaloneJs)||tn.main,y.id=`${u}-prettier`,p.src=((V=l==null?void 0:l.prettier)==null?void 0:V.parserMarkdownJs)||tn.markdown,p.id=`${u}-prettierMD`;const x=document.createElement("link");x.rel="stylesheet",x.href=((H=l==null?void 0:l.cropper)==null?void 0:H.css)||nn.css,x.id=`${u}-cropperCss`;const S=document.createElement("script");S.src=((T=l==null?void 0:l.cropper)==null?void 0:T.js)||nn.js,S.id=`${u}-cropper`,n||fe(k),e||(d||(fe(x),fe(S)),a||fe(y),r||fe(p))})},si=(s,t)=>{const{editorId:e,previewOnly:n}=s,i=o.reactive({pageFullscreen:s.pageFullscreen,fullscreen:!1,preview:s.preview,htmlPreview:s.preview?!1:s.htmlPreview}),l=(d,f)=>{i[d]=f===void 0?!i[d]:f,d==="preview"&&i.preview?i.htmlPreview=!1:d==="htmlPreview"&&i.htmlPreview&&(i.preview=!1)};let a="";const r=()=>{i.pageFullscreen||i.fullscreen?document.body.style.overflow="hidden":document.body.style.overflow=a};return o.watch(()=>[i.pageFullscreen,i.fullscreen],r),o.onMounted(()=>{n||v.on(e,{name:"uploadImage",callback(d,f){const h=m=>{v.emit(e,"replace","image",{desc:"",urls:m}),f&&f()};s.onUploadImg?s.onUploadImg(d,h):t.emit("onUploadImg",d,h)}}),a=document.body.style.overflow,r()}),[i,l]},li=s=>{const{editorId:t}=s,e=o.ref(!1);o.onMounted(()=>{v.on(t,{name:Ht,callback:i=>{i===void 0?e.value=!e.value:e.value=i}})});const n=o.computed(()=>!s.toolbarsExclude.includes("catalog")&&s.toolbars.includes("catalog"));return[e,n]},oi=(s,t,e,n,i)=>{const{editorId:l}=s;o.watch(()=>n.pageFullscreen,r=>{v.emit(l,fn,r)}),o.watch(()=>n.fullscreen,r=>{v.emit(l,mn,r)}),o.watch(()=>n.preview,r=>{v.emit(l,Pt,r)}),o.watch(()=>n.htmlPreview,r=>{v.emit(l,gn,r)}),o.watch(e,r=>{v.emit(l,pn,r)});const a={on(r,d){switch(r){case"pageFullscreen":{v.on(l,{name:fn,callback(f){d(f)}});break}case"fullscreen":{v.on(l,{name:mn,callback(f){d(f)}});break}case"preview":{v.on(l,{name:Pt,callback(f){d(f)}});break}case"htmlPreview":{v.on(l,{name:gn,callback(f){d(f)}});break}case"catalog":{v.on(l,{name:pn,callback(f){d(f)}});break}}},togglePageFullscreen(r){i("pageFullscreen",r)},toggleFullscreen(r){v.emit(l,hn,r)},togglePreview(r){i("preview",r)},toggleHtmlPreview(r){i("htmlPreview",r)},toggleCatalog(r){v.emit(l,Ht,r)},triggerSave(){v.emit(l,wt)},insert(r){v.emit(l,"replace","universal",{generate:r})},focus(){v.emit(l,bn)}};t.expose(a)},zs="",ri=o.defineComponent({setup(){return()=>o.createVNode("div",{class:`${u}-divider`},null)}}),ke=({instance:s,ctx:t,props:e={}},n="default")=>{const i=(s==null?void 0:s.$slots[n])||(t==null?void 0:t.slots[n]);return(i?i(s):"")||e[n]},Vs="",ai=()=>({trigger:{type:String,default:"hover"},overlay:{type:[String,Object],default:""},visible:{type:Boolean,default:!1},onChange:{type:Function,default:()=>{}},relative:{type:String,default:"html"}}),Xe=o.defineComponent({props:ai(),setup(s,t){const e=`${u}-dropdown-hidden`,n=o.reactive({overlayClass:[e],overlayStyle:{},triggerHover:!1,overlayHover:!1}),i=o.ref(),l=o.ref(),a=()=>{var S;s.trigger==="hover"&&(n.triggerHover=!0);const m=i.value,b=l.value,g=m.getBoundingClientRect(),$=m.offsetTop,k=m.offsetLeft,y=g.height,p=g.width,x=((S=document.querySelector(s.relative))==null?void 0:S.scrollLeft)||0;n.overlayStyle={...n.overlayStyle,top:$+y+"px",left:k-b.offsetWidth/2+p/2-x+"px"},s.onChange(!0)},r=()=>{n.overlayHover=!0};o.watch(()=>s.visible,m=>{m?n.overlayClass=n.overlayClass.filter(b=>b!==e):n.overlayClass.push(e)});const d=m=>{const b=i.value,g=l.value;!b.contains(m.target)&&!g.contains(m.target)&&s.onChange(!1)};let f=-1;const h=m=>{i.value===m.target?n.triggerHover=!1:n.overlayHover=!1,clearTimeout(f),f=window.setTimeout(()=>{!n.overlayHover&&!n.triggerHover&&s.onChange(!1)},10)};return o.onMounted(()=>{s.trigger==="click"?(i.value.addEventListener("click",a),document.addEventListener("click",d)):(i.value.addEventListener("mouseenter",a),i.value.addEventListener("mouseleave",h),l.value.addEventListener("mouseenter",r),l.value.addEventListener("mouseleave",h))}),o.onBeforeUnmount(()=>{s.trigger==="click"?(i.value.removeEventListener("click",a),document.removeEventListener("click",d)):(i.value.removeEventListener("mouseenter",a),i.value.removeEventListener("mouseleave",h),l.value.removeEventListener("mouseenter",r),l.value.removeEventListener("mouseleave",h))}),()=>{const m=ke({ctx:t}),b=ke({props:s,ctx:t},"overlay"),g=o.cloneVNode(m instanceof Array?m[0]:m,{ref:i}),$=o.createVNode("div",{class:[`${u}-dropdown`,n.overlayClass],style:n.overlayStyle,ref:l},[o.createVNode("div",{class:`${u}-dropdown-overlay`},[b instanceof Array?b[0]:b])]);return[g,$]}}}),_s="",ci=()=>({title:{type:String,default:""},visible:{type:Boolean,default:!1},width:{type:String,default:"auto"},height:{type:String,default:"auto"},onClose:{type:Function,default:()=>{}},showAdjust:{type:Boolean,default:!1},isFullscreen:{type:Boolean,default:!1},onAdjust:{type:Function,default:()=>{}},class:{type:String}}),Mt=o.defineComponent({props:ci(),setup(s,t){const e=o.ref(s.visible),n=o.ref([`${u}-modal`]),i=o.ref(),l=o.ref();let a=()=>{};const r=o.reactive({initPos:{left:"0px",top:"0px"},historyPos:{left:"0px",top:"0px"}}),d=o.computed(()=>s.isFullscreen?{width:"100%",height:"100%"}:{width:s.width,height:s.height});return o.onMounted(()=>{a=un(l.value,(f,h)=>{r.initPos.left=f+"px",r.initPos.top=h+"px"})}),o.onBeforeUnmount(()=>{a()}),o.watch(()=>s.isFullscreen,f=>{f?a():a=un(l.value,(h,m)=>{r.initPos.left=h+"px",r.initPos.top=m+"px"})}),o.watch(()=>s.visible,f=>{f?(n.value.push("zoom-in"),e.value=f,o.nextTick(()=>{const h=i.value.offsetWidth/2,m=i.value.offsetHeight/2,b=document.documentElement.clientWidth/2,g=document.documentElement.clientHeight/2;r.initPos.left=b-h+"px",r.initPos.top=g-m+"px"}),setTimeout(()=>{n.value=n.value.filter(h=>h!=="zoom-in")},140)):(n.value.push("zoom-out"),setTimeout(()=>{n.value=n.value.filter(h=>h!=="zoom-out"),e.value=f},130))}),()=>{const f=ke({ctx:t}),h=ke({props:s,ctx:t},"title");return o.createVNode("div",{class:[s.class],style:{display:e.value?"block":"none"}},[o.createVNode("div",{class:`${u}-modal-mask`,onClick:s.onClose},null),o.createVNode("div",{class:n.value,style:{...r.initPos,...d.value},ref:i},[o.createVNode("div",{class:`${u}-modal-header`,ref:l},[h||""]),o.createVNode("div",{class:`${u}-modal-body`},[f]),o.createVNode("div",{class:`${u}-modal-func`},[s.showAdjust&&o.createVNode("div",{class:`${u}-modal-adjust`,onClick:m=>{m.stopPropagation(),s.isFullscreen?r.initPos=r.historyPos:(r.historyPos=r.initPos,r.initPos={left:"0",top:"0"}),s.onAdjust(!s.isFullscreen)}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":`#md-editor-icon-${s.isFullscreen?"suoxiao":"fangda"}`},null)])]),o.createVNode("div",{class:`${u}-modal-close`,onClick:m=>{m.stopPropagation(),s.onClose&&s.onClose()}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-close"},null)])])])])])}}}),di=()=>({type:{type:String,default:"link"},visible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}}}),ui=o.defineComponent({props:di(),setup(s){const t=o.inject("usedLanguageText"),e=o.inject("editorId"),n=o.computed(()=>{var l,a;switch(s.type){case"link":return(l=t.value.linkModalTips)==null?void 0:l.linkTitle;case"image":return(a=t.value.linkModalTips)==null?void 0:a.imageTitle;default:return""}}),i=o.reactive({desc:"",url:""});return o.watch(()=>s.visible,l=>{l||setTimeout(()=>{i.desc="",i.url=""},200)}),()=>o.createVNode(Mt,{title:n.value,visible:s.visible,onClose:s.onCancel},{default:()=>{var l,a,r,d,f;return[o.createVNode("div",{class:`${u}-form-item`},[o.createVNode("label",{class:`${u}-label`,for:`link-desc-${e}`},[(l=t.value.linkModalTips)==null?void 0:l.descLabel]),o.createVNode("input",{placeholder:(a=t.value.linkModalTips)==null?void 0:a.descLabelPlaceHolder,class:`${u}-input`,id:`link-desc-${e}`,type:"text",value:i.desc,onChange:h=>{i.desc=h.target.value},autocomplete:"off"},null)]),o.createVNode("div",{class:`${u}-form-item`},[o.createVNode("label",{class:`${u}-label`,for:`link-url-${e}`},[(r=t.value.linkModalTips)==null?void 0:r.urlLabel]),o.createVNode("input",{placeholder:(d=t.value.linkModalTips)==null?void 0:d.urlLabelPlaceHolder,class:`${u}-input`,id:`link-url-${e}`,type:"text",value:i.url,onChange:h=>{i.url=h.target.value},autocomplete:"off"},null)]),o.createVNode("div",{class:`${u}-form-item`},[o.createVNode("button",{class:[`${u}-btn`,`${u}-btn-row`],type:"button",onClick:()=>{s.onOk(i),i.desc="",i.url=""}},[(f=t.value.linkModalTips)==null?void 0:f.buttonOK])])]}})}}),As="",hi=()=>({visible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}}}),fi=o.defineComponent({props:hi(),setup(s){var h,m;const t=o.inject("usedLanguageText"),e=o.inject("editorId");let n=(m=(h=ee==null?void 0:ee.editorExtensions)==null?void 0:h.cropper)==null?void 0:m.instance;const i=o.ref(),l=o.ref(),a=o.ref(),r=o.reactive({cropperInited:!1,imgSelected:!1,imgSrc:"",isFullscreen:!1});let d=null;o.watch(()=>s.visible,()=>{s.visible&&!r.cropperInited&&(n=n||window.Cropper,i.value.onchange=()=>{if(!n){v.emit(e,"errorCatcher",{name:"Cropper",message:"Cropper is undefined"});return}const b=i.value.files||[];if(r.imgSelected=!0,(b==null?void 0:b.length)>0){const g=new FileReader;g.onload=$=>{r.imgSrc=$.target.result,o.nextTick(()=>{d=new n(l.value,{viewMode:2,preview:`.${u}-clip-preview-target`})})},g.readAsDataURL(b[0])}})}),o.watch(()=>[r.imgSelected],()=>{a.value.style=""}),o.watch(()=>r.isFullscreen,()=>{o.nextTick(()=>{d==null||d.destroy(),a.value.style="",l.value&&(d=new n(l.value,{viewMode:2,preview:`.${u}-clip-preview-target`}))})});const f=()=>{d.clear(),d.destroy(),d=null,i.value.value="",r.imgSelected=!1};return()=>{var b;return o.createVNode(Mt,{class:`${u}-modal-clip`,title:(b=t.value.clipModalTips)==null?void 0:b.title,visible:s.visible,onClose:s.onCancel,showAdjust:!0,isFullscreen:r.isFullscreen,onAdjust:g=>{r.isFullscreen=g},width:"668px",height:"421px"},{default:()=>{var g,$;return[o.createVNode("div",{class:`${u}-form-item ${u}-clip`},[o.createVNode("div",{class:`${u}-clip-main`},[r.imgSelected?o.createVNode("div",{class:`${u}-clip-cropper`},[o.createVNode("img",{src:r.imgSrc,ref:l,style:{display:"none"},alt:""},null),o.createVNode("div",{class:`${u}-clip-delete`,onClick:f},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-delete"},null)])])]):o.createVNode("div",{class:`${u}-clip-upload`,onClick:()=>{i.value.click()}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-upload"},null)])])]),o.createVNode("div",{class:`${u}-clip-preview`},[o.createVNode("div",{class:`${u}-clip-preview-target`,ref:a},null)])]),o.createVNode("div",{class:`${u}-form-item`},[o.createVNode("button",{class:`${u}-btn`,type:"button",onClick:()=>{if(d){const k=d.getCroppedCanvas();v.emit(e,"uploadImage",[Gn(k.toDataURL("image/png"))],s.onOk),f()}}},[((g=t.value.clipModalTips)==null?void 0:g.buttonUpload)||(($=t.value.linkModalTips)==null?void 0:$.buttonOK)])]),o.createVNode("input",{ref:i,accept:"image/*",type:"file",multiple:!1,style:{display:"none"}},null)]}})}}}),mi=()=>({type:{type:String,default:"link"},linkVisible:{type:Boolean,default:!1},clipVisible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}}}),gi=o.defineComponent({props:mi(),setup(s){return()=>o.createVNode(o.Fragment,null,[o.createVNode(ui,{type:s.type,visible:s.linkVisible,onOk:s.onOk,onCancel:s.onCancel},null),o.createVNode(fi,{visible:s.clipVisible,onOk:s.onOk,onCancel:s.onCancel},null)])}}),pi=s=>{var d,f,h,m;const t=o.inject("editorId");let e=(f=(d=ee.editorExtensions)==null?void 0:d.screenfull)==null?void 0:f.instance;const n=(m=(h=ee.editorExtensions)==null?void 0:h.screenfull)==null?void 0:m.js,i=o.ref(!1),l=b=>{if(!e){v.emit(t,"errorCatcher",{name:"fullscreen",message:"fullscreen is undefined"});return}e.isEnabled?(i.value=!0,(b===void 0?!e.isFullscreen:b)?e.request():e.exit()):console.error("browser does not support screenfull!")},a=()=>{e&&e.isEnabled&&e.on("change",()=>{(i.value||s.setting.fullscreen)&&(i.value=!1,s.updateSetting("fullscreen"))})},r=()=>{e=window.screenfull,a()};return o.onMounted(()=>{if(a(),!e){const b=document.createElement("script");b.src=n||Bn,b.onload=r,b.id=`${u}-screenfull`,fe(b,"screenfull")}}),o.onMounted(()=>{v.on(t,{name:hn,callback:l})}),{fullscreenHandler:l}},bi=()=>({tableShape:{type:Array,default:()=>[6,4]},onSelected:{type:Function,default:()=>{}}}),ki=o.defineComponent({name:"TableShape",props:bi(),setup(s){const t=o.reactive({x:-1,y:-1});return()=>o.createVNode("div",{class:`${u}-table-shape`,onMouseleave:()=>{t.x=-1,t.y=-1}},[new Array(s.tableShape[1]).fill("").map((e,n)=>o.createVNode("div",{class:`${u}-table-shape-row`,key:`table-shape-row-${n}`},[new Array(s.tableShape[0]).fill("").map((i,l)=>o.createVNode("div",{class:`${u}-table-shape-col`,key:`table-shape-col-${l}`,onMouseenter:()=>{t.x=n,t.y=l},onClick:()=>{s.onSelected(t)}},[o.createVNode("div",{class:[`${u}-table-shape-col-default`,n<=t.x&&l<=t.y&&`${u}-table-shape-col-include`]},null)]))]))])}}),yi=()=>({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}}),wi=o.defineComponent({name:"MDEditorToolbar",props:yi(),setup(s){const t=o.inject("editorId"),e=o.inject("usedLanguageText"),{fullscreenHandler:n}=pi(s),i=`${t}-toolbar-wrapper`,l=o.reactive({title:!1,catalog:!1,image:!1,table:!1,mermaid:!1,katex:!1}),a=(g,$)=>{v.emit(t,"replace",g,$)},r=o.reactive({type:"link",linkVisible:!1,clipVisible:!1}),d=o.ref();o.onMounted(()=>{v.on(t,{name:"openModals",callback(g){r.type=g,r.linkVisible=!0}})});const f=o.computed(()=>{const g=s.toolbars.filter(p=>!s.toolbarsExclude.includes(p)),$=g.indexOf("="),k=$===-1?g:g.slice(0,$+1),y=$===-1?[]:g.slice($,Number.MAX_SAFE_INTEGER);return[k,y]}),h=o.ref(),m=()=>{v.emit(t,"uploadImage",Array.from(h.value.files||[])),h.value.value=""};o.onMounted(()=>{h.value.addEventListener("change",m)});const b=g=>{var $,k,y,p,x,S,C,V,H,T,w,Q,U,B,z,F,P,q,j,te,I,R,M,oe,ce,be,Ve,je,Ke,He,Ge,Vt,_t,lt,ot,At,It,rt,Lt,Ft,pt,Dn,Hn;if(sn.includes(g))switch(g){case"-":return o.createVNode(ri,null,null);case"bold":return o.createVNode("div",{class:`${u}-toolbar-item`,title:($=e.value.toolbarTips)==null?void 0:$.bold,onClick:()=>{a("bold")}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-bold"},null)])]);case"underline":return o.createVNode("div",{class:`${u}-toolbar-item`,title:(k=e.value.toolbarTips)==null?void 0:k.underline,onClick:()=>{a("underline")}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-underline"},null)])]);case"italic":return o.createVNode("div",{class:`${u}-toolbar-item`,title:(y=e.value.toolbarTips)==null?void 0:y.italic,onClick:()=>{a("italic")}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-italic"},null)])]);case"strikeThrough":return o.createVNode("div",{class:`${u}-toolbar-item`,title:(p=e.value.toolbarTips)==null?void 0:p.strikeThrough,onClick:()=>{a("strikeThrough")}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-strike-through"},null)])]);case"title":return o.createVNode(Xe,{relative:`#${i}`,visible:l.title,onChange:W=>{l.title=W},overlay:o.createVNode("ul",{class:`${u}-menu`,onClick:()=>{l.title=!1}},[o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("h1")}},[(x=e.value.titleItem)==null?void 0:x.h1]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("h2")}},[(S=e.value.titleItem)==null?void 0:S.h2]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("h3")}},[(C=e.value.titleItem)==null?void 0:C.h3]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("h4")}},[(V=e.value.titleItem)==null?void 0:V.h4]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("h5")}},[(H=e.value.titleItem)==null?void 0:H.h5]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("h6")}},[(T=e.value.titleItem)==null?void 0:T.h6])])},{default:()=>{var W;return[o.createVNode("div",{class:`${u}-toolbar-item`,title:(W=e.value.toolbarTips)==null?void 0:W.title},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-title"},null)])])]}});case"sub":return o.createVNode("div",{class:`${u}-toolbar-item`,title:(w=e.value.toolbarTips)==null?void 0:w.sub,onClick:()=>{a("sub")}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-sub"},null)])]);case"sup":return o.createVNode("div",{class:`${u}-toolbar-item`,title:(Q=e.value.toolbarTips)==null?void 0:Q.sup,onClick:()=>{a("sup")}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-sup"},null)])]);case"quote":return o.createVNode("div",{class:`${u}-toolbar-item`,title:(U=e.value.toolbarTips)==null?void 0:U.quote,onClick:()=>{a("quote")}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-quote"},null)])]);case"unorderedList":return o.createVNode("div",{class:`${u}-toolbar-item`,title:(B=e.value.toolbarTips)==null?void 0:B.unorderedList,onClick:()=>{a("unorderedList")}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-unordered-list"},null)])]);case"orderedList":return o.createVNode("div",{class:`${u}-toolbar-item`,title:(z=e.value.toolbarTips)==null?void 0:z.orderedList,onClick:()=>{a("orderedList")}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-ordered-list"},null)])]);case"task":return o.createVNode("div",{class:`${u}-toolbar-item`,title:(F=e.value.toolbarTips)==null?void 0:F.task,onClick:()=>{a("task")}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-task"},null)])]);case"codeRow":return o.createVNode("div",{class:`${u}-toolbar-item`,title:(P=e.value.toolbarTips)==null?void 0:P.codeRow,onClick:()=>{a("codeRow")}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-code-row"},null)])]);case"code":return o.createVNode("div",{class:`${u}-toolbar-item`,title:(q=e.value.toolbarTips)==null?void 0:q.code,onClick:()=>{a("code")}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-code"},null)])]);case"link":return o.createVNode("div",{class:`${u}-toolbar-item`,title:(j=e.value.toolbarTips)==null?void 0:j.link,onClick:()=>{r.type="link",r.linkVisible=!0}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-link"},null)])]);case"image":return s.noUploadImg?o.createVNode("div",{class:`${u}-toolbar-item`,title:(te=e.value.toolbarTips)==null?void 0:te.image,onClick:()=>{r.type="image",r.linkVisible=!0}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-image"},null)])]):o.createVNode(Xe,{relative:`#${i}`,visible:l.image,onChange:W=>{l.image=W},overlay:o.createVNode("ul",{class:`${u}-menu`,onClick:()=>{l.title=!1}},[o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{r.type="image",r.linkVisible=!0}},[(I=e.value.imgTitleItem)==null?void 0:I.link]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{h.value.click()}},[(R=e.value.imgTitleItem)==null?void 0:R.upload]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{r.clipVisible=!0}},[(M=e.value.imgTitleItem)==null?void 0:M.clip2upload])])},{default:()=>{var W;return[o.createVNode("div",{class:`${u}-toolbar-item`,title:(W=e.value.toolbarTips)==null?void 0:W.image},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-image"},null)])])]}});case"table":return o.createVNode(Xe,{relative:`#${i}`,visible:l.table,onChange:W=>{l.table=W},key:"bar-table",overlay:o.createVNode(ki,{tableShape:s.tableShape,onSelected:W=>{a("table",{selectedShape:W})}},null)},{default:()=>{var W;return[o.createVNode("div",{class:`${u}-toolbar-item`,title:(W=e.value.toolbarTips)==null?void 0:W.table},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-table"},null)])])]}});case"revoke":return o.createVNode("div",{class:`${u}-toolbar-item`,title:(oe=e.value.toolbarTips)==null?void 0:oe.revoke,onClick:()=>{v.emit(t,"ctrlZ")}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-revoke"},null)])]);case"next":return o.createVNode("div",{class:`${u}-toolbar-item`,title:(ce=e.value.toolbarTips)==null?void 0:ce.next,onClick:()=>{v.emit(t,"ctrlShiftZ")}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-next"},null)])]);case"save":return o.createVNode("div",{class:`${u}-toolbar-item`,title:(be=e.value.toolbarTips)==null?void 0:be.save,onClick:()=>{v.emit(t,wt)}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-baocun"},null)])]);case"prettier":return s.noPrettier?"":o.createVNode("div",{class:`${u}-toolbar-item`,title:(Ve=e.value.toolbarTips)==null?void 0:Ve.prettier,onClick:()=>{a("prettier")}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-prettier"},null)])]);case"pageFullscreen":return!s.setting.fullscreen&&o.createVNode("div",{class:`${u}-toolbar-item`,title:(je=e.value.toolbarTips)==null?void 0:je.pageFullscreen,onClick:()=>{s.updateSetting("pageFullscreen")}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":`#md-editor-icon-${s.setting.pageFullscreen?"suoxiao":"fangda"}`},null)])]);case"fullscreen":return o.createVNode("div",{class:`${u}-toolbar-item`,title:(Ke=e.value.toolbarTips)==null?void 0:Ke.fullscreen,onClick:()=>{n()}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":`#md-editor-icon-${s.setting.fullscreen?"fullscreen-exit":"fullscreen"}`},null)])]);case"preview":return o.createVNode("div",{class:`${u}-toolbar-item`,title:(He=e.value.toolbarTips)==null?void 0:He.preview,onClick:()=>{s.updateSetting("preview")}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-preview"},null)])]);case"htmlPreview":return o.createVNode("div",{class:`${u}-toolbar-item`,title:(Ge=e.value.toolbarTips)==null?void 0:Ge.htmlPreview,onClick:()=>{s.updateSetting("htmlPreview")}},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-coding"},null)])]);case"catalog":return o.createVNode("div",{class:`${u}-toolbar-item`,title:(Vt=e.value.toolbarTips)==null?void 0:Vt.catalog,onClick:()=>{v.emit(t,Ht)},key:"bar-catalog"},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-catalog"},null)])]);case"github":return o.createVNode("div",{class:`${u}-toolbar-item`,title:(_t=e.value.toolbarTips)==null?void 0:_t.github,onClick:()=>Kn("https://github.com/imzbf/md-editor-v3")},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-github"},null)])]);case"mermaid":return o.createVNode(Xe,{relative:`#${i}`,visible:l.mermaid,onChange:W=>{l.mermaid=W},overlay:o.createVNode("ul",{class:`${u}-menu`,onClick:()=>{l.mermaid=!1}},[o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("flow")}},[(lt=e.value.mermaid)==null?void 0:lt.flow]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("sequence")}},[(ot=e.value.mermaid)==null?void 0:ot.sequence]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("gantt")}},[(At=e.value.mermaid)==null?void 0:At.gantt]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("class")}},[(It=e.value.mermaid)==null?void 0:It.class]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("state")}},[(rt=e.value.mermaid)==null?void 0:rt.state]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("pie")}},[(Lt=e.value.mermaid)==null?void 0:Lt.pie]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("relationship")}},[(Ft=e.value.mermaid)==null?void 0:Ft.relationship]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("journey")}},[(pt=e.value.mermaid)==null?void 0:pt.journey])]),key:"bar-mermaid"},{default:()=>{var W;return[o.createVNode("div",{class:`${u}-toolbar-item`,title:(W=e.value.toolbarTips)==null?void 0:W.mermaid},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-mermaid"},null)])])]}});case"katex":return o.createVNode(Xe,{relative:`#${i}`,visible:l.katex,onChange:W=>{l.katex=W},overlay:o.createVNode("ul",{class:`${u}-menu`,onClick:()=>{l.katex=!1}},[o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("katexInline")}},[(Dn=e.value.katex)==null?void 0:Dn.inline]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("katexBlock")}},[(Hn=e.value.katex)==null?void 0:Hn.block])]),key:"bar-katex"},{default:()=>{var W;return[o.createVNode("div",{class:`${u}-toolbar-item`,title:(W=e.value.toolbarTips)==null?void 0:W.katex},[o.createVNode("svg",{class:`${u}-icon`,"aria-hidden":"true"},[o.createVNode("use",{"xlink:href":"#md-editor-icon-formula"},null)])])]}})}else return s.defToolbars instanceof Array?s.defToolbars[g]||"":s.defToolbars&&s.defToolbars.children instanceof Array&&s.defToolbars.children[g]||""};return()=>{const g=f.value[0].map(k=>b(k)),$=f.value[1].map(k=>b(k));return o.createVNode(o.Fragment,null,[s.toolbars.length>0&&o.createVNode("div",{class:`${u}-toolbar-wrapper`,id:i},[o.createVNode("div",{class:`${u}-toolbar`},[o.createVNode("div",{class:`${u}-toolbar-left`,ref:d},[g]),o.createVNode("div",{class:`${u}-toolbar-right`},[$])])]),o.createVNode("input",{ref:h,accept:"image/*",type:"file",multiple:!0,style:{display:"none"}},null),o.createVNode(gi,{linkVisible:r.linkVisible,clipVisible:r.clipVisible,type:r.type,onCancel:()=>{r.linkVisible=!1,r.clipVisible=!1},onOk:k=>{k&&a(r.type,{desc:k.desc,url:k.url}),r.linkVisible=!1,r.clipVisible=!1}},null)])}}});function kn(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}let Qe=kn();function xi(s){Qe=s}const yn=/[&<>"']/,vi=new RegExp(yn.source,"g"),wn=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,$i=new RegExp(wn.source,"g"),Si={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},xn=s=>Si[s];function re(s,t){if(t){if(yn.test(s))return s.replace(vi,xn)}else if(wn.test(s))return s.replace($i,xn);return s}const Ci=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function vn(s){return s.replace(Ci,(t,e)=>(e=e.toLowerCase(),e==="colon"?":":e.charAt(0)==="#"?e.charAt(1)==="x"?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""))}const Ti=/(^|[^\[])\^/g;function G(s,t){s=typeof s=="string"?s:s.source,t=t||"";const e={replace:(n,i)=>(i=i.source||i,i=i.replace(Ti,"$1"),s=s.replace(n,i),e),getRegex:()=>new RegExp(s,t)};return e}const Ei=/[^\w:]/g,Ni=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function $n(s,t,e){if(s){let n;try{n=decodeURIComponent(vn(e)).replace(Ei,"").toLowerCase()}catch{return null}if(n.indexOf("javascript:")===0||n.indexOf("vbscript:")===0||n.indexOf("data:")===0)return null}t&&!Ni.test(e)&&(e=Ai(t,e));try{e=encodeURI(e).replace(/%25/g,"%")}catch{return null}return e}const xt={},zi=/^[^:]+:\/*[^/]*$/,Vi=/^([^:]+:)[\s\S]*$/,_i=/^([^:]+:\/*[^/]*)[\s\S]*$/;function Ai(s,t){xt[" "+s]||(zi.test(s)?xt[" "+s]=s+"/":xt[" "+s]=$t(s,"/",!0)),s=xt[" "+s];const e=s.indexOf(":")===-1;return t.substring(0,2)==="//"?e?t:s.replace(Vi,"$1")+t:t.charAt(0)==="/"?e?t:s.replace(_i,"$1")+t:s+t}const vt={exec:function(){}};function ye(s){let t=1,e,n;for(;t<arguments.length;t++){e=arguments[t];for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n])}return s}function Sn(s,t){const e=s.replace(/\|/g,(l,a,r)=>{let d=!1,f=a;for(;--f>=0&&r[f]==="\\";)d=!d;return d?"|":" |"}),n=e.split(/ \|/);let i=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(/\\\|/g,"|");return n}function $t(s,t,e){const n=s.length;if(n===0)return"";let i=0;for(;i<n;){const l=s.charAt(n-i-1);if(l===t&&!e)i++;else if(l!==t&&e)i++;else break}return s.slice(0,n-i)}function Ii(s,t){if(s.indexOf(t[1])===-1)return-1;const e=s.length;let n=0,i=0;for(;i<e;i++)if(s[i]==="\\")i++;else if(s[i]===t[0])n++;else if(s[i]===t[1]&&(n--,n<0))return i;return-1}function Cn(s){s&&s.sanitize&&!s.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function Tn(s,t){if(t<1)return"";let e="";for(;t>1;)t&1&&(e+=s),t>>=1,s+=s;return e+s}function En(s,t,e,n){const i=t.href,l=t.title?re(t.title):null,a=s[1].replace(/\\([\[\]])/g,"$1");if(s[0].charAt(0)!=="!"){n.state.inLink=!0;const r={type:"link",raw:e,href:i,title:l,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,r}return{type:"image",raw:e,href:i,title:l,text:re(a)}}function Li(s,t){const e=s.match(/^(\s+)(?:```)/);if(e===null)return t;const n=e[1];return t.split(`
3
+ `).map(i=>{const l=i.match(/^\s+/);if(l===null)return i;const[a]=l;return a.length>=n.length?i.slice(n.length):i}).join(`
4
+ `)}class Bt{constructor(t){this.options=t||Qe}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const n=e[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:$t(n,`
5
+ `)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const n=e[0],i=Li(n,e[3]||"");return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline._escapes,"$1"):e[2],text:i}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(/#$/.test(n)){const i=$t(n,"#");(this.options.pedantic||!i||/ $/.test(i))&&(n=i.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:e[0]}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){const n=e[0].replace(/^ *>[ \t]?/gm,""),i=this.lexer.state.top;this.lexer.state.top=!0;const l=this.lexer.blockTokens(n);return this.lexer.state.top=i,{type:"blockquote",raw:e[0],tokens:l,text:n}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n,i,l,a,r,d,f,h,m,b,g,$,k=e[1].trim();const y=k.length>1,p={type:"list",raw:"",ordered:y,start:y?+k.slice(0,-1):"",loose:!1,items:[]};k=y?`\\d{1,9}\\${k.slice(-1)}`:`\\${k}`,this.options.pedantic&&(k=y?k:"[*+-]");const x=new RegExp(`^( {0,3}${k})((?:[ ][^\\n]*)?(?:\\n|$))`);for(;t&&($=!1,!(!(e=x.exec(t))||this.rules.block.hr.test(t)));){if(n=e[0],t=t.substring(n.length),h=e[2].split(`
6
+ `,1)[0].replace(/^\t+/,C=>" ".repeat(3*C.length)),m=t.split(`
7
+ `,1)[0],this.options.pedantic?(a=2,g=h.trimLeft()):(a=e[2].search(/[^ ]/),a=a>4?1:a,g=h.slice(a),a+=e[1].length),d=!1,!h&&/^ *$/.test(m)&&(n+=m+`
8
+ `,t=t.substring(m.length+1),$=!0),!$){const C=new RegExp(`^ {0,${Math.min(3,a-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),V=new RegExp(`^ {0,${Math.min(3,a-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),H=new RegExp(`^ {0,${Math.min(3,a-1)}}(?:\`\`\`|~~~)`),T=new RegExp(`^ {0,${Math.min(3,a-1)}}#`);for(;t&&(b=t.split(`
9
+ `,1)[0],m=b,this.options.pedantic&&(m=m.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!(H.test(m)||T.test(m)||C.test(m)||V.test(t)));){if(m.search(/[^ ]/)>=a||!m.trim())g+=`
10
+ `+m.slice(a);else{if(d||h.search(/[^ ]/)>=4||H.test(h)||T.test(h)||V.test(h))break;g+=`
11
+ `+m}!d&&!m.trim()&&(d=!0),n+=b+`
12
+ `,t=t.substring(b.length+1),h=m.slice(a)}}p.loose||(f?p.loose=!0:/\n *\n *$/.test(n)&&(f=!0)),this.options.gfm&&(i=/^\[[ xX]\] /.exec(g),i&&(l=i[0]!=="[ ] ",g=g.replace(/^\[[ xX]\] +/,""))),p.items.push({type:"list_item",raw:n,task:!!i,checked:l,loose:!1,text:g}),p.raw+=n}p.items[p.items.length-1].raw=n.trimRight(),p.items[p.items.length-1].text=g.trimRight(),p.raw=p.raw.trimRight();const S=p.items.length;for(r=0;r<S;r++)if(this.lexer.state.top=!1,p.items[r].tokens=this.lexer.blockTokens(p.items[r].text,[]),!p.loose){const C=p.items[r].tokens.filter(H=>H.type==="space"),V=C.length>0&&C.some(H=>/\n.*\n/.test(H.raw));p.loose=V}if(p.loose)for(r=0;r<S;r++)p.items[r].loose=!0;return p}}html(t){const e=this.rules.block.html.exec(t);if(e){const n={type:"html",raw:e[0],pre:!this.options.sanitizer&&(e[1]==="pre"||e[1]==="script"||e[1]==="style"),text:e[0]};if(this.options.sanitize){const i=this.options.sanitizer?this.options.sanitizer(e[0]):re(e[0]);n.type="paragraph",n.text=i,n.tokens=this.lexer.inline(i)}return n}}def(t){const e=this.rules.block.def.exec(t);if(e){const n=e[1].toLowerCase().replace(/\s+/g," "),i=e[2]?e[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline._escapes,"$1"):"",l=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline._escapes,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:i,title:l}}}table(t){const e=this.rules.block.table.exec(t);if(e){const n={type:"table",header:Sn(e[1]).map(i=>({text:i})),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:e[3]&&e[3].trim()?e[3].replace(/\n[ \t]*$/,"").split(`
13
+ `):[]};if(n.header.length===n.align.length){n.raw=e[0];let i=n.align.length,l,a,r,d;for(l=0;l<i;l++)/^ *-+: *$/.test(n.align[l])?n.align[l]="right":/^ *:-+: *$/.test(n.align[l])?n.align[l]="center":/^ *:-+ *$/.test(n.align[l])?n.align[l]="left":n.align[l]=null;for(i=n.rows.length,l=0;l<i;l++)n.rows[l]=Sn(n.rows[l],n.header.length).map(f=>({text:f}));for(i=n.header.length,a=0;a<i;a++)n.header[a].tokens=this.lexer.inline(n.header[a].text);for(i=n.rows.length,a=0;a<i;a++)for(d=n.rows[a],r=0;r<d.length;r++)d[r].tokens=this.lexer.inline(d[r].text);return n}}}lheading(t){const e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){const e=this.rules.block.paragraph.exec(t);if(e){const n=e[1].charAt(e[1].length-1)===`
14
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){const e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){const e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:re(e[1])}}tag(t){const e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&/^<a /i.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):re(e[0]):e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const n=e[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;const a=$t(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{const a=Ii(e[2],"()");if(a>-1){const d=(e[0].indexOf("!")===0?5:4)+e[1].length+a;e[2]=e[2].substring(0,a),e[0]=e[0].substring(0,d).trim(),e[3]=""}}let i=e[2],l="";if(this.options.pedantic){const a=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);a&&(i=a[1],l=a[3])}else l=e[3]?e[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(this.options.pedantic&&!/>$/.test(n)?i=i.slice(1):i=i.slice(1,-1)),En(e,{href:i&&i.replace(this.rules.inline._escapes,"$1"),title:l&&l.replace(this.rules.inline._escapes,"$1")},e[0],this.lexer)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let i=(n[2]||n[1]).replace(/\s+/g," ");if(i=e[i.toLowerCase()],!i){const l=n[0].charAt(0);return{type:"text",raw:l,text:l}}return En(n,i,n[0],this.lexer)}}emStrong(t,e,n=""){let i=this.rules.inline.emStrong.lDelim.exec(t);if(!i||i[3]&&n.match(/[\p{L}\p{N}]/u))return;const l=i[1]||i[2]||"";if(!l||l&&(n===""||this.rules.inline.punctuation.exec(n))){const a=i[0].length-1;let r,d,f=a,h=0;const m=i[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(m.lastIndex=0,e=e.slice(-1*t.length+a);(i=m.exec(e))!=null;){if(r=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!r)continue;if(d=r.length,i[3]||i[4]){f+=d;continue}else if((i[5]||i[6])&&a%3&&!((a+d)%3)){h+=d;continue}if(f-=d,f>0)continue;d=Math.min(d,d+f+h);const b=t.slice(0,a+i.index+(i[0].length-r.length)+d);if(Math.min(a,d)%2){const $=b.slice(1,-1);return{type:"em",raw:b,text:$,tokens:this.lexer.inlineTokens($)}}const g=b.slice(2,-2);return{type:"strong",raw:b,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(/\n/g," ");const i=/[^ ]/.test(n),l=/^ /.test(n)&&/ $/.test(n);return i&&l&&(n=n.substring(1,n.length-1)),n=re(n,!0),{type:"codespan",raw:e[0],text:n}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t,e){const n=this.rules.inline.autolink.exec(t);if(n){let i,l;return n[2]==="@"?(i=re(this.options.mangle?e(n[1]):n[1]),l="mailto:"+i):(i=re(n[1]),l=i),{type:"link",raw:n[0],text:i,href:l,tokens:[{type:"text",raw:i,text:i}]}}}url(t,e){let n;if(n=this.rules.inline.url.exec(t)){let i,l;if(n[2]==="@")i=re(this.options.mangle?e(n[0]):n[0]),l="mailto:"+i;else{let a;do a=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0];while(a!==n[0]);i=re(n[0]),n[1]==="www."?l="http://"+n[0]:l=n[0]}return{type:"link",raw:n[0],text:i,href:l,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(t,e){const n=this.rules.inline.text.exec(t);if(n){let i;return this.lexer.state.inRawBlock?i=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):re(n[0]):n[0]:i=re(this.options.smartypants?e(n[0]):n[0]),{type:"text",raw:n[0],text:i}}}}const A={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:vt,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};A._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/,A._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,A.def=G(A.def).replace("label",A._label).replace("title",A._title).getRegex(),A.bullet=/(?:[*+-]|\d{1,9}[.)])/,A.listItemStart=G(/^( *)(bull) */).replace("bull",A.bullet).getRegex(),A.list=G(A.list).replace(/bull/g,A.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+A.def.source+")").getRegex(),A._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",A._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,A.html=G(A.html,"i").replace("comment",A._comment).replace("tag",A._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),A.paragraph=G(A._paragraph).replace("hr",A.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",A._tag).getRegex(),A.blockquote=G(A.blockquote).replace("paragraph",A.paragraph).getRegex(),A.normal=ye({},A),A.gfm=ye({},A.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),A.gfm.table=G(A.gfm.table).replace("hr",A.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",A._tag).getRegex(),A.gfm.paragraph=G(A._paragraph).replace("hr",A.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",A.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",A._tag).getRegex(),A.pedantic=ye({},A.normal,{html:G(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",A._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:vt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:G(A.normal._paragraph).replace("hr",A.hr).replace("heading",` *#{1,6} *[^
15
+ ]`).replace("lheading",A.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});const E={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:vt,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:vt,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};E._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",E.punctuation=G(E.punctuation).replace(/punctuation/g,E._punctuation).getRegex(),E.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,E.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g,E._comment=G(A._comment).replace("(?:-->|$)","-->").getRegex(),E.emStrong.lDelim=G(E.emStrong.lDelim).replace(/punct/g,E._punctuation).getRegex(),E.emStrong.rDelimAst=G(E.emStrong.rDelimAst,"g").replace(/punct/g,E._punctuation).getRegex(),E.emStrong.rDelimUnd=G(E.emStrong.rDelimUnd,"g").replace(/punct/g,E._punctuation).getRegex(),E._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,E._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,E._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,E.autolink=G(E.autolink).replace("scheme",E._scheme).replace("email",E._email).getRegex(),E._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,E.tag=G(E.tag).replace("comment",E._comment).replace("attribute",E._attribute).getRegex(),E._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,E._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,E._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,E.link=G(E.link).replace("label",E._label).replace("href",E._href).replace("title",E._title).getRegex(),E.reflink=G(E.reflink).replace("label",E._label).replace("ref",A._label).getRegex(),E.nolink=G(E.nolink).replace("ref",A._label).getRegex(),E.reflinkSearch=G(E.reflinkSearch,"g").replace("reflink",E.reflink).replace("nolink",E.nolink).getRegex(),E.normal=ye({},E),E.pedantic=ye({},E.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:G(/^!?\[(label)\]\((.*?)\)/).replace("label",E._label).getRegex(),reflink:G(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",E._label).getRegex()}),E.gfm=ye({},E.normal,{escape:G(E.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/}),E.gfm.url=G(E.gfm.url,"i").replace("email",E.gfm._extended_email).getRegex(),E.breaks=ye({},E.gfm,{br:G(E.br).replace("{2,}","*").getRegex(),text:G(E.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});function Fi(s){return s.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}function Nn(s){let t="",e,n;const i=s.length;for(e=0;e<i;e++)n=s.charCodeAt(e),Math.random()>.5&&(n="x"+n.toString(16)),t+="&#"+n+";";return t}class Ae{constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Qe,this.options.tokenizer=this.options.tokenizer||new Bt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const e={block:A.normal,inline:E.normal};this.options.pedantic?(e.block=A.pedantic,e.inline=E.pedantic):this.options.gfm&&(e.block=A.gfm,this.options.breaks?e.inline=E.breaks:e.inline=E.gfm),this.tokenizer.rules=e}static get rules(){return{block:A,inline:E}}static lex(t,e){return new Ae(e).lex(t)}static lexInline(t,e){return new Ae(e).inlineTokens(t)}lex(t){t=t.replace(/\r\n|\r/g,`
16
+ `),this.blockTokens(t,this.tokens);let e;for(;e=this.inlineQueue.shift();)this.inlineTokens(e.src,e.tokens);return this.tokens}blockTokens(t,e=[]){this.options.pedantic?t=t.replace(/\t/g," ").replace(/^ +$/gm,""):t=t.replace(/^( *)(\t+)/gm,(r,d,f)=>d+" ".repeat(f.length));let n,i,l,a;for(;t;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(r=>(n=r.call({lexer:this},t,e))?(t=t.substring(n.raw.length),e.push(n),!0):!1))){if(n=this.tokenizer.space(t)){t=t.substring(n.raw.length),n.raw.length===1&&e.length>0?e[e.length-1].raw+=`
17
+ `:e.push(n);continue}if(n=this.tokenizer.code(t)){t=t.substring(n.raw.length),i=e[e.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
18
+ `+n.raw,i.text+=`
19
+ `+n.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):e.push(n);continue}if(n=this.tokenizer.fences(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.heading(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.hr(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.blockquote(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.list(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.html(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.def(t)){t=t.substring(n.raw.length),i=e[e.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
20
+ `+n.raw,i.text+=`
21
+ `+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.lheading(t)){t=t.substring(n.raw.length),e.push(n);continue}if(l=t,this.options.extensions&&this.options.extensions.startBlock){let r=1/0;const d=t.slice(1);let f;this.options.extensions.startBlock.forEach(function(h){f=h.call({lexer:this},d),typeof f=="number"&&f>=0&&(r=Math.min(r,f))}),r<1/0&&r>=0&&(l=t.substring(0,r+1))}if(this.state.top&&(n=this.tokenizer.paragraph(l))){i=e[e.length-1],a&&i.type==="paragraph"?(i.raw+=`
22
+ `+n.raw,i.text+=`
23
+ `+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):e.push(n),a=l.length!==t.length,t=t.substring(n.raw.length);continue}if(n=this.tokenizer.text(t)){t=t.substring(n.raw.length),i=e[e.length-1],i&&i.type==="text"?(i.raw+=`
24
+ `+n.raw,i.text+=`
25
+ `+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):e.push(n);continue}if(t){const r="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(r);break}else throw new Error(r)}}return this.state.top=!0,e}inline(t,e=[]){return this.inlineQueue.push({src:t,tokens:e}),e}inlineTokens(t,e=[]){let n,i,l,a=t,r,d,f;if(this.tokens.links){const h=Object.keys(this.tokens.links);if(h.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)h.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,r.index)+"["+Tn("a",r[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,r.index)+"["+Tn("a",r[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(r=this.tokenizer.rules.inline.escapedEmSt.exec(a))!=null;)a=a.slice(0,r.index+r[0].length-2)+"++"+a.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;t;)if(d||(f=""),d=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(h=>(n=h.call({lexer:this},t,e))?(t=t.substring(n.raw.length),e.push(n),!0):!1))){if(n=this.tokenizer.escape(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.tag(t)){t=t.substring(n.raw.length),i=e[e.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):e.push(n);continue}if(n=this.tokenizer.link(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(n.raw.length),i=e[e.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):e.push(n);continue}if(n=this.tokenizer.emStrong(t,a,f)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.codespan(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.br(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.del(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.autolink(t,Nn)){t=t.substring(n.raw.length),e.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(t,Nn))){t=t.substring(n.raw.length),e.push(n);continue}if(l=t,this.options.extensions&&this.options.extensions.startInline){let h=1/0;const m=t.slice(1);let b;this.options.extensions.startInline.forEach(function(g){b=g.call({lexer:this},m),typeof b=="number"&&b>=0&&(h=Math.min(h,b))}),h<1/0&&h>=0&&(l=t.substring(0,h+1))}if(n=this.tokenizer.inlineText(l,Fi)){t=t.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(f=n.raw.slice(-1)),d=!0,i=e[e.length-1],i&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):e.push(n);continue}if(t){const h="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return e}}class Ut{constructor(t){this.options=t||Qe}code(t,e,n){const i=(e||"").match(/\S*/)[0];if(this.options.highlight){const l=this.options.highlight(t,i);l!=null&&l!==t&&(n=!0,t=l)}return t=t.replace(/\n$/,"")+`
26
+ `,i?'<pre><code class="'+this.options.langPrefix+re(i)+'">'+(n?t:re(t,!0))+`</code></pre>
27
+ `:"<pre><code>"+(n?t:re(t,!0))+`</code></pre>
28
+ `}blockquote(t){return`<blockquote>
29
+ ${t}</blockquote>
30
+ `}html(t){return t}heading(t,e,n,i){if(this.options.headerIds){const l=this.options.headerPrefix+i.slug(n);return`<h${e} id="${l}">${t}</h${e}>
31
+ `}return`<h${e}>${t}</h${e}>
32
+ `}hr(){return this.options.xhtml?`<hr/>
33
+ `:`<hr>
34
+ `}list(t,e,n){const i=e?"ol":"ul",l=e&&n!==1?' start="'+n+'"':"";return"<"+i+l+`>
35
+ `+t+"</"+i+`>
36
+ `}listitem(t){return`<li>${t}</li>
37
+ `}checkbox(t){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "}paragraph(t){return`<p>${t}</p>
38
+ `}table(t,e){return e&&(e=`<tbody>${e}</tbody>`),`<table>
39
+ <thead>
40
+ `+t+`</thead>
41
+ `+e+`</table>
42
+ `}tablerow(t){return`<tr>
43
+ ${t}</tr>
44
+ `}tablecell(t,e){const n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
45
+ `}strong(t){return`<strong>${t}</strong>`}em(t){return`<em>${t}</em>`}codespan(t){return`<code>${t}</code>`}br(){return this.options.xhtml?"<br/>":"<br>"}del(t){return`<del>${t}</del>`}link(t,e,n){if(t=$n(this.options.sanitize,this.options.baseUrl,t),t===null)return n;let i='<a href="'+t+'"';return e&&(i+=' title="'+e+'"'),i+=">"+n+"</a>",i}image(t,e,n){if(t=$n(this.options.sanitize,this.options.baseUrl,t),t===null)return n;let i=`<img src="${t}" alt="${n}"`;return e&&(i+=` title="${e}"`),i+=this.options.xhtml?"/>":">",i}text(t){return t}}class zn{strong(t){return t}em(t){return t}codespan(t){return t}del(t){return t}html(t){return t}text(t){return t}link(t,e,n){return""+n}image(t,e,n){return""+n}br(){return""}}class Vn{constructor(){this.seen={}}serialize(t){return t.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(t,e){let n=t,i=0;if(this.seen.hasOwnProperty(n)){i=this.seen[t];do i++,n=t+"-"+i;while(this.seen.hasOwnProperty(n))}return e||(this.seen[t]=i,this.seen[n]=0),n}slug(t,e={}){const n=this.serialize(t);return this.getNextSafeSlug(n,e.dryrun)}}class Ce{constructor(t){this.options=t||Qe,this.options.renderer=this.options.renderer||new Ut,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new zn,this.slugger=new Vn}static parse(t,e){return new Ce(e).parse(t)}static parseInline(t,e){return new Ce(e).parseInline(t)}parse(t,e=!0){let n="",i,l,a,r,d,f,h,m,b,g,$,k,y,p,x,S,C,V,H;const T=t.length;for(i=0;i<T;i++){if(g=t[i],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[g.type]&&(H=this.options.extensions.renderers[g.type].call({parser:this},g),H!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(g.type))){n+=H||"";continue}switch(g.type){case"space":continue;case"hr":{n+=this.renderer.hr();continue}case"heading":{n+=this.renderer.heading(this.parseInline(g.tokens),g.depth,vn(this.parseInline(g.tokens,this.textRenderer)),this.slugger);continue}case"code":{n+=this.renderer.code(g.text,g.lang,g.escaped);continue}case"table":{for(m="",h="",r=g.header.length,l=0;l<r;l++)h+=this.renderer.tablecell(this.parseInline(g.header[l].tokens),{header:!0,align:g.align[l]});for(m+=this.renderer.tablerow(h),b="",r=g.rows.length,l=0;l<r;l++){for(f=g.rows[l],h="",d=f.length,a=0;a<d;a++)h+=this.renderer.tablecell(this.parseInline(f[a].tokens),{header:!1,align:g.align[a]});b+=this.renderer.tablerow(h)}n+=this.renderer.table(m,b);continue}case"blockquote":{b=this.parse(g.tokens),n+=this.renderer.blockquote(b);continue}case"list":{for($=g.ordered,k=g.start,y=g.loose,r=g.items.length,b="",l=0;l<r;l++)x=g.items[l],S=x.checked,C=x.task,p="",x.task&&(V=this.renderer.checkbox(S),y?x.tokens.length>0&&x.tokens[0].type==="paragraph"?(x.tokens[0].text=V+" "+x.tokens[0].text,x.tokens[0].tokens&&x.tokens[0].tokens.length>0&&x.tokens[0].tokens[0].type==="text"&&(x.tokens[0].tokens[0].text=V+" "+x.tokens[0].tokens[0].text)):x.tokens.unshift({type:"text",text:V}):p+=V),p+=this.parse(x.tokens,y),b+=this.renderer.listitem(p,C,S);n+=this.renderer.list(b,$,k);continue}case"html":{n+=this.renderer.html(g.text);continue}case"paragraph":{n+=this.renderer.paragraph(this.parseInline(g.tokens));continue}case"text":{for(b=g.tokens?this.parseInline(g.tokens):g.text;i+1<T&&t[i+1].type==="text";)g=t[++i],b+=`
46
+ `+(g.tokens?this.parseInline(g.tokens):g.text);n+=e?this.renderer.paragraph(b):b;continue}default:{const w='Token with "'+g.type+'" type was not found.';if(this.options.silent){console.error(w);return}else throw new Error(w)}}}return n}parseInline(t,e){e=e||this.renderer;let n="",i,l,a;const r=t.length;for(i=0;i<r;i++){if(l=t[i],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[l.type]&&(a=this.options.extensions.renderers[l.type].call({parser:this},l),a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type))){n+=a||"";continue}switch(l.type){case"escape":{n+=e.text(l.text);break}case"html":{n+=e.html(l.text);break}case"link":{n+=e.link(l.href,l.title,this.parseInline(l.tokens,e));break}case"image":{n+=e.image(l.href,l.title,l.text);break}case"strong":{n+=e.strong(this.parseInline(l.tokens,e));break}case"em":{n+=e.em(this.parseInline(l.tokens,e));break}case"codespan":{n+=e.codespan(l.text);break}case"br":{n+=e.br();break}case"del":{n+=e.del(this.parseInline(l.tokens,e));break}case"text":{n+=e.text(l.text);break}default:{const d='Token with "'+l.type+'" type was not found.';if(this.options.silent){console.error(d);return}else throw new Error(d)}}}return n}}function N(s,t,e){if(typeof s>"u"||s===null)throw new Error("marked(): input parameter is undefined or null");if(typeof s!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected");if(typeof t=="function"&&(e=t,t=null),t=ye({},N.defaults,t||{}),Cn(t),e){const i=t.highlight;let l;try{l=Ae.lex(s,t)}catch(d){return e(d)}const a=function(d){let f;if(!d)try{t.walkTokens&&N.walkTokens(l,t.walkTokens),f=Ce.parse(l,t)}catch(h){d=h}return t.highlight=i,d?e(d):e(null,f)};if(!i||i.length<3||(delete t.highlight,!l.length))return a();let r=0;N.walkTokens(l,function(d){d.type==="code"&&(r++,setTimeout(()=>{i(d.text,d.lang,function(f,h){if(f)return a(f);h!=null&&h!==d.text&&(d.text=h,d.escaped=!0),r--,r===0&&a()})},0))}),r===0&&a();return}function n(i){if(i.message+=`
47
+ Please report this to https://github.com/markedjs/marked.`,t.silent)return"<p>An error occurred:</p><pre>"+re(i.message+"",!0)+"</pre>";throw i}try{const i=Ae.lex(s,t);if(t.walkTokens){if(t.async)return Promise.all(N.walkTokens(i,t.walkTokens)).then(()=>Ce.parse(i,t)).catch(n);N.walkTokens(i,t.walkTokens)}return Ce.parse(i,t)}catch(i){n(i)}}N.options=N.setOptions=function(s){return ye(N.defaults,s),xi(N.defaults),N},N.getDefaults=kn,N.defaults=Qe,N.use=function(...s){const t=N.defaults.extensions||{renderers:{},childTokens:{}};s.forEach(e=>{const n=ye({},e);if(n.async=N.defaults.async||n.async,e.extensions&&(e.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if(i.renderer){const l=t.renderers[i.name];l?t.renderers[i.name]=function(...a){let r=i.renderer.apply(this,a);return r===!1&&(r=l.apply(this,a)),r}:t.renderers[i.name]=i.renderer}if(i.tokenizer){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");t[i.level]?t[i.level].unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),n.extensions=t),e.renderer){const i=N.defaults.renderer||new Ut;for(const l in e.renderer){const a=i[l];i[l]=(...r)=>{let d=e.renderer[l].apply(i,r);return d===!1&&(d=a.apply(i,r)),d}}n.renderer=i}if(e.tokenizer){const i=N.defaults.tokenizer||new Bt;for(const l in e.tokenizer){const a=i[l];i[l]=(...r)=>{let d=e.tokenizer[l].apply(i,r);return d===!1&&(d=a.apply(i,r)),d}}n.tokenizer=i}if(e.walkTokens){const i=N.defaults.walkTokens;n.walkTokens=function(l){let a=[];return a.push(e.walkTokens.call(this,l)),i&&(a=a.concat(i.call(this,l))),a}}N.setOptions(n)})},N.walkTokens=function(s,t){let e=[];for(const n of s)switch(e=e.concat(t.call(N,n)),n.type){case"table":{for(const i of n.header)e=e.concat(N.walkTokens(i.tokens,t));for(const i of n.rows)for(const l of i)e=e.concat(N.walkTokens(l.tokens,t));break}case"list":{e=e.concat(N.walkTokens(n.items,t));break}default:N.defaults.extensions&&N.defaults.extensions.childTokens&&N.defaults.extensions.childTokens[n.type]?N.defaults.extensions.childTokens[n.type].forEach(function(i){e=e.concat(N.walkTokens(n[i],t))}):n.tokens&&(e=e.concat(N.walkTokens(n.tokens,t)))}return e},N.parseInline=function(s,t){if(typeof s>"u"||s===null)throw new Error("marked.parseInline(): input parameter is undefined or null");if(typeof s!="string")throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected");t=ye({},N.defaults,t||{}),Cn(t);try{const e=Ae.lexInline(s,t);return t.walkTokens&&N.walkTokens(e,t.walkTokens),Ce.parseInline(e,t)}catch(e){if(e.message+=`
48
+ Please report this to https://github.com/markedjs/marked.`,t.silent)return"<p>An error occurred:</p><pre>"+re(e.message+"",!0)+"</pre>";throw e}},N.Parser=Ce,N.parser=Ce.parse,N.Renderer=Ut,N.TextRenderer=zn,N.Lexer=Ae,N.lexer=Ae.lex,N.Tokenizer=Bt,N.Slugger=Vn,N.parse=N,N.options,N.setOptions,N.use,N.walkTokens,N.parseInline,Ce.parse,Ae.lex;var Ri=function(){var s=document.getSelection();if(!s.rangeCount)return function(){};for(var t=document.activeElement,e=[],n=0;n<s.rangeCount;n++)e.push(s.getRangeAt(n));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null;break}return s.removeAllRanges(),function(){s.type==="Caret"&&s.removeAllRanges(),s.rangeCount||e.forEach(function(i){s.addRange(i)}),t&&t.focus()}},ji=Ri,_n={"text/plain":"Text","text/html":"Url",default:"Text"},Oi="Copy to clipboard: #{key}, Enter";function Di(s){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return s.replace(/#{\s*key\s*}/g,t)}function Hi(s,t){var e,n,i,l,a,r,d=!1;t||(t={}),e=t.debug||!1;try{i=ji(),l=document.createRange(),a=document.getSelection(),r=document.createElement("span"),r.textContent=s,r.ariaHidden="true",r.style.all="unset",r.style.position="fixed",r.style.top=0,r.style.clip="rect(0, 0, 0, 0)",r.style.whiteSpace="pre",r.style.webkitUserSelect="text",r.style.MozUserSelect="text",r.style.msUserSelect="text",r.style.userSelect="text",r.addEventListener("copy",function(h){if(h.stopPropagation(),t.format)if(h.preventDefault(),typeof h.clipboardData>"u"){e&&console.warn("unable to use e.clipboardData"),e&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var m=_n[t.format]||_n.default;window.clipboardData.setData(m,s)}else h.clipboardData.clearData(),h.clipboardData.setData(t.format,s);t.onCopy&&(h.preventDefault(),t.onCopy(h.clipboardData))}),document.body.appendChild(r),l.selectNodeContents(r),a.addRange(l);var f=document.execCommand("copy");if(!f)throw new Error("copy command was unsuccessful");d=!0}catch(h){e&&console.error("unable to copy using execCommand: ",h),e&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",s),t.onCopy&&t.onCopy(window.clipboardData),d=!0}catch(m){e&&console.error("unable to copy using clipboardData: ",m),e&&console.error("falling back to prompt"),n=Di("message"in t?t.message:Oi),window.prompt(n,s)}}finally{a&&(typeof a.removeRange=="function"?a.removeRange(l):a.removeAllRanges()),r&&document.body.removeChild(r),i()}return d}var at=Hi;/*! medium-zoom 1.0.8 | MIT License | https://github.com/francoischalifour/medium-zoom */var Be=Object.assign||function(s){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n])}return s},St=function(t){return t.tagName==="IMG"},Pi=function(t){return NodeList.prototype.isPrototypeOf(t)},Ct=function(t){return t&&t.nodeType===1},An=function(t){var e=t.currentSrc||t.src;return e.substr(-4).toLowerCase()===".svg"},In=function(t){try{return Array.isArray(t)?t.filter(St):Pi(t)?[].slice.call(t).filter(St):Ct(t)?[t].filter(St):typeof t=="string"?[].slice.call(document.querySelectorAll(t)).filter(St):[]}catch{throw new TypeError(`The provided selector is invalid.
49
+ Expects a CSS selector, a Node element, a NodeList or an array.
50
+ See: https://github.com/francoischalifour/medium-zoom`)}},Mi=function(t){var e=document.createElement("div");return e.classList.add("medium-zoom-overlay"),e.style.background=t,e},Bi=function(t){var e=t.getBoundingClientRect(),n=e.top,i=e.left,l=e.width,a=e.height,r=t.cloneNode(),d=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,f=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;return r.removeAttribute("id"),r.style.position="absolute",r.style.top=n+d+"px",r.style.left=i+f+"px",r.style.width=l+"px",r.style.height=a+"px",r.style.transform="",r},Ye=function(t,e){var n=Be({bubbles:!1,cancelable:!1,detail:void 0},e);if(typeof window.CustomEvent=="function")return new CustomEvent(t,n);var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),i},Ui=function s(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=window.Promise||function(z){function F(){}z(F,F)},i=function(z){var F=z.target;if(F===Q){$();return}S.indexOf(F)!==-1&&k({target:F})},l=function(){if(!(V||!w.original)){var z=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;Math.abs(H-z)>T.scrollOffset&&setTimeout($,150)}},a=function(z){var F=z.key||z.keyCode;(F==="Escape"||F==="Esc"||F===27)&&$()},r=function(){var z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},F=z;if(z.background&&(Q.style.background=z.background),z.container&&z.container instanceof Object&&(F.container=Be({},T.container,z.container)),z.template){var P=Ct(z.template)?z.template:document.querySelector(z.template);F.template=P}return T=Be({},T,F),S.forEach(function(q){q.dispatchEvent(Ye("medium-zoom:update",{detail:{zoom:U}}))}),U},d=function(){var z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return s(Be({},T,z))},f=function(){for(var z=arguments.length,F=Array(z),P=0;P<z;P++)F[P]=arguments[P];var q=F.reduce(function(j,te){return[].concat(j,In(te))},[]);return q.filter(function(j){return S.indexOf(j)===-1}).forEach(function(j){S.push(j),j.classList.add("medium-zoom-image")}),C.forEach(function(j){var te=j.type,I=j.listener,R=j.options;q.forEach(function(M){M.addEventListener(te,I,R)})}),U},h=function(){for(var z=arguments.length,F=Array(z),P=0;P<z;P++)F[P]=arguments[P];w.zoomed&&$();var q=F.length>0?F.reduce(function(j,te){return[].concat(j,In(te))},[]):S;return q.forEach(function(j){j.classList.remove("medium-zoom-image"),j.dispatchEvent(Ye("medium-zoom:detach",{detail:{zoom:U}}))}),S=S.filter(function(j){return q.indexOf(j)===-1}),U},m=function(z,F){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return S.forEach(function(q){q.addEventListener("medium-zoom:"+z,F,P)}),C.push({type:"medium-zoom:"+z,listener:F,options:P}),U},b=function(z,F){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return S.forEach(function(q){q.removeEventListener("medium-zoom:"+z,F,P)}),C=C.filter(function(q){return!(q.type==="medium-zoom:"+z&&q.listener.toString()===F.toString())}),U},g=function(){var z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},F=z.target,P=function(){var j={width:document.documentElement.clientWidth,height:document.documentElement.clientHeight,left:0,top:0,right:0,bottom:0},te=void 0,I=void 0;if(T.container)if(T.container instanceof Object)j=Be({},j,T.container),te=j.width-j.left-j.right-T.margin*2,I=j.height-j.top-j.bottom-T.margin*2;else{var R=Ct(T.container)?T.container:document.querySelector(T.container),M=R.getBoundingClientRect(),oe=M.width,ce=M.height,be=M.left,Ve=M.top;j=Be({},j,{width:oe,height:ce,left:be,top:Ve})}te=te||j.width-T.margin*2,I=I||j.height-T.margin*2;var je=w.zoomedHd||w.original,Ke=An(je)?te:je.naturalWidth||te,He=An(je)?I:je.naturalHeight||I,Ge=je.getBoundingClientRect(),Vt=Ge.top,_t=Ge.left,lt=Ge.width,ot=Ge.height,At=Math.min(Math.max(lt,Ke),te)/lt,It=Math.min(Math.max(ot,He),I)/ot,rt=Math.min(At,It),Lt=(-_t+(te-lt)/2+T.margin+j.left)/rt,Ft=(-Vt+(I-ot)/2+T.margin+j.top)/rt,pt="scale("+rt+") translate3d("+Lt+"px, "+Ft+"px, 0)";w.zoomed.style.transform=pt,w.zoomedHd&&(w.zoomedHd.style.transform=pt)};return new n(function(q){if(F&&S.indexOf(F)===-1){q(U);return}var j=function oe(){V=!1,w.zoomed.removeEventListener("transitionend",oe),w.original.dispatchEvent(Ye("medium-zoom:opened",{detail:{zoom:U}})),q(U)};if(w.zoomed){q(U);return}if(F)w.original=F;else if(S.length>0){var te=S;w.original=te[0]}else{q(U);return}if(w.original.dispatchEvent(Ye("medium-zoom:open",{detail:{zoom:U}})),H=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,V=!0,w.zoomed=Bi(w.original),document.body.appendChild(Q),T.template){var I=Ct(T.template)?T.template:document.querySelector(T.template);w.template=document.createElement("div"),w.template.appendChild(I.content.cloneNode(!0)),document.body.appendChild(w.template)}if(w.original.parentElement&&w.original.parentElement.tagName==="PICTURE"&&w.original.currentSrc&&(w.zoomed.src=w.original.currentSrc),document.body.appendChild(w.zoomed),window.requestAnimationFrame(function(){document.body.classList.add("medium-zoom--opened")}),w.original.classList.add("medium-zoom-image--hidden"),w.zoomed.classList.add("medium-zoom-image--opened"),w.zoomed.addEventListener("click",$),w.zoomed.addEventListener("transitionend",j),w.original.getAttribute("data-zoom-src")){w.zoomedHd=w.zoomed.cloneNode(),w.zoomedHd.removeAttribute("srcset"),w.zoomedHd.removeAttribute("sizes"),w.zoomedHd.removeAttribute("loading"),w.zoomedHd.src=w.zoomed.getAttribute("data-zoom-src"),w.zoomedHd.onerror=function(){clearInterval(R),console.warn("Unable to reach the zoom image target "+w.zoomedHd.src),w.zoomedHd=null,P()};var R=setInterval(function(){w.zoomedHd.complete&&(clearInterval(R),w.zoomedHd.classList.add("medium-zoom-image--opened"),w.zoomedHd.addEventListener("click",$),document.body.appendChild(w.zoomedHd),P())},10)}else if(w.original.hasAttribute("srcset")){w.zoomedHd=w.zoomed.cloneNode(),w.zoomedHd.removeAttribute("sizes"),w.zoomedHd.removeAttribute("loading");var M=w.zoomedHd.addEventListener("load",function(){w.zoomedHd.removeEventListener("load",M),w.zoomedHd.classList.add("medium-zoom-image--opened"),w.zoomedHd.addEventListener("click",$),document.body.appendChild(w.zoomedHd),P()})}else P()})},$=function(){return new n(function(z){if(V||!w.original){z(U);return}var F=function P(){w.original.classList.remove("medium-zoom-image--hidden"),document.body.removeChild(w.zoomed),w.zoomedHd&&document.body.removeChild(w.zoomedHd),document.body.removeChild(Q),w.zoomed.classList.remove("medium-zoom-image--opened"),w.template&&document.body.removeChild(w.template),V=!1,w.zoomed.removeEventListener("transitionend",P),w.original.dispatchEvent(Ye("medium-zoom:closed",{detail:{zoom:U}})),w.original=null,w.zoomed=null,w.zoomedHd=null,w.template=null,z(U)};V=!0,document.body.classList.remove("medium-zoom--opened"),w.zoomed.style.transform="",w.zoomedHd&&(w.zoomedHd.style.transform=""),w.template&&(w.template.style.transition="opacity 150ms",w.template.style.opacity=0),w.original.dispatchEvent(Ye("medium-zoom:close",{detail:{zoom:U}})),w.zoomed.addEventListener("transitionend",F)})},k=function(){var z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},F=z.target;return w.original?$():g({target:F})},y=function(){return T},p=function(){return S},x=function(){return w.original},S=[],C=[],V=!1,H=0,T=e,w={original:null,zoomed:null,zoomedHd:null,template:null};Object.prototype.toString.call(t)==="[object Object]"?T=t:(t||typeof t=="string")&&f(t),T=Be({margin:0,background:"#fff",scrollOffset:40,container:null,template:null},T);var Q=Mi(T.background);document.addEventListener("click",i),document.addEventListener("keyup",a),document.addEventListener("scroll",l),window.addEventListener("resize",$);var U={open:g,close:$,toggle:k,update:r,clone:d,attach:f,detach:h,on:m,off:b,getOptions:y,getImages:p,getZoomedImage:x};return U};function qi(s,t){t===void 0&&(t={});var e=t.insertAt;if(!(!s||typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",e==="top"&&n.firstChild?n.insertBefore(i,n.firstChild):n.appendChild(i),i.styleSheet?i.styleSheet.cssText=s:i.appendChild(document.createTextNode(s))}}var Wi=".medium-zoom-overlay{position:fixed;top:0;right:0;bottom:0;left:0;opacity:0;transition:opacity .3s;will-change:opacity}.medium-zoom--opened .medium-zoom-overlay{cursor:pointer;cursor:zoom-out;opacity:1}.medium-zoom-image{cursor:pointer;cursor:zoom-in;transition:transform .3s cubic-bezier(.2,0,.2,1)!important}.medium-zoom-image--hidden{visibility:hidden}.medium-zoom-image--opened{position:relative;cursor:pointer;cursor:zoom-out;will-change:transform}";qi(Wi);const Ki=Ui,ct=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Ln=new Set,Gi=(s,t,e,n)=>{typeof process=="object"&&process&&typeof process.emitWarning=="function"?process.emitWarning(s,t,e,n):console.error(`[${e}] ${t}: ${s}`)},Zi=s=>!Ln.has(s),Oe=s=>s&&s===Math.floor(s)&&s>0&&isFinite(s),Fn=s=>Oe(s)?s<=Math.pow(2,8)?Uint8Array:s<=Math.pow(2,16)?Uint16Array:s<=Math.pow(2,32)?Uint32Array:s<=Number.MAX_SAFE_INTEGER?Tt:null:null;class Tt extends Array{constructor(t){super(t),this.fill(0)}}const et=class{constructor(t,e){se(this,"heap");se(this,"length");if(!c(et,Je))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}static create(t){const e=Fn(t);if(!e)return[];L(et,Je,!0);const n=new et(t,e);return L(et,Je,!1),n}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}};let Et=et;Je=new WeakMap,D(Et,Je,!1);const Xt=class{constructor(t){D(this,ut);D(this,zt);D(this,Ne);D(this,ze);D(this,mt);D(this,it);D(this,st);D(this,X);D(this,gt);D(this,We);D(this,we,void 0);D(this,me,void 0);D(this,Te,void 0);D(this,xe,void 0);D(this,tt,void 0);se(this,"ttl");se(this,"ttlResolution");se(this,"ttlAutopurge");se(this,"updateAgeOnGet");se(this,"updateAgeOnHas");se(this,"allowStale");se(this,"noDisposeOnSet");se(this,"noUpdateTTL");se(this,"maxEntrySize");se(this,"sizeCalculation");se(this,"noDeleteOnFetchRejection");se(this,"noDeleteOnStaleGet");se(this,"allowStaleOnFetchAbort");se(this,"allowStaleOnFetchRejection");se(this,"ignoreFetchAbort");D(this,ne,void 0);D(this,ve,void 0);D(this,ie,void 0);D(this,Z,void 0);D(this,O,void 0);D(this,ue,void 0);D(this,ge,void 0);D(this,de,void 0);D(this,le,void 0);D(this,$e,void 0);D(this,ae,void 0);D(this,Le,void 0);D(this,Fe,void 0);D(this,Se,void 0);D(this,Ee,void 0);D(this,De,void 0);D(this,he,void 0);D(this,Ue,()=>{});D(this,Re,()=>{});D(this,ht,()=>{});D(this,pe,()=>!1);D(this,qe,t=>{});D(this,nt,(t,e,n)=>{});D(this,ft,(t,e,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});const{max:e=0,ttl:n,ttlResolution:i=1,ttlAutopurge:l,updateAgeOnGet:a,updateAgeOnHas:r,allowStale:d,dispose:f,disposeAfter:h,noDisposeOnSet:m,noUpdateTTL:b,maxSize:g=0,maxEntrySize:$=0,sizeCalculation:k,fetchMethod:y,noDeleteOnFetchRejection:p,noDeleteOnStaleGet:x,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:C,ignoreFetchAbort:V}=t;if(e!==0&&!Oe(e))throw new TypeError("max option must be a nonnegative integer");const H=e?Fn(e):Array;if(!H)throw new Error("invalid max value: "+e);if(L(this,we,e),L(this,me,g),this.maxEntrySize=$||c(this,me),this.sizeCalculation=k,this.sizeCalculation){if(!c(this,me)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw new TypeError("fetchMethod must be a function if specified");if(L(this,tt,y),L(this,De,!!y),L(this,ie,new Map),L(this,Z,new Array(e).fill(void 0)),L(this,O,new Array(e).fill(void 0)),L(this,ue,new H(e)),L(this,ge,new H(e)),L(this,de,0),L(this,le,0),L(this,$e,Et.create(e)),L(this,ne,0),L(this,ve,0),typeof f=="function"&&L(this,Te,f),typeof h=="function"?(L(this,xe,h),L(this,ae,[])):(L(this,xe,void 0),L(this,ae,void 0)),L(this,Ee,!!c(this,Te)),L(this,he,!!c(this,xe)),this.noDisposeOnSet=!!m,this.noUpdateTTL=!!b,this.noDeleteOnFetchRejection=!!p,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!C,this.ignoreFetchAbort=!!V,this.maxEntrySize!==0){if(c(this,me)!==0&&!Oe(c(this,me)))throw new TypeError("maxSize must be a positive integer if specified");if(!Oe(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");_(this,zt,Pn).call(this)}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!x,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!r,this.ttlResolution=Oe(i)||i===0?i:1,this.ttlAutopurge=!!l,this.ttl=n||0,this.ttl){if(!Oe(this.ttl))throw new TypeError("ttl must be a positive integer if specified");_(this,ut,Yt).call(this)}if(c(this,we)===0&&this.ttl===0&&c(this,me)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!c(this,we)&&!c(this,me)){const T="LRU_CACHE_UNBOUNDED";Zi(T)&&(Ln.add(T),Gi("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",T,Xt))}}static unsafeExposeInternals(t){return{starts:c(t,Fe),ttls:c(t,Se),sizes:c(t,Le),keyMap:c(t,ie),keyList:c(t,Z),valList:c(t,O),next:c(t,ue),prev:c(t,ge),get head(){return c(t,de)},get tail(){return c(t,le)},free:c(t,$e),isBackgroundFetch:e=>{var n;return _(n=t,X,Y).call(n,e)},backgroundFetch:(e,n,i,l)=>{var a;return _(a=t,st,Ot).call(a,e,n,i,l)},moveToTail:e=>{var n;return _(n=t,We,bt).call(n,e)},indexes:e=>{var n;return _(n=t,Ne,Pe).call(n,e)},rindexes:e=>{var n;return _(n=t,ze,Me).call(n,e)},isStale:e=>{var n;return c(n=t,pe).call(n,e)}}}get max(){return c(this,we)}get maxSize(){return c(this,me)}get calculatedSize(){return c(this,ve)}get size(){return c(this,ne)}get fetchMethod(){return c(this,tt)}get dispose(){return c(this,Te)}get disposeAfter(){return c(this,xe)}getRemainingTTL(t){return c(this,ie).has(t)?1/0:0}*entries(){for(const t of _(this,Ne,Pe).call(this))c(this,O)[t]!==void 0&&c(this,Z)[t]!==void 0&&!_(this,X,Y).call(this,c(this,O)[t])&&(yield[c(this,Z)[t],c(this,O)[t]])}*rentries(){for(const t of _(this,ze,Me).call(this))c(this,O)[t]!==void 0&&c(this,Z)[t]!==void 0&&!_(this,X,Y).call(this,c(this,O)[t])&&(yield[c(this,Z)[t],c(this,O)[t]])}*keys(){for(const t of _(this,Ne,Pe).call(this)){const e=c(this,Z)[t];e!==void 0&&!_(this,X,Y).call(this,c(this,O)[t])&&(yield e)}}*rkeys(){for(const t of _(this,ze,Me).call(this)){const e=c(this,Z)[t];e!==void 0&&!_(this,X,Y).call(this,c(this,O)[t])&&(yield e)}}*values(){for(const t of _(this,Ne,Pe).call(this))c(this,O)[t]!==void 0&&!_(this,X,Y).call(this,c(this,O)[t])&&(yield c(this,O)[t])}*rvalues(){for(const t of _(this,ze,Me).call(this))c(this,O)[t]!==void 0&&!_(this,X,Y).call(this,c(this,O)[t])&&(yield c(this,O)[t])}[Symbol.iterator](){return this.entries()}find(t,e={}){for(const n of _(this,Ne,Pe).call(this)){const i=c(this,O)[n],l=_(this,X,Y).call(this,i)?i.__staleWhileFetching:i;if(l!==void 0&&t(l,c(this,Z)[n],this))return this.get(c(this,Z)[n],e)}}forEach(t,e=this){for(const n of _(this,Ne,Pe).call(this)){const i=c(this,O)[n],l=_(this,X,Y).call(this,i)?i.__staleWhileFetching:i;l!==void 0&&t.call(e,l,c(this,Z)[n],this)}}rforEach(t,e=this){for(const n of _(this,ze,Me).call(this)){const i=c(this,O)[n],l=_(this,X,Y).call(this,i)?i.__staleWhileFetching:i;l!==void 0&&t.call(e,l,c(this,Z)[n],this)}}purgeStale(){let t=!1;for(const e of _(this,ze,Me).call(this,{allowStale:!0}))c(this,pe).call(this,e)&&(this.delete(c(this,Z)[e]),t=!0);return t}dump(){const t=[];for(const e of _(this,Ne,Pe).call(this,{allowStale:!0})){const n=c(this,Z)[e],i=c(this,O)[e],l=_(this,X,Y).call(this,i)?i.__staleWhileFetching:i;if(l===void 0||n===void 0)continue;const a={value:l};if(c(this,Se)&&c(this,Fe)){a.ttl=c(this,Se)[e];const r=ct.now()-c(this,Fe)[e];a.start=Math.floor(Date.now()-r)}c(this,Le)&&(a.size=c(this,Le)[e]),t.unshift([n,a])}return t}load(t){this.clear();for(const[e,n]of t){if(n.start){const i=Date.now()-n.start;n.start=ct.now()-i}this.set(e,n.value,n)}}set(t,e,n={}){var b,g,$;const{ttl:i=this.ttl,start:l,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:r=this.sizeCalculation,status:d}=n;let{noUpdateTTL:f=this.noUpdateTTL}=n;const h=c(this,ft).call(this,t,e,n.size||0,r);if(this.maxEntrySize&&h>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=!0),this.delete(t),this;let m=c(this,ne)===0?void 0:c(this,ie).get(t);if(m===void 0)m=c(this,ne)===0?c(this,le):c(this,$e).length!==0?c(this,$e).pop():c(this,ne)===c(this,we)?_(this,it,jt).call(this,!1):c(this,ne),c(this,Z)[m]=t,c(this,O)[m]=e,c(this,ie).set(t,m),c(this,ue)[c(this,le)]=m,c(this,ge)[m]=c(this,le),L(this,le,m),Rt(this,ne)._++,c(this,nt).call(this,m,h,d),d&&(d.set="add"),f=!1;else{_(this,We,bt).call(this,m);const k=c(this,O)[m];if(e!==k){if(c(this,De)&&_(this,X,Y).call(this,k)?k.__abortController.abort(new Error("replaced")):a||(c(this,Ee)&&((b=c(this,Te))==null||b.call(this,k,t,"set")),c(this,he)&&((g=c(this,ae))==null||g.push([k,t,"set"]))),c(this,qe).call(this,m),c(this,nt).call(this,m,h,d),c(this,O)[m]=e,d){d.set="replace";const y=k&&_(this,X,Y).call(this,k)?k.__staleWhileFetching:k;y!==void 0&&(d.oldValue=y)}}else d&&(d.set="update")}if(i!==0&&!c(this,Se)&&_(this,ut,Yt).call(this),c(this,Se)&&(f||c(this,ht).call(this,m,i,l),d&&c(this,Re).call(this,d,m)),!a&&c(this,he)&&c(this,ae)){const k=c(this,ae);let y;for(;y=k==null?void 0:k.shift();)($=c(this,xe))==null||$.call(this,...y)}return this}pop(){var t;try{for(;c(this,ne);){const e=c(this,O)[c(this,de)];if(_(this,it,jt).call(this,!0),_(this,X,Y).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(c(this,he)&&c(this,ae)){const e=c(this,ae);let n;for(;n=e==null?void 0:e.shift();)(t=c(this,xe))==null||t.call(this,...n)}}}has(t,e={}){const{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=e,l=c(this,ie).get(t);if(l!==void 0)if(c(this,pe).call(this,l))i&&(i.has="stale",c(this,Re).call(this,i,l));else return n&&c(this,Ue).call(this,l),i&&(i.has="hit",c(this,Re).call(this,i,l)),!0;else i&&(i.has="miss");return!1}peek(t,e={}){const{allowStale:n=this.allowStale}=e,i=c(this,ie).get(t);if(i!==void 0&&(n||!c(this,pe).call(this,i))){const l=c(this,O)[i];return _(this,X,Y).call(this,l)?l.__staleWhileFetching:l}}async fetch(t,e={}){const{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:l=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:r=this.noDisposeOnSet,size:d=0,sizeCalculation:f=this.sizeCalculation,noUpdateTTL:h=this.noUpdateTTL,noDeleteOnFetchRejection:m=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:b=this.allowStaleOnFetchRejection,ignoreFetchAbort:g=this.ignoreFetchAbort,allowStaleOnFetchAbort:$=this.allowStaleOnFetchAbort,context:k,forceRefresh:y=!1,status:p,signal:x}=e;if(!c(this,De))return p&&(p.fetch="get"),this.get(t,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:l,status:p});const S={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:l,ttl:a,noDisposeOnSet:r,size:d,sizeCalculation:f,noUpdateTTL:h,noDeleteOnFetchRejection:m,allowStaleOnFetchRejection:b,allowStaleOnFetchAbort:$,ignoreFetchAbort:g,status:p,signal:x};let C=c(this,ie).get(t);if(C===void 0){p&&(p.fetch="miss");const V=_(this,st,Ot).call(this,t,C,S,k);return V.__returned=V}else{const V=c(this,O)[C];if(_(this,X,Y).call(this,V)){const U=n&&V.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",U&&(p.returnedStale=!0)),U?V.__staleWhileFetching:V.__returned=V}const H=c(this,pe).call(this,C);if(!y&&!H)return p&&(p.fetch="hit"),_(this,We,bt).call(this,C),i&&c(this,Ue).call(this,C),p&&c(this,Re).call(this,p,C),V;const T=_(this,st,Ot).call(this,t,C,S,k),Q=T.__staleWhileFetching!==void 0&&n;return p&&(p.fetch=H?"stale":"refresh",Q&&H&&(p.returnedStale=!0)),Q?T.__staleWhileFetching:T.__returned=T}}get(t,e={}){const{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:l=this.noDeleteOnStaleGet,status:a}=e,r=c(this,ie).get(t);if(r!==void 0){const d=c(this,O)[r],f=_(this,X,Y).call(this,d);return a&&c(this,Re).call(this,a,r),c(this,pe).call(this,r)?(a&&(a.get="stale"),f?(a&&n&&d.__staleWhileFetching!==void 0&&(a.returnedStale=!0),n?d.__staleWhileFetching:void 0):(l||this.delete(t),a&&n&&(a.returnedStale=!0),n?d:void 0)):(a&&(a.get="hit"),f?d.__staleWhileFetching:(_(this,We,bt).call(this,r),i&&c(this,Ue).call(this,r),d))}else a&&(a.get="miss")}delete(t){var n,i,l,a;let e=!1;if(c(this,ne)!==0){const r=c(this,ie).get(t);if(r!==void 0)if(e=!0,c(this,ne)===1)this.clear();else{c(this,qe).call(this,r);const d=c(this,O)[r];_(this,X,Y).call(this,d)?d.__abortController.abort(new Error("deleted")):(c(this,Ee)||c(this,he))&&(c(this,Ee)&&((n=c(this,Te))==null||n.call(this,d,t,"delete")),c(this,he)&&((i=c(this,ae))==null||i.push([d,t,"delete"]))),c(this,ie).delete(t),c(this,Z)[r]=void 0,c(this,O)[r]=void 0,r===c(this,le)?L(this,le,c(this,ge)[r]):r===c(this,de)?L(this,de,c(this,ue)[r]):(c(this,ue)[c(this,ge)[r]]=c(this,ue)[r],c(this,ge)[c(this,ue)[r]]=c(this,ge)[r]),Rt(this,ne)._--,c(this,$e).push(r)}}if(c(this,he)&&((l=c(this,ae))!=null&&l.length)){const r=c(this,ae);let d;for(;d=r==null?void 0:r.shift();)(a=c(this,xe))==null||a.call(this,...d)}return e}clear(){var t,e,n;for(const i of _(this,ze,Me).call(this,{allowStale:!0})){const l=c(this,O)[i];if(_(this,X,Y).call(this,l))l.__abortController.abort(new Error("deleted"));else{const a=c(this,Z)[i];c(this,Ee)&&((t=c(this,Te))==null||t.call(this,l,a,"delete")),c(this,he)&&((e=c(this,ae))==null||e.push([l,a,"delete"]))}}if(c(this,ie).clear(),c(this,O).fill(void 0),c(this,Z).fill(void 0),c(this,Se)&&c(this,Fe)&&(c(this,Se).fill(0),c(this,Fe).fill(0)),c(this,Le)&&c(this,Le).fill(0),L(this,de,0),L(this,le,0),c(this,$e).length=0,L(this,ve,0),L(this,ne,0),c(this,he)&&c(this,ae)){const i=c(this,ae);let l;for(;l=i==null?void 0:i.shift();)(n=c(this,xe))==null||n.call(this,...l)}}};let qt=Xt;we=new WeakMap,me=new WeakMap,Te=new WeakMap,xe=new WeakMap,tt=new WeakMap,ne=new WeakMap,ve=new WeakMap,ie=new WeakMap,Z=new WeakMap,O=new WeakMap,ue=new WeakMap,ge=new WeakMap,de=new WeakMap,le=new WeakMap,$e=new WeakMap,ae=new WeakMap,Le=new WeakMap,Fe=new WeakMap,Se=new WeakMap,Ee=new WeakMap,De=new WeakMap,he=new WeakMap,ut=new WeakSet,Yt=function(){const t=new Tt(c(this,we)),e=new Tt(c(this,we));L(this,Se,t),L(this,Fe,e),L(this,ht,(l,a,r=ct.now())=>{if(e[l]=a!==0?r:0,t[l]=a,a!==0&&this.ttlAutopurge){const d=setTimeout(()=>{c(this,pe).call(this,l)&&this.delete(c(this,Z)[l])},a+1);d.unref&&d.unref()}}),L(this,Ue,l=>{e[l]=t[l]!==0?ct.now():0}),L(this,Re,(l,a)=>{if(t[a]){const r=t[a],d=e[a];l.ttl=r,l.start=d,l.now=n||i(),l.remainingTTL=l.now+r-d}});let n=0;const i=()=>{const l=ct.now();if(this.ttlResolution>0){n=l;const a=setTimeout(()=>n=0,this.ttlResolution);a.unref&&a.unref()}return l};this.getRemainingTTL=l=>{const a=c(this,ie).get(l);return a===void 0?0:t[a]===0||e[a]===0?1/0:e[a]+t[a]-(n||i())},L(this,pe,l=>t[l]!==0&&e[l]!==0&&(n||i())-e[l]>t[l])},Ue=new WeakMap,Re=new WeakMap,ht=new WeakMap,pe=new WeakMap,zt=new WeakSet,Pn=function(){const t=new Tt(c(this,we));L(this,ve,0),L(this,Le,t),L(this,qe,e=>{L(this,ve,c(this,ve)-t[e]),t[e]=0}),L(this,ft,(e,n,i,l)=>{if(_(this,X,Y).call(this,n))return 0;if(!Oe(i))if(l){if(typeof l!="function")throw new TypeError("sizeCalculation must be a function");if(i=l(n,e),!Oe(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i}),L(this,nt,(e,n,i)=>{if(t[e]=n,c(this,me)){const l=c(this,me)-t[e];for(;c(this,ve)>l;)_(this,it,jt).call(this,!0)}L(this,ve,c(this,ve)+t[e]),i&&(i.entrySize=n,i.totalCalculatedSize=c(this,ve))})},qe=new WeakMap,nt=new WeakMap,ft=new WeakMap,Ne=new WeakSet,Pe=function*({allowStale:t=this.allowStale}={}){if(c(this,ne))for(let e=c(this,le);!(!_(this,mt,Jt).call(this,e)||((t||!c(this,pe).call(this,e))&&(yield e),e===c(this,de)));)e=c(this,ge)[e]},ze=new WeakSet,Me=function*({allowStale:t=this.allowStale}={}){if(c(this,ne))for(let e=c(this,de);!(!_(this,mt,Jt).call(this,e)||((t||!c(this,pe).call(this,e))&&(yield e),e===c(this,le)));)e=c(this,ue)[e]},mt=new WeakSet,Jt=function(t){return t!==void 0&&c(this,ie).get(c(this,Z)[t])===t},it=new WeakSet,jt=function(t){var l,a;const e=c(this,de),n=c(this,Z)[e],i=c(this,O)[e];return c(this,De)&&_(this,X,Y).call(this,i)?i.__abortController.abort(new Error("evicted")):(c(this,Ee)||c(this,he))&&(c(this,Ee)&&((l=c(this,Te))==null||l.call(this,i,n,"evict")),c(this,he)&&((a=c(this,ae))==null||a.push([i,n,"evict"]))),c(this,qe).call(this,e),t&&(c(this,Z)[e]=void 0,c(this,O)[e]=void 0,c(this,$e).push(e)),c(this,ne)===1?(L(this,de,L(this,le,0)),c(this,$e).length=0):L(this,de,c(this,ue)[e]),c(this,ie).delete(n),Rt(this,ne)._--,e},st=new WeakSet,Ot=function(t,e,n,i){const l=e===void 0?void 0:c(this,O)[e];if(_(this,X,Y).call(this,l))return l;const a=new AbortController,{signal:r}=n;r==null||r.addEventListener("abort",()=>a.abort(r.reason),{signal:a.signal});const d={signal:a.signal,options:n,context:i},f=(k,y=!1)=>{const{aborted:p}=a.signal,x=n.ignoreFetchAbort&&k!==void 0;if(n.status&&(p&&!y?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,x&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),p&&!x&&!y)return m(a.signal.reason);const S=g;return c(this,O)[e]===g&&(k===void 0?S.__staleWhileFetching?c(this,O)[e]=S.__staleWhileFetching:this.delete(t):(n.status&&(n.status.fetchUpdated=!0),this.set(t,k,d.options))),k},h=k=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=k),m(k)),m=k=>{const{aborted:y}=a.signal,p=y&&n.allowStaleOnFetchAbort,x=p||n.allowStaleOnFetchRejection,S=x||n.noDeleteOnFetchRejection,C=g;if(c(this,O)[e]===g&&(!S||C.__staleWhileFetching===void 0?this.delete(t):p||(c(this,O)[e]=C.__staleWhileFetching)),x)return n.status&&C.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),C.__staleWhileFetching;if(C.__returned===C)throw k},b=(k,y)=>{var x;const p=(x=c(this,tt))==null?void 0:x.call(this,t,l,d);p&&p instanceof Promise&&p.then(S=>k(S),y),a.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(k(),n.allowStaleOnFetchAbort&&(k=S=>f(S,!0)))})};n.status&&(n.status.fetchDispatched=!0);const g=new Promise(b).then(f,h),$=Object.assign(g,{__abortController:a,__staleWhileFetching:l,__returned:void 0});return e===void 0?(this.set(t,$,{...d.options,status:void 0}),e=c(this,ie).get(t)):c(this,O)[e]=$,$},X=new WeakSet,Y=function(t){if(!c(this,De))return!1;const e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof AbortController},gt=new WeakSet,en=function(t,e){c(this,ge)[e]=t,c(this,ue)[t]=e},We=new WeakSet,bt=function(t){t!==c(this,le)&&(t===c(this,de)?L(this,de,c(this,ue)[t]):_(this,gt,en).call(this,c(this,ge)[t],c(this,ue)[t]),_(this,gt,en).call(this,c(this,le),t),L(this,le,t))};const Xi=qt,dt=s=>{const t=s.value,e=t.substring(0,s.selectionStart),n=t.substring(s.selectionEnd,t.length),i=e.lastIndexOf(`
51
+ `),l=e.substring(0,i+1),a=n.indexOf(`
52
+ `),r=n.substring(a===-1?n.length:a,n.length),d=e.substring(i+1,e.length),f=n.substring(0,a);return{prefixStr:e,subfixStr:n,prefixStrEndRow:l,subfixStrEndRow:r,prefixSupply:d,subfixSupply:f}},Qi=(s,t="",e,n)=>{var m,b,g,$,k,y;let i="",l=0,a=0,r=!1,d,f;const h=(m=ee.editorConfig)==null?void 0:m.mermaidTemplate;if(/^h[1-6]{1}$/.test(s)){const p=s.replace(/^h(\d)/,(x,S)=>new Array(Number(S)).fill("#",0,S).join(""));i=`${p} ${t}`,l=p.length+1}else if(s==="prettier"){const p=window.prettier||((g=(b=ee.editorExtensions)==null?void 0:b.prettier)==null?void 0:g.prettierInstance),x=[(($=window.prettierPlugins)==null?void 0:$.markdown)||((y=(k=ee.editorExtensions)==null?void 0:k.prettier)==null?void 0:y.parserMarkdownInstance)];return!p||x[0]===void 0?(v.emit(n.editorId,"errorCatcher",{name:"prettier",message:"prettier is undefined"}),e.value):p.format(e.value,{parser:"markdown",plugins:x})}else switch(s){case"bold":{i=`**${t}**`,l=2,a=-2;break}case"underline":{i=`<u>${t}</u>`,l=3,a=-4;break}case"italic":{i=`*${t}*`,l=1,a=-1;break}case"strikeThrough":{i=`~${t}~`,l=1,a=-1;break}case"sub":{i=`<sub>${t}</sub>`,l=5,a=-6;break}case"sup":{i=`<sup>${t}</sup>`,l=5,a=-6;break}case"codeRow":{i="`"+t+"`",l=1,a=-1;break}case"quote":{i=`> ${t}`,l=2;break}case"orderedList":{i=`1. ${t}`,l=3;break}case"unorderedList":{i=`- ${t}`,l=2;break}case"task":{i=`- [ ] ${t}`,l=6,r=!0;break}case"code":{const p=n.text||t||"",x=n.mode||"language";i=`\`\`\`${x}
53
+ ${p}
54
+ \`\`\`
55
+ `,l=3,a=3+x.length-i.length,r=!0;break}case"table":{i="|";const{selectedShape:p={x:1,y:1}}=n,{x,y:S}=p;for(let C=0;C<=S;C++)i+=" col |";i+=`
56
+ |`;for(let C=0;C<=S;C++)i+=" - |";for(let C=0;C<=x;C++){i+=`
57
+ |`;for(let V=0;V<=S;V++)i+=" content |"}l=2,a=5-i.length,r=!0;break}case"link":{const{desc:p,url:x}=n;i=`[${p}](${x})`;break}case"image":{const{desc:p,url:x,urls:S}=n;S instanceof Array?i=S.reduce((C,V)=>C+`![${p}](${V})
58
+ `,""):i=`![${p}](${x})
59
+ `;break}case"tab":{const{tabWidth:p=2}=n,x=new Array(p).fill(" ").join("");if(t==="")i=x;else if(/\n/.test(t)){const{prefixStr:S,subfixStr:C,prefixSupply:V,subfixSupply:H}=dt(e);i=`${V}${t}${H}`.split(`
60
+ `).map(Q=>`${x}${Q}`).join(`
61
+ `),d=S.substring(0,S.length-V.length),f=C.substring(H.length,C.length),r=!0,l=p,a=-V.length-H.length}else{const C=e.value.substring(0,e.selectionStart);/\n$/.test(C)||C===""?(i=`${x}${t}`,r=!0):i=x}break}case"shiftTab":{const{tabWidth:p=2}=n,{prefixStr:x,prefixStrEndRow:S,subfixStrEndRow:C,prefixSupply:V,subfixSupply:H}=dt(e),T=new RegExp(`^\\s{${p}}`),w=(Q=!1,U=!1)=>{const B=`${V}${t}${H}`;if(T.test(B)){const z=x.length-(U?0:p),F=Q?z+t.length-p:z;return _e(e,z,F),`${S}${B.replace(T,"")}${C}`}else if(/^\s/.test(B)){const z=B.replace(/^\s/,""),F=B.length-z.length,P=e.selectionStart-(U?0:F),q=Q?P+t.length-F:P;return _e(e,P,q),`${S}${z}${C}`}else i=t};if(t===""){const Q=w();if(Q)return Q}else if(/\n/.test(t)){const U=`${V}${t}${H}`.split(`
62
+ `);let[B,z]=[0,0];const F=U.map((P,q)=>{if(T.test(P))return q===0&&(B=p),z+=p,P.replace(T,"");if(/^\s/.test(P)){const j=P.replace(/^\s/,"");return z+=P.length-j.length,j}return P}).join(`
63
+ `);return _e(e,e.selectionStart-B,e.selectionEnd-z),`${S}${F}${C}`}else{const Q=w(!0,!0);if(Q)return Q}break}case"ctrlC":{const{prefixSupply:p,subfixSupply:x}=dt(e);return at(t===""?`${p}${x}`:t),e.value}case"ctrlX":{const{prefixStrEndRow:p,subfixStrEndRow:x,prefixStr:S,subfixStr:C,prefixSupply:V,subfixSupply:H}=dt(e);return t===""?(at(`${V}${H}`),_e(e,p.length),`${p}${x.replace(/^\n/,"")}`):(at(t),_e(e,S.length),`${S}${C}`)}case"ctrlD":{const{prefixStrEndRow:p,subfixStrEndRow:x}=dt(e);return _e(e,p.length),`${p}${x.replace(/^\n/,"")}`}case"flow":{i=`\`\`\`mermaid
64
+ ${(h==null?void 0:h.flow)||`flowchart TD
65
+ Start --> Stop`}
66
+ \`\`\`
67
+ `,l=2;break}case"sequence":{i=`\`\`\`mermaid
68
+ ${(h==null?void 0:h.sequence)||`sequenceDiagram
69
+ A->>B: hello!
70
+ B-->>A: hi!
71
+ A-)B: bye!`}
72
+ \`\`\`
73
+ `,l=2;break}case"gantt":{i=`\`\`\`mermaid
74
+ ${(h==null?void 0:h.gantt)||`gantt
75
+ title A Gantt Diagram
76
+ dateFormat YYYY-MM-DD
77
+ section Section
78
+ A task :a1, 2014-01-01, 30d
79
+ Another task :after a1, 20d`}
80
+ \`\`\`
81
+ `,l=2;break}case"class":{i=`\`\`\`mermaid
82
+ ${(h==null?void 0:h.class)||`classDiagram
83
+ class Animal
84
+ Vehicle <|-- Car`}
85
+ \`\`\`
86
+ `,l=2;break}case"state":{i=`\`\`\`mermaid
87
+ ${(h==null?void 0:h.state)||`stateDiagram-v2
88
+ s1 --> s2`}
89
+ \`\`\`
90
+ `,l=2;break}case"pie":{i=`\`\`\`mermaid
91
+ ${(h==null?void 0:h.pie)||`pie title Pets adopted by volunteers
92
+ "Dogs" : 386
93
+ "Cats" : 85
94
+ "Rats" : 15`}
95
+ \`\`\`
96
+ `,l=2;break}case"relationship":{i=`\`\`\`mermaid
97
+ ${(h==null?void 0:h.relationship)||`erDiagram
98
+ CAR ||--o{ NAMED-DRIVER : allows
99
+ PERSON ||--o{ NAMED-DRIVER : is`}
100
+ \`\`\`
101
+ `,l=2;break}case"journey":{i=`\`\`\`mermaid
102
+ ${(h==null?void 0:h.journey)||`journey
103
+ title My working day
104
+ section Go to work
105
+ Make tea: 5: Me
106
+ Go upstairs: 3: Me
107
+ Do work: 1: Me, Cat
108
+ section Go home
109
+ Go downstairs: 5: Me
110
+ Sit down: 5: Me`}
111
+ \`\`\`
112
+ `,l=2;break}case"katexInline":{i="$$",l=1,a=-1;break}case"katexBlock":{i=`$$
113
+
114
+ $$
115
+ `,l=1,a=-4;break}case"universal":{const{generate:p}=n,x=p(t);i=x.targetValue,r=x.select,l=x.deviationStart,a=x.deviationEnd}}return Dt(e,i,{deviationStart:l,deviationEnd:a,select:r,prefixVal:d,subfixVal:f})},Rn={block(s,t){return{name:"KaTexBlockExtension",level:"block",start:e=>{var n;return(n=e.match(/\n\$\$/))==null?void 0:n.index},tokenizer(e){if(/^\$\$/.test(e)&&e.split("$$").length>2){const n=dn(e,"$$");return{type:"KaTexBlockExtension",raw:n[0],text:n[1].trim(),tokens:[]}}},renderer(e){const n=t||typeof window<"u"&&window.katex;if(n){const i=n.renderToString(e.text,{throwOnError:!1,displayMode:!0});return`<p class="${s}-katex-block" data-processed>${i}</p>`}else return`<p class="${s}-katex-block">${e.text}</p>`}}},inline(s,t){return{name:"KaTexInlineExtension",level:"inline",start:e=>{var n;return(n=e.match(/\$[^\n]*/))==null?void 0:n.index},tokenizer(e){if(/^\$[^\n]*\$/.test(e)){const n=dn(e);return{type:"KaTexInlineExtension",raw:n[0],text:n[1].trim(),tokens:[]}}},renderer(e){const n=t||typeof window<"u"&&window.katex;if(n){const i=n.renderToString(e.text,{throwOnError:!1});return`<span class="${s}-katex-inline" data-processed>${i}</span>`}else return`<span class="${s}-katex-inline">${e.text}</span>`}}}},jn=["abstract","attention","bug","caution","danger","error","example","failure","hint","info","note","question","quote","success","tip","warning"],Wt=new RegExp(`^!!!\\s*(${jn.join("|")})\\s*(.*)$`),Yi=/^!!!\s*$/,Ji={name:"alert",level:"block",start(s){var e;return(e=s.match(new RegExp(`(^|[\\r\\n])!!!\\s*(${jn.join("|")})\\s*(.*)`)))==null?void 0:e.index},tokenizer(s){const t=s.split(/\n/);if(Wt.test(t[0])){const e={x:-1,y:-1},n=[];for(let i=0,l=t.length;i<l;i++)Wt.test(t[i])?e.x=i:Yi.test(t[i])&&(e.y=i,e.x>=0&&(n.push({...e}),e.x=-1,e.y=-1));if(n.length){const i=n[0],[l,a,r]=Wt.exec(t[i.x])||[],d=t.slice(i.x+1,i.y).join(`
116
+ `),h={type:"alert",raw:t.slice(i.x,i.y+1).join(`
117
+ `),icon:a,title:r,text:d,titleTokens:[],tokens:[],childTokens:["title","text"]};return this.lexer.inlineTokens(h.title,h.titleTokens),this.lexer.blockTokens(h.text,h.tokens),h}}},renderer(s){return`<div class="md-editor-alert md-editor-alert-${s.icon}">
118
+ <p class="md-editor-alert-title">${this.parser.parseInline(s.titleTokens,null)}</p>
119
+ ${this.parser.parse(s.tokens)}
120
+ </div>`}},es=typeof window>"u",ts=(s,t,e)=>{var g,$;const n=o.inject("previewOnly"),i=o.inject("historyLength"),l=o.inject("editorId");if(n)return;let a=-1;const r={list:[{content:s.value,startPos:((g=t.value)==null?void 0:g.selectionStart)||0,endPos:(($=t.value)==null?void 0:$.selectionEnd)||0}],userUpdated:!0,curr:0},d=[0,0];let f=d;const h=k=>{var S,C;const y=((S=t.value)==null?void 0:S.selectionStart)||0,p=((C=t.value)==null?void 0:C.selectionEnd)||0;r.list[r.curr].startPos=y,r.list[r.curr].endPos=p,r.userUpdated=!1,r.curr=k;const x=r.list[r.curr];f=[x.startPos,x.endPos],s.onChange(x.content),_e(t.value,x.startPos,x.endPos).then(()=>{v.emit(l,"selectTextChange")})},m=k=>{var x,S;clearTimeout(a);const y=((x=t.value)==null?void 0:x.selectionStart)||0,p=((S=t.value)==null?void 0:S.selectionEnd)||0;a=setTimeout(()=>{if(r.userUpdated){r.curr<r.list.length-1&&(r.list=r.list.slice(0,r.curr+1)),r.list.length>i&&r.list.shift();const C=r.list.pop()||{startPos:0,endPos:0,content:k};C.startPos=f[0],C.endPos=f[1],f=d,Array.prototype.push.call(r.list,C,{content:k,startPos:y,endPos:p}),r.curr=r.list.length-1}else r.userUpdated=!0},150)},b=k=>{var y,p;(f===d||k)&&(f=[(y=t.value)==null?void 0:y.selectionStart,(p=t.value)==null?void 0:p.selectionEnd])};o.watch([o.toRef(s,"value"),e],()=>{e.value&&m(s.value)}),o.watch(()=>s.value,()=>{v.emit(l,"selectTextChange")},{flush:"post"}),o.onMounted(()=>{v.on(l,{name:"ctrlZ",callback(){h(r.curr-1<0?0:r.curr-1)}}),v.on(l,{name:"ctrlShiftZ",callback(){h(r.curr+1===r.list.length?r.curr:r.curr+1)}}),v.on(l,{name:"saveHistoryPos",callback:b})})},ns=(s,t)=>{var l;const e=(l=ee.editorExtensions)==null?void 0:l.katex,n=e==null?void 0:e.instance,i=o.ref(!1);return s.noKatex||t.use({extensions:[Rn.inline(u,n),Rn.block(u,n)]}),o.onMounted(()=>{if(!s.noKatex&&!n){const a=document.createElement("script");a.src=(e==null?void 0:e.js)||kt.js,a.onload=()=>{i.value=!0},a.id=`${u}-katex`;const r=document.createElement("link");r.rel="stylesheet",r.href=(e==null?void 0:e.css)||kt.css,r.id=`${u}-katexCss`,fe(a,"katex"),fe(r)}}),i},is=s=>{var q,j,te;const{markedRenderer:t,markedExtensions:e,markedOptions:n,editorExtensions:i,editorConfig:l}=ee,a=o.inject("showCodeRowNumber"),r=o.inject("editorId"),d=o.inject("highlight"),f=o.inject("previewOnly"),h=o.inject("theme"),m=(q=i==null?void 0:i.highlight)==null?void 0:q.instance,b=(j=i==null?void 0:i.mermaid)==null?void 0:j.instance,g=(te=i==null?void 0:i.katex)==null?void 0:te.instance,$=i==null?void 0:i.katex,k=o.ref(!1),y=o.ref([]);let p=[],x=[];const S=new Xi({max:1e3,ttl:6e5}),C=os(s),V=ns(s,N),H=o.computed(()=>(s.noMermaid||C.mermaidInited)&&k.value&&(s.noKatex||V.value));let T=new N.Renderer;T.image=(I,R,M)=>`<span class="figure"><img src="${I}" title="${R||""}" alt="${M||""}" zoom><span class="figcaption">${M||""}</span></span>`,T.listitem=(I,R)=>R?`<li class="li-task">${I}</li>`:`<li>${I}</li>`,t instanceof Function&&(T=t(T));const w=T.code;T.code=(I,R,M)=>{if(!s.noMermaid&&R==="mermaid"){const oe=Jn();try{if(es)return`<p class="${u}-mermaid">${I}</p>`;{const be=S.get(I);if(be)return`<p class="${u}-mermaid" data-processed>${be}</p>`;const Ve=b||window.mermaid;if(C.mermaidInited){const Ke=(Ve.renderAsync||Ve.render)(oe,I);Ke.then(He=>{S.set(I,typeof He=="string"?He:He.svg)}),p.push(Ke)}else return`<p class="${u}-mermaid">${I}</p>`}const ce=`<script type="text/tmplate">${oe}<\/script>`;return x.push(ce),ce}catch(ce){return`<p class="${u}-mermaid-error">Error: ${(ce==null?void 0:ce.message)||""}</p>`}}return w.call(T,I,R,M).replace(/^<pre><code\sclass="language-([^>]*)">/,'<pre><code class="language-$1" language="$1">')};const Q=T.heading,U=Q!==new N.Renderer().heading;T.heading=(I,R,M,oe)=>{y.value.push({text:M,level:R});const ce=s.markedHeadingId(M,R,y.value.length);return U?Q.call(T,I,R,M,oe,y.value.length,ce):I!==M?`<h${R} id="${ce}">${I}</h${R}>`:`<h${R} id="${ce}"><a href="#${ce}">${M}</a></h${R}>`},m&&N.setOptions({highlight:(I,R)=>{let M;const oe=m.getLanguage(R);return R&&oe?M=m.highlight(I,{language:R,ignoreIllegals:!0}).value:M=m.highlightAuto(I).value,a?cn(M):`<span class="code-block">${M}</span>`}}),N.setOptions({breaks:!0,...n}),e instanceof Array&&e.length>0&&N.use({extensions:e}),N.use({extensions:[Ji]});const B=o.ref(s.sanitize(N(s.value||"",{renderer:T}))),z=async I=>{let R=s.sanitize(N(I,{renderer:T}));const M=[...p],oe=[...x];return x=[],p=[],(await Promise.allSettled(M)).forEach((be,Ve)=>{be.status==="fulfilled"?R=R.replace(oe[Ve],`<p class="${u}-mermaid" data-processed>${typeof be.value=="string"?be.value:be.value.svg}</p>`):R=R.replace(oe[Ve],`<p class="${u}-mermaid-error">${be.reason||""}</p>`)}),R},F=yt(async()=>{y.value=[];const I=await z(s.value||"");B.value=I,v.emit(r,"buildFinished",B.value),s.onHtmlChanged(B.value)},(l==null?void 0:l.renderDelay)!==void 0?l==null?void 0:l.renderDelay:f?0:500);o.watch([H,o.toRef(C,"reRender"),o.toRef(s,"value")],F),o.watch([h],()=>{S.clear()});const P=()=>{N.setOptions({highlight:(I,R)=>{let M;const oe=window.hljs.getLanguage(R);return R&&oe?M=window.hljs.highlight(I,{language:R,ignoreIllegals:!0}).value:M=window.hljs.highlightAuto(I).value,a?cn(M):`<span class="code-block">${M}</span>`}}),k.value=!0};return o.watch(()=>y.value,I=>{s.onGetCatalog(I),v.emit(r,"catalogChanged",I)}),o.onMounted(()=>{if(!s.noKatex&&!g){const R=document.createElement("script");R.src=($==null?void 0:$.js)||kt.js,R.onload=()=>{V.value=!0},R.id=`${u}-katex`;const M=document.createElement("link");M.rel="stylesheet",M.href=($==null?void 0:$.css)||kt.css,M.id=`${u}-katexCss`,fe(R,"katex"),fe(M)}const I=document.createElement("link");if(I.rel="stylesheet",I.href=d.value.css,I.id=`${u}-hlCss`,fe(I),!m){const R=document.createElement("script");R.src=d.value.js,R.onload=P,R.id=`${u}-hljs`,fe(R,"hljs")}}),o.watch(()=>d.value.css,I=>{ei(`${u}-hlCss`,"href",I)}),o.onMounted(()=>{v.on(r,{name:"pushCatalog",callback(){v.emit(r,"catalogChanged",y.value)}})}),B},ss=(s,t,e,n,i)=>{const l=o.inject("previewOnly"),a=o.inject("usedLanguageText"),r=o.inject("editorId");let d=()=>{},f=()=>{};const h=()=>{document.querySelectorAll(`#${r}-preview pre`).forEach(g=>{var p,x;let $=-1;(p=g.querySelector(".copy-button"))==null||p.remove();const k=((x=a.value.copyCode)==null?void 0:x.text)||"复制代码",y=document.createElement("span");y.setAttribute("class","copy-button"),y.dataset.tips=k,y.innerHTML=`<svg class="${u}-icon" aria-hidden="true"><use xlink:href="#${u}-icon-copy"></use></svg>`,y.addEventListener("click",()=>{var T,w;clearTimeout($);const S=g.querySelector("code").innerText,C=at(s.formatCopiedText(S)),V=((T=a.value.copyCode)==null?void 0:T.successTips)||"已复制!",H=((w=a.value.copyCode)==null?void 0:w.failTips)||"已复制!";y.dataset.tips=C?V:H,$=window.setTimeout(()=>{y.dataset.tips=k},1500)}),g.appendChild(y)})},m=()=>{o.nextTick(()=>{s.setting.preview&&!l&&s.scrollAuto&&(d(),f()),h()})},b=g=>{g&&!l&&o.nextTick(()=>{d(),[f,d]=an(e.value,n.value||i.value),f(),h()})};o.watch(()=>t.value,m),o.watch(()=>a.value,h),o.watch(()=>s.setting.preview,b),o.watch(()=>s.setting.htmlPreview,b),o.watch(()=>s.scrollAuto,g=>{g?f():d()}),o.onMounted(()=>{h(),!l&&(n.value||i.value)&&([f,d]=an(e.value,n.value||i.value)),s.scrollAuto&&f()})},ls=(s,t)=>{const e=o.inject("previewOnly"),n=o.inject("tabWidth"),i=o.inject("editorId"),l=o.ref("");o.onMounted(()=>{var a;e||((a=t.value)==null||a.addEventListener("keypress",r=>{var d,f,h;if(r.key==="Enter"){const m=(d=t.value)==null?void 0:d.selectionStart,b=(f=t.value)==null?void 0:f.value.substring(0,m),g=(h=t.value)==null?void 0:h.value.substring(m),$=b==null?void 0:b.lastIndexOf(`
121
+ `),k=b==null?void 0:b.substring($+1,m);if(/^\d+\.\s|^-\s/.test(k))if(r.cancelBubble=!0,r.preventDefault(),r.stopPropagation(),/^(\d+\.|-)\s+(\[[x\s]\]\s+)?$/.test(k)){const y=b==null?void 0:b.replace(/(\d+\.|-)\s+(\[[x\s]\]\s+)?$/,"");s.onChange(y+g),_e(t.value,y==null?void 0:y.length)}else if(/^-\s+.+/.test(k)){const y=/^-\s+\[[x\s]\]/.test(k)?`
122
+ - [ ] `:`
123
+ - `;s.onChange(Dt(t.value,y,{}))}else{const y=k==null?void 0:k.match(/\d+(?=\.)/),p=y&&Number(y[0])+1||1,x=/^\d\.\s+\[[x\s]\]/.test(k)?`
124
+ ${p}. [ ] `:`
125
+ ${p}. `;s.onChange(Dt(t.value,x,{}))}}}),v.on(i,{name:"replace",callback(r,d={}){s.onChange(Qi(r,l.value,t.value,{...d,tabWidth:n,editorId:i}))}}),v.on(i,{name:"selectTextChange",callback(){l.value=Xn(t.value)}}))}),o.watch(()=>s.value,()=>{l.value=""})},os=s=>{const t=o.inject("theme"),{editorExtensions:e}=ee,n=e==null?void 0:e.mermaid,i=o.reactive({reRender:!1,mermaidInited:!1}),l=()=>{const a=(n==null?void 0:n.instance)||window.mermaid;!s.noMermaid&&a&&(a.initialize({startOnLoad:!1,theme:t.value==="dark"?"dark":"default"}),i.reRender=!i.reRender)};return o.watch(()=>t.value,l),o.onMounted(()=>{if(!s.noMermaid)if(n!=null&&n.instance)l(),i.mermaidInited=!0;else{const a=document.createElement("script");a.id=`${u}-mermaid`;const r=(n==null?void 0:n.js)||Un;/\.mjs/.test(r)?(a.setAttribute("type","module"),a.innerHTML=`import mermaid from "${r}";window.mermaid=mermaid;document.getElementById('${u}-mermaid').dispatchEvent(new Event('load'));`):a.src=r,a.onload=()=>{l(),i.mermaidInited=!0},fe(a,"mermaid")}}),i},rs=(s,t)=>{const e=o.inject("editorId"),n=o.inject("previewOnly"),i=l=>{if(l.clipboardData){if(l.clipboardData.files.length>0){const{files:a}=l.clipboardData;v.emit(e,"uploadImage",Array.from(a).filter(r=>/image\/.*/.test(r.type))),l.preventDefault()}if(s.autoDetectCode&&l.clipboardData.types.includes("vscode-editor-data")){const a=JSON.parse(l.clipboardData.getData("vscode-editor-data"));v.emit(e,"replace","code",{mode:a.mode,text:l.clipboardData.getData("text/plain")}),l.preventDefault()}}};o.onMounted(()=>{n||t.value.addEventListener("paste",i)}),o.onBeforeUnmount(()=>{n||t.value.removeEventListener("paste",i)})},as=(s,t)=>{const e=o.inject("editorId"),n=yt(()=>{const i=document.querySelectorAll(`#${e}-preview img[zoom]`);i.length!==0&&Ki(i,{background:"#00000073"})});o.onMounted(n),o.watch([t,o.toRef(s.setting,"preview")],n)},cs=s=>{const t=o.inject("editorId");o.onMounted(()=>{v.on(t,{name:bn,callback(){var e;(e=s.value)==null||e.focus()}})})},ds=()=>({value:{type:String,default:""},onChange:{type:Function,default:()=>{}},setting:{type:Object,default:()=>({})},onHtmlChanged:{type:Function,default:()=>{}},onGetCatalog:{type:Function,default:()=>{}},markedHeadingId:{type:Function,default:()=>""},noMermaid:{type:Boolean,default:!1},sanitize:{type:Function,default:s=>s},placeholder:{type:String,default:""},noKatex:{type:Boolean,default:!1},scrollAuto:{type:Boolean},formatCopiedText:{type:Function,default:s=>s},autofocus:{type:Boolean},disabled:{type:Boolean},readonly:{type:Boolean},maxlength:{type:Number},autoDetectCode:{type:Boolean},onBlur:{type:Function,default:()=>{}},onFocus:{type:Function,default:()=>{}}}),us=o.defineComponent({name:"MDEditorContent",props:ds(),setup(s){const t=o.ref(!0),e=o.inject("previewOnly"),n=o.inject("showCodeRowNumber"),i=o.inject("previewTheme"),l=o.inject("editorId"),a=o.ref(),r=o.ref(),d=o.ref(),f=is(s);return ss(s,f,a,r,d),ls(s,a),ts(s,a,t),rs(s,a),as(s,f),cs(a),()=>{const h=Yn(s,["formatCopiedText","markedHeadingId","noKatex","noMermaid","onChange","onGetCatalog","onHtmlChanged","sanitize","scrollAuto","setting","autoDetectCode","onBlur","onFocus"]);return o.createVNode(o.Fragment,null,[o.createVNode("div",{class:`${u}-content`},[!e&&o.createVNode("div",{class:`${u}-input-wrapper`},[o.createVNode("textarea",o.mergeProps(h,{id:`${l}-textarea`,class:[s.setting.preview||s.setting.htmlPreview?"":"textarea-only"],ref:a,onBlur:m=>{v.emit(l,"selectTextChange"),s.onBlur(m)},onFocus:s.onFocus,onKeydown:()=>{v.emit(l,"saveHistoryPos",!0)},onCompositionstart:()=>{t.value=!1},onInput:m=>{s.onChange(m.target.value)},onCompositionend:()=>{t.value=!0}}),null)]),s.setting.preview&&o.createVNode("div",{id:`${l}-preview-wrapper`,class:`${u}-preview-wrapper`,ref:r,key:"content-preview-wrapper"},[o.createVNode("article",{id:`${l}-preview`,class:[`${u}-preview`,`${i==null?void 0:i.value}-theme`,n&&`${u}-scrn`],innerHTML:f.value},null)]),s.setting.htmlPreview&&o.createVNode("div",{class:`${u}-preview-wrapper`,ref:d,key:"html-preview-wrapper"},[o.createVNode("div",{class:`${u}-html`},[f.value])])])])}}}),hs=o.defineComponent({props:{modelValue:{type:String,default:""}},setup(s){const t=o.inject("usedLanguageText");return()=>{var e,n;return o.createVNode("div",{class:`${u}-footer-item`},[o.createVNode("label",{class:`${u}-footer-label`},[`${(e=t.value.footer)==null?void 0:e.markdownTotal}:`]),o.createVNode("span",null,[((n=s.modelValue)==null?void 0:n.length)||0])])}}}),Is="",fs=()=>({checked:{type:Boolean,default:!1},onChange:{type:Function,default:()=>{}}}),ms=o.defineComponent({props:fs(),setup(s){return()=>o.createVNode("div",{class:[`${u}-checkbox`,s.checked&&`${u}-checkbox-checked`],onClick:()=>{s.onChange(!s.checked)}},null)}}),gs=()=>({scrollAuto:{type:Boolean},onScrollAutoChange:{type:Function,default:()=>{}}}),ps=o.defineComponent({props:gs(),setup(s){const t=o.inject("usedLanguageText");return()=>{var e;return o.createVNode("div",{class:`${u}-footer-item`},[o.createVNode("label",{class:`${u}-footer-label`,onClick:()=>{s.onScrollAutoChange(!s.scrollAuto)}},[(e=t.value.footer)==null?void 0:e.scrollAuto]),o.createVNode(ms,{checked:s.scrollAuto,onChange:s.onScrollAutoChange},null)])}}}),bs=()=>({modelValue:{type:String,default:""},footers:{type:Array,default:[]},scrollAuto:{type:Boolean},onScrollAutoChange:{type:Function,default:()=>{}},defFooters:{type:Object}}),ks=o.defineComponent({name:"MDEditorFooter",props:bs(),setup(s){const t=o.computed(()=>{const n=s.footers.indexOf("="),i=n===-1?s.footers:s.footers.slice(0,n),l=n===-1?[]:s.footers.slice(n,Number.MAX_SAFE_INTEGER);return[i,l]}),e=n=>{if(ln.includes(n))switch(n){case"markdownTotal":return o.createVNode(hs,{modelValue:s.modelValue},null);case"scrollSwitch":return o.createVNode(ps,{scrollAuto:s.scrollAuto,onScrollAutoChange:s.onScrollAutoChange},null)}else return s.defFooters instanceof Array?s.defFooters[n]||"":s.defFooters&&s.defFooters.children instanceof Array&&s.defFooters.children[n]||""};return()=>{const n=t.value[0].map(l=>e(l)),i=t.value[1].map(l=>e(l));return o.createVNode("div",{class:`${u}-footer`},[o.createVNode("div",{class:`${u}-footer-left`},[n]),o.createVNode("div",{class:`${u}-footer-right`},[i])])}}}),ys=()=>({tocItem:{type:Object,default:()=>({})},markedHeadingId:{type:Function,default:()=>{}},scrollElement:{type:[String,Object],default:""},onClick:{type:Function,default:()=>{}},scrollElementOffsetTop:{type:Number,default:0}}),On=o.defineComponent({props:ys(),setup(s){return()=>{const{tocItem:t,markedHeadingId:e,scrollElement:n,onClick:i,scrollElementOffsetTop:l}=s;return o.createVNode("div",{class:[`${u}-catalog-link`,t.active&&`${u}-catalog-active`],onClick:a=>{i(a,t),a.stopPropagation();const r=e(t.text,t.level,t.index),d=document.getElementById(r),f=n instanceof Element?n:document.querySelector(n);if(d&&f){let h=d.offsetParent,m=d.offsetTop;if(f.contains(h))for(;h&&f!=h;)m+=h==null?void 0:h.offsetTop,h=h==null?void 0:h.offsetParent;f==null||f.scrollTo({top:m-l,behavior:"smooth"})}}},[o.createVNode("span",{title:t.text},[t.text]),o.createVNode("div",{class:`${u}-catalog-wrapper`},[t.children&&t.children.map(a=>o.createVNode(On,{markedHeadingId:e,key:`${t.text}-link-${a.level}-${a.text}`,tocItem:a,scrollElement:n,onClick:i,scrollElementOffsetTop:l},null))])])}}}),Ls="",ws=()=>({editorId:{type:String},class:{type:String,default:""},markedHeadingId:{type:Function,default:s=>s},scrollElement:{type:[String,Object]},theme:{type:String,default:"light"},offsetTop:{type:Number,default:20},scrollElementOffsetTop:{type:Number,default:0},onClick:{type:Function}}),Nt=o.defineComponent({name:"MdCatalog",props:ws(),emits:["onClick"],setup(s,t){const e=s.editorId,n=o.reactive({list:[],show:!1,scrollElement:s.scrollElement||`#${e}-preview-wrapper`}),i=o.computed(()=>{const a=[];return n.list.forEach(({text:r,level:d,active:f},h)=>{const m={level:d,text:r,index:h+1,active:!!f};if(a.length===0)a.push(m);else{let b=a[a.length-1];if(m.level>b.level)for(let g=b.level+1;g<=6;g++){const{children:$}=b;if(!$){b.children=[m];break}if(b=$[$.length-1],m.level<=b.level){$.push(m);break}}else a.push(m)}}),a});o.onMounted(()=>{v.on(e,{name:"catalogChanged",callback:a=>{n.list=a.map((r,d)=>d===0?{...r,active:!0}:{...r})}}),v.emit(e,"pushCatalog")});const l=()=>{var r;const a=n.scrollElement instanceof HTMLElement?n.scrollElement:document.querySelector(n.scrollElement);(r=a===document.documentElement?window:a)==null||r.addEventListener("scroll",Zn(()=>{if(n.list.length===0)return!1;const{activeHead:d}=n.list.reduce((f,h,m)=>{const b=document.getElementById(s.markedHeadingId(h.text,h.level,m+1));if(b instanceof HTMLElement){const g=Qn(b,a);if(g<s.offsetTop&&g>f.minTop)return{activeHead:h,minTop:g}}return f},{activeHead:n.list[0],minTop:Number.MIN_SAFE_INTEGER});n.list=n.list.map(f=>f===d?{...f,active:!0}:{...f,active:!1})}))};return o.onMounted(()=>{l(),v.on(e,{name:Pt,callback(a){a&&o.nextTick(l)}})}),()=>o.createVNode("div",{class:`${u}-catalog${s.theme==="dark"?"-dark":""} ${s.class}`},[i.value.map(a=>o.createVNode(On,{markedHeadingId:s.markedHeadingId,tocItem:a,key:`link-${a.level}-${a.text}`,scrollElement:n.scrollElement,onClick:(r,d)=>{s.onClick?s.onClick(r,d):t.emit("onClick",r,d)},scrollElementOffsetTop:s.scrollElementOffsetTop},null))])}}),xs={modelValue:{type:String,default:""},theme:{type:String,default:"light"},class:{type:String,default:""},historyLength:{type:Number,default:10},onChange:{type:Function},onSave:{type:Function},onUploadImg:{type:Function},pageFullscreen:{type:Boolean,default:!1},preview:{type:Boolean,default:!0},htmlPreview:{type:Boolean,default:!1},previewOnly:{type:Boolean,default:!1},language:{type:String,default:"zh-CN"},toolbars:{type:Array,default:sn},toolbarsExclude:{type:Array,default:[]},noPrettier:{type:Boolean,default:!1},onHtmlChanged:{type:Function},onGetCatalog:{type:Function},editorId:{type:String,default:J},tabWidth:{type:Number,default:2},showCodeRowNumber:{type:Boolean,default:!1},previewTheme:{type:String,default:"default"},style:{type:Object,default:()=>({})},markedHeadingId:{type:Function,default:s=>s},tableShape:{type:Array,default:()=>[6,4]},noMermaid:{type:Boolean,default:!1},sanitize:{type:Function,default:s=>s},placeholder:{type:String,default:""},noKatex:{type:Boolean,default:!1},defToolbars:{type:[String,Object]},onError:{type:Function},codeTheme:{type:String,default:"atom"},footers:{type:Array,default:ln},scrollAuto:{type:Boolean,default:!0},defFooters:{type:[String,Object]},noIconfont:{type:Boolean},formatCopiedText:{type:Function,default:s=>s},noUploadImg:{type:Boolean},codeStyleReverse:{type:Boolean,default:!0},codeStyleReverseList:{type:Array,default:["default","mk-cute"]},autoFocus:{type:Boolean},disabled:{type:Boolean},readOnly:{type:Boolean},maxLength:{type:Number},autoDetectCode:{type:Boolean},onBlur:{type:Function},onFocus:{type:Function}},vs=["onChange","onSave","onUploadImg","onHtmlChanged","onGetCatalog","onError","update:modelValue","onBlur","onFocus"],Rs="",js="",Ie=o.defineComponent({name:"MdEditorV3",props:xs,emits:vs,setup(s,t){const{editorId:e,previewOnly:n,noKatex:i,noMermaid:l,noPrettier:a,noUploadImg:r}=s,d=o.reactive({scrollAuto:s.scrollAuto});ti(s,t),ni(s),ii(s);const[f,h]=si(s,t),[m,b]=li(s);return o.onBeforeUnmount(()=>{v.clear(e)}),oi(s,t,m,f,h),()=>{var k;const g=ke({props:s,ctx:t},"defToolbars"),$=ke({props:s,ctx:t},"defFooters");return o.createVNode("div",{id:e,class:[u,s.class,s.theme==="dark"&&`${u}-dark`,f.fullscreen||f.pageFullscreen?`${u}-fullscreen`:"",n&&`${u}-previewOnly`],style:s.style},[!n&&o.createVNode(wi,{noPrettier:a,toolbars:s.toolbars,toolbarsExclude:s.toolbarsExclude,setting:f,updateSetting:h,tableShape:s.tableShape,defToolbars:g,noUploadImg:r},null),o.createVNode(us,{value:s.modelValue,setting:f,markedHeadingId:s.markedHeadingId,noMermaid:l,sanitize:s.sanitize,placeholder:s.placeholder,noKatex:i,scrollAuto:d.scrollAuto,formatCopiedText:s.formatCopiedText,autofocus:s.autoFocus,disabled:s.disabled,readonly:s.readOnly,maxlength:s.maxLength,autoDetectCode:s.autoDetectCode,onChange:y=>{v.emit(e,"saveHistoryPos"),s.onChange?s.onChange(y):(t.emit("update:modelValue",y),t.emit("onChange",y))},onHtmlChanged:y=>{s.onHtmlChanged?s.onHtmlChanged(y):t.emit("onHtmlChanged",y)},onGetCatalog:y=>{s.onGetCatalog?s.onGetCatalog(y):t.emit("onGetCatalog",y)},onBlur:y=>{s.onBlur?s.onBlur(y):t.emit("onBlur",y)},onFocus:y=>{s.onFocus?s.onFocus(y):t.emit("onFocus",y)}},null),!n&&((k=s.footers)==null?void 0:k.length)>0&&o.createVNode(ks,{modelValue:s.modelValue,footers:s.footers,defFooters:$,scrollAuto:d.scrollAuto,onScrollAutoChange:y=>d.scrollAuto=y},null),b.value&&!n&&o.createVNode(Nt,{theme:s.theme,style:{display:m.value?"block":"none"},class:`${u}-catalog-editor`,editorId:e,markedHeadingId:s.markedHeadingId},null)])}}}),$s=()=>({title:{type:String,default:""},trigger:{type:[String,Object]},onClick:{type:Function}}),Kt=o.defineComponent({name:"NormalToolbar",props:$s(),emits:["onClick"],setup(s,t){return()=>{const e=ke({props:s,ctx:t},"trigger");return o.createVNode("div",{class:`${u}-toolbar-item`,title:s.title,onClick:n=>{s.onClick instanceof Function?s.onClick(n):t.emit("onClick",n)}},[e])}}}),Ss=()=>({title:{type:String,default:""},visible:{type:Boolean},trigger:{type:[String,Object]},onChange:{type:Function},overlay:{type:[String,Object]}}),Gt=o.defineComponent({name:"DropdownToolbar",props:Ss(),emits:["onChange"],setup(s,t){const e=o.inject("editorId");return()=>{const n=ke({props:s,ctx:t},"trigger"),i=ke({props:s,ctx:t},"overlay");return o.createVNode(Xe,{relative:`#${e}-toolbar-wrapper`,visible:s.visible,onChange:l=>{s.onChange instanceof Function?s.onChange(l):t.emit("onChange",l)},overlay:i},{default:()=>[o.createVNode("div",{class:`${u}-toolbar-item`,title:s.title||""},[n])]})}}});function Cs(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!o.isVNode(s)}const Ts=()=>({title:{type:String,default:""},modalTitle:{type:String,default:""},visible:{type:Boolean},width:{type:String,default:"auto"},height:{type:String,default:"auto"},trigger:{type:[String,Object]},onClick:{type:Function},onClose:{type:Function},showAdjust:{type:Boolean,default:!1},isFullscreen:{type:Boolean,default:!1},onAdjust:{type:Function}}),Zt=o.defineComponent({name:"ModalToolbar",props:Ts(),emits:["onClick","onClose","onAdjust"],setup(s,t){return()=>{const e=ke({props:s,ctx:t},"trigger"),n=ke({props:s,ctx:t},"default");return o.createVNode(o.Fragment,null,[o.createVNode("div",{class:`${u}-toolbar-item`,title:s.title,onClick:()=>{s.onClick instanceof Function?s.onClick():t.emit("onClick")}},[e]),o.createVNode(Mt,{width:s.width,height:s.height,title:s.modalTitle,visible:s.visible,onClose:()=>{s.onClose instanceof Function?s.onClose():t.emit("onClose")},showAdjust:s.showAdjust,isFullscreen:s.isFullscreen,onAdjust:i=>{s.onAdjust instanceof Function?s.onAdjust(i):t.emit("onAdjust",i)}},Cs(n)?n:{default:()=>[n]})])}}});return Ie.install=s=>(s.component(Ie.name,Ie),s.component(Kt.name,Kt),s.component(Gt.name,Gt),s.component(Nt.name,Nt),s.component(Zt.name,Zt),s),Ie.NormalToolbar=Kt,Ie.DropdownToolbar=Gt,Ie.MdCatalog=Nt,Ie.ModalToolbar=Zt,Ie.config=qn,Ie});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "md-editor-v3",
3
- "version": "2.10.0",
3
+ "version": "2.11.0",
4
4
  "keywords": [
5
5
  "vue",
6
6
  "vue3",
@@ -31,12 +31,12 @@
31
31
  ],
32
32
  "type": "module",
33
33
  "types": "./lib/MdEditor/index.d.ts",
34
- "main": "./lib/md-editor-v3.umd.cjs",
35
- "module": "./lib/md-editor-v3.js",
34
+ "main": "./lib/md-editor-v3.cjs",
35
+ "module": "./lib/md-editor-v3.mjs",
36
36
  "exports": {
37
37
  ".": {
38
- "import": "./lib/md-editor-v3.js",
39
- "require": "./lib/md-editor-v3.umd.cjs"
38
+ "import": "./lib/md-editor-v3.mjs",
39
+ "require": "./lib/md-editor-v3.cjs"
40
40
  },
41
41
  "./lib/style.css": "./lib/style.css"
42
42
  },
@@ -54,6 +54,7 @@
54
54
  "@typescript-eslint/eslint-plugin": "^5.55.0",
55
55
  "@typescript-eslint/parser": "^5.55.0",
56
56
  "@vavt/markdown-theme": "^2.2.2",
57
+ "@vavt/vite-plugin-import-markdown": "^1.0.0",
57
58
  "@vitejs/plugin-vue": "^4.0.0",
58
59
  "@vitejs/plugin-vue-jsx": "^3.0.0",
59
60
  "@vue/eslint-config-prettier": "^7.1.0",