@feedlog-ai/webcomponents 0.0.20 → 0.0.22

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.
Files changed (67) hide show
  1. package/README.md +20 -5
  2. package/dist/cjs/feedlog-badge.cjs.entry.js +3 -3
  3. package/dist/cjs/feedlog-button_2.cjs.entry.js +1547 -8
  4. package/dist/cjs/feedlog-card.cjs.entry.js +1 -1
  5. package/dist/cjs/feedlog-github-issues-client.cjs.entry.js +24 -18
  6. package/dist/cjs/feedlog-github-issues.cjs.entry.js +14 -4
  7. package/dist/cjs/feedlog-issues-list.cjs.entry.js +8 -37
  8. package/dist/cjs/feedlog-toolkit.cjs.js +2 -2
  9. package/dist/cjs/{index-5lluu_3h.js → index-DnsqTPII.js} +0 -37
  10. package/dist/cjs/loader.cjs.js +2 -2
  11. package/dist/collection/components/feedlog-badge/feedlog-badge.css +15 -3
  12. package/dist/collection/components/feedlog-badge/feedlog-badge.js +3 -3
  13. package/dist/collection/components/feedlog-github-issues/feedlog-github-issues.css +202 -13
  14. package/dist/collection/components/feedlog-github-issues/feedlog-github-issues.js +73 -2
  15. package/dist/collection/components/feedlog-github-issues/feedlog-github-issues.stories.js +56 -6
  16. package/dist/collection/components/feedlog-github-issues-client/feedlog-github-issues-client.js +63 -2
  17. package/dist/collection/components/feedlog-issue/feedlog-issue.css +196 -46
  18. package/dist/collection/components/feedlog-issue/feedlog-issue.js +71 -6
  19. package/dist/collection/components/feedlog-issue/feedlog-issue.stories.js +115 -3
  20. package/dist/collection/components/feedlog-issues-list/feedlog-issues-list.css +3 -209
  21. package/dist/collection/components/feedlog-issues-list/feedlog-issues-list.js +29 -35
  22. package/dist/collection/utils/markdown.js +48 -0
  23. package/dist/components/feedlog-badge.js +1 -1
  24. package/dist/components/feedlog-github-issues-client.js +1 -1
  25. package/dist/components/feedlog-github-issues.js +1 -1
  26. package/dist/components/feedlog-issue.js +1 -1
  27. package/dist/components/feedlog-issues-list.js +1 -1
  28. package/dist/components/index.js +1 -1
  29. package/dist/components/p-BBPFf6g7.js +3 -0
  30. package/dist/components/p-Chc3XZ5Y.js +1 -0
  31. package/dist/components/p-cag4iyHV.js +1 -0
  32. package/dist/esm/feedlog-badge.entry.js +3 -3
  33. package/dist/esm/feedlog-button_2.entry.js +1547 -8
  34. package/dist/esm/feedlog-card.entry.js +1 -1
  35. package/dist/esm/feedlog-github-issues-client.entry.js +24 -18
  36. package/dist/esm/feedlog-github-issues.entry.js +14 -4
  37. package/dist/esm/feedlog-issues-list.entry.js +8 -37
  38. package/dist/esm/feedlog-toolkit.js +3 -3
  39. package/dist/esm/{index-CkB6Yzeb.js → index-rs_66Oq4.js} +0 -37
  40. package/dist/esm/loader.js +3 -3
  41. package/dist/feedlog-toolkit/feedlog-toolkit.esm.js +1 -1
  42. package/dist/feedlog-toolkit/p-13773ed6.entry.js +1 -0
  43. package/dist/feedlog-toolkit/{p-cdb2b098.entry.js → p-4e90285c.entry.js} +1 -1
  44. package/dist/feedlog-toolkit/p-9b515728.entry.js +1 -0
  45. package/dist/feedlog-toolkit/p-da51c7fd.entry.js +1 -0
  46. package/dist/feedlog-toolkit/p-dad7b157.entry.js +3 -0
  47. package/dist/feedlog-toolkit/p-e5ba7dd7.entry.js +1 -0
  48. package/dist/feedlog-toolkit/p-rs_66Oq4.js +2 -0
  49. package/dist/types/components/feedlog-badge/feedlog-badge.d.ts +1 -1
  50. package/dist/types/components/feedlog-github-issues/feedlog-github-issues.d.ts +16 -1
  51. package/dist/types/components/feedlog-github-issues/feedlog-github-issues.stories.d.ts +1 -0
  52. package/dist/types/components/feedlog-github-issues-client/feedlog-github-issues-client.d.ts +14 -1
  53. package/dist/types/components/feedlog-issue/feedlog-issue.d.ts +19 -2
  54. package/dist/types/components/feedlog-issue/feedlog-issue.stories.d.ts +10 -0
  55. package/dist/types/components/feedlog-issues-list/feedlog-issues-list.d.ts +5 -5
  56. package/dist/types/components.d.ts +68 -4
  57. package/dist/types/utils/markdown.d.ts +5 -0
  58. package/package.json +4 -2
  59. package/dist/components/p-Bu_AsIay.js +0 -1
  60. package/dist/components/p-CHtSMTyP.js +0 -1
  61. package/dist/components/p-Cp7B8xwh.js +0 -1
  62. package/dist/feedlog-toolkit/p-2401f510.entry.js +0 -1
  63. package/dist/feedlog-toolkit/p-5df44120.entry.js +0 -1
  64. package/dist/feedlog-toolkit/p-95fea2f4.entry.js +0 -1
  65. package/dist/feedlog-toolkit/p-CkB6Yzeb.js +0 -2
  66. package/dist/feedlog-toolkit/p-b4b631f3.entry.js +0 -1
  67. package/dist/feedlog-toolkit/p-c19a4d1b.entry.js +0 -1
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host } from './index-CkB6Yzeb.js';
1
+ import { r as registerInstance, c as createEvent, h, H as Host } from './index-rs_66Oq4.js';
2
2
 
3
3
  const feedlogButtonCss = () => `:host{display:inline-block;font-family:ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;--feedlog-background:#ffffff;--feedlog-foreground:oklch(0.145 0 0);--feedlog-primary:#030213;--feedlog-primary-foreground:oklch(1 0 0);--feedlog-secondary:oklch(0.95 0.0058 264.53);--feedlog-secondary-foreground:#030213;--feedlog-muted:#ececf0;--feedlog-accent:#e9ebef;--feedlog-accent-foreground:#030213;--feedlog-border:rgba(0, 0, 0, 0.1);--feedlog-input:transparent;--feedlog-ring:oklch(0.708 0 0);--feedlog-destructive:#d4183d;--feedlog-radius:0.625rem}:host(.dark){--feedlog-background:oklch(0.145 0 0);--feedlog-foreground:oklch(0.985 0 0);--feedlog-primary:oklch(0.985 0 0);--feedlog-primary-foreground:oklch(0.205 0 0);--feedlog-secondary:oklch(0.269 0 0);--feedlog-secondary-foreground:oklch(0.985 0 0);--feedlog-muted:oklch(0.269 0 0);--feedlog-accent:oklch(0.269 0 0);--feedlog-accent-foreground:oklch(0.985 0 0);--feedlog-border:oklch(0.269 0 0);--feedlog-input:oklch(0.269 0 0);--feedlog-ring:oklch(0.439 0 0);--feedlog-destructive:oklch(0.396 0.141 25.723)}button{display:inline-flex;align-items:center;justify-content:center;gap:0.5rem;white-space:nowrap;font-size:0.875rem;font-weight:500;border-radius:calc(var(--feedlog-radius) - 2px);border:1px solid transparent;cursor:pointer;transition:all 0.15s ease;outline:none;font-family:inherit}button:disabled{opacity:0.5;cursor:not-allowed;pointer-events:none}button:focus-visible{border-color:var(--feedlog-ring);box-shadow:0 0 0 3px color-mix(in oklab, var(--feedlog-ring) 50%, transparent)}.button-default{background-color:var(--feedlog-primary);color:var(--feedlog-primary-foreground);border-color:transparent}.button-default:hover:not(:disabled){background-color:color-mix(in oklab, var(--feedlog-primary) 90%, transparent)}.button-outline{background-color:var(--feedlog-background);color:var(--feedlog-foreground);border-color:var(--feedlog-border)}.button-outline:hover:not(:disabled){background-color:var(--feedlog-accent);color:var(--feedlog-accent-foreground)}:host(.dark) .button-outline{background-color:transparent;border-color:var(--feedlog-input)}:host(.dark) .button-outline:hover:not(:disabled){background-color:color-mix(in oklab, var(--feedlog-accent) 50%, transparent)}.button-ghost{background-color:transparent;color:var(--feedlog-foreground);border-color:transparent}.button-ghost:hover:not(:disabled){background-color:var(--feedlog-accent);color:var(--feedlog-accent-foreground)}.button-destructive{background-color:var(--feedlog-destructive);color:#ffffff;border-color:transparent}.button-destructive:hover:not(:disabled){background-color:color-mix(in oklab, var(--feedlog-destructive) 90%, transparent)}:host(.dark) .button-destructive{background-color:color-mix(in oklab, var(--feedlog-destructive) 60%, transparent)}.button-size-sm{height:2rem;padding:0 0.75rem;font-size:0.75rem}.button-size-sm:has(svg:only-child){width:2rem;padding:0}.button-size-default{height:2.25rem;padding:0.5rem 1rem}.button-size-lg{height:2.5rem;padding:0.625rem 1.5rem;font-size:1rem}button svg{pointer-events:none;flex-shrink:0;width:1rem;height:1rem}`;
4
4
 
@@ -35,7 +35,1501 @@ const FeedlogButton = class {
35
35
  };
36
36
  FeedlogButton.style = feedlogButtonCss();
37
37
 
38
- const feedlogIssueCss = () => `:host{display:block;font-family:ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;--feedlog-background:#ffffff;--feedlog-foreground:oklch(0.145 0 0);--feedlog-card:#ffffff;--feedlog-card-foreground:oklch(0.145 0 0);--feedlog-muted:#ececf0;--feedlog-muted-foreground:#717182;--feedlog-border:rgba(0, 0, 0, 0.1);--feedlog-accent-color:#2563eb;--feedlog-destructive:#d4183d;--feedlog-blue-400:oklch(0.707 0.165 254.624);--feedlog-blue-600:oklch(0.546 0.245 262.881);--feedlog-blue-100:oklch(0.932 0.032 255.585);--feedlog-red-100:#fce7f3;--feedlog-red-400:#f472b6;--feedlog-red-600:#db2777;--feedlog-radius:0.625rem;--feedlog-gap:0.5rem}:host(.dark){--feedlog-background:oklch(0.145 0 0);--feedlog-foreground:oklch(0.985 0 0);--feedlog-card:oklch(0.145 0 0);--feedlog-card-foreground:oklch(0.985 0 0);--feedlog-muted:oklch(0.269 0 0);--feedlog-muted-foreground:oklch(0.708 0 0);--feedlog-border:oklch(0.269 0 0);--feedlog-accent-color:#3b82f6;--feedlog-destructive:oklch(0.396 0.141 25.723);--feedlog-blue-400:oklch(0.707 0.165 254.624);--feedlog-blue-600:oklch(0.546 0.245 262.881);--feedlog-blue-900-30:color-mix(in oklab, oklch(0.379 0.146 265.522) 30%, transparent);--feedlog-red-900-30:color-mix(in oklab, oklch(0.396 0.141 25.723) 30%, transparent)}.issue-card{background-color:var(--feedlog-card);border:1px solid var(--feedlog-border);border-radius:var(--feedlog-radius);box-shadow:0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);transition:box-shadow 0.15s ease;position:relative}.issue-card:hover{box-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)}.issue-content{padding:1.5rem;display:flex;flex-direction:column;gap:1rem}.issue-header{display:flex;align-items:center;gap:0.5rem;justify-content:space-between}.issue-type-badge{width:fit-content}.pinned-indicator{font-size:1rem;opacity:0.7}.issue-main{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem}.issue-details{flex:1;min-width:0}.issue-title{color:var(--feedlog-card-foreground);font-size:0.875rem;font-weight:600;margin:0 0 0.375rem 0;line-height:1.4;word-break:break-word}.issue-body{color:var(--feedlog-muted-foreground);font-size:0.75rem;line-height:1.625;margin:0 0 0.75rem 0;word-break:break-word;white-space:pre-wrap}.issue-repository{display:flex;align-items:center;gap:0.5rem;font-size:0.75rem;color:var(--feedlog-muted-foreground);margin-bottom:0.5rem}.repo-name{font-weight:500}.github-number{color:var(--feedlog-blue-600);font-weight:600}:host(.dark) .github-number{color:var(--feedlog-blue-400)}.upvote-button{display:flex;flex-direction:column;align-items:center;gap:0.125rem;padding:0.5rem 0.75rem;border-radius:0.5rem;background-color:var(--feedlog-muted);border:1px solid transparent;cursor:pointer;transition:all 0.15s ease;flex-shrink:0;font-size:0.75rem;font-weight:600}.upvote-button:hover{background-color:var(--feedlog-blue-100);border-color:var(--feedlog-blue-400)}.upvote-button.upvoted{background-color:var(--feedlog-red-100);border-color:var(--feedlog-red-400)}.upvote-button.upvoted:hover{background-color:var(--feedlog-red-100);border-color:var(--feedlog-red-600)}:host(.dark) .upvote-button:hover{background-color:var(--feedlog-blue-900-30);border-color:var(--feedlog-blue-600)}:host(.dark) .upvote-button.upvoted{background-color:var(--feedlog-red-900-30);border-color:var(--feedlog-red-600)}.upvote-icon{width:1rem;height:1rem;stroke-width:2}.upvote-icon.filled{color:var(--feedlog-red-600)}.upvote-icon.outline{color:var(--feedlog-blue-600)}:host(.dark) .upvote-icon.outline{color:var(--feedlog-blue-400)}.upvote-count{font-size:0.75rem;font-weight:600;color:var(--feedlog-card-foreground)}.issue-footer{display:flex;flex-direction:column;gap:0.25rem;font-size:0.75rem}.issue-date{color:var(--feedlog-muted-foreground);cursor:help}`;
38
+ /**
39
+ * marked v17.0.2 - a markdown parser
40
+ * Copyright (c) 2018-2026, MarkedJS. (MIT License)
41
+ * Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
42
+ * https://github.com/markedjs/marked
43
+ */
44
+
45
+ /**
46
+ * DO NOT EDIT THIS FILE
47
+ * The code in this file is generated from files in ./src/
48
+ */
49
+
50
+ function M(){return {async:false,breaks:false,extensions:null,gfm:true,hooks:null,pedantic:false,renderer:null,silent:false,tokenizer:null,walkTokens:null}}var T=M();function H(u){T=u;}var _={exec:()=>null};function k(u,e=""){let t=typeof u=="string"?u:u.source,n={replace:(r,i)=>{let s=typeof i=="string"?i:i.source;return s=s.replace(m.caret,"$1"),t=t.replace(r,s),n},getRegex:()=>new RegExp(t,e)};return n}var Re=(()=>{try{return !!new RegExp("(?<=1)(?<!1)")}catch{return false}})(),m={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:u=>new RegExp(`^( {0,3}${u})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:u=>new RegExp(`^ {0,${Math.min(3,u-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:u=>new RegExp(`^ {0,${Math.min(3,u-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:u=>new RegExp(`^ {0,${Math.min(3,u-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:u=>new RegExp(`^ {0,${Math.min(3,u-1)}}#`),htmlBeginRegex:u=>new RegExp(`^ {0,${Math.min(3,u-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:u=>new RegExp(`^ {0,${Math.min(3,u-1)}}>`)},Te=/^(?:[ \t]*(?:\n|$))+/,Oe=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,we=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,I=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ye=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,N=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,re=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,se=k(re).replace(/bull/g,N).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Pe=k(re).replace(/bull/g,N).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Q=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Se=/^[^\n]+/,F=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,$e=k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",F).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),_e=k(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,N).getRegex(),q="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",j=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Le=k("^ {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",j).replace("tag",q).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ie=k(Q).replace("hr",I).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[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",q).getRegex(),Me=k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ie).getRegex(),U={blockquote:Me,code:Oe,def:$e,fences:we,heading:ye,hr:I,html:Le,lheading:se,list:_e,newline:Te,paragraph:ie,table:_,text:Se},te=k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",I).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",q).getRegex(),ze={...U,lheading:Pe,table:te,paragraph:k(Q).replace("hr",I).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",te).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",q).getRegex()},Ce={...U,html:k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",j).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:_,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:k(Q).replace("hr",I).replace("heading",` *#{1,6} *[^
51
+ ]`).replace("lheading",se).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ae=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ie=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,oe=/^( {2,}|\\)\n(?!\s*$)/,Ee=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,v=/[\p{P}\p{S}]/u,K=/[\s\p{P}\p{S}]/u,ae=/[^\s\p{P}\p{S}]/u,Be=k(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,K).getRegex(),le=/(?!~)[\p{P}\p{S}]/u,De=/(?!~)[\s\p{P}\p{S}]/u,qe=/(?:[^\s\p{P}\p{S}]|~)/u,ue=/(?![*_])[\p{P}\p{S}]/u,ve=/(?![*_])[\s\p{P}\p{S}]/u,Ge=/(?:[^\s\p{P}\p{S}]|[*_])/u,He=k(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Re?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),pe=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Ze=k(pe,"u").replace(/punct/g,v).getRegex(),Ne=k(pe,"u").replace(/punct/g,le).getRegex(),ce="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Qe=k(ce,"gu").replace(/notPunctSpace/g,ae).replace(/punctSpace/g,K).replace(/punct/g,v).getRegex(),Fe=k(ce,"gu").replace(/notPunctSpace/g,qe).replace(/punctSpace/g,De).replace(/punct/g,le).getRegex(),je=k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ae).replace(/punctSpace/g,K).replace(/punct/g,v).getRegex(),Ue=k(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ue).getRegex(),Ke="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",We=k(Ke,"gu").replace(/notPunctSpace/g,Ge).replace(/punctSpace/g,ve).replace(/punct/g,ue).getRegex(),Xe=k(/\\(punct)/,"gu").replace(/punct/g,v).getRegex(),Je=k(/^<(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(),Ve=k(j).replace("(?:-->|$)","-->").getRegex(),Ye=k("^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",Ve).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),D=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,et=k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",D).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),he=k(/^!?\[(label)\]\[(ref)\]/).replace("label",D).replace("ref",F).getRegex(),ke=k(/^!?\[(ref)\](?:\[\])?/).replace("ref",F).getRegex(),tt=k("reflink|nolink(?!\\()","g").replace("reflink",he).replace("nolink",ke).getRegex(),ne=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,W={_backpedal:_,anyPunctuation:Xe,autolink:Je,blockSkip:He,br:oe,code:Ie,del:_,delLDelim:_,delRDelim:_,emStrongLDelim:Ze,emStrongRDelimAst:Qe,emStrongRDelimUnd:je,escape:Ae,link:et,nolink:ke,punctuation:Be,reflink:he,reflinkSearch:tt,tag:Ye,text:Ee,url:_},nt={...W,link:k(/^!?\[(label)\]\((.*?)\)/).replace("label",D).getRegex(),reflink:k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",D).getRegex()},Z={...W,emStrongRDelimAst:Fe,emStrongLDelim:Ne,delLDelim:Ue,delRDelim:We,url:k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ne).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\S]|[^\s~\\]))\1(?=[^~]|$)/,text:k(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",ne).getRegex()},rt={...Z,br:k(oe).replace("{2,}","*").getRegex(),text:k(Z.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},E={normal:U,gfm:ze,pedantic:Ce},z={normal:W,gfm:Z,breaks:rt,pedantic:nt};var st={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},de=u=>st[u];function O(u,e){if(e){if(m.escapeTest.test(u))return u.replace(m.escapeReplace,de)}else if(m.escapeTestNoEncode.test(u))return u.replace(m.escapeReplaceNoEncode,de);return u}function X(u){try{u=encodeURI(u).replace(m.percentDecode,"%");}catch{return null}return u}function J(u,e){let t=u.replace(m.findPipe,(i,s,a)=>{let o=false,l=s;for(;--l>=0&&a[l]==="\\";)o=!o;return o?"|":" |"}),n=t.split(m.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-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(m.slashPipe,"|");return n}function C(u,e,t){let n=u.length;if(n===0)return "";let r=0;for(;r<n;){let i=u.charAt(n-r-1);if(i===e&&true)r++;else break}return u.slice(0,n-r)}function ge(u,e){if(u.indexOf(e[1])===-1)return -1;let t=0;for(let n=0;n<u.length;n++)if(u[n]==="\\")n++;else if(u[n]===e[0])t++;else if(u[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function fe(u,e=0){let t=e,n="";for(let r of u)if(r===" "){let i=4-t%4;n+=" ".repeat(i),t+=i;}else n+=r,t++;return n}function me(u,e,t,n,r){let i=e.href,s=e.title||null,a=u[1].replace(r.other.outputLinkReplace,"$1");n.state.inLink=true;let o={type:u[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:s,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=false,o}function it(u,e,t){let n=u.match(t.other.indentCodeCompensation);if(n===null)return e;let r=n[1];return e.split(`
52
+ `).map(i=>{let s=i.match(t.other.beginningSpace);if(s===null)return i;let[a]=s;return a.length>=r.length?i.slice(r.length):i}).join(`
53
+ `)}var w=class{options;rules;lexer;constructor(e){this.options=e||T;}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(this.rules.other.codeRemoveIndent,"");return {type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:C(n,`
54
+ `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=it(n,t[3]||"",this.rules);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(this.rules.other.endingHash.test(n)){let r=C(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.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:C(t[0],`
55
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=C(t[0],`
56
+ `).split(`
57
+ `),r="",i="",s=[];for(;n.length>0;){let a=false,o=[],l;for(l=0;l<n.length;l++)if(this.rules.other.blockquoteStart.test(n[l]))o.push(n[l]),a=true;else if(!a)o.push(n[l]);else break;n=n.slice(l);let p=o.join(`
58
+ `),c=p.replace(this.rules.other.blockquoteSetextReplace,`
59
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
60
+ ${p}`:p,i=i?`${i}
61
+ ${c}`:c;let d=this.lexer.state.top;if(this.lexer.state.top=true,this.lexer.blockTokens(c,s,true),this.lexer.state.top=d,n.length===0)break;let h=s.at(-1);if(h?.type==="code")break;if(h?.type==="blockquote"){let R=h,f=R.raw+`
62
+ `+n.join(`
63
+ `),S=this.blockquote(f);s[s.length-1]=S,r=r.substring(0,r.length-R.raw.length)+S.raw,i=i.substring(0,i.length-R.text.length)+S.text;break}else if(h?.type==="list"){let R=h,f=R.raw+`
64
+ `+n.join(`
65
+ `),S=this.list(f);s[s.length-1]=S,r=r.substring(0,r.length-h.raw.length)+S.raw,i=i.substring(0,i.length-R.raw.length)+S.raw,n=f.substring(s.at(-1).raw.length).split(`
66
+ `);continue}}return {type:"blockquote",raw:r,tokens:s,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:false,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let s=this.rules.other.listItemRegex(n),a=false;for(;e;){let l=false,p="",c="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let d=fe(t[2].split(`
67
+ `,1)[0],t[1].length),h=e.split(`
68
+ `,1)[0],R=!d.trim(),f=0;if(this.options.pedantic?(f=2,c=d.trimStart()):R?f=t[1].length+1:(f=d.search(this.rules.other.nonSpaceChar),f=f>4?1:f,c=d.slice(f),f+=t[1].length),R&&this.rules.other.blankLine.test(h)&&(p+=h+`
69
+ `,e=e.substring(h.length+1),l=true),!l){let S=this.rules.other.nextBulletRegex(f),V=this.rules.other.hrRegex(f),Y=this.rules.other.fencesBeginRegex(f),ee=this.rules.other.headingBeginRegex(f),xe=this.rules.other.htmlBeginRegex(f),be=this.rules.other.blockquoteBeginRegex(f);for(;e;){let G=e.split(`
70
+ `,1)[0],A;if(h=G,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),A=h):A=h.replace(this.rules.other.tabCharGlobal," "),Y.test(h)||ee.test(h)||xe.test(h)||be.test(h)||S.test(h)||V.test(h))break;if(A.search(this.rules.other.nonSpaceChar)>=f||!h.trim())c+=`
71
+ `+A.slice(f);else {if(R||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||Y.test(d)||ee.test(d)||V.test(d))break;c+=`
72
+ `+h;}R=!h.trim(),p+=G+`
73
+ `,e=e.substring(G.length+1),d=A.slice(f);}}i.loose||(a?i.loose=true:this.rules.other.doubleBlankLine.test(p)&&(a=true)),i.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(c),loose:false,text:c,tokens:[]}),i.raw+=p;}let o=i.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let l of i.items){if(this.lexer.state.top=false,l.tokens=this.lexer.blockTokens(l.text,[]),l.task){if(l.text=l.text.replace(this.rules.other.listReplaceTask,""),l.tokens[0]?.type==="text"||l.tokens[0]?.type==="paragraph"){l.tokens[0].raw=l.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),l.tokens[0].text=l.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let c=this.lexer.inlineQueue.length-1;c>=0;c--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[c].src)){this.lexer.inlineQueue[c].src=this.lexer.inlineQueue[c].src.replace(this.rules.other.listReplaceTask,"");break}}let p=this.rules.other.listTaskCheckbox.exec(l.raw);if(p){let c={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};l.checked=c.checked,i.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=c.raw+l.tokens[0].raw,l.tokens[0].text=c.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(c)):l.tokens.unshift({type:"paragraph",raw:c.raw,text:c.raw,tokens:[c]}):l.tokens.unshift(c);}}if(!i.loose){let p=l.tokens.filter(d=>d.type==="space"),c=p.length>0&&p.some(d=>this.rules.other.anyLine.test(d.raw));i.loose=c;}}if(i.loose)for(let l of i.items){l.loose=true;for(let p of l.tokens)p.type==="text"&&(p.type="paragraph");}return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return {type:"html",block:true,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(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return {type:"def",tag:n,raw:t[0],href:r,title:i}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=J(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
74
+ `):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let a of r)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a<n.length;a++)s.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:true,align:s.align[a]});for(let a of i)s.rows.push(J(a,s.header.length).map((o,l)=>({text:o,tokens:this.lexer.inline(o),header:false,align:s.align[l]})));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)===`
75
+ `?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:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return !this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=true:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=false),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=true:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=false),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:false,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let s=C(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else {let s=ge(t[2],"()");if(s===-2)return;if(s>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,o).trim(),t[3]="";}}let r=t[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3]);}else i=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),me(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}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(this.rules.other.multipleSpaceGlobal," "),i=t[r.toLowerCase()];if(!i){let s=n[0].charAt(0);return {type:"text",raw:s,text:s}}return me(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(r[1]||r[2]||"")||!n||this.rules.inline.punctuation.exec(n)){let s=[...r[0]].length-1,a,o,l=s,p=0,c=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+s);(r=c.exec(t))!=null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){l+=o;continue}else if((r[5]||r[6])&&s%3&&!((s+o)%3)){p+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+p);let d=[...r[0]][0].length,h=e.slice(0,s+r.index+d+o);if(Math.min(s,o)%2){let f=h.slice(1,-1);return {type:"em",raw:h,text:f,tokens:this.lexer.inlineTokens(f)}}let R=h.slice(2,-2);return {type:"strong",raw:h,text:R,tokens:this.lexer.inlineTokens(R)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&i&&(n=n.substring(1,n.length-1)),{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,t,n=""){let r=this.rules.inline.delLDelim.exec(e);if(!r)return;if(!(r[1]||"")||!n||this.rules.inline.punctuation.exec(n)){let s=[...r[0]].length-1,a,o,l=s,p=this.rules.inline.delRDelim;for(p.lastIndex=0,t=t.slice(-1*e.length+s);(r=p.exec(t))!=null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a||(o=[...a].length,o!==s))continue;if(r[3]||r[4]){l+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l);let c=[...r[0]][0].length,d=e.slice(0,s+r.index+c+o),h=d.slice(s,-s);return {type:"del",raw:d,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,r;if(t[2]==="@")n=t[0],r="mailto:"+n;else {let i;do i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(i!==t[0]);n=t[0],t[1]==="www."?r="http://"+t[0]:r=t[0];}return {type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return {type:"text",raw:t[0],text:t[0],escaped:n}}}};var x=class u{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||T,this.options.tokenizer=this.options.tokenizer||new w,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:false,inRawBlock:false,top:true};let t={other:m,block:E.normal,inline:z.normal};this.options.pedantic?(t.block=E.pedantic,t.inline=z.pedantic):this.options.gfm&&(t.block=E.gfm,this.options.breaks?t.inline=z.breaks:t.inline=z.gfm),this.tokenizer.rules=t;}static get rules(){return {block:E,inline:z}}static lex(e,t){return new u(t).lex(e)}static lexInline(e,t){return new u(t).inlineTokens(e)}lex(e){e=e.replace(m.carriageReturn,`
76
+ `),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=[],n=false){for(this.options.pedantic&&(e=e.replace(m.tabCharGlobal," ").replace(m.spaceLine,""));e;){let r;if(this.options.extensions?.block?.some(s=>(r=s.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),true):false))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let s=t.at(-1);r.raw.length===1&&s!==void 0?s.raw+=`
77
+ `:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let s=t.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(`
78
+ `)?"":`
79
+ `)+r.raw,s.text+=`
80
+ `+r.text,this.inlineQueue.at(-1).src=s.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let s=t.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(`
81
+ `)?"":`
82
+ `)+r.raw,s.text+=`
83
+ `+r.raw,this.inlineQueue.at(-1).src=s.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let s=1/0,a=e.slice(1),o;this.options.extensions.startBlock.forEach(l=>{o=l.call({lexer:this},a),typeof o=="number"&&o>=0&&(s=Math.min(s,o));}),s<1/0&&s>=0&&(i=e.substring(0,s+1));}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let s=t.at(-1);n&&s?.type==="paragraph"?(s.raw+=(s.raw.endsWith(`
84
+ `)?"":`
85
+ `)+r.raw,s.text+=`
86
+ `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let s=t.at(-1);s?.type==="text"?(s.raw+=(s.raw.endsWith(`
87
+ `)?"":`
88
+ `)+r.raw,s.text+=`
89
+ `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):t.push(r);continue}if(e){let s="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(s);break}else throw new Error(s)}}return this.state.top=true,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let o=Object.keys(this.tokens.links);if(o.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)o.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+"["+"a".repeat(r[0].length-i-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let s=false,a="";for(;e;){s||(a=""),s=false;let o;if(this.options.extensions?.inline?.some(p=>(o=p.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),true):false))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let p=t.at(-1);o.type==="text"&&p?.type==="text"?(p.raw+=o.raw,p.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,a)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,a)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let l=e;if(this.options.extensions?.startInline){let p=1/0,c=e.slice(1),d;this.options.extensions.startInline.forEach(h=>{d=h.call({lexer:this},c),typeof d=="number"&&d>=0&&(p=Math.min(p,d));}),p<1/0&&p>=0&&(l=e.substring(0,p+1));}if(o=this.tokenizer.inlineText(l)){e=e.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(a=o.raw.slice(-1)),s=true;let p=t.at(-1);p?.type==="text"?(p.raw+=o.raw,p.text+=o.text):t.push(o);continue}if(e){let p="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(p);break}else throw new Error(p)}}return t}};var y=class{options;parser;constructor(e){this.options=e||T;}space(e){return ""}code({text:e,lang:t,escaped:n}){let r=(t||"").match(m.notSpaceStart)?.[0],i=e.replace(m.endingNewline,"")+`
90
+ `;return r?'<pre><code class="language-'+O(r)+'">'+(n?i:O(i,true))+`</code></pre>
91
+ `:"<pre><code>"+(n?i:O(i,true))+`</code></pre>
92
+ `}blockquote({tokens:e}){return `<blockquote>
93
+ ${this.parser.parse(e)}</blockquote>
94
+ `}html({text:e}){return e}def(e){return ""}heading({tokens:e,depth:t}){return `<h${t}>${this.parser.parseInline(e)}</h${t}>
95
+ `}hr(e){return `<hr>
96
+ `}list(e){let t=e.ordered,n=e.start,r="";for(let a=0;a<e.items.length;a++){let o=e.items[a];r+=this.listitem(o);}let i=t?"ol":"ul",s=t&&n!==1?' start="'+n+'"':"";return "<"+i+s+`>
97
+ `+r+"</"+i+`>
98
+ `}listitem(e){return `<li>${this.parser.parse(e.tokens)}</li>
99
+ `}checkbox({checked:e}){return "<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return `<p>${this.parser.parseInline(e)}</p>
100
+ `}table(e){let t="",n="";for(let i=0;i<e.header.length;i++)n+=this.tablecell(e.header[i]);t+=this.tablerow({text:n});let r="";for(let i=0;i<e.rows.length;i++){let s=e.rows[i];n="";for(let a=0;a<s.length;a++)n+=this.tablecell(s[a]);r+=this.tablerow({text:n});}return r&&(r=`<tbody>${r}</tbody>`),`<table>
101
+ <thead>
102
+ `+t+`</thead>
103
+ `+r+`</table>
104
+ `}tablerow({text:e}){return `<tr>
105
+ ${e}</tr>
106
+ `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return (e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
107
+ `}strong({tokens:e}){return `<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return `<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return `<code>${O(e,true)}</code>`}br(e){return "<br>"}del({tokens:e}){return `<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=X(e);if(i===null)return r;e=i;let s='<a href="'+e+'"';return t&&(s+=' title="'+O(t)+'"'),s+=">"+r+"</a>",s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=X(e);if(i===null)return O(n);e=i;let s=`<img src="${e}" alt="${n}"`;return t&&(s+=` title="${O(t)}"`),s+=">",s}text(e){return "tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:O(e.text)}};var $=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return ""+e}image({text:e}){return ""+e}br(){return ""}checkbox({raw:e}){return e}};var b=class u{options;renderer;textRenderer;constructor(e){this.options=e||T,this.options.renderer=this.options.renderer||new y,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new $;}static parse(e,t){return new u(t).parse(e)}static parseInline(e,t){return new u(t).parseInline(e)}parse(e){let t="";for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let s=r,a=this.options.extensions.renderers[s.type].call({parser:this},s);if(a!==false||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(s.type)){t+=a||"";continue}}let i=r;switch(i.type){case "space":{t+=this.renderer.space(i);break}case "hr":{t+=this.renderer.hr(i);break}case "heading":{t+=this.renderer.heading(i);break}case "code":{t+=this.renderer.code(i);break}case "table":{t+=this.renderer.table(i);break}case "blockquote":{t+=this.renderer.blockquote(i);break}case "list":{t+=this.renderer.list(i);break}case "checkbox":{t+=this.renderer.checkbox(i);break}case "html":{t+=this.renderer.html(i);break}case "def":{t+=this.renderer.def(i);break}case "paragraph":{t+=this.renderer.paragraph(i);break}case "text":{t+=this.renderer.text(i);break}default:{let s='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return t}parseInline(e,t=this.renderer){let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let a=this.options.extensions.renderers[i.type].call({parser:this},i);if(a!==false||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=a||"";continue}}let s=i;switch(s.type){case "escape":{n+=t.text(s);break}case "html":{n+=t.html(s);break}case "link":{n+=t.link(s);break}case "image":{n+=t.image(s);break}case "checkbox":{n+=t.checkbox(s);break}case "strong":{n+=t.strong(s);break}case "em":{n+=t.em(s);break}case "codespan":{n+=t.codespan(s);break}case "br":{n+=t.br(s);break}case "del":{n+=t.del(s);break}case "text":{n+=t.text(s);break}default:{let a='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}};var P=class{options;block;constructor(e){this.options=e||T;}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?x.lex:x.lexInline}provideParser(){return this.block?b.parse:b.parseInline}};var B=class{defaults=M();options=this.setOptions;parse=this.parseMarkdown(true);parseInline=this.parseMarkdown(false);Parser=b;Renderer=y;TextRenderer=$;Lexer=x;Tokenizer=w;Hooks=P;constructor(...e){this.use(...e);}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case "table":{let i=r;for(let s of i.header)n=n.concat(this.walkTokens(s.tokens,t));for(let s of i.rows)for(let a of s)n=n.concat(this.walkTokens(a.tokens,t));break}case "list":{let i=r;n=n.concat(this.walkTokens(i.items,t));break}default:{let i=r;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(s=>{let a=i[s].flat(1/0);n=n.concat(this.walkTokens(a,t));}):i.tokens&&(n=n.concat(this.walkTokens(i.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||false,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=t.renderers[i.name];s?t.renderers[i.name]=function(...a){let o=i.renderer.apply(this,a);return o===false&&(o=s.apply(this,a)),o}:t.renderers[i.name]=i.renderer;}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=t[i.level];s?s.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]));}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens);}),r.extensions=t),n.renderer){let i=this.defaults.renderer||new y(this.defaults);for(let s in n.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let a=s,o=n.renderer[a],l=i[a];i[a]=(...p)=>{let c=o.apply(i,p);return c===false&&(c=l.apply(i,p)),c||""};}r.renderer=i;}if(n.tokenizer){let i=this.defaults.tokenizer||new w(this.defaults);for(let s in n.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let a=s,o=n.tokenizer[a],l=i[a];i[a]=(...p)=>{let c=o.apply(i,p);return c===false&&(c=l.apply(i,p)),c};}r.tokenizer=i;}if(n.hooks){let i=this.defaults.hooks||new P;for(let s in n.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let a=s,o=n.hooks[a],l=i[a];P.passThroughHooks.has(s)?i[a]=p=>{if(this.defaults.async&&P.passThroughHooksRespectAsync.has(s))return (async()=>{let d=await o.call(i,p);return l.call(i,d)})();let c=o.call(i,p);return l.call(i,c)}:i[a]=(...p)=>{if(this.defaults.async)return (async()=>{let d=await o.apply(i,p);return d===false&&(d=await l.apply(i,p)),d})();let c=o.apply(i,p);return c===false&&(c=l.apply(i,p)),c};}r.hooks=i;}if(n.walkTokens){let i=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(a){let o=[];return o.push(s.call(this,a)),i&&(o=o.concat(i.call(this,a))),o};}this.defaults={...this.defaults,...r};}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return x.lex(e,t??this.defaults)}parser(e,t){return b.parse(e,t??this.defaults)}parseMarkdown(e){return (n,r)=>{let i={...r},s={...this.defaults,...i},a=this.onError(!!s.silent,!!s.async);if(this.defaults.async===true&&i.async===false)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return (async()=>{let o=s.hooks?await s.hooks.preprocess(n):n,p=await(s.hooks?await s.hooks.provideLexer():e?x.lex:x.lexInline)(o,s),c=s.hooks?await s.hooks.processAllTokens(p):p;s.walkTokens&&await Promise.all(this.walkTokens(c,s.walkTokens));let h=await(s.hooks?await s.hooks.provideParser():e?b.parse:b.parseInline)(c,s);return s.hooks?await s.hooks.postprocess(h):h})().catch(a);try{s.hooks&&(n=s.hooks.preprocess(n));let l=(s.hooks?s.hooks.provideLexer():e?x.lex:x.lexInline)(n,s);s.hooks&&(l=s.hooks.processAllTokens(l)),s.walkTokens&&this.walkTokens(l,s.walkTokens);let c=(s.hooks?s.hooks.provideParser():e?b.parse:b.parseInline)(l,s);return s.hooks&&(c=s.hooks.postprocess(c)),c}catch(o){return a(o)}}}onError(e,t){return n=>{if(n.message+=`
108
+ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+O(n.message+"",true)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}};var L=new B;function g(u,e){return L.parse(u,e)}g.options=g.setOptions=function(u){return L.setOptions(u),g.defaults=L.defaults,H(g.defaults),g};g.getDefaults=M;g.defaults=T;g.use=function(...u){return L.use(...u),g.defaults=L.defaults,H(g.defaults),g};g.walkTokens=function(u,e){return L.walkTokens(u,e)};g.parseInline=L.parseInline;g.Parser=b;g.parser=b.parse;g.Renderer=y;g.TextRenderer=$;g.Lexer=x;g.lexer=x.lex;g.Tokenizer=w;g.Hooks=P;g.parse=g;
109
+
110
+ /*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */
111
+
112
+ const {
113
+ entries,
114
+ setPrototypeOf,
115
+ isFrozen,
116
+ getPrototypeOf,
117
+ getOwnPropertyDescriptor
118
+ } = Object;
119
+ let {
120
+ freeze,
121
+ seal,
122
+ create
123
+ } = Object; // eslint-disable-line import/no-mutable-exports
124
+ let {
125
+ apply,
126
+ construct
127
+ } = typeof Reflect !== 'undefined' && Reflect;
128
+ if (!freeze) {
129
+ freeze = function freeze(x) {
130
+ return x;
131
+ };
132
+ }
133
+ if (!seal) {
134
+ seal = function seal(x) {
135
+ return x;
136
+ };
137
+ }
138
+ if (!apply) {
139
+ apply = function apply(func, thisArg) {
140
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
141
+ args[_key - 2] = arguments[_key];
142
+ }
143
+ return func.apply(thisArg, args);
144
+ };
145
+ }
146
+ if (!construct) {
147
+ construct = function construct(Func) {
148
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
149
+ args[_key2 - 1] = arguments[_key2];
150
+ }
151
+ return new Func(...args);
152
+ };
153
+ }
154
+ const arrayForEach = unapply(Array.prototype.forEach);
155
+ const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
156
+ const arrayPop = unapply(Array.prototype.pop);
157
+ const arrayPush = unapply(Array.prototype.push);
158
+ const arraySplice = unapply(Array.prototype.splice);
159
+ const stringToLowerCase = unapply(String.prototype.toLowerCase);
160
+ const stringToString = unapply(String.prototype.toString);
161
+ const stringMatch = unapply(String.prototype.match);
162
+ const stringReplace = unapply(String.prototype.replace);
163
+ const stringIndexOf = unapply(String.prototype.indexOf);
164
+ const stringTrim = unapply(String.prototype.trim);
165
+ const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
166
+ const regExpTest = unapply(RegExp.prototype.test);
167
+ const typeErrorCreate = unconstruct(TypeError);
168
+ /**
169
+ * Creates a new function that calls the given function with a specified thisArg and arguments.
170
+ *
171
+ * @param func - The function to be wrapped and called.
172
+ * @returns A new function that calls the given function with a specified thisArg and arguments.
173
+ */
174
+ function unapply(func) {
175
+ return function (thisArg) {
176
+ if (thisArg instanceof RegExp) {
177
+ thisArg.lastIndex = 0;
178
+ }
179
+ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
180
+ args[_key3 - 1] = arguments[_key3];
181
+ }
182
+ return apply(func, thisArg, args);
183
+ };
184
+ }
185
+ /**
186
+ * Creates a new function that constructs an instance of the given constructor function with the provided arguments.
187
+ *
188
+ * @param func - The constructor function to be wrapped and called.
189
+ * @returns A new function that constructs an instance of the given constructor function with the provided arguments.
190
+ */
191
+ function unconstruct(Func) {
192
+ return function () {
193
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
194
+ args[_key4] = arguments[_key4];
195
+ }
196
+ return construct(Func, args);
197
+ };
198
+ }
199
+ /**
200
+ * Add properties to a lookup table
201
+ *
202
+ * @param set - The set to which elements will be added.
203
+ * @param array - The array containing elements to be added to the set.
204
+ * @param transformCaseFunc - An optional function to transform the case of each element before adding to the set.
205
+ * @returns The modified set with added elements.
206
+ */
207
+ function addToSet(set, array) {
208
+ let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;
209
+ if (setPrototypeOf) {
210
+ // Make 'in' and truthy checks like Boolean(set.constructor)
211
+ // independent of any properties defined on Object.prototype.
212
+ // Prevent prototype setters from intercepting set as a this value.
213
+ setPrototypeOf(set, null);
214
+ }
215
+ let l = array.length;
216
+ while (l--) {
217
+ let element = array[l];
218
+ if (typeof element === 'string') {
219
+ const lcElement = transformCaseFunc(element);
220
+ if (lcElement !== element) {
221
+ // Config presets (e.g. tags.js, attrs.js) are immutable.
222
+ if (!isFrozen(array)) {
223
+ array[l] = lcElement;
224
+ }
225
+ element = lcElement;
226
+ }
227
+ }
228
+ set[element] = true;
229
+ }
230
+ return set;
231
+ }
232
+ /**
233
+ * Clean up an array to harden against CSPP
234
+ *
235
+ * @param array - The array to be cleaned.
236
+ * @returns The cleaned version of the array
237
+ */
238
+ function cleanArray(array) {
239
+ for (let index = 0; index < array.length; index++) {
240
+ const isPropertyExist = objectHasOwnProperty(array, index);
241
+ if (!isPropertyExist) {
242
+ array[index] = null;
243
+ }
244
+ }
245
+ return array;
246
+ }
247
+ /**
248
+ * Shallow clone an object
249
+ *
250
+ * @param object - The object to be cloned.
251
+ * @returns A new object that copies the original.
252
+ */
253
+ function clone(object) {
254
+ const newObject = create(null);
255
+ for (const [property, value] of entries(object)) {
256
+ const isPropertyExist = objectHasOwnProperty(object, property);
257
+ if (isPropertyExist) {
258
+ if (Array.isArray(value)) {
259
+ newObject[property] = cleanArray(value);
260
+ } else if (value && typeof value === 'object' && value.constructor === Object) {
261
+ newObject[property] = clone(value);
262
+ } else {
263
+ newObject[property] = value;
264
+ }
265
+ }
266
+ }
267
+ return newObject;
268
+ }
269
+ /**
270
+ * This method automatically checks if the prop is function or getter and behaves accordingly.
271
+ *
272
+ * @param object - The object to look up the getter function in its prototype chain.
273
+ * @param prop - The property name for which to find the getter function.
274
+ * @returns The getter function found in the prototype chain or a fallback function.
275
+ */
276
+ function lookupGetter(object, prop) {
277
+ while (object !== null) {
278
+ const desc = getOwnPropertyDescriptor(object, prop);
279
+ if (desc) {
280
+ if (desc.get) {
281
+ return unapply(desc.get);
282
+ }
283
+ if (typeof desc.value === 'function') {
284
+ return unapply(desc.value);
285
+ }
286
+ }
287
+ object = getPrototypeOf(object);
288
+ }
289
+ function fallbackValue() {
290
+ return null;
291
+ }
292
+ return fallbackValue;
293
+ }
294
+
295
+ const html$1 = freeze(['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']);
296
+ const svg$1 = freeze(['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']);
297
+ const svgFilters = freeze(['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']);
298
+ // List of SVG elements that are disallowed by default.
299
+ // We still need to know them so that we can do namespace
300
+ // checks properly in case one wants to add them to
301
+ // allow-list.
302
+ const svgDisallowed = freeze(['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']);
303
+ const mathMl$1 = freeze(['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']);
304
+ // Similarly to SVG, we want to know all MathML elements,
305
+ // even those that we disallow by default.
306
+ const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
307
+ const text = freeze(['#text']);
308
+
309
+ const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', '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', 'slot']);
310
+ const svg = freeze(['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']);
311
+ const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
312
+ const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
313
+
314
+ // eslint-disable-next-line unicorn/better-regex
315
+ const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
316
+ const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
317
+ const TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm); // eslint-disable-line unicorn/better-regex
318
+ const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/); // eslint-disable-line no-useless-escape
319
+ const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
320
+ const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
321
+ );
322
+ const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
323
+ const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
324
+ );
325
+ const DOCTYPE_NAME = seal(/^html$/i);
326
+ const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
327
+
328
+ var EXPRESSIONS = /*#__PURE__*/Object.freeze({
329
+ __proto__: null,
330
+ ARIA_ATTR: ARIA_ATTR,
331
+ ATTR_WHITESPACE: ATTR_WHITESPACE,
332
+ CUSTOM_ELEMENT: CUSTOM_ELEMENT,
333
+ DATA_ATTR: DATA_ATTR,
334
+ DOCTYPE_NAME: DOCTYPE_NAME,
335
+ ERB_EXPR: ERB_EXPR,
336
+ IS_ALLOWED_URI: IS_ALLOWED_URI,
337
+ IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
338
+ MUSTACHE_EXPR: MUSTACHE_EXPR,
339
+ TMPLIT_EXPR: TMPLIT_EXPR
340
+ });
341
+
342
+ /* eslint-disable @typescript-eslint/indent */
343
+ // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
344
+ const NODE_TYPE = {
345
+ element: 1,
346
+ text: 3,
347
+ // Deprecated
348
+ progressingInstruction: 7,
349
+ comment: 8,
350
+ document: 9};
351
+ const getGlobal = function getGlobal() {
352
+ return typeof window === 'undefined' ? null : window;
353
+ };
354
+ /**
355
+ * Creates a no-op policy for internal use only.
356
+ * Don't export this function outside this module!
357
+ * @param trustedTypes The policy factory.
358
+ * @param purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
359
+ * @return The policy created (or null, if Trusted Types
360
+ * are not supported or creating the policy failed).
361
+ */
362
+ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
363
+ if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
364
+ return null;
365
+ }
366
+ // Allow the callers to control the unique policy name
367
+ // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
368
+ // Policy creation with duplicate names throws in Trusted Types.
369
+ let suffix = null;
370
+ const ATTR_NAME = 'data-tt-policy-suffix';
371
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
372
+ suffix = purifyHostElement.getAttribute(ATTR_NAME);
373
+ }
374
+ const policyName = 'dompurify' + (suffix ? '#' + suffix : '');
375
+ try {
376
+ return trustedTypes.createPolicy(policyName, {
377
+ createHTML(html) {
378
+ return html;
379
+ },
380
+ createScriptURL(scriptUrl) {
381
+ return scriptUrl;
382
+ }
383
+ });
384
+ } catch (_) {
385
+ // Policy creation failed (most likely another DOMPurify script has
386
+ // already run). Skip creating the policy, as this will only cause errors
387
+ // if TT are enforced.
388
+ console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
389
+ return null;
390
+ }
391
+ };
392
+ const _createHooksMap = function _createHooksMap() {
393
+ return {
394
+ afterSanitizeAttributes: [],
395
+ afterSanitizeElements: [],
396
+ afterSanitizeShadowDOM: [],
397
+ beforeSanitizeAttributes: [],
398
+ beforeSanitizeElements: [],
399
+ beforeSanitizeShadowDOM: [],
400
+ uponSanitizeAttribute: [],
401
+ uponSanitizeElement: [],
402
+ uponSanitizeShadowNode: []
403
+ };
404
+ };
405
+ function createDOMPurify() {
406
+ let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
407
+ const DOMPurify = root => createDOMPurify(root);
408
+ DOMPurify.version = '3.3.1';
409
+ DOMPurify.removed = [];
410
+ if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
411
+ // Not running in a browser, provide a factory function
412
+ // so that you can pass your own Window
413
+ DOMPurify.isSupported = false;
414
+ return DOMPurify;
415
+ }
416
+ let {
417
+ document
418
+ } = window;
419
+ const originalDocument = document;
420
+ const currentScript = originalDocument.currentScript;
421
+ const {
422
+ DocumentFragment,
423
+ HTMLTemplateElement,
424
+ Node,
425
+ Element,
426
+ NodeFilter,
427
+ NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,
428
+ HTMLFormElement,
429
+ DOMParser,
430
+ trustedTypes
431
+ } = window;
432
+ const ElementPrototype = Element.prototype;
433
+ const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
434
+ const remove = lookupGetter(ElementPrototype, 'remove');
435
+ const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
436
+ const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
437
+ const getParentNode = lookupGetter(ElementPrototype, 'parentNode');
438
+ // As per issue #47, the web-components registry is inherited by a
439
+ // new document created via createHTMLDocument. As per the spec
440
+ // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
441
+ // a new empty registry is used when creating a template contents owner
442
+ // document, so we use that as our parent document to ensure nothing
443
+ // is inherited.
444
+ if (typeof HTMLTemplateElement === 'function') {
445
+ const template = document.createElement('template');
446
+ if (template.content && template.content.ownerDocument) {
447
+ document = template.content.ownerDocument;
448
+ }
449
+ }
450
+ let trustedTypesPolicy;
451
+ let emptyHTML = '';
452
+ const {
453
+ implementation,
454
+ createNodeIterator,
455
+ createDocumentFragment,
456
+ getElementsByTagName
457
+ } = document;
458
+ const {
459
+ importNode
460
+ } = originalDocument;
461
+ let hooks = _createHooksMap();
462
+ /**
463
+ * Expose whether this browser supports running the full DOMPurify.
464
+ */
465
+ DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;
466
+ const {
467
+ MUSTACHE_EXPR,
468
+ ERB_EXPR,
469
+ TMPLIT_EXPR,
470
+ DATA_ATTR,
471
+ ARIA_ATTR,
472
+ IS_SCRIPT_OR_DATA,
473
+ ATTR_WHITESPACE,
474
+ CUSTOM_ELEMENT
475
+ } = EXPRESSIONS;
476
+ let {
477
+ IS_ALLOWED_URI: IS_ALLOWED_URI$1
478
+ } = EXPRESSIONS;
479
+ /**
480
+ * We consider the elements and attributes below to be safe. Ideally
481
+ * don't add any new ones but feel free to remove unwanted ones.
482
+ */
483
+ /* allowed element names */
484
+ let ALLOWED_TAGS = null;
485
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
486
+ /* Allowed attribute names */
487
+ let ALLOWED_ATTR = null;
488
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
489
+ /*
490
+ * Configure how DOMPurify should handle custom elements and their attributes as well as customized built-in elements.
491
+ * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
492
+ * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
493
+ * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
494
+ */
495
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
496
+ tagNameCheck: {
497
+ writable: true,
498
+ configurable: false,
499
+ enumerable: true,
500
+ value: null
501
+ },
502
+ attributeNameCheck: {
503
+ writable: true,
504
+ configurable: false,
505
+ enumerable: true,
506
+ value: null
507
+ },
508
+ allowCustomizedBuiltInElements: {
509
+ writable: true,
510
+ configurable: false,
511
+ enumerable: true,
512
+ value: false
513
+ }
514
+ }));
515
+ /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
516
+ let FORBID_TAGS = null;
517
+ /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
518
+ let FORBID_ATTR = null;
519
+ /* Config object to store ADD_TAGS/ADD_ATTR functions (when used as functions) */
520
+ const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
521
+ tagCheck: {
522
+ writable: true,
523
+ configurable: false,
524
+ enumerable: true,
525
+ value: null
526
+ },
527
+ attributeCheck: {
528
+ writable: true,
529
+ configurable: false,
530
+ enumerable: true,
531
+ value: null
532
+ }
533
+ }));
534
+ /* Decide if ARIA attributes are okay */
535
+ let ALLOW_ARIA_ATTR = true;
536
+ /* Decide if custom data attributes are okay */
537
+ let ALLOW_DATA_ATTR = true;
538
+ /* Decide if unknown protocols are okay */
539
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
540
+ /* Decide if self-closing tags in attributes are allowed.
541
+ * Usually removed due to a mXSS issue in jQuery 3.0 */
542
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
543
+ /* Output should be safe for common template engines.
544
+ * This means, DOMPurify removes data attributes, mustaches and ERB
545
+ */
546
+ let SAFE_FOR_TEMPLATES = false;
547
+ /* Output should be safe even for XML used within HTML and alike.
548
+ * This means, DOMPurify removes comments when containing risky content.
549
+ */
550
+ let SAFE_FOR_XML = true;
551
+ /* Decide if document with <html>... should be returned */
552
+ let WHOLE_DOCUMENT = false;
553
+ /* Track whether config is already set on this instance of DOMPurify. */
554
+ let SET_CONFIG = false;
555
+ /* Decide if all elements (e.g. style, script) must be children of
556
+ * document.body. By default, browsers might move them to document.head */
557
+ let FORCE_BODY = false;
558
+ /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
559
+ * string (or a TrustedHTML object if Trusted Types are supported).
560
+ * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
561
+ */
562
+ let RETURN_DOM = false;
563
+ /* Decide if a DOM `DocumentFragment` should be returned, instead of a html
564
+ * string (or a TrustedHTML object if Trusted Types are supported) */
565
+ let RETURN_DOM_FRAGMENT = false;
566
+ /* Try to return a Trusted Type object instead of a string, return a string in
567
+ * case Trusted Types are not supported */
568
+ let RETURN_TRUSTED_TYPE = false;
569
+ /* Output should be free from DOM clobbering attacks?
570
+ * This sanitizes markups named with colliding, clobberable built-in DOM APIs.
571
+ */
572
+ let SANITIZE_DOM = true;
573
+ /* Achieve full DOM Clobbering protection by isolating the namespace of named
574
+ * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
575
+ *
576
+ * HTML/DOM spec rules that enable DOM Clobbering:
577
+ * - Named Access on Window (§7.3.3)
578
+ * - DOM Tree Accessors (§3.1.5)
579
+ * - Form Element Parent-Child Relations (§4.10.3)
580
+ * - Iframe srcdoc / Nested WindowProxies (§4.8.5)
581
+ * - HTMLCollection (§4.2.10.2)
582
+ *
583
+ * Namespace isolation is implemented by prefixing `id` and `name` attributes
584
+ * with a constant string, i.e., `user-content-`
585
+ */
586
+ let SANITIZE_NAMED_PROPS = false;
587
+ const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
588
+ /* Keep element content when removing element? */
589
+ let KEEP_CONTENT = true;
590
+ /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
591
+ * of importing it into a new Document and returning a sanitized copy */
592
+ let IN_PLACE = false;
593
+ /* Allow usage of profiles like html, svg and mathMl */
594
+ let USE_PROFILES = {};
595
+ /* Tags to ignore content of when KEEP_CONTENT is true */
596
+ let FORBID_CONTENTS = null;
597
+ const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
598
+ /* Tags that are safe for data: URIs */
599
+ let DATA_URI_TAGS = null;
600
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
601
+ /* Attributes safe for values like "javascript:" */
602
+ let URI_SAFE_ATTRIBUTES = null;
603
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
604
+ const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
605
+ const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
606
+ const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
607
+ /* Document namespace */
608
+ let NAMESPACE = HTML_NAMESPACE;
609
+ let IS_EMPTY_INPUT = false;
610
+ /* Allowed XHTML+XML namespaces */
611
+ let ALLOWED_NAMESPACES = null;
612
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
613
+ let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
614
+ let HTML_INTEGRATION_POINTS = addToSet({}, ['annotation-xml']);
615
+ // Certain elements are allowed in both SVG and HTML
616
+ // namespace. We need to specify them explicitly
617
+ // so that they don't get erroneously deleted from
618
+ // HTML namespace.
619
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
620
+ /* Parsing of strict XHTML documents */
621
+ let PARSER_MEDIA_TYPE = null;
622
+ const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
623
+ const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
624
+ let transformCaseFunc = null;
625
+ /* Keep a reference to config to pass to hooks */
626
+ let CONFIG = null;
627
+ /* Ideally, do not touch anything below this line */
628
+ /* ______________________________________________ */
629
+ const formElement = document.createElement('form');
630
+ const isRegexOrFunction = function isRegexOrFunction(testValue) {
631
+ return testValue instanceof RegExp || testValue instanceof Function;
632
+ };
633
+ /**
634
+ * _parseConfig
635
+ *
636
+ * @param cfg optional config literal
637
+ */
638
+ // eslint-disable-next-line complexity
639
+ const _parseConfig = function _parseConfig() {
640
+ let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
641
+ if (CONFIG && CONFIG === cfg) {
642
+ return;
643
+ }
644
+ /* Shield configuration object from tampering */
645
+ if (!cfg || typeof cfg !== 'object') {
646
+ cfg = {};
647
+ }
648
+ /* Shield configuration object from prototype pollution */
649
+ cfg = clone(cfg);
650
+ PARSER_MEDIA_TYPE =
651
+ // eslint-disable-next-line unicorn/prefer-includes
652
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
653
+ // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
654
+ transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
655
+ /* Set configuration parameters */
656
+ ALLOWED_TAGS = objectHasOwnProperty(cfg, 'ALLOWED_TAGS') ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
657
+ ALLOWED_ATTR = objectHasOwnProperty(cfg, 'ALLOWED_ATTR') ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
658
+ ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, 'ALLOWED_NAMESPACES') ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
659
+ URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
660
+ DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS') ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
661
+ FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
662
+ FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});
663
+ FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});
664
+ USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES : false;
665
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
666
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
667
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
668
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true
669
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
670
+ SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false; // Default true
671
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
672
+ RETURN_DOM = cfg.RETURN_DOM || false; // Default false
673
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
674
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
675
+ FORCE_BODY = cfg.FORCE_BODY || false; // Default false
676
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
677
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
678
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
679
+ IN_PLACE = cfg.IN_PLACE || false; // Default false
680
+ IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
681
+ NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
682
+ MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;
683
+ HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;
684
+ CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
685
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
686
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
687
+ }
688
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
689
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
690
+ }
691
+ if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {
692
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
693
+ }
694
+ if (SAFE_FOR_TEMPLATES) {
695
+ ALLOW_DATA_ATTR = false;
696
+ }
697
+ if (RETURN_DOM_FRAGMENT) {
698
+ RETURN_DOM = true;
699
+ }
700
+ /* Parse profile info */
701
+ if (USE_PROFILES) {
702
+ ALLOWED_TAGS = addToSet({}, text);
703
+ ALLOWED_ATTR = [];
704
+ if (USE_PROFILES.html === true) {
705
+ addToSet(ALLOWED_TAGS, html$1);
706
+ addToSet(ALLOWED_ATTR, html);
707
+ }
708
+ if (USE_PROFILES.svg === true) {
709
+ addToSet(ALLOWED_TAGS, svg$1);
710
+ addToSet(ALLOWED_ATTR, svg);
711
+ addToSet(ALLOWED_ATTR, xml);
712
+ }
713
+ if (USE_PROFILES.svgFilters === true) {
714
+ addToSet(ALLOWED_TAGS, svgFilters);
715
+ addToSet(ALLOWED_ATTR, svg);
716
+ addToSet(ALLOWED_ATTR, xml);
717
+ }
718
+ if (USE_PROFILES.mathMl === true) {
719
+ addToSet(ALLOWED_TAGS, mathMl$1);
720
+ addToSet(ALLOWED_ATTR, mathMl);
721
+ addToSet(ALLOWED_ATTR, xml);
722
+ }
723
+ }
724
+ /* Merge configuration parameters */
725
+ if (cfg.ADD_TAGS) {
726
+ if (typeof cfg.ADD_TAGS === 'function') {
727
+ EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
728
+ } else {
729
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
730
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
731
+ }
732
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
733
+ }
734
+ }
735
+ if (cfg.ADD_ATTR) {
736
+ if (typeof cfg.ADD_ATTR === 'function') {
737
+ EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
738
+ } else {
739
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
740
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
741
+ }
742
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
743
+ }
744
+ }
745
+ if (cfg.ADD_URI_SAFE_ATTR) {
746
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
747
+ }
748
+ if (cfg.FORBID_CONTENTS) {
749
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
750
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
751
+ }
752
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
753
+ }
754
+ if (cfg.ADD_FORBID_CONTENTS) {
755
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
756
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
757
+ }
758
+ addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
759
+ }
760
+ /* Add #text in case KEEP_CONTENT is set to true */
761
+ if (KEEP_CONTENT) {
762
+ ALLOWED_TAGS['#text'] = true;
763
+ }
764
+ /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
765
+ if (WHOLE_DOCUMENT) {
766
+ addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
767
+ }
768
+ /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
769
+ if (ALLOWED_TAGS.table) {
770
+ addToSet(ALLOWED_TAGS, ['tbody']);
771
+ delete FORBID_TAGS.tbody;
772
+ }
773
+ if (cfg.TRUSTED_TYPES_POLICY) {
774
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {
775
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
776
+ }
777
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {
778
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
779
+ }
780
+ // Overwrite existing TrustedTypes policy.
781
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
782
+ // Sign local variables required by `sanitize`.
783
+ emptyHTML = trustedTypesPolicy.createHTML('');
784
+ } else {
785
+ // Uninitialized policy, attempt to initialize the internal dompurify policy.
786
+ if (trustedTypesPolicy === undefined) {
787
+ trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
788
+ }
789
+ // If creating the internal policy succeeded sign internal variables.
790
+ if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {
791
+ emptyHTML = trustedTypesPolicy.createHTML('');
792
+ }
793
+ }
794
+ // Prevent further manipulation of configuration.
795
+ // Not available in IE8, Safari 5, etc.
796
+ if (freeze) {
797
+ freeze(cfg);
798
+ }
799
+ CONFIG = cfg;
800
+ };
801
+ /* Keep track of all possible SVG and MathML tags
802
+ * so that we can perform the namespace checks
803
+ * correctly. */
804
+ const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
805
+ const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
806
+ /**
807
+ * @param element a DOM element whose namespace is being checked
808
+ * @returns Return false if the element has a
809
+ * namespace that a spec-compliant parser would never
810
+ * return. Return true otherwise.
811
+ */
812
+ const _checkValidNamespace = function _checkValidNamespace(element) {
813
+ let parent = getParentNode(element);
814
+ // In JSDOM, if we're inside shadow DOM, then parentNode
815
+ // can be null. We just simulate parent in this case.
816
+ if (!parent || !parent.tagName) {
817
+ parent = {
818
+ namespaceURI: NAMESPACE,
819
+ tagName: 'template'
820
+ };
821
+ }
822
+ const tagName = stringToLowerCase(element.tagName);
823
+ const parentTagName = stringToLowerCase(parent.tagName);
824
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
825
+ return false;
826
+ }
827
+ if (element.namespaceURI === SVG_NAMESPACE) {
828
+ // The only way to switch from HTML namespace to SVG
829
+ // is via <svg>. If it happens via any other tag, then
830
+ // it should be killed.
831
+ if (parent.namespaceURI === HTML_NAMESPACE) {
832
+ return tagName === 'svg';
833
+ }
834
+ // The only way to switch from MathML to SVG is via`
835
+ // svg if parent is either <annotation-xml> or MathML
836
+ // text integration points.
837
+ if (parent.namespaceURI === MATHML_NAMESPACE) {
838
+ return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
839
+ }
840
+ // We only allow elements that are defined in SVG
841
+ // spec. All others are disallowed in SVG namespace.
842
+ return Boolean(ALL_SVG_TAGS[tagName]);
843
+ }
844
+ if (element.namespaceURI === MATHML_NAMESPACE) {
845
+ // The only way to switch from HTML namespace to MathML
846
+ // is via <math>. If it happens via any other tag, then
847
+ // it should be killed.
848
+ if (parent.namespaceURI === HTML_NAMESPACE) {
849
+ return tagName === 'math';
850
+ }
851
+ // The only way to switch from SVG to MathML is via
852
+ // <math> and HTML integration points
853
+ if (parent.namespaceURI === SVG_NAMESPACE) {
854
+ return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
855
+ }
856
+ // We only allow elements that are defined in MathML
857
+ // spec. All others are disallowed in MathML namespace.
858
+ return Boolean(ALL_MATHML_TAGS[tagName]);
859
+ }
860
+ if (element.namespaceURI === HTML_NAMESPACE) {
861
+ // The only way to switch from SVG to HTML is via
862
+ // HTML integration points, and from MathML to HTML
863
+ // is via MathML text integration points
864
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
865
+ return false;
866
+ }
867
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
868
+ return false;
869
+ }
870
+ // We disallow tags that are specific for MathML
871
+ // or SVG and should never appear in HTML namespace
872
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
873
+ }
874
+ // For XHTML and XML documents that support custom namespaces
875
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
876
+ return true;
877
+ }
878
+ // The code should never reach this place (this means
879
+ // that the element somehow got namespace that is not
880
+ // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
881
+ // Return false just in case.
882
+ return false;
883
+ };
884
+ /**
885
+ * _forceRemove
886
+ *
887
+ * @param node a DOM node
888
+ */
889
+ const _forceRemove = function _forceRemove(node) {
890
+ arrayPush(DOMPurify.removed, {
891
+ element: node
892
+ });
893
+ try {
894
+ // eslint-disable-next-line unicorn/prefer-dom-node-remove
895
+ getParentNode(node).removeChild(node);
896
+ } catch (_) {
897
+ remove(node);
898
+ }
899
+ };
900
+ /**
901
+ * _removeAttribute
902
+ *
903
+ * @param name an Attribute name
904
+ * @param element a DOM node
905
+ */
906
+ const _removeAttribute = function _removeAttribute(name, element) {
907
+ try {
908
+ arrayPush(DOMPurify.removed, {
909
+ attribute: element.getAttributeNode(name),
910
+ from: element
911
+ });
912
+ } catch (_) {
913
+ arrayPush(DOMPurify.removed, {
914
+ attribute: null,
915
+ from: element
916
+ });
917
+ }
918
+ element.removeAttribute(name);
919
+ // We void attribute values for unremovable "is" attributes
920
+ if (name === 'is') {
921
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
922
+ try {
923
+ _forceRemove(element);
924
+ } catch (_) {}
925
+ } else {
926
+ try {
927
+ element.setAttribute(name, '');
928
+ } catch (_) {}
929
+ }
930
+ }
931
+ };
932
+ /**
933
+ * _initDocument
934
+ *
935
+ * @param dirty - a string of dirty markup
936
+ * @return a DOM, filled with the dirty markup
937
+ */
938
+ const _initDocument = function _initDocument(dirty) {
939
+ /* Create a HTML document */
940
+ let doc = null;
941
+ let leadingWhitespace = null;
942
+ if (FORCE_BODY) {
943
+ dirty = '<remove></remove>' + dirty;
944
+ } else {
945
+ /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
946
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
947
+ leadingWhitespace = matches && matches[0];
948
+ }
949
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
950
+ // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
951
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
952
+ }
953
+ const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
954
+ /*
955
+ * Use the DOMParser API by default, fallback later if needs be
956
+ * DOMParser not work for svg when has multiple root element.
957
+ */
958
+ if (NAMESPACE === HTML_NAMESPACE) {
959
+ try {
960
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
961
+ } catch (_) {}
962
+ }
963
+ /* Use createHTMLDocument in case DOMParser is not available */
964
+ if (!doc || !doc.documentElement) {
965
+ doc = implementation.createDocument(NAMESPACE, 'template', null);
966
+ try {
967
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
968
+ } catch (_) {
969
+ // Syntax error if dirtyPayload is invalid xml
970
+ }
971
+ }
972
+ const body = doc.body || doc.documentElement;
973
+ if (dirty && leadingWhitespace) {
974
+ body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
975
+ }
976
+ /* Work on whole document or just its body */
977
+ if (NAMESPACE === HTML_NAMESPACE) {
978
+ return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
979
+ }
980
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
981
+ };
982
+ /**
983
+ * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
984
+ *
985
+ * @param root The root element or node to start traversing on.
986
+ * @return The created NodeIterator
987
+ */
988
+ const _createNodeIterator = function _createNodeIterator(root) {
989
+ return createNodeIterator.call(root.ownerDocument || root, root,
990
+ // eslint-disable-next-line no-bitwise
991
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
992
+ };
993
+ /**
994
+ * _isClobbered
995
+ *
996
+ * @param element element to check for clobbering attacks
997
+ * @return true if clobbered, false if safe
998
+ */
999
+ const _isClobbered = function _isClobbered(element) {
1000
+ return element instanceof HTMLFormElement && (typeof element.nodeName !== 'string' || typeof element.textContent !== 'string' || typeof element.removeChild !== 'function' || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== 'function' || typeof element.setAttribute !== 'function' || typeof element.namespaceURI !== 'string' || typeof element.insertBefore !== 'function' || typeof element.hasChildNodes !== 'function');
1001
+ };
1002
+ /**
1003
+ * Checks whether the given object is a DOM node.
1004
+ *
1005
+ * @param value object to check whether it's a DOM node
1006
+ * @return true is object is a DOM node
1007
+ */
1008
+ const _isNode = function _isNode(value) {
1009
+ return typeof Node === 'function' && value instanceof Node;
1010
+ };
1011
+ function _executeHooks(hooks, currentNode, data) {
1012
+ arrayForEach(hooks, hook => {
1013
+ hook.call(DOMPurify, currentNode, data, CONFIG);
1014
+ });
1015
+ }
1016
+ /**
1017
+ * _sanitizeElements
1018
+ *
1019
+ * @protect nodeName
1020
+ * @protect textContent
1021
+ * @protect removeChild
1022
+ * @param currentNode to check for permission to exist
1023
+ * @return true if node was killed, false if left alive
1024
+ */
1025
+ const _sanitizeElements = function _sanitizeElements(currentNode) {
1026
+ let content = null;
1027
+ /* Execute a hook if present */
1028
+ _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
1029
+ /* Check if element is clobbered or can clobber */
1030
+ if (_isClobbered(currentNode)) {
1031
+ _forceRemove(currentNode);
1032
+ return true;
1033
+ }
1034
+ /* Now let's check the element's type and name */
1035
+ const tagName = transformCaseFunc(currentNode.nodeName);
1036
+ /* Execute a hook if present */
1037
+ _executeHooks(hooks.uponSanitizeElement, currentNode, {
1038
+ tagName,
1039
+ allowedTags: ALLOWED_TAGS
1040
+ });
1041
+ /* Detect mXSS attempts abusing namespace confusion */
1042
+ if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
1043
+ _forceRemove(currentNode);
1044
+ return true;
1045
+ }
1046
+ /* Remove any occurrence of processing instructions */
1047
+ if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
1048
+ _forceRemove(currentNode);
1049
+ return true;
1050
+ }
1051
+ /* Remove any kind of possibly harmful comments */
1052
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
1053
+ _forceRemove(currentNode);
1054
+ return true;
1055
+ }
1056
+ /* Remove element if anything forbids its presence */
1057
+ if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])) {
1058
+ /* Check if we have a custom element to handle */
1059
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
1060
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
1061
+ return false;
1062
+ }
1063
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
1064
+ return false;
1065
+ }
1066
+ }
1067
+ /* Keep content except for bad-listed elements */
1068
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
1069
+ const parentNode = getParentNode(currentNode) || currentNode.parentNode;
1070
+ const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
1071
+ if (childNodes && parentNode) {
1072
+ const childCount = childNodes.length;
1073
+ for (let i = childCount - 1; i >= 0; --i) {
1074
+ const childClone = cloneNode(childNodes[i], true);
1075
+ childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
1076
+ parentNode.insertBefore(childClone, getNextSibling(currentNode));
1077
+ }
1078
+ }
1079
+ }
1080
+ _forceRemove(currentNode);
1081
+ return true;
1082
+ }
1083
+ /* Check whether element has a valid namespace */
1084
+ if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
1085
+ _forceRemove(currentNode);
1086
+ return true;
1087
+ }
1088
+ /* Make sure that older browsers don't get fallback-tag mXSS */
1089
+ if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
1090
+ _forceRemove(currentNode);
1091
+ return true;
1092
+ }
1093
+ /* Sanitize element content to be template-safe */
1094
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
1095
+ /* Get the element's text content */
1096
+ content = currentNode.textContent;
1097
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
1098
+ content = stringReplace(content, expr, ' ');
1099
+ });
1100
+ if (currentNode.textContent !== content) {
1101
+ arrayPush(DOMPurify.removed, {
1102
+ element: currentNode.cloneNode()
1103
+ });
1104
+ currentNode.textContent = content;
1105
+ }
1106
+ }
1107
+ /* Execute a hook if present */
1108
+ _executeHooks(hooks.afterSanitizeElements, currentNode, null);
1109
+ return false;
1110
+ };
1111
+ /**
1112
+ * _isValidAttribute
1113
+ *
1114
+ * @param lcTag Lowercase tag name of containing element.
1115
+ * @param lcName Lowercase attribute name.
1116
+ * @param value Attribute value.
1117
+ * @return Returns true if `value` is valid, otherwise false.
1118
+ */
1119
+ // eslint-disable-next-line complexity
1120
+ const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
1121
+ /* Make sure attribute cannot clobber */
1122
+ if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
1123
+ return false;
1124
+ }
1125
+ /* Allow valid data-* attributes: At least one character after "-"
1126
+ (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
1127
+ XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
1128
+ We don't need to check the value; it's always URI safe. */
1129
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
1130
+ if (
1131
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
1132
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1133
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
1134
+ _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) ||
1135
+ // Alternative, second condition checks if it's an `is`-attribute, AND
1136
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1137
+ lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {
1138
+ return false;
1139
+ }
1140
+ /* Check value is safe. First, is attr inert? If so, is safe */
1141
+ } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if (value) {
1142
+ return false;
1143
+ } else ;
1144
+ return true;
1145
+ };
1146
+ /**
1147
+ * _isBasicCustomElement
1148
+ * checks if at least one dash is included in tagName, and it's not the first char
1149
+ * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
1150
+ *
1151
+ * @param tagName name of the tag of the node to sanitize
1152
+ * @returns Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
1153
+ */
1154
+ const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
1155
+ return tagName !== 'annotation-xml' && stringMatch(tagName, CUSTOM_ELEMENT);
1156
+ };
1157
+ /**
1158
+ * _sanitizeAttributes
1159
+ *
1160
+ * @protect attributes
1161
+ * @protect nodeName
1162
+ * @protect removeAttribute
1163
+ * @protect setAttribute
1164
+ *
1165
+ * @param currentNode to sanitize
1166
+ */
1167
+ const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
1168
+ /* Execute a hook if present */
1169
+ _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
1170
+ const {
1171
+ attributes
1172
+ } = currentNode;
1173
+ /* Check if we have attributes; if not we might have a text node */
1174
+ if (!attributes || _isClobbered(currentNode)) {
1175
+ return;
1176
+ }
1177
+ const hookEvent = {
1178
+ attrName: '',
1179
+ attrValue: '',
1180
+ keepAttr: true,
1181
+ allowedAttributes: ALLOWED_ATTR,
1182
+ forceKeepAttr: undefined
1183
+ };
1184
+ let l = attributes.length;
1185
+ /* Go backwards over all attributes; safely remove bad ones */
1186
+ while (l--) {
1187
+ const attr = attributes[l];
1188
+ const {
1189
+ name,
1190
+ namespaceURI,
1191
+ value: attrValue
1192
+ } = attr;
1193
+ const lcName = transformCaseFunc(name);
1194
+ const initValue = attrValue;
1195
+ let value = name === 'value' ? initValue : stringTrim(initValue);
1196
+ /* Execute a hook if present */
1197
+ hookEvent.attrName = lcName;
1198
+ hookEvent.attrValue = value;
1199
+ hookEvent.keepAttr = true;
1200
+ hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
1201
+ _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
1202
+ value = hookEvent.attrValue;
1203
+ /* Full DOM Clobbering protection via namespace isolation,
1204
+ * Prefix id and name attributes with `user-content-`
1205
+ */
1206
+ if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
1207
+ // Remove the attribute with this value
1208
+ _removeAttribute(name, currentNode);
1209
+ // Prefix the value and later re-create the attribute with the sanitized value
1210
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
1211
+ }
1212
+ /* Work around a security issue with comments inside attributes */
1213
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title|textarea)/i, value)) {
1214
+ _removeAttribute(name, currentNode);
1215
+ continue;
1216
+ }
1217
+ /* Make sure we cannot easily use animated hrefs, even if animations are allowed */
1218
+ if (lcName === 'attributename' && stringMatch(value, 'href')) {
1219
+ _removeAttribute(name, currentNode);
1220
+ continue;
1221
+ }
1222
+ /* Did the hooks approve of the attribute? */
1223
+ if (hookEvent.forceKeepAttr) {
1224
+ continue;
1225
+ }
1226
+ /* Did the hooks approve of the attribute? */
1227
+ if (!hookEvent.keepAttr) {
1228
+ _removeAttribute(name, currentNode);
1229
+ continue;
1230
+ }
1231
+ /* Work around a security issue in jQuery 3.0 */
1232
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
1233
+ _removeAttribute(name, currentNode);
1234
+ continue;
1235
+ }
1236
+ /* Sanitize attribute content to be template-safe */
1237
+ if (SAFE_FOR_TEMPLATES) {
1238
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
1239
+ value = stringReplace(value, expr, ' ');
1240
+ });
1241
+ }
1242
+ /* Is `value` valid for this attribute? */
1243
+ const lcTag = transformCaseFunc(currentNode.nodeName);
1244
+ if (!_isValidAttribute(lcTag, lcName, value)) {
1245
+ _removeAttribute(name, currentNode);
1246
+ continue;
1247
+ }
1248
+ /* Handle attributes that require Trusted Types */
1249
+ if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {
1250
+ if (namespaceURI) ; else {
1251
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
1252
+ case 'TrustedHTML':
1253
+ {
1254
+ value = trustedTypesPolicy.createHTML(value);
1255
+ break;
1256
+ }
1257
+ case 'TrustedScriptURL':
1258
+ {
1259
+ value = trustedTypesPolicy.createScriptURL(value);
1260
+ break;
1261
+ }
1262
+ }
1263
+ }
1264
+ }
1265
+ /* Handle invalid data-* attribute set by try-catching it */
1266
+ if (value !== initValue) {
1267
+ try {
1268
+ if (namespaceURI) {
1269
+ currentNode.setAttributeNS(namespaceURI, name, value);
1270
+ } else {
1271
+ /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
1272
+ currentNode.setAttribute(name, value);
1273
+ }
1274
+ if (_isClobbered(currentNode)) {
1275
+ _forceRemove(currentNode);
1276
+ } else {
1277
+ arrayPop(DOMPurify.removed);
1278
+ }
1279
+ } catch (_) {
1280
+ _removeAttribute(name, currentNode);
1281
+ }
1282
+ }
1283
+ }
1284
+ /* Execute a hook if present */
1285
+ _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
1286
+ };
1287
+ /**
1288
+ * _sanitizeShadowDOM
1289
+ *
1290
+ * @param fragment to iterate over recursively
1291
+ */
1292
+ const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
1293
+ let shadowNode = null;
1294
+ const shadowIterator = _createNodeIterator(fragment);
1295
+ /* Execute a hook if present */
1296
+ _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
1297
+ while (shadowNode = shadowIterator.nextNode()) {
1298
+ /* Execute a hook if present */
1299
+ _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
1300
+ /* Sanitize tags and elements */
1301
+ _sanitizeElements(shadowNode);
1302
+ /* Check attributes next */
1303
+ _sanitizeAttributes(shadowNode);
1304
+ /* Deep shadow DOM detected */
1305
+ if (shadowNode.content instanceof DocumentFragment) {
1306
+ _sanitizeShadowDOM(shadowNode.content);
1307
+ }
1308
+ }
1309
+ /* Execute a hook if present */
1310
+ _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
1311
+ };
1312
+ // eslint-disable-next-line complexity
1313
+ DOMPurify.sanitize = function (dirty) {
1314
+ let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1315
+ let body = null;
1316
+ let importedNode = null;
1317
+ let currentNode = null;
1318
+ let returnNode = null;
1319
+ /* Make sure we have a string to sanitize.
1320
+ DO NOT return early, as this will return the wrong type if
1321
+ the user has requested a DOM object rather than a string */
1322
+ IS_EMPTY_INPUT = !dirty;
1323
+ if (IS_EMPTY_INPUT) {
1324
+ dirty = '<!-->';
1325
+ }
1326
+ /* Stringify, in case dirty is an object */
1327
+ if (typeof dirty !== 'string' && !_isNode(dirty)) {
1328
+ if (typeof dirty.toString === 'function') {
1329
+ dirty = dirty.toString();
1330
+ if (typeof dirty !== 'string') {
1331
+ throw typeErrorCreate('dirty is not a string, aborting');
1332
+ }
1333
+ } else {
1334
+ throw typeErrorCreate('toString is not a function');
1335
+ }
1336
+ }
1337
+ /* Return dirty HTML if DOMPurify cannot run */
1338
+ if (!DOMPurify.isSupported) {
1339
+ return dirty;
1340
+ }
1341
+ /* Assign config vars */
1342
+ if (!SET_CONFIG) {
1343
+ _parseConfig(cfg);
1344
+ }
1345
+ /* Clean up removed elements */
1346
+ DOMPurify.removed = [];
1347
+ /* Check if dirty is correctly typed for IN_PLACE */
1348
+ if (typeof dirty === 'string') {
1349
+ IN_PLACE = false;
1350
+ }
1351
+ if (IN_PLACE) {
1352
+ /* Do some early pre-sanitization to avoid unsafe root nodes */
1353
+ if (dirty.nodeName) {
1354
+ const tagName = transformCaseFunc(dirty.nodeName);
1355
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
1356
+ throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
1357
+ }
1358
+ }
1359
+ } else if (dirty instanceof Node) {
1360
+ /* If dirty is a DOM element, append to an empty document to avoid
1361
+ elements being stripped by the parser */
1362
+ body = _initDocument('<!---->');
1363
+ importedNode = body.ownerDocument.importNode(dirty, true);
1364
+ if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === 'BODY') {
1365
+ /* Node is already a body, use as is */
1366
+ body = importedNode;
1367
+ } else if (importedNode.nodeName === 'HTML') {
1368
+ body = importedNode;
1369
+ } else {
1370
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
1371
+ body.appendChild(importedNode);
1372
+ }
1373
+ } else {
1374
+ /* Exit directly if we have nothing to do */
1375
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&
1376
+ // eslint-disable-next-line unicorn/prefer-includes
1377
+ dirty.indexOf('<') === -1) {
1378
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
1379
+ }
1380
+ /* Initialize the document to work on */
1381
+ body = _initDocument(dirty);
1382
+ /* Check we have a DOM node from the data */
1383
+ if (!body) {
1384
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
1385
+ }
1386
+ }
1387
+ /* Remove first element node (ours) if FORCE_BODY is set */
1388
+ if (body && FORCE_BODY) {
1389
+ _forceRemove(body.firstChild);
1390
+ }
1391
+ /* Get node iterator */
1392
+ const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
1393
+ /* Now start iterating over the created document */
1394
+ while (currentNode = nodeIterator.nextNode()) {
1395
+ /* Sanitize tags and elements */
1396
+ _sanitizeElements(currentNode);
1397
+ /* Check attributes next */
1398
+ _sanitizeAttributes(currentNode);
1399
+ /* Shadow DOM detected, sanitize it */
1400
+ if (currentNode.content instanceof DocumentFragment) {
1401
+ _sanitizeShadowDOM(currentNode.content);
1402
+ }
1403
+ }
1404
+ /* If we sanitized `dirty` in-place, return it. */
1405
+ if (IN_PLACE) {
1406
+ return dirty;
1407
+ }
1408
+ /* Return sanitized string or DOM */
1409
+ if (RETURN_DOM) {
1410
+ if (RETURN_DOM_FRAGMENT) {
1411
+ returnNode = createDocumentFragment.call(body.ownerDocument);
1412
+ while (body.firstChild) {
1413
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
1414
+ returnNode.appendChild(body.firstChild);
1415
+ }
1416
+ } else {
1417
+ returnNode = body;
1418
+ }
1419
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
1420
+ /*
1421
+ AdoptNode() is not used because internal state is not reset
1422
+ (e.g. the past names map of a HTMLFormElement), this is safe
1423
+ in theory but we would rather not risk another attack vector.
1424
+ The state that is cloned by importNode() is explicitly defined
1425
+ by the specs.
1426
+ */
1427
+ returnNode = importNode.call(originalDocument, returnNode, true);
1428
+ }
1429
+ return returnNode;
1430
+ }
1431
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
1432
+ /* Serialize doctype if allowed */
1433
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
1434
+ serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
1435
+ }
1436
+ /* Sanitize final string template-safe */
1437
+ if (SAFE_FOR_TEMPLATES) {
1438
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
1439
+ serializedHTML = stringReplace(serializedHTML, expr, ' ');
1440
+ });
1441
+ }
1442
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
1443
+ };
1444
+ DOMPurify.setConfig = function () {
1445
+ let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1446
+ _parseConfig(cfg);
1447
+ SET_CONFIG = true;
1448
+ };
1449
+ DOMPurify.clearConfig = function () {
1450
+ CONFIG = null;
1451
+ SET_CONFIG = false;
1452
+ };
1453
+ DOMPurify.isValidAttribute = function (tag, attr, value) {
1454
+ /* Initialize shared config vars if necessary. */
1455
+ if (!CONFIG) {
1456
+ _parseConfig({});
1457
+ }
1458
+ const lcTag = transformCaseFunc(tag);
1459
+ const lcName = transformCaseFunc(attr);
1460
+ return _isValidAttribute(lcTag, lcName, value);
1461
+ };
1462
+ DOMPurify.addHook = function (entryPoint, hookFunction) {
1463
+ if (typeof hookFunction !== 'function') {
1464
+ return;
1465
+ }
1466
+ arrayPush(hooks[entryPoint], hookFunction);
1467
+ };
1468
+ DOMPurify.removeHook = function (entryPoint, hookFunction) {
1469
+ if (hookFunction !== undefined) {
1470
+ const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
1471
+ return index === -1 ? undefined : arraySplice(hooks[entryPoint], index, 1)[0];
1472
+ }
1473
+ return arrayPop(hooks[entryPoint]);
1474
+ };
1475
+ DOMPurify.removeHooks = function (entryPoint) {
1476
+ hooks[entryPoint] = [];
1477
+ };
1478
+ DOMPurify.removeAllHooks = function () {
1479
+ hooks = _createHooksMap();
1480
+ };
1481
+ return DOMPurify;
1482
+ }
1483
+ var purify = createDOMPurify();
1484
+
1485
+ /**
1486
+ * Parse markdown to sanitized HTML for safe rendering.
1487
+ * Uses marked for parsing and DOMPurify for XSS protection.
1488
+ */
1489
+ function parseMarkdown(markdown) {
1490
+ if (markdown == null || markdown === '') {
1491
+ return '';
1492
+ }
1493
+ const html = g.parse(markdown, {
1494
+ gfm: true,
1495
+ breaks: true,
1496
+ });
1497
+ return purify.sanitize(html, {
1498
+ ALLOWED_TAGS: [
1499
+ 'p',
1500
+ 'br',
1501
+ 'strong',
1502
+ 'em',
1503
+ 'b',
1504
+ 'i',
1505
+ 'u',
1506
+ 's',
1507
+ 'code',
1508
+ 'pre',
1509
+ 'a',
1510
+ 'ul',
1511
+ 'ol',
1512
+ 'li',
1513
+ 'h1',
1514
+ 'h2',
1515
+ 'h3',
1516
+ 'h4',
1517
+ 'h5',
1518
+ 'h6',
1519
+ 'blockquote',
1520
+ 'hr',
1521
+ 'table',
1522
+ 'thead',
1523
+ 'tbody',
1524
+ 'tr',
1525
+ 'th',
1526
+ 'td',
1527
+ ],
1528
+ ALLOWED_ATTR: ['href', 'target', 'rel'],
1529
+ });
1530
+ }
1531
+
1532
+ const feedlogIssueCss = () => `:host{display:block;font-family:ui-sans-serif,\\n system-ui,\\n -apple-system,\\n BlinkMacSystemFont,\\n 'Segoe UI',\\n Roboto,\\n 'Helvetica Neue',\\n Arial,\\n sans-serif;--feedlog-background:#ffffff;--feedlog-foreground:oklch(0.145 0 0);--feedlog-card:#ffffff;--feedlog-card-foreground:oklch(0.145 0 0);--feedlog-muted:#f1f5f9;--feedlog-muted-foreground:#64748b;--feedlog-border:rgba(0, 0, 0, 0.08);--feedlog-accent-color:#2563eb;--feedlog-destructive:#d4183d;--feedlog-blue-400:oklch(0.707 0.165 254.624);--feedlog-blue-600:oklch(0.546 0.245 262.881);--feedlog-blue-100:oklch(0.932 0.032 255.585);--feedlog-red-100:#fce7f3;--feedlog-red-400:#f472b6;--feedlog-red-600:#db2777;--feedlog-radius:0.625rem;--feedlog-gap:0.5rem;--feedlog-card-padding:1.25rem;--feedlog-title-font-size:0.9375rem;--feedlog-title-font-weight:600;--feedlog-body-font-size:0.8125rem;--feedlog-body-line-height:1.5;--feedlog-timestamp-font-size:0.6875rem;--feedlog-timestamp-color:var(--feedlog-muted-foreground);--feedlog-card-accent-width:3px;--feedlog-icon-color:var(--feedlog-muted-foreground);--feedlog-icon-color-muted:var(--feedlog-muted-foreground);--feedlog-pin-color:var(--feedlog-accent-color);--feedlog-upvote-icon-color:var(--feedlog-blue-600);--feedlog-upvote-icon-filled-color:var(--feedlog-red-600);--feedlog-shadow:0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08);--feedlog-shadow-hover:0 4px 12px -2px rgba(0, 0, 0, 0.1), 0 2px 6px -2px rgba(0, 0, 0, 0.08)}:host(.dark){--feedlog-background:oklch(0.18 0.01 260);--feedlog-foreground:oklch(0.985 0 0);--feedlog-card:oklch(0.24 0.01 260);--feedlog-card-foreground:oklch(0.985 0 0);--feedlog-muted:oklch(0.32 0.01 260);--feedlog-muted-foreground:oklch(0.72 0.02 260);--feedlog-border:oklch(0.34 0.01 260);--feedlog-accent-color:#3b82f6;--feedlog-destructive:oklch(0.396 0.141 25.723);--feedlog-blue-400:oklch(0.707 0.165 254.624);--feedlog-blue-600:oklch(0.546 0.245 262.881);--feedlog-blue-900-30:color-mix(in oklab, oklch(0.379 0.146 265.522) 30%, transparent);--feedlog-red-900-30:color-mix(in oklab, oklch(0.396 0.141 25.723) 30%, transparent);--feedlog-upvote-icon-color:var(--feedlog-blue-400);--feedlog-upvote-icon-filled-color:var(--feedlog-red-600);--feedlog-shadow:0 1px 3px 0 rgba(0, 0, 0, 0.3);--feedlog-shadow-hover:0 4px 12px -2px rgba(0, 0, 0, 0.4)}.issue-card{background-color:var(--feedlog-card);border:1px solid var(--feedlog-border);border-radius:var(--feedlog-radius);box-shadow:var(--feedlog-shadow);transition:box-shadow 0.2s ease,\\n transform 0.2s ease;position:relative;overflow:hidden}.issue-card::before{content:'';position:absolute;left:0;top:0;bottom:0;width:var(--feedlog-card-accent-width);background:var(--feedlog-accent-color)}.issue-card.issue-type-bug::before{background:var(--feedlog-destructive)}.issue-card:hover{box-shadow:var(--feedlog-shadow-hover)}.issue-content{padding:var(--feedlog-card-padding);padding-left:calc(var(--feedlog-card-padding) + var(--feedlog-card-accent-width));display:flex;flex-direction:column;gap:0.875rem}.issue-header{display:flex;align-items:flex-start;justify-content:space-between;gap:0.75rem;min-height:1.5rem}.issue-header-left{display:flex;align-items:center;gap:0.375rem;flex-wrap:wrap}.issue-type-badge{width:fit-content}.pinned-indicator{display:flex;align-items:center;color:var(--feedlog-pin-color, var(--feedlog-accent-color));opacity:0.9}.pin-icon{width:0.875rem;height:0.875rem;color:inherit}.issue-timestamp{font-size:var(--feedlog-timestamp-font-size);color:var(--feedlog-timestamp-color);white-space:nowrap;flex-shrink:0;cursor:help}.issue-main{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem}.issue-details{flex:1;min-width:0}.issue-title{color:var(--feedlog-card-foreground);font-size:var(--feedlog-title-font-size);font-weight:var(--feedlog-title-font-weight);margin:0 0 0.5rem 0;line-height:1.4;word-break:break-word}.issue-body{color:var(--feedlog-muted-foreground);font-size:var(--feedlog-body-font-size);line-height:var(--feedlog-body-line-height);margin:0 0 0.75rem 0;word-break:break-word}.issue-body :first-child{margin-top:0}.issue-body :last-child{margin-bottom:0}.issue-body p{margin:0 0 0.5em 0}.issue-body p:last-child{margin-bottom:0}.issue-body a{color:var(--feedlog-accent-color);text-decoration:none}.issue-body a:hover{text-decoration:underline}.issue-body code{background-color:var(--feedlog-muted);padding:0.125em 0.375em;border-radius:0.25rem;font-size:0.9em}.issue-body pre{margin:0.5em 0;padding:0.75rem;background-color:var(--feedlog-muted);border-radius:0.25rem;overflow-x:auto;font-size:0.85em}.issue-body pre code{background:none;padding:0}.issue-body strong{font-weight:600}.issue-body ul,.issue-body ol{margin:0.5em 0;padding-left:1.25em}.issue-body li{margin:0.25em 0}.issue-body blockquote{margin:0.5em 0;padding-left:1em;border-left:3px solid var(--feedlog-muted);color:var(--feedlog-muted-foreground)}.issue-repository{display:flex;align-items:center;gap:0.5rem;font-size:0.75rem;color:var(--feedlog-muted-foreground);flex-wrap:wrap}.repo-name{font-weight:500}.github-link{display:inline-flex;align-items:center;gap:0.25rem;color:var(--feedlog-accent-color);text-decoration:none;font-weight:500;font-size:0.75rem;padding:0.125rem 0.375rem;border-radius:0.25rem;transition:background-color 0.15s ease,\\n color 0.15s ease}.github-link:hover{text-decoration:underline}.github-link-icon{flex-shrink:0;color:inherit}.github-link-text{white-space:nowrap}.github-number{color:var(--feedlog-blue-600);font-weight:600}:host(.dark) .github-number{color:var(--feedlog-blue-400)}.upvote-button{display:flex;flex-direction:column;align-items:center;gap:0.125rem;padding:0.5rem 0.75rem;border-radius:0.5rem;background-color:var(--feedlog-muted);border:1px solid transparent;cursor:pointer;transition:all 0.2s ease;flex-shrink:0;font-size:0.75rem;font-weight:600}.upvote-button:hover{background-color:var(--feedlog-blue-100);border-color:var(--feedlog-blue-400)}.upvote-button.upvoted{background-color:var(--feedlog-red-100);border-color:var(--feedlog-red-400)}.upvote-button.upvoted:hover{background-color:var(--feedlog-red-100);border-color:var(--feedlog-red-600)}:host(.dark) .upvote-button:hover{background-color:var(--feedlog-blue-900-30);border-color:var(--feedlog-blue-600)}:host(.dark) .upvote-button.upvoted{background-color:var(--feedlog-red-900-30);border-color:var(--feedlog-red-600)}.upvote-icon{width:1rem;height:1rem;color:inherit}.upvote-icon.filled{color:var(--feedlog-upvote-icon-filled-color)}.upvote-icon.outline{color:var(--feedlog-upvote-icon-color)}.upvote-count{font-size:0.75rem;font-weight:600;color:var(--feedlog-card-foreground)}`;
39
1533
 
40
1534
  const FeedlogIssueComponent = class {
41
1535
  constructor(hostRef) {
@@ -55,13 +1549,19 @@ const FeedlogIssueComponent = class {
55
1549
  };
56
1550
  }
57
1551
  /**
58
- * Renders the heart icon SVG - filled or outline based on upvote state
1552
+ * Renders the pin icon SVG (Lucide/Feather style)
59
1553
  */
60
- renderHeartIcon(filled) {
1554
+ renderPinIcon() {
1555
+ return (h("svg", { class: "pin-icon", xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("path", { d: "M12 17v5" }), h("path", { d: "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16h1v2a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1v-2h1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z" })));
1556
+ }
1557
+ /**
1558
+ * Renders the upvote (thumbs-up) icon SVG
1559
+ */
1560
+ renderUpvoteIcon(filled) {
61
1561
  if (filled) {
62
- return (h("svg", { class: "upvote-icon filled", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor" }, h("path", { d: "M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" })));
1562
+ return (h("svg", { class: "upvote-icon filled", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor" }, h("path", { d: "M7 10v12" }), h("path", { d: "M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2h0a3.13 3.13 0 0 1 3 3.88Z" })));
63
1563
  }
64
- return (h("svg", { class: "upvote-icon outline", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("path", { d: "M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" })));
1564
+ return (h("svg", { class: "upvote-icon outline", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("path", { d: "M7 10v12" }), h("path", { d: "M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2h0a3.13 3.13 0 0 1 3 3.88Z" })));
65
1565
  }
66
1566
  /**
67
1567
  * Format an ISO date string to a relative time string
@@ -87,11 +1587,50 @@ const FeedlogIssueComponent = class {
87
1587
  return 'unknown date';
88
1588
  }
89
1589
  }
90
- render() {
1590
+ /**
1591
+ * Get the status badge label for closed issues
1592
+ */
1593
+ getStatusBadgeLabel() {
91
1594
  const { issue } = this;
1595
+ if (issue.status === 'in_progress')
1596
+ return 'In progress';
1597
+ if (issue.status === 'closed' && issue.type === 'bug')
1598
+ return 'Resolved';
1599
+ if (issue.status === 'closed' && issue.type === 'enhancement')
1600
+ return 'Implemented';
1601
+ return null;
1602
+ }
1603
+ /**
1604
+ * Renders the external link (GitHub) icon SVG
1605
+ */
1606
+ renderExternalLinkIcon() {
1607
+ return (h("svg", { class: "github-link-icon", xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }), h("polyline", { points: "15 3 21 3 21 9" }), h("line", { x1: "10", y1: "14", x2: "21", y2: "3" })));
1608
+ }
1609
+ render() {
1610
+ var _a, _b;
1611
+ const { issue, issueUrl } = this;
92
1612
  if (!issue)
93
1613
  return null;
94
- return (h(Host, { class: this.theme === 'dark' ? 'dark' : '' }, h("div", { class: "issue-card" }, h("div", { class: "issue-content" }, h("div", { class: "issue-header" }, h("div", { class: "issue-type-badge" }, issue.type === 'bug' ? (h("feedlog-badge", { variant: "destructive" }, "Bug")) : (h("feedlog-badge", { variant: "enhancement" }, "Enhancement"))), issue.pinnedAt && (h("div", { class: "pinned-indicator", title: "Pinned issue" }, "\uD83D\uDCCC"))), h("div", { class: "issue-main" }, h("div", { class: "issue-details" }, h("h3", { class: "issue-title" }, issue.title), h("p", { class: "issue-body" }, issue.body), h("div", { class: "issue-repository" }, h("span", { class: "repo-name" }, issue.repository.owner, "/", issue.repository.name))), issue.type !== 'bug' && (h("button", { class: `upvote-button ${issue.hasUpvoted ? 'upvoted' : ''}`, onClick: (e) => this.handleUpvote(e), title: issue.hasUpvoted ? 'Remove upvote' : 'Upvote this issue' }, this.renderHeartIcon(issue.hasUpvoted), h("span", { class: "upvote-count" }, issue.upvoteCount)))), h("div", { class: "issue-footer" }, h("span", { class: "issue-date", title: `Updated: ${issue.updatedAt}` }, "Updated ", this.formatDate(issue.updatedAt)), h("span", { class: "issue-date", title: `Created: ${issue.createdAt}` }, "Created ", this.formatDate(issue.createdAt)))))));
1614
+ const wasUpdated = new Date(issue.updatedAt).getTime() > new Date(issue.createdAt).getTime();
1615
+ const timestampLabel = wasUpdated ? 'Updated' : 'Created';
1616
+ const timestampDate = wasUpdated ? issue.updatedAt : issue.createdAt;
1617
+ const timestampTitle = wasUpdated
1618
+ ? `Updated: ${issue.updatedAt}`
1619
+ : `Created: ${issue.createdAt}`;
1620
+ const displayTitle = (_a = issue.title) !== null && _a !== void 0 ? _a : 'Untitled';
1621
+ const rawRepoName = issue.repository.name;
1622
+ const repoName = rawRepoName != null &&
1623
+ rawRepoName !== '' &&
1624
+ rawRepoName.toLowerCase() !== 'unnamed repository'
1625
+ ? rawRepoName
1626
+ : null;
1627
+ const repoTooltip = issue.repository.description != null && issue.repository.description !== ''
1628
+ ? issue.repository.description
1629
+ : undefined;
1630
+ const statusBadgeLabel = this.getStatusBadgeLabel();
1631
+ const githubUrl = (_b = issue.githubIssueLink) !== null && _b !== void 0 ? _b : issueUrl;
1632
+ const showGithubButton = githubUrl != null && githubUrl !== '';
1633
+ return (h(Host, { class: this.theme === 'dark' ? 'dark' : '', "data-upvoted": issue.hasUpvoted ? 'true' : 'false' }, h("div", { class: `issue-card issue-type-${issue.type}` }, h("div", { class: "issue-content" }, h("div", { class: "issue-header" }, h("div", { class: "issue-header-left" }, h("div", { class: "issue-type-badge" }, issue.type === 'bug' ? (h("feedlog-badge", { variant: "destructive" }, "Bug")) : (h("feedlog-badge", { variant: "enhancement" }, "Enhancement"))), statusBadgeLabel && (h("feedlog-badge", { variant: "secondary" }, statusBadgeLabel)), issue.pinnedAt && (h("div", { class: "pinned-indicator", title: "Pinned issue" }, this.renderPinIcon()))), h("span", { class: "issue-timestamp", title: timestampTitle }, timestampLabel, " ", this.formatDate(timestampDate))), h("div", { class: "issue-main" }, h("div", { class: "issue-details" }, h("h3", { class: "issue-title" }, displayTitle), issue.body != null && issue.body !== '' && (h("div", { class: "issue-body", innerHTML: parseMarkdown(issue.body) })), h("div", { class: "issue-repository" }, repoName != null && (h("span", { class: "repo-name", title: repoTooltip }, repoName)), showGithubButton && (h("a", { part: "github-link", class: "github-link", href: githubUrl, target: "_blank", rel: "noopener noreferrer", title: "View on GitHub" }, this.renderExternalLinkIcon(), h("span", { class: "github-link-text" }, "View on GitHub"))))), issue.type !== 'bug' && (h("button", { part: "upvote-button", class: `upvote-button ${issue.hasUpvoted ? 'upvoted' : ''}`, onClick: (e) => this.handleUpvote(e), title: issue.hasUpvoted ? 'Remove upvote' : 'Upvote this issue' }, h("slot", { name: "upvote-icon" }, this.renderUpvoteIcon(issue.hasUpvoted)), h("span", { class: "upvote-count" }, issue.upvoteCount))))))));
95
1634
  }
96
1635
  };
97
1636
  FeedlogIssueComponent.style = feedlogIssueCss();