@runtypelabs/persona 3.34.1 → 3.36.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/README.md +11 -11
- package/dist/animations/glyph-cycle.d.cts +1 -1
- package/dist/animations/glyph-cycle.d.ts +1 -1
- package/dist/animations/{types-CthJFfNx.d.cts → types-DgYsuwXL.d.cts} +15 -14
- package/dist/animations/{types-CthJFfNx.d.ts → types-DgYsuwXL.d.ts} +15 -14
- package/dist/animations/wipe.d.cts +1 -1
- package/dist/animations/wipe.d.ts +1 -1
- package/dist/codegen.cjs +11 -11
- package/dist/codegen.js +10 -10
- package/dist/index.cjs +46 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +514 -158
- package/dist/index.d.ts +514 -158
- package/dist/index.global.js +41 -89
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +46 -44
- 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 +2 -2
- package/dist/launcher.global.js.map +1 -1
- package/dist/markdown-parsers.js +53 -0
- package/dist/plugin-kit.d.cts +4 -4
- package/dist/plugin-kit.d.ts +4 -4
- package/dist/runtype-tts.js +1 -0
- package/dist/smart-dom-reader.cjs +1 -1
- package/dist/smart-dom-reader.d.cts +352 -103
- package/dist/smart-dom-reader.d.ts +352 -103
- package/dist/smart-dom-reader.js +1 -1
- package/dist/theme-editor-preview.cjs +203 -0
- package/dist/theme-editor-preview.d.cts +5748 -0
- package/dist/theme-editor-preview.d.ts +5748 -0
- package/dist/theme-editor-preview.js +203 -0
- package/dist/theme-editor.cjs +14 -131
- package/dist/theme-editor.d.cts +362 -574
- package/dist/theme-editor.d.ts +362 -574
- package/dist/theme-editor.js +14 -131
- package/dist/theme-reference.cjs +1 -1
- package/dist/theme-reference.d.cts +1 -1
- package/dist/theme-reference.d.ts +1 -1
- package/dist/theme-reference.js +1 -1
- package/dist/voice-worklet-player.cjs +80 -0
- package/dist/voice-worklet-player.d.cts +215 -0
- package/dist/voice-worklet-player.d.ts +215 -0
- package/dist/voice-worklet-player.js +80 -0
- package/dist/widget.css +54 -36
- package/package.json +16 -2
- package/src/animations/glyph-cycle.ts +11 -14
- package/src/animations/wipe.ts +1 -1
- package/src/ask-user-question-tool.test.ts +1 -1
- package/src/ask-user-question-tool.ts +6 -8
- package/src/client.test.ts +56 -12
- package/src/client.ts +35 -31
- package/src/codegen.test.ts +1 -1
- package/src/codegen.ts +1 -1
- package/src/components/approval-bubble.test.ts +1 -1
- package/src/components/approval-bubble.ts +3 -3
- package/src/components/artifact-pane.ts +3 -3
- package/src/components/ask-user-question-bubble.test.ts +14 -14
- package/src/components/ask-user-question-bubble.ts +10 -10
- package/src/components/composer-builder.ts +17 -16
- package/src/components/composer-parts.test.ts +54 -0
- package/src/components/composer-parts.ts +95 -126
- package/src/components/demo-carousel.ts +1 -1
- package/src/components/event-stream-view.test.ts +7 -7
- package/src/components/event-stream-view.ts +5 -5
- package/src/components/header-builder.ts +33 -27
- package/src/components/header-layouts.ts +1 -1
- package/src/components/header-parts.test.ts +90 -0
- package/src/components/header-parts.ts +62 -93
- package/src/components/launcher.test.ts +11 -0
- package/src/components/launcher.ts +1 -1
- package/src/components/message-bubble.test.ts +74 -2
- package/src/components/message-bubble.ts +25 -11
- package/src/components/messages.ts +2 -2
- package/src/components/panel.test.ts +1 -1
- package/src/components/panel.ts +92 -97
- package/src/components/pill-composer-builder.ts +28 -24
- package/src/components/reasoning-bubble.ts +2 -2
- package/src/components/suggestions.ts +1 -1
- package/src/components/tool-bubble.ts +1 -1
- package/src/components/widget-view.test.ts +181 -0
- package/src/components/widget-view.ts +234 -0
- package/src/defaults.ts +54 -51
- package/src/generated/runtype-openapi-contract.ts +5 -0
- package/src/index-core.ts +30 -4
- package/src/index-global.ts +73 -6
- package/src/index.ts +7 -1
- package/src/install.test.ts +11 -11
- package/src/install.ts +28 -18
- package/src/launcher-global.ts +25 -14
- package/src/markdown-parsers-eager.ts +20 -0
- package/src/markdown-parsers-entry.ts +4 -0
- package/src/markdown-parsers-loader.ts +49 -0
- package/src/plugin-kit.test.ts +1 -1
- package/src/plugin-kit.ts +7 -7
- package/src/plugins/types.ts +5 -5
- package/src/postprocessors.ts +27 -14
- package/src/runtime/host-layout.test.ts +1 -1
- package/src/runtime/host-layout.ts +4 -5
- package/src/runtime/init.ts +2 -2
- package/src/session.test.ts +5 -6
- package/src/session.ts +333 -227
- package/src/session.voice.test.ts +146 -0
- package/src/session.webmcp.test.ts +24 -25
- package/src/smart-dom-reader.ts +3 -4
- package/src/styles/widget.css +54 -36
- package/src/suggest-replies-tool.test.ts +3 -3
- package/src/suggest-replies-tool.ts +5 -5
- package/src/testing/index.ts +1 -1
- package/src/theme-editor/color-utils.ts +2 -2
- package/src/theme-editor/index.ts +4 -13
- package/src/theme-editor/presets.ts +1 -1
- package/src/theme-editor/preview-utils.ts +22 -20
- package/src/theme-editor/preview.ts +4 -1
- package/src/theme-editor/role-mappings.ts +3 -3
- package/src/theme-editor/sections.ts +21 -20
- package/src/theme-editor/types.ts +1 -1
- package/src/theme-editor/webmcp/index.ts +1 -1
- package/src/theme-editor/webmcp/summary.ts +1 -2
- package/src/theme-editor/webmcp/tools.ts +30 -30
- package/src/theme-editor/webmcp/types.ts +2 -2
- package/src/theme-editor-preview.ts +10 -0
- package/src/theme-reference.ts +26 -26
- package/src/types.ts +368 -99
- package/src/ui.approval-plugin.test.ts +3 -3
- package/src/ui.ask-user-question-plugin.test.ts +9 -9
- package/src/ui.component-directive.test.ts +4 -4
- package/src/ui.composer-bar.test.ts +10 -11
- package/src/ui.composer-keyboard.test.ts +5 -5
- package/src/ui.header-icon-color.test.ts +59 -0
- package/src/ui.scroll.test.ts +5 -6
- package/src/ui.stop-button.test.ts +3 -4
- package/src/ui.suggest-replies.test.ts +2 -2
- package/src/ui.ts +292 -131
- package/src/utils/buttons.ts +1 -1
- package/src/utils/code-generators.ts +1 -1
- package/src/utils/composer-history.ts +3 -3
- package/src/utils/dom-context.test.ts +2 -2
- package/src/utils/dom-context.ts +7 -7
- package/src/utils/dom.test.ts +67 -0
- package/src/utils/dom.ts +75 -0
- package/src/utils/dropdown.ts +2 -2
- package/src/utils/event-stream-buffer.test.ts +2 -2
- package/src/utils/message-fingerprint.test.ts +9 -0
- package/src/utils/message-fingerprint.ts +5 -0
- package/src/utils/morph.ts +1 -1
- package/src/utils/sanitize.ts +32 -16
- package/src/utils/sequence-buffer.test.ts +8 -8
- package/src/utils/sequence-buffer.ts +4 -4
- package/src/utils/smart-dom-adapter.test.ts +1 -1
- package/src/utils/smart-dom-adapter.ts +4 -5
- package/src/utils/speech-text.test.ts +122 -0
- package/src/utils/speech-text.ts +101 -0
- package/src/utils/stream-animation.test.ts +3 -3
- package/src/utils/stream-animation.ts +6 -6
- package/src/utils/theme.test.ts +1 -1
- package/src/utils/throughput-tracker.test.ts +11 -11
- package/src/utils/throughput-tracker.ts +9 -9
- package/src/utils/tokens.ts +13 -13
- package/src/utils/virtual-scroller.ts +1 -1
- package/src/vendor/smart-dom-reader/README.md +4 -4
- package/src/vendor/smart-dom-reader/index.d.ts +1 -1
- package/src/vendor/smart-dom-reader/index.js +2 -2
- package/src/version.ts +1 -1
- package/src/voice/audio-playback-manager.test.ts +159 -0
- package/src/voice/audio-playback-manager.ts +145 -30
- package/src/voice/browser-speech-engine.ts +130 -0
- package/src/voice/fallback-speech-engine.ts +89 -0
- package/src/voice/index.ts +21 -0
- package/src/voice/read-aloud-controller.test.ts +143 -0
- package/src/voice/read-aloud-controller.ts +136 -0
- package/src/voice/runtype-speech-engine.test.ts +280 -0
- package/src/voice/runtype-speech-engine.ts +211 -0
- package/src/voice/runtype-tts-entry.ts +10 -0
- package/src/voice/runtype-tts-loader.test.ts +47 -0
- package/src/voice/runtype-tts-loader.ts +42 -0
- package/src/voice/runtype-voice-provider.ts +332 -537
- package/src/voice/voice-factory.ts +26 -4
- package/src/voice/voice.test.ts +321 -7
- package/src/voice/worklet-playback-engine.ts +272 -0
- package/src/voice-worklet-player.ts +39 -0
- package/src/webmcp-bridge.test.ts +6 -6
- package/src/webmcp-bridge.ts +24 -25
- package/src/webmcp-polyfill.ts +1 -1
- package/src/voice/voice-activity-detector.ts +0 -90
|
@@ -0,0 +1,53 @@
|
|
|
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:(r,o)=>{let s=typeof o=="string"?o:o.source;return s=s.replace(Ri,"$1"),t=t.replace(r,s),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,s,c)=>{let u=!1,g=s;for(;--g>=0&&c[g]==="\\";)u=!u;return u?"|":" |"}),n=t.split(/ \|/),r=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(;r<n.length;r++)n[r]=n[r].trim().replace(/\\\|/g,"|");return n}function Ve(l,e,t){let n=l.length;if(n===0)return"";let r=0;for(;r<n;){let o=l.charAt(n-r-1);if(o===e&&!t)r++;else if(o!==e&&t)r++;else break}return l.slice(0,n-r)}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 r=e.href,o=e.title?G(e.title):null,s=l[1].replace(/\\([\[\]])/g,"$1");if(l[0].charAt(0)!=="!"){n.state.inLink=!0;let c={type:"link",raw:t,href:r,title:o,text:s,tokens:n.inlineTokens(s)};return n.state.inLink=!1,c}return{type:"image",raw:t,href:r,title:o,text:G(s)}}function Oi(l,e){let t=l.match(/^(\s+)(?:```)/);if(t===null)return e;let n=t[1];return e.split(`
|
|
2
|
+
`).map(r=>{let o=r.match(/^\s+/);if(o===null)return r;let[s]=o;return s.length>=n.length?r.slice(n.length):r}).join(`
|
|
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],r=Oi(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(/#$/.test(n)){let r=Ve(n,"#");(this.options.pedantic||!r||/ $/.test(r))&&(n=r.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
|
+
$1`);n=Ve(n.replace(/^ *>[ \t]?/gm,""),`
|
|
6
|
+
`);let r=this.lexer.state.top;this.lexer.state.top=!0;let o=this.lexer.blockTokens(n);return this.lexer.state.top=r,{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(),r=n.length>1,o={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let s=new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),c="",u="",g=!1;for(;e;){let d=!1;if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;c=t[0],e=e.substring(c.length);let T=t[2].split(`
|
|
7
|
+
`,1)[0].replace(/^\t+/,K=>" ".repeat(3*K.length)),m=e.split(`
|
|
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
|
+
`,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
|
+
`,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
|
+
`+m.slice(x);else{if(q||T.search(/[^ ]/)>=4||me.test(T)||z.test(T)||Se.test(T))break;u+=`
|
|
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," "),r=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:r,title:o}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;let n=dn(t[1]),r=t[2].replace(/^\||\| *$/g,"").split("|"),o=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
|
|
14
|
+
`):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let c of r)/^ *-+: *$/.test(c)?s.align.push("right"):/^ *:-+: *$/.test(c)?s.align.push("center"):/^ *:-+ *$/.test(c)?s.align.push("left"):s.align.push(null);for(let c of n)s.header.push({text:c,tokens:this.lexer.inline(c)});for(let c of o)s.rows.push(dn(c,s.header.length).map(u=>({text:u,tokens:this.lexer.inline(u)})));return s}}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 s=Ve(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=Ii(t[2],"()");if(s>-1){let u=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,u).trim(),t[3]=""}}let r=t[2],o="";if(this.options.pedantic){let s=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(r);s&&(r=s[1],o=s[3])}else o=t[3]?t[3].slice(1,-1):"";return r=r.trim(),/^</.test(r)&&(this.options.pedantic&&!/>$/.test(n)?r=r.slice(1):r=r.slice(1,-1)),mn(t,{href:r&&r.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 r=(n[2]||n[1]).replace(/\s+/g," "),o=t[r.toLowerCase()];if(!o){let s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return mn(n,o,n[0],this.lexer)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||r[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(r[1]||r[2]||"")||!n||this.rules.inline.punctuation.exec(n)){let s=[...r[0]].length-1,c,u,g=s,d=0,T=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(T.lastIndex=0,t=t.slice(-1*e.length+s);(r=T.exec(t))!=null;){if(c=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!c)continue;if(u=[...c].length,r[3]||r[4]){g+=u;continue}else if((r[5]||r[6])&&s%3&&!((s+u)%3)){d+=u;continue}if(g-=u,g>0)continue;u=Math.min(u,u+g+d);let m=[...r[0]][0].length,x=e.slice(0,s+r.index+m+u);if(Math.min(s,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," "),r=/[^ ]/.test(n),o=/^ /.test(n)&&/ $/.test(n);return r&&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,r;return t[2]==="@"?(n=G(t[1]),r="mailto:"+n):(n=G(t[1]),r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n,r;let t;if(t=this.rules.inline.url.exec(e)){let o,s;if(t[2]==="@")o=G(t[0]),s="mailto:"+o;else{let c;do c=t[0],t[0]=(r=(n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])!=null?r:"";while(c!==t[0]);o=G(t[0]),t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:o,href:s,tokens:[{type:"text",raw:o,text:o}]}}}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
|
+
]`).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,r,o,s;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),r=t[t.length-1],r&&(r.type==="paragraph"||r.type==="text")?(r.raw+=`
|
|
19
|
+
`+n.raw,r.text+=`
|
|
20
|
+
`+n.text,this.inlineQueue[this.inlineQueue.length-1].src=r.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),r=t[t.length-1],r&&(r.type==="paragraph"||r.type==="text")?(r.raw+=`
|
|
21
|
+
`+n.raw,r.text+=`
|
|
22
|
+
`+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=r.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))){r=t[t.length-1],s&&r.type==="paragraph"?(r.raw+=`
|
|
23
|
+
`+n.raw,r.text+=`
|
|
24
|
+
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n),s=o.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length),r=t[t.length-1],r&&r.type==="text"?(r.raw+=`
|
|
25
|
+
`+n.raw,r.text+=`
|
|
26
|
+
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.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,r,o,s=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(s))!=null;)d.includes(c[0].slice(c[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,c.index)+"["+"a".repeat(c[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(c=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)s=s.slice(0,c.index)+"["+"a".repeat(c[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(c=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,c.index)+"++"+s.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),r=t[t.length-1],r&&n.type==="text"&&r.type==="text"?(r.raw+=n.raw,r.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),r=t[t.length-1],r&&n.type==="text"&&r.type==="text"?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,s,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,r=t[t.length-1],r&&r.type==="text"?(r.raw+=n.raw,r.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){var o;let r=(o=(t||"").match(/^\S*/))==null?void 0:o[0];return e=e.replace(/\n$/,"")+`
|
|
27
|
+
`,r?'<pre><code class="language-'+G(r)+'">'+(n?e:G(e,!0))+`</code></pre>
|
|
28
|
+
`:"<pre><code>"+(n?e:G(e,!0))+`</code></pre>
|
|
29
|
+
`}blockquote(e){return`<blockquote>
|
|
30
|
+
${e}</blockquote>
|
|
31
|
+
`}html(e,t){return e}heading(e,t,n){return`<h${t}>${e}</h${t}>
|
|
32
|
+
`}hr(){return`<hr>
|
|
33
|
+
`}list(e,t,n){let r=t?"ol":"ul",o=t&&n!==1?' start="'+n+'"':"";return"<"+r+o+`>
|
|
34
|
+
`+e+"</"+r+`>
|
|
35
|
+
`}listitem(e,t,n){return`<li>${e}</li>
|
|
36
|
+
`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>
|
|
37
|
+
`}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),`<table>
|
|
38
|
+
<thead>
|
|
39
|
+
`+e+`</thead>
|
|
40
|
+
`+t+`</table>
|
|
41
|
+
`}tablerow(e){return`<tr>
|
|
42
|
+
${e}</tr>
|
|
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 r=hn(e);if(r===null)return n;e=r;let o='<a href="'+e+'"';return t&&(o+=' title="'+t+'"'),o+=">"+n+"</a>",o}image(e,t,n){let r=hn(e);if(r===null)return n;e=r;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 r=0;r<e.length;r++){let o=e[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){let s=o,c=this.options.extensions.renderers[s.type].call({parser:this},s);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(s.type)){n+=c||"";continue}}switch(o.type){case"space":continue;case"hr":{n+=this.renderer.hr();continue}case"heading":{let s=o;n+=this.renderer.heading(this.parseInline(s.tokens),s.depth,Si(this.parseInline(s.tokens,this.textRenderer)));continue}case"code":{let s=o;n+=this.renderer.code(s.text,s.lang,!!s.escaped);continue}case"table":{let s=o,c="",u="";for(let d=0;d<s.header.length;d++)u+=this.renderer.tablecell(this.parseInline(s.header[d].tokens),{header:!0,align:s.align[d]});c+=this.renderer.tablerow(u);let g="";for(let d=0;d<s.rows.length;d++){let T=s.rows[d];u="";for(let m=0;m<T.length;m++)u+=this.renderer.tablecell(this.parseInline(T[m].tokens),{header:!1,align:s.align[m]});g+=this.renderer.tablerow(u)}n+=this.renderer.table(c,g);continue}case"blockquote":{let s=o,c=this.parse(s.tokens);n+=this.renderer.blockquote(c);continue}case"list":{let s=o,c=s.ordered,u=s.start,g=s.loose,d="";for(let T=0;T<s.items.length;T++){let m=s.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 s=o;n+=this.renderer.html(s.text,s.block);continue}case"paragraph":{let s=o;n+=this.renderer.paragraph(this.parseInline(s.tokens));continue}case"text":{let s=o,c=s.tokens?this.parseInline(s.tokens):s.text;for(;r+1<e.length&&e[r+1].type==="text";)s=e[++r],c+=`
|
|
45
|
+
`+(s.tokens?this.parseInline(s.tokens):s.text);n+=t?this.renderer.paragraph(c):c;continue}default:{let s='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let r=0;r<e.length;r++){let o=e[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){let s=this.options.extensions.renderers[o.type].call({parser:this},o);if(s!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){n+=s||"";continue}}switch(o.type){case"escape":{let s=o;n+=t.text(s.text);break}case"html":{let s=o;n+=t.html(s.text);break}case"link":{let s=o;n+=t.link(s.href,s.title,this.parseInline(s.tokens,t));break}case"image":{let s=o;n+=t.image(s.href,s.title,s.text);break}case"strong":{let s=o;n+=t.strong(this.parseInline(s.tokens,t));break}case"em":{let s=o;n+=t.em(this.parseInline(s.tokens,t));break}case"codespan":{let s=o;n+=t.codespan(s.text);break}case"br":{n+=t.br();break}case"del":{let s=o;n+=t.del(this.parseInline(s.tokens,t));break}case"text":{let s=o;n+=t.text(s.text);break}default:{let s='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}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){var r,o;let n=[];for(let s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{let c=s;for(let u of c.header)n=n.concat(this.walkTokens(u.tokens,t));for(let u of c.rows)for(let g of u)n=n.concat(this.walkTokens(g.tokens,t));break}case"list":{let c=s;n=n.concat(this.walkTokens(c.items,t));break}default:{let c=s;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[c.type]?this.defaults.extensions.childTokens[c.type].forEach(u=>{let g=c[u].flat(1/0);n=n.concat(this.walkTokens(g,t))}):c.tokens&&(n=n.concat(this.walkTokens(c.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let s=t.renderers[o.name];s?t.renderers[o.name]=function(...c){let u=o.renderer.apply(this,c);return u===!1&&(u=s.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 s=t[o.level];s?s.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)}),r.extensions=t),n.renderer){let o=this.defaults.renderer||new we(this.defaults);for(let s in n.renderer){if(!(s in o))throw new Error(`renderer '${s}' does not exist`);if(s==="options")continue;let c=s,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||""}}r.renderer=o}if(n.tokenizer){let o=this.defaults.tokenizer||new ye(this.defaults);for(let s in n.tokenizer){if(!(s in o))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let c=s,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}}r.tokenizer=o}if(n.hooks){let o=this.defaults.hooks||new ue;for(let s in n.hooks){if(!(s in o))throw new Error(`hook '${s}' does not exist`);if(s==="options")continue;let c=s,u=n.hooks[c],g=o[c];ue.passThroughHooks.has(s)?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}}r.hooks=o}if(n.walkTokens){let o=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(c){let u=[];return u.push(s.call(this,c)),o&&(u=u.concat(o.call(this,c))),u}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ee.lex(e,t!=null?t:this.defaults)}parser(e,t){return te.parse(e,t!=null?t:this.defaults)}};fe=new WeakSet,yt=function(e,t){return(n,r)=>{let o={...r},s={...this.defaults,...o};this.defaults.async===!0&&o.async===!1&&(s.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),s.async=!0);let c=Xe(this,fe,Rn).call(this,!!s.silent,!!s.async);if(typeof n=="undefined"||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(s.hooks&&(s.hooks.options=s),s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(n):n).then(u=>e(u,s)).then(u=>s.hooks?s.hooks.processAllTokens(u):u).then(u=>s.walkTokens?Promise.all(this.walkTokens(u,s.walkTokens)).then(()=>u):u).then(u=>t(u,s)).then(u=>s.hooks?s.hooks.postprocess(u):u).catch(c);try{s.hooks&&(n=s.hooks.preprocess(n));let u=e(n,s);s.hooks&&(u=s.hooks.processAllTokens(u)),s.walkTokens&&this.walkTokens(u,s.walkTokens);let g=t(u,s);return s.hooks&&(g=s.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 r="<p>An error occurred:</p><pre>"+G(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}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!="undefined"&&l[Symbol.iterator]||l["@@iterator"];if(t!=null){var n,r,o,s,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,r=d}finally{try{if(!u&&t.return!=null&&(s=t.return(),Object(s)!==s))return}finally{if(g)throw r}}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!="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+`>
|
|
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
|
+
/*! Bundled license information:
|
|
50
|
+
|
|
51
|
+
dompurify/dist/purify.es.mjs:
|
|
52
|
+
(*! @license DOMPurify 3.4.10 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.10/LICENSE *)
|
|
53
|
+
*/
|
package/dist/plugin-kit.d.cts
CHANGED
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
*/
|
|
9
9
|
declare function getStyleRoot(node: Node): Document | ShadowRoot;
|
|
10
10
|
/**
|
|
11
|
-
* Inject a plugin's CSS once into the correct root
|
|
11
|
+
* Inject a plugin's CSS once into the correct root: the widget's shadow root
|
|
12
12
|
* when shadowed, the document head otherwise. Idempotent: keyed by `id`, so it
|
|
13
13
|
* is safe to call on every render.
|
|
14
14
|
*
|
|
15
15
|
* Pass the element you're about to return from a render hook. While building, an
|
|
16
16
|
* element is detached and its eventual root is unknown, so this injects into the
|
|
17
17
|
* owning document immediately (covering the default light-DOM case with no
|
|
18
|
-
* flash) and then, on the next microtask
|
|
19
|
-
* element
|
|
18
|
+
* flash) and then, on the next microtask: after the widget has mounted the
|
|
19
|
+
* element: re-resolves and also injects into its shadow root if it landed in
|
|
20
20
|
* one. You may also pass an explicit `Document` or `ShadowRoot`.
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
@@ -48,7 +48,7 @@ interface PopoverOptions {
|
|
|
48
48
|
zIndex?: number | null;
|
|
49
49
|
/**
|
|
50
50
|
* Where to mount `content`. Defaults to the anchor's shadow root (when
|
|
51
|
-
* shadowed) or `document.body
|
|
51
|
+
* shadowed) or `document.body`: keeping it inside the same style + stacking
|
|
52
52
|
* scope as the anchor while escaping the transcript's scroll clipping.
|
|
53
53
|
*/
|
|
54
54
|
container?: HTMLElement | ShadowRoot;
|
package/dist/plugin-kit.d.ts
CHANGED
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
*/
|
|
9
9
|
declare function getStyleRoot(node: Node): Document | ShadowRoot;
|
|
10
10
|
/**
|
|
11
|
-
* Inject a plugin's CSS once into the correct root
|
|
11
|
+
* Inject a plugin's CSS once into the correct root: the widget's shadow root
|
|
12
12
|
* when shadowed, the document head otherwise. Idempotent: keyed by `id`, so it
|
|
13
13
|
* is safe to call on every render.
|
|
14
14
|
*
|
|
15
15
|
* Pass the element you're about to return from a render hook. While building, an
|
|
16
16
|
* element is detached and its eventual root is unknown, so this injects into the
|
|
17
17
|
* owning document immediately (covering the default light-DOM case with no
|
|
18
|
-
* flash) and then, on the next microtask
|
|
19
|
-
* element
|
|
18
|
+
* flash) and then, on the next microtask: after the widget has mounted the
|
|
19
|
+
* element: re-resolves and also injects into its shadow root if it landed in
|
|
20
20
|
* one. You may also pass an explicit `Document` or `ShadowRoot`.
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
@@ -48,7 +48,7 @@ interface PopoverOptions {
|
|
|
48
48
|
zIndex?: number | null;
|
|
49
49
|
/**
|
|
50
50
|
* Where to mount `content`. Defaults to the anchor's shadow root (when
|
|
51
|
-
* shadowed) or `document.body
|
|
51
|
+
* shadowed) or `document.body`: keeping it inside the same style + stacking
|
|
52
52
|
* scope as the anchor while escaping the transcript's scroll clipping.
|
|
53
53
|
*/
|
|
54
54
|
container?: HTMLElement | ShadowRoot;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var l=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;var r;this.sampleRate=e;let i=Math.max(0,(r=t.prebufferMs)!=null?r:0);this.waterlineSamples=Math.round(e*i/1e3),this.buffering=this.waterlineSamples>0}ensureContext(){if(!this.ctx){let t=typeof window!="undefined"?window:void 0;if(!t)throw new Error("AudioPlaybackManager requires a browser environment");let i=t.AudioContext||t.webkitAudioContext;this.ctx=new i({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 r=new Uint8Array(this.remainder.length+e.length);r.set(this.remainder),r.set(e,this.remainder.length),t=r,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 i=this.pcmToFloat32(t);i.length!==0&&(this.buffering?(this.pendingBuffers.push(i),this.pendingSamples+=i.length,this.pendingSamples>=this.waterlineSamples&&this.releaseBuffer()):this.scheduleSamples(i))}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(),i=t.createBuffer(1,e.length,this.sampleRate);i.getChannelData(0).set(e);let r=t.createBufferSource();r.buffer=i,r.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)),r.start(this.nextStartTime),this.nextStartTime+=i.duration,this.activeSources.push(r),this.pendingCount++,this.playing=!0,!this.started){this.started=!0;let n=this.startedCallbacks.slice();this.startedCallbacks=[];for(let h of n)h()}r.onended=()=>{let n=this.activeSources.indexOf(r);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),i=new Float32Array(t),r=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let s=0;s<t;s++){let n=r.getInt16(s*2,!0);i[s]=n/32768}return i}};function y(o){return o.replace(/\/+$/,"")}var c=class{constructor(e){this.opts=e;this.id="runtype-tts";this.supportsPause=!0;this.player=null;this.playerPromise=null;this.generation=0}ensurePlayer(){var e,t;return(t=this.playerPromise)!=null?t:this.playerPromise=Promise.resolve(this.opts.createPlaybackEngine?this.opts.createPlaybackEngine():new l(24e3,{prebufferMs:(e=this.opts.prebufferMs)!=null?e:200})).then(i=>this.player=i)}speak(e,t){let i=++this.generation;this.run(i,e,t)}async run(e,t,i){var r,s,n,h;try{let a=await this.ensurePlayer();if(e!==this.generation)return;a.flush(),a.resume(),a.onStarted(()=>{var p;e===this.generation&&((p=i.onStart)==null||p.call(i))}),a.onFinished(()=>{var p;e===this.generation&&((p=i.onEnd)==null||p.call(i))});let u=`${y(this.opts.host)}/v1/agents/${encodeURIComponent(this.opts.agentId)}/speak`,d=await fetch(u,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.opts.clientToken}`},body:JSON.stringify({text:t.text,voice:(r=t.voice)!=null?r:this.opts.voice,format:"pcm"})});if(e!==this.generation)return;if(!d.ok||!d.body)throw new Error(await v(d));let g=d.body.getReader();for(;;){let{done:p,value:f}=await g.read();if(e!==this.generation){await g.cancel().catch(()=>{});return}if(p)break;f&&f.byteLength>0&&a.enqueue(f)}a.markStreamEnd()}catch(a){if(e!==this.generation)return;let u=a instanceof Error?a:new Error(String(a));(n=(s=this.opts).onError)==null||n.call(s,u),(h=i.onError)==null||h.call(i,u)}}pause(){var e;(e=this.player)==null||e.pause()}resume(){var e;(e=this.player)==null||e.resume()}stop(){var e;this.generation++,(e=this.player)==null||e.flush()}destroy(){var e;this.generation++,(e=this.player)==null||e.destroy(),this.player=null,this.playerPromise=null}};async function v(o){var e,t;try{let i=await o.json();return i.detail?`${(e=i.error)!=null?e:`Runtype TTS ${o.status}`}: ${i.detail}`:(t=i.error)!=null?t:`Runtype TTS request failed (${o.status})`}catch{return`Runtype TTS request failed (${o.status})`}}var m=class{constructor(e,t,i={}){this.primary=e;this.fallback=t;this.options=i;this.id="fallback";this.active=e}get supportsPause(){return this.active.supportsPause}speak(e,t){this.active=this.primary;let i=!1;this.primary.speak(e,{onStart:()=>{var r;i=!0,(r=t.onStart)==null||r.call(t)},onEnd:()=>{var r;return(r=t.onEnd)==null?void 0:r.call(t)},onError:r=>{var s,n,h;if(i){(s=t.onError)==null||s.call(t,r);return}(h=(n=this.options).onFallback)==null||h.call(n,r),this.active=this.fallback,this.fallback.speak(e,t)}})}pause(){this.active.pause()}resume(){this.active.resume()}stop(){this.active.stop()}destroy(){var e,t,i,r;(t=(e=this.primary).destroy)==null||t.call(e),(r=(i=this.fallback).destroy)==null||r.call(i)}};export{m as FallbackSpeechEngine,c as RuntypeSpeechEngine};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";var M=Object.defineProperty;var tt=Object.getOwnPropertyDescriptor;var et=Object.getOwnPropertyNames;var nt=Object.prototype.hasOwnProperty;var rt=(s,e,t)=>e in s?M(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var st=(s,e)=>{for(var t in e)M(s,t,{get:e[t],enumerable:!0})},ot=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of et(e))!nt.call(s,r)&&r!==t&&M(s,r,{get:()=>e[r],enumerable:!(n=tt(e,r))||n.enumerable});return s};var it=s=>ot(M({},"__esModule",{value:!0}),s);var R=(s,e,t)=>rt(s,typeof e!="symbol"?e+"":e,t);var wt={};st(wt,{collectSmartDomContext:()=>Z,createSmartDomReaderContextProvider:()=>$t,smartDomResultToEnriched:()=>k});module.exports=it(wt);var q=Object.defineProperty,at=Object.getOwnPropertyDescriptor,ct=Object.getOwnPropertyNames,B=Object.prototype.hasOwnProperty,T=(s,e)=>()=>(s&&(e=s(s=0)),e),lt=(s,e)=>{let t={};for(var n in s)q(t,n,{get:s[n],enumerable:!0});return e||q(t,Symbol.toStringTag,{value:"Module"}),t},ut=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(var r=ct(e),i=0,a=r.length,o;i<a;i++)o=r[i],!B.call(s,o)&&o!==t&&q(s,o,{get:(c=>e[c]).bind(null,o),enumerable:!(n=at(e,o))||n.enumerable});return s},dt=s=>B.call(s,"module.exports")?s["module.exports"]:ut(q({},"__esModule",{value:!0}),s),ft=void 0,w,z=T((()=>{w=class v{static findMainContent(e){let t=e.querySelector('main, [role="main"]');return t||(e.body?v.detectMainContent(e.body):e.documentElement)}static detectMainContent(e){let t=[];if(v.collectCandidates(e,t,15),t.length===0)return e;t.sort((r,i)=>v.calculateContentScore(i)-v.calculateContentScore(r));let n=t[0];for(let r=1;r<t.length;r++){let i=t[r];!t.some((a,o)=>o!==r&&a.contains(i))&&v.calculateContentScore(i)>v.calculateContentScore(n)&&(n=i)}return n}static collectCandidates(e,t,n){v.calculateContentScore(e)>=n&&t.push(e),Array.from(e.children).forEach(r=>{v.collectCandidates(r,t,n)})}static calculateContentScore(e){var d;let t=0,n=["article","content","main-container","main","main-content","post","entry"],r=["content","main","article","post","entry"];n.forEach(f=>{e.classList.contains(f)&&(t+=10)}),r.forEach(f=>{var h;(h=e.id)!=null&&h.toLowerCase().includes(f)&&(t+=10)});let i=e.tagName.toLowerCase();["article","main","section"].includes(i)&&(t+=8);let a=e.getElementsByTagName("p").length;t+=Math.min(a*2,10);let o=e.querySelectorAll("h1, h2, h3").length;t+=Math.min(o*3,9);let c=((d=e.textContent)==null?void 0:d.trim().length)||0;c>300&&(t+=Math.min(Math.floor(c/300)*2,10));let l=v.calculateLinkDensity(e);l<.3?t+=5:l>.5&&(t-=5),(e.hasAttribute("data-main")||e.hasAttribute("data-content")||e.hasAttribute("itemprop"))&&(t+=8);let u=e.getAttribute("role");return(u==="main"||u==="article")&&(t+=10),e.matches("aside, nav, header, footer, .sidebar, .navigation, .menu, .ad, .advertisement")&&(t-=10),e.getElementsByTagName("form").length>2&&(t-=5),Math.max(0,t)}static calculateLinkDensity(e){var i,a;let t=e.getElementsByTagName("a"),n=0;for(let o of Array.from(t))n+=((i=o.textContent)==null?void 0:i.length)||0;let r=((a=e.textContent)==null?void 0:a.length)||1;return n/r}static isNavigation(e){if(e.tagName.toLowerCase()==="nav"||e.getAttribute("role")==="navigation")return!0;let t=[/nav/i,/menu/i,/sidebar/i,/toolbar/i],n=`${e.className} ${e.id}`.toLowerCase();return t.some(r=>r.test(n))}static isSupplementary(e){if(e.tagName.toLowerCase()==="aside"||e.getAttribute("role")==="complementary")return!0;let t=[/sidebar/i,/widget/i,/related/i,/advertisement/i,/social/i],n=`${e.className} ${e.id}`.toLowerCase();return t.some(r=>r.test(n))}static detectLandmarks(e){let t={navigation:[],main:[],complementary:[],contentinfo:[],banner:[],search:[],form:[],region:[]};for(let[n,r]of Object.entries({navigation:'nav, [role="navigation"]',main:'main, [role="main"]',complementary:'aside, [role="complementary"]',contentinfo:'footer, [role="contentinfo"]',banner:'header, [role="banner"]',search:'[role="search"]',form:'form[aria-label], form[aria-labelledby], [role="form"]',region:'section[aria-label], section[aria-labelledby], [role="region"]'})){let i=e.querySelectorAll(r);t[n]=Array.from(i)}return t}}})),E,P=T((()=>{E=class S{static generateSelectors(e){var p;let t=e.ownerDocument||document,n=[];e.id&&S.isUniqueId(e.id,t)&&n.push({type:"id",value:`#${CSS.escape(e.id)}`,score:100});let r=S.getDataTestId(e);if(r){let m=`[data-testid="${CSS.escape(r)}"]`;n.push({type:"data-testid",value:m,score:90+(S.isUniqueSelectorSafe(m,t)?5:0)})}let i=e.getAttribute("role"),a=e.getAttribute("aria-label");if(i&&a){let m=`[role="${CSS.escape(i)}"][aria-label="${CSS.escape(a)}"]`;n.push({type:"role-aria",value:m,score:85+(S.isUniqueSelectorSafe(m,t)?5:0)})}let o=e.getAttribute("name");if(o){let m=`[name="${CSS.escape(o)}"]`;n.push({type:"name",value:m,score:78+(S.isUniqueSelectorSafe(m,t)?5:0)})}let c=S.generateCSSSelector(e,t),l=(c.match(/:nth-child\(/g)||[]).length*10,u=c.includes(".")?8:0,d=Math.max(0,70+u-l);n.push({type:"class-path",value:c,score:d});let f=S.generateXPath(e,t);n.push({type:"xpath",value:f,score:40});let h=S.generateTextBasedSelector(e);h&&n.push({type:"text",value:h,score:30}),n.sort((m,x)=>x.score-m.score);let g={css:((p=n.find(m=>m.type!=="xpath"&&m.type!=="text"))==null?void 0:p.value)||c,xpath:f,candidates:n};return h&&(g.textBased=h),r&&(g.dataTestId=r),a&&(g.ariaLabel=a),g}static generateCSSSelector(e,t){var a;if(e.id&&S.isUniqueId(e.id,t))return`#${CSS.escape(e.id)}`;let n=S.getDataTestId(e);if(n)return`[data-testid="${CSS.escape(n)}"]`;let r=[],i=e;for(;i&&i.nodeType===Node.ELEMENT_NODE;){let o=i.nodeName.toLowerCase();if(i.id&&S.isUniqueId(i.id,t)){o=`#${CSS.escape(i.id)}`,r.unshift(o);break}let c=S.getMeaningfulClasses(i);c.length>0&&(o+=`.${c.map(u=>CSS.escape(u)).join(".")}`);let l=(a=i.parentElement)==null?void 0:a.children;if(l&&l.length>1){let u=Array.from(l).indexOf(i);(u>0||!S.isUniqueSelector(o,i.parentElement))&&(o+=`:nth-child(${u+1})`)}r.unshift(o),i=i.parentElement}return S.optimizePath(r,e,t)}static generateXPath(e,t){var i;if(e.id&&S.isUniqueId(e.id,t))return`//*[@id="${e.id}"]`;let n=[],r=e;for(;r&&r.nodeType===Node.ELEMENT_NODE;){let a=r.nodeName.toLowerCase();if(r.id&&S.isUniqueId(r.id,t)){n.unshift(`//*[@id="${r.id}"]`);break}let o=a,c=(i=r.parentElement)==null?void 0:i.children;if(c){let l=Array.from(c).filter(u=>u.nodeName.toLowerCase()===a);if(l.length>1){let u=l.indexOf(r)+1;o+=`[${u}]`}}n.unshift(o),r=r.parentElement}return`//${n.join("/")}`}static generateTextBasedSelector(e){var r;let t=(r=e.textContent)==null?void 0:r.trim();if(!t||t.length>50)return;let n=e.nodeName.toLowerCase();if(["button","a","label"].includes(n))return`${n}:contains("${t.replace(/['"\\]/g,"\\$&")}")`}static getDataTestId(e){return e.getAttribute("data-testid")||e.getAttribute("data-test-id")||e.getAttribute("data-test")||e.getAttribute("data-cy")||void 0}static isUniqueId(e,t){return t.querySelectorAll(`#${CSS.escape(e)}`).length===1}static isUniqueSelector(e,t){try{return t.querySelectorAll(e).length===1}catch{return!1}}static isUniqueSelectorSafe(e,t){try{return t.querySelectorAll(e).length===1}catch{return!1}}static getMeaningfulClasses(e){let t=Array.from(e.classList),n=[/^(p|m|w|h|text|bg|border|flex|grid|col|row)-/,/^(xs|sm|md|lg|xl|2xl):/,/^(hover|focus|active|disabled|checked):/,/^js-/,/^is-/,/^has-/];return t.filter(r=>r.length<3?!1:!n.some(i=>i.test(r))).slice(0,2)}static optimizePath(e,t,n){for(let r=0;r<e.length-1;r++){let i=e.slice(r).join(" > ");try{let a=n.querySelectorAll(i);if(a.length===1&&a[0]===t)return i}catch{}}return e.join(" > ")}static getContextPath(e){var a;let t=[],n=e,r=0,i=5;for(;n&&n!==((a=e.ownerDocument)==null?void 0:a.body)&&r<i;){let o=n.nodeName.toLowerCase(),c=o;if(n.id)c=`${o}#${n.id}`;else if(n.className&&typeof n.className=="string"){let u=n.className.split(" ")[0];u&&(c=`${o}.${u}`)}let l=n.getAttribute("role");l&&(c+=`[role="${l}"]`),t.unshift(c),n=n.parentElement,r++}return t}}})),b,_=T((()=>{var s;P(),b=(s=class{static isVisible(t,n){var a,o;let r=t.getBoundingClientRect(),i=n||((o=(a=t.ownerDocument)==null?void 0:a.defaultView)==null?void 0:o.getComputedStyle(t));return i?r.width>0&&r.height>0&&i.display!=="none"&&i.visibility!=="hidden"&&i.opacity!=="0"&&t.offsetParent!==null:!1}static isInViewport(t,n){var a,o,c,l;let r=t.getBoundingClientRect(),i=n||{width:((o=(a=t.ownerDocument)==null?void 0:a.defaultView)==null?void 0:o.innerWidth)||0,height:((l=(c=t.ownerDocument)==null?void 0:c.defaultView)==null?void 0:l.innerHeight)||0};return r.top<i.height&&r.bottom>0&&r.left<i.width&&r.right>0}static passesFilter(t,n){var a,o,c,l,u,d,f,h,g,p;if(!n)return!0;let r=t;if((a=n.excludeSelectors)!=null&&a.length){for(let m of n.excludeSelectors)if(t.matches(m))return!1}if((o=n.includeSelectors)!=null&&o.length){let m=!1;for(let x of n.includeSelectors)if(t.matches(x)){m=!0;break}if(!m)return!1}if((c=n.tags)!=null&&c.length&&!n.tags.includes(t.tagName.toLowerCase()))return!1;let i=((l=r.textContent)==null?void 0:l.toLowerCase())||"";if((u=n.textContains)!=null&&u.length){let m=!1;for(let x of n.textContains)if(i.includes(x.toLowerCase())){m=!0;break}if(!m)return!1}if((d=n.textMatches)!=null&&d.length){let m=!1;for(let x of n.textMatches)if(x.test(i)){m=!0;break}if(!m)return!1}if((f=n.hasAttributes)!=null&&f.length){for(let m of n.hasAttributes)if(!t.hasAttribute(m))return!1}if(n.attributeValues)for(let[m,x]of Object.entries(n.attributeValues)){let C=t.getAttribute(m);if(!C)return!1;if(typeof x=="string"){if(C!==x)return!1}else if(x instanceof RegExp&&!x.test(C))return!1}if((h=n.withinSelectors)!=null&&h.length){let m=!1;for(let x of n.withinSelectors)if(t.closest(x)){m=!0;break}if(!m)return!1}if((g=n.interactionTypes)!=null&&g.length){let m=s.getInteractionInfo(t),x=!1;for(let C of n.interactionTypes)if(m[C]){x=!0;break}if(!x)return!1}if(n.nearText){let m=t.parentElement;if(!m||!((p=m.textContent)!=null&&p.toLowerCase().includes(n.nearText.toLowerCase())))return!1}return!0}static extractElement(t,n,r=0){if(n.maxDepth&&r>n.maxDepth||!n.includeHidden&&!s.isVisible(t)||n.viewportOnly&&!s.isInViewport(t)||!s.passesFilter(t,n.filter))return null;let i=t,a={tag:t.tagName.toLowerCase(),text:s.getElementText(t,n),selector:E.generateSelectors(t),attributes:s.getRelevantAttributes(t,n),context:s.getElementContext(t),interaction:s.getInteractionInfo(t)};if(n.mode==="full"&&s.isSemanticContainer(t)){let o=[];if(n.includeShadowDOM&&i.shadowRoot){let l=s.extractChildren(i.shadowRoot,n,r+1);o.push(...l)}let c=s.extractChildren(t,n,r+1);o.push(...c),o.length>0&&(a.children=o)}return a}static extractChildren(t,n,r){let i=[],a=t.querySelectorAll("*");for(let o of Array.from(a)){if(s.hasExtractedAncestor(o,a))continue;let c=s.extractElement(o,n,r);c&&i.push(c)}return i}static hasExtractedAncestor(t,n){let r=t.parentElement;for(;r;){if(Array.from(n).includes(r))return!0;r=r.parentElement}return!1}static getRelevantAttributes(t,n){var c,l;let r=["id","class","name","type","value","placeholder","href","src","alt","title","action","method","aria-label","aria-describedby","aria-controls","role","disabled","readonly","required","checked","min","max","pattern","step","autocomplete","data-testid","data-test","data-cy"],i={},a=(c=n.attributeTruncateLength)!=null?c:100,o=(l=n.dataAttributeTruncateLength)!=null?l:50;for(let u of r){let d=t.getAttribute(u);d&&(i[u]=d.length>a?`${d.substring(0,a)}...`:d)}for(let u of t.attributes)u.name.startsWith("data-")&&!r.includes(u.name)&&(i[u.name]=u.value.length>o?`${u.value.substring(0,o)}...`:u.value);return i}static getElementContext(t){let n={parentChain:E.getContextPath(t)},r=t.closest("form");r&&(n.nearestForm=E.generateSelectors(r).css);let i=t.closest('section, [role="region"]');i&&(n.nearestSection=E.generateSelectors(i).css);let a=t.closest('main, [role="main"]');a&&(n.nearestMain=E.generateSelectors(a).css);let o=t.closest('nav, [role="navigation"]');return o&&(n.nearestNav=E.generateSelectors(o).css),n}static getInteractionInfo(t){let n=t,r={};(n.onclick||t.getAttribute("onclick")||t.matches('button, a[href], [role="button"], [tabindex]:not([tabindex="-1"])'))&&(r.click=!0),(n.onchange||t.getAttribute("onchange")||t.matches("input, select, textarea"))&&(r.change=!0),(n.onsubmit||t.getAttribute("onsubmit")||t.matches("form"))&&(r.submit=!0),t.matches('a[href], button[type="submit"]')&&(r.nav=!0),(n.hasAttribute("disabled")||n.getAttribute("aria-disabled")==="true")&&(r.disabled=!0),s.isVisible(t)||(r.hidden=!0);let i=t.getAttribute("role");if(i&&(r.role=i),t.matches("input, textarea, select, button")){let a=t.form||t.closest("form");a&&(r.form=E.generateSelectors(a).css)}return r}static getElementText(t,n){var a;if(t.matches("input, textarea")){let o=t;return o.value||o.placeholder||""}if(t.matches("img"))return t.alt||"";let r=((a=t.textContent)==null?void 0:a.trim())||"",i=n==null?void 0:n.textTruncateLength;return i&&r.length>i?`${r.substring(0,i)}...`:r}static isSemanticContainer(t){return t.matches('article, section, nav, aside, main, header, footer, form, table, ul, ol, dl, figure, details, dialog, [role="region"], [role="navigation"], [role="main"], [role="complementary"]')}static getInteractiveElements(t,n){let r=[],i=s.INTERACTIVE_SELECTORS.join(", "),a=t.querySelectorAll(i);for(let o of Array.from(a)){let c=s.extractElement(o,n);c&&r.push(c)}if(n.customSelectors)for(let o of n.customSelectors)try{let c=t.querySelectorAll(o);for(let l of Array.from(c)){let u=s.extractElement(l,n);u&&r.push(u)}}catch{console.warn(`Invalid custom selector: ${o}`)}return r}static getSemanticElements(t,n){let r=[],i=s.SEMANTIC_SELECTORS.join(", "),a=t.querySelectorAll(i);for(let o of Array.from(a)){let c=s.extractElement(o,n);c&&r.push(c)}return r}},R(s,"INTERACTIVE_SELECTORS",["button","a[href]",'input:not([type="hidden"])',"textarea","select",'[role="button"]',"[onclick]",'[contenteditable="true"]',"summary",'[tabindex]:not([tabindex="-1"])']),R(s,"SEMANTIC_SELECTORS",["h1","h2","h3","h4","h5","h6","article","section","nav","aside","main","header","footer","form","table","ul","ol","img[alt]","figure","video","audio",'[role="navigation"]','[role="main"]','[role="complementary"]','[role="contentinfo"]']),s)}));function $(s,e){let t=(s!=null?s:"").trim();if(!e||t.length<=e)return t;let n=["login","log in","sign in","sign up","submit","search","filter","add to cart","next","continue"],r=t.toLowerCase(),i=n.map(l=>({k:l,i:r.indexOf(l)})).find(l=>l.i>-1),a=Math.max(0,Math.floor(e*.66));if(i&&i.i>a){let l=Math.max(12,e-a-5),u=Math.max(0,i.i-Math.floor(l/2)),d=Math.min(t.length,u+l);return`${t.slice(0,a).trimEnd()} \u2026 ${t.slice(u,d).trim()}\u2026`}let o=t.slice(0,e),c=o.lastIndexOf(" ");return`${c>32?o.slice(0,c):o}\u2026`}function ht(s){var e;return((e=s.selector)==null?void 0:e.css)||""}function mt(s){let e=5381;for(let t=0;t<s.length;t++)e=e*33^s.charCodeAt(t);return`sec-${(e>>>0).toString(36)}`}function X(s){switch(s){case"header":return"\u{1F9ED}";case"navigation":return"\u{1F4D1}";case"main":return"\u{1F4C4}";case"sections":return"\u{1F5C2}\uFE0F";case"sidebar":return"\u{1F4DA}";case"footer":return"\u{1F53B}";case"modals":return"\u{1F4AC}";default:return"\u{1F539}"}}function O(s,e){var o,c,l,u,d;let t=$(s.text||((o=s.attributes)==null?void 0:o.ariaLabel),(c=e==null?void 0:e.maxTextLength)!=null?c:80),n=ht(s),r=s.tag.toLowerCase(),i=(l=s.interaction)!=null&&l.submit?"submit":(u=s.interaction)!=null&&u.click?"click":(d=s.interaction)!=null&&d.change?"change":void 0,a=i?` (${i})`:"";return`- ${r.toUpperCase()}: ${t||"(no text)"} \u2192 \`${n}\`${a}`}function gt(s){let e=[];e.push(...s.buttons.map(o=>{var c;return((c=o.selector)==null?void 0:c.css)||""})),e.push(...s.links.map(o=>{var c;return((c=o.selector)==null?void 0:c.css)||""})),e.push(...s.inputs.map(o=>{var c;return((c=o.selector)==null?void 0:c.css)||""})),e.push(...s.clickable.map(o=>{var c;return((c=o.selector)==null?void 0:c.css)||""}));let t=e.length||1,n=e.filter(o=>o.startsWith("#")).length,r=e.filter(o=>/\[data-testid=/.test(o)).length,i=e.filter(o=>/:nth-child\(/.test(o)).length,a=n+r;return`Selector quality: ${Math.round(a/t*100)}% stable (ID/data-testid), ${Math.round(i/t*100)}% structural (:nth-child)`}function pt(s,e){var r,i;let t=[],n=a=>typeof(e==null?void 0:e.maxElements)=="number"?a.slice(0,e.maxElements):a;if(s.buttons.length){t.push("Buttons:");for(let a of n(s.buttons))t.push(O(a,e))}if(s.links.length){t.push("Links:");for(let a of n(s.links))t.push(O(a,e))}if(s.inputs.length){t.push("Inputs:");for(let a of n(s.inputs))t.push(O(a,e))}if(s.clickable.length){t.push("Other Clickable:");for(let a of n(s.clickable))t.push(O(a,e))}if(s.forms.length){t.push("Forms:");for(let a of n(s.forms))t.push(`- FORM: action=${(r=a.action)!=null?r:"-"} method=${(i=a.method)!=null?i:"-"} \u2192 \`${a.selector}\``)}return t.join(`
|
|
2
|
-
`)}function V(s){var a,o;let e=X("region"),t=mt(`${s.selector}|${(a=s.label)!=null?a:""}|${(o=s.role)!=null?o:""}`),n=s.label?` ${s.label}`:"",r=[];s.buttonCount&&r.push(`${s.buttonCount} buttons`),s.linkCount&&r.push(`${s.linkCount} links`),s.inputCount&&r.push(`${s.inputCount} inputs`),s.textPreview&&r.push(`\u201C${$(s.textPreview,80)}\u201D`);let i=r.length
|
|
2
|
+
`)}function V(s){var a,o;let e=X("region"),t=mt(`${s.selector}|${(a=s.label)!=null?a:""}|${(o=s.role)!=null?o:""}`),n=s.label?` ${s.label}`:"",r=[];s.buttonCount&&r.push(`${s.buttonCount} buttons`),s.linkCount&&r.push(`${s.linkCount} links`),s.inputCount&&r.push(`${s.inputCount} inputs`),s.textPreview&&r.push(`\u201C${$(s.textPreview,80)}\u201D`);let i=r.length?`: ${r.join(", ")}`:"";return`${e} ${n} \u2192 \`${s.selector}\` [${t}]${i}`}function N(s,e,t="section"){return`<page ${[e!=null&&e.title?`title="${U(e==null?void 0:e.title)}"`:null,e!=null&&e.url?`url="${U(e==null?void 0:e.url)}"`:null].filter(Boolean).join(" ")}>
|
|
3
3
|
<${t}><![CDATA[
|
|
4
4
|
${s}
|
|
5
5
|
]]></${t}>
|