md-editor-v3 2.11.1 → 2.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/md-editor-v3.cjs +33 -33
- package/lib/md-editor-v3.mjs +921 -928
- package/lib/md-editor-v3.umd.js +33 -33
- package/lib/style.css +1 -1
- package/package.json +1 -1
package/lib/md-editor-v3.umd.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
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
|
|
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=s.onload;s.onload=null;const i=function(l){typeof n=="function"&&n.bind(this)(l),s.removeEventListener("load",i)};e?t!==""&&typeof s.onload=="function"&&(Reflect.get(window,t)?s.dispatchEvent(new Event("load")):e.addEventListener("load",i)):(s.addEventListener("load",i),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={"&":"&","<":"<",">":">",'"':""","'":"'"},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(`
|
|
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 Xe,ke,ue,Se,ye,Ye,ne,we,ie,Z,j,ce,he,ae,le,xe,re,_e,Ae,ve,Ce,Fe,de,at,Qt,Pe,Ie,ct,fe,Tt,Pn,Me,Je,dt,Te,Oe,Ee,De,ut,Yt,et,Rt,tt,jt,X,Q,ht,Jt,Be,gt;"use strict";var Es=Object.defineProperty;var Ns=(o,u,Y)=>u in o?Es(o,u,{enumerable:!0,configurable:!0,writable:!0,value:Y}):o[u]=Y;var se=(o,u,Y)=>(Ns(o,typeof u!="symbol"?u+"":u,Y),Y),Xt=(o,u,Y)=>{if(!u.has(o))throw TypeError("Cannot "+Y)};var c=(o,u,Y)=>(Xt(o,u,"read from private field"),Y?Y.call(o):u.get(o)),D=(o,u,Y)=>{if(u.has(o))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(o):u.set(o,Y)},F=(o,u,Y,We)=>(Xt(o,u,"write to private field"),We?We.call(o,Y):u.set(o,Y),Y),Ft=(o,u,Y,We)=>({set _(q){F(o,u,q,Y)},get _(){return c(o,u,We)}}),I=(o,u,Y)=>(Xt(o,u,"access private method"),Y);const u="md-editor",Y="md-editor-v3",We="https://at.alicdn.com/t/c/font_2605852_u82y61ve02.js",q="https://cdnjs.cloudflare.com/ajax/libs",Mn=`${q}/highlight.js/11.7.0/highlight.min.js`,en={main:`${q}/prettier/2.8.0/standalone.js`,markdown:`${q}/prettier/2.8.0/parser-markdown.js`},tn={css:`${q}/cropperjs/1.5.13/cropper.min.css`,js:`${q}/cropperjs/1.5.13/cropper.min.js`},Bn=`${q}/screenfull.js/5.2.0/screenfull.min.js`,nn=["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"],sn=["markdownTotal","=","scrollSwitch"],ln={"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=`${q}/mermaid/9.4.0/mermaid.min.js`,on={js:`${q}/KaTeX/0.16.3/katex.min.js`,css:`${q}/KaTeX/0.16.3/katex.min.css`},rn={a11y:{light:`${q}/highlight.js/11.7.0/styles/a11y-light.min.css`,dark:`${q}/highlight.js/11.7.0/styles/a11y-dark.min.css`},atom:{light:`${q}/highlight.js/11.7.0/styles/atom-one-light.min.css`,dark:`${q}/highlight.js/11.7.0/styles/atom-one-dark.min.css`},github:{light:`${q}/highlight.js/11.7.0/styles/github.min.css`,dark:`${q}/highlight.js/11.7.0/styles/github-dark.min.css`},gradient:{light:`${q}/highlight.js/11.7.0/styles/gradient-light.min.css`,dark:`${q}/highlight.js/11.7.0/styles/gradient-dark.min.css`},kimbie:{light:`${q}/highlight.js/11.7.0/styles/kimbie-light.min.css`,dark:`${q}/highlight.js/11.7.0/styles/kimbie-dark.min.css`},paraiso:{light:`${q}/highlight.js/11.7.0/styles/paraiso-light.min.css`,dark:`${q}/highlight.js/11.7.0/styles/paraiso-dark.min.css`},qtcreator:{light:`${q}/highlight.js/11.7.0/styles/qtcreator-light.min.css`,dark:`${q}/highlight.js/11.7.0/styles/qtcreator-dark.min.css`},stackoverflow:{light:`${q}/highlight.js/11.7.0/styles/stackoverflow-light.min.css`,dark:`${q}/highlight.js/11.7.0/styles/stackoverflow-dark.min.css`}},J={markedRenderer:s=>s,markedExtensions:[],markedOptions:{},editorExtensions:{},editorConfig:{}},qn=s=>{if(s)for(const t in s){const e=s[t];e&&(J[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,Ne=(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())}),Ot=(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,Ne(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=pt(()=>{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)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("")}`},pt=(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)}},ge=(s,t="")=>{const e=document.getElementById(s.id),n=s.onload;s.onload=null;const i=function(l){typeof n=="function"&&n.bind(this)(l),s.removeEventListener("load",i)};e?t!==""&&(e.addEventListener("load",i),Reflect.get(window,t)&&e.dispatchEvent(new Event("load"))):(s.addEventListener("load",i),document.head.appendChild(s))},ei=pt((s,t,e)=>{const n=document.getElementById(s);n&&n.setAttribute(t,e)},10),bt="onSave",Dt="changeCatalogVisible",hn="changeFullscreen",fn="pageFullscreenChanged",mn="fullscreenChanged",Ht="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,bt,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:bt,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=J==null?void 0:J.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={...ln,...(r=J==null?void 0:J.editorConfig)==null?void 0:r.languageUserDefined};return a[s.language]?a[s.language]:ln["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}=J,a=t||!!((h=(f=J.editorExtensions)==null?void 0:f.prettier)!=null&&h.prettierInstance),r=t||!!((b=(m=J.editorExtensions)==null?void 0:m.prettier)!=null&&b.parserMarkdownInstance),d=i||!!(($=(g=J.editorExtensions)==null?void 0:g.cropper)!=null&&$.instance);o.onMounted(()=>{var T,N,H,V;const k=document.createElement("script");k.src=(l==null?void 0:l.iconfont)||We,k.id=`${u}-icon`;const w=document.createElement("script"),p=document.createElement("script");w.src=((T=l==null?void 0:l.prettier)==null?void 0:T.standaloneJs)||en.main,w.id=`${u}-prettier`,p.src=((N=l==null?void 0:l.prettier)==null?void 0:N.parserMarkdownJs)||en.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)||tn.css,x.id=`${u}-cropperCss`;const S=document.createElement("script");S.src=((V=l==null?void 0:l.cropper)==null?void 0:V.js)||tn.js,S.id=`${u}-cropper`,n||ge(k),e||(d||(ge(x),ge(S)),a||ge(w),r||ge(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:Dt,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,Ht,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:Ht,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,Dt,r)},triggerSave(){v.emit(l,bt)},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)}}),pe=({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"}}),Ke=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,w=g.height,p=g.width,x=((S=document.querySelector(s.relative))==null?void 0:S.scrollLeft)||0;n.overlayStyle={...n.overlayStyle,top:$+w+"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=pe({ctx:t}),b=pe({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}}),Pt=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=pe({ctx:t}),h=pe({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(Pt,{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=J==null?void 0:J.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(Pt,{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=J.editorExtensions)==null?void 0:d.screenfull)==null?void 0:f.instance;const n=(m=(h=J.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`,ge(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),w=$===-1?[]:g.slice($,Number.MAX_SAFE_INTEGER);return[k,w]}),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,w,p,x,S,T,N,H,V,y,K,M,B,A,R,P,z,C,O,G,ee,te,me,ft,Ue,Re,je,Et,Nt,qe,zt,Vt,nt,it,_t,At,st,It,Lt,mt,Dn,Hn;if(nn.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:(w=e.value.toolbarTips)==null?void 0:w.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(Ke,{relative:`#${i}`,visible:l.title,onChange:U=>{l.title=U},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")}},[(T=e.value.titleItem)==null?void 0:T.h3]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("h4")}},[(N=e.value.titleItem)==null?void 0:N.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")}},[(V=e.value.titleItem)==null?void 0:V.h6])])},{default:()=>{var U;return[o.createVNode("div",{class:`${u}-toolbar-item`,title:(U=e.value.toolbarTips)==null?void 0:U.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:(y=e.value.toolbarTips)==null?void 0:y.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:(K=e.value.toolbarTips)==null?void 0:K.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:(M=e.value.toolbarTips)==null?void 0:M.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:(A=e.value.toolbarTips)==null?void 0:A.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:(R=e.value.toolbarTips)==null?void 0:R.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:(z=e.value.toolbarTips)==null?void 0:z.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:(C=e.value.toolbarTips)==null?void 0:C.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:(O=e.value.toolbarTips)==null?void 0:O.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(Ke,{relative:`#${i}`,visible:l.image,onChange:U=>{l.image=U},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}},[(G=e.value.imgTitleItem)==null?void 0:G.link]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{h.value.click()}},[(ee=e.value.imgTitleItem)==null?void 0:ee.upload]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{r.clipVisible=!0}},[(te=e.value.imgTitleItem)==null?void 0:te.clip2upload])])},{default:()=>{var U;return[o.createVNode("div",{class:`${u}-toolbar-item`,title:(U=e.value.toolbarTips)==null?void 0:U.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(Ke,{relative:`#${i}`,visible:l.table,onChange:U=>{l.table=U},key:"bar-table",overlay:o.createVNode(ki,{tableShape:s.tableShape,onSelected:U=>{a("table",{selectedShape:U})}},null)},{default:()=>{var U;return[o.createVNode("div",{class:`${u}-toolbar-item`,title:(U=e.value.toolbarTips)==null?void 0:U.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:(me=e.value.toolbarTips)==null?void 0:me.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:(ft=e.value.toolbarTips)==null?void 0:ft.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:(Ue=e.value.toolbarTips)==null?void 0:Ue.save,onClick:()=>{v.emit(t,bt)}},[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:(Re=e.value.toolbarTips)==null?void 0:Re.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:(Et=e.value.toolbarTips)==null?void 0:Et.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:(Nt=e.value.toolbarTips)==null?void 0:Nt.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:(qe=e.value.toolbarTips)==null?void 0:qe.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:(zt=e.value.toolbarTips)==null?void 0:zt.catalog,onClick:()=>{v.emit(t,Dt)},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:(Vt=e.value.toolbarTips)==null?void 0:Vt.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(Ke,{relative:`#${i}`,visible:l.mermaid,onChange:U=>{l.mermaid=U},overlay:o.createVNode("ul",{class:`${u}-menu`,onClick:()=>{l.mermaid=!1}},[o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("flow")}},[(nt=e.value.mermaid)==null?void 0:nt.flow]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("sequence")}},[(it=e.value.mermaid)==null?void 0:it.sequence]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("gantt")}},[(_t=e.value.mermaid)==null?void 0:_t.gantt]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("class")}},[(At=e.value.mermaid)==null?void 0:At.class]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("state")}},[(st=e.value.mermaid)==null?void 0:st.state]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("pie")}},[(It=e.value.mermaid)==null?void 0:It.pie]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("relationship")}},[(Lt=e.value.mermaid)==null?void 0:Lt.relationship]),o.createVNode("li",{class:`${u}-menu-item`,onClick:()=>{a("journey")}},[(mt=e.value.mermaid)==null?void 0:mt.journey])]),key:"bar-mermaid"},{default:()=>{var U;return[o.createVNode("div",{class:`${u}-toolbar-item`,title:(U=e.value.toolbarTips)==null?void 0:U.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(Ke,{relative:`#${i}`,visible:l.katex,onChange:U=>{l.katex=U},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 U;return[o.createVNode("div",{class:`${u}-toolbar-item`,title:(U=e.value.toolbarTips)==null?void 0:U.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 Ge=kn();function xi(s){Ge=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={"&":"&","<":"<",">":">",'"':""","'":"'"},xn=s=>Si[s];function oe(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 W(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 kt={},zi=/^[^:]+:\/*[^/]*$/,Vi=/^([^:]+:)[\s\S]*$/,_i=/^([^:]+:\/*[^/]*)[\s\S]*$/;function Ai(s,t){kt[" "+s]||(zi.test(s)?kt[" "+s]=s+"/":kt[" "+s]=wt(s,"/",!0)),s=kt[" "+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 yt={exec:function(){}};function be(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 wt(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?oe(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:oe(a)}}function Li(s,t){const e=s.match(/^(\s+)(?:```)/);if(e===null)return t;const n=e[1];return t.split(`
|
|
3
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
|
|
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
|
|
6
|
-
`,1)[0].replace(/^\t+/,
|
|
4
|
+
`)}class Mt{constructor(t){this.options=t||Ge}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:wt(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=wt(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 w=k.length>1,p={type:"list",raw:"",ordered:w,start:w?+k.slice(0,-1):"",loose:!1,items:[]};k=w?`\\d{1,9}\\${k.slice(-1)}`:`\\${k}`,this.options.pedantic&&(k=w?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+/,T=>" ".repeat(3*T.length)),m=t.split(`
|
|
7
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
|
|
9
|
-
`,1)[0],m=b,this.options.pedantic&&(m=m.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!(H.test(m)||
|
|
10
|
-
`+m.slice(a);else{if(d||h.search(/[^ ]/)>=4||H.test(h)||
|
|
8
|
+
`,t=t.substring(m.length+1),$=!0),!$){const T=new RegExp(`^ {0,${Math.min(3,a-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),N=new RegExp(`^ {0,${Math.min(3,a-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),H=new RegExp(`^ {0,${Math.min(3,a-1)}}(?:\`\`\`|~~~)`),V=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)||V.test(m)||T.test(m)||N.test(t)));){if(m.search(/[^ ]/)>=a||!m.trim())g+=`
|
|
10
|
+
`+m.slice(a);else{if(d||h.search(/[^ ]/)>=4||H.test(h)||V.test(h)||N.test(h))break;g+=`
|
|
11
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
|
|
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 T=p.items[r].tokens.filter(H=>H.type==="space"),N=T.length>0&&T.some(H=>/\n.*\n/.test(H.raw));p.loose=N}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]):oe(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
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:
|
|
15
|
-
]`).replace("lheading",
|
|
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:oe(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]):oe(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=wt(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=oe(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=oe(this.options.mangle?e(n[1]):n[1]),l="mailto:"+i):(i=oe(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=oe(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=oe(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]):oe(n[0]):n[0]:i=oe(this.options.smartypants?e(n[0]):n[0]),{type:"text",raw:n[0],text:i}}}}const L={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:yt,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};L._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/,L._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,L.def=W(L.def).replace("label",L._label).replace("title",L._title).getRegex(),L.bullet=/(?:[*+-]|\d{1,9}[.)])/,L.listItemStart=W(/^( *)(bull) */).replace("bull",L.bullet).getRegex(),L.list=W(L.list).replace(/bull/g,L.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+L.def.source+")").getRegex(),L._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",L._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,L.html=W(L.html,"i").replace("comment",L._comment).replace("tag",L._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),L.paragraph=W(L._paragraph).replace("hr",L.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",L._tag).getRegex(),L.blockquote=W(L.blockquote).replace("paragraph",L.paragraph).getRegex(),L.normal=be({},L),L.gfm=be({},L.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),L.gfm.table=W(L.gfm.table).replace("hr",L.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",L._tag).getRegex(),L.gfm.paragraph=W(L._paragraph).replace("hr",L.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",L.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",L._tag).getRegex(),L.pedantic=be({},L.normal,{html:W(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",L._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:yt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:W(L.normal._paragraph).replace("hr",L.hr).replace("heading",` *#{1,6} *[^
|
|
15
|
+
]`).replace("lheading",L.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});const E={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:yt,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:yt,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};E._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",E.punctuation=W(E.punctuation).replace(/punctuation/g,E._punctuation).getRegex(),E.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,E.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g,E._comment=W(L._comment).replace("(?:-->|$)","-->").getRegex(),E.emStrong.lDelim=W(E.emStrong.lDelim).replace(/punct/g,E._punctuation).getRegex(),E.emStrong.rDelimAst=W(E.emStrong.rDelimAst,"g").replace(/punct/g,E._punctuation).getRegex(),E.emStrong.rDelimUnd=W(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=W(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=W(E.tag).replace("comment",E._comment).replace("attribute",E._attribute).getRegex(),E._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,E._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,E._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,E.link=W(E.link).replace("label",E._label).replace("href",E._href).replace("title",E._title).getRegex(),E.reflink=W(E.reflink).replace("label",E._label).replace("ref",L._label).getRegex(),E.nolink=W(E.nolink).replace("ref",L._label).getRegex(),E.reflinkSearch=W(E.reflinkSearch,"g").replace("reflink",E.reflink).replace("nolink",E.nolink).getRegex(),E.normal=be({},E),E.pedantic=be({},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:W(/^!?\[(label)\]\((.*?)\)/).replace("label",E._label).getRegex(),reflink:W(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",E._label).getRegex()}),E.gfm=be({},E.normal,{escape:W(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=W(E.gfm.url,"i").replace("email",E.gfm._extended_email).getRegex(),E.breaks=be({},E.gfm,{br:W(E.br).replace("{2,}","*").getRegex(),text:W(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 ze{constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Ge,this.options.tokenizer=this.options.tokenizer||new Mt,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:L.normal,inline:E.normal};this.options.pedantic?(e.block=L.pedantic,e.inline=E.pedantic):this.options.gfm&&(e.block=L.gfm,this.options.breaks?e.inline=E.breaks:e.inline=E.gfm),this.tokenizer.rules=e}static get rules(){return{block:L,inline:E}}static lex(t,e){return new ze(e).lex(t)}static lexInline(t,e){return new ze(e).inlineTokens(t)}lex(t){t=t.replace(/\r\n|\r/g,`
|
|
16
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
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
18
|
`+n.raw,i.text+=`
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
`+n.raw,i.text+=`
|
|
23
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
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
|
|
26
|
-
`,i?'<pre><code class="'+this.options.langPrefix+
|
|
27
|
-
`:"<pre><code>"+(n?t:
|
|
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 Bt{constructor(t){this.options=t||Ge}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+oe(i)+'">'+(n?t:oe(t,!0))+`</code></pre>
|
|
27
|
+
`:"<pre><code>"+(n?t:oe(t,!0))+`</code></pre>
|
|
28
28
|
`}blockquote(t){return`<blockquote>
|
|
29
29
|
${t}</blockquote>
|
|
30
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}>
|
|
@@ -42,25 +42,25 @@ ${t}</blockquote>
|
|
|
42
42
|
`}tablerow(t){return`<tr>
|
|
43
43
|
${t}</tr>
|
|
44
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
|
|
46
|
-
`+(g.tokens?this.parseInline(g.tokens):g.text);n+=e?this.renderer.paragraph(b):b;continue}default:{const
|
|
47
|
-
Please report this to https://github.com/markedjs/marked.`,t.silent)return"<p>An error occurred:</p><pre>"+
|
|
48
|
-
Please report this to https://github.com/markedjs/marked.`,t.silent)return"<p>An error occurred:</p><pre>"+
|
|
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 $e{constructor(t){this.options=t||Ge,this.options.renderer=this.options.renderer||new Bt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new zn,this.slugger=new Vn}static parse(t,e){return new $e(e).parse(t)}static parseInline(t,e){return new $e(e).parseInline(t)}parse(t,e=!0){let n="",i,l,a,r,d,f,h,m,b,g,$,k,w,p,x,S,T,N,H;const V=t.length;for(i=0;i<V;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,w=g.loose,r=g.items.length,b="",l=0;l<r;l++)x=g.items[l],S=x.checked,T=x.task,p="",x.task&&(N=this.renderer.checkbox(S),w?x.tokens.length>0&&x.tokens[0].type==="paragraph"?(x.tokens[0].text=N+" "+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=N+" "+x.tokens[0].tokens[0].text)):x.tokens.unshift({type:"text",text:N}):p+=N),p+=this.parse(x.tokens,w),b+=this.renderer.listitem(p,T,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<V&&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 y='Token with "'+g.type+'" type was not found.';if(this.options.silent){console.error(y);return}else throw new Error(y)}}}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 _(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=be({},_.defaults,t||{}),Cn(t),e){const i=t.highlight;let l;try{l=ze.lex(s,t)}catch(d){return e(d)}const a=function(d){let f;if(!d)try{t.walkTokens&&_.walkTokens(l,t.walkTokens),f=$e.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;_.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>"+oe(i.message+"",!0)+"</pre>";throw i}try{const i=ze.lex(s,t);if(t.walkTokens){if(t.async)return Promise.all(_.walkTokens(i,t.walkTokens)).then(()=>$e.parse(i,t)).catch(n);_.walkTokens(i,t.walkTokens)}return $e.parse(i,t)}catch(i){n(i)}}_.options=_.setOptions=function(s){return be(_.defaults,s),xi(_.defaults),_},_.getDefaults=kn,_.defaults=Ge,_.use=function(...s){const t=_.defaults.extensions||{renderers:{},childTokens:{}};s.forEach(e=>{const n=be({},e);if(n.async=_.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=_.defaults.renderer||new Bt;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=_.defaults.tokenizer||new Mt;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=_.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}}_.setOptions(n)})},_.walkTokens=function(s,t){let e=[];for(const n of s)switch(e=e.concat(t.call(_,n)),n.type){case"table":{for(const i of n.header)e=e.concat(_.walkTokens(i.tokens,t));for(const i of n.rows)for(const l of i)e=e.concat(_.walkTokens(l.tokens,t));break}case"list":{e=e.concat(_.walkTokens(n.items,t));break}default:_.defaults.extensions&&_.defaults.extensions.childTokens&&_.defaults.extensions.childTokens[n.type]?_.defaults.extensions.childTokens[n.type].forEach(function(i){e=e.concat(_.walkTokens(n[i],t))}):n.tokens&&(e=e.concat(_.walkTokens(n.tokens,t)))}return e},_.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=be({},_.defaults,t||{}),Cn(t);try{const e=ze.lexInline(s,t);return t.walkTokens&&_.walkTokens(e,t.walkTokens),$e.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>"+oe(e.message+"",!0)+"</pre>";throw e}},_.Parser=$e,_.parser=$e.parse,_.Renderer=Bt,_.TextRenderer=zn,_.Lexer=ze,_.lexer=ze.lex,_.Tokenizer=Mt,_.Slugger=Vn,_.parse=_,_.options,_.setOptions,_.use,_.walkTokens,_.parseInline,$e.parse,ze.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 lt=Hi;/*! medium-zoom 1.0.8 | MIT License | https://github.com/francoischalifour/medium-zoom */var He=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},xt=function(t){return t.tagName==="IMG"},Pi=function(t){return NodeList.prototype.isPrototypeOf(t)},vt=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(xt):Pi(t)?[].slice.call(t).filter(xt):vt(t)?[t].filter(xt):typeof t=="string"?[].slice.call(document.querySelectorAll(t)).filter(xt):[]}catch{throw new TypeError(`The provided selector is invalid.
|
|
49
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(`
|
|
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},Ze=function(t,e){var n=He({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(A){function R(){}A(R,R)},i=function(A){var R=A.target;if(R===K){$();return}S.indexOf(R)!==-1&&k({target:R})},l=function(){if(!(N||!y.original)){var A=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;Math.abs(H-A)>V.scrollOffset&&setTimeout($,150)}},a=function(A){var R=A.key||A.keyCode;(R==="Escape"||R==="Esc"||R===27)&&$()},r=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},R=A;if(A.background&&(K.style.background=A.background),A.container&&A.container instanceof Object&&(R.container=He({},V.container,A.container)),A.template){var P=vt(A.template)?A.template:document.querySelector(A.template);R.template=P}return V=He({},V,R),S.forEach(function(z){z.dispatchEvent(Ze("medium-zoom:update",{detail:{zoom:M}}))}),M},d=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return s(He({},V,A))},f=function(){for(var A=arguments.length,R=Array(A),P=0;P<A;P++)R[P]=arguments[P];var z=R.reduce(function(C,O){return[].concat(C,In(O))},[]);return z.filter(function(C){return S.indexOf(C)===-1}).forEach(function(C){S.push(C),C.classList.add("medium-zoom-image")}),T.forEach(function(C){var O=C.type,G=C.listener,ee=C.options;z.forEach(function(te){te.addEventListener(O,G,ee)})}),M},h=function(){for(var A=arguments.length,R=Array(A),P=0;P<A;P++)R[P]=arguments[P];y.zoomed&&$();var z=R.length>0?R.reduce(function(C,O){return[].concat(C,In(O))},[]):S;return z.forEach(function(C){C.classList.remove("medium-zoom-image"),C.dispatchEvent(Ze("medium-zoom:detach",{detail:{zoom:M}}))}),S=S.filter(function(C){return z.indexOf(C)===-1}),M},m=function(A,R){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return S.forEach(function(z){z.addEventListener("medium-zoom:"+A,R,P)}),T.push({type:"medium-zoom:"+A,listener:R,options:P}),M},b=function(A,R){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return S.forEach(function(z){z.removeEventListener("medium-zoom:"+A,R,P)}),T=T.filter(function(z){return!(z.type==="medium-zoom:"+A&&z.listener.toString()===R.toString())}),M},g=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},R=A.target,P=function(){var C={width:document.documentElement.clientWidth,height:document.documentElement.clientHeight,left:0,top:0,right:0,bottom:0},O=void 0,G=void 0;if(V.container)if(V.container instanceof Object)C=He({},C,V.container),O=C.width-C.left-C.right-V.margin*2,G=C.height-C.top-C.bottom-V.margin*2;else{var ee=vt(V.container)?V.container:document.querySelector(V.container),te=ee.getBoundingClientRect(),me=te.width,ft=te.height,Ue=te.left,Re=te.top;C=He({},C,{width:me,height:ft,left:Ue,top:Re})}O=O||C.width-V.margin*2,G=G||C.height-V.margin*2;var je=y.zoomedHd||y.original,Et=An(je)?O:je.naturalWidth||O,Nt=An(je)?G:je.naturalHeight||G,qe=je.getBoundingClientRect(),zt=qe.top,Vt=qe.left,nt=qe.width,it=qe.height,_t=Math.min(Math.max(nt,Et),O)/nt,At=Math.min(Math.max(it,Nt),G)/it,st=Math.min(_t,At),It=(-Vt+(O-nt)/2+V.margin+C.left)/st,Lt=(-zt+(G-it)/2+V.margin+C.top)/st,mt="scale("+st+") translate3d("+It+"px, "+Lt+"px, 0)";y.zoomed.style.transform=mt,y.zoomedHd&&(y.zoomedHd.style.transform=mt)};return new n(function(z){if(R&&S.indexOf(R)===-1){z(M);return}var C=function me(){N=!1,y.zoomed.removeEventListener("transitionend",me),y.original.dispatchEvent(Ze("medium-zoom:opened",{detail:{zoom:M}})),z(M)};if(y.zoomed){z(M);return}if(R)y.original=R;else if(S.length>0){var O=S;y.original=O[0]}else{z(M);return}if(y.original.dispatchEvent(Ze("medium-zoom:open",{detail:{zoom:M}})),H=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,N=!0,y.zoomed=Bi(y.original),document.body.appendChild(K),V.template){var G=vt(V.template)?V.template:document.querySelector(V.template);y.template=document.createElement("div"),y.template.appendChild(G.content.cloneNode(!0)),document.body.appendChild(y.template)}if(y.original.parentElement&&y.original.parentElement.tagName==="PICTURE"&&y.original.currentSrc&&(y.zoomed.src=y.original.currentSrc),document.body.appendChild(y.zoomed),window.requestAnimationFrame(function(){document.body.classList.add("medium-zoom--opened")}),y.original.classList.add("medium-zoom-image--hidden"),y.zoomed.classList.add("medium-zoom-image--opened"),y.zoomed.addEventListener("click",$),y.zoomed.addEventListener("transitionend",C),y.original.getAttribute("data-zoom-src")){y.zoomedHd=y.zoomed.cloneNode(),y.zoomedHd.removeAttribute("srcset"),y.zoomedHd.removeAttribute("sizes"),y.zoomedHd.removeAttribute("loading"),y.zoomedHd.src=y.zoomed.getAttribute("data-zoom-src"),y.zoomedHd.onerror=function(){clearInterval(ee),console.warn("Unable to reach the zoom image target "+y.zoomedHd.src),y.zoomedHd=null,P()};var ee=setInterval(function(){y.zoomedHd.complete&&(clearInterval(ee),y.zoomedHd.classList.add("medium-zoom-image--opened"),y.zoomedHd.addEventListener("click",$),document.body.appendChild(y.zoomedHd),P())},10)}else if(y.original.hasAttribute("srcset")){y.zoomedHd=y.zoomed.cloneNode(),y.zoomedHd.removeAttribute("sizes"),y.zoomedHd.removeAttribute("loading");var te=y.zoomedHd.addEventListener("load",function(){y.zoomedHd.removeEventListener("load",te),y.zoomedHd.classList.add("medium-zoom-image--opened"),y.zoomedHd.addEventListener("click",$),document.body.appendChild(y.zoomedHd),P()})}else P()})},$=function(){return new n(function(A){if(N||!y.original){A(M);return}var R=function P(){y.original.classList.remove("medium-zoom-image--hidden"),document.body.removeChild(y.zoomed),y.zoomedHd&&document.body.removeChild(y.zoomedHd),document.body.removeChild(K),y.zoomed.classList.remove("medium-zoom-image--opened"),y.template&&document.body.removeChild(y.template),N=!1,y.zoomed.removeEventListener("transitionend",P),y.original.dispatchEvent(Ze("medium-zoom:closed",{detail:{zoom:M}})),y.original=null,y.zoomed=null,y.zoomedHd=null,y.template=null,A(M)};N=!0,document.body.classList.remove("medium-zoom--opened"),y.zoomed.style.transform="",y.zoomedHd&&(y.zoomedHd.style.transform=""),y.template&&(y.template.style.transition="opacity 150ms",y.template.style.opacity=0),y.original.dispatchEvent(Ze("medium-zoom:close",{detail:{zoom:M}})),y.zoomed.addEventListener("transitionend",R)})},k=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},R=A.target;return y.original?$():g({target:R})},w=function(){return V},p=function(){return S},x=function(){return y.original},S=[],T=[],N=!1,H=0,V=e,y={original:null,zoomed:null,zoomedHd:null,template:null};Object.prototype.toString.call(t)==="[object Object]"?V=t:(t||typeof t=="string")&&f(t),V=He({margin:0,background:"#fff",scrollOffset:40,container:null,template:null},V);var K=Mi(V.background);document.addEventListener("click",i),document.addEventListener("keyup",a),document.addEventListener("scroll",l),window.addEventListener("resize",$);var M={open:g,close:$,toggle:k,update:r,clone:d,attach:f,detach:h,on:m,off:b,getOptions:w,getImages:p,getZoomedImage:x};return M};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,ot=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),Le=s=>s&&s===Math.floor(s)&&s>0&&isFinite(s),Fn=s=>Le(s)?s<=Math.pow(2,8)?Uint8Array:s<=Math.pow(2,16)?Uint16Array:s<=Math.pow(2,32)?Uint32Array:s<=Number.MAX_SAFE_INTEGER?$t:null:null;class $t extends Array{constructor(t){super(t),this.fill(0)}}const Qe=class{constructor(t,e){se(this,"heap");se(this,"length");if(!c(Qe,Xe))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[];F(Qe,Xe,!0);const n=new Qe(t,e);return F(Qe,Xe,!1),n}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}};let St=Qe;Xe=new WeakMap,D(St,Xe,!1);const Zt=class{constructor(t){D(this,at);D(this,Tt);D(this,Te);D(this,Ee);D(this,ut);D(this,et);D(this,tt);D(this,X);D(this,ht);D(this,Be);D(this,ke,void 0);D(this,ue,void 0);D(this,Se,void 0);D(this,ye,void 0);D(this,Ye,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,we,void 0);D(this,ie,void 0);D(this,Z,void 0);D(this,j,void 0);D(this,ce,void 0);D(this,he,void 0);D(this,ae,void 0);D(this,le,void 0);D(this,xe,void 0);D(this,re,void 0);D(this,_e,void 0);D(this,Ae,void 0);D(this,ve,void 0);D(this,Ce,void 0);D(this,Fe,void 0);D(this,de,void 0);D(this,Pe,()=>{});D(this,Ie,()=>{});D(this,ct,()=>{});D(this,fe,()=>!1);D(this,Me,t=>{});D(this,Je,(t,e,n)=>{});D(this,dt,(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:w,noDeleteOnFetchRejection:p,noDeleteOnStaleGet:x,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:T,ignoreFetchAbort:N}=t;if(e!==0&&!Le(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(F(this,ke,e),F(this,ue,g),this.maxEntrySize=$||c(this,ue),this.sizeCalculation=k,this.sizeCalculation){if(!c(this,ue)&&!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(w!==void 0&&typeof w!="function")throw new TypeError("fetchMethod must be a function if specified");if(F(this,Ye,w),F(this,Fe,!!w),F(this,ie,new Map),F(this,Z,new Array(e).fill(void 0)),F(this,j,new Array(e).fill(void 0)),F(this,ce,new H(e)),F(this,he,new H(e)),F(this,ae,0),F(this,le,0),F(this,xe,St.create(e)),F(this,ne,0),F(this,we,0),typeof f=="function"&&F(this,Se,f),typeof h=="function"?(F(this,ye,h),F(this,re,[])):(F(this,ye,void 0),F(this,re,void 0)),F(this,Ce,!!c(this,Se)),F(this,de,!!c(this,ye)),this.noDisposeOnSet=!!m,this.noUpdateTTL=!!b,this.noDeleteOnFetchRejection=!!p,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!T,this.ignoreFetchAbort=!!N,this.maxEntrySize!==0){if(c(this,ue)!==0&&!Le(c(this,ue)))throw new TypeError("maxSize must be a positive integer if specified");if(!Le(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");I(this,Tt,Pn).call(this)}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!x,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!r,this.ttlResolution=Le(i)||i===0?i:1,this.ttlAutopurge=!!l,this.ttl=n||0,this.ttl){if(!Le(this.ttl))throw new TypeError("ttl must be a positive integer if specified");I(this,at,Qt).call(this)}if(c(this,ke)===0&&this.ttl===0&&c(this,ue)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!c(this,ke)&&!c(this,ue)){const V="LRU_CACHE_UNBOUNDED";Zi(V)&&(Ln.add(V),Gi("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",V,Zt))}}static unsafeExposeInternals(t){return{starts:c(t,Ae),ttls:c(t,ve),sizes:c(t,_e),keyMap:c(t,ie),keyList:c(t,Z),valList:c(t,j),next:c(t,ce),prev:c(t,he),get head(){return c(t,ae)},get tail(){return c(t,le)},free:c(t,xe),isBackgroundFetch:e=>{var n;return I(n=t,X,Q).call(n,e)},backgroundFetch:(e,n,i,l)=>{var a;return I(a=t,tt,jt).call(a,e,n,i,l)},moveToTail:e=>{var n;return I(n=t,Be,gt).call(n,e)},indexes:e=>{var n;return I(n=t,Te,Oe).call(n,e)},rindexes:e=>{var n;return I(n=t,Ee,De).call(n,e)},isStale:e=>{var n;return c(n=t,fe).call(n,e)}}}get max(){return c(this,ke)}get maxSize(){return c(this,ue)}get calculatedSize(){return c(this,we)}get size(){return c(this,ne)}get fetchMethod(){return c(this,Ye)}get dispose(){return c(this,Se)}get disposeAfter(){return c(this,ye)}getRemainingTTL(t){return c(this,ie).has(t)?1/0:0}*entries(){for(const t of I(this,Te,Oe).call(this))c(this,j)[t]!==void 0&&c(this,Z)[t]!==void 0&&!I(this,X,Q).call(this,c(this,j)[t])&&(yield[c(this,Z)[t],c(this,j)[t]])}*rentries(){for(const t of I(this,Ee,De).call(this))c(this,j)[t]!==void 0&&c(this,Z)[t]!==void 0&&!I(this,X,Q).call(this,c(this,j)[t])&&(yield[c(this,Z)[t],c(this,j)[t]])}*keys(){for(const t of I(this,Te,Oe).call(this)){const e=c(this,Z)[t];e!==void 0&&!I(this,X,Q).call(this,c(this,j)[t])&&(yield e)}}*rkeys(){for(const t of I(this,Ee,De).call(this)){const e=c(this,Z)[t];e!==void 0&&!I(this,X,Q).call(this,c(this,j)[t])&&(yield e)}}*values(){for(const t of I(this,Te,Oe).call(this))c(this,j)[t]!==void 0&&!I(this,X,Q).call(this,c(this,j)[t])&&(yield c(this,j)[t])}*rvalues(){for(const t of I(this,Ee,De).call(this))c(this,j)[t]!==void 0&&!I(this,X,Q).call(this,c(this,j)[t])&&(yield c(this,j)[t])}[Symbol.iterator](){return this.entries()}find(t,e={}){for(const n of I(this,Te,Oe).call(this)){const i=c(this,j)[n],l=I(this,X,Q).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 I(this,Te,Oe).call(this)){const i=c(this,j)[n],l=I(this,X,Q).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 I(this,Ee,De).call(this)){const i=c(this,j)[n],l=I(this,X,Q).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 I(this,Ee,De).call(this,{allowStale:!0}))c(this,fe).call(this,e)&&(this.delete(c(this,Z)[e]),t=!0);return t}dump(){const t=[];for(const e of I(this,Te,Oe).call(this,{allowStale:!0})){const n=c(this,Z)[e],i=c(this,j)[e],l=I(this,X,Q).call(this,i)?i.__staleWhileFetching:i;if(l===void 0||n===void 0)continue;const a={value:l};if(c(this,ve)&&c(this,Ae)){a.ttl=c(this,ve)[e];const r=ot.now()-c(this,Ae)[e];a.start=Math.floor(Date.now()-r)}c(this,_e)&&(a.size=c(this,_e)[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=ot.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,dt).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,xe).length!==0?c(this,xe).pop():c(this,ne)===c(this,ke)?I(this,et,Rt).call(this,!1):c(this,ne),c(this,Z)[m]=t,c(this,j)[m]=e,c(this,ie).set(t,m),c(this,ce)[c(this,le)]=m,c(this,he)[m]=c(this,le),F(this,le,m),Ft(this,ne)._++,c(this,Je).call(this,m,h,d),d&&(d.set="add"),f=!1;else{I(this,Be,gt).call(this,m);const k=c(this,j)[m];if(e!==k){if(c(this,Fe)&&I(this,X,Q).call(this,k)?k.__abortController.abort(new Error("replaced")):a||(c(this,Ce)&&((b=c(this,Se))==null||b.call(this,k,t,"set")),c(this,de)&&((g=c(this,re))==null||g.push([k,t,"set"]))),c(this,Me).call(this,m),c(this,Je).call(this,m,h,d),c(this,j)[m]=e,d){d.set="replace";const w=k&&I(this,X,Q).call(this,k)?k.__staleWhileFetching:k;w!==void 0&&(d.oldValue=w)}}else d&&(d.set="update")}if(i!==0&&!c(this,ve)&&I(this,at,Qt).call(this),c(this,ve)&&(f||c(this,ct).call(this,m,i,l),d&&c(this,Ie).call(this,d,m)),!a&&c(this,de)&&c(this,re)){const k=c(this,re);let w;for(;w=k==null?void 0:k.shift();)($=c(this,ye))==null||$.call(this,...w)}return this}pop(){var t;try{for(;c(this,ne);){const e=c(this,j)[c(this,ae)];if(I(this,et,Rt).call(this,!0),I(this,X,Q).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(c(this,de)&&c(this,re)){const e=c(this,re);let n;for(;n=e==null?void 0:e.shift();)(t=c(this,ye))==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,fe).call(this,l))i&&(i.has="stale",c(this,Ie).call(this,i,l));else return n&&c(this,Pe).call(this,l),i&&(i.has="hit",c(this,Ie).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,fe).call(this,i))){const l=c(this,j)[i];return I(this,X,Q).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:w=!1,status:p,signal:x}=e;if(!c(this,Fe))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 T=c(this,ie).get(t);if(T===void 0){p&&(p.fetch="miss");const N=I(this,tt,jt).call(this,t,T,S,k);return N.__returned=N}else{const N=c(this,j)[T];if(I(this,X,Q).call(this,N)){const M=n&&N.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",M&&(p.returnedStale=!0)),M?N.__staleWhileFetching:N.__returned=N}const H=c(this,fe).call(this,T);if(!w&&!H)return p&&(p.fetch="hit"),I(this,Be,gt).call(this,T),i&&c(this,Pe).call(this,T),p&&c(this,Ie).call(this,p,T),N;const V=I(this,tt,jt).call(this,t,T,S,k),K=V.__staleWhileFetching!==void 0&&n;return p&&(p.fetch=H?"stale":"refresh",K&&H&&(p.returnedStale=!0)),K?V.__staleWhileFetching:V.__returned=V}}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,j)[r],f=I(this,X,Q).call(this,d);return a&&c(this,Ie).call(this,a,r),c(this,fe).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:(I(this,Be,gt).call(this,r),i&&c(this,Pe).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,Me).call(this,r);const d=c(this,j)[r];I(this,X,Q).call(this,d)?d.__abortController.abort(new Error("deleted")):(c(this,Ce)||c(this,de))&&(c(this,Ce)&&((n=c(this,Se))==null||n.call(this,d,t,"delete")),c(this,de)&&((i=c(this,re))==null||i.push([d,t,"delete"]))),c(this,ie).delete(t),c(this,Z)[r]=void 0,c(this,j)[r]=void 0,r===c(this,le)?F(this,le,c(this,he)[r]):r===c(this,ae)?F(this,ae,c(this,ce)[r]):(c(this,ce)[c(this,he)[r]]=c(this,ce)[r],c(this,he)[c(this,ce)[r]]=c(this,he)[r]),Ft(this,ne)._--,c(this,xe).push(r)}}if(c(this,de)&&((l=c(this,re))!=null&&l.length)){const r=c(this,re);let d;for(;d=r==null?void 0:r.shift();)(a=c(this,ye))==null||a.call(this,...d)}return e}clear(){var t,e,n;for(const i of I(this,Ee,De).call(this,{allowStale:!0})){const l=c(this,j)[i];if(I(this,X,Q).call(this,l))l.__abortController.abort(new Error("deleted"));else{const a=c(this,Z)[i];c(this,Ce)&&((t=c(this,Se))==null||t.call(this,l,a,"delete")),c(this,de)&&((e=c(this,re))==null||e.push([l,a,"delete"]))}}if(c(this,ie).clear(),c(this,j).fill(void 0),c(this,Z).fill(void 0),c(this,ve)&&c(this,Ae)&&(c(this,ve).fill(0),c(this,Ae).fill(0)),c(this,_e)&&c(this,_e).fill(0),F(this,ae,0),F(this,le,0),c(this,xe).length=0,F(this,we,0),F(this,ne,0),c(this,de)&&c(this,re)){const i=c(this,re);let l;for(;l=i==null?void 0:i.shift();)(n=c(this,ye))==null||n.call(this,...l)}}};let Ut=Zt;ke=new WeakMap,ue=new WeakMap,Se=new WeakMap,ye=new WeakMap,Ye=new WeakMap,ne=new WeakMap,we=new WeakMap,ie=new WeakMap,Z=new WeakMap,j=new WeakMap,ce=new WeakMap,he=new WeakMap,ae=new WeakMap,le=new WeakMap,xe=new WeakMap,re=new WeakMap,_e=new WeakMap,Ae=new WeakMap,ve=new WeakMap,Ce=new WeakMap,Fe=new WeakMap,de=new WeakMap,at=new WeakSet,Qt=function(){const t=new $t(c(this,ke)),e=new $t(c(this,ke));F(this,ve,t),F(this,Ae,e),F(this,ct,(l,a,r=ot.now())=>{if(e[l]=a!==0?r:0,t[l]=a,a!==0&&this.ttlAutopurge){const d=setTimeout(()=>{c(this,fe).call(this,l)&&this.delete(c(this,Z)[l])},a+1);d.unref&&d.unref()}}),F(this,Pe,l=>{e[l]=t[l]!==0?ot.now():0}),F(this,Ie,(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=ot.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())},F(this,fe,l=>t[l]!==0&&e[l]!==0&&(n||i())-e[l]>t[l])},Pe=new WeakMap,Ie=new WeakMap,ct=new WeakMap,fe=new WeakMap,Tt=new WeakSet,Pn=function(){const t=new $t(c(this,ke));F(this,we,0),F(this,_e,t),F(this,Me,e=>{F(this,we,c(this,we)-t[e]),t[e]=0}),F(this,dt,(e,n,i,l)=>{if(I(this,X,Q).call(this,n))return 0;if(!Le(i))if(l){if(typeof l!="function")throw new TypeError("sizeCalculation must be a function");if(i=l(n,e),!Le(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}),F(this,Je,(e,n,i)=>{if(t[e]=n,c(this,ue)){const l=c(this,ue)-t[e];for(;c(this,we)>l;)I(this,et,Rt).call(this,!0)}F(this,we,c(this,we)+t[e]),i&&(i.entrySize=n,i.totalCalculatedSize=c(this,we))})},Me=new WeakMap,Je=new WeakMap,dt=new WeakMap,Te=new WeakSet,Oe=function*({allowStale:t=this.allowStale}={}){if(c(this,ne))for(let e=c(this,le);!(!I(this,ut,Yt).call(this,e)||((t||!c(this,fe).call(this,e))&&(yield e),e===c(this,ae)));)e=c(this,he)[e]},Ee=new WeakSet,De=function*({allowStale:t=this.allowStale}={}){if(c(this,ne))for(let e=c(this,ae);!(!I(this,ut,Yt).call(this,e)||((t||!c(this,fe).call(this,e))&&(yield e),e===c(this,le)));)e=c(this,ce)[e]},ut=new WeakSet,Yt=function(t){return t!==void 0&&c(this,ie).get(c(this,Z)[t])===t},et=new WeakSet,Rt=function(t){var l,a;const e=c(this,ae),n=c(this,Z)[e],i=c(this,j)[e];return c(this,Fe)&&I(this,X,Q).call(this,i)?i.__abortController.abort(new Error("evicted")):(c(this,Ce)||c(this,de))&&(c(this,Ce)&&((l=c(this,Se))==null||l.call(this,i,n,"evict")),c(this,de)&&((a=c(this,re))==null||a.push([i,n,"evict"]))),c(this,Me).call(this,e),t&&(c(this,Z)[e]=void 0,c(this,j)[e]=void 0,c(this,xe).push(e)),c(this,ne)===1?(F(this,ae,F(this,le,0)),c(this,xe).length=0):F(this,ae,c(this,ce)[e]),c(this,ie).delete(n),Ft(this,ne)._--,e},tt=new WeakSet,jt=function(t,e,n,i){const l=e===void 0?void 0:c(this,j)[e];if(I(this,X,Q).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,w=!1)=>{const{aborted:p}=a.signal,x=n.ignoreFetchAbort&&k!==void 0;if(n.status&&(p&&!w?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,x&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),p&&!x&&!w)return m(a.signal.reason);const S=g;return c(this,j)[e]===g&&(k===void 0?S.__staleWhileFetching?c(this,j)[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:w}=a.signal,p=w&&n.allowStaleOnFetchAbort,x=p||n.allowStaleOnFetchRejection,S=x||n.noDeleteOnFetchRejection,T=g;if(c(this,j)[e]===g&&(!S||T.__staleWhileFetching===void 0?this.delete(t):p||(c(this,j)[e]=T.__staleWhileFetching)),x)return n.status&&T.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),T.__staleWhileFetching;if(T.__returned===T)throw k},b=(k,w)=>{var x;const p=(x=c(this,Ye))==null?void 0:x.call(this,t,l,d);p&&p instanceof Promise&&p.then(S=>k(S),w),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,j)[e]=$,$},X=new WeakSet,Q=function(t){if(!c(this,Fe))return!1;const e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof AbortController},ht=new WeakSet,Jt=function(t,e){c(this,he)[e]=t,c(this,ce)[t]=e},Be=new WeakSet,gt=function(t){t!==c(this,le)&&(t===c(this,ae)?F(this,ae,c(this,ce)[t]):I(this,ht,Jt).call(this,c(this,he)[t],c(this,ce)[t]),I(this,ht,Jt).call(this,c(this,le),t),F(this,le,t))};const Xi=Ut,rt=s=>{const t=s.value,e=t.substring(0,s.selectionStart),n=t.substring(s.selectionEnd,t.length),i=e.lastIndexOf(`
|
|
51
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,
|
|
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,w;let i="",l=0,a=0,r=!1,d,f;const h=(m=J.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=J.editorExtensions)==null?void 0:b.prettier)==null?void 0:g.prettierInstance),x=[(($=window.prettierPlugins)==null?void 0:$.markdown)||((w=(k=J.editorExtensions)==null?void 0:k.prettier)==null?void 0:w.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=2,a=-2;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
53
|
${p}
|
|
54
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
|
|
56
|
-
|`;for(let
|
|
57
|
-
|`;for(let
|
|
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 T=0;T<=S;T++)i+=" col |";i+=`
|
|
56
|
+
|`;for(let T=0;T<=S;T++)i+=" - |";for(let T=0;T<=x;T++){i+=`
|
|
57
|
+
|`;for(let N=0;N<=S;N++)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((T,N)=>T+`
|
|
58
58
|
`,""):i=`
|
|
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:
|
|
60
|
-
`).map(
|
|
61
|
-
`),d=S.substring(0,S.length-
|
|
62
|
-
`);let[B,
|
|
63
|
-
`);return
|
|
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:T,prefixSupply:N,subfixSupply:H}=rt(e);i=`${N}${t}${H}`.split(`
|
|
60
|
+
`).map(K=>`${x}${K}`).join(`
|
|
61
|
+
`),d=S.substring(0,S.length-N.length),f=T.substring(H.length,T.length),r=!0,l=p,a=-N.length-H.length}else{const T=e.value.substring(0,e.selectionStart);/\n$/.test(T)||T===""?(i=`${x}${t}`,r=!0):i=x}break}case"shiftTab":{const{tabWidth:p=2}=n,{prefixStr:x,prefixStrEndRow:S,subfixStrEndRow:T,prefixSupply:N,subfixSupply:H}=rt(e),V=new RegExp(`^\\s{${p}}`),y=(K=!1,M=!1)=>{const B=`${N}${t}${H}`;if(V.test(B)){const A=x.length-(M?0:p),R=K?A+t.length-p:A;return Ne(e,A,R),`${S}${B.replace(V,"")}${T}`}else if(/^\s/.test(B)){const A=B.replace(/^\s/,""),R=B.length-A.length,P=e.selectionStart-(M?0:R),z=K?P+t.length-R:P;return Ne(e,P,z),`${S}${A}${T}`}else i=t};if(t===""){const K=y();if(K)return K}else if(/\n/.test(t)){const M=`${N}${t}${H}`.split(`
|
|
62
|
+
`);let[B,A]=[0,0];const R=M.map((P,z)=>{if(V.test(P))return z===0&&(B=p),A+=p,P.replace(V,"");if(/^\s/.test(P)){const C=P.replace(/^\s/,"");return A+=P.length-C.length,C}return P}).join(`
|
|
63
|
+
`);return Ne(e,e.selectionStart-B,e.selectionEnd-A),`${S}${R}${T}`}else{const K=y(!0,!0);if(K)return K}break}case"ctrlC":{const{prefixSupply:p,subfixSupply:x}=rt(e);return lt(t===""?`${p}${x}`:t),e.value}case"ctrlX":{const{prefixStrEndRow:p,subfixStrEndRow:x,prefixStr:S,subfixStr:T,prefixSupply:N,subfixSupply:H}=rt(e);return t===""?(lt(`${N}${H}`),Ne(e,p.length),`${p}${x.replace(/^\n/,"")}`):(lt(t),Ne(e,S.length),`${S}${T}`)}case"ctrlD":{const{prefixStrEndRow:p,subfixStrEndRow:x}=rt(e);return Ne(e,p.length),`${p}${x.replace(/^\n/,"")}`}case"flow":{i=`\`\`\`mermaid
|
|
64
64
|
${(h==null?void 0:h.flow)||`flowchart TD
|
|
65
65
|
Start --> Stop`}
|
|
66
66
|
\`\`\`
|
|
@@ -112,14 +112,14 @@ ${(h==null?void 0:h.journey)||`journey
|
|
|
112
112
|
`,l=2;break}case"katexInline":{i="$$",l=1,a=-1;break}case"katexBlock":{i=`$$
|
|
113
113
|
|
|
114
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
|
|
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 Ot(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"],qt=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(qt.test(t[0])){const e={x:-1,y:-1},n=[];for(let i=0,l=t.length;i<l;i++)qt.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]=qt.exec(t[i.x])||[],d=t.slice(i.x+1,i.y).join(`
|
|
116
116
|
`),h={type:"alert",raw:t.slice(i.x,i.y+1).join(`
|
|
117
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
118
|
<p class="md-editor-alert-title">${this.parser.parseInline(s.titleTokens,null)}</p>
|
|
119
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,
|
|
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
|
|
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,T;const w=((S=t.value)==null?void 0:S.selectionStart)||0,p=((T=t.value)==null?void 0:T.selectionEnd)||0;r.list[r.curr].startPos=w,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),Ne(t.value,x.startPos,x.endPos).then(()=>{v.emit(l,"selectTextChange")})},m=k=>{var x,S;clearTimeout(a);const w=((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 T=r.list.pop()||{startPos:0,endPos:0,content:k};T.startPos=f[0],T.endPos=f[1],f=d,Array.prototype.push.call(r.list,T,{content:k,startPos:w,endPos:p}),r.curr=r.list.length-1}else r.userUpdated=!0},150)},b=k=>{var w,p;(f===d||k)&&(f=[(w=t.value)==null?void 0:w.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=J.editorExtensions)==null?void 0:l.katex,n=e==null?void 0:e.instance,i=o.ref(!!n);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)||on.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)||on.css,r.id=`${u}-katexCss`,ge(a,"katex"),ge(r)}}),i},is=s=>{var R,P;const{markedRenderer:t,markedExtensions:e,markedOptions:n,editorExtensions:i,editorConfig:l}=J,a=o.inject("showCodeRowNumber"),r=o.inject("editorId"),d=o.inject("highlight"),f=o.inject("previewOnly"),h=o.inject("theme"),m=(R=i==null?void 0:i.highlight)==null?void 0:R.instance,b=(P=i==null?void 0:i.mermaid)==null?void 0:P.instance,g=o.ref(!!m),$=o.ref([]);let k=[],w=[];const p=new Xi({max:1e3,ttl:6e5}),x=os(s),S=ns(s,_),T=o.computed(()=>(s.noMermaid||x.mermaidInited)&&g.value&&(s.noKatex||S.value));let N=new _.Renderer;N.image=(z,C,O)=>`<span class="figure"><img src="${z}" title="${C||""}" alt="${O||""}" zoom><span class="figcaption">${O||""}</span></span>`,N.listitem=(z,C)=>C?`<li class="li-task">${z}</li>`:`<li>${z}</li>`,t instanceof Function&&(N=t(N));const H=N.code;N.code=(z,C,O)=>{if(!s.noMermaid&&C==="mermaid"){const G=Jn();try{if(es)return`<p class="${u}-mermaid">${z}</p>`;{const te=p.get(z);if(te)return`<p class="${u}-mermaid" data-processed>${te}</p>`;const me=b||window.mermaid;if(x.mermaidInited){const Ue=(me.renderAsync||me.render)(G,z);Ue.then(Re=>{p.set(z,typeof Re=="string"?Re:Re.svg)}),k.push(Ue)}else return`<p class="${u}-mermaid">${z}</p>`}const ee=`<script type="text/tmplate">${G}<\/script>`;return w.push(ee),ee}catch(ee){return`<p class="${u}-mermaid-error">Error: ${(ee==null?void 0:ee.message)||""}</p>`}}return H.call(N,z,C,O).replace(/^<pre><code\sclass="language-([^>]*)">/,'<pre><code class="language-$1" language="$1">')};const V=N.heading,y=V!==new _.Renderer().heading;N.heading=(z,C,O,G)=>{$.value.push({text:O,level:C});const ee=s.markedHeadingId(O,C,$.value.length);return y?V.call(N,z,C,O,G,$.value.length,ee):z!==O?`<h${C} id="${ee}">${z}</h${C}>`:`<h${C} id="${ee}"><a href="#${ee}">${O}</a></h${C}>`},m&&_.setOptions({highlight:(z,C)=>{let O;const G=m.getLanguage(C);return C&&G?O=m.highlight(z,{language:C,ignoreIllegals:!0}).value:O=m.highlightAuto(z).value,a?cn(O.trim()):`<span class="code-block">${O.trim()}</span>`}}),_.setOptions({breaks:!0,...n}),e instanceof Array&&e.length>0&&_.use({extensions:e}),_.use({extensions:[Ji]});const K=o.ref(s.sanitize(_(s.value||"",{renderer:N}))),M=async z=>{let C=s.sanitize(_(z,{renderer:N}));const O=[...k],G=[...w];return w=[],k=[],(await Promise.allSettled(O)).forEach((te,me)=>{te.status==="fulfilled"?C=C.replace(G[me],`<p class="${u}-mermaid" data-processed>${typeof te.value=="string"?te.value:te.value.svg}</p>`):C=C.replace(G[me],`<p class="${u}-mermaid-error">${te.reason||""}</p>`)}),C},B=pt(async()=>{$.value=[];const z=await M(s.value||"");K.value=z,v.emit(r,"buildFinished",K.value),s.onHtmlChanged(K.value)},(l==null?void 0:l.renderDelay)!==void 0?l==null?void 0:l.renderDelay:f?0:500);o.watch([T,o.toRef(x,"reRender"),o.toRef(s,"value")],B),o.watch([h],()=>{p.clear()});const A=()=>{_.setOptions({highlight:(z,C)=>{let O;const G=window.hljs.getLanguage(C);return C&&G?O=window.hljs.highlight(z,{language:C,ignoreIllegals:!0}).value:O=window.hljs.highlightAuto(z).value,a?cn(O.trim()):`<span class="code-block">${O.trim()}</span>`}}),g.value=!0};return o.watch(()=>$.value,z=>{s.onGetCatalog(z),v.emit(r,"catalogChanged",z)}),o.onMounted(()=>{if(!m){const z=document.createElement("script");z.src=d.value.js,z.onload=A,z.id=`${u}-hljs`,ge(z,"hljs");const C=document.createElement("link");C.rel="stylesheet",C.href=d.value.css,C.id=`${u}-hlCss`,ge(C)}}),o.watch(()=>d.value.css,z=>{ei(`${u}-hlCss`,"href",z)}),o.onMounted(()=>{v.on(r,{name:"pushCatalog",callback(){v.emit(r,"catalogChanged",$.value)}})}),K},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)||"复制代码",w=document.createElement("span");w.setAttribute("class","copy-button"),w.dataset.tips=k,w.innerHTML=`<svg class="${u}-icon" aria-hidden="true"><use xlink:href="#${u}-icon-copy"></use></svg>`,w.addEventListener("click",()=>{var V,y;clearTimeout($);const S=g.querySelector("code").innerText,T=lt(s.formatCopiedText(S)),N=((V=a.value.copyCode)==null?void 0:V.successTips)||"已复制!",H=((y=a.value.copyCode)==null?void 0:y.failTips)||"已复制!";w.dataset.tips=T?N:H,$=window.setTimeout(()=>{w.dataset.tips=k},1500)}),g.appendChild(w)})},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 w=b==null?void 0:b.replace(/(\d+\.|-)\s+(\[[x\s]\]\s+)?$/,"");s.onChange(w+g),Ne(t.value,w==null?void 0:w.length)}else if(/^-\s+.+/.test(k)){const w=/^-\s+\[[x\s]\]/.test(k)?`
|
|
122
122
|
- [ ] `:`
|
|
123
|
-
- `;s.onChange(
|
|
123
|
+
- `;s.onChange(Ot(t.value,w,{}))}else{const w=k==null?void 0:k.match(/\d+(?=\.)/),p=w&&Number(w[0])+1||1,x=/^\d\.\s+\[[x\s]\]/.test(k)?`
|
|
124
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});
|
|
125
|
+
${p}. `;s.onChange(Ot(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}=J,n=e==null?void 0:e.mermaid,i=o.reactive({reRender:!1,mermaidInited:!!(n!=null&&n.instance)}),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},ge(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=pt(()=>{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(sn.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}}),Ct=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:Ht,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:nn},toolbarsExclude:{type:Array,default:[]},noPrettier:{type:Boolean,default:!1},onHtmlChanged:{type:Function},onGetCatalog:{type:Function},editorId:{type:String,default:Y},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:sn},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="",Ve=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=pe({props:s,ctx:t},"defToolbars"),$=pe({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:w=>{v.emit(e,"saveHistoryPos"),s.onChange?s.onChange(w):(t.emit("update:modelValue",w),t.emit("onChange",w))},onHtmlChanged:w=>{s.onHtmlChanged?s.onHtmlChanged(w):t.emit("onHtmlChanged",w)},onGetCatalog:w=>{s.onGetCatalog?s.onGetCatalog(w):t.emit("onGetCatalog",w)},onBlur:w=>{s.onBlur?s.onBlur(w):t.emit("onBlur",w)},onFocus:w=>{s.onFocus?s.onFocus(w):t.emit("onFocus",w)}},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:w=>d.scrollAuto=w},null),b.value&&!n&&o.createVNode(Ct,{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}}),Wt=o.defineComponent({name:"NormalToolbar",props:$s(),emits:["onClick"],setup(s,t){return()=>{const e=pe({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]}}),Kt=o.defineComponent({name:"DropdownToolbar",props:Ss(),emits:["onChange"],setup(s,t){const e=o.inject("editorId");return()=>{const n=pe({props:s,ctx:t},"trigger"),i=pe({props:s,ctx:t},"overlay");return o.createVNode(Ke,{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}}),Gt=o.defineComponent({name:"ModalToolbar",props:Ts(),emits:["onClick","onClose","onAdjust"],setup(s,t){return()=>{const e=pe({props:s,ctx:t},"trigger"),n=pe({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(Pt,{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 Ve.install=s=>(s.component(Ve.name,Ve),s.component(Wt.name,Wt),s.component(Kt.name,Kt),s.component(Ct.name,Ct),s.component(Gt.name,Gt),s),Ve.NormalToolbar=Wt,Ve.DropdownToolbar=Kt,Ve.MdCatalog=Ct,Ve.ModalToolbar=Gt,Ve.config=qn,Ve});
|