@aaa_iii/fzv 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +162 -0
- package/README.md +115 -72
- package/dist/client/assets/{c-BOwhf9XG.js → c-BrjaNpVh.js} +1 -1
- package/dist/client/assets/{cpp-DpzZLjVG.js → cpp-BIxKXcra.js} +1 -1
- package/dist/client/assets/{highlight-8tepxCyl.js → highlight-hBTJsM0d.js} +3 -3
- package/dist/client/assets/index-DmtUQAD5.js +69 -0
- package/dist/client/assets/{java-CLOHQwSj.js → java-D_0z2NwT.js} +1 -1
- package/dist/client/assets/{jsx-6cZ_qQIQ.js → jsx-Dyxbavxn.js} +1 -1
- package/dist/client/assets/{latex-BdQ50_4Z.js → latex-D_hv-EHy.js} +1 -1
- package/dist/client/assets/{lua-COOzpq9a.js → lua-BkwxsP7-.js} +1 -1
- package/dist/client/assets/{pdf-BKh0TLgl.js → pdf-CIufTche.js} +2 -2
- package/dist/client/assets/{r-CcRq0cGl.js → r-B-o4EwkG.js} +1 -1
- package/dist/client/assets/{ruby-DMlj-gdq.js → ruby-C11HOYlt.js} +1 -1
- package/dist/client/assets/{tsx-CoAl8Bip.js → tsx-BIbTecDf.js} +1 -1
- package/dist/client/assets/{typescript-CEZCLEMH.js → typescript-BMg-mt7U.js} +1 -1
- package/dist/client/assets/{xml-CLG99EYI.js → xml-BQ9PLRGp.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/catalog.js +6 -0
- package/dist/server/cli.js +35 -10
- package/dist/server/network.js +4 -0
- package/dist/server/office.js +244 -0
- package/dist/server/server.js +53 -4
- package/dist/shared.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/index-BdokDwpe.js +0 -69
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-BKh0TLgl.js","assets/pdf-C_UMrClT.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=class{indexed;a;b;constructor(e){let t=0,n=e=>/[\p{L}\p{N}]/u.test(e),r=e=>e&&e.toLocaleLowerCase()===e&&e.toLocaleUpperCase()!==e,i=e=>e&&e.toLocaleUpperCase()===e&&e.toLocaleLowerCase()!==e;this.indexed=e.map(e=>{let a=Array.from(e.path),o=a.map(e=>e.toLocaleLowerCase()),s=new Int8Array(a.length);for(let e=0;e<a.length;e++){let t=a[e],o=a[e-1]??``;e===0||o===`/`||o===`\\`||([`_`,`-`,`.`].includes(o)||!n(o))&&n(t)?s[e]=8:(r(o)&&i(t)||/\d/.test(t)&&!/\d/.test(o))&&(s[e]=7)}return t=Math.max(t,a.length),{file:e,chars:a,lower:o,bonuses:s}}),this.a=new Int32Array(t),this.b=new Int32Array(t)}termScore(e,t){let{chars:n,lower:r,bonuses:i}=t,a=n.length;if(e.chars.length>a)return-1;let o=(t,i)=>e.smartCase?e.chars[t]===n[i]:e.lower[t]===r[i],s=0;for(let t=0;t<e.chars.length;t++){let e=!1;for(;s<a;)if(o(t,s++)){e=!0;break}if(!e)return-1}let c=-1073741823,l=this.a,u=this.b;l.fill(c,0,a);for(let e=0;e<a;e++)o(0,e)&&(l[e]=16+2*i[e]);for(let t=1;t<e.chars.length;t++){u.fill(c,0,a);let e=c;for(let n=0;n<a;n++){if(n>=2&&l[n-2]>c&&(e=Math.max(e,l[n-2]+n-2)),!o(t,n))continue;let r=n>0&&l[n-1]>c?l[n-1]+16+i[n]+4:c,a=e>c?e+16+i[n]-3-(n-2):c;u[n]=Math.max(r,a)}[l,u]=[u,l]}let d=c;for(let e=0;e<a;e++)d=Math.max(d,l[e]);return d}search(e,t=250){let n=e.trim(),r=n.endsWith(`/`)?n.slice(0,-1):``;if(!n||this.indexed.some(e=>e.file.kind===`directory`&&e.file.path===r)){let e=r?`${r}/`:``,n=this.indexed.map(e=>e.file).filter(t=>t.path.startsWith(e)&&!t.path.slice(e.length).includes(`/`)).sort((e,t)=>Number(t.kind===`directory`)-Number(e.kind===`directory`)||e.path.localeCompare(t.path));return{files:n.slice(0,t),total:n.length}}let i=e.trim().split(/\s+/).filter(Boolean).map(e=>{let t=Array.from(e);return{chars:t,lower:t.map(e=>e.toLocaleLowerCase()),smartCase:/[A-Z]/.test(e)}}),a=[];for(let e of this.indexed){let t=0;for(let n of i){let r=this.termScore(n,e);if(r<0){t=-1;break}t+=r}t>=0&&a.push({file:e.file,score:t})}return a.sort((e,t)=>t.score-e.score||e.file.path.length-t.file.path.length||e.file.path.localeCompare(t.file.path)),{files:a.slice(0,t).map(e=>e.file),total:a.length}}};function t(e,t=1){return`fzv:project:${e}:v${t}`}function n(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.version!==2||!Array.isArray(t.groups)||!t.groups.length||t.groups.length>32)return null;let n=[],r=new Set;for(let e of t.groups){if(!e||typeof e.id!=`string`||r.has(e.id)||!Array.isArray(e.tabs))return null;r.add(e.id);let t=new Set,i=[];for(let n of e.tabs)n&&typeof n.path==`string`&&!t.has(n.path)&&(t.add(n.path),i.push({path:n.path,mode:n.mode===`source`?`source`:`viewer`}));n.push({id:e.id,tabs:i,active:typeof e.active==`string`&&t.has(e.active)?e.active:i[0]?.path??null})}let i=new Set,a=new Set,o=(e,t=0)=>{if(!e||typeof e!=`object`||t>32)return null;let n=e;if(typeof n.id!=`string`)return null;if(n.type===`group`)return!r.has(n.id)||i.has(n.id)?null:(i.add(n.id),{type:`group`,id:n.id});if(n.type!==`split`||a.has(n.id)||![`x`,`y`].includes(n.axis)||!Number.isFinite(n.ratio)||n.ratio<=0||n.ratio>=1||!Array.isArray(n.children)||n.children.length!==2)return null;a.add(n.id);let s=o(n.children[0],t+1),c=o(n.children[1],t+1);return s&&c?{type:`split`,id:n.id,axis:n.axis,ratio:n.ratio,children:[s,c]}:null},s=o(t.layout);return!s||i.size!==r.size?null:{version:2,layout:s,groups:n,activeGroup:typeof t.activeGroup==`string`&&r.has(t.activeGroup)?t.activeGroup:n[0].id}}function r(e,r){try{let i=n(JSON.parse(e.getItem(t(r,2))??`null`));if(i)return i;let a=JSON.parse(e.getItem(t(r))??`null`);return!a||typeof a!=`object`||!(`version`in a)||a.version!==1||!(`tabs`in a)||!Array.isArray(a.tabs)?null:{version:1,tabs:[...new Set(a.tabs.filter(e=>typeof e==`string`))],active:`active`in a&&typeof a.active==`string`?a.active:null}}catch{return null}}function i(e,n,r){try{e.setItem(t(n,r.version),JSON.stringify(r))}catch{}}function a(e){let t=document.createElement(`i`);return t.className=`codicon codicon-${e}`,t.setAttribute(`aria-hidden`,`true`),t}function o(e){return a(e.kind===`directory`?`folder`:e.kind===`pdf`?`file-pdf`:e.kind===`image`?`file-media`:e.kind===`html`?`file-code`:/\.md$/i.test(e.name)?`markdown`:/\.(?:[cm]?js|jsx|ts|tsx|py|rs|go|c|cc|cpp|h|hpp|cs|java|rb|lua|sh|json|ya?ml|toml|css|scss|xml|sql|tex|sty|bib|bst)$/i.test(e.name)||[`Makefile`,`Dockerfile`].includes(e.name)?`file-code`:`file`)}function s(e,t,n,r,i){if(e.type===`split`)return{...e,children:e.children.map(e=>s(e,t,n,r,i))};if(e.id!==t)return e;let a={type:`group`,id:n};return{type:`split`,id:i,axis:r===`left`||r===`right`?`x`:`y`,ratio:.5,children:r===`left`||r===`up`?[a,e]:[e,a]}}function c(e,t){if(e.type===`group`)return e.id===t?null:e;let n=c(e.children[0],t),r=c(e.children[1],t);return n?r?{...e,children:[n,r]}:n:r}function l(e){return e.type===`group`?[e.id]:e.children.flatMap(l)}function u(e,t){if(e.type===`group`)return t===`x`?220:140;let n=e.children.map(e=>u(e,t));return e.axis===t?n[0]+n[1]+4:Math.max(...n)}function d(e,t){let n=Math.max(0,t-4),r=u(e.children[0],e.axis),i=u(e.children[1],e.axis);if(n<=r+i){let e=r/(r+i);return[e,e]}return[r/n,1-i/n]}function f(e,t){let n=new Map,r=new Map,i=(e,t)=>{if(e.type===`group`){n.set(e.id,t);return}let a=e.axis===`x`,o=a?t.width:t.height,s=Math.min(4,o),[c,l]=d(e,o),u=Math.max(c,Math.min(l,e.ratio)),f=Math.max(0,o-s)*u,p=Math.max(0,o-s-f),m={...t,[a?`width`:`height`]:f},h=a?{...t,x:t.x+f+s,width:p}:{...t,y:t.y+f+s,height:p},g=a?{...t,x:t.x+f,width:s}:{...t,y:t.y+f,height:s};r.set(e.id,{node:e,rect:t,sash:g}),i(e.children[0],m),i(e.children[1],h)};return i(e,t),{groups:n,splits:r}}function p(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var m=p();function h(e){m=e}var g={exec:()=>null};function _(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function v(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(y.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var ee=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),y={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,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,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,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,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:_(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:_(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:_(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:_(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:_(e=>RegExp(`^ {0,${e}}(?:</?(?:${fe})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,`i`)),blockquoteBeginRegex:_(e=>RegExp(`^ {0,${e}}>`))},te=/^(?:[ \t]*(?:\n|$))+/,ne=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,b=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,x=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,re=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ie=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,S=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ae=v(S).replace(/bull/g,ie).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}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),oe=v(S).replace(/bull/g,ie).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}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),se=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,ce=/^[^\n]+/,le=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ue=v(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,le).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),de=v(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,ie).getRegex(),fe=`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`,pe=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,me=v(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,pe).replace(`tag`,fe).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),he=e=>v(se).replace(`hr`,x).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,fe).getRegex(),ge=he(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),_e=he(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),ve={blockquote:v(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,_e).getRegex(),code:ne,def:ue,fences:b,heading:re,hr:x,html:me,lheading:ae,list:de,newline:te,paragraph:ge,table:g,text:ce},C=v(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,x).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,fe).getRegex(),ye={...ve,lheading:oe,table:C,paragraph:v(se).replace(`hr`,x).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,C).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,fe).getRegex()},be={...ve,html:v(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,pe).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:g,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:v(se).replace(`hr`,x).replace(`heading`,` *#{1,6} *[^
|
|
3
|
-
]`).replace(`lheading`,ae).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},xe=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Se=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ce=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,we=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,w=/[\p{P}\p{S}]/u,Te=/[\s\p{P}\p{S}]/u,Ee=/[^\s\p{P}\p{S}]/u,T=v(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,Te).getRegex(),De=/[\p{Pi}\p{Ps}"']/u,E=/(?!~)[\p{P}\p{S}]/u,Oe=/(?!~)[\s\p{P}\p{S}]/u,D=/(?:[^\s\p{P}\p{S}]|~)/u,ke=v(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,ee?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Ae=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,je=v(Ae,`u`).replace(/punct/g,w).getRegex(),Me=v(Ae,`u`).replace(/punct/g,E).getRegex(),Ne=v(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,De).replace(/punct/g,w).getRegex(),Pe=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Fe=v(Pe,`gu`).replace(/notPunctSpace/g,Ee).replace(/punctSpace/g,Te).replace(/punct/g,w).getRegex(),O=v(Pe,`gu`).replace(/notPunctSpace/g,D).replace(/punctSpace/g,Oe).replace(/punct/g,E).getRegex(),Ie=v(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Ee).replace(/punctSpace/g,Te).replace(/punct/g,w).getRegex(),Le=v(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Ee).replace(/punctSpace/g,Te).replace(/punct/g,w).getRegex(),Re=v(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Ee).replace(/punctSpace/g,Te).replace(/punct/g,w).getRegex(),ze=v(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,w).getRegex(),Be=v(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Ee).replace(/punctSpace/g,Te).replace(/punct/g,w).getRegex(),Ve=v(/\\(punct)/,`gu`).replace(/punct/g,w).getRegex(),He=v(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,`gu`).replace(/punct/g,w).getRegex(),Ue=v(/^<(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(),We=v(pe).replace(`(?:-->|$)`,`-->`).getRegex(),Ge=v(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,We).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ke=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,qe=v(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,Ke).getRegex(),Je=v(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace(`label`,qe).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ye=v(/^!?\[(label)\]\[(ref)\]/).replace(`label`,qe).replace(`ref`,le).getRegex(),Xe=v(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,le).getRegex(),Ze=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Qe=v(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,Ke).getRegex(),$e=v(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,v(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Qe).replace(`ref`,Ze).getRegex()).replace(`nolink`,v(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Ze).getRegex()).getRegex(),et=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,tt=v(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),nt={_backpedal:g,anyPunctuation:Ve,anyPunctuationOutsideCode:He,autolink:Ue,blockSkip:ke,br:Ce,code:Se,del:g,delLDelim:g,delRDelim:g,emStrongLDelim:je,emStrongRDelimAst:Fe,emStrongRDelimUnd:Le,escape:xe,link:Je,nolink:Xe,punctuation:T,reflink:Ye,reflinkSearch:$e,tag:Ge,text:we,url:g},rt={...nt,emStrongLDelim:Ne,emStrongRDelimAst:Ie,emStrongRDelimUnd:Re,link:v(/^!?\[(label)\]\((.*?)\)/).replace(`label`,qe).getRegex(),reflink:v(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,qe).getRegex()},it={...nt,emStrongRDelimAst:O,emStrongLDelim:Me,delLDelim:ze,delRDelim:Be,url:v(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,tt).replace(`protocol`,et).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:v(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,et).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},at={...it,br:v(Ce).replace(`{2,}`,`*`).getRegex(),text:v(it.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},k={normal:ve,gfm:ye,pedantic:be},A={normal:nt,gfm:it,breaks:at,pedantic:rt},ot={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},st=e=>ot[e];function j(e,t){if(t){if(y.escapeTest.test(e))return e.replace(y.escapeReplace,st)}else if(y.escapeTestNoEncode.test(e))return e.replace(y.escapeReplaceNoEncode,st);return e}function ct(e){return y.numericCharacterReference.test(e)?e.replace(y.numericCharacterReferenceOrAmpersand,(e,t,n)=>{if(t===void 0&&n===void 0)return`&`;let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:r===38?`&`:String.fromCodePoint(r)}):e}function lt(e){try{e=encodeURI(e).replace(y.percentDecode,`%`)}catch{return null}return e}function ut(e,t){let n=e.replace(y.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(y.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(y.slashPipe,`|`);return n}function M(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function dt(e){let t=e.split(`
|
|
4
|
-
`),n=t.length-1;for(;n>=0&&y.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
5
|
-
`)}function ft(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function pt(e,t){if(e.indexOf(t[0])===-1&&e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function N(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function mt(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`,l=r.state.inLink,u=r.state.linkEmitted,d=r.state.inRawBlock;r.state.inLink=!0,r.state.linkEmitted=!1;let f=r.inlineTokens(s),p=r.state.linkEmitted;if(r.state.linkEmitted=u,r.state.inLink=l,!c){if(p){r.state.inRawBlock=d;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:f}}function ht(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
6
|
-
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return e.slice(Math.min(r.length,i.length))}).join(`
|
|
7
|
-
`)}function gt(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var _t=class{options;rules;lexer;constructor(e){this.options=e||m}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 e=this.options.pedantic?t[0]:dt(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=ht(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=M(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:M(t[0],`
|
|
8
|
-
`),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:M(t[0],`
|
|
9
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=M(t[0],`
|
|
10
|
-
`).split(`
|
|
11
|
-
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
12
|
-
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
13
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
14
|
-
${s}`:s,r=r?`${r}
|
|
15
|
-
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`||u?.type===`heading`||u?.type===`hr`||u?.type===`html`)break;if(u?.type===`blockquote`){let t=u,a=e.join(`
|
|
16
|
-
`),o=t.raw+`
|
|
17
|
-
`+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s;let c=o.substring(s.raw.length).replace(/^\n/,``),l=c?c.split(`
|
|
18
|
-
`).length:0,d=l?e.slice(0,-l):e;d.length>0&&(n=`${n}
|
|
19
|
-
${d.join(`
|
|
20
|
-
`)}`),r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
|
|
21
|
-
`+e.join(`
|
|
22
|
-
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
23
|
-
`)}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=e,r=()=>n.length-e.length,i=t[1].trim(),a=i.length>1,o={type:`list`,raw:``,ordered:a,start:a?+i.slice(0,-1):``,loose:!1,items:[]};i=a?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=a?i:`[*+-]`);let s=this.rules.other.listItemRegex(i),c=!1;for(;e;){let i=!1,a=``;if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;let l=r();e=e.substring(t[0].length);let u=t[2].split(`
|
|
24
|
-
`,1)[0],d=t[1].length,f=this.options.pedantic?N(u,d):u.replace(this.rules.other.leadingSpaceTab,e=>N(e,d)),p=e.split(`
|
|
25
|
-
`,1)[0],m=!f.trim(),h=0;if(this.options.pedantic?(h=2,a=f.trimStart()):m?h=d+1:(h=f.search(this.rules.other.nonSpaceChar),h=h>4?1:h,a=f.slice(h),h+=d),m&&this.rules.other.blankLine.test(p)&&(e=e.substring(p.length+1),i=!0),!i){let t=this.rules.other.nextBulletRegex(h),n=this.rules.other.hrRegex(h),r=this.rules.other.fencesBeginRegex(h),i=this.rules.other.headingBeginRegex(h),o=this.rules.other.htmlBeginRegex(h),s=this.rules.other.blockquoteBeginRegex(h);for(;e;){let c=e.split(`
|
|
26
|
-
`,1)[0],l;if(p=c,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting,` `),l=p):l=p.replace(this.rules.other.leadingSpaceTab,e=>N(e)),r.test(p)||i.test(p)||o.test(p)||s.test(p)||t.test(p)||n.test(p))break;if(l.search(this.rules.other.nonSpaceChar)>=h||!p.trim())a+=`
|
|
27
|
-
`+l.slice(h);else{if(m||f.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||r.test(f)||i.test(f)||n.test(f))break;a+=`
|
|
28
|
-
`+p}m=!p.trim(),e=e.substring(c.length+1),f=l.slice(h)}}let g=n.slice(l,r());o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(g)&&(c=!0)),o.items.push({type:`list_item`,raw:g,task:!!this.options.gfm&&this.rules.other.listIsTask.test(a),loose:!1,text:a,tokens:[]})}let l=o.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;o.raw=n.slice(0,r()).trimEnd();for(let e of o.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!o.loose){let t=e.tokens.filter(e=>e.type===`space`);o.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of o.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,o.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(o.loose)for(let e of o.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=dt(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){if(!this.rules.other.startAngleBracket.test(t[2])&&pt(t[2],`()`)!==-1)return;let e=ft(t[1]).replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:M(t[0],`
|
|
29
|
-
`),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=ut(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
30
|
-
`):[],a={type:`table`,raw:M(t[0],`
|
|
31
|
-
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(ut(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:M(t[0],`
|
|
32
|
-
`),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
33
|
-
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}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=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){if(this.lexer.state.linkParenPossible===!1)return;let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&>(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=M(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=pt(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let i=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),mt(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.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[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&>(e,n[1],r,this.rules))return;let i=t[ft((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return mt(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.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]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}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&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:e?t[0]:ct(t[0]),escaped:e}}}},P=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||m,this.options.tokenizer=this.options.tokenizer||new _t,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let t={other:y,block:k.normal,inline:A.normal};this.options.pedantic?(t.block=k.pedantic,t.inline=A.pedantic):this.options.gfm&&(t.block=k.gfm,t.inline=this.options.breaks?A.breaks:A.gfm),this.tokenizer.rules=t}static get rules(){return{block:k,inline:A}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(y.carriageReturn,`
|
|
34
|
-
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(y.tabCharGlobal,` `).replace(y.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
|
|
35
|
-
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
36
|
-
`)?``:`
|
|
37
|
-
`)+i.raw,n.text+=`
|
|
38
|
-
`+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if((i=this.tokenizer.fences(e))||(i=this.tokenizer.heading(e))||(i=this.tokenizer.hr(e))||(i=this.tokenizer.blockquote(e))||(i=this.tokenizer.list(e))||(i=this.tokenizer.html(e))){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
39
|
-
`)?``:`
|
|
40
|
-
`)+i.raw,n.text+=`
|
|
41
|
-
`+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if((i=this.tokenizer.table(e))||(i=this.tokenizer.lheading(e))){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
|
|
42
|
-
`)?``:`
|
|
43
|
-
`)+i.raw,r.text+=`
|
|
44
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length)}else if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
45
|
-
`)?``:`
|
|
46
|
-
`)+i.raw,n.text+=`
|
|
47
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(e.charAt(0)!==`!`&&Object.hasOwn(this.tokens.links,ft(e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&e.includes(`)`);try{return this.#e(e,t)}finally{this.state.linkParenPossible=n}}#e(e,t){let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,ft(n.slice(r+1,-1))))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}n=n.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(e,t,n)=>n?`+`.repeat(e.length):t?t+e.slice(t.length,-t.length).replace(/`/g,`+`)+t:e),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if((o=this.tokenizer.escape(e))||(o=this.tokenizer.tag(e))||(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 n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if((o=this.tokenizer.emStrong(e,n,i))||(o=this.tokenizer.codespan(e))||(o=this.tokenizer.br(e))||(o=this.tokenizer.del(e,n,i))||(o=this.tokenizer.autolink(e))||!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},vt=class{options;parser;constructor(e){this.options=e||m}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(y.notSpaceStart)?.[0],i=e?e.replace(y.endingNewline,``)+`
|
|
48
|
-
`:``;return r?`<pre><code class="language-`+j(r)+`">`+(n?i:j(i,!0))+`</code></pre>
|
|
49
|
-
`:`<pre><code>`+(n?i:j(i,!0))+`</code></pre>
|
|
50
|
-
`}blockquote({tokens:e}){return`<blockquote>
|
|
51
|
-
${this.parser.parse(e)}</blockquote>
|
|
52
|
-
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
53
|
-
`}hr(e){return`<hr>
|
|
54
|
-
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
55
|
-
`+r+`</`+i+`>
|
|
56
|
-
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
57
|
-
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
58
|
-
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
59
|
-
<thead>
|
|
60
|
-
`+t+`</thead>
|
|
61
|
-
`+r+`</table>
|
|
62
|
-
`}tablerow({text:e}){return`<tr>
|
|
63
|
-
${e}</tr>
|
|
64
|
-
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
65
|
-
`}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>${j(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?j(n,!0):this.parser.parseInline(r),o=lt(e);if(o===null)return a;e=j(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+j(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=lt(e);if(i===null)return j(n);e=i;let a=`<img src="${j(e)}" alt="${j(n)}"`;return t&&(a+=` title="${j(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:j(e.text)}},yt=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}},F=class e{options;renderer;textRenderer;constructor(e){this.options=e||m,this.options.renderer=this.options.renderer||new vt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new yt}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;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 e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},bt=class{options;block;constructor(e){this.options=e||m}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(e=this.block){return e?P.lex:P.lexInline}provideParser(e=this.block){return e?F.parse:F.parseInline}};function xt(e,t){if(Array.isArray(t))for(let n=0;n<t.length;n++)e.push(t[n]);else e.push(t)}var I=new class{defaults=p();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=F;Renderer=vt;TextRenderer=yt;Lexer=P;Tokenizer=_t;Hooks=bt;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(xt(n,t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)xt(n,this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)xt(n,this.walkTokens(e.tokens,t));break}case`list`:{let e=r;xt(n,this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);xt(n,this.walkTokens(i,t))}):e.tokens&&xt(n,this.walkTokens(e.tokens,t))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new vt(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new _t(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new bt;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=bt.passThroughHooks.has(n)?e=>{if(this.defaults.async&&bt.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&xt(n,t.call(this,e)),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return P.lex(e,t??this.defaults)}parser(e,t){return F.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(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 t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?P.lex:P.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?F.parse:F.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?P.lex:P.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?F.parse:F.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
66
|
-
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+j(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function L(e,t){return I.parse(e,t)}L.options=L.setOptions=function(e){return I.setOptions(e),L.defaults=I.defaults,h(L.defaults),L},L.getDefaults=p,L.defaults=m;function St(...e){return I.use(...e),L.defaults=I.defaults,h(L.defaults),L}L.use=St,L.walkTokens=function(e,t){return I.walkTokens(e,t)},L.parseInline=I.parseInline,L.Parser=F,L.parser=F.parse,L.Renderer=vt,L.TextRenderer=yt,L.Lexer=P,L.lexer=P.lex,L.Tokenizer=_t,L.Hooks=bt,L.parse=L,L.options,L.setOptions,L.walkTokens,L.parseInline,F.parse,P.lex;function Ct(e,t){this.v=e,this.k=t}function wt(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Tt(e){if(Array.isArray(e))return e}function Et(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Dt(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
67
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ot(e,t){return Tt(e)||Et(e,t)||kt(e,t)||Dt()}function kt(e,t){if(e){if(typeof e==`string`)return wt(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wt(e,t):void 0}}function At(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof Ct;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}At.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},At.prototype.next=function(e){return this._invoke(`next`,e)},At.prototype.throw=function(e){return this._invoke(`throw`,e)},At.prototype.return=function(e){return this._invoke(`return`,e)};var jt=Object.entries,Mt=Object.setPrototypeOf,Nt=Object.isFrozen,Pt=Object.getPrototypeOf,Ft=Object.getOwnPropertyDescriptor,R=Object.freeze,z=Object.seal,It=Object.create,Lt=typeof Reflect<`u`&&Reflect,Rt=Lt.apply,zt=Lt.construct;R||=function(e){return e},z||=function(e){return e},Rt||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},zt||=function(e){return new e(...[...arguments].slice(1))};var Bt=W(Array.prototype.forEach);Array.prototype.indexOf;var Vt=W(Array.prototype.lastIndexOf),Ht=W(Array.prototype.pop),Ut=W(Array.prototype.push),Wt=W(Array.prototype.slice),Gt=W(Array.prototype.splice),Kt=Array.isArray,qt=sn(Set),Jt=W(Set.prototype.add),Yt=W(Set.prototype.has),Xt=W(String.prototype.toLowerCase),Zt=W(String.prototype.toString),Qt=W(String.prototype.match),$t=W(String.prototype.replace),en=W(String.prototype.indexOf),tn=W(String.prototype.trim),nn=W(Number.prototype.toString),rn=W(Boolean.prototype.toString),an=typeof BigInt>`u`?null:W(BigInt.prototype.toString),B=typeof Symbol>`u`?null:W(Symbol.prototype.toString),V=W(Object.prototype.hasOwnProperty),H=W(Object.prototype.toString),U=W(RegExp.prototype.test),on=sn(TypeError);function W(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Rt(e,t,n)}}function sn(e){return function(){return zt(e,[...arguments])}}function G(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Xt;if(Mt&&Mt(e,null),!Kt(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Nt(t)||(t[r]=e),i=e)}e[i]=!0}return e}function cn(e){for(let t=0;t<e.length;t++)V(e,t)||(e[t]=null);return e}function K(e){let t=It(null);for(let r of jt(e)){var n=Ot(r,2);let i=n[0],a=n[1];V(e,i)&&(t[i]=Kt(a)?cn(a):a&&typeof a==`object`&&a.constructor===Object?K(a):a)}return t}function ln(e){switch(typeof e){case`string`:return e;case`number`:return nn(e);case`boolean`:return rn(e);case`bigint`:return an?an(e):`0`;case`symbol`:return B?B(e):`Symbol()`;case`undefined`:return H(e);case`function`:case`object`:{if(e===null)return H(e);let t=e,n=q(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:H(e)}return H(e)}default:return H(e)}}function q(e,t){for(;e!==null;){let n=Ft(e,t);if(n){if(n.get)return W(n.get);if(typeof n.value==`function`)return W(n.value)}e=Pt(e)}function n(){return null}return n}function un(e,t){for(;e!==null;){let n=Ft(e,t);if(n)return n.get?W(n.get):null;e=Pt(e)}return null}function dn(e){try{return U(e,``),!0}catch{return!1}}var fn=R(`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`.split(`.`)),pn=R(`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`.split(`.`)),mn=R([`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`]),hn=R([`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`]),gn=R(`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`.split(`.`)),_n=R([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),vn=R([`#text`]),yn=R(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),bn=R(`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.dominant-baseline.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.pointer-events.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-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.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`.split(`.`)),xn=R(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Sn=R([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Cn=z(/{{[\w\W]*|^[\w\W]*}}/g),wn=z(/<%[\w\W]*|^[\w\W]*%>/g),Tn=z(/\${[\w\W]*/g),En=z(/^data-[\-\w.\u00B7-\uFFFF]+$/),Dn=z(/^aria-[\-\w]+$/),On=z(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),kn=z(/^(?:\w+script|data):/i),An=z(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),jn=z(/^html$/i),Mn=z(/^[a-z][.\w]*(-[.\w]+)+$/i),Nn=z(/<[/\w!]/g),Pn=z(/<[/\w]/g),Fn=z(/<\/no(script|embed|frames)/i),In=z(/\/>/i),J={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Ln=R(G({},[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`])),Rn=function(){return typeof window>`u`?null:window},zn=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Bn=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Vn=function(e,t,n,r){return V(e,t)&&Kt(e[t])?G(r.base?K(r.base):{},e[t],r.transform):n},Hn=function(e,t,n){let r=V(e,t)?e[t]:void 0;return r&&typeof r==`object`?K(r):n()};function Un(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Rn(),t=e=>Un(e);if(t.version=`3.4.17`,t.removed=[],!e||!e.document||e.document.nodeType!==J.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=q(d,`cloneNode`),p=q(d,`remove`),m=q(d,`removeAttributeNode`),h=q(d,`nextSibling`),g=q(d,`childNodes`),_=q(d,`parentNode`),v=q(d,`shadowRoot`),ee=q(d,`attributes`),y=o&&o.prototype?q(o.prototype,`nodeType`):null,te=o&&o.prototype?q(o.prototype,`nodeName`):null,ne=o&&o.prototype?q(o.prototype,`ownerDocument`):null,b=function(e){return y?y(e):e.nodeType},x=function(e){return te?te(e):e.nodeName},re=un(d,`namespaceURI`),ie=function(e){return re?re(e):e.namespaceURI};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let S,ae=``,oe,se=!1,ce=0,le=function(){if(ce>0)throw on(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},ue=function(e){le(),ce++;try{return S.createHTML(e)}finally{ce--}},de=function(e){le(),ce++;try{return S.createScriptURL(e)}finally{ce--}},fe=function(){return se||=(oe=zn(u,i),!0),oe},pe=n,me=pe.implementation,he=pe.createNodeIterator,ge=pe.createDocumentFragment,_e=pe.getElementsByTagName,ve=r.importNode,C=Bn();t.isSupported=typeof jt==`function`&&typeof _==`function`&&me&&me.createHTMLDocument!==void 0;let ye=Cn,be=wn,xe=Tn,Se=En,Ce=Dn,we=kn,w=An,Te=Mn,Ee=On,T=null,De=G({},[...fn,...pn,...mn,...gn,...vn]),E=null,Oe=G({},[...yn,...bn,...xn,...Sn]),D=Object.seal(It(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ke=null,Ae=null,je=Object.seal(It(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Me=!0,Ne=!0,Pe=!1,Fe=!0,O=!1,Ie=!0,Le=!1,Re=!1,ze=null,Be=null,Ve=!1,He=!1,Ue=!1,We=!1,Ge=!0,Ke=!1,qe=`user-content-`,Je=!0,Ye=!1,Xe=null,Ze={},Qe=null,$e=G({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),et=null,tt=G({},[`audio`,`video`,`img`,`source`,`image`,`track`]),nt=null,rt=G({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),it=`http://www.w3.org/1998/Math/MathML`,at=`http://www.w3.org/2000/svg`,k=`http://www.w3.org/1999/xhtml`,A=k,ot=!1,st=null,j=G({},[it,at,k],Zt),ct=R([`mi`,`mo`,`mn`,`ms`,`mtext`]),lt=G({},ct),ut=R([`annotation-xml`]),M=G({},ut),dt=G({},[`title`,`style`,`font`,`a`,`script`]),ft=null,pt=[`application/xhtml+xml`,`text/html`],N=null,mt=null,ht=n.createElement(`form`),gt=function(e){return e instanceof RegExp||e instanceof Function},_t=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(mt&&mt===e)return;(!e||typeof e!=`object`)&&(e={}),e=K(e),ft=pt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,N=ft===`application/xhtml+xml`?Zt:Xt,T=Vn(e,`ALLOWED_TAGS`,De,{transform:N}),E=Vn(e,`ALLOWED_ATTR`,Oe,{transform:N}),st=Vn(e,`ALLOWED_NAMESPACES`,j,{transform:Zt}),nt=Vn(e,`ADD_URI_SAFE_ATTR`,rt,{transform:N,base:rt}),et=Vn(e,`ADD_DATA_URI_TAGS`,tt,{transform:N,base:tt}),Qe=Vn(e,`FORBID_CONTENTS`,$e,{transform:N}),ke=Vn(e,`FORBID_TAGS`,K({}),{transform:N}),Ae=Vn(e,`FORBID_ATTR`,K({}),{transform:N}),Ze=V(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?K(e.USE_PROFILES):e.USE_PROFILES:!1,Me=e.ALLOW_ARIA_ATTR!==!1,Ne=e.ALLOW_DATA_ATTR!==!1,Pe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Fe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,O=e.SAFE_FOR_TEMPLATES||!1,Ie=e.SAFE_FOR_XML!==!1,Le=e.WHOLE_DOCUMENT||!1,He=e.RETURN_DOM||!1,Ue=e.RETURN_DOM_FRAGMENT||!1,We=e.RETURN_TRUSTED_TYPE||!1,Ve=e.FORCE_BODY||!1,Ge=e.SANITIZE_DOM!==!1,Ke=e.SANITIZE_NAMED_PROPS||!1,Je=e.KEEP_CONTENT!==!1,Ye=e.IN_PLACE||!1,Ee=dn(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:On,A=typeof e.NAMESPACE==`string`?e.NAMESPACE:k,lt=Hn(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>G({},ct)),M=Hn(e,`HTML_INTEGRATION_POINTS`,()=>G({},ut));let t=Hn(e,`CUSTOM_ELEMENT_HANDLING`,()=>It(null));if(D=It(null),V(t,`tagNameCheck`)&>(t.tagNameCheck)&&(D.tagNameCheck=t.tagNameCheck),V(t,`attributeNameCheck`)&>(t.attributeNameCheck)&&(D.attributeNameCheck=t.attributeNameCheck),V(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(D.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),z(D),O&&(Ne=!1),Ue&&(He=!0),Ze&&(T=G({},vn),E=It(null),Ze.html===!0&&(G(T,fn),G(E,yn)),Ze.svg===!0&&(G(T,pn),G(E,bn),G(E,Sn)),Ze.svgFilters===!0&&(G(T,mn),G(E,bn),G(E,Sn)),Ze.mathMl===!0&&(G(T,gn),G(E,xn),G(E,Sn))),je.tagCheck=null,je.attributeCheck=null,V(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?je.tagCheck=e.ADD_TAGS:Kt(e.ADD_TAGS)&&(T===De&&(T=K(T)),G(T,e.ADD_TAGS,N))),V(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?je.attributeCheck=e.ADD_ATTR:Kt(e.ADD_ATTR)&&(E===Oe&&(E=K(E)),G(E,e.ADD_ATTR,N))),V(e,`ADD_FORBID_CONTENTS`)&&Kt(e.ADD_FORBID_CONTENTS)&&(Qe===$e&&(Qe=K(Qe)),G(Qe,e.ADD_FORBID_CONTENTS,N)),Je&&(T[`#text`]=!0),Le&&G(T,[`html`,`head`,`body`]),T.table&&(G(T,[`tbody`]),delete ke.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw on(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw on(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=S;S=e.TRUSTED_TYPES_POLICY;try{ae=ue(``)}catch(e){throw S=t,e}}else e.TRUSTED_TYPES_POLICY===null?(S=void 0,ae=``):(S===void 0&&(S=fe()),S&&typeof ae==`string`&&(ae=ue(``)));R&&R(e),mt=e},P=G({},[...pn,...mn,...hn]),vt=G({},[...gn,..._n]),yt=function(e,t,n){return t.namespaceURI===k?e===`svg`:t.namespaceURI===it?e===`svg`&&(n===`annotation-xml`||lt[n]):!!P[e]},F=function(e,t,n){return t.namespaceURI===k?e===`math`:t.namespaceURI===at?e===`math`&&M[n]:!!vt[e]},bt=function(e,t,n){return t.namespaceURI===at&&!M[n]||t.namespaceURI===it&&!lt[n]?!1:!vt[e]&&(dt[e]||!P[e])},xt=function(e){let t=ie(e),n=Xt(x(e)),r=_(e),i,a;return r&&b(r)===J.element?(i={namespaceURI:ie(r)},a=Xt(x(r))):(i={namespaceURI:A},a=`template`),st[t]?t===at?yt(n,i,a):t===it?F(n,i,a):t===k?bt(n,i,a):!!(ft===`application/xhtml+xml`&&st[t]):!1},I=function(e){Ut(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw on(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},L=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},St=function(e){Et(e);let t=g(e);t&&Bt(Wt(t),e=>{try{p(e)}catch{}});let n=b(e)===J.element?ee(e):null;if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&L(e,r,i)}},Ct=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}Ut(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(He||Ue)try{I(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},wt=function(e){let t=ee(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||E[N(i)]||L(e,r,i)}},Tt=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=[e];for(;r.length>0;){let e=r.pop();if(t(e)===!1)continue;if(n&&b(e)===J.element){let t=v(e);B(t)&&r.push(t)}let i=g(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},Et=function(e){Tt(e,e=>{b(e)===J.element&&wt(e)})},Dt=function(e){let t=[];return Tt(e,e=>{t.push(e)},!0),t},Ot=function(e,t){let n=qt();Bt(Dt(e),e=>{b(e)===J.element&&Jt(n,e)}),Bt(t,e=>{b(e)===J.element&&!Yt(n,e)&&wt(e)})},kt=function(e,n){let r=!1;return Bt(t.removed,t=>{t.element&&(r||=t.element===e,Et(t.element))}),Ot(e,n),r},At=function(e,t){let n=Xe,r=null,i=()=>(r||(r=qt(),Bt(t,e=>{Jt(r,e)})),r);for(let t=0;;t++){let r=Dt(e),a=[e],o=!1;if(Bt(r,e=>{b(e)===J.documentFragment?Ut(a,e):!o&&!Yt(n,e)&&(o=Yt(i(),e))}),!o)return;if(t>=8)throw on(`the tree kept changing during in-place sanitization; refusing to return it`);Bt(a,(t,n)=>{Mt(t,n>0,e,i())})}},Mt=function(e,t,n,r){let i=Rt(e),a;for(;a=i.nextNode();)Yt(r,a)&&!Yt(Xe,a)&&(t&&W(C.uponSanitizeShadowNode,a,null),qn(a,n),er(a,n),B(a.content)&&tr(a.content))},Nt=function(e){Xe&&Jt(Xe,e)},Pt=function(e,t){return Ie?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},Ft=function(e){Ie&&Tt(e,e=>{let t=b(e);if(t===J.processingInstruction||t===J.comment&&U(Pn,e.data)){try{p(e)}catch{}return!1}if(t===J.element){let t=e,n=N(x(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&Pt(`for`,n)&&t.removeAttribute(`for`)}catch{}}return!0})},Lt=function(e){let t=null,r=null;if(Ve)e=`<remove></remove>`+e;else{let t=Qt(e,/^[\r\n\t ]+/);r=t&&t[0]}ft===`application/xhtml+xml`&&A===k&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=S?ue(e):e;if(A===k)try{t=new l().parseFromString(i,ft)}catch{}if(!t||!t.documentElement){t=me.createDocument(A,`template`,null);try{t.documentElement.innerHTML=ot?ae:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),A===k?_e.call(t,Le?`html`:`body`)[0]:Le?t.documentElement:a},Rt=function(e){let t=ne?ne(e):e.ownerDocument;return he.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},zt=function(e){return e=$t(e,ye,` `),e=$t(e,be,` `),e=$t(e,xe,` `),e},nn=function(e){rn(e);let t=e.querySelectorAll?.call(e,`template`);t&&Bt(t,e=>{B(e.content)&&nn(e.content)})},rn=function(e){e.normalize();let t=ne?ne(e):e.ownerDocument,n=he.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=zt(r.data),r=n.nextNode()},an=function(e){let t=te?te(e):null;return typeof t!=`string`||N(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==ee(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==g(e)},B=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===J.documentFragment}catch{return!1}},H=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function W(e,n,r){e.length!==0&&Bt(e,e=>{e.call(t,n,r,mt)})}let sn=function(e,t){return!!(Ie&&e.hasChildNodes()&&!H(e.firstElementChild)&&U(Nn,e.textContent)&&U(Nn,e.innerHTML)||Ie&&Ln[t]&&b(e)===J.element&&ie(e)===k&&(H(e.firstElementChild)||typeof e.textContent==`string`&&U(Nn,e.textContent))||e.nodeType===J.processingInstruction||Ie&&e.nodeType===J.comment&&U(Pn,e.data))},cn=function(e,t){return e instanceof RegExp?U(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Wn=function(e,t,n){if(!ke[t]&&Xn(t)&&cn(D.tagNameCheck,t))return!1;if(Je&&!Qe[t]&&!Qe[Xt(t)]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return I(e),!0},Gn=function(e,t,n,r){return e.length===0?t:t===n||t===r?K(t):t},Kn=function(e,t){return e===t||_(e)!==null?!1:(Ye&&Et(e),!0)},qn=function(e,n){if(Nt(e),W(C.beforeSanitizeElements,e,null),Kn(e,n))return!0;if(an(e))return I(e),!0;let r=N(x(e));if(T=Gn(C.uponSanitizeElement,T,De,ze),W(C.uponSanitizeElement,e,{tagName:r,allowedTags:T}),Kn(e,n))return!0;if(sn(e,r))return I(e),!0;if(ke[r]||!(je.tagCheck instanceof Function&&je.tagCheck(r))&&!T[r]){let t=Wn(e,r,n);return t===!1&&(W(C.afterSanitizeElements,e,null),Kn(e,n))?!0:t}if(b(e)===J.element&&!xt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&U(Fn,e.innerHTML))return I(e),!0;if(O&&e.nodeType===J.text){let n=zt(e.textContent);e.textContent!==n&&(Ut(t.removed,{element:e.cloneNode()}),e.textContent=n)}return W(C.afterSanitizeElements,e,null),Kn(e,n)},Jn=function(e,t,r){if(Ae[t]||Pt(t,e)||Ge&&(t===`id`||t===`name`)&&(r in n||r in ht))return!1;let i=E[t]||je.attributeCheck instanceof Function&&je.attributeCheck(t,e);return Ne&&U(Se,t)||Me&&U(Ce,t)?!0:i?nt[t]||U(Ee,$t(r,w,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&en(r,`data:`)===0&&et[e]||Pe&&!U(we,$t(r,w,``))?!0:!r:Xn(e)&&cn(D.tagNameCheck,e)&&cn(D.attributeNameCheck,t,e)||t===`is`&&D.allowCustomizedBuiltInElements&&cn(D.tagNameCheck,r)},Yn=G({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Xn=function(e){return!Yn[Xt(e)]&&U(Te,e)},Zn=function(e,t,n,r){if(S&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return ue(r);case`TrustedScriptURL`:return de(r)}return r},Qn=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!an(e)||(I(e),!1)}catch{return Ct(t,e),!1}},$n=function(e,t){return Ie&&U(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:Xt(e)===`attributename`&&Qt(t,`href`)!==null},er=function(e,n){if(W(C.beforeSanitizeAttributes,e,null),Kn(e,n))return;let r=e.attributes;if(!r||an(e))return;E=Gn(C.uponSanitizeAttribute,E,Oe,Be);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:E,forceKeepAttr:void 0},a=r.length,o=N(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=N(s),d=l,f=s===`value`?d:tn(d),p=!1;i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,W(C.uponSanitizeAttribute,e,i),f=i.attrValue,Ke&&(u===`id`||u===`name`)&&en(f,qe)!==0&&(Ct(s,e,n),f=qe+f,p=!0),$n(s,f)?Ct(s,e,n):i.forceKeepAttr||(i.keepAttr?!Fe&&U(In,f)?Ct(s,e,n):(O&&(f=zt(f)),Jn(o,u,f)?(f=Zn(o,u,c,f),f!==d&&Qn(e,s,c,f)&&p&&Ht(t.removed)):Ct(s,e,n)):Ct(s,e,n))}W(C.afterSanitizeAttributes,e,null),Kn(e,n)},tr=function(e){let t=null,n=Rt(e);for(W(C.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(W(C.uponSanitizeShadowNode,t,null),qn(t,e),er(t,e),B(t.content)&&tr(t.content),b(t)===J.element){let e=v(t);B(e)&&(nr(e),tr(e))}O&&rn(e),W(C.afterSanitizeShadowDOM,e,null)},nr=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){tr(e.shadow);continue}let n=e.node,r=b(n)===J.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=te?te(n):null;if(typeof e==`string`&&N(e)===`template`){let e=n.content;B(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);B(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(ot=!e,ot&&(e=`<!-->`),typeof e!=`string`&&!H(e)&&(e=ln(e),typeof e!=`string`))throw on(`dirty is not a string, aborting`);if(!t.isSupported)return e;Re?(T=ze,E=Be):_t(n),(C.uponSanitizeElement.length>0||C.uponSanitizeAttribute.length>0)&&(T=K(T)),C.uponSanitizeAttribute.length>0&&(E=K(E)),t.removed=[];let c=Ye&&typeof e!=`string`&&H(e),l=[],u=Xe;if(c){Ft(e);let t=x(e);if(typeof t==`string`){let n=N(t);if(!T[n]||ke[n])throw St(e),on(`root node is forbidden and cannot be sanitized in-place`)}if(an(e))throw St(e),on(`root node is clobbered and cannot be sanitized in-place`);l=Dt(e),Xe=qt()}else if(H(e))i=Lt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===J.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),nr(i);else{if(!He&&!O&&!Le&&e.indexOf(`<`)===-1)return S&&We?ue(e):e;if(i=Lt(e),!i)return He?null:We?ae:``}i&&Ve&&I(i.firstChild);let d=c?e:i;try{c&&nr(e);let t=Rt(d);for(;o=t.nextNode();)qn(o,d),er(o,d),B(o.content)&&tr(o.content);c&&At(e,l)}catch(t){throw c&&(St(e),kt(e,l)),t}finally{Xe=u}if(c){if(kt(e,l))throw on(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return O&&nn(e),e}if(He){if(O&&nn(i),Ue)for(s=ge.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(E.shadowroot||E.shadowrootmode)&&(s=ve.call(r,s,!0)),s}let f=Le?i.outerHTML:i.innerHTML;return Le&&T[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&U(jn,i.ownerDocument.doctype.name)&&(f=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
68
|
-
`+f),O&&(f=zt(f)),S&&We?ue(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};_t(e),Re=!0,ze=T,Be=E},t.clearConfig=function(){mt=null,Re=!1,ze=null,Be=null,S=oe,ae=``},t.isValidAttribute=function(e,t,n){mt||_t({});let r=N(e),i=N(t);return typeof n==`string`&&($n(t,n)||!Fe&&U(In,n))?!1:Jn(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&V(C,e)&&Ut(C[e],t)},t.removeHook=function(e,t){if(V(C,e)){if(t!==void 0){let n=Vt(C[e],t);return n===-1?void 0:Gt(C[e],n,1)[0]}return Ht(C[e])}},t.removeHooks=function(e){V(C,e)&&(C[e]=[])},t.removeAllHooks=function(){C=Bn()},t}var Wn=Un(),Gn=`modulepreload`,Kn=function(e){return`/_fzv/`+e},qn={},Jn=function(e){return e.pathname.endsWith(`.css`)},Yn=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},Xn=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Kn(t,n);let r=s(t),i=Jn(r);return Yn(qn,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Gn,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function Zn(e,t){if(e.startsWith(`#`))return e;let n=new URL(t.split(`/`).map(encodeURIComponent).join(`/`),`https://project.invalid/`),r=new URL(e,n);return r.origin===n.origin?`/asset${r.pathname}${r.search}${r.hash}`:[`http:`,`https:`,`mailto:`].includes(r.protocol)?r.href:null}function Qn(e,t){let n=document.createElement(`article`);n.className=`markdown-preview`,n.append(Wn.sanitize(L.parse(e,{async:!1}),{USE_PROFILES:{html:!0},FORBID_TAGS:[`style`,`form`,`button`],FORBID_ATTR:[`style`,`id`,`name`,`class`],RETURN_DOM_FRAGMENT:!0}));for(let e of n.querySelectorAll(`a, img`)){let n=e.tagName===`A`?`href`:`src`,r=e.getAttribute(n);if(e.removeAttribute(`srcset`),r){try{let i=Zn(r,t);i?e.setAttribute(n,i):e.removeAttribute(n)}catch{e.removeAttribute(n)}e instanceof HTMLAnchorElement&&(e.target=`_blank`,e.rel=`noopener noreferrer`)}}return n}function $n(e,t,n,r){let i=document.createElement(`div`);i.className=`source-preview`;let o=document.createElement(`div`);o.className=`source-toolbar`;let s=document.createElement(`button`);s.type=`button`,s.className=`toolbar-button`,s.setAttribute(`aria-label`,`Copy source code`),s.title=`Copy source code`,s.append(a(`copy`),document.createTextNode(`Copy source code`)),s.addEventListener(`click`,()=>r(e),{signal:n}),o.append(s);let c=document.createElement(`pre`);c.className=`line-numbers`,c.setAttribute(`aria-hidden`,`true`),c.textContent=Array.from({length:e.split(/\r\n|\r|\n/).length},(e,t)=>String(t+1)).join(`
|
|
69
|
-
`);let l=document.createElement(`pre`);return l.className=`text-preview source-text`,l.textContent=e,i.append(o,c,l),Xn(async()=>{let{highlightSource:e}=await import(`./highlight-8tepxCyl.js`);return{highlightSource:e}},[]).then(({highlightSource:r})=>r(l,e,t,n)).catch(()=>{}),i}function er(e){return e.kind===`html`||e.kind===`text`&&/\.md$/i.test(e.name)}function tr(e){return e.kind===`text`&&!er(e)?`source`:`viewer`}function nr(e,t=0,n=!1){return`${e.kind===`html`&&!n?`/preview-html`:`/file`}?${new URLSearchParams({path:e.path,revision:String(t)})}`}function rr(e,t){e.classList.add(`preview-error`);let n=document.createElement(`p`);n.textContent=t,e.replaceChildren(n)}function ir(e,t=0,n=tr(e),r=()=>{}){let i=document.createElement(`section`);i.className=`preview-pane`,i.hidden=!0,i.setAttribute(`role`,`tabpanel`),i.setAttribute(`aria-label`,e.path);let o=new AbortController,s=!1,c=o.signal,l=nr(e,t),u;if(e.kind===`text`||e.kind===`html`){let a=document.createElement(`div`);a.className=`viewer-surface`;let o=document.createElement(`div`);o.className=`source-surface`,o.textContent=`Loading…`;let s=er(e);s&&i.append(a),i.append(o),s||(n=`source`);let d=n,f,p=!1,m=!1,h=()=>{f===void 0||c.aborted||(d===`source`&&!p&&(o.replaceChildren($n(f,e.name,c,r)),p=!0),d===`viewer`&&e.kind===`text`&&!m&&(a.replaceChildren(Qn(f,e.path)),m=!0))},g,_=()=>{g??=fetch(nr(e,t,!0),{signal:c}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.text()}).then(e=>{f=e,h()}).catch(t=>{if(c.aborted)return;let n=`Could not load ${e.path}: ${t}`;rr(o,n),e.kind===`text`&&rr(a,n)})};if(e.kind===`html`){let t=document.createElement(`iframe`);t.title=e.path,t.setAttribute(`sandbox`,`allow-scripts`),a.append(t),u=n=>{d=n,a.hidden=n!==`viewer`,o.hidden=n!==`source`,n===`source`?(_(),h()):t.hasAttribute(`src`)||(t.src=l,fetch(l,{method:`HEAD`,signal:c}).then(t=>{t.ok||rr(a,`Could not load ${e.path} (HTTP ${t.status}).`)}).catch(e=>{c.aborted||rr(a,String(e))}))}}else a.textContent=`Loading…`,_(),u=e=>{s||(e=`source`),d=e,a.hidden=e!==`viewer`,o.hidden=e!==`source`,h()};u(n)}else if(e.kind===`pdf`)i.textContent=`Loading…`,Xn(async()=>{let{mountPdf:e}=await import(`./pdf-BKh0TLgl.js`);return{mountPdf:e}},__vite__mapDeps([0,1])).then(({mountPdf:e})=>{if(!c.aborted)return e(i,l,c,()=>s)}).catch(t=>{c.aborted||rr(i,`Could not load ${e.path}: ${t}`)});else if(e.kind===`image`){let t=document.createElement(`div`);t.className=`image-stage`;let n=document.createElement(`img`);n.src=l,n.alt=e.path,n.draggable=!1,n.addEventListener(`error`,()=>rr(i,`Could not load ${e.path}.`),{signal:c}),t.append(n);let r=document.createElement(`div`);r.className=`image-toolbar`,r.setAttribute(`role`,`group`),r.setAttribute(`aria-label`,`Image zoom`);let o=document.createElement(`span`);o.className=`image-zoom-value`,o.textContent=`100%`;let s=1,u=0,d=0,f=!1,p=0,m=0,h=()=>{n.style.transform=`translate3d(${u}px, ${d}px, 0) scale(${s})`,o.textContent=`${Math.round(s*100)}%`,t.classList.toggle(`zoomed`,s>1.001)},g=(e,n,r)=>{let i=Math.max(.1,Math.min(12,e)),a=i/s;if(n!==void 0&&r!==void 0){let e=t.getBoundingClientRect(),i=n-e.left-e.width/2,o=r-e.top-e.height/2;u=i-(i-u)*a,d=o-(o-d)*a}else u*=a,d*=a;s=i,h()},_=(e,t,n)=>{let r=document.createElement(`button`);return r.type=`button`,r.title=e,r.setAttribute(`aria-label`,e),r.textContent=t,r.addEventListener(`click`,n,{signal:c}),r},v=_(`Zoom out`,``,()=>g(s/1.25));v.append(a(`remove`)),v.className=`image-zoom-out`;let ee=_(`Fit image to viewer`,`Fit`,()=>{u=0,d=0,g(1)});ee.className=`image-fit`;let y=_(`Zoom in`,``,()=>g(s*1.25));y.append(a(`add`)),y.className=`image-zoom-in`,r.append(v,o,ee,y),t.addEventListener(`wheel`,e=>{e.ctrlKey&&(e.preventDefault(),g(s*Math.exp(-e.deltaY*.002),e.clientX,e.clientY))},{passive:!1,signal:c}),t.addEventListener(`pointerdown`,e=>{e.button!==0||s<=1.001||(f=!0,p=e.clientX,m=e.clientY,t.classList.add(`dragging`),t.setPointerCapture(e.pointerId))},{signal:c}),t.addEventListener(`pointermove`,e=>{f&&(u+=e.clientX-p,d+=e.clientY-m,p=e.clientX,m=e.clientY,h())},{signal:c});let te=()=>{f=!1,t.classList.remove(`dragging`)};t.addEventListener(`pointerup`,te,{signal:c}),t.addEventListener(`pointercancel`,te,{signal:c}),t.addEventListener(`lostpointercapture`,te,{signal:c}),i.append(t,r)}return{element:i,setActive:e=>{s=e},setMode:u,dispose:()=>{o.abort(),i.querySelectorAll(`iframe`).forEach(e=>e.remove()),i.remove()}}}function ar(e,t){Object.assign(e.style,{left:`${t.x}px`,top:`${t.y}px`,width:`${t.width}px`,height:`${t.height}px`})}var or=class{host;onChange;copyToClipboard;groups=new Map;tree;selectedGroup;sequence=0;tabSequence=0;revision=0;sashes=new Map;measured;dragged=null;dragSurface=document.createElement(`div`);highlight=document.createElement(`div`);resizeSurface=document.createElement(`div`);resizeObserver;constructor(e,t,n){this.host=e,this.onChange=t,this.copyToClipboard=n,this.selectedGroup=this.makeGroup(),this.tree={type:`group`,id:this.selectedGroup.id},this.measured=f(this.tree,this.hostRect()),this.dragSurface.className=`editor-drag-surface`,this.dragSurface.hidden=!0,this.highlight.className=`editor-drop-highlight`,this.dragSurface.append(this.highlight),this.resizeSurface.className=`editor-resize-surface`,this.resizeSurface.hidden=!0,e.append(this.dragSurface,this.resizeSurface),e.addEventListener(`dragover`,e=>this.dragOver(e)),e.addEventListener(`drop`,e=>{if(!this.dragged)return;e.preventDefault(),e.stopPropagation();let t=this.dropTarget(e),n=this.dragged;this.endDrag(),t&&this.transfer(n,t,this.isCopy(e))}),e.addEventListener(`dragleave`,t=>{e.contains(t.relatedTarget)||(this.highlight.hidden=!0)}),window.addEventListener(`dragend`,()=>this.endDrag()),window.addEventListener(`drop`,()=>this.endDrag()),window.addEventListener(`keydown`,e=>{e.key===`Escape`&&this.endDrag()}),window.addEventListener(`blur`,()=>{setTimeout(()=>this.activateFrame(document.activeElement),0)}),this.resizeObserver=new ResizeObserver(()=>this.layout()),this.resizeObserver.observe(e),this.render(!1)}get activeTab(){return this.selectedGroup.active}get tabs(){return l(this.tree).flatMap(e=>this.groups.get(e)?.tabs??[])}hostRect(){return{x:0,y:0,width:this.host.clientWidth,height:this.host.clientHeight}}makeGroup(){let e;do e=`group-${++this.sequence}`;while(this.groups.has(e));let t=document.createElement(`section`);t.className=`editor-group`,t.dataset.groupId=e,t.setAttribute(`role`,`region`);let n=document.getElementById(`editor-group-template`);t.append(n.content.cloneNode(!0));for(let n of t.querySelectorAll(`[id]`))n.dataset.control=n.id,this.groups.size&&(n.id+=`-${e}`);let r=e=>t.querySelector(`[data-control="${e}"]`);r(`current-path`).classList.add(`current-path`);let i={id:e,element:t,header:t.querySelector(`.group-header`),tabbar:r(`tabbar`),tabs:[],active:null,control:r};return t.addEventListener(`pointerdown`,()=>this.selectGroup(i),{capture:!0}),t.addEventListener(`focusin`,()=>this.selectGroup(i)),r(`group-focus`).addEventListener(`click`,()=>{this.selectGroup(i),this.focus()}),r(`reload-file`).addEventListener(`click`,()=>this.reload(i.active)),r(`copy-path`).addEventListener(`click`,()=>{let e=i.active?.file.path;e&&this.copyToClipboard(e,`File path`)}),r(`viewer-mode`).addEventListener(`click`,()=>this.setMode(i.active,`viewer`)),r(`source-mode`).addEventListener(`click`,()=>this.setMode(i.active,`source`)),r(`split-right`).addEventListener(`click`,()=>this.split(i,`right`)),r(`split-down`).addEventListener(`click`,()=>this.split(i,`down`)),this.groups.set(e,i),this.host.append(t),i}selectGroup(e){this.selectedGroup!==e&&(this.selectedGroup=e,this.render())}activate(e,t=!1){this.selectedGroup=e.group,e.group.active=e,this.render(),e.element.scrollIntoView({block:`nearest`,inline:`nearest`}),t&&e.button.focus()}mountPane(e){let t=e.pane.element;t.id=`${e.id}-panel`,t.setAttribute(`aria-labelledby`,e.id),t.addEventListener(`pointerdown`,()=>this.selectGroup(e.group),{capture:!0}),t.addEventListener(`focusin`,()=>this.selectGroup(e.group)),this.host.append(t)}makeTab(e,t,n=tr(e)){let r=`file-tab-${++this.tabSequence}`,i=document.createElement(`div`);i.className=`tab`,i.setAttribute(`role`,`presentation`),i.draggable=!0;let s=document.createElement(`button`);s.type=`button`,s.className=`tab-select tab-label`,s.setAttribute(`role`,`tab`),s.id=r,s.title=e.path,s.setAttribute(`aria-label`,e.path),s.setAttribute(`aria-controls`,`${r}-panel`);let c=document.createElement(`span`);c.textContent=e.name,s.append(o(e),c);let l={id:r,file:e,group:t,mode:n,element:i,button:s,pane:ir(e,0,n,e=>this.copyToClipboard(e,`Source`)),revision:0};s.addEventListener(`click`,()=>this.activate(l)),s.addEventListener(`keydown`,e=>{let t=l.group.tabs,n=t.indexOf(l),r=e.key===`ArrowRight`?(n+1)%t.length:e.key===`ArrowLeft`?(n-1+t.length)%t.length:e.key===`Home`?0:e.key===`End`?t.length-1:-1;e.key===`Delete`?(e.preventDefault(),this.close(l,!0)):r>=0&&(e.preventDefault(),this.activate(t[r],!0))});let u=document.createElement(`button`);return u.type=`button`,u.className=`tab-close`,u.title=`Close tab`,u.setAttribute(`aria-label`,`Close ${e.path}`),u.append(a(`close`)),u.addEventListener(`click`,()=>this.close(l,!0)),i.append(s,u),i.addEventListener(`dragstart`,e=>{e.dataTransfer&&(this.dragged=l,e.dataTransfer.effectAllowed=`copyMove`,e.dataTransfer.setData(`application/x-fzv-tab`,l.id),this.host.classList.add(`dragging-tab`),requestAnimationFrame(()=>{this.dragged&&(this.dragSurface.hidden=!1,this.highlight.hidden=!0)}))}),this.mountPane(l),t.tabs.push(l),t.active=l,l}open(e){let t=this.selectedGroup;this.activate(t.tabs.find(t=>t.file.path===e.path)??this.makeTab(e,t))}close(e,t=!1){this.dragged===e&&this.endDrag();let n=e.group,r=n.tabs.indexOf(e);r<0||(n.tabs.splice(r,1),e.pane.dispose(),e.element.remove(),n.active===e&&(n.active=n.tabs[Math.min(r,n.tabs.length-1)]??null),this.removeEmptyGroup(n),this.render(),t&&this.focus())}removeEmptyGroup(e){if(e.tabs.length||this.groups.size===1)return;let t=l(this.tree).indexOf(e.id);if(this.tree=c(this.tree,e.id),this.groups.delete(e.id),e.element.remove(),this.selectedGroup===e){let e=l(this.tree);this.selectedGroup=this.groups.get(e[Math.min(t,e.length-1)])}}focus(){(this.activeTab?.button??document.getElementById(`main`))?.focus()}cycle(e){let t=this.selectedGroup;if(!t.tabs.length)return;let n=t.active?t.tabs.indexOf(t.active):-1;this.activate(t.tabs[(n+e+t.tabs.length)%t.tabs.length])}focusGroup(e){let t=l(this.tree)[e],n=this.groups.get(t);n&&(this.selectGroup(n),this.focus())}splitActive(e){this.split(this.selectedGroup,e)}split(e,t){e.active&&this.transfer(e.active,{group:e,direction:t},!0)}transfer(e,t,n){let r=e.group,i=t.group;if(t.direction){if(this.groups.size>=32||!n&&r===i&&r.tabs.length===1)return;let e=this.makeGroup();this.tree=s(this.tree,i.id,e.id,t.direction,`split-${++this.sequence}`),i=e}let a=i.tabs.find(t=>t.file.path===e.file.path);if(i===r){t.index!==void 0&&(i.tabs.splice(i.tabs.indexOf(e),1),i.tabs.splice(t.index,0,e)),this.activate(e,!0);return}if(a&&t.index!==void 0&&(i.tabs.splice(i.tabs.indexOf(a),1),i.tabs.splice(t.index,0,a)),n){let n=a??this.makeTab(e.file,i,e.mode);!a&&t.index!==void 0&&(i.tabs.splice(i.tabs.indexOf(n),1),i.tabs.splice(t.index,0,n)),this.activate(n,!0);return}let o=r.tabs.indexOf(e);r.tabs.splice(o,1),r.active===e&&(r.active=r.tabs[Math.min(o,r.tabs.length-1)]??null),a?(e.pane.dispose(),e.element.remove()):(e.group=i,i.tabs.splice(t.index??i.tabs.length,0,e)),this.selectedGroup=i,i.active=a??e,this.removeEmptyGroup(r),this.activate(a??e,!0)}reload(e=this.activeTab){e&&(e.pane.dispose(),e.revision=++this.revision,e.pane=ir(e.file,e.revision,e.mode,e=>this.copyToClipboard(e,`Source`)),this.mountPane(e),this.render())}setMode(e,t){e?.pane.setMode&&er(e.file)&&(e.mode=t,e.pane.setMode(t),this.render())}frameTab(e){return this.tabs.find(t=>t.group.active===t&&t.file.kind===`html`&&t.mode===`viewer`&&t.pane.element.querySelector(`iframe`)?.contentWindow===e)}activateFrame(e){if(!(e instanceof HTMLIFrameElement))return;let t=this.frameTab(e.contentWindow);t&&this.selectGroup(t.group)}snapshot(){return{version:2,layout:this.tree,activeGroup:this.selectedGroup.id,groups:l(this.tree).map(e=>{let t=this.groups.get(e);return{id:e,tabs:t.tabs.map(e=>({path:e.file.path,mode:e.mode})),active:t.active?.file.path??null}})}}restore(e,t){if(!e){this.render();return}let n=new Map(t.map(e=>[e.path,e]));if(e.version===1){for(let t of e.tabs){let e=n.get(t);e&&this.makeTab(e,this.selectedGroup)}this.selectedGroup.active=this.selectedGroup.tabs.find(t=>t.file.path===e.active)??this.selectedGroup.tabs[0]??null}else{for(let e of this.groups.values())e.element.remove();this.groups.clear();let t=new Map;for(let r of e.groups){let e=this.makeGroup();t.set(r.id,e.id);for(let t of r.tabs){let r=n.get(t.path);r&&this.makeTab(r,e,er(r)?t.mode:tr(r))}e.active=e.tabs.find(e=>e.file.path===r.active)??e.tabs[0]??null}let r=e=>e.type===`group`?{type:`group`,id:t.get(e.id)}:{...e,id:`split-${++this.sequence}`,children:[r(e.children[0]),r(e.children[1])]};this.tree=r(e.layout),this.selectedGroup=this.groups.get(t.get(e.activeGroup));for(let e of[...this.groups.values()])this.removeEmptyGroup(e)}this.render()}render(e=!0){let t=0;for(let e of l(this.tree)){let n=this.groups.get(e);n.element.setAttribute(`aria-label`,`Editor group ${++t}`),n.element.classList.toggle(`focused`,n===this.selectedGroup),n.element.classList.toggle(`multiple`,this.groups.size>1);let r=n.control(`group-focus`);r.hidden=this.groups.size===1,r.textContent=String(t),r.setAttribute(`aria-label`,`Focus editor group ${t}`),r.setAttribute(`aria-pressed`,String(n===this.selectedGroup)),r.title=`Focus editor group ${t} (f)`,n.element.setAttribute(`aria-owns`,n.tabs.map(e=>e.pane.element.id).join(` `));let i=n.active;n.control(`no-tabs`).hidden=!!n.tabs.length,n.control(`empty-state`).hidden=!!i,n.control(`current-path`).textContent=i?.file.path??`Ready when you are`,n.control(`current-path`).title=i?.file.path??``;for(let e of[`reload-file`,`split-right`,`split-down`])n.control(e).disabled=!i||e.startsWith(`split-`)&&this.groups.size>=32;if(n.control(`copy-path`).disabled=!i,n.control(`open-file`).hidden=!i,n.control(`download-file`).hidden=!i,i&&(n.control(`open-file`).href=nr(i.file,i.revision)),i){let e=n.control(`download-file`);e.href=nr(i.file,i.revision,!0),e.download=i.file.name}n.control(`preview-modes`).hidden=!i||!er(i.file),n.control(`viewer-mode`).setAttribute(`aria-pressed`,String(i?.mode===`viewer`)),n.control(`source-mode`).setAttribute(`aria-pressed`,String(i?.mode===`source`)),n.tabs.forEach((e,t)=>{let r=n.tabbar.children[t];r!==e.element&&n.tabbar.insertBefore(e.element,r??null);let a=e===i;e.element.classList.toggle(`active`,a),e.button.setAttribute(`aria-selected`,String(a)),e.button.tabIndex=a?0:-1,e.pane.element.hidden=!a,e.pane.element.dataset.groupId=n.id,e.pane.setActive(a&&n===this.selectedGroup)})}this.layout(),e&&this.onChange()}layout(){this.measured=f(this.tree,this.hostRect());for(let[e,t]of this.measured.groups){let n=this.groups.get(e);ar(n.element,t);let r=Math.min(t.height,n.header.offsetHeight);for(let e of n.tabs)ar(e.pane.element,{...t,y:t.y+r,height:Math.max(0,t.height-r)})}for(let[e,t]of this.sashes)this.measured.splits.has(e)||(t.remove(),this.sashes.delete(e));for(let[e,{node:t,rect:n,sash:r}]of this.measured.splits){let i=this.sashes.get(e);i||(i=this.makeSash(e),this.sashes.set(e,i),this.host.append(i)),i.dataset.axis=t.axis,i.setAttribute(`aria-orientation`,t.axis===`x`?`vertical`:`horizontal`),i.setAttribute(`aria-label`,t.axis===`x`?`Resize editor columns`:`Resize editor rows`);let[a,o]=d(t,t.axis===`x`?n.width:n.height);i.setAttribute(`aria-valuemin`,String(Math.round(a*100))),i.setAttribute(`aria-valuemax`,String(Math.round(o*100))),i.setAttribute(`aria-valuenow`,String(Math.round(Math.max(a,Math.min(o,t.ratio))*100))),ar(i,r)}}makeSash(e){let t=document.createElement(`div`);t.className=`editor-sash`,t.setAttribute(`role`,`separator`),t.tabIndex=0;let n=null,r=(r=!1)=>{if(!n)return;let i=this.measured.splits.get(e);r&&i&&(i.node.ratio=n.ratio);let a=n.pointer;n=null,t.hasPointerCapture(a)&&t.releasePointerCapture(a),this.resizeSurface.hidden=!0,t.classList.remove(`resizing`),this.layout(),this.onChange()};return t.addEventListener(`pointerdown`,r=>{if(r.button!==0)return;r.preventDefault();let i=this.measured.splits.get(e);n={ratio:i.node.ratio,pointer:r.pointerId},t.setPointerCapture(r.pointerId),t.focus(),t.classList.add(`resizing`),this.resizeSurface.style.cursor=i.node.axis===`x`?`col-resize`:`row-resize`,this.resizeSurface.hidden=!1}),t.addEventListener(`pointermove`,t=>{if(!n)return;let r=this.measured.splits.get(e),i=this.host.getBoundingClientRect(),a=r.node.axis===`x`?r.rect.width:r.rect.height,o=r.node.axis===`x`?t.clientX-i.left-r.rect.x:t.clientY-i.top-r.rect.y,[s,c]=d(r.node,a);r.node.ratio=Math.max(s,Math.min(c,(o-2)/Math.max(1,a-4))),this.layout()}),t.addEventListener(`pointerup`,()=>r()),t.addEventListener(`pointercancel`,()=>r(!0)),t.addEventListener(`lostpointercapture`,()=>r()),t.addEventListener(`keydown`,t=>{if(t.key===`Escape`&&n){t.preventDefault(),r(!0);return}let i=this.measured.splits.get(e),a=i.node.axis===`x`?`ArrowLeft`:`ArrowUp`;if(![a,i.node.axis===`x`?`ArrowRight`:`ArrowDown`,`Home`,`End`].includes(t.key))return;t.preventDefault();let[o,s]=d(i.node,i.node.axis===`x`?i.rect.width:i.rect.height);i.node.ratio=t.key===`Home`?o:t.key===`End`?s:Math.max(o,Math.min(s,i.node.ratio+(t.key===a?-.05:.05))),this.layout(),this.onChange()}),t.addEventListener(`dblclick`,()=>{this.measured.splits.get(e).node.ratio=.5,this.layout(),this.onChange()}),t}isCopy(e){return/Mac|iPhone|iPad/.test(navigator.platform)?e.altKey:e.ctrlKey}endDrag(){this.dragged=null,this.host.classList.remove(`dragging-tab`),this.dragSurface.hidden=!0,this.highlight.hidden=!0}dropTarget(e){let t=this.host.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;for(let[t,i]of this.measured.groups){if(n<i.x||n>i.x+i.width||r<i.y||r>i.y+i.height)continue;let a=this.groups.get(t),o=a.tabbar.getBoundingClientRect();if(e.clientY<o.bottom){e.clientX<o.left+24&&(a.tabbar.scrollLeft-=12),e.clientX>o.right-24&&(a.tabbar.scrollLeft+=12);let t=a.tabs.filter(e=>e.file.path!==this.dragged?.file.path),n=t.findIndex(t=>{let n=t.element.getBoundingClientRect();return e.clientX<n.left+n.width/2});return{group:a,index:n<0?t.length:n}}let s=a.header.offsetHeight,c=(n-i.x)/i.width,l=(r-i.y-s)/Math.max(1,i.height-s),u;return l>=0&&(c<.1||c>.9||l<.1||l>.9)&&(u=c<1/3?`left`:c>2/3?`right`:l<.5?`up`:`down`),{group:a,direction:u}}return null}dragOver(e){if(!this.dragged)return;e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.isCopy(e)?`copy`:`move`);let t=this.dropTarget(e);if(this.highlight.hidden=!t,!t)return;let n=this.measured.groups.get(t.group.id);if(t.index!==void 0){let e=t.group.tabs.filter(e=>e.file.path!==this.dragged?.file.path),r=e[t.index]?.element.getBoundingClientRect(),i=e[t.index-1]?.element.getBoundingClientRect(),a=t.group.tabbar.getBoundingClientRect(),o=this.host.getBoundingClientRect(),s=Math.max(a.left,Math.min(a.right-2,r?.left??i?.right??a.left));this.highlight.classList.add(`tab-insertion`),ar(this.highlight,{x:s-o.left,y:n.y,width:2,height:a.height});return}this.highlight.classList.remove(`tab-insertion`);let r=t.group.header.offsetHeight,i={...n,y:n.y+r,height:Math.max(0,n.height-r)};(t.direction===`left`||t.direction===`right`)&&(i.width/=2,t.direction===`right`&&(i.x+=i.width)),(t.direction===`up`||t.direction===`down`)&&(i.height/=2,t.direction===`down`&&(i.y+=i.height)),ar(this.highlight,i)}},sr=`fzv:theme`;function cr(e){let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=null;try{let e=localStorage.getItem(sr);(e===`light`||e===`dark`)&&(n=e)}catch{}let r=t=>{document.documentElement.dataset.theme=t;let n=t===`light`?`Switch to dark theme`:`Switch to light theme`;e.setAttribute(`aria-label`,n),e.setAttribute(`aria-pressed`,String(t===`dark`)),e.title=n;let r=document.createElement(`span`);r.textContent=t===`light`?`Dark`:`Light`,e.replaceChildren(a(`color-mode`),r)};r(n??(t.matches?`dark`:`light`)),t.addEventListener(`change`,()=>{n||r(t.matches?`dark`:`light`)}),e.addEventListener(`click`,()=>{n=document.documentElement.dataset.theme===`dark`?`light`:`dark`,r(n);try{localStorage.setItem(sr,n)}catch{}})}function lr(e={}){let t=new AbortController,n=t.signal,r=0,i=null,a=[],o=``,s=null,c=()=>{i?.remove(),i=null,a=[],o=``,r=0},l=()=>{if(!s)return;let e=s;s=null,e.open&&e.close(),e.remove()},u=()=>{if(s)return;c();let t=document.createElement(`dialog`);s=t,t.setAttribute(`aria-labelledby`,`fzv-keyboard-help-title`),Object.assign(t.style,{position:`fixed`,inset:`0`,margin:`auto`,width:`min(520px, calc(100vw - 28px))`,maxHeight:`min(80vh, 640px)`,overflow:`auto`,padding:`20px 22px`,border:`1px solid #8888`,borderRadius:`8px`,background:`#f8f8f8`,color:`#202020`,boxShadow:`0 12px 40px #0005`,font:`13px/1.5 system-ui, sans-serif`,zIndex:`2147483647`});let r=document.createElement(`div`);Object.assign(r.style,{display:`flex`,alignItems:`center`,gap:`12px`,marginBottom:`14px`});let i=document.createElement(`h2`);i.id=`fzv-keyboard-help-title`,i.textContent=`Keyboard shortcuts`,Object.assign(i.style,{flex:`1`,margin:`0`,fontSize:`16px`});let a=document.createElement(`button`);a.type=`button`,a.textContent=`Close`,a.setAttribute(`aria-label`,`Close keyboard shortcuts`),Object.assign(a.style,{padding:`5px 9px`,border:`1px solid #8888`,borderRadius:`4px`,background:`#fff`,color:`inherit`,font:`inherit`,cursor:`pointer`}),a.addEventListener(`click`,l,{signal:n}),r.append(i,a);let o=[[`/`,`Find a file`],[`r`,`Reload the active preview`],[`f`,e.bridgeWorkspace?`Show workspace hints`:`Show hints for links and controls`],[`h j k l`,`Scroll the active preview`],[`gg`,`Scroll to the top`],[`G`,`Scroll to the bottom`],[`?`,`Show this keyboard help`],[`Escape`,`Cancel hints or close this help`]];e.bridgeWorkspace||o.push([`Ctrl/Cmd + Tab`,`Switch tabs in the focused group`],[`Alt + j / k`,`Switch tabs in the focused group`],[`Ctrl/Cmd + 1–9`,`Focus an editor group`],[`Ctrl/Cmd + \\`,`Split the editor to the right`],[`Ctrl/Cmd + Shift + \\`,`Split the editor below`],[`Ctrl/Cmd + f`,`Find in a PDF`],[`Ctrl/Cmd + + / − / 0`,`Zoom an image or PDF`]);let u=document.createElement(`div`);Object.assign(u.style,{display:`grid`,gridTemplateColumns:`minmax(125px, auto) minmax(0, 1fr)`,gap:`7px 14px`,alignItems:`center`});for(let[e,t]of o){let n=document.createElement(`kbd`);n.textContent=e,Object.assign(n.style,{justifySelf:`start`,padding:`2px 5px`,border:`1px solid #aaa`,borderRadius:`3px`,background:`#eee`,color:`inherit`,font:`11px ui-monospace, monospace`,whiteSpace:`nowrap`});let r=document.createElement(`span`);r.textContent=t,u.append(n,r)}t.append(r,u),t.addEventListener(`cancel`,e=>{e.preventDefault(),l()},{signal:n}),document.body.append(t),t.showModal(),a.focus()},d=e=>e instanceof HTMLElement&&(e.isContentEditable||!!e.closest(`input, textarea, select, [role="textbox"]`)),f=()=>{c();let e=document.querySelector(`dialog[open]`)??document.body,t=[...e.querySelectorAll(`a[href], button:not(:disabled), input:not(:disabled):not([type="hidden"]), textarea:not(:disabled), select:not(:disabled), summary, [role="button"], [tabindex]:not([tabindex="-1"]), [contenteditable]:not([contenteditable="false"]), iframe`)].filter(e=>{if(e.matches(`:disabled`)||e.closest(`[hidden], [inert], [aria-disabled="true"]`))return!1;let t=getComputedStyle(e);if(t.visibility!==`visible`||t.display===`none`||t.opacity===`0`)return!1;let n=e.getBoundingClientRect(),r=Math.max(0,n.left),i=Math.min(innerWidth,n.right),a=Math.max(0,n.top),o=Math.min(innerHeight,n.bottom);if(r>=i||a>=o)return!1;let s=document.elementFromPoint((r+i)/2,(a+o)/2);return s===e||!!(s&&e.contains(s))});if(!t.length)return;i=document.createElement(`div`),i.className=`vim-hints`,i.setAttribute(`aria-label`,`Link hints; type a label to jump, Escape to cancel`),i.style.pointerEvents=`none`;let n=Math.max(1,Math.ceil(Math.log(t.length)/Math.log(9)));a=t.map((e,t)=>{let r=t,a=``;for(let e=0;e<n;e++)a=`asdfghjkl`[r%9]+a,r=Math.floor(r/9);let o=e.getBoundingClientRect(),s=document.createElement(`span`);return s.className=`vim-hint`,s.dataset.hintTarget=e.id||e.getAttribute(`aria-label`)||e.textContent?.trim()||e.tagName,s.textContent=a.toUpperCase(),s.setAttribute(`aria-hidden`,`true`),Object.assign(s.style,{position:`fixed`,zIndex:`2147483647`,pointerEvents:`none`,left:`${Math.max(0,Math.min(innerWidth-32,o.left))}px`,top:`${Math.max(0,Math.min(innerHeight-20,o.top))}px`,font:`bold 12px/18px monospace`,padding:`0 3px`,color:`#1f1f1f`,backgroundColor:`#ffdf80`,border:`1px solid #b78618`,borderRadius:`2px`,boxShadow:`0 1px 2px #0003`}),i.append(s),{target:e,label:a,badge:s}}),e.append(i)},p=()=>{let t=e.getScrollRoot?.();if(t)return t;let n=document.activeElement;for(;n instanceof HTMLElement&&n!==document.body;){let e=getComputedStyle(n);if(/(auto|scroll)/.test(e.overflowY+e.overflowX)&&(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth))return n;n=n.parentElement}return document.scrollingElement},m=e=>{let t=p();t&&(e===`top`?t.scrollTo({top:0,behavior:`instant`}):e===`bottom`?t.scrollTo({top:t.scrollHeight,behavior:`instant`}):t.scrollBy({left:e===`h`?-64:e===`l`?64:0,top:e===`j`?64:e===`k`?-64:0,behavior:`instant`}))};return window.addEventListener(`keydown`,t=>{if(t.defaultPrevented||t.isComposing||d(t.composedPath()[0]??t.target)||t.ctrlKey||t.metaKey||t.altKey){r=0;return}let n=()=>{t.preventDefault(),t.stopImmediatePropagation()};if(s){t.key===`Escape`&&(l(),n());return}if(t.key===`Escape`){(i||r)&&(c(),n());return}if(i){if(n(),t.key===`Backspace`)o=o.slice(0,-1);else if(t.key.length===1)o+=t.key.toLowerCase();else return;let r=a.filter(e=>e.label.startsWith(o));for(let e of a)e.badge.hidden=!e.label.startsWith(o);if(!r.length){c();return}let i=r.find(e=>e.label===o);if(i){let t=i.target;c(),t.isConnected&&(t.focus(),e.onHintActivate?.(t)||t.click())}return}let p=r;if(r=0,t.key===`/`&&e.onSearch){n(),e.onSearch();return}if(t.key===`?`){n(),u();return}if(t.key===`r`&&e.onReload){n(),e.onReload();return}if(t.key===`f`&&!t.repeat){n(),e.bridgeWorkspace?parent.postMessage({type:`fzv:shortcut`,key:`f`},`*`):f();return}if(t.key===`g`){if(n(),t.repeat)return;let i=performance.now();p&&i-p<800?e.onScroll?.(`top`)||m(`top`):r=i;return}if(![`h`,`j`,`k`,`l`,`G`].includes(t.key))return;n();let h=t.key===`G`?`bottom`:t.key;e.onScroll?.(h)||m(h)},{capture:!0,signal:n}),window.addEventListener(`blur`,c,{signal:n}),window.addEventListener(`message`,t=>{e.bridgeWorkspace&&parent!==window&&t.source===parent&&(t.data?.type===`fzv:show-hints`&&f(),t.data?.type===`fzv:scroll`&&[`h`,`j`,`k`,`l`,`top`,`bottom`].includes(t.data.key)&&m(t.data.key))},{signal:n}),window.addEventListener(`resize`,c,{signal:n}),document.addEventListener(`pointerdown`,c,{capture:!0,signal:n}),document.addEventListener(`pointerdown`,()=>e.onFocus?.(),{capture:!0,signal:n}),document.addEventListener(`focusin`,()=>e.onFocus?.(),{signal:n}),document.addEventListener(`scroll`,()=>{i&&c()},{capture:!0,signal:n}),document.addEventListener(`focusin`,e=>{r=0,d(e.target)&&c()},{signal:n}),{cancel:c,showHints:f,showHelp:u,dispose:()=>{c(),l(),t.abort()}}}function Y(e){let t=document.getElementById(e);if(!t)throw Error(`Missing UI element: ${e}`);return t}var X=Y(`search`),Z=Y(`search-panel`),ur=Y(`results`),dr=Y(`result-count`),fr=Y(`refresh-files`),pr=Y(`notification`);cr(Y(`theme-toggle`));var mr=[],hr=new e([]),gr=``,_r=[],Q=0,vr,yr=0,br;try{br=window.localStorage}catch{}function xr(e){pr.textContent=e,pr.hidden=!1,clearTimeout(vr),vr=setTimeout(()=>{pr.hidden=!0},5e3)}function Sr(e){let t=document.activeElement,n=window.getSelection(),r=n?Array.from({length:n.rangeCount},(e,t)=>n.getRangeAt(t).cloneRange()):[],i=window.scrollX,a=window.scrollY,o=document.createElement(`textarea`);o.value=e,o.readOnly=!0,o.setAttribute(`aria-hidden`,`true`),Object.assign(o.style,{position:`fixed`,left:`-10000px`,top:`0`,width:`1px`,height:`1px`,opacity:`0`,fontSize:`16px`}),document.body.append(o);let s=!1;try{o.focus({preventScroll:!0}),o.select(),s=document.execCommand(`copy`)}catch{s=!1}if(o.remove(),t instanceof HTMLElement&&t.isConnected&&t.focus({preventScroll:!0}),n){n.removeAllRanges();for(let e of r)n.addRange(e)}return window.scrollTo(i,a),s}async function Cr(e,t){try{await navigator.clipboard.writeText(e),xr(`${t} copied to clipboard.`)}catch{xr(Sr(e)?`${t} copied to clipboard.`:`Could not copy ${t.toLowerCase()}.`)}}function wr(){br&&gr&&i(br,gr,$.snapshot())}function Tr(){let e=hr.search(X.value);_r=e.files,Q=Math.min(Math.max(Q,0),Math.max(0,_r.length-1));let t=_r.map((e,t)=>{let n=document.createElement(`button`);n.type=`button`,n.className=`result monaco-list-row quick-input-list-entry`,n.title=e.path,n.setAttribute(`aria-label`,e.path),n.classList.toggle(`active`,e.path===$.activeTab?.file.path),n.classList.toggle(`keyboard-selected`,t===Q&&document.activeElement===X),e.path===$.activeTab?.file.path&&n.setAttribute(`aria-current`,`true`);let r=document.createElement(`span`);r.className=`result-text`;let i=document.createElement(`span`);i.className=`result-name`,i.textContent=e.name+(e.kind===`directory`?`/`:``);let a=document.createElement(`span`);return a.className=`result-path`,a.textContent=e.path,r.append(i,a),n.append(o(e),r),n.addEventListener(`click`,()=>kr(e)),n});if(ur.replaceChildren(...t),!_r.length){let e=document.createElement(`div`);e.className=`no-results`,e.textContent=mr.length?`No files match your search.`:`No previewable files yet. Add a PDF, HTML, image, or text file, then refresh.`,ur.append(e)}dr.textContent=X.value.trim()?`${e.total} match${e.total===1?``:`es`}`:`${e.total} item${e.total===1?``:`s`}`,e.total>_r.length&&(dr.textContent+=` · showing ${_r.length}`)}function Er(){$.focus()}function Dr(e){Nr.cancel(),e?(X.value=``,Q=0,Z.open||Z.showModal(),X.focus(),Tr()):(Z.close(),Er())}function Or(){Dr(!0)}function kr(e){e.kind===`directory`?(X.value=`${e.path}/`,Q=0,X.focus(),Tr()):($.open(e),Dr(!1))}function Ar(e){return[...new Set(e.version===1?e.tabs:e.groups.flatMap(e=>e.tabs.map(e=>e.path)))]}async function jr(e){let t=[],n=[],r=0;for(let i of Ar(e)){let e=new URLSearchParams({path:i}).toString().length+7;e>12e3||((n.length===32||n.length>0&&r+e>12e3)&&(t.push(n),n=[],r=0),n.push(i),r+=e)}return n.length&&t.push(n),(await Promise.all(t.map(async e=>{let t=new URLSearchParams;for(let n of e)t.append(`path`,n);let n=await fetch(`/api/session-files?${t}`);if(!n.ok)throw Error(`HTTP ${n.status}`);return await n.json()}))).flat()}async function Mr(t=!1){fr.disabled=!0,dr.textContent=`Loading files…`;try{if(t){let t=fetch(`/api/files`).then(async e=>e.ok?{data:await e.json()}:{error:Error(`HTTP ${e.status}`)},e=>({error:e})),n=await fetch(`/api/project`);if(!n.ok)throw Error(`HTTP ${n.status}`);let i=await n.json();i.watch&&new EventSource(`/api/events`).addEventListener(`change`,()=>window.location.reload()),gr=i.id,Y(`project-name`).textContent=i.name,Y(`status-project`).textContent=i.name;let a=br?r(br,gr):null,o=!1;if(a)try{$.restore(a,await jr(a)),o=!0}catch{}let s=await t;if(`error`in s)throw s.error;let c=s.data;a&&!o&&$.restore(a,c.files),mr=c.files,hr=new e([...c.directories,...mr]),Tr()}else{let t=await fetch(`/api/files`);if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();gr=n.project.id;let r=new Set(n.files.map(e=>e.path));mr=n.files,hr=new e([...n.directories,...mr]),Y(`project-name`).textContent=n.project.name,Y(`status-project`).textContent=n.project.name;for(let e of $.tabs)r.has(e.file.path)||$.close(e);Tr(),xr(`File list refreshed.`)}}catch(e){dr.textContent=`Could not load files`,xr(`Could not load the project: ${e}`)}finally{fr.disabled=!1}}X.addEventListener(`input`,()=>{Q=0,cancelAnimationFrame(yr),yr=requestAnimationFrame(Tr)}),X.addEventListener(`focus`,Tr),X.addEventListener(`blur`,()=>{for(let e of ur.children)e.classList.remove(`keyboard-selected`)}),X.addEventListener(`keydown`,e=>{e.key===`Escape`?(e.preventDefault(),Dr(!1)):([`Enter`,`ArrowDown`,`ArrowUp`].includes(e.key)&&(cancelAnimationFrame(yr),Tr()),e.key===`Enter`&&_r[Q]&&(e.preventDefault(),kr(_r[Q])),(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),Q=Math.max(0,Math.min(_r.length-1,Q+(e.key===`ArrowDown`?1:-1))),Tr(),ur.children[Q]?.scrollIntoView({block:`nearest`})))}),Z.addEventListener(`close`,()=>{Z.open||Er()}),Z.addEventListener(`cancel`,e=>{e.preventDefault(),Dr(!1)}),Z.addEventListener(`click`,e=>{if(e.target!==Z)return;let t=Z.getBoundingClientRect();(e.clientX<t.left||e.clientX>t.right||e.clientY<t.top||e.clientY>t.bottom)&&Dr(!1)}),Y(`close-search`).addEventListener(`click`,()=>Dr(!1)),Y(`find-file`).addEventListener(`click`,Or),fr.addEventListener(`click`,()=>{Mr()}),window.addEventListener(`keydown`,e=>{if(e.defaultPrevented||e.isComposing||document.querySelector(`dialog[open]`))return;let t=document.activeElement,n=t instanceof HTMLElement&&(t.isContentEditable||!!t.closest(`input,textarea,select,[role="textbox"]`));if(e.altKey&&!e.ctrlKey&&!e.metaKey&&[`j`,`k`].includes(e.key.toLowerCase())){e.preventDefault(),$.cycle(e.key.toLowerCase()===`j`?1:-1);return}if(e.ctrlKey&&e.key===`Tab`){e.preventDefault(),$.cycle(e.shiftKey?-1:1);return}if(!n&&(e.ctrlKey||e.metaKey)&&!e.altKey&&!Z.open){if(e.code===`Backslash`){e.preventDefault(),$.splitActive(e.shiftKey?`down`:`right`);return}if(/^[1-9]$/.test(e.key)){e.preventDefault(),$.focusGroup(Number(e.key)-1);return}}let r=$.activeTab;if(!n&&(e.ctrlKey||e.metaKey)&&!e.altKey&&r?.file.kind===`image`){let t=[`+`,`=`].includes(e.key)?`.image-zoom-in`:[`-`,`_`].includes(e.key)?`.image-zoom-out`:e.key===`0`?`.image-fit`:null;t&&(e.preventDefault(),r.pane.element.querySelector(t)?.click())}});var Nr=lr({onSearch:Or,onScroll:e=>{let t=$.activeTab;if(!t||t.file.kind!==`html`||t.mode!==`viewer`)return!1;let n=t.pane.element.querySelector(`iframe`);return n?.contentWindow?(n.contentWindow.postMessage({type:`fzv:scroll`,key:e},`*`),!0):!1},onHintActivate:e=>!(e instanceof HTMLIFrameElement)||!$.frameTab(e.contentWindow)?!1:($.activateFrame(e),e.contentWindow?.postMessage({type:`fzv:show-hints`},`*`),!0),onReload:()=>{Z.open||$.reload()},getScrollRoot:()=>Z.open?ur:[...$.activeTab?.pane.element.querySelectorAll(`.source-preview, .viewer-surface, .pdf-scroll`)??[]].find(e=>e.getClientRects().length>0)??null}),$=new or(Y(`preview`),()=>{Nr.cancel();let e=$.activeTab;document.title=e?`${e.file.name} — fzv`:`fzv`;let t=$.tabs.length;Y(`tab-count`).textContent=`${t} open tab${t===1?``:`s`}`,Tr(),wr()},(e,t)=>void Cr(e,t));window.addEventListener(`message`,e=>{if(e.origin!==`null`)return;let t=$.frameTab(e.source);t&&(e.data?.type===`fzv:focus`?$.activateFrame(t.pane.element.querySelector(`iframe`)):t===$.activeTab&&e.data?.type===`fzv:shortcut`&&(e.data.key===`/`&&Or(),e.data.key===`r`&&$.reload(),e.data.key===`f`&&!Z.open&&($.focus(),Nr.showHints())))}),Mr(!0);export{Xn as t};
|