@runtypelabs/persona 4.7.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animations/glyph-cycle.cjs +2 -2
- package/dist/animations/glyph-cycle.d.cts +1 -1
- package/dist/animations/glyph-cycle.d.ts +1 -1
- package/dist/animations/glyph-cycle.js +2 -2
- package/dist/animations/{types-CSmiKRVa.d.cts → types-BsZtXPKK.d.cts} +43 -3
- package/dist/animations/{types-CSmiKRVa.d.ts → types-BsZtXPKK.d.ts} +43 -3
- package/dist/animations/wipe.cjs +2 -2
- package/dist/animations/wipe.d.cts +1 -1
- package/dist/animations/wipe.d.ts +1 -1
- package/dist/chunk-5EIIHQLQ.js +1 -0
- package/dist/codegen.cjs +12 -12
- package/dist/codegen.js +14 -14
- package/dist/index.cjs +91 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +877 -172
- package/dist/index.d.ts +877 -172
- package/dist/index.global.js +81 -57
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +91 -68
- package/dist/index.js.map +1 -1
- package/dist/install.global.js +1 -1
- package/dist/install.global.js.map +1 -1
- package/dist/launcher.global.js +3 -2
- package/dist/launcher.global.js.map +1 -1
- package/dist/markdown-parsers.js +24 -24
- package/dist/plugin-kit.cjs +1 -1
- package/dist/plugin-kit.js +1 -1
- package/dist/runtype-tts-entry-UJAEF7NZ.js +1 -0
- package/dist/runtype-tts.js +1 -1
- package/dist/session-reconnect-JKIJBHS5.js +1 -0
- package/dist/smart-dom-reader.cjs +17 -17
- package/dist/smart-dom-reader.d.cts +753 -15
- package/dist/smart-dom-reader.d.ts +753 -15
- package/dist/smart-dom-reader.js +17 -17
- package/dist/testing.cjs +3 -3
- package/dist/testing.js +3 -3
- package/dist/theme-editor-preview.cjs +81 -58
- package/dist/theme-editor-preview.d.cts +761 -15
- package/dist/theme-editor-preview.d.ts +761 -15
- package/dist/theme-editor-preview.js +81 -58
- package/dist/theme-editor.cjs +6 -6
- package/dist/theme-editor.d.cts +753 -15
- package/dist/theme-editor.d.ts +753 -15
- package/dist/theme-editor.js +10 -10
- package/dist/theme-reference.cjs +1 -1
- package/dist/theme-reference.d.cts +74 -0
- package/dist/theme-reference.d.ts +74 -0
- package/dist/theme-reference.js +1 -1
- package/dist/voice-worklet-player.cjs +2 -2
- package/dist/voice-worklet-player.js +2 -2
- package/dist/webmcp-polyfill.js +2 -2
- package/dist/widget.css +1 -1
- package/package.json +2 -3
- package/src/artifacts-session.test.ts +178 -0
- package/src/client.test.ts +186 -1
- package/src/client.ts +92 -9
- package/src/components/artifact-card.test.ts +333 -0
- package/src/components/artifact-card.ts +75 -28
- package/src/components/artifact-inline.test.ts +1328 -0
- package/src/components/artifact-inline.ts +920 -0
- package/src/components/artifact-pane.test.ts +1042 -0
- package/src/components/artifact-pane.ts +440 -131
- package/src/components/artifact-preview.test.ts +1155 -0
- package/src/components/artifact-preview.ts +994 -0
- package/src/components/pill-composer-builder.test.ts +6 -2
- package/src/components/pill-composer-builder.ts +6 -6
- package/src/components/reasoning-bubble.ts +1 -13
- package/src/components/registry.ts +38 -3
- package/src/components/tool-bubble.ts +1 -13
- package/src/defaults.ts +1 -0
- package/src/generated/runtype-openapi-contract.ts +55 -3
- package/src/index-core.ts +20 -1
- package/src/index.ts +8 -0
- package/src/markdown-parsers-loader.test.ts +158 -0
- package/src/markdown-parsers-loader.ts +74 -9
- package/src/runtime/host-layout.test.ts +163 -0
- package/src/runtime/host-layout.ts +110 -7
- package/src/runtime/init.ts +18 -61
- package/src/session.ts +76 -22
- package/src/styles/widget.css +773 -26
- package/src/theme-editor/preview.ts +2 -0
- package/src/theme-editor/sections.test.ts +26 -1
- package/src/theme-editor/sections.ts +10 -2
- package/src/theme-reference.ts +2 -2
- package/src/tool-call-display-defaults.test.ts +1 -0
- package/src/types/theme.ts +77 -0
- package/src/types.ts +516 -17
- package/src/ui.artifact-pane-gating.test.ts +636 -0
- package/src/ui.component-directive.test.ts +104 -0
- package/src/ui.composer-bar.test.ts +60 -2
- package/src/ui.detached-panel.test.ts +1049 -0
- package/src/ui.tool-display.test.ts +51 -0
- package/src/ui.ts +698 -109
- package/src/utils/artifact-custom-actions.ts +128 -0
- package/src/utils/artifact-display.test.ts +42 -0
- package/src/utils/artifact-display.ts +84 -0
- package/src/utils/artifact-file.test.ts +116 -0
- package/src/utils/artifact-file.ts +117 -0
- package/src/utils/artifact-gate.test.ts +112 -5
- package/src/utils/artifact-gate.ts +39 -14
- package/src/utils/artifact-loading-status.ts +55 -0
- package/src/utils/artifact-status-label.ts +190 -0
- package/src/utils/buttons.ts +7 -1
- package/src/utils/code-highlight.test.ts +186 -0
- package/src/utils/code-highlight.ts +400 -0
- package/src/utils/icons.ts +2 -0
- package/src/utils/roving-tablist.test.ts +152 -0
- package/src/utils/roving-tablist.ts +111 -0
- package/src/utils/spinner.ts +45 -0
- package/src/utils/theme.test.ts +48 -0
- package/src/utils/theme.ts +7 -0
- package/src/utils/tokens.ts +91 -0
- package/src/utils/tool-loading-animation.test.ts +32 -0
- package/src/utils/tool-loading-animation.ts +24 -0
- package/dist/chunk-DFBSCFYN.js +0 -1
- package/dist/runtype-tts-entry-HFUV2UF7.js +0 -1
- package/dist/session-reconnect-U77QFUR7.js +0 -1
package/dist/markdown-parsers.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
var bi=Object.defineProperty;var un=l=>{throw TypeError(l)};var _i=(l,e,t)=>e in l?bi(l,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[e]=t;var E=(l,e,t)=>_i(l,typeof e!="symbol"?e+"":e,t),xi=(l,e,t)=>e.has(l)||un("Cannot "+t);var pn=(l,e,t)=>e.has(l)?un("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(l):e.set(l,t);var Xe=(l,e,t)=>(xi(l,e,"access private method"),t);function wt(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var he=wt();function Tn(l){he=l}var kn=/[&<>"']/,yi=new RegExp(kn.source,"g"),bn=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,wi=new RegExp(bn.source,"g"),Ei={"&":"&","<":"<",">":">",'"':""","'":"'"},fn=l=>Ei[l];function G(l,e){if(e){if(kn.test(l))return l.replace(yi,fn)}else if(bn.test(l))return l.replace(wi,fn);return l}var Ai=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Si(l){return l.replace(Ai,(e,t)=>(t=t.toLowerCase(),t==="colon"?":":t.charAt(0)==="#"?t.charAt(1)==="x"?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}var Ri=/(^|[^\[])\^/g;function w(l,e){let t=typeof l=="string"?l:l.source;e=e||"";let n={replace:(
|
|
2
|
-
`).map(
|
|
1
|
+
var bi=Object.defineProperty;var un=l=>{throw TypeError(l)};var _i=(l,e,t)=>e in l?bi(l,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[e]=t;var E=(l,e,t)=>_i(l,typeof e!="symbol"?e+"":e,t),xi=(l,e,t)=>e.has(l)||un("Cannot "+t);var pn=(l,e,t)=>e.has(l)?un("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(l):e.set(l,t);var Xe=(l,e,t)=>(xi(l,e,"access private method"),t);function wt(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var he=wt();function Tn(l){he=l}var kn=/[&<>"']/,yi=new RegExp(kn.source,"g"),bn=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,wi=new RegExp(bn.source,"g"),Ei={"&":"&","<":"<",">":">",'"':""","'":"'"},fn=l=>Ei[l];function G(l,e){if(e){if(kn.test(l))return l.replace(yi,fn)}else if(bn.test(l))return l.replace(wi,fn);return l}var Ai=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Si(l){return l.replace(Ai,(e,t)=>(t=t.toLowerCase(),t==="colon"?":":t.charAt(0)==="#"?t.charAt(1)==="x"?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}var Ri=/(^|[^\[])\^/g;function w(l,e){let t=typeof l=="string"?l:l.source;e=e||"";let n={replace:(s,o)=>{let r=typeof o=="string"?o:o.source;return r=r.replace(Ri,"$1"),t=t.replace(s,r),n},getRegex:()=>new RegExp(t,e)};return n}function hn(l){try{l=encodeURI(l).replace(/%25/g,"%")}catch{return null}return l}var Ce={exec:()=>null};function dn(l,e){let t=l.replace(/\|/g,(o,r,c)=>{let u=!1,g=r;for(;--g>=0&&c[g]==="\\";)u=!u;return u?"|":" |"}),n=t.split(/ \|/),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 Ve(l,e,t){let n=l.length;if(n===0)return"";let s=0;for(;s<n;){let o=l.charAt(n-s-1);if(o===e&&!t)s++;else if(o!==e&&t)s++;else break}return l.slice(0,n-s)}function Ii(l,e){if(l.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<l.length;n++)if(l[n]==="\\")n++;else if(l[n]===e[0])t++;else if(l[n]===e[1]&&(t--,t<0))return n;return-1}function mn(l,e,t,n){let s=e.href,o=e.title?G(e.title):null,r=l[1].replace(/\\([\[\]])/g,"$1");if(l[0].charAt(0)!=="!"){n.state.inLink=!0;let c={type:"link",raw:t,href:s,title:o,text:r,tokens:n.inlineTokens(r)};return n.state.inLink=!1,c}return{type:"image",raw:t,href:s,title:o,text:G(r)}}function Oi(l,e){let t=l.match(/^(\s+)(?:```)/);if(t===null)return e;let n=t[1];return e.split(`
|
|
2
|
+
`).map(s=>{let o=s.match(/^\s+/);if(o===null)return s;let[r]=o;return r.length>=n.length?s.slice(n.length):s}).join(`
|
|
3
3
|
`)}var ye=class{constructor(e){E(this,"options");E(this,"rules");E(this,"lexer");this.options=e||he}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Ve(n,`
|
|
4
|
-
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],
|
|
4
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=Oi(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){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(/#$/.test(n)){let s=Ve(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){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
|
|
5
5
|
$1`);n=Ve(n.replace(/^ *>[ \t]?/gm,""),`
|
|
6
|
-
`);let
|
|
6
|
+
`);let s=this.lexer.state.top;this.lexer.state.top=!0;let o=this.lexer.blockTokens(n);return this.lexer.state.top=s,{type:"blockquote",raw:t[0],tokens:o,text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),s=n.length>1,o={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:"[*+-]");let r=new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),c="",u="",g=!1;for(;e;){let d=!1;if(!(t=r.exec(e))||this.rules.block.hr.test(e))break;c=t[0],e=e.substring(c.length);let T=t[2].split(`
|
|
7
7
|
`,1)[0].replace(/^\t+/,K=>" ".repeat(3*K.length)),m=e.split(`
|
|
8
8
|
`,1)[0],x=0;this.options.pedantic?(x=2,u=T.trimStart()):(x=t[2].search(/[^ ]/),x=x>4?1:x,u=T.slice(x),x+=t[1].length);let q=!1;if(!T&&/^ *$/.test(m)&&(c+=m+`
|
|
9
9
|
`,e=e.substring(m.length+1),d=!0),!d){let K=new RegExp(`^ {0,${Math.min(3,x-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),Se=new RegExp(`^ {0,${Math.min(3,x-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),me=new RegExp(`^ {0,${Math.min(3,x-1)}}(?:\`\`\`|~~~)`),z=new RegExp(`^ {0,${Math.min(3,x-1)}}#`);for(;e;){let W=e.split(`
|
|
10
10
|
`,1)[0];if(m=W,this.options.pedantic&&(m=m.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),me.test(m)||z.test(m)||K.test(m)||Se.test(e))break;if(m.search(/[^ ]/)>=x||!m.trim())u+=`
|
|
11
11
|
`+m.slice(x);else{if(q||T.search(/[^ ]/)>=4||me.test(T)||z.test(T)||Se.test(T))break;u+=`
|
|
12
12
|
`+m}!q&&!m.trim()&&(q=!0),c+=W+`
|
|
13
|
-
`,e=e.substring(W.length+1),T=m.slice(x)}}o.loose||(g?o.loose=!0:/\n *\n *$/.test(c)&&(g=!0));let H=null,B;this.options.gfm&&(H=/^\[[ xX]\] /.exec(u),H&&(B=H[0]!=="[ ] ",u=u.replace(/^\[[ xX]\] +/,""))),o.items.push({type:"list_item",raw:c,task:!!H,checked:B,loose:!1,text:u,tokens:[]}),o.raw+=c}o.items[o.items.length-1].raw=c.trimEnd(),o.items[o.items.length-1].text=u.trimEnd(),o.raw=o.raw.trimEnd();for(let d=0;d<o.items.length;d++)if(this.lexer.state.top=!1,o.items[d].tokens=this.lexer.blockTokens(o.items[d].text,[]),!o.loose){let T=o.items[d].tokens.filter(x=>x.type==="space"),m=T.length>0&&T.some(x=>/\n.*\n/.test(x.raw));o.loose=m}if(o.loose)for(let d=0;d<o.items.length;d++)o.items[d].loose=!0;return o}}html(e){let 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){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(/\s+/g," "),
|
|
14
|
-
`):[],
|
|
15
|
-
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let 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){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:G(t[1])}}tag(e){let 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){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;let
|
|
13
|
+
`,e=e.substring(W.length+1),T=m.slice(x)}}o.loose||(g?o.loose=!0:/\n *\n *$/.test(c)&&(g=!0));let H=null,B;this.options.gfm&&(H=/^\[[ xX]\] /.exec(u),H&&(B=H[0]!=="[ ] ",u=u.replace(/^\[[ xX]\] +/,""))),o.items.push({type:"list_item",raw:c,task:!!H,checked:B,loose:!1,text:u,tokens:[]}),o.raw+=c}o.items[o.items.length-1].raw=c.trimEnd(),o.items[o.items.length-1].text=u.trimEnd(),o.raw=o.raw.trimEnd();for(let d=0;d<o.items.length;d++)if(this.lexer.state.top=!1,o.items[d].tokens=this.lexer.blockTokens(o.items[d].text,[]),!o.loose){let T=o.items[d].tokens.filter(x=>x.type==="space"),m=T.length>0&&T.some(x=>/\n.*\n/.test(x.raw));o.loose=m}if(o.loose)for(let d=0;d<o.items.length;d++)o.items[d].loose=!0;return o}}html(e){let 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){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(/\s+/g," "),s=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=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:o}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;let n=dn(t[1]),s=t[2].replace(/^\||\| *$/g,"").split("|"),o=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
|
|
14
|
+
`):[],r={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(let c of s)/^ *-+: *$/.test(c)?r.align.push("right"):/^ *:-+: *$/.test(c)?r.align.push("center"):/^ *:-+ *$/.test(c)?r.align.push("left"):r.align.push(null);for(let c of n)r.header.push({text:c,tokens:this.lexer.inline(c)});for(let c of o)r.rows.push(dn(c,r.header.length).map(u=>({text:u,tokens:this.lexer.inline(u)})));return r}}lheading(e){let 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){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
|
|
15
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let 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){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:G(t[1])}}tag(e){let 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){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;let r=Ve(n.slice(0,-1),"\\");if((n.length-r.length)%2===0)return}else{let r=Ii(t[2],"()");if(r>-1){let u=(t[0].indexOf("!")===0?5:4)+t[1].length+r;t[2]=t[2].substring(0,r),t[0]=t[0].substring(0,u).trim(),t[3]=""}}let s=t[2],o="";if(this.options.pedantic){let r=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(s);r&&(s=r[1],o=r[3])}else o=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)),mn(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.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))){let s=(n[2]||n[1]).replace(/\s+/g," "),o=t[s.toLowerCase()];if(!o){let r=n[0].charAt(0);return{type:"text",raw:r,text:r}}return mn(n,o,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)){let r=[...s[0]].length-1,c,u,g=r,d=0,T=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(T.lastIndex=0,t=t.slice(-1*e.length+r);(s=T.exec(t))!=null;){if(c=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!c)continue;if(u=[...c].length,s[3]||s[4]){g+=u;continue}else if((s[5]||s[6])&&r%3&&!((r+u)%3)){d+=u;continue}if(g-=u,g>0)continue;u=Math.min(u,u+g+d);let m=[...s[0]][0].length,x=e.slice(0,r+s.index+m+u);if(Math.min(r,u)%2){let H=x.slice(1,-1);return{type:"em",raw:x,text:H,tokens:this.lexer.inlineTokens(H)}}let q=x.slice(2,-2);return{type:"strong",raw:x,text:q,tokens:this.lexer.inlineTokens(q)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(/\n/g," "),s=/[^ ]/.test(n),o=/^ /.test(n)&&/ $/.test(n);return s&&o&&(n=n.substring(1,n.length-1)),n=G(n,!0),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let 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){let t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=G(t[1]),s="mailto:"+n):(n=G(t[1]),s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,s;if(t[2]==="@")n=G(t[0]),s="mailto:"+n;else{let o;do o=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(o!==t[0]);n=G(t[0]),t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n;return this.lexer.state.inRawBlock?n=t[0]:n=G(t[0]),{type:"text",raw:t[0],text:n}}}},Ni=/^(?: *(?:\n|$))+/,Li=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,Di=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Pe=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ci=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,_n=/(?:[*+-]|\d{1,9}[.)])/,xn=w(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,_n).replace(/blockCode/g,/ {4}/).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(),Et=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Mi=/^[^\n]+/,At=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Pi=w(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",At).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),zi=w(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,_n).getRegex(),et="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",St=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,$i=w("^ {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",St).replace("tag",et).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),yn=w(Et).replace("hr",Pe).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",et).getRegex(),vi=w(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",yn).getRegex(),Rt={blockquote:vi,code:Li,def:Pi,fences:Di,heading:Ci,hr:Pe,html:$i,lheading:xn,list:zi,newline:Ni,paragraph:yn,table:Ce,text:Mi},gn=w("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Pe).replace("heading"," {0,3}#{1,6}(?:\\s|$)").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",et).getRegex(),Ui={...Rt,table:gn,paragraph:w(Et).replace("hr",Pe).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",gn).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",et).getRegex()},Fi={...Rt,html:w(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",St).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:Ce,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:w(Et).replace("hr",Pe).replace("heading",` *#{1,6} *[^
|
|
16
16
|
]`).replace("lheading",xn).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},wn=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Hi=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,En=/^( {2,}|\\)\n(?!\s*$)/,Bi=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ze="\\p{P}\\p{S}",Gi=w(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,ze).getRegex(),Wi=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,ji=w(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,ze).getRegex(),qi=w("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,ze).getRegex(),Yi=w("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,ze).getRegex(),Zi=w(/\\([punct])/,"gu").replace(/punct/g,ze).getRegex(),Xi=w(/^<(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(),Vi=w(St).replace("(?:-->|$)","-->").getRegex(),Qi=w("^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",Vi).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ke=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Ki=w(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Ke).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),An=w(/^!?\[(label)\]\[(ref)\]/).replace("label",Ke).replace("ref",At).getRegex(),Sn=w(/^!?\[(ref)\](?:\[\])?/).replace("ref",At).getRegex(),Ji=w("reflink|nolink(?!\\()","g").replace("reflink",An).replace("nolink",Sn).getRegex(),It={_backpedal:Ce,anyPunctuation:Zi,autolink:Xi,blockSkip:Wi,br:En,code:Hi,del:Ce,emStrongLDelim:ji,emStrongRDelimAst:qi,emStrongRDelimUnd:Yi,escape:wn,link:Ki,nolink:Sn,punctuation:Gi,reflink:An,reflinkSearch:Ji,tag:Qi,text:Bi,url:Ce},es={...It,link:w(/^!?\[(label)\]\((.*?)\)/).replace("label",Ke).getRegex(),reflink:w(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ke).getRegex()},xt={...It,escape:w(wn).replace("])","~|])").getRegex(),url:w(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},ts={...xt,br:w(En).replace("{2,}","*").getRegex(),text:w(xt.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Qe={normal:Rt,gfm:Ui,pedantic:Fi},De={normal:It,gfm:xt,breaks:ts,pedantic:es},ee=class l{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||he,this.options.tokenizer=this.options.tokenizer||new ye,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={block:Qe.normal,inline:De.normal};this.options.pedantic?(t.block=Qe.pedantic,t.inline=De.pedantic):this.options.gfm&&(t.block=Qe.gfm,this.options.breaks?t.inline=De.breaks:t.inline=De.gfm),this.tokenizer.rules=t}static get rules(){return{block:Qe,inline:De}}static lex(e,t){return new l(t).lex(e)}static lexInline(e,t){return new l(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
|
|
17
|
-
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[]){this.options.pedantic?e=e.replace(/\t/g," ").replace(/^ +$/gm,""):e=e.replace(/^( *)(\t+)/gm,(c,u,g)=>u+" ".repeat(g.length));let n,
|
|
18
|
-
`:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length),
|
|
19
|
-
`+n.raw,
|
|
20
|
-
`+n.text,this.inlineQueue[this.inlineQueue.length-1].src=
|
|
21
|
-
`+n.raw,
|
|
22
|
-
`+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=
|
|
23
|
-
`+n.raw,
|
|
24
|
-
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=
|
|
25
|
-
`+n.raw,
|
|
26
|
-
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=
|
|
27
|
-
`,
|
|
17
|
+
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[]){this.options.pedantic?e=e.replace(/\t/g," ").replace(/^ +$/gm,""):e=e.replace(/^( *)(\t+)/gm,(c,u,g)=>u+" ".repeat(g.length));let n,s,o,r;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(c=>(n=c.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length),n.raw.length===1&&t.length>0?t[t.length-1].raw+=`
|
|
18
|
+
`:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length),s=t[t.length-1],s&&(s.type==="paragraph"||s.type==="text")?(s.raw+=`
|
|
19
|
+
`+n.raw,s.text+=`
|
|
20
|
+
`+n.text,this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length),s=t[t.length-1],s&&(s.type==="paragraph"||s.type==="text")?(s.raw+=`
|
|
21
|
+
`+n.raw,s.text+=`
|
|
22
|
+
`+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=s.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(o=e,this.options.extensions&&this.options.extensions.startBlock){let c=1/0,u=e.slice(1),g;this.options.extensions.startBlock.forEach(d=>{g=d.call({lexer:this},u),typeof g=="number"&&g>=0&&(c=Math.min(c,g))}),c<1/0&&c>=0&&(o=e.substring(0,c+1))}if(this.state.top&&(n=this.tokenizer.paragraph(o))){s=t[t.length-1],r&&s.type==="paragraph"?(s.raw+=`
|
|
23
|
+
`+n.raw,s.text+=`
|
|
24
|
+
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n),r=o.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length),s=t[t.length-1],s&&s.type==="text"?(s.raw+=`
|
|
25
|
+
`+n.raw,s.text+=`
|
|
26
|
+
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,s,o,r=e,c,u,g;if(this.tokens.links){let d=Object.keys(this.tokens.links);if(d.length>0)for(;(c=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)d.includes(c[0].slice(c[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,c.index)+"["+"a".repeat(c[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(c=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,c.index)+"["+"a".repeat(c[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(c=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,c.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(u||(g=""),u=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(d=>(n=d.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,g)){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(o=e,this.options.extensions&&this.options.extensions.startInline){let d=1/0,T=e.slice(1),m;this.options.extensions.startInline.forEach(x=>{m=x.call({lexer:this},T),typeof m=="number"&&m>=0&&(d=Math.min(d,m))}),d<1/0&&d>=0&&(o=e.substring(0,d+1))}if(n=this.tokenizer.inlineText(o)){e=e.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(g=n.raw.slice(-1)),u=!0,s=t[t.length-1],s&&s.type==="text"?(s.raw+=n.raw,s.text+=n.text):t.push(n);continue}if(e){let d="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return t}},we=class{constructor(e){E(this,"options");this.options=e||he}code(e,t,n){let s=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+`
|
|
27
|
+
`,s?'<pre><code class="language-'+G(s)+'">'+(n?e:G(e,!0))+`</code></pre>
|
|
28
28
|
`:"<pre><code>"+(n?e:G(e,!0))+`</code></pre>
|
|
29
29
|
`}blockquote(e){return`<blockquote>
|
|
30
30
|
${e}</blockquote>
|
|
31
31
|
`}html(e,t){return e}heading(e,t,n){return`<h${t}>${e}</h${t}>
|
|
32
32
|
`}hr(){return`<hr>
|
|
33
|
-
`}list(e,t,n){let
|
|
34
|
-
`+e+"</"+
|
|
33
|
+
`}list(e,t,n){let s=t?"ol":"ul",o=t&&n!==1?' start="'+n+'"':"";return"<"+s+o+`>
|
|
34
|
+
`+e+"</"+s+`>
|
|
35
35
|
`}listitem(e,t,n){return`<li>${e}</li>
|
|
36
36
|
`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>
|
|
37
37
|
`}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),`<table>
|
|
@@ -41,10 +41,10 @@ ${e}</blockquote>
|
|
|
41
41
|
`}tablerow(e){return`<tr>
|
|
42
42
|
${e}</tr>
|
|
43
43
|
`}tablecell(e,t){let n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
|
|
44
|
-
`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){let
|
|
45
|
-
`+(
|
|
46
|
-
Please report this to https://github.com/markedjs/marked.`,e){let
|
|
47
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rs(l,e){return ns(l)||is(l,e)||os(l,e)||ss()}function os(l,e){if(l){if(typeof l=="string")return In(l,e);var t={}.toString.call(l).slice(8,-1);return t==="Object"&&l.constructor&&(t=l.constructor.name),t==="Map"||t==="Set"?Array.from(l):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?In(l,e):void 0}}var Bn=Object.entries,On=Object.setPrototypeOf,ls=Object.isFrozen,as=Object.getPrototypeOf,cs=Object.getOwnPropertyDescriptor,M=Object.freeze,P=Object.seal,Ae=Object.create,Gn=typeof Reflect!="undefined"&&Reflect,Mt=Gn.apply,Pt=Gn.construct;M||(M=function(e){return e});P||(P=function(e){return e});Mt||(Mt=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return e.apply(t,r)});Pt||(Pt=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)});var $e=N(Array.prototype.forEach),us=N(Array.prototype.lastIndexOf),Nn=N(Array.prototype.pop),Ee=N(Array.prototype.push),ps=N(Array.prototype.splice),oe=Array.isArray,Fe=N(String.prototype.toLowerCase),Ot=N(String.prototype.toString),Ln=N(String.prototype.match),ve=N(String.prototype.replace),Dn=N(String.prototype.indexOf),fs=N(String.prototype.trim),hs=N(Number.prototype.toString),ds=N(Boolean.prototype.toString),Cn=typeof BigInt=="undefined"?null:N(BigInt.prototype.toString),Mn=typeof Symbol=="undefined"?null:N(Symbol.prototype.toString),U=N(Object.prototype.hasOwnProperty),Ue=N(Object.prototype.toString),C=N(RegExp.prototype.test),de=ms(TypeError);function N(l){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Mt(l,e,n)}}function ms(l){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Pt(l,t)}}function b(l,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Fe;if(On&&On(l,null),!oe(e))return l;let n=e.length;for(;n--;){let r=e[n];if(typeof r=="string"){let o=t(r);o!==r&&(ls(e)||(e[n]=o),r=o)}l[r]=!0}return l}function gs(l){for(let e=0;e<l.length;e++)U(l,e)||(l[e]=null);return l}function v(l){let e=Ae(null);for(let n of Bn(l)){var t=rs(n,2);let r=t[0],o=t[1];U(l,r)&&(oe(o)?e[r]=gs(o):o&&typeof o=="object"&&o.constructor===Object?e[r]=v(o):e[r]=o)}return e}function Ts(l){switch(typeof l){case"string":return l;case"number":return hs(l);case"boolean":return ds(l);case"bigint":return Cn?Cn(l):"0";case"symbol":return Mn?Mn(l):"Symbol()";case"undefined":return Ue(l);case"function":case"object":{if(l===null)return Ue(l);let e=l,t=Q(e,"toString");if(typeof t=="function"){let n=t(e);return typeof n=="string"?n:Ue(n)}return Ue(l)}default:return Ue(l)}}function Q(l,e){for(;l!==null;){let n=cs(l,e);if(n){if(n.get)return N(n.get);if(typeof n.value=="function")return N(n.value)}l=as(l)}function t(){return null}return t}function ks(l){try{return C(l,""),!0}catch{return!1}}var Pn=M(["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","search","section","select","shadow","slot","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"]),Nt=M(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Lt=M(["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"]),bs=M(["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"]),Dt=M(["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"]),_s=M(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),zn=M(["#text"]),$n=M(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","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","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Ct=M(["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","mask-type","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"]),vn=M(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),tt=M(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),xs=P(/{{[\w\W]*|^[\w\W]*}}/g),ys=P(/<%[\w\W]*|^[\w\W]*%>/g),ws=P(/\${[\w\W]*/g),Es=P(/^data-[\-\w.\u00B7-\uFFFF]+$/),As=P(/^aria-[\-\w]+$/),Un=P(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ss=P(/^(?:\w+script|data):/i),Rs=P(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Is=P(/^html$/i),Os=P(/^[a-z][.\w]*(-[.\w]+)+$/i),Fn=P(/<[/\w!]/g),Ns=P(/<[/\w]/g),Ls=P(/<\/no(script|embed|frames)/i),Ds=P(/\/>/i),V={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Cs=function(){return typeof window=="undefined"?null:window},Ms=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null,r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Hn=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},re=function(e,t,n,r){return U(e,t)&&oe(e[t])?b(r.base?v(r.base):{},e[t],r.transform):n};function Wn(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Cs(),e=f=>Wn(f);if(e.version="3.4.10",e.removed=[],!l||!l.document||l.document.nodeType!==V.document||!l.Element)return e.isSupported=!1,e;let t=l.document,n=t,r=n.currentScript;l.DocumentFragment;let o=l.HTMLTemplateElement,s=l.Node,c=l.Element,u=l.NodeFilter,g=l.NamedNodeMap;g===void 0&&(l.NamedNodeMap||l.MozNamedAttrMap),l.HTMLFormElement;let d=l.DOMParser,T=l.trustedTypes,m=c.prototype,x=Q(m,"cloneNode"),q=Q(m,"remove"),H=Q(m,"nextSibling"),B=Q(m,"childNodes"),K=Q(m,"parentNode"),Se=Q(m,"shadowRoot"),me=Q(m,"attributes"),z=s&&s.prototype?Q(s.prototype,"nodeType"):null,W=s&&s.prototype?Q(s.prototype,"nodeName"):null;if(typeof o=="function"){let f=t.createElement("template");f.content&&f.content.ownerDocument&&(t=f.content.ownerDocument)}let F,le="",nt,zt=!1,Re=0,$t=function(){if(Re>0)throw de('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},ge=function(i){$t(),Re++;try{return F.createHTML(i)}finally{Re--}},jn=function(i){$t(),Re++;try{return F.createScriptURL(i)}finally{Re--}},qn=function(){return zt||(nt=Ms(T,r),zt=!0),nt},He=t,it=He.implementation,vt=He.createNodeIterator,Yn=He.createDocumentFragment,Zn=He.getElementsByTagName,Xn=n.importNode,L=Hn();e.isSupported=typeof Bn=="function"&&typeof K=="function"&&it&&it.createHTMLDocument!==void 0;let Vn=xs,Qn=ys,Kn=ws,Jn=Es,ei=As,ti=Ss,Ut=Rs,ni=Os,Ft=Un,R=null,st=b({},[...Pn,...Nt,...Lt,...Dt,...zn]),I=null,rt=b({},[...$n,...Ct,...vn,...tt]),A=Object.seal(Ae(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}})),Ie=null,Ht=null,ne=Object.seal(Ae(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Bt=!0,ot=!0,Gt=!1,Wt=!0,ie=!1,Oe=!0,ae=!1,lt=!1,at=!1,Te=!1,Be=!1,Ge=!1,jt=!0,qt=!1,Yt="user-content-",ct=!0,ut=!1,ke={},Z=null,pt=b({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]),Zt=null,Xt=b({},["audio","video","img","source","image","track"]),ft=null,Vt=b({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),We="http://www.w3.org/1998/Math/MathML",je="http://www.w3.org/2000/svg",X="http://www.w3.org/1999/xhtml",be=X,ht=!1,dt=null,ii=b({},[We,je,X],Ot),Qt=M(["mi","mo","mn","ms","mtext"]),mt=b({},Qt),Kt=M(["annotation-xml"]),gt=b({},Kt),si=b({},["title","style","font","a","script"]),Ne=null,ri=["application/xhtml+xml","text/html"],oi="text/html",S=null,_e=null,li=t.createElement("form"),Jt=function(i){return i instanceof RegExp||i instanceof Function},Tt=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(_e&&_e===i)return;(!i||typeof i!="object")&&(i={}),i=v(i),Ne=ri.indexOf(i.PARSER_MEDIA_TYPE)===-1?oi:i.PARSER_MEDIA_TYPE,S=Ne==="application/xhtml+xml"?Ot:Fe,R=re(i,"ALLOWED_TAGS",st,{transform:S}),I=re(i,"ALLOWED_ATTR",rt,{transform:S}),dt=re(i,"ALLOWED_NAMESPACES",ii,{transform:Ot}),ft=re(i,"ADD_URI_SAFE_ATTR",Vt,{transform:S,base:Vt}),Zt=re(i,"ADD_DATA_URI_TAGS",Xt,{transform:S,base:Xt}),Z=re(i,"FORBID_CONTENTS",pt,{transform:S}),Ie=re(i,"FORBID_TAGS",v({}),{transform:S}),Ht=re(i,"FORBID_ATTR",v({}),{transform:S}),ke=U(i,"USE_PROFILES")?i.USE_PROFILES&&typeof i.USE_PROFILES=="object"?v(i.USE_PROFILES):i.USE_PROFILES:!1,Bt=i.ALLOW_ARIA_ATTR!==!1,ot=i.ALLOW_DATA_ATTR!==!1,Gt=i.ALLOW_UNKNOWN_PROTOCOLS||!1,Wt=i.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ie=i.SAFE_FOR_TEMPLATES||!1,Oe=i.SAFE_FOR_XML!==!1,ae=i.WHOLE_DOCUMENT||!1,Te=i.RETURN_DOM||!1,Be=i.RETURN_DOM_FRAGMENT||!1,Ge=i.RETURN_TRUSTED_TYPE||!1,at=i.FORCE_BODY||!1,jt=i.SANITIZE_DOM!==!1,qt=i.SANITIZE_NAMED_PROPS||!1,ct=i.KEEP_CONTENT!==!1,ut=i.IN_PLACE||!1,Ft=ks(i.ALLOWED_URI_REGEXP)?i.ALLOWED_URI_REGEXP:Un,be=typeof i.NAMESPACE=="string"?i.NAMESPACE:X,mt=U(i,"MATHML_TEXT_INTEGRATION_POINTS")&&i.MATHML_TEXT_INTEGRATION_POINTS&&typeof i.MATHML_TEXT_INTEGRATION_POINTS=="object"?v(i.MATHML_TEXT_INTEGRATION_POINTS):b({},Qt),gt=U(i,"HTML_INTEGRATION_POINTS")&&i.HTML_INTEGRATION_POINTS&&typeof i.HTML_INTEGRATION_POINTS=="object"?v(i.HTML_INTEGRATION_POINTS):b({},Kt);let a=U(i,"CUSTOM_ELEMENT_HANDLING")&&i.CUSTOM_ELEMENT_HANDLING&&typeof i.CUSTOM_ELEMENT_HANDLING=="object"?v(i.CUSTOM_ELEMENT_HANDLING):Ae(null);if(A=Ae(null),U(a,"tagNameCheck")&&Jt(a.tagNameCheck)&&(A.tagNameCheck=a.tagNameCheck),U(a,"attributeNameCheck")&&Jt(a.attributeNameCheck)&&(A.attributeNameCheck=a.attributeNameCheck),U(a,"allowCustomizedBuiltInElements")&&typeof a.allowCustomizedBuiltInElements=="boolean"&&(A.allowCustomizedBuiltInElements=a.allowCustomizedBuiltInElements),P(A),ie&&(ot=!1),Be&&(Te=!0),ke&&(R=b({},zn),I=Ae(null),ke.html===!0&&(b(R,Pn),b(I,$n)),ke.svg===!0&&(b(R,Nt),b(I,Ct),b(I,tt)),ke.svgFilters===!0&&(b(R,Lt),b(I,Ct),b(I,tt)),ke.mathMl===!0&&(b(R,Dt),b(I,vn),b(I,tt))),ne.tagCheck=null,ne.attributeCheck=null,U(i,"ADD_TAGS")&&(typeof i.ADD_TAGS=="function"?ne.tagCheck=i.ADD_TAGS:oe(i.ADD_TAGS)&&(R===st&&(R=v(R)),b(R,i.ADD_TAGS,S))),U(i,"ADD_ATTR")&&(typeof i.ADD_ATTR=="function"?ne.attributeCheck=i.ADD_ATTR:oe(i.ADD_ATTR)&&(I===rt&&(I=v(I)),b(I,i.ADD_ATTR,S))),U(i,"ADD_URI_SAFE_ATTR")&&oe(i.ADD_URI_SAFE_ATTR)&&b(ft,i.ADD_URI_SAFE_ATTR,S),U(i,"FORBID_CONTENTS")&&oe(i.FORBID_CONTENTS)&&(Z===pt&&(Z=v(Z)),b(Z,i.FORBID_CONTENTS,S)),U(i,"ADD_FORBID_CONTENTS")&&oe(i.ADD_FORBID_CONTENTS)&&(Z===pt&&(Z=v(Z)),b(Z,i.ADD_FORBID_CONTENTS,S)),ct&&(R["#text"]=!0),ae&&b(R,["html","head","body"]),R.table&&(b(R,["tbody"]),delete Ie.tbody),i.TRUSTED_TYPES_POLICY){if(typeof i.TRUSTED_TYPES_POLICY.createHTML!="function")throw de('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof i.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw de('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let p=F;F=i.TRUSTED_TYPES_POLICY;try{le=ge("")}catch(h){throw F=p,h}}else i.TRUSTED_TYPES_POLICY===null?(F=void 0,le=""):(F===void 0&&(F=qn()),F&&typeof le=="string"&&(le=ge("")));(L.uponSanitizeElement.length>0||L.uponSanitizeAttribute.length>0)&&R===st&&(R=v(R)),L.uponSanitizeAttribute.length>0&&I===rt&&(I=v(I)),M&&M(i),_e=i},en=b({},[...Nt,...Lt,...bs]),tn=b({},[...Dt,..._s]),ai=function(i,a,p){return a.namespaceURI===X?i==="svg":a.namespaceURI===We?i==="svg"&&(p==="annotation-xml"||mt[p]):!!en[i]},ci=function(i,a,p){return a.namespaceURI===X?i==="math":a.namespaceURI===je?i==="math"&>[p]:!!tn[i]},ui=function(i,a,p){return a.namespaceURI===je&&!gt[p]||a.namespaceURI===We&&!mt[p]?!1:!tn[i]&&(si[i]||!en[i])},pi=function(i){let a=K(i);(!a||!a.tagName)&&(a={namespaceURI:be,tagName:"template"});let p=Fe(i.tagName),h=Fe(a.tagName);return dt[i.namespaceURI]?i.namespaceURI===je?ai(p,a,h):i.namespaceURI===We?ci(p,a,h):i.namespaceURI===X?ui(p,a,h):!!(Ne==="application/xhtml+xml"&&dt[i.namespaceURI]):!1},se=function(i){Ee(e.removed,{element:i});try{K(i).removeChild(i)}catch{if(q(i),!K(i))throw de("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},nn=function(i){let a=B(i);if(a){let h=[];$e(a,k=>{Ee(h,k)}),$e(h,k=>{try{q(k)}catch{}})}let p=me(i);if(p)for(let h=p.length-1;h>=0;--h){let k=p[h],_=k&&k.name;if(typeof _=="string")try{i.removeAttribute(_)}catch{}}},ce=function(i,a){try{Ee(e.removed,{attribute:a.getAttributeNode(i),from:a})}catch{Ee(e.removed,{attribute:null,from:a})}if(a.removeAttribute(i),i==="is")if(Te||Be)try{se(a)}catch{}else try{a.setAttribute(i,"")}catch{}},fi=function(i){let a=me(i);if(a)for(let p=a.length-1;p>=0;--p){let h=a[p],k=h&&h.name;if(!(typeof k!="string"||I[S(k)]))try{i.removeAttribute(k)}catch{}}},hi=function(i){let a=[i];for(;a.length>0;){let p=a.pop();(z?z(p):p.nodeType)===V.element&&fi(p);let k=B(p);if(k)for(let _=k.length-1;_>=0;--_)a.push(k[_])}},sn=function(i){let a=null,p=null;if(at)i="<remove></remove>"+i;else{let _=Ln(i,/^[\r\n\t ]+/);p=_&&_[0]}Ne==="application/xhtml+xml"&&be===X&&(i='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+i+"</body></html>");let h=F?ge(i):i;if(be===X)try{a=new d().parseFromString(h,Ne)}catch{}if(!a||!a.documentElement){a=it.createDocument(be,"template",null);try{a.documentElement.innerHTML=ht?le:h}catch{}}let k=a.body||a.documentElement;return i&&p&&k.insertBefore(t.createTextNode(p),k.childNodes[0]||null),be===X?Zn.call(a,ae?"html":"body")[0]:ae?a.documentElement:k},rn=function(i){return vt.call(i.ownerDocument||i,i,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},qe=function(i){return i=ve(i,Vn," "),i=ve(i,Qn," "),i=ve(i,Kn," "),i},kt=function(i){var a;i.normalize();let p=vt.call(i.ownerDocument||i,i,u.SHOW_TEXT|u.SHOW_COMMENT|u.SHOW_CDATA_SECTION|u.SHOW_PROCESSING_INSTRUCTION,null),h=p.nextNode();for(;h;)h.data=qe(h.data),h=p.nextNode();let k=(a=i.querySelectorAll)===null||a===void 0?void 0:a.call(i,"template");k&&$e(k,_=>{xe(_.content)&&kt(_.content)})},Ye=function(i){let a=W?W(i):null;return typeof a!="string"||S(a)!=="form"?!1:typeof i.nodeName!="string"||typeof i.textContent!="string"||typeof i.removeChild!="function"||i.attributes!==me(i)||typeof i.removeAttribute!="function"||typeof i.setAttribute!="function"||typeof i.namespaceURI!="string"||typeof i.insertBefore!="function"||typeof i.hasChildNodes!="function"||i.nodeType!==z(i)||i.childNodes!==B(i)},xe=function(i){if(!z||typeof i!="object"||i===null)return!1;try{return z(i)===V.documentFragment}catch{return!1}},Le=function(i){if(!z||typeof i!="object"||i===null)return!1;try{return typeof z(i)=="number"}catch{return!1}};function J(f,i,a){f.length!==0&&$e(f,p=>{p.call(e,i,a,_e)})}let di=function(i,a){return!!(Oe&&i.hasChildNodes()&&!Le(i.firstElementChild)&&C(Fn,i.textContent)&&C(Fn,i.innerHTML)||Oe&&i.namespaceURI===X&&a==="style"&&Le(i.firstElementChild)||i.nodeType===V.processingInstruction||Oe&&i.nodeType===V.comment&&C(Ns,i.data))},mi=function(i,a){if(!Ie[a]&&an(a)&&(A.tagNameCheck instanceof RegExp&&C(A.tagNameCheck,a)||A.tagNameCheck instanceof Function&&A.tagNameCheck(a)))return!1;if(ct&&!Z[a]){let p=K(i),h=B(i);if(h&&p){let k=h.length;for(let _=k-1;_>=0;--_){let D=ut?h[_]:x(h[_],!0);p.insertBefore(D,H(i))}}}return se(i),!0},on=function(i){if(J(L.beforeSanitizeElements,i,null),Ye(i))return se(i),!0;let a=S(W?W(i):i.nodeName);if(J(L.uponSanitizeElement,i,{tagName:a,allowedTags:R}),di(i,a))return se(i),!0;if(Ie[a]||!(ne.tagCheck instanceof Function&&ne.tagCheck(a))&&!R[a])return mi(i,a);if((z?z(i):i.nodeType)===V.element&&!pi(i)||(a==="noscript"||a==="noembed"||a==="noframes")&&C(Ls,i.innerHTML))return se(i),!0;if(ie&&i.nodeType===V.text){let h=qe(i.textContent);i.textContent!==h&&(Ee(e.removed,{element:i.cloneNode()}),i.textContent=h)}return J(L.afterSanitizeElements,i,null),!1},ln=function(i,a,p){if(Ht[a]||jt&&(a==="id"||a==="name")&&(p in t||p in li))return!1;let h=I[a]||ne.attributeCheck instanceof Function&&ne.attributeCheck(a,i);if(!(ot&&C(Jn,a))){if(!(Bt&&C(ei,a))){if(h){if(!ft[a]){if(!C(Ft,ve(p,Ut,""))){if(!((a==="src"||a==="xlink:href"||a==="href")&&i!=="script"&&Dn(p,"data:")===0&&Zt[i])){if(!(Gt&&!C(ti,ve(p,Ut,"")))){if(p)return!1}}}}}else if(!(an(i)&&(A.tagNameCheck instanceof RegExp&&C(A.tagNameCheck,i)||A.tagNameCheck instanceof Function&&A.tagNameCheck(i))&&(A.attributeNameCheck instanceof RegExp&&C(A.attributeNameCheck,a)||A.attributeNameCheck instanceof Function&&A.attributeNameCheck(a,i))||a==="is"&&A.allowCustomizedBuiltInElements&&(A.tagNameCheck instanceof RegExp&&C(A.tagNameCheck,p)||A.tagNameCheck instanceof Function&&A.tagNameCheck(p))))return!1}}return!0},gi=b({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),an=function(i){return!gi[Fe(i)]&&C(ni,i)},Ti=function(i,a,p,h){if(F&&typeof T=="object"&&typeof T.getAttributeType=="function"&&!p)switch(T.getAttributeType(i,a)){case"TrustedHTML":return ge(h);case"TrustedScriptURL":return jn(h)}return h},ki=function(i,a,p,h){try{p?i.setAttributeNS(p,a,h):i.setAttribute(a,h),Ye(i)?se(i):Nn(e.removed)}catch{ce(a,i)}},cn=function(i){J(L.beforeSanitizeAttributes,i,null);let a=i.attributes;if(!a||Ye(i))return;let p={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:I,forceKeepAttr:void 0},h=a.length,k=S(i.nodeName);for(;h--;){let _=a[h],D=_.name,O=_.namespaceURI,j=_.value,Y=S(D),_t=j,$=D==="value"?_t:fs(_t);if(p.attrName=Y,p.attrValue=$,p.keepAttr=!0,p.forceKeepAttr=void 0,J(L.uponSanitizeAttribute,i,p),$=p.attrValue,qt&&(Y==="id"||Y==="name")&&Dn($,Yt)!==0&&(ce(D,i),$=Yt+$),Oe&&C(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,$)){ce(D,i);continue}if(Y==="attributename"&&Ln($,"href")){ce(D,i);continue}if(!p.forceKeepAttr){if(!p.keepAttr){ce(D,i);continue}if(!Wt&&C(Ds,$)){ce(D,i);continue}if(ie&&($=qe($)),!ln(k,Y,$)){ce(D,i);continue}$=Ti(k,Y,O,$),$!==_t&&ki(i,D,O,$)}}J(L.afterSanitizeAttributes,i,null)},Ze=function(i){let a=null,p=rn(i);for(J(L.beforeSanitizeShadowDOM,i,null);a=p.nextNode();)if(J(L.uponSanitizeShadowNode,a,null),on(a),cn(a),xe(a.content)&&Ze(a.content),(z?z(a):a.nodeType)===V.element){let k=Se(a);xe(k)&&(bt(k),Ze(k))}J(L.afterSanitizeShadowDOM,i,null)},bt=function(i){let a=[{node:i,shadow:null}];for(;a.length>0;){let p=a.pop();if(p.shadow){Ze(p.shadow);continue}let h=p.node,_=(z?z(h):h.nodeType)===V.element,D=B(h);if(D)for(let O=D.length-1;O>=0;--O)a.push({node:D[O],shadow:null});if(_){let O=W?W(h):null;if(typeof O=="string"&&S(O)==="template"){let j=h.content;xe(j)&&a.push({node:j,shadow:null})}}if(_){let O=Se(h);xe(O)&&a.push({node:null,shadow:O},{node:O,shadow:null})}}};return e.sanitize=function(f){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=null,p=null,h=null,k=null;if(ht=!f,ht&&(f="<!-->"),typeof f!="string"&&!Le(f)&&(f=Ts(f),typeof f!="string"))throw de("dirty is not a string, aborting");if(!e.isSupported)return f;lt||Tt(i),e.removed=[];let _=ut&&typeof f!="string"&&Le(f);if(_){let j=W?W(f):f.nodeName;if(typeof j=="string"){let Y=S(j);if(!R[Y]||Ie[Y])throw de("root node is forbidden and cannot be sanitized in-place")}if(Ye(f))throw de("root node is clobbered and cannot be sanitized in-place");try{bt(f)}catch(Y){throw nn(f),Y}}else if(Le(f))a=sn("<!---->"),p=a.ownerDocument.importNode(f,!0),p.nodeType===V.element&&p.nodeName==="BODY"||p.nodeName==="HTML"?a=p:a.appendChild(p),bt(p);else{if(!Te&&!ie&&!ae&&f.indexOf("<")===-1)return F&&Ge?ge(f):f;if(a=sn(f),!a)return Te?null:Ge?le:""}a&&at&&se(a.firstChild);let D=rn(_?f:a);try{for(;h=D.nextNode();)on(h),cn(h),xe(h.content)&&Ze(h.content)}catch(j){throw _&&nn(f),j}if(_)return $e(e.removed,j=>{j.element&&hi(j.element)}),ie&&kt(f),f;if(Te){if(ie&&kt(a),Be)for(k=Yn.call(a.ownerDocument);a.firstChild;)k.appendChild(a.firstChild);else k=a;return(I.shadowroot||I.shadowrootmode)&&(k=Xn.call(n,k,!0)),k}let O=ae?a.outerHTML:a.innerHTML;return ae&&R["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&C(Is,a.ownerDocument.doctype.name)&&(O="<!DOCTYPE "+a.ownerDocument.doctype.name+`>
|
|
44
|
+
`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){let s=hn(e);if(s===null)return n;e=s;let o='<a href="'+e+'"';return t&&(o+=' title="'+t+'"'),o+=">"+n+"</a>",o}image(e,t,n){let s=hn(e);if(s===null)return n;e=s;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${t}"`),o+=">",o}text(e){return e}},Me=class{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}},te=class l{constructor(e){E(this,"options");E(this,"renderer");E(this,"textRenderer");this.options=e||he,this.options.renderer=this.options.renderer||new we,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Me}static parse(e,t){return new l(t).parse(e)}static parseInline(e,t){return new l(t).parseInline(e)}parse(e,t=!0){let n="";for(let s=0;s<e.length;s++){let o=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){let r=o,c=this.options.extensions.renderers[r.type].call({parser:this},r);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(r.type)){n+=c||"";continue}}switch(o.type){case"space":continue;case"hr":{n+=this.renderer.hr();continue}case"heading":{let r=o;n+=this.renderer.heading(this.parseInline(r.tokens),r.depth,Si(this.parseInline(r.tokens,this.textRenderer)));continue}case"code":{let r=o;n+=this.renderer.code(r.text,r.lang,!!r.escaped);continue}case"table":{let r=o,c="",u="";for(let d=0;d<r.header.length;d++)u+=this.renderer.tablecell(this.parseInline(r.header[d].tokens),{header:!0,align:r.align[d]});c+=this.renderer.tablerow(u);let g="";for(let d=0;d<r.rows.length;d++){let T=r.rows[d];u="";for(let m=0;m<T.length;m++)u+=this.renderer.tablecell(this.parseInline(T[m].tokens),{header:!1,align:r.align[m]});g+=this.renderer.tablerow(u)}n+=this.renderer.table(c,g);continue}case"blockquote":{let r=o,c=this.parse(r.tokens);n+=this.renderer.blockquote(c);continue}case"list":{let r=o,c=r.ordered,u=r.start,g=r.loose,d="";for(let T=0;T<r.items.length;T++){let m=r.items[T],x=m.checked,q=m.task,H="";if(m.task){let B=this.renderer.checkbox(!!x);g?m.tokens.length>0&&m.tokens[0].type==="paragraph"?(m.tokens[0].text=B+" "+m.tokens[0].text,m.tokens[0].tokens&&m.tokens[0].tokens.length>0&&m.tokens[0].tokens[0].type==="text"&&(m.tokens[0].tokens[0].text=B+" "+m.tokens[0].tokens[0].text)):m.tokens.unshift({type:"text",text:B+" "}):H+=B+" "}H+=this.parse(m.tokens,g),d+=this.renderer.listitem(H,q,!!x)}n+=this.renderer.list(d,c,u);continue}case"html":{let r=o;n+=this.renderer.html(r.text,r.block);continue}case"paragraph":{let r=o;n+=this.renderer.paragraph(this.parseInline(r.tokens));continue}case"text":{let r=o,c=r.tokens?this.parseInline(r.tokens):r.text;for(;s+1<e.length&&e[s+1].type==="text";)r=e[++s],c+=`
|
|
45
|
+
`+(r.tokens?this.parseInline(r.tokens):r.text);n+=t?this.renderer.paragraph(c):c;continue}default:{let r='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(r),"";throw new Error(r)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let s=0;s<e.length;s++){let o=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){let r=this.options.extensions.renderers[o.type].call({parser:this},o);if(r!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){n+=r||"";continue}}switch(o.type){case"escape":{let r=o;n+=t.text(r.text);break}case"html":{let r=o;n+=t.html(r.text);break}case"link":{let r=o;n+=t.link(r.href,r.title,this.parseInline(r.tokens,t));break}case"image":{let r=o;n+=t.image(r.href,r.title,r.text);break}case"strong":{let r=o;n+=t.strong(this.parseInline(r.tokens,t));break}case"em":{let r=o;n+=t.em(this.parseInline(r.tokens,t));break}case"codespan":{let r=o;n+=t.codespan(r.text);break}case"br":{n+=t.br();break}case"del":{let r=o;n+=t.del(this.parseInline(r.tokens,t));break}case"text":{let r=o;n+=t.text(r.text);break}default:{let r='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(r),"";throw new Error(r)}}}return n}},ue=class{constructor(e){E(this,"options");this.options=e||he}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}};E(ue,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));var fe,yt,Rn,Je=class{constructor(...e){pn(this,fe);E(this,"defaults",wt());E(this,"options",this.setOptions);E(this,"parse",Xe(this,fe,yt).call(this,ee.lex,te.parse));E(this,"parseInline",Xe(this,fe,yt).call(this,ee.lexInline,te.parseInline));E(this,"Parser",te);E(this,"Renderer",we);E(this,"TextRenderer",Me);E(this,"Lexer",ee);E(this,"Tokenizer",ye);E(this,"Hooks",ue);this.use(...e)}walkTokens(e,t){let n=[];for(let s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{let o=s;for(let r of o.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of o.rows)for(let c of r)n=n.concat(this.walkTokens(c.tokens,t));break}case"list":{let o=s;n=n.concat(this.walkTokens(o.items,t));break}default:{let o=s;this.defaults.extensions?.childTokens?.[o.type]?this.defaults.extensions.childTokens[o.type].forEach(r=>{let c=o[r].flat(1/0);n=n.concat(this.walkTokens(c,t))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let r=t.renderers[o.name];r?t.renderers[o.name]=function(...c){let u=o.renderer.apply(this,c);return u===!1&&(u=r.apply(this,c)),u}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let r=t[o.level];r?r.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),s.extensions=t),n.renderer){let o=this.defaults.renderer||new we(this.defaults);for(let r in n.renderer){if(!(r in o))throw new Error(`renderer '${r}' does not exist`);if(r==="options")continue;let c=r,u=n.renderer[c],g=o[c];o[c]=(...d)=>{let T=u.apply(o,d);return T===!1&&(T=g.apply(o,d)),T||""}}s.renderer=o}if(n.tokenizer){let o=this.defaults.tokenizer||new ye(this.defaults);for(let r in n.tokenizer){if(!(r in o))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let c=r,u=n.tokenizer[c],g=o[c];o[c]=(...d)=>{let T=u.apply(o,d);return T===!1&&(T=g.apply(o,d)),T}}s.tokenizer=o}if(n.hooks){let o=this.defaults.hooks||new ue;for(let r in n.hooks){if(!(r in o))throw new Error(`hook '${r}' does not exist`);if(r==="options")continue;let c=r,u=n.hooks[c],g=o[c];ue.passThroughHooks.has(r)?o[c]=d=>{if(this.defaults.async)return Promise.resolve(u.call(o,d)).then(m=>g.call(o,m));let T=u.call(o,d);return g.call(o,T)}:o[c]=(...d)=>{let T=u.apply(o,d);return T===!1&&(T=g.apply(o,d)),T}}s.hooks=o}if(n.walkTokens){let o=this.defaults.walkTokens,r=n.walkTokens;s.walkTokens=function(c){let u=[];return u.push(r.call(this,c)),o&&(u=u.concat(o.call(this,c))),u}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ee.lex(e,t??this.defaults)}parser(e,t){return te.parse(e,t??this.defaults)}};fe=new WeakSet,yt=function(e,t){return(n,s)=>{let o={...s},r={...this.defaults,...o};this.defaults.async===!0&&o.async===!1&&(r.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),r.async=!0);let c=Xe(this,fe,Rn).call(this,!!r.silent,!!r.async);if(typeof n>"u"||n===null)return c(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(r.hooks&&(r.hooks.options=r),r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(n):n).then(u=>e(u,r)).then(u=>r.hooks?r.hooks.processAllTokens(u):u).then(u=>r.walkTokens?Promise.all(this.walkTokens(u,r.walkTokens)).then(()=>u):u).then(u=>t(u,r)).then(u=>r.hooks?r.hooks.postprocess(u):u).catch(c);try{r.hooks&&(n=r.hooks.preprocess(n));let u=e(n,r);r.hooks&&(u=r.hooks.processAllTokens(u)),r.walkTokens&&this.walkTokens(u,r.walkTokens);let g=t(u,r);return r.hooks&&(g=r.hooks.postprocess(g)),g}catch(u){return c(u)}}},Rn=function(e,t){return n=>{if(n.message+=`
|
|
46
|
+
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+G(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}};var pe=new Je;function y(l,e){return pe.parse(l,e)}y.options=y.setOptions=function(l){return pe.setOptions(l),y.defaults=pe.defaults,Tn(y.defaults),y};y.getDefaults=wt;y.defaults=he;y.use=function(...l){return pe.use(...l),y.defaults=pe.defaults,Tn(y.defaults),y};y.walkTokens=function(l,e){return pe.walkTokens(l,e)};y.parseInline=pe.parseInline;y.Parser=te;y.parser=te.parse;y.Renderer=we;y.TextRenderer=Me;y.Lexer=ee;y.lexer=ee.lex;y.Tokenizer=ye;y.Hooks=ue;y.parse=y;var $s=y.options,vs=y.setOptions,Us=y.use,Fs=y.walkTokens,Hs=y.parseInline;var Bs=te.parse,Gs=ee.lex;function In(l,e){(e==null||e>l.length)&&(e=l.length);for(var t=0,n=Array(e);t<e;t++)n[t]=l[t];return n}function ns(l){if(Array.isArray(l))return l}function is(l,e){var t=l==null?null:typeof Symbol<"u"&&l[Symbol.iterator]||l["@@iterator"];if(t!=null){var n,s,o,r,c=[],u=!0,g=!1;try{if(o=(t=t.call(l)).next,e!==0)for(;!(u=(n=o.call(t)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(d){g=!0,s=d}finally{try{if(!u&&t.return!=null&&(r=t.return(),Object(r)!==r))return}finally{if(g)throw s}}return c}}function ss(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
47
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rs(l,e){return ns(l)||is(l,e)||os(l,e)||ss()}function os(l,e){if(l){if(typeof l=="string")return In(l,e);var t={}.toString.call(l).slice(8,-1);return t==="Object"&&l.constructor&&(t=l.constructor.name),t==="Map"||t==="Set"?Array.from(l):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?In(l,e):void 0}}var Bn=Object.entries,On=Object.setPrototypeOf,ls=Object.isFrozen,as=Object.getPrototypeOf,cs=Object.getOwnPropertyDescriptor,M=Object.freeze,P=Object.seal,Ae=Object.create,Gn=typeof Reflect<"u"&&Reflect,Mt=Gn.apply,Pt=Gn.construct;M||(M=function(e){return e});P||(P=function(e){return e});Mt||(Mt=function(e,t){for(var n=arguments.length,s=new Array(n>2?n-2:0),o=2;o<n;o++)s[o-2]=arguments[o];return e.apply(t,s)});Pt||(Pt=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 new e(...n)});var $e=N(Array.prototype.forEach),us=N(Array.prototype.lastIndexOf),Nn=N(Array.prototype.pop),Ee=N(Array.prototype.push),ps=N(Array.prototype.splice),oe=Array.isArray,Fe=N(String.prototype.toLowerCase),Ot=N(String.prototype.toString),Ln=N(String.prototype.match),ve=N(String.prototype.replace),Dn=N(String.prototype.indexOf),fs=N(String.prototype.trim),hs=N(Number.prototype.toString),ds=N(Boolean.prototype.toString),Cn=typeof BigInt>"u"?null:N(BigInt.prototype.toString),Mn=typeof Symbol>"u"?null:N(Symbol.prototype.toString),U=N(Object.prototype.hasOwnProperty),Ue=N(Object.prototype.toString),C=N(RegExp.prototype.test),de=ms(TypeError);function N(l){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];return Mt(l,e,n)}}function ms(l){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Pt(l,t)}}function b(l,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Fe;if(On&&On(l,null),!oe(e))return l;let n=e.length;for(;n--;){let s=e[n];if(typeof s=="string"){let o=t(s);o!==s&&(ls(e)||(e[n]=o),s=o)}l[s]=!0}return l}function gs(l){for(let e=0;e<l.length;e++)U(l,e)||(l[e]=null);return l}function v(l){let e=Ae(null);for(let n of Bn(l)){var t=rs(n,2);let s=t[0],o=t[1];U(l,s)&&(oe(o)?e[s]=gs(o):o&&typeof o=="object"&&o.constructor===Object?e[s]=v(o):e[s]=o)}return e}function Ts(l){switch(typeof l){case"string":return l;case"number":return hs(l);case"boolean":return ds(l);case"bigint":return Cn?Cn(l):"0";case"symbol":return Mn?Mn(l):"Symbol()";case"undefined":return Ue(l);case"function":case"object":{if(l===null)return Ue(l);let e=l,t=Q(e,"toString");if(typeof t=="function"){let n=t(e);return typeof n=="string"?n:Ue(n)}return Ue(l)}default:return Ue(l)}}function Q(l,e){for(;l!==null;){let n=cs(l,e);if(n){if(n.get)return N(n.get);if(typeof n.value=="function")return N(n.value)}l=as(l)}function t(){return null}return t}function ks(l){try{return C(l,""),!0}catch{return!1}}var Pn=M(["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","search","section","select","shadow","slot","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"]),Nt=M(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Lt=M(["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"]),bs=M(["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"]),Dt=M(["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"]),_s=M(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),zn=M(["#text"]),$n=M(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","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","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Ct=M(["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","mask-type","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"]),vn=M(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),tt=M(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),xs=P(/{{[\w\W]*|^[\w\W]*}}/g),ys=P(/<%[\w\W]*|^[\w\W]*%>/g),ws=P(/\${[\w\W]*/g),Es=P(/^data-[\-\w.\u00B7-\uFFFF]+$/),As=P(/^aria-[\-\w]+$/),Un=P(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ss=P(/^(?:\w+script|data):/i),Rs=P(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Is=P(/^html$/i),Os=P(/^[a-z][.\w]*(-[.\w]+)+$/i),Fn=P(/<[/\w!]/g),Ns=P(/<[/\w]/g),Ls=P(/<\/no(script|embed|frames)/i),Ds=P(/\/>/i),V={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Cs=function(){return typeof window>"u"?null:window},Ms=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null,s="data-tt-policy-suffix";t&&t.hasAttribute(s)&&(n=t.getAttribute(s));let o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Hn=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},re=function(e,t,n,s){return U(e,t)&&oe(e[t])?b(s.base?v(s.base):{},e[t],s.transform):n};function Wn(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Cs(),e=f=>Wn(f);if(e.version="3.4.10",e.removed=[],!l||!l.document||l.document.nodeType!==V.document||!l.Element)return e.isSupported=!1,e;let t=l.document,n=t,s=n.currentScript;l.DocumentFragment;let o=l.HTMLTemplateElement,r=l.Node,c=l.Element,u=l.NodeFilter,g=l.NamedNodeMap;g===void 0&&(l.NamedNodeMap||l.MozNamedAttrMap),l.HTMLFormElement;let d=l.DOMParser,T=l.trustedTypes,m=c.prototype,x=Q(m,"cloneNode"),q=Q(m,"remove"),H=Q(m,"nextSibling"),B=Q(m,"childNodes"),K=Q(m,"parentNode"),Se=Q(m,"shadowRoot"),me=Q(m,"attributes"),z=r&&r.prototype?Q(r.prototype,"nodeType"):null,W=r&&r.prototype?Q(r.prototype,"nodeName"):null;if(typeof o=="function"){let f=t.createElement("template");f.content&&f.content.ownerDocument&&(t=f.content.ownerDocument)}let F,le="",nt,zt=!1,Re=0,$t=function(){if(Re>0)throw de('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},ge=function(i){$t(),Re++;try{return F.createHTML(i)}finally{Re--}},jn=function(i){$t(),Re++;try{return F.createScriptURL(i)}finally{Re--}},qn=function(){return zt||(nt=Ms(T,s),zt=!0),nt},He=t,it=He.implementation,vt=He.createNodeIterator,Yn=He.createDocumentFragment,Zn=He.getElementsByTagName,Xn=n.importNode,L=Hn();e.isSupported=typeof Bn=="function"&&typeof K=="function"&&it&&it.createHTMLDocument!==void 0;let Vn=xs,Qn=ys,Kn=ws,Jn=Es,ei=As,ti=Ss,Ut=Rs,ni=Os,Ft=Un,R=null,st=b({},[...Pn,...Nt,...Lt,...Dt,...zn]),I=null,rt=b({},[...$n,...Ct,...vn,...tt]),A=Object.seal(Ae(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}})),Ie=null,Ht=null,ne=Object.seal(Ae(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Bt=!0,ot=!0,Gt=!1,Wt=!0,ie=!1,Oe=!0,ae=!1,lt=!1,at=!1,Te=!1,Be=!1,Ge=!1,jt=!0,qt=!1,Yt="user-content-",ct=!0,ut=!1,ke={},Z=null,pt=b({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]),Zt=null,Xt=b({},["audio","video","img","source","image","track"]),ft=null,Vt=b({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),We="http://www.w3.org/1998/Math/MathML",je="http://www.w3.org/2000/svg",X="http://www.w3.org/1999/xhtml",be=X,ht=!1,dt=null,ii=b({},[We,je,X],Ot),Qt=M(["mi","mo","mn","ms","mtext"]),mt=b({},Qt),Kt=M(["annotation-xml"]),gt=b({},Kt),si=b({},["title","style","font","a","script"]),Ne=null,ri=["application/xhtml+xml","text/html"],oi="text/html",S=null,_e=null,li=t.createElement("form"),Jt=function(i){return i instanceof RegExp||i instanceof Function},Tt=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(_e&&_e===i)return;(!i||typeof i!="object")&&(i={}),i=v(i),Ne=ri.indexOf(i.PARSER_MEDIA_TYPE)===-1?oi:i.PARSER_MEDIA_TYPE,S=Ne==="application/xhtml+xml"?Ot:Fe,R=re(i,"ALLOWED_TAGS",st,{transform:S}),I=re(i,"ALLOWED_ATTR",rt,{transform:S}),dt=re(i,"ALLOWED_NAMESPACES",ii,{transform:Ot}),ft=re(i,"ADD_URI_SAFE_ATTR",Vt,{transform:S,base:Vt}),Zt=re(i,"ADD_DATA_URI_TAGS",Xt,{transform:S,base:Xt}),Z=re(i,"FORBID_CONTENTS",pt,{transform:S}),Ie=re(i,"FORBID_TAGS",v({}),{transform:S}),Ht=re(i,"FORBID_ATTR",v({}),{transform:S}),ke=U(i,"USE_PROFILES")?i.USE_PROFILES&&typeof i.USE_PROFILES=="object"?v(i.USE_PROFILES):i.USE_PROFILES:!1,Bt=i.ALLOW_ARIA_ATTR!==!1,ot=i.ALLOW_DATA_ATTR!==!1,Gt=i.ALLOW_UNKNOWN_PROTOCOLS||!1,Wt=i.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ie=i.SAFE_FOR_TEMPLATES||!1,Oe=i.SAFE_FOR_XML!==!1,ae=i.WHOLE_DOCUMENT||!1,Te=i.RETURN_DOM||!1,Be=i.RETURN_DOM_FRAGMENT||!1,Ge=i.RETURN_TRUSTED_TYPE||!1,at=i.FORCE_BODY||!1,jt=i.SANITIZE_DOM!==!1,qt=i.SANITIZE_NAMED_PROPS||!1,ct=i.KEEP_CONTENT!==!1,ut=i.IN_PLACE||!1,Ft=ks(i.ALLOWED_URI_REGEXP)?i.ALLOWED_URI_REGEXP:Un,be=typeof i.NAMESPACE=="string"?i.NAMESPACE:X,mt=U(i,"MATHML_TEXT_INTEGRATION_POINTS")&&i.MATHML_TEXT_INTEGRATION_POINTS&&typeof i.MATHML_TEXT_INTEGRATION_POINTS=="object"?v(i.MATHML_TEXT_INTEGRATION_POINTS):b({},Qt),gt=U(i,"HTML_INTEGRATION_POINTS")&&i.HTML_INTEGRATION_POINTS&&typeof i.HTML_INTEGRATION_POINTS=="object"?v(i.HTML_INTEGRATION_POINTS):b({},Kt);let a=U(i,"CUSTOM_ELEMENT_HANDLING")&&i.CUSTOM_ELEMENT_HANDLING&&typeof i.CUSTOM_ELEMENT_HANDLING=="object"?v(i.CUSTOM_ELEMENT_HANDLING):Ae(null);if(A=Ae(null),U(a,"tagNameCheck")&&Jt(a.tagNameCheck)&&(A.tagNameCheck=a.tagNameCheck),U(a,"attributeNameCheck")&&Jt(a.attributeNameCheck)&&(A.attributeNameCheck=a.attributeNameCheck),U(a,"allowCustomizedBuiltInElements")&&typeof a.allowCustomizedBuiltInElements=="boolean"&&(A.allowCustomizedBuiltInElements=a.allowCustomizedBuiltInElements),P(A),ie&&(ot=!1),Be&&(Te=!0),ke&&(R=b({},zn),I=Ae(null),ke.html===!0&&(b(R,Pn),b(I,$n)),ke.svg===!0&&(b(R,Nt),b(I,Ct),b(I,tt)),ke.svgFilters===!0&&(b(R,Lt),b(I,Ct),b(I,tt)),ke.mathMl===!0&&(b(R,Dt),b(I,vn),b(I,tt))),ne.tagCheck=null,ne.attributeCheck=null,U(i,"ADD_TAGS")&&(typeof i.ADD_TAGS=="function"?ne.tagCheck=i.ADD_TAGS:oe(i.ADD_TAGS)&&(R===st&&(R=v(R)),b(R,i.ADD_TAGS,S))),U(i,"ADD_ATTR")&&(typeof i.ADD_ATTR=="function"?ne.attributeCheck=i.ADD_ATTR:oe(i.ADD_ATTR)&&(I===rt&&(I=v(I)),b(I,i.ADD_ATTR,S))),U(i,"ADD_URI_SAFE_ATTR")&&oe(i.ADD_URI_SAFE_ATTR)&&b(ft,i.ADD_URI_SAFE_ATTR,S),U(i,"FORBID_CONTENTS")&&oe(i.FORBID_CONTENTS)&&(Z===pt&&(Z=v(Z)),b(Z,i.FORBID_CONTENTS,S)),U(i,"ADD_FORBID_CONTENTS")&&oe(i.ADD_FORBID_CONTENTS)&&(Z===pt&&(Z=v(Z)),b(Z,i.ADD_FORBID_CONTENTS,S)),ct&&(R["#text"]=!0),ae&&b(R,["html","head","body"]),R.table&&(b(R,["tbody"]),delete Ie.tbody),i.TRUSTED_TYPES_POLICY){if(typeof i.TRUSTED_TYPES_POLICY.createHTML!="function")throw de('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof i.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw de('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let p=F;F=i.TRUSTED_TYPES_POLICY;try{le=ge("")}catch(h){throw F=p,h}}else i.TRUSTED_TYPES_POLICY===null?(F=void 0,le=""):(F===void 0&&(F=qn()),F&&typeof le=="string"&&(le=ge("")));(L.uponSanitizeElement.length>0||L.uponSanitizeAttribute.length>0)&&R===st&&(R=v(R)),L.uponSanitizeAttribute.length>0&&I===rt&&(I=v(I)),M&&M(i),_e=i},en=b({},[...Nt,...Lt,...bs]),tn=b({},[...Dt,..._s]),ai=function(i,a,p){return a.namespaceURI===X?i==="svg":a.namespaceURI===We?i==="svg"&&(p==="annotation-xml"||mt[p]):!!en[i]},ci=function(i,a,p){return a.namespaceURI===X?i==="math":a.namespaceURI===je?i==="math"&>[p]:!!tn[i]},ui=function(i,a,p){return a.namespaceURI===je&&!gt[p]||a.namespaceURI===We&&!mt[p]?!1:!tn[i]&&(si[i]||!en[i])},pi=function(i){let a=K(i);(!a||!a.tagName)&&(a={namespaceURI:be,tagName:"template"});let p=Fe(i.tagName),h=Fe(a.tagName);return dt[i.namespaceURI]?i.namespaceURI===je?ai(p,a,h):i.namespaceURI===We?ci(p,a,h):i.namespaceURI===X?ui(p,a,h):!!(Ne==="application/xhtml+xml"&&dt[i.namespaceURI]):!1},se=function(i){Ee(e.removed,{element:i});try{K(i).removeChild(i)}catch{if(q(i),!K(i))throw de("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},nn=function(i){let a=B(i);if(a){let h=[];$e(a,k=>{Ee(h,k)}),$e(h,k=>{try{q(k)}catch{}})}let p=me(i);if(p)for(let h=p.length-1;h>=0;--h){let k=p[h],_=k&&k.name;if(typeof _=="string")try{i.removeAttribute(_)}catch{}}},ce=function(i,a){try{Ee(e.removed,{attribute:a.getAttributeNode(i),from:a})}catch{Ee(e.removed,{attribute:null,from:a})}if(a.removeAttribute(i),i==="is")if(Te||Be)try{se(a)}catch{}else try{a.setAttribute(i,"")}catch{}},fi=function(i){let a=me(i);if(a)for(let p=a.length-1;p>=0;--p){let h=a[p],k=h&&h.name;if(!(typeof k!="string"||I[S(k)]))try{i.removeAttribute(k)}catch{}}},hi=function(i){let a=[i];for(;a.length>0;){let p=a.pop();(z?z(p):p.nodeType)===V.element&&fi(p);let k=B(p);if(k)for(let _=k.length-1;_>=0;--_)a.push(k[_])}},sn=function(i){let a=null,p=null;if(at)i="<remove></remove>"+i;else{let _=Ln(i,/^[\r\n\t ]+/);p=_&&_[0]}Ne==="application/xhtml+xml"&&be===X&&(i='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+i+"</body></html>");let h=F?ge(i):i;if(be===X)try{a=new d().parseFromString(h,Ne)}catch{}if(!a||!a.documentElement){a=it.createDocument(be,"template",null);try{a.documentElement.innerHTML=ht?le:h}catch{}}let k=a.body||a.documentElement;return i&&p&&k.insertBefore(t.createTextNode(p),k.childNodes[0]||null),be===X?Zn.call(a,ae?"html":"body")[0]:ae?a.documentElement:k},rn=function(i){return vt.call(i.ownerDocument||i,i,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},qe=function(i){return i=ve(i,Vn," "),i=ve(i,Qn," "),i=ve(i,Kn," "),i},kt=function(i){var a;i.normalize();let p=vt.call(i.ownerDocument||i,i,u.SHOW_TEXT|u.SHOW_COMMENT|u.SHOW_CDATA_SECTION|u.SHOW_PROCESSING_INSTRUCTION,null),h=p.nextNode();for(;h;)h.data=qe(h.data),h=p.nextNode();let k=(a=i.querySelectorAll)===null||a===void 0?void 0:a.call(i,"template");k&&$e(k,_=>{xe(_.content)&&kt(_.content)})},Ye=function(i){let a=W?W(i):null;return typeof a!="string"||S(a)!=="form"?!1:typeof i.nodeName!="string"||typeof i.textContent!="string"||typeof i.removeChild!="function"||i.attributes!==me(i)||typeof i.removeAttribute!="function"||typeof i.setAttribute!="function"||typeof i.namespaceURI!="string"||typeof i.insertBefore!="function"||typeof i.hasChildNodes!="function"||i.nodeType!==z(i)||i.childNodes!==B(i)},xe=function(i){if(!z||typeof i!="object"||i===null)return!1;try{return z(i)===V.documentFragment}catch{return!1}},Le=function(i){if(!z||typeof i!="object"||i===null)return!1;try{return typeof z(i)=="number"}catch{return!1}};function J(f,i,a){f.length!==0&&$e(f,p=>{p.call(e,i,a,_e)})}let di=function(i,a){return!!(Oe&&i.hasChildNodes()&&!Le(i.firstElementChild)&&C(Fn,i.textContent)&&C(Fn,i.innerHTML)||Oe&&i.namespaceURI===X&&a==="style"&&Le(i.firstElementChild)||i.nodeType===V.processingInstruction||Oe&&i.nodeType===V.comment&&C(Ns,i.data))},mi=function(i,a){if(!Ie[a]&&an(a)&&(A.tagNameCheck instanceof RegExp&&C(A.tagNameCheck,a)||A.tagNameCheck instanceof Function&&A.tagNameCheck(a)))return!1;if(ct&&!Z[a]){let p=K(i),h=B(i);if(h&&p){let k=h.length;for(let _=k-1;_>=0;--_){let D=ut?h[_]:x(h[_],!0);p.insertBefore(D,H(i))}}}return se(i),!0},on=function(i){if(J(L.beforeSanitizeElements,i,null),Ye(i))return se(i),!0;let a=S(W?W(i):i.nodeName);if(J(L.uponSanitizeElement,i,{tagName:a,allowedTags:R}),di(i,a))return se(i),!0;if(Ie[a]||!(ne.tagCheck instanceof Function&&ne.tagCheck(a))&&!R[a])return mi(i,a);if((z?z(i):i.nodeType)===V.element&&!pi(i)||(a==="noscript"||a==="noembed"||a==="noframes")&&C(Ls,i.innerHTML))return se(i),!0;if(ie&&i.nodeType===V.text){let h=qe(i.textContent);i.textContent!==h&&(Ee(e.removed,{element:i.cloneNode()}),i.textContent=h)}return J(L.afterSanitizeElements,i,null),!1},ln=function(i,a,p){if(Ht[a]||jt&&(a==="id"||a==="name")&&(p in t||p in li))return!1;let h=I[a]||ne.attributeCheck instanceof Function&&ne.attributeCheck(a,i);if(!(ot&&C(Jn,a))){if(!(Bt&&C(ei,a))){if(h){if(!ft[a]){if(!C(Ft,ve(p,Ut,""))){if(!((a==="src"||a==="xlink:href"||a==="href")&&i!=="script"&&Dn(p,"data:")===0&&Zt[i])){if(!(Gt&&!C(ti,ve(p,Ut,"")))){if(p)return!1}}}}}else if(!(an(i)&&(A.tagNameCheck instanceof RegExp&&C(A.tagNameCheck,i)||A.tagNameCheck instanceof Function&&A.tagNameCheck(i))&&(A.attributeNameCheck instanceof RegExp&&C(A.attributeNameCheck,a)||A.attributeNameCheck instanceof Function&&A.attributeNameCheck(a,i))||a==="is"&&A.allowCustomizedBuiltInElements&&(A.tagNameCheck instanceof RegExp&&C(A.tagNameCheck,p)||A.tagNameCheck instanceof Function&&A.tagNameCheck(p))))return!1}}return!0},gi=b({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),an=function(i){return!gi[Fe(i)]&&C(ni,i)},Ti=function(i,a,p,h){if(F&&typeof T=="object"&&typeof T.getAttributeType=="function"&&!p)switch(T.getAttributeType(i,a)){case"TrustedHTML":return ge(h);case"TrustedScriptURL":return jn(h)}return h},ki=function(i,a,p,h){try{p?i.setAttributeNS(p,a,h):i.setAttribute(a,h),Ye(i)?se(i):Nn(e.removed)}catch{ce(a,i)}},cn=function(i){J(L.beforeSanitizeAttributes,i,null);let a=i.attributes;if(!a||Ye(i))return;let p={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:I,forceKeepAttr:void 0},h=a.length,k=S(i.nodeName);for(;h--;){let _=a[h],D=_.name,O=_.namespaceURI,j=_.value,Y=S(D),_t=j,$=D==="value"?_t:fs(_t);if(p.attrName=Y,p.attrValue=$,p.keepAttr=!0,p.forceKeepAttr=void 0,J(L.uponSanitizeAttribute,i,p),$=p.attrValue,qt&&(Y==="id"||Y==="name")&&Dn($,Yt)!==0&&(ce(D,i),$=Yt+$),Oe&&C(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,$)){ce(D,i);continue}if(Y==="attributename"&&Ln($,"href")){ce(D,i);continue}if(!p.forceKeepAttr){if(!p.keepAttr){ce(D,i);continue}if(!Wt&&C(Ds,$)){ce(D,i);continue}if(ie&&($=qe($)),!ln(k,Y,$)){ce(D,i);continue}$=Ti(k,Y,O,$),$!==_t&&ki(i,D,O,$)}}J(L.afterSanitizeAttributes,i,null)},Ze=function(i){let a=null,p=rn(i);for(J(L.beforeSanitizeShadowDOM,i,null);a=p.nextNode();)if(J(L.uponSanitizeShadowNode,a,null),on(a),cn(a),xe(a.content)&&Ze(a.content),(z?z(a):a.nodeType)===V.element){let k=Se(a);xe(k)&&(bt(k),Ze(k))}J(L.afterSanitizeShadowDOM,i,null)},bt=function(i){let a=[{node:i,shadow:null}];for(;a.length>0;){let p=a.pop();if(p.shadow){Ze(p.shadow);continue}let h=p.node,_=(z?z(h):h.nodeType)===V.element,D=B(h);if(D)for(let O=D.length-1;O>=0;--O)a.push({node:D[O],shadow:null});if(_){let O=W?W(h):null;if(typeof O=="string"&&S(O)==="template"){let j=h.content;xe(j)&&a.push({node:j,shadow:null})}}if(_){let O=Se(h);xe(O)&&a.push({node:null,shadow:O},{node:O,shadow:null})}}};return e.sanitize=function(f){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=null,p=null,h=null,k=null;if(ht=!f,ht&&(f="<!-->"),typeof f!="string"&&!Le(f)&&(f=Ts(f),typeof f!="string"))throw de("dirty is not a string, aborting");if(!e.isSupported)return f;lt||Tt(i),e.removed=[];let _=ut&&typeof f!="string"&&Le(f);if(_){let j=W?W(f):f.nodeName;if(typeof j=="string"){let Y=S(j);if(!R[Y]||Ie[Y])throw de("root node is forbidden and cannot be sanitized in-place")}if(Ye(f))throw de("root node is clobbered and cannot be sanitized in-place");try{bt(f)}catch(Y){throw nn(f),Y}}else if(Le(f))a=sn("<!---->"),p=a.ownerDocument.importNode(f,!0),p.nodeType===V.element&&p.nodeName==="BODY"||p.nodeName==="HTML"?a=p:a.appendChild(p),bt(p);else{if(!Te&&!ie&&!ae&&f.indexOf("<")===-1)return F&&Ge?ge(f):f;if(a=sn(f),!a)return Te?null:Ge?le:""}a&&at&&se(a.firstChild);let D=rn(_?f:a);try{for(;h=D.nextNode();)on(h),cn(h),xe(h.content)&&Ze(h.content)}catch(j){throw _&&nn(f),j}if(_)return $e(e.removed,j=>{j.element&&hi(j.element)}),ie&&kt(f),f;if(Te){if(ie&&kt(a),Be)for(k=Yn.call(a.ownerDocument);a.firstChild;)k.appendChild(a.firstChild);else k=a;return(I.shadowroot||I.shadowrootmode)&&(k=Xn.call(n,k,!0)),k}let O=ae?a.outerHTML:a.innerHTML;return ae&&R["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&C(Is,a.ownerDocument.doctype.name)&&(O="<!DOCTYPE "+a.ownerDocument.doctype.name+`>
|
|
48
48
|
`+O),ie&&(O=qe(O)),F&&Ge?ge(O):O},e.setConfig=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Tt(f),lt=!0},e.clearConfig=function(){_e=null,lt=!1,F=nt,le=""},e.isValidAttribute=function(f,i,a){_e||Tt({});let p=S(f),h=S(i);return ln(p,h,a)},e.addHook=function(f,i){typeof i=="function"&&Ee(L[f],i)},e.removeHook=function(f,i){if(i!==void 0){let a=us(L[f],i);return a===-1?void 0:ps(L[f],a,1)[0]}return Nn(L[f])},e.removeHooks=function(f){L[f]=[]},e.removeAllHooks=function(){L=Hn()},e}var Ps=Wn();export{Ps as DOMPurify,Je as Marked};
|
|
49
49
|
/*! Bundled license information:
|
|
50
50
|
|
package/dist/plugin-kit.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var h=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var T=(t,e)=>{for(var o in e)h(t,o,{get:e[o],enumerable:!0})},C=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of L(e))!S.call(t,i)&&i!==o&&h(t,i,{get:()=>e[i],enumerable:!(n=P(e,i))||n.enumerable});return t};var H=t=>C(h({},"__esModule",{value:!0}),t);var z={};T(z,{createPopover:()=>N,getStyleRoot:()=>v,injectStyles:()=>M,isEditableEventTarget:()=>I});module.exports=H(z);function v(t){let e=t.getRootNode?.();return e instanceof ShadowRoot||e instanceof Document?e:t.ownerDocument??document}function m(t,e,o){let n=t instanceof Document?t.head:t,i=e.replace(/["\\]/g,"\\$&");if(n.querySelector(`style[data-persona-plugin-style="${i}"]`))return;let s=(t instanceof Document?t:t.ownerDocument??document).createElement("style");s.setAttribute("data-persona-plugin-style",e),s.textContent=o,n.appendChild(s)}function M(t,e,o){if(t instanceof Document||t instanceof ShadowRoot){m(t,e,o);return}let n=t;if(n.isConnected){m(v(n),e,o);return}let i=n.ownerDocument??document;m(i,e,o),queueMicrotask(()=>{let a=v(n);a!==i&&m(a,e,o)})}function O(t){let e=t.getRootNode?.();return e instanceof ShadowRoot?e:(t.ownerDocument??document).body}function N(t){let{anchor:e,content:o,placement:n="bottom-start",offset:i=6,matchAnchorWidth:a=!1,zIndex:s=2147483e3,onOpen:R,onDismiss:w}=t,x=t.container??O(e),c=!1,l=null,f=()=>{if(!c)return;let r=e.getBoundingClientRect();o.style.position="fixed",a&&(o.style.minWidth=`${r.width}px`);let p=n==="top-start"||n==="top-end"?r.top-i-o.getBoundingClientRect().height:r.bottom+i,d=n==="bottom-end"||n==="top-end"?r.right-o.getBoundingClientRect().width:r.left;o.style.top=`${p}px`,o.style.left=`${d}px`},u=()=>{c&&(c=!1,l&&(l(),l=null),o.remove())},g=()=>{if(c)return;c=!0,s!=null&&(o.style.zIndex=String(s)),x.appendChild(o),f();let r=(e.ownerDocument??document).defaultView??window,p=e.ownerDocument??document,d=()=>{if(!e.isConnected){u(),w?.("anchor-removed");return}f()},E=y=>{let D=typeof y.composedPath=="function"?y.composedPath():[];D.includes(o)||D.includes(e)||(u(),w?.("outside"))},b=r.setTimeout(()=>{p.addEventListener("pointerdown",E,!0)},0);r.addEventListener("scroll",d,!0),r.addEventListener("resize",d),l=()=>{r.clearTimeout(b),p.removeEventListener("pointerdown",E,!0),r.removeEventListener("scroll",d,!0),r.removeEventListener("resize",d)},R?.()};return{get isOpen(){return c},open:g,close:u,toggle:()=>c?u():g(),reposition:f,destroy:u}}function I(t){return(typeof t.composedPath=="function"?t.composedPath():[]).some(o=>o instanceof HTMLElement&&(o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.isContentEditable))}0&&(module.exports={createPopover,getStyleRoot,injectStyles,isEditableEventTarget});
|
package/dist/plugin-kit.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function y(e){let t=e.getRootNode?.();return t instanceof ShadowRoot||t instanceof Document?t:e.ownerDocument??document}function m(e,t,o){let n=e instanceof Document?e.head:e,r=t.replace(/["\\]/g,"\\$&");if(n.querySelector(`style[data-persona-plugin-style="${r}"]`))return;let s=(e instanceof Document?e:e.ownerDocument??document).createElement("style");s.setAttribute("data-persona-plugin-style",t),s.textContent=o,n.appendChild(s)}function P(e,t,o){if(e instanceof Document||e instanceof ShadowRoot){m(e,t,o);return}let n=e;if(n.isConnected){m(y(n),t,o);return}let r=n.ownerDocument??document;m(r,t,o),queueMicrotask(()=>{let a=y(n);a!==r&&m(a,t,o)})}function b(e){let t=e.getRootNode?.();return t instanceof ShadowRoot?t:(e.ownerDocument??document).body}function L(e){let{anchor:t,content:o,placement:n="bottom-start",offset:r=6,matchAnchorWidth:a=!1,zIndex:s=2147483e3,onOpen:D,onDismiss:h}=e,R=e.container??b(t),c=!1,l=null,f=()=>{if(!c)return;let i=t.getBoundingClientRect();o.style.position="fixed",a&&(o.style.minWidth=`${i.width}px`);let p=n==="top-start"||n==="top-end"?i.top-r-o.getBoundingClientRect().height:i.bottom+r,d=n==="bottom-end"||n==="top-end"?i.right-o.getBoundingClientRect().width:i.left;o.style.top=`${p}px`,o.style.left=`${d}px`},u=()=>{c&&(c=!1,l&&(l(),l=null),o.remove())},v=()=>{if(c)return;c=!0,s!=null&&(o.style.zIndex=String(s)),R.appendChild(o),f();let i=(t.ownerDocument??document).defaultView??window,p=t.ownerDocument??document,d=()=>{if(!t.isConnected){u(),h?.("anchor-removed");return}f()},w=g=>{let E=typeof g.composedPath=="function"?g.composedPath():[];E.includes(o)||E.includes(t)||(u(),h?.("outside"))},x=i.setTimeout(()=>{p.addEventListener("pointerdown",w,!0)},0);i.addEventListener("scroll",d,!0),i.addEventListener("resize",d),l=()=>{i.clearTimeout(x),p.removeEventListener("pointerdown",w,!0),i.removeEventListener("scroll",d,!0),i.removeEventListener("resize",d)},D?.()};return{get isOpen(){return c},open:v,close:u,toggle:()=>c?u():v(),reposition:f,destroy:u}}function S(e){return(typeof e.composedPath=="function"?e.composedPath():[]).some(o=>o instanceof HTMLElement&&(o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.isContentEditable))}export{L as createPopover,y as getStyleRoot,P as injectStyles,S as isEditableEventTarget};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as h}from"./chunk-5EIIHQLQ.js";function y(n){return n.replace(/\/+$/,"")}var p=class{constructor(e){this.opts=e;this.id="runtype-tts";this.supportsPause=!0;this.player=null;this.playerPromise=null;this.generation=0}ensurePlayer(){return this.playerPromise??(this.playerPromise=Promise.resolve(this.opts.createPlaybackEngine?this.opts.createPlaybackEngine():new h(24e3,{prebufferMs:this.opts.prebufferMs??200})).then(e=>this.player=e))}speak(e,r){let i=++this.generation;this.run(i,e,r)}async run(e,r,i){try{let t=await this.ensurePlayer();if(e!==this.generation)return;t.flush(),t.resume(),t.onStarted(()=>{e===this.generation&&i.onStart?.()}),t.onFinished(()=>{e===this.generation&&i.onEnd?.()});let a=`${y(this.opts.host)}/v1/agents/${encodeURIComponent(this.opts.agentId)}/speak`,o=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.opts.clientToken}`},body:JSON.stringify({text:r.text,voice:r.voice??this.opts.voice,format:"pcm"})});if(e!==this.generation)return;if(!o.ok||!o.body)throw new Error(await d(o));let l=o.body.getReader();for(;;){let{done:u,value:s}=await l.read();if(e!==this.generation){await l.cancel().catch(()=>{});return}if(u)break;s&&s.byteLength>0&&t.enqueue(s)}t.markStreamEnd()}catch(t){if(e!==this.generation)return;let a=t instanceof Error?t:new Error(String(t));this.opts.onError?.(a),i.onError?.(a)}}pause(){this.player?.pause()}resume(){this.player?.resume()}stop(){this.generation++,this.player?.flush()}destroy(){this.generation++,this.player?.destroy(),this.player=null,this.playerPromise=null}};async function d(n){try{let e=await n.json();return e.detail?`${e.error??`Runtype TTS ${n.status}`}: ${e.detail}`:e.error??`Runtype TTS request failed (${n.status})`}catch{return`Runtype TTS request failed (${n.status})`}}var c=class{constructor(e,r,i={}){this.primary=e;this.fallback=r;this.options=i;this.id="fallback";this.active=e}get supportsPause(){return this.active.supportsPause}speak(e,r){this.active=this.primary;let i=!1;this.primary.speak(e,{onStart:()=>{i=!0,r.onStart?.()},onEnd:()=>r.onEnd?.(),onError:t=>{if(i){r.onError?.(t);return}this.options.onFallback?.(t),this.active=this.fallback,this.fallback.speak(e,r)}})}pause(){this.active.pause()}resume(){this.active.resume()}stop(){this.active.stop()}destroy(){this.primary.destroy?.(),this.fallback.destroy?.()}};export{c as FallbackSpeechEngine,p as RuntypeSpeechEngine};
|
package/dist/runtype-tts.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var h=class{constructor(e=24e3,t={}){this.ctx=null;this.nextStartTime=0;this.activeSources=[];this.finishedCallbacks=[];this.startedCallbacks=[];this.playing=!1;this.streamEnded=!1;this.pendingCount=0;this.started=!1;this.userPaused=!1;this.pendingBuffers=[];this.pendingSamples=0;this.remainder=null;this.sampleRate=e;let r=Math.max(0,t.prebufferMs??0);this.waterlineSamples=Math.round(e*r/1e3),this.buffering=this.waterlineSamples>0}ensureContext(){if(!this.ctx){let t=typeof window<"u"?window:void 0;if(!t)throw new Error("AudioPlaybackManager requires a browser environment");let r=t.AudioContext||t.webkitAudioContext;this.ctx=new r({sampleRate:this.sampleRate})}let e=this.ctx;return e.state==="suspended"&&!this.userPaused&&e.resume(),e}enqueue(e){if(e.length===0)return;let t=e;if(this.remainder){let i=new Uint8Array(this.remainder.length+e.length);i.set(this.remainder),i.set(e,this.remainder.length),t=i,this.remainder=null}if(t.length%2!==0&&(this.remainder=new Uint8Array([t[t.length-1]]),t=t.subarray(0,t.length-1)),t.length===0)return;let r=this.pcmToFloat32(t);r.length!==0&&(this.buffering?(this.pendingBuffers.push(r),this.pendingSamples+=r.length,this.pendingSamples>=this.waterlineSamples&&this.releaseBuffer()):this.scheduleSamples(r))}markStreamEnd(){this.pendingBuffers.length>0&&this.releaseBuffer(),this.streamEnded=!0,this.checkFinished()}flush(){for(let e of this.activeSources)try{e.stop(),e.disconnect()}catch{}this.activeSources=[],this.pendingCount=0,this.nextStartTime=0,this.playing=!1,this.streamEnded=!1,this.finishedCallbacks=[],this.startedCallbacks=[],this.remainder=null,this.pendingBuffers=[],this.pendingSamples=0,this.buffering=this.waterlineSamples>0,this.started=!1}isPlaying(){return this.playing}onFinished(e){this.finishedCallbacks.push(e)}onStarted(e){this.startedCallbacks.push(e)}pause(){this.userPaused=!0,this.ctx&&this.ctx.state==="running"&&this.ctx.suspend()}resume(){this.userPaused=!1,this.ctx&&this.ctx.state==="suspended"&&this.ctx.resume()}async destroy(){this.flush(),this.ctx&&(await this.ctx.close(),this.ctx=null)}releaseBuffer(){this.buffering=!1;let e=this.pendingBuffers;this.pendingBuffers=[],this.pendingSamples=0;for(let t of e)this.scheduleSamples(t)}scheduleSamples(e){if(e.length===0)return;let t=this.ensureContext(),r=t.createBuffer(1,e.length,this.sampleRate);r.getChannelData(0).set(e);let i=t.createBufferSource();i.buffer=r,i.connect(t.destination);let s=t.currentTime;if(this.nextStartTime===0?this.nextStartTime=s:this.nextStartTime<s&&(this.nextStartTime=s,this.waterlineSamples>0&&(this.buffering=!0)),i.start(this.nextStartTime),this.nextStartTime+=r.duration,this.activeSources.push(i),this.pendingCount++,this.playing=!0,!this.started){this.started=!0;let n=this.startedCallbacks.slice();this.startedCallbacks=[];for(let o of n)o()}i.onended=()=>{let n=this.activeSources.indexOf(i);n!==-1&&this.activeSources.splice(n,1),this.pendingCount--,this.checkFinished()}}checkFinished(){if(this.streamEnded&&this.pendingCount<=0&&this.pendingBuffers.length===0){this.playing=!1,this.streamEnded=!1;let e=this.finishedCallbacks.slice();this.finishedCallbacks=[];for(let t of e)t()}}pcmToFloat32(e){let t=Math.floor(e.length/2),r=new Float32Array(t),i=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let s=0;s<t;s++){let n=i.getInt16(s*2,!0);r[s]=n/32768}return r}};function d(a){return a.replace(/\/+$/,"")}var p=class{constructor(e){this.opts=e;this.id="runtype-tts";this.supportsPause=!0;this.player=null;this.playerPromise=null;this.generation=0}ensurePlayer(){return this.playerPromise??(this.playerPromise=Promise.resolve(this.opts.createPlaybackEngine?this.opts.createPlaybackEngine():new h(24e3,{prebufferMs:this.opts.prebufferMs??200})).then(e=>this.player=e))}speak(e,t){let r=++this.generation;this.run(r,e,t)}async run(e,t,r){try{let i=await this.ensurePlayer();if(e!==this.generation)return;i.flush(),i.resume(),i.onStarted(()=>{e===this.generation&&r.onStart?.()}),i.onFinished(()=>{e===this.generation&&r.onEnd?.()});let s=`${d(this.opts.host)}/v1/agents/${encodeURIComponent(this.opts.agentId)}/speak`,n=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.opts.clientToken}`},body:JSON.stringify({text:t.text,voice:t.voice??this.opts.voice,format:"pcm"})});if(e!==this.generation)return;if(!n.ok||!n.body)throw new Error(await f(n));let o=n.body.getReader();for(;;){let{done:u,value:l}=await o.read();if(e!==this.generation){await o.cancel().catch(()=>{});return}if(u)break;l&&l.byteLength>0&&i.enqueue(l)}i.markStreamEnd()}catch(i){if(e!==this.generation)return;let s=i instanceof Error?i:new Error(String(i));this.opts.onError?.(s),r.onError?.(s)}}pause(){this.player?.pause()}resume(){this.player?.resume()}stop(){this.generation++,this.player?.flush()}destroy(){this.generation++,this.player?.destroy(),this.player=null,this.playerPromise=null}};async function f(a){try{let e=await a.json();return e.detail?`${e.error??`Runtype TTS ${a.status}`}: ${e.detail}`:e.error??`Runtype TTS request failed (${a.status})`}catch{return`Runtype TTS request failed (${a.status})`}}var c=class{constructor(e,t,r={}){this.primary=e;this.fallback=t;this.options=r;this.id="fallback";this.active=e}get supportsPause(){return this.active.supportsPause}speak(e,t){this.active=this.primary;let r=!1;this.primary.speak(e,{onStart:()=>{r=!0,t.onStart?.()},onEnd:()=>t.onEnd?.(),onError:i=>{if(r){t.onError?.(i);return}this.options.onFallback?.(i),this.active=this.fallback,this.fallback.speak(e,t)}})}pause(){this.active.pause()}resume(){this.active.resume()}stop(){this.active.stop()}destroy(){this.primary.destroy?.(),this.fallback.destroy?.()}};export{c as FallbackSpeechEngine,p as RuntypeSpeechEngine};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var M=[1e3,2e3,4e3,8e3,8e3];function E(e){let t=0,r=null,s=null,c=!1,f=()=>{if(s&&(clearTimeout(s),s=null),r){let n=r;r=null,n()}},m=()=>{let n=e.getStatus();n!=="resuming"&&n!=="paused"||f()},b=()=>{typeof document<"u"&&document.visibilityState==="hidden"||m()},v=()=>{m()},p=()=>{c||(typeof document<"u"&&document.addEventListener("visibilitychange",b),typeof window<"u"&&window.addEventListener("online",v),c=!0)},g=()=>{c&&(typeof document<"u"&&document.removeEventListener("visibilitychange",b),typeof window<"u"&&window.removeEventListener("online",v),c=!1)},R=n=>new Promise(o=>{r=o,s=setTimeout(()=>{s=null,r=null,o()},n)}),y=()=>{let n=e.getResumable();e.clearResumable(),e.setReconnecting(!1),t=0,g(),e.setAbortController(null);let o=!1;for(let i of e.getMessages())i.streaming&&(i.streaming=!1,o=!0);let l=e.buildErrorContent("Connection lost and the response could not be resumed.");l?e.appendMessage({id:`reconnect-failed-${n?.executionId??e.nextSequence()}`,role:"assistant",content:l,createdAt:new Date().toISOString(),streaming:!1,sequence:e.nextSequence()}):o&&e.notifyMessagesChanged(),e.setStreaming(!1),e.setStatus("idle"),e.onError(new Error("Durable session reconnect failed."))},S=async()=>{let n=e.config.reconnect?.backoffMs??M,o=e.config.reconnect?.maxAttempts??n.length,l=e.config.reconnectStream;if(!l){e.setReconnecting(!1);return}for(;e.getResumable()&&t<o;){t+=1,e.setStatus("resuming");let i=e.getResumable(),w=i.lastEventId,d=new AbortController;e.setAbortController(d),e.emitReconnect({phase:"resuming",handle:i,attempt:t});let u=null;try{let a=await l({executionId:i.executionId,after:i.lastEventId,signal:d.signal});a&&a.ok&&a.body&&(u=a.body)}catch{u=null}if(d.signal.aborted)return;if(u){let a=e.getMessages().find(C=>C.id===i.assistantMessageId)?.content,A=typeof a=="string"?a:"";try{await e.resumeConnect(u,i.assistantMessageId,A)}catch{}if(d.signal.aborted)return;if(!e.getResumable()){e.setReconnecting(!1),t=0,g(),e.emitReconnect({phase:"resumed",handle:i});return}e.getResumable().lastEventId!==w&&(t=0)}if(e.getResumable()&&t<o&&(e.setStatus("paused"),await R(n[Math.min(t-1,n.length-1)]??1e3),d.signal.aborted))return}e.getResumable()&&y()};return{begin(){t=0,p(),S()},teardown(){s&&(clearTimeout(s),s=null),r=null,t=0,g()},wake:f}}export{E as createReconnectController};
|