mirror of
https://github.com/silenty4ng/k5web
synced 2025-01-15 16:22:44 +00:00
57 lines
61 KiB
JavaScript
57 lines
61 KiB
JavaScript
var Hn=Object.defineProperty;var Bn=(a,e,t)=>e in a?Hn(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var E=(a,e,t)=>(Bn(a,typeof e!="symbol"?e+"":e,t),t);import{v as Gn,ad as Wn,_ as jn}from"./index.b5a2f1c9.js";/* empty css *//* empty css *//* empty css *//* empty css */import{d as qn,r as Zn,w as Yn,o as Xn,bW as Vn,bI as Qn,C as ke,D as nt,aI as q,aH as Z,u as Jn,G as qt,aM as he,aN as Ne,aK as Zt,aJ as Yt,aE as Xt,bX as Kn,b8 as ei,bh as ti,bK as ni,bO as ii}from"./arco.9755215d.js";import{g as si}from"./vue.e23f7fca.js";import{u as ri}from"./loading.3855ec1d.js";import{L as oi}from"./index.aabf007e.js";import{S as li}from"./index.d5c8997c.js";import"./chart.e5f26fc3.js";import"./slot.d8136cff.js";function pt(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let re=pt();function pn(a){re=a}const hn=/[&<>"']/,ai=new RegExp(hn.source,"g"),fn=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,ci=new RegExp(fn.source,"g"),ui={"&":"&","<":"<",">":">",'"':""","'":"'"},Vt=a=>ui[a];function U(a,e){if(e){if(hn.test(a))return a.replace(ai,Vt)}else if(fn.test(a))return a.replace(ci,Vt);return a}const pi=/(^|[^\[])\^/g;function T(a,e){let t=typeof a=="string"?a:a.source;e=e||"";const n={replace:(s,i)=>{let r=typeof i=="string"?i:i.source;return r=r.replace(pi,"$1"),t=t.replace(s,r),n},getRegex:()=>new RegExp(t,e)};return n}function Qt(a){try{a=encodeURI(a).replace(/%25/g,"%")}catch{return null}return a}const Ae={exec:()=>null};function Jt(a,e){const t=a.replace(/\|/g,(i,r,l)=>{let c=!1,h=r;for(;--h>=0&&l[h]==="\\";)c=!c;return c?"|":" |"}),n=t.split(/ \|/);let s=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(/\\\|/g,"|");return n}function be(a,e,t){const n=a.length;if(n===0)return"";let s=0;for(;s<n;){const i=a.charAt(n-s-1);if(i===e&&!t)s++;else if(i!==e&&t)s++;else break}return a.slice(0,n-s)}function hi(a,e){if(a.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<a.length;n++)if(a[n]==="\\")n++;else if(a[n]===e[0])t++;else if(a[n]===e[1]&&(t--,t<0))return n;return-1}function Kt(a,e,t,n){const s=e.href,i=e.title?U(e.title):null,r=a[1].replace(/\\([\[\]])/g,"$1");if(a[0].charAt(0)!=="!"){n.state.inLink=!0;const l={type:"link",raw:t,href:s,title:i,text:r,tokens:n.inlineTokens(r)};return n.state.inLink=!1,l}return{type:"image",raw:t,href:s,title:i,text:U(r)}}function fi(a,e){const t=a.match(/^(\s+)(?:```)/);if(t===null)return e;const n=t[1];return e.split(`
|
|
`).map(s=>{const i=s.match(/^\s+/);if(i===null)return s;const[r]=i;return r.length>=n.length?s.slice(n.length):s}).join(`
|
|
`)}class Ue{constructor(e){E(this,"options");E(this,"rules");E(this,"lexer");this.options=e||re}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(/^(?: {1,4}| {0,3}\t)/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:be(n,`
|
|
`)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],s=fi(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(/#$/.test(n)){const s=be(n,"#");(this.options.pedantic||!s||/ $/.test(s))&&(n=s.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:be(t[0],`
|
|
`)}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let n=be(t[0],`
|
|
`).split(`
|
|
`),s="",i="";const r=[];for(;n.length>0;){let l=!1;const c=[];let h;for(h=0;h<n.length;h++)if(/^ {0,3}>/.test(n[h]))c.push(n[h]),l=!0;else if(!l)c.push(n[h]);else break;n=n.slice(h);const p=c.join(`
|
|
`),m=p.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
|
|
$1`).replace(/^ {0,3}>[ \t]?/gm,"");s=s?`${s}
|
|
${p}`:p,i=i?`${i}
|
|
${m}`:m;const g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(m,r,!0),this.lexer.state.top=g,n.length===0)break;const x=r[r.length-1];if((x==null?void 0:x.type)==="code")break;if((x==null?void 0:x.type)==="blockquote"){const b=x,_=b.raw+`
|
|
`+n.join(`
|
|
`),O=this.blockquote(_);r[r.length-1]=O,s=s.substring(0,s.length-b.raw.length)+O.raw,i=i.substring(0,i.length-b.text.length)+O.text;break}else if((x==null?void 0:x.type)==="list"){const b=x,_=b.raw+`
|
|
`+n.join(`
|
|
`),O=this.list(_);r[r.length-1]=O,s=s.substring(0,s.length-x.raw.length)+O.raw,i=i.substring(0,i.length-b.raw.length)+O.raw,n=_.substring(r[r.length-1].raw.length).split(`
|
|
`);continue}}return{type:"blockquote",raw:s,tokens:r,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const s=n.length>1,i={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");const r=new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`);let l=!1;for(;e;){let c=!1,h="",p="";if(!(t=r.exec(e))||this.rules.block.hr.test(e))break;h=t[0],e=e.substring(h.length);let m=t[2].split(`
|
|
`,1)[0].replace(/^\t+/,j=>" ".repeat(3*j.length)),g=e.split(`
|
|
`,1)[0],x=!m.trim(),b=0;if(this.options.pedantic?(b=2,p=m.trimStart()):x?b=t[1].length+1:(b=t[2].search(/[^ ]/),b=b>4?1:b,p=m.slice(b),b+=t[1].length),x&&/^[ \t]*$/.test(g)&&(h+=g+`
|
|
`,e=e.substring(g.length+1),c=!0),!c){const j=new RegExp(`^ {0,${Math.min(3,b-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),M=new RegExp(`^ {0,${Math.min(3,b-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),X=new RegExp(`^ {0,${Math.min(3,b-1)}}(?:\`\`\`|~~~)`),A=new RegExp(`^ {0,${Math.min(3,b-1)}}#`),H=new RegExp(`^ {0,${Math.min(3,b-1)}}<[a-z].*>`,"i");for(;e;){const z=e.split(`
|
|
`,1)[0];let te;if(g=z,this.options.pedantic?(g=g.replace(/^ {1,4}(?=( {4})*[^ ])/g," "),te=g):te=g.replace(/\t/g," "),X.test(g)||A.test(g)||H.test(g)||j.test(g)||M.test(g))break;if(te.search(/[^ ]/)>=b||!g.trim())p+=`
|
|
`+te.slice(b);else{if(x||m.replace(/\t/g," ").search(/[^ ]/)>=4||X.test(m)||A.test(m)||M.test(m))break;p+=`
|
|
`+g}!x&&!g.trim()&&(x=!0),h+=z+`
|
|
`,e=e.substring(z.length+1),m=te.slice(b)}}i.loose||(l?i.loose=!0:/\n[ \t]*\n[ \t]*$/.test(h)&&(l=!0));let _=null,O;this.options.gfm&&(_=/^\[[ xX]\] /.exec(p),_&&(O=_[0]!=="[ ] ",p=p.replace(/^\[[ xX]\] +/,""))),i.items.push({type:"list_item",raw:h,task:!!_,checked:O,loose:!1,text:p,tokens:[]}),i.raw+=h}i.items[i.items.length-1].raw=i.items[i.items.length-1].raw.trimEnd(),i.items[i.items.length-1].text=i.items[i.items.length-1].text.trimEnd(),i.raw=i.raw.trimEnd();for(let c=0;c<i.items.length;c++)if(this.lexer.state.top=!1,i.items[c].tokens=this.lexer.blockTokens(i.items[c].text,[]),!i.loose){const h=i.items[c].tokens.filter(m=>m.type==="space"),p=h.length>0&&h.some(m=>/\n.*\n/.test(m.raw));i.loose=p}if(i.loose)for(let c=0;c<i.items.length;c++)i.items[c].loose=!0;return i}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(/\s+/g," "),s=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:s,title:i}}}table(e){const t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;const n=Jt(t[1]),s=t[2].replace(/^\||\| *$/g,"").split("|"),i=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
|
|
`):[],r={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(const l of s)/^ *-+: *$/.test(l)?r.align.push("right"):/^ *:-+: *$/.test(l)?r.align.push("center"):/^ *:-+ *$/.test(l)?r.align.push("left"):r.align.push(null);for(let l=0;l<n.length;l++)r.header.push({text:n[l],tokens:this.lexer.inline(n[l]),header:!0,align:r.align[l]});for(const l of i)r.rows.push(Jt(l,r.header.length).map((c,h)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:r.align[h]})));return r}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const n=t[1].charAt(t[1].length-1)===`
|
|
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:U(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;const r=be(n.slice(0,-1),"\\");if((n.length-r.length)%2===0)return}else{const r=hi(t[2],"()");if(r>-1){const c=(t[0].indexOf("!")===0?5:4)+t[1].length+r;t[2]=t[2].substring(0,r),t[0]=t[0].substring(0,c).trim(),t[3]=""}}let s=t[2],i="";if(this.options.pedantic){const r=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(s);r&&(s=r[1],i=r[3])}else i=t[3]?t[3].slice(1,-1):"";return s=s.trim(),/^</.test(s)&&(this.options.pedantic&&!/>$/.test(n)?s=s.slice(1):s=s.slice(1,-1)),Kt(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const s=(n[2]||n[1]).replace(/\s+/g," "),i=t[s.toLowerCase()];if(!i){const r=n[0].charAt(0);return{type:"text",raw:r,text:r}}return Kt(n,i,n[0],this.lexer)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s||s[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(s[1]||s[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const r=[...s[0]].length-1;let l,c,h=r,p=0;const m=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(m.lastIndex=0,t=t.slice(-1*e.length+r);(s=m.exec(t))!=null;){if(l=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!l)continue;if(c=[...l].length,s[3]||s[4]){h+=c;continue}else if((s[5]||s[6])&&r%3&&!((r+c)%3)){p+=c;continue}if(h-=c,h>0)continue;c=Math.min(c,c+h+p);const g=[...s[0]][0].length,x=e.slice(0,r+s.index+g+c);if(Math.min(r,c)%2){const _=x.slice(1,-1);return{type:"em",raw:x,text:_,tokens:this.lexer.inlineTokens(_)}}const b=x.slice(2,-2);return{type:"strong",raw:x,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(/\n/g," ");const s=/[^ ]/.test(n),i=/^ /.test(n)&&/ $/.test(n);return s&&i&&(n=n.substring(1,n.length-1)),n=U(n,!0),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=U(t[1]),s="mailto:"+n):(n=U(t[1]),s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n,s;let t;if(t=this.rules.inline.url.exec(e)){let i,r;if(t[2]==="@")i=U(t[0]),r="mailto:"+i;else{let l;do l=t[0],t[0]=(s=(n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])!=null?s:"";while(l!==t[0]);i=U(t[0]),t[1]==="www."?r="http://"+t[0]:r=t[0]}return{type:"link",raw:t[0],text:i,href:r,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let n;return this.lexer.state.inRawBlock?n=t[0]:n=U(t[0]),{type:"text",raw:t[0],text:n}}}}const di=/^(?:[ \t]*(?:\n|$))+/,mi=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,gi=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Se=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ki=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,dn=/(?:[*+-]|\d{1,9}[.)])/,mn=T(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,dn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),ht=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,bi=/^[^\n]+/,ft=/(?!\s*\])(?:\\.|[^\[\]\\])+/,xi=T(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ft).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),_i=T(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,dn).getRegex(),Be="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|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",dt=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,wi=T("^ {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|$))","i").replace("comment",dt).replace("tag",Be).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),gn=T(ht).replace("hr",Se).replace("heading"," {0,3}#{1,6}(?:\\s|$)").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",Be).getRegex(),Ti=T(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",gn).getRegex(),mt={blockquote:Ti,code:mi,def:xi,fences:gi,heading:ki,hr:Se,html:wi,lheading:mn,list:_i,newline:di,paragraph:gn,table:Ae,text:bi},en=T("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Se).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\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",Be).getRegex(),Ei={...mt,table:en,paragraph:T(ht).replace("hr",Se).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",en).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",Be).getRegex()},yi={...mt,html:T(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",dt).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:Ae,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:T(ht).replace("hr",Se).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",mn).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},kn=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ai=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,bn=/^( {2,}|\\)\n(?!\s*$)/,Ri=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Le="\\p{P}\\p{S}",Si=T(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Le).getRegex(),Li=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,Ii=T(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Le).getRegex(),Oi=T("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Le).getRegex(),Di=T("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Le).getRegex(),Ci=T(/\\([punct])/,"gu").replace(/punct/g,Le).getRegex(),Mi=T(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("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])?)+(?![-_])/).getRegex(),Ni=T(dt).replace("(?:-->|$)","-->").getRegex(),vi=T("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Ni).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Fe=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Pi=T(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Fe).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),xn=T(/^!?\[(label)\]\[(ref)\]/).replace("label",Fe).replace("ref",ft).getRegex(),_n=T(/^!?\[(ref)\](?:\[\])?/).replace("ref",ft).getRegex(),$i=T("reflink|nolink(?!\\()","g").replace("reflink",xn).replace("nolink",_n).getRegex(),gt={_backpedal:Ae,anyPunctuation:Ci,autolink:Mi,blockSkip:Li,br:bn,code:Ai,del:Ae,emStrongLDelim:Ii,emStrongRDelimAst:Oi,emStrongRDelimUnd:Di,escape:kn,link:Pi,nolink:_n,punctuation:Si,reflink:xn,reflinkSearch:$i,tag:vi,text:Ri,url:Ae},zi={...gt,link:T(/^!?\[(label)\]\((.*?)\)/).replace("label",Fe).getRegex(),reflink:T(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Fe).getRegex()},at={...gt,escape:T(kn).replace("])","~|])").getRegex(),url:T(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_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.!#$%&'*+\/=?_`{\|}~-]+@)))/},Ui={...at,br:T(bn).replace("{2,}","*").getRegex(),text:T(at.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ve={normal:mt,gfm:Ei,pedantic:yi},xe={normal:gt,gfm:at,breaks:Ui,pedantic:zi};class B{constructor(e){E(this,"tokens");E(this,"options");E(this,"state");E(this,"tokenizer");E(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||re,this.options.tokenizer=this.options.tokenizer||new Ue,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 t={block:ve.normal,inline:xe.normal};this.options.pedantic?(t.block=ve.pedantic,t.inline=xe.pedantic):this.options.gfm&&(t.block=ve.gfm,this.options.breaks?t.inline=xe.breaks:t.inline=xe.gfm),this.tokenizer.rules=t}static get rules(){return{block:ve,inline:xe}}static lex(e,t){return new B(t).lex(e)}static lexInline(e,t){return new B(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
|
|
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.options.pedantic&&(e=e.replace(/\t/g," ").replace(/^ +$/gm,""));let s,i,r;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(l=>(s=l.call({lexer:this},e,t))?(e=e.substring(s.raw.length),t.push(s),!0):!1))){if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length),s.raw.length===1&&t.length>0?t[t.length-1].raw+=`
|
|
`:t.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
|
|
`+s.raw,i.text+=`
|
|
`+s.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
|
|
`+s.raw,i.text+=`
|
|
`+s.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title});continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),t.push(s);continue}if(r=e,this.options.extensions&&this.options.extensions.startBlock){let l=1/0;const c=e.slice(1);let h;this.options.extensions.startBlock.forEach(p=>{h=p.call({lexer:this},c),typeof h=="number"&&h>=0&&(l=Math.min(l,h))}),l<1/0&&l>=0&&(r=e.substring(0,l+1))}if(this.state.top&&(s=this.tokenizer.paragraph(r))){i=t[t.length-1],n&&(i==null?void 0:i.type)==="paragraph"?(i.raw+=`
|
|
`+s.raw,i.text+=`
|
|
`+s.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(s),n=r.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length),i=t[t.length-1],i&&i.type==="text"?(i.raw+=`
|
|
`+s.raw,i.text+=`
|
|
`+s.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(s);continue}if(e){const l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,s,i,r=e,l,c,h;if(this.tokens.links){const p=Object.keys(this.tokens.links);if(p.length>0)for(;(l=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)p.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(l=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(l=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,l.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(c||(h=""),c=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(p=>(n=p.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),s=t[t.length-1],s&&n.type==="text"&&s.type==="text"?(s.raw+=n.raw,s.text+=n.text):t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length),s=t[t.length-1],s&&n.type==="text"&&s.type==="text"?(s.raw+=n.raw,s.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,r,h)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}if(i=e,this.options.extensions&&this.options.extensions.startInline){let p=1/0;const m=e.slice(1);let g;this.options.extensions.startInline.forEach(x=>{g=x.call({lexer:this},m),typeof g=="number"&&g>=0&&(p=Math.min(p,g))}),p<1/0&&p>=0&&(i=e.substring(0,p+1))}if(n=this.tokenizer.inlineText(i)){e=e.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(h=n.raw.slice(-1)),c=!0,s=t[t.length-1],s&&s.type==="text"?(s.raw+=n.raw,s.text+=n.text):t.push(n);continue}if(e){const p="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(p);break}else throw new Error(p)}}return t}}class He{constructor(e){E(this,"options");E(this,"parser");this.options=e||re}space(e){return""}code({text:e,lang:t,escaped:n}){var r;const s=(r=(t||"").match(/^\S*/))==null?void 0:r[0],i=e.replace(/\n$/,"")+`
|
|
`;return s?'<pre><code class="language-'+U(s)+'">'+(n?i:U(i,!0))+`</code></pre>
|
|
`:"<pre><code>"+(n?i:U(i,!0))+`</code></pre>
|
|
`}blockquote({tokens:e}){return`<blockquote>
|
|
${this.parser.parse(e)}</blockquote>
|
|
`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
`}hr(e){return`<hr>
|
|
`}list(e){const t=e.ordered,n=e.start;let s="";for(let l=0;l<e.items.length;l++){const c=e.items[l];s+=this.listitem(c)}const i=t?"ol":"ul",r=t&&n!==1?' start="'+n+'"':"";return"<"+i+r+`>
|
|
`+s+"</"+i+`>
|
|
`}listitem(e){let t="";if(e.task){const n=this.checkbox({checked:!!e.checked});e.loose?e.tokens.length>0&&e.tokens[0].type==="paragraph"?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=n+" "+e.tokens[0].tokens[0].text)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" "}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
|
|
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
`}table(e){let t="",n="";for(let i=0;i<e.header.length;i++)n+=this.tablecell(e.header[i]);t+=this.tablerow({text:n});let s="";for(let i=0;i<e.rows.length;i++){const r=e.rows[i];n="";for(let l=0;l<r.length;l++)n+=this.tablecell(r[l]);s+=this.tablerow({text:n})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
|
|
<thead>
|
|
`+t+`</thead>
|
|
`+s+`</table>
|
|
`}tablerow({text:e}){return`<tr>
|
|
${e}</tr>
|
|
`}tablecell(e){const t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${e}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){const s=this.parser.parseInline(n),i=Qt(e);if(i===null)return s;e=i;let r='<a href="'+e+'"';return t&&(r+=' title="'+t+'"'),r+=">"+s+"</a>",r}image({href:e,title:t,text:n}){const s=Qt(e);if(s===null)return n;e=s;let i=`<img src="${e}" alt="${n}"`;return t&&(i+=` title="${t}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):e.text}}class kt{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}}class G{constructor(e){E(this,"options");E(this,"renderer");E(this,"textRenderer");this.options=e||re,this.options.renderer=this.options.renderer||new He,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new kt}static parse(e,t){return new G(t).parse(e)}static parseInline(e,t){return new G(t).parseInline(e)}parse(e,t=!0){let n="";for(let s=0;s<e.length;s++){const i=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){const l=i,c=this.options.extensions.renderers[l.type].call({parser:this},l);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(l.type)){n+=c||"";continue}}const r=i;switch(r.type){case"space":{n+=this.renderer.space(r);continue}case"hr":{n+=this.renderer.hr(r);continue}case"heading":{n+=this.renderer.heading(r);continue}case"code":{n+=this.renderer.code(r);continue}case"table":{n+=this.renderer.table(r);continue}case"blockquote":{n+=this.renderer.blockquote(r);continue}case"list":{n+=this.renderer.list(r);continue}case"html":{n+=this.renderer.html(r);continue}case"paragraph":{n+=this.renderer.paragraph(r);continue}case"text":{let l=r,c=this.renderer.text(l);for(;s+1<e.length&&e[s+1].type==="text";)l=e[++s],c+=`
|
|
`+this.renderer.text(l);t?n+=this.renderer.paragraph({type:"paragraph",raw:c,text:c,tokens:[{type:"text",raw:c,text:c}]}):n+=c;continue}default:{const l='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let s=0;s<e.length;s++){const i=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){const l=this.options.extensions.renderers[i.type].call({parser:this},i);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=l||"";continue}}const r=i;switch(r.type){case"escape":{n+=t.text(r);break}case"html":{n+=t.html(r);break}case"link":{n+=t.link(r);break}case"image":{n+=t.image(r);break}case"strong":{n+=t.strong(r);break}case"em":{n+=t.em(r);break}case"codespan":{n+=t.codespan(r);break}case"br":{n+=t.br(r);break}case"del":{n+=t.del(r);break}case"text":{n+=t.text(r);break}default:{const l='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}}class Re{constructor(e){E(this,"options");E(this,"block");this.options=e||re}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?B.lex:B.lexInline}provideParser(){return this.block?G.parse:G.parseInline}}E(Re,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class Fi{constructor(...e){E(this,"defaults",pt());E(this,"options",this.setOptions);E(this,"parse",this.parseMarkdown(!0));E(this,"parseInline",this.parseMarkdown(!1));E(this,"Parser",G);E(this,"Renderer",He);E(this,"TextRenderer",kt);E(this,"Lexer",B);E(this,"Tokenizer",Ue);E(this,"Hooks",Re);this.use(...e)}walkTokens(e,t){var s,i;let n=[];for(const r of e)switch(n=n.concat(t.call(this,r)),r.type){case"table":{const l=r;for(const c of l.header)n=n.concat(this.walkTokens(c.tokens,t));for(const c of l.rows)for(const h of c)n=n.concat(this.walkTokens(h.tokens,t));break}case"list":{const l=r;n=n.concat(this.walkTokens(l.items,t));break}default:{const l=r;(i=(s=this.defaults.extensions)==null?void 0:s.childTokens)!=null&&i[l.type]?this.defaults.extensions.childTokens[l.type].forEach(c=>{const h=l[c].flat(1/0);n=n.concat(this.walkTokens(h,t))}):l.tokens&&(n=n.concat(this.walkTokens(l.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){const r=t.renderers[i.name];r?t.renderers[i.name]=function(...l){let c=i.renderer.apply(this,l);return c===!1&&(c=r.apply(this,l)),c}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const r=t[i.level];r?r.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]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),s.extensions=t),n.renderer){const i=this.defaults.renderer||new He(this.defaults);for(const r in n.renderer){if(!(r in i))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;const l=r,c=n.renderer[l],h=i[l];i[l]=(...p)=>{let m=c.apply(i,p);return m===!1&&(m=h.apply(i,p)),m||""}}s.renderer=i}if(n.tokenizer){const i=this.defaults.tokenizer||new Ue(this.defaults);for(const r in n.tokenizer){if(!(r in i))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;const l=r,c=n.tokenizer[l],h=i[l];i[l]=(...p)=>{let m=c.apply(i,p);return m===!1&&(m=h.apply(i,p)),m}}s.tokenizer=i}if(n.hooks){const i=this.defaults.hooks||new Re;for(const r in n.hooks){if(!(r in i))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;const l=r,c=n.hooks[l],h=i[l];Re.passThroughHooks.has(r)?i[l]=p=>{if(this.defaults.async)return Promise.resolve(c.call(i,p)).then(g=>h.call(i,g));const m=c.call(i,p);return h.call(i,m)}:i[l]=(...p)=>{let m=c.apply(i,p);return m===!1&&(m=h.apply(i,p)),m}}s.hooks=i}if(n.walkTokens){const i=this.defaults.walkTokens,r=n.walkTokens;s.walkTokens=function(l){let c=[];return c.push(r.call(this,l)),i&&(c=c.concat(i.call(this,l))),c}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return B.lex(e,t!=null?t:this.defaults)}parser(e,t){return G.parse(e,t!=null?t:this.defaults)}parseMarkdown(e){return(n,s)=>{const i={...s},r={...this.defaults,...i},l=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&i.async===!1)return l(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));r.hooks&&(r.hooks.options=r,r.hooks.block=e);const c=r.hooks?r.hooks.provideLexer():e?B.lex:B.lexInline,h=r.hooks?r.hooks.provideParser():e?G.parse:G.parseInline;if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(n):n).then(p=>c(p,r)).then(p=>r.hooks?r.hooks.processAllTokens(p):p).then(p=>r.walkTokens?Promise.all(this.walkTokens(p,r.walkTokens)).then(()=>p):p).then(p=>h(p,r)).then(p=>r.hooks?r.hooks.postprocess(p):p).catch(l);try{r.hooks&&(n=r.hooks.preprocess(n));let p=c(n,r);r.hooks&&(p=r.hooks.processAllTokens(p)),r.walkTokens&&this.walkTokens(p,r.walkTokens);let m=h(p,r);return r.hooks&&(m=r.hooks.postprocess(m)),m}catch(p){return l(p)}}}onError(e,t){return n=>{if(n.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,e){const s="<p>An error occurred:</p><pre>"+U(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}}const se=new Fi;function w(a,e){return se.parse(a,e)}w.options=w.setOptions=function(a){return se.setOptions(a),w.defaults=se.defaults,pn(w.defaults),w};w.getDefaults=pt;w.defaults=re;w.use=function(...a){return se.use(...a),w.defaults=se.defaults,pn(w.defaults),w};w.walkTokens=function(a,e){return se.walkTokens(a,e)};w.parseInline=se.parseInline;w.Parser=G;w.parser=G.parse;w.Renderer=He;w.TextRenderer=kt;w.Lexer=B;w.lexer=B.lex;w.Tokenizer=Ue;w.Hooks=Re;w.parse=w;w.options;w.setOptions;w.use;w.walkTokens;w.parseInline;G.parse;B.lex;/*! @license DOMPurify 3.1.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.7/LICENSE */const{entries:wn,setPrototypeOf:tn,isFrozen:Hi,getPrototypeOf:Bi,getOwnPropertyDescriptor:Gi}=Object;let{freeze:P,seal:W,create:Tn}=Object,{apply:ct,construct:ut}=typeof Reflect<"u"&&Reflect;P||(P=function(e){return e});W||(W=function(e){return e});ct||(ct=function(e,t,n){return e.apply(t,n)});ut||(ut=function(e,t){return new e(...t)});const Pe=F(Array.prototype.forEach),nn=F(Array.prototype.pop),_e=F(Array.prototype.push),ze=F(String.prototype.toLowerCase),it=F(String.prototype.toString),sn=F(String.prototype.match),we=F(String.prototype.replace),Wi=F(String.prototype.indexOf),ji=F(String.prototype.trim),Y=F(Object.prototype.hasOwnProperty),v=F(RegExp.prototype.test),Te=qi(TypeError);function F(a){return function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];return ct(a,e,n)}}function qi(a){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ut(a,t)}}function k(a,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ze;tn&&tn(a,null);let n=e.length;for(;n--;){let s=e[n];if(typeof s=="string"){const i=t(s);i!==s&&(Hi(e)||(e[n]=i),s=i)}a[s]=!0}return a}function Zi(a){for(let e=0;e<a.length;e++)Y(a,e)||(a[e]=null);return a}function ie(a){const e=Tn(null);for(const[t,n]of wn(a))Y(a,t)&&(Array.isArray(n)?e[t]=Zi(n):n&&typeof n=="object"&&n.constructor===Object?e[t]=ie(n):e[t]=n);return e}function Ee(a,e){for(;a!==null;){const n=Gi(a,e);if(n){if(n.get)return F(n.get);if(typeof n.value=="function")return F(n.value)}a=Bi(a)}function t(){return null}return t}const rn=P(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),st=P(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),rt=P(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Yi=P(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),ot=P(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Xi=P(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),on=P(["#text"]),ln=P(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),lt=P(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),an=P(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),$e=P(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Vi=W(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Qi=W(/<%[\w\W]*|[\w\W]*%>/gm),Ji=W(/\${[\w\W]*}/gm),Ki=W(/^data-[\-\w.\u00B7-\uFFFF]/),es=W(/^aria-[\-\w]+$/),En=W(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ts=W(/^(?:\w+script|data):/i),ns=W(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),yn=W(/^html$/i),is=W(/^[a-z][.\w]*(-[.\w]+)+$/i);var cn=Object.freeze({__proto__:null,MUSTACHE_EXPR:Vi,ERB_EXPR:Qi,TMPLIT_EXPR:Ji,DATA_ATTR:Ki,ARIA_ATTR:es,IS_ALLOWED_URI:En,IS_SCRIPT_OR_DATA:ts,ATTR_WHITESPACE:ns,DOCTYPE_NAME:yn,CUSTOM_ELEMENT:is});const ye={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},ss=function(){return typeof window>"u"?null:window},rs=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const s="data-tt-policy-suffix";t&&t.hasAttribute(s)&&(n=t.getAttribute(s));const i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}};function An(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ss();const e=d=>An(d);if(e.version="3.1.7",e.removed=[],!a||!a.document||a.document.nodeType!==ye.document)return e.isSupported=!1,e;let{document:t}=a;const n=t,s=n.currentScript,{DocumentFragment:i,HTMLTemplateElement:r,Node:l,Element:c,NodeFilter:h,NamedNodeMap:p=a.NamedNodeMap||a.MozNamedAttrMap,HTMLFormElement:m,DOMParser:g,trustedTypes:x}=a,b=c.prototype,_=Ee(b,"cloneNode"),O=Ee(b,"remove"),j=Ee(b,"nextSibling"),M=Ee(b,"childNodes"),X=Ee(b,"parentNode");if(typeof r=="function"){const d=t.createElement("template");d.content&&d.content.ownerDocument&&(t=d.content.ownerDocument)}let A,H="";const{implementation:z,createNodeIterator:te,createDocumentFragment:Rn,getElementsByTagName:Sn}=t,{importNode:Ln}=n;let V={};e.isSupported=typeof wn=="function"&&typeof X=="function"&&z&&z.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Ge,ERB_EXPR:We,TMPLIT_EXPR:je,DATA_ATTR:In,ARIA_ATTR:On,IS_SCRIPT_OR_DATA:Dn,ATTR_WHITESPACE:bt,CUSTOM_ELEMENT:Cn}=cn;let{IS_ALLOWED_URI:xt}=cn,S=null;const _t=k({},[...rn,...st,...rt,...ot,...on]);let L=null;const wt=k({},[...ln,...lt,...an,...$e]);let R=Object.seal(Tn(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),fe=null,qe=null,Tt=!0,Ze=!0,Et=!1,yt=!0,oe=!1,Ye=!0,ne=!1,Xe=!1,Ve=!1,le=!1,Ie=!1,Oe=!1,At=!0,Rt=!1;const Mn="user-content-";let Qe=!0,de=!1,ae={},ce=null;const St=k({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Lt=null;const It=k({},["audio","video","img","source","image","track"]);let Je=null;const Ot=k({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),De="http://www.w3.org/1998/Math/MathML",Ce="http://www.w3.org/2000/svg",K="http://www.w3.org/1999/xhtml";let ue=K,Ke=!1,et=null;const Nn=k({},[De,Ce,K],it);let me=null;const vn=["application/xhtml+xml","text/html"],Pn="text/html";let I=null,pe=null;const $n=t.createElement("form"),Dt=function(o){return o instanceof RegExp||o instanceof Function},tt=function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(pe&&pe===o)){if((!o||typeof o!="object")&&(o={}),o=ie(o),me=vn.indexOf(o.PARSER_MEDIA_TYPE)===-1?Pn:o.PARSER_MEDIA_TYPE,I=me==="application/xhtml+xml"?it:ze,S=Y(o,"ALLOWED_TAGS")?k({},o.ALLOWED_TAGS,I):_t,L=Y(o,"ALLOWED_ATTR")?k({},o.ALLOWED_ATTR,I):wt,et=Y(o,"ALLOWED_NAMESPACES")?k({},o.ALLOWED_NAMESPACES,it):Nn,Je=Y(o,"ADD_URI_SAFE_ATTR")?k(ie(Ot),o.ADD_URI_SAFE_ATTR,I):Ot,Lt=Y(o,"ADD_DATA_URI_TAGS")?k(ie(It),o.ADD_DATA_URI_TAGS,I):It,ce=Y(o,"FORBID_CONTENTS")?k({},o.FORBID_CONTENTS,I):St,fe=Y(o,"FORBID_TAGS")?k({},o.FORBID_TAGS,I):{},qe=Y(o,"FORBID_ATTR")?k({},o.FORBID_ATTR,I):{},ae=Y(o,"USE_PROFILES")?o.USE_PROFILES:!1,Tt=o.ALLOW_ARIA_ATTR!==!1,Ze=o.ALLOW_DATA_ATTR!==!1,Et=o.ALLOW_UNKNOWN_PROTOCOLS||!1,yt=o.ALLOW_SELF_CLOSE_IN_ATTR!==!1,oe=o.SAFE_FOR_TEMPLATES||!1,Ye=o.SAFE_FOR_XML!==!1,ne=o.WHOLE_DOCUMENT||!1,le=o.RETURN_DOM||!1,Ie=o.RETURN_DOM_FRAGMENT||!1,Oe=o.RETURN_TRUSTED_TYPE||!1,Ve=o.FORCE_BODY||!1,At=o.SANITIZE_DOM!==!1,Rt=o.SANITIZE_NAMED_PROPS||!1,Qe=o.KEEP_CONTENT!==!1,de=o.IN_PLACE||!1,xt=o.ALLOWED_URI_REGEXP||En,ue=o.NAMESPACE||K,R=o.CUSTOM_ELEMENT_HANDLING||{},o.CUSTOM_ELEMENT_HANDLING&&Dt(o.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(R.tagNameCheck=o.CUSTOM_ELEMENT_HANDLING.tagNameCheck),o.CUSTOM_ELEMENT_HANDLING&&Dt(o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(R.attributeNameCheck=o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),o.CUSTOM_ELEMENT_HANDLING&&typeof o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(R.allowCustomizedBuiltInElements=o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),oe&&(Ze=!1),Ie&&(le=!0),ae&&(S=k({},on),L=[],ae.html===!0&&(k(S,rn),k(L,ln)),ae.svg===!0&&(k(S,st),k(L,lt),k(L,$e)),ae.svgFilters===!0&&(k(S,rt),k(L,lt),k(L,$e)),ae.mathMl===!0&&(k(S,ot),k(L,an),k(L,$e))),o.ADD_TAGS&&(S===_t&&(S=ie(S)),k(S,o.ADD_TAGS,I)),o.ADD_ATTR&&(L===wt&&(L=ie(L)),k(L,o.ADD_ATTR,I)),o.ADD_URI_SAFE_ATTR&&k(Je,o.ADD_URI_SAFE_ATTR,I),o.FORBID_CONTENTS&&(ce===St&&(ce=ie(ce)),k(ce,o.FORBID_CONTENTS,I)),Qe&&(S["#text"]=!0),ne&&k(S,["html","head","body"]),S.table&&(k(S,["tbody"]),delete fe.tbody),o.TRUSTED_TYPES_POLICY){if(typeof o.TRUSTED_TYPES_POLICY.createHTML!="function")throw Te('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof o.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Te('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');A=o.TRUSTED_TYPES_POLICY,H=A.createHTML("")}else A===void 0&&(A=rs(x,s)),A!==null&&typeof H=="string"&&(H=A.createHTML(""));P&&P(o),pe=o}},Ct=k({},["mi","mo","mn","ms","mtext"]),Mt=k({},["annotation-xml"]),zn=k({},["title","style","font","a","script"]),Nt=k({},[...st,...rt,...Yi]),vt=k({},[...ot,...Xi]),Un=function(o){let u=X(o);(!u||!u.tagName)&&(u={namespaceURI:ue,tagName:"template"});const f=ze(o.tagName),y=ze(u.tagName);return et[o.namespaceURI]?o.namespaceURI===Ce?u.namespaceURI===K?f==="svg":u.namespaceURI===De?f==="svg"&&(y==="annotation-xml"||Ct[y]):Boolean(Nt[f]):o.namespaceURI===De?u.namespaceURI===K?f==="math":u.namespaceURI===Ce?f==="math"&&Mt[y]:Boolean(vt[f]):o.namespaceURI===K?u.namespaceURI===Ce&&!Mt[y]||u.namespaceURI===De&&!Ct[y]?!1:!vt[f]&&(zn[f]||!Nt[f]):!!(me==="application/xhtml+xml"&&et[o.namespaceURI]):!1},Q=function(o){_e(e.removed,{element:o});try{X(o).removeChild(o)}catch{O(o)}},Me=function(o,u){try{_e(e.removed,{attribute:u.getAttributeNode(o),from:u})}catch{_e(e.removed,{attribute:null,from:u})}if(u.removeAttribute(o),o==="is"&&!L[o])if(le||Ie)try{Q(u)}catch{}else try{u.setAttribute(o,"")}catch{}},Pt=function(o){let u=null,f=null;if(Ve)o="<remove></remove>"+o;else{const D=sn(o,/^[\r\n\t ]+/);f=D&&D[0]}me==="application/xhtml+xml"&&ue===K&&(o='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+o+"</body></html>");const y=A?A.createHTML(o):o;if(ue===K)try{u=new g().parseFromString(y,me)}catch{}if(!u||!u.documentElement){u=z.createDocument(ue,"template",null);try{u.documentElement.innerHTML=Ke?H:y}catch{}}const C=u.body||u.documentElement;return o&&f&&C.insertBefore(t.createTextNode(f),C.childNodes[0]||null),ue===K?Sn.call(u,ne?"html":"body")[0]:ne?u.documentElement:C},$t=function(o){return te.call(o.ownerDocument||o,o,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},zt=function(o){return o instanceof m&&(typeof o.nodeName!="string"||typeof o.textContent!="string"||typeof o.removeChild!="function"||!(o.attributes instanceof p)||typeof o.removeAttribute!="function"||typeof o.setAttribute!="function"||typeof o.namespaceURI!="string"||typeof o.insertBefore!="function"||typeof o.hasChildNodes!="function")},Ut=function(o){return typeof l=="function"&&o instanceof l},ee=function(o,u,f){!V[o]||Pe(V[o],y=>{y.call(e,u,f,pe)})},Ft=function(o){let u=null;if(ee("beforeSanitizeElements",o,null),zt(o))return Q(o),!0;const f=I(o.nodeName);if(ee("uponSanitizeElement",o,{tagName:f,allowedTags:S}),o.hasChildNodes()&&!Ut(o.firstElementChild)&&v(/<[/\w]/g,o.innerHTML)&&v(/<[/\w]/g,o.textContent)||o.nodeType===ye.progressingInstruction||Ye&&o.nodeType===ye.comment&&v(/<[/\w]/g,o.data))return Q(o),!0;if(!S[f]||fe[f]){if(!fe[f]&&Bt(f)&&(R.tagNameCheck instanceof RegExp&&v(R.tagNameCheck,f)||R.tagNameCheck instanceof Function&&R.tagNameCheck(f)))return!1;if(Qe&&!ce[f]){const y=X(o)||o.parentNode,C=M(o)||o.childNodes;if(C&&y){const D=C.length;for(let $=D-1;$>=0;--$){const J=_(C[$],!0);J.__removalCount=(o.__removalCount||0)+1,y.insertBefore(J,j(o))}}}return Q(o),!0}return o instanceof c&&!Un(o)||(f==="noscript"||f==="noembed"||f==="noframes")&&v(/<\/no(script|embed|frames)/i,o.innerHTML)?(Q(o),!0):(oe&&o.nodeType===ye.text&&(u=o.textContent,Pe([Ge,We,je],y=>{u=we(u,y," ")}),o.textContent!==u&&(_e(e.removed,{element:o.cloneNode()}),o.textContent=u)),ee("afterSanitizeElements",o,null),!1)},Ht=function(o,u,f){if(At&&(u==="id"||u==="name")&&(f in t||f in $n))return!1;if(!(Ze&&!qe[u]&&v(In,u))){if(!(Tt&&v(On,u))){if(!L[u]||qe[u]){if(!(Bt(o)&&(R.tagNameCheck instanceof RegExp&&v(R.tagNameCheck,o)||R.tagNameCheck instanceof Function&&R.tagNameCheck(o))&&(R.attributeNameCheck instanceof RegExp&&v(R.attributeNameCheck,u)||R.attributeNameCheck instanceof Function&&R.attributeNameCheck(u))||u==="is"&&R.allowCustomizedBuiltInElements&&(R.tagNameCheck instanceof RegExp&&v(R.tagNameCheck,f)||R.tagNameCheck instanceof Function&&R.tagNameCheck(f))))return!1}else if(!Je[u]){if(!v(xt,we(f,bt,""))){if(!((u==="src"||u==="xlink:href"||u==="href")&&o!=="script"&&Wi(f,"data:")===0&&Lt[o])){if(!(Et&&!v(Dn,we(f,bt,"")))){if(f)return!1}}}}}}return!0},Bt=function(o){return o!=="annotation-xml"&&sn(o,Cn)},Gt=function(o){ee("beforeSanitizeAttributes",o,null);const{attributes:u}=o;if(!u)return;const f={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:L};let y=u.length;for(;y--;){const C=u[y],{name:D,namespaceURI:$,value:J}=C,ge=I(D);let N=D==="value"?J:ji(J);if(f.attrName=ge,f.attrValue=N,f.keepAttr=!0,f.forceKeepAttr=void 0,ee("uponSanitizeAttribute",o,f),N=f.attrValue,f.forceKeepAttr||(Me(D,o),!f.keepAttr))continue;if(!yt&&v(/\/>/i,N)){Me(D,o);continue}oe&&Pe([Ge,We,je],jt=>{N=we(N,jt," ")});const Wt=I(o.nodeName);if(!!Ht(Wt,ge,N)){if(Rt&&(ge==="id"||ge==="name")&&(Me(D,o),N=Mn+N),Ye&&v(/((--!?|])>)|<\/(style|title)/i,N)){Me(D,o);continue}if(A&&typeof x=="object"&&typeof x.getAttributeType=="function"&&!$)switch(x.getAttributeType(Wt,ge)){case"TrustedHTML":{N=A.createHTML(N);break}case"TrustedScriptURL":{N=A.createScriptURL(N);break}}try{$?o.setAttributeNS($,D,N):o.setAttribute(D,N),zt(o)?Q(o):nn(e.removed)}catch{}}}ee("afterSanitizeAttributes",o,null)},Fn=function d(o){let u=null;const f=$t(o);for(ee("beforeSanitizeShadowDOM",o,null);u=f.nextNode();)ee("uponSanitizeShadowNode",u,null),!Ft(u)&&(u.content instanceof i&&d(u.content),Gt(u));ee("afterSanitizeShadowDOM",o,null)};return e.sanitize=function(d){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=null,f=null,y=null,C=null;if(Ke=!d,Ke&&(d="<!-->"),typeof d!="string"&&!Ut(d))if(typeof d.toString=="function"){if(d=d.toString(),typeof d!="string")throw Te("dirty is not a string, aborting")}else throw Te("toString is not a function");if(!e.isSupported)return d;if(Xe||tt(o),e.removed=[],typeof d=="string"&&(de=!1),de){if(d.nodeName){const J=I(d.nodeName);if(!S[J]||fe[J])throw Te("root node is forbidden and cannot be sanitized in-place")}}else if(d instanceof l)u=Pt("<!---->"),f=u.ownerDocument.importNode(d,!0),f.nodeType===ye.element&&f.nodeName==="BODY"||f.nodeName==="HTML"?u=f:u.appendChild(f);else{if(!le&&!oe&&!ne&&d.indexOf("<")===-1)return A&&Oe?A.createHTML(d):d;if(u=Pt(d),!u)return le?null:Oe?H:""}u&&Ve&&Q(u.firstChild);const D=$t(de?d:u);for(;y=D.nextNode();)Ft(y)||(y.content instanceof i&&Fn(y.content),Gt(y));if(de)return d;if(le){if(Ie)for(C=Rn.call(u.ownerDocument);u.firstChild;)C.appendChild(u.firstChild);else C=u;return(L.shadowroot||L.shadowrootmode)&&(C=Ln.call(n,C,!0)),C}let $=ne?u.outerHTML:u.innerHTML;return ne&&S["!doctype"]&&u.ownerDocument&&u.ownerDocument.doctype&&u.ownerDocument.doctype.name&&v(yn,u.ownerDocument.doctype.name)&&($="<!DOCTYPE "+u.ownerDocument.doctype.name+`>
|
|
`+$),oe&&Pe([Ge,We,je],J=>{$=we($,J," ")}),A&&Oe?A.createHTML($):$},e.setConfig=function(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};tt(d),Xe=!0},e.clearConfig=function(){pe=null,Xe=!1},e.isValidAttribute=function(d,o,u){pe||tt({});const f=I(d),y=I(o);return Ht(f,y,u)},e.addHook=function(d,o){typeof o=="function"&&(V[d]=V[d]||[],_e(V[d],o))},e.removeHook=function(d){if(V[d])return nn(V[d])},e.removeHooks=function(d){V[d]&&(V[d]=[])},e.removeAllHooks=function(){V={}},e}var un=An();const os={class:"container"},ls={name:"DIY"},as=qn({...ls,setup(a){const e=si(),{t}=Gn.exports.useI18n(),n=()=>{e.push({path:"/tool/flash",query:{url:"https://k5.vicicode.cn/diyapi/LOSEHU"+i.flag.join("")+".bin?v="+new Date().getTime()}})},s=()=>{fetch("https://k5.vicicode.cn/diyapi/LOSEHU"+i.flag.join("")+".bin?v="+new Date().getTime()).then(h=>h.blob()).then(h=>{const p=URL.createObjectURL(h),m=document.createElement("a");m.href=p,m.download="LOSEHU-CUSTOM-"+i.flag.join("")+".bin",document.body.appendChild(m),m.click(),document.body.removeChild(m)})},i=Zn({versions:[],flag:[],disMatrix:[],disName:[],showSort:[],readme:""});Yn(()=>[...i.flag],()=>{r()});const r=()=>{i.flag.map((h,p)=>{i.disMatrix[p].forEach((m,g)=>{i.versions.indexOf("LOSEHU"+i.flag.join("").substring(0,p)+g+i.flag.join("").substring(p+1)+".bin")==-1?i.disMatrix[p].set(g,!0):i.disMatrix[p].set(g,!1)})})},{loading:l,setLoading:c}=ri(!0);return Xn(async()=>{c(!0);let h=await(await fetch("https://k5.vicicode.cn/diyapi/function.json?v="+new Date().getTime())).text();h=JSON.parse(h);let p=[],m=[];h.map(_=>{p[_[_.length-1]-1]=_,m.push(_[_.length-1]-1)}),h=p;let g=[],x=[];h.map(_=>{let O=new Map,j=new Map;for(let M=_[0]*2+1;M<_[0]*3+1;M++)O.set(_[M],!1),t("idea.diy")!=="LOSEHU DIY"?j.set(_[M],_[M-_[0]-_[0]]):j.set(_[M],_[M-_[0]]);g.push(O),x.push(j)}),i.flag=new Array(h.length).fill("0"),i.disName=x,i.disMatrix=g,i.showSort=m;const b=await(await fetch("https://k5.vicicode.cn/diyapi/version.json?v="+new Date().getTime())).text();i.versions=JSON.parse(b),r(),c(!1),t("menu.dashboard")=="CPS"?i.readme=un.sanitize(await w.parse(await(await fetch("https://k5.vicicode.cn/diyapi/README_en.md?v="+new Date().getTime())).text())):i.readme=un.sanitize(await w.parse(await(await fetch("https://k5.vicicode.cn/diyapi/README.md?v="+new Date().getTime())).text())),i.readme=i.readme.replaceAll('href="./README_en.md"',""),i.readme=i.readme.replaceAll('href="./README.md"',""),i.readme=i.readme.replaceAll("losehu/uv-k5-firmware-chinese/blob/main/payment/show.png","losehu/uv-k5-firmware-chinese/blob/main/payment/show.png?raw=true"),i.readme=i.readme.replaceAll("/images/c1.JPG","https://github.com/losehu/uv-k5-firmware-custom/blob/main/images/c1.JPG?raw=true"),i.readme=i.readme.replaceAll("/images/c2.JPG","https://github.com/losehu/uv-k5-firmware-custom/blob/main/images/c2.JPG?raw=true"),i.readme=i.readme.replaceAll("/images/c3.JPG","https://github.com/losehu/uv-k5-firmware-custom/blob/main/images/c3.JPG?raw=true"),i.readme=i.readme.replaceAll("/images/c4.JPG","https://github.com/losehu/uv-k5-firmware-custom/blob/main/images/c4.JPG?raw=true"),i.readme=i.readme.replaceAll("a href",'a target="_blank" href')}),(h,p)=>{const m=Wn,g=oi,x=Vn,b=Kn,_=ei,O=ti,j=li,M=Qn,X=ni,A=ii;return ke(),nt("div",os,[q(m,{items:[h.$t("menu.workshop"),h.$t("idea.diy")]},null,8,["items"]),q(A,{gutter:20,align:"stretch"},{default:Z(()=>[q(X,{span:24},{default:Z(()=>[q(M,{class:"general-card",title:h.$t("idea.diy"),loading:Jn(l)},{default:Z(()=>[q(j,{direction:"vertical"},{default:Z(()=>[qt("div",null,[he(Ne(h.$t("oi")),1),q(g,{theme:"primary",href:"https://github.com/losehu/uv-k5-firmware-custom",target:"_blank"},{default:Z(()=>[he("https://github.com/losehu/uv-k5-firmware-custom")]),_:1})]),(ke(!0),nt(Zt,null,Yt(i.showSort,H=>(ke(),Xt(b,{modelValue:i.flag[H],"onUpdate:modelValue":z=>i.flag[H]=z,type:"button"},{default:Z(()=>[(ke(!0),nt(Zt,null,Yt(i.disMatrix[H],z=>(ke(),Xt(x,{value:z[0],disabled:z[1]},{default:Z(()=>[he(Ne(i.disName[H].get(z[0])),1)]),_:2},1032,["value","disabled"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"]))),256)),qt("div",null,[q(_,{type:"primary",onClick:n},{default:Z(()=>[he(Ne(h.$t("diy.generate")),1)]),_:1}),he("\xA0\xA0 "),q(O,{onClick:s},{default:Z(()=>[he(Ne(h.$t("global.download")),1)]),_:1})])]),_:1})]),_:1},8,["title","loading"])]),_:1})]),_:1}),q(A,{gutter:20,align:"stretch",style:{"margin-top":"10px"}},{default:Z(()=>[q(X,{span:24},{default:Z(()=>[q(M,{style:{padding:"20px"},class:"general-card readme",innerHTML:i.readme},null,8,["innerHTML"])]),_:1})]),_:1})])}}});const Ts=jn(as,[["__scopeId","data-v-2c3f2359"]]);export{Ts as default};
|