@burger-editor/local 4.0.0-alpha.10 → 4.0.0-alpha.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.js CHANGED
@@ -27,7 +27,7 @@ function kebabCase$1(str) {
27
27
  }
28
28
 
29
29
  /**
30
- * marked v16.1.1 - a markdown parser
30
+ * marked v16.1.2 - a markdown parser
31
31
  * Copyright (c) 2011-2025, Christopher Jeffrey. (MIT Licensed)
32
32
  * https://github.com/markedjs/marked
33
33
  */
@@ -38,7 +38,7 @@ function kebabCase$1(str) {
38
38
  */
39
39
 
40
40
  function L$1(){return {async:false,breaks:false,extensions:null,gfm:true,hooks:null,pedantic:false,renderer:null,silent:false,tokenizer:null,walkTokens:null}}var O$1=L$1();function H$1(l){O$1=l;}var E$1={exec:()=>null};function h$3(l,e=""){let t=typeof l=="string"?l:l.source,n={replace:(r,i)=>{let s=typeof i=="string"?i:i.source;return s=s.replace(m$1.caret,"$1"),t=t.replace(r,s),n},getRegex:()=>new RegExp(t,e)};return n}var m$1={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:l=>new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:l=>new RegExp(`^ {0,${Math.min(3,l-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:l=>new RegExp(`^ {0,${Math.min(3,l-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:l=>new RegExp(`^ {0,${Math.min(3,l-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:l=>new RegExp(`^ {0,${Math.min(3,l-1)}}#`),htmlBeginRegex:l=>new RegExp(`^ {0,${Math.min(3,l-1)}}<(?:[a-z].*>|!--)`,"i")},xe$1=/^(?:[ \t]*(?:\n|$))+/,be$1=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Re$1=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,C$1=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Oe$1=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,j$1=/(?:[*+-]|\d{1,9}[.)])/,se$1=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ie$5=h$3(se$1).replace(/bull/g,j$1).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Te$1=h$3(se$1).replace(/bull/g,j$1).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),F$1=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,we$1=/^[^\n]+/,Q$1=/(?!\s*\])(?:\\.|[^\[\]\\])+/,ye$1=h$3(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Q$1).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Pe$1=h$3(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,j$1).getRegex(),v$1="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",U$1=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Se$1=h$3("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",U$1).replace("tag",v$1).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),oe$1=h$3(F$1).replace("hr",C$1).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",v$1).getRegex(),$e$1=h$3(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",oe$1).getRegex(),K$1={blockquote:$e$1,code:be$1,def:ye$1,fences:Re$1,heading:Oe$1,hr:C$1,html:Se$1,lheading:ie$5,list:Pe$1,newline:xe$1,paragraph:oe$1,table:E$1,text:we$1},re$3=h$3("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",C$1).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",v$1).getRegex(),_e$1={...K$1,lheading:Te$1,table:re$3,paragraph:h$3(F$1).replace("hr",C$1).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",re$3).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",v$1).getRegex()},Le$1={...K$1,html:h$3(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",U$1).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:E$1,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:h$3(F$1).replace("hr",C$1).replace("heading",` *#{1,6} *[^
41
- ]`).replace("lheading",ie$5).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Me$1=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ze$1=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ae$1=/^( {2,}|\\)\n(?!\s*$)/,Ae$1=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,D$1=/[\p{P}\p{S}]/u,X$1=/[\s\p{P}\p{S}]/u,le$1=/[^\s\p{P}\p{S}]/u,Ee$1=h$3(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,X$1).getRegex(),ue$1=/(?!~)[\p{P}\p{S}]/u,Ce$1=/(?!~)[\s\p{P}\p{S}]/u,Ie$1=/(?:[^\s\p{P}\p{S}]|~)/u,Be$1=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,pe$1=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,qe$1=h$3(pe$1,"u").replace(/punct/g,D$1).getRegex(),ve$1=h$3(pe$1,"u").replace(/punct/g,ue$1).getRegex(),ce$1="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",De$1=h$3(ce$1,"gu").replace(/notPunctSpace/g,le$1).replace(/punctSpace/g,X$1).replace(/punct/g,D$1).getRegex(),Ze$1=h$3(ce$1,"gu").replace(/notPunctSpace/g,Ie$1).replace(/punctSpace/g,Ce$1).replace(/punct/g,ue$1).getRegex(),Ge$1=h$3("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,le$1).replace(/punctSpace/g,X$1).replace(/punct/g,D$1).getRegex(),He$1=h$3(/\\(punct)/,"gu").replace(/punct/g,D$1).getRegex(),Ne$1=h$3(/^<(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(),je$1=h$3(U$1).replace("(?:-->|$)","-->").getRegex(),Fe$1=h$3("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",je$1).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),q$1=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Qe$1=h$3(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",q$1).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),he$1=h$3(/^!?\[(label)\]\[(ref)\]/).replace("label",q$1).replace("ref",Q$1).getRegex(),de$1=h$3(/^!?\[(ref)\](?:\[\])?/).replace("ref",Q$1).getRegex(),Ue$1=h$3("reflink|nolink(?!\\()","g").replace("reflink",he$1).replace("nolink",de$1).getRegex(),W$1={_backpedal:E$1,anyPunctuation:He$1,autolink:Ne$1,blockSkip:Be$1,br:ae$1,code:ze$1,del:E$1,emStrongLDelim:qe$1,emStrongRDelimAst:De$1,emStrongRDelimUnd:Ge$1,escape:Me$1,link:Qe$1,nolink:de$1,punctuation:Ee$1,reflink:he$1,reflinkSearch:Ue$1,tag:Fe$1,text:Ae$1,url:E$1},Ke$1={...W$1,link:h$3(/^!?\[(label)\]\((.*?)\)/).replace("label",q$1).getRegex(),reflink:h$3(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",q$1).getRegex()},N$1={...W$1,emStrongRDelimAst:Ze$1,emStrongLDelim:ve$1,url:h$3(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Xe$1={...N$1,br:h$3(ae$1).replace("{2,}","*").getRegex(),text:h$3(N$1.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},I$1={normal:K$1,gfm:_e$1,pedantic:Le$1},M$1={normal:W$1,gfm:N$1,breaks:Xe$1,pedantic:Ke$1};var We$1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ke$1=l=>We$1[l];function w$1(l,e){if(e){if(m$1.escapeTest.test(l))return l.replace(m$1.escapeReplace,ke$1)}else if(m$1.escapeTestNoEncode.test(l))return l.replace(m$1.escapeReplaceNoEncode,ke$1);return l}function J$1(l){try{l=encodeURI(l).replace(m$1.percentDecode,"%");}catch{return null}return l}function V$1(l,e){let t=l.replace(m$1.findPipe,(i,s,o)=>{let a=false,u=s;for(;--u>=0&&o[u]==="\\";)a=!a;return a?"|":" |"}),n=t.split(m$1.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(m$1.slashPipe,"|");return n}function z$1(l,e,t){let n=l.length;if(n===0)return "";let r=0;for(;r<n;){let i=l.charAt(n-r-1);if(i===e&&true)r++;else break}return l.slice(0,n-r)}function ge$1(l,e){if(l.indexOf(e[1])===-1)return -1;let t=0;for(let n=0;n<l.length;n++)if(l[n]==="\\")n++;else if(l[n]===e[0])t++;else if(l[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function fe$1(l,e,t,n,r){let i=e.href,s=e.title||null,o=l[1].replace(r.other.outputLinkReplace,"$1");n.state.inLink=true;let a={type:l[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:s,text:o,tokens:n.inlineTokens(o)};return n.state.inLink=false,a}function Je$1(l,e,t){let n=l.match(t.other.indentCodeCompensation);if(n===null)return e;let r=n[1];return e.split(`
41
+ ]`).replace("lheading",ie$5).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Me$1=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ze$1=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ae$1=/^( {2,}|\\)\n(?!\s*$)/,Ae$1=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,D$1=/[\p{P}\p{S}]/u,W$1=/[\s\p{P}\p{S}]/u,le$1=/[^\s\p{P}\p{S}]/u,Ee$1=h$3(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,W$1).getRegex(),ue$1=/(?!~)[\p{P}\p{S}]/u,Ce$1=/(?!~)[\s\p{P}\p{S}]/u,Ie$1=/(?:[^\s\p{P}\p{S}]|~)/u,Be$1=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,pe$1=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,qe$1=h$3(pe$1,"u").replace(/punct/g,D$1).getRegex(),ve$1=h$3(pe$1,"u").replace(/punct/g,ue$1).getRegex(),ce$1="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",De$1=h$3(ce$1,"gu").replace(/notPunctSpace/g,le$1).replace(/punctSpace/g,W$1).replace(/punct/g,D$1).getRegex(),Ze$1=h$3(ce$1,"gu").replace(/notPunctSpace/g,Ie$1).replace(/punctSpace/g,Ce$1).replace(/punct/g,ue$1).getRegex(),Ge$1=h$3("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,le$1).replace(/punctSpace/g,W$1).replace(/punct/g,D$1).getRegex(),He$1=h$3(/\\(punct)/,"gu").replace(/punct/g,D$1).getRegex(),Ne$1=h$3(/^<(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(),je$1=h$3(U$1).replace("(?:-->|$)","-->").getRegex(),Fe$1=h$3("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",je$1).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),q$1=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Qe$1=h$3(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",q$1).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),he$1=h$3(/^!?\[(label)\]\[(ref)\]/).replace("label",q$1).replace("ref",Q$1).getRegex(),de$1=h$3(/^!?\[(ref)\](?:\[\])?/).replace("ref",Q$1).getRegex(),Ue$1=h$3("reflink|nolink(?!\\()","g").replace("reflink",he$1).replace("nolink",de$1).getRegex(),X$1={_backpedal:E$1,anyPunctuation:He$1,autolink:Ne$1,blockSkip:Be$1,br:ae$1,code:ze$1,del:E$1,emStrongLDelim:qe$1,emStrongRDelimAst:De$1,emStrongRDelimUnd:Ge$1,escape:Me$1,link:Qe$1,nolink:de$1,punctuation:Ee$1,reflink:he$1,reflinkSearch:Ue$1,tag:Fe$1,text:Ae$1,url:E$1},Ke$1={...X$1,link:h$3(/^!?\[(label)\]\((.*?)\)/).replace("label",q$1).getRegex(),reflink:h$3(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",q$1).getRegex()},N$1={...X$1,emStrongRDelimAst:Ze$1,emStrongLDelim:ve$1,url:h$3(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},We$1={...N$1,br:h$3(ae$1).replace("{2,}","*").getRegex(),text:h$3(N$1.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},I$1={normal:K$1,gfm:_e$1,pedantic:Le$1},M$1={normal:X$1,gfm:N$1,breaks:We$1,pedantic:Ke$1};var Xe$1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ke$1=l=>Xe$1[l];function w$1(l,e){if(e){if(m$1.escapeTest.test(l))return l.replace(m$1.escapeReplace,ke$1)}else if(m$1.escapeTestNoEncode.test(l))return l.replace(m$1.escapeReplaceNoEncode,ke$1);return l}function J$1(l){try{l=encodeURI(l).replace(m$1.percentDecode,"%");}catch{return null}return l}function V$1(l,e){let t=l.replace(m$1.findPipe,(i,s,o)=>{let a=false,u=s;for(;--u>=0&&o[u]==="\\";)a=!a;return a?"|":" |"}),n=t.split(m$1.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(m$1.slashPipe,"|");return n}function z$1(l,e,t){let n=l.length;if(n===0)return "";let r=0;for(;r<n;){let i=l.charAt(n-r-1);if(i===e&&true)r++;else break}return l.slice(0,n-r)}function ge$1(l,e){if(l.indexOf(e[1])===-1)return -1;let t=0;for(let n=0;n<l.length;n++)if(l[n]==="\\")n++;else if(l[n]===e[0])t++;else if(l[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function fe$1(l,e,t,n,r){let i=e.href,s=e.title||null,o=l[1].replace(r.other.outputLinkReplace,"$1");n.state.inLink=true;let a={type:l[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:s,text:o,tokens:n.inlineTokens(o)};return n.state.inLink=false,a}function Je$1(l,e,t){let n=l.match(t.other.indentCodeCompensation);if(n===null)return e;let r=n[1];return e.split(`
42
42
  `).map(i=>{let s=i.match(t.other.beginningSpace);if(s===null)return i;let[o]=s;return o.length>=r.length?i.slice(r.length):i}).join(`
43
43
  `)}var y$1=class y{options;rules;lexer;constructor(e){this.options=e||O$1;}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return {type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return {type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:z$1(n,`
44
44
  `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=Je$1(n,t[3]||"",this.rules);return {type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let r=z$1(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim());}return {type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return {type:"hr",raw:z$1(t[0],`
@@ -64,14 +64,18 @@ ${c}`:c;let f=this.lexer.state.top;if(this.lexer.state.top=true,this.lexer.block
64
64
  `):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let o of r)this.rules.other.tableAlignRight.test(o)?s.align.push("right"):this.rules.other.tableAlignCenter.test(o)?s.align.push("center"):this.rules.other.tableAlignLeft.test(o)?s.align.push("left"):s.align.push(null);for(let o=0;o<n.length;o++)s.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:true,align:s.align[o]});for(let o of i)s.rows.push(V$1(o,s.header.length).map((a,u)=>({text:a,tokens:this.lexer.inline(a),header:false,align:s.align[u]})));return s}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return {type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
65
65
  `?t[1].slice(0,-1):t[1];return {type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return {type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return {type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return !this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=true:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=false),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=true:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=false),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:false,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let s=z$1(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else {let s=ge$1(t[2],"()");if(s===-2)return;if(s>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,a).trim(),t[3]="";}}let r=t[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3]);}else i=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),fe$1(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[r.toLowerCase()];if(!i){let s=n[0].charAt(0);return {type:"text",raw:s,text:s}}return fe$1(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(r[1]||r[2]||"")||!n||this.rules.inline.punctuation.exec(n)){let s=[...r[0]].length-1,o,a,u=s,p=0,c=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+s);(r=c.exec(t))!=null;){if(o=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!o)continue;if(a=[...o].length,r[3]||r[4]){u+=a;continue}else if((r[5]||r[6])&&s%3&&!((s+a)%3)){p+=a;continue}if(u-=a,u>0)continue;a=Math.min(a,a+u+p);let f=[...r[0]][0].length,k=e.slice(0,s+r.index+f+a);if(Math.min(s,a)%2){let g=k.slice(1,-1);return {type:"em",raw:k,text:g,tokens:this.lexer.inlineTokens(g)}}let x=k.slice(2,-2);return {type:"strong",raw:k,text:x,tokens:this.lexer.inlineTokens(x)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return {type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return {type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,r;if(t[2]==="@")n=t[0],r="mailto:"+n;else {let i;do i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(i!==t[0]);n=t[0],t[1]==="www."?r="http://"+t[0]:r=t[0];}return {type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return {type:"text",raw:t[0],text:t[0],escaped:n}}}};var b$1=class l{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||O$1,this.options.tokenizer=this.options.tokenizer||new y$1,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:false,inRawBlock:false,top:true};let t={other:m$1,block:I$1.normal,inline:M$1.normal};this.options.pedantic?(t.block=I$1.pedantic,t.inline=M$1.pedantic):this.options.gfm&&(t.block=I$1.gfm,this.options.breaks?t.inline=M$1.breaks:t.inline=M$1.gfm),this.tokenizer.rules=t;}static get rules(){return {block:I$1,inline:M$1}}static lex(e,t){return new l(t).lex(e)}static lexInline(e,t){return new l(t).inlineTokens(e)}lex(e){e=e.replace(m$1.carriageReturn,`
66
66
  `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens);}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=false){for(this.options.pedantic&&(e=e.replace(m$1.tabCharGlobal," ").replace(m$1.spaceLine,""));e;){let r;if(this.options.extensions?.block?.some(s=>(r=s.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),true):false))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let s=t.at(-1);r.raw.length===1&&s!==void 0?s.raw+=`
67
- `:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let s=t.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=`
68
- `+r.raw,s.text+=`
69
- `+r.text,this.inlineQueue.at(-1).src=s.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let s=t.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=`
70
- `+r.raw,s.text+=`
71
- `+r.raw,this.inlineQueue.at(-1).src=s.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title});continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let s=1/0,o=e.slice(1),a;this.options.extensions.startBlock.forEach(u=>{a=u.call({lexer:this},o),typeof a=="number"&&a>=0&&(s=Math.min(s,a));}),s<1/0&&s>=0&&(i=e.substring(0,s+1));}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let s=t.at(-1);n&&s?.type==="paragraph"?(s.raw+=`
72
- `+r.raw,s.text+=`
73
- `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let s=t.at(-1);s?.type==="text"?(s.raw+=`
74
- `+r.raw,s.text+=`
67
+ `:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let s=t.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(`
68
+ `)?"":`
69
+ `)+r.raw,s.text+=`
70
+ `+r.text,this.inlineQueue.at(-1).src=s.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let s=t.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(`
71
+ `)?"":`
72
+ `)+r.raw,s.text+=`
73
+ `+r.raw,this.inlineQueue.at(-1).src=s.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title});continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let s=1/0,o=e.slice(1),a;this.options.extensions.startBlock.forEach(u=>{a=u.call({lexer:this},o),typeof a=="number"&&a>=0&&(s=Math.min(s,a));}),s<1/0&&s>=0&&(i=e.substring(0,s+1));}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let s=t.at(-1);n&&s?.type==="paragraph"?(s.raw+=(s.raw.endsWith(`
74
+ `)?"":`
75
+ `)+r.raw,s.text+=`
76
+ `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let s=t.at(-1);s?.type==="text"?(s.raw+=(s.raw.endsWith(`
77
+ `)?"":`
78
+ `)+r.raw,s.text+=`
75
79
  `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):t.push(r);continue}if(e){let s="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(s);break}else throw new Error(s)}}return this.state.top=true,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let o=Object.keys(this.tokens.links);if(o.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)o.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=false,s="";for(;e;){i||(s=""),i=false;let o;if(this.options.extensions?.inline?.some(u=>(o=u.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),true):false))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let u=t.at(-1);o.type==="text"&&u?.type==="text"?(u.raw+=o.raw,u.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,s)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let a=e;if(this.options.extensions?.startInline){let u=1/0,p=e.slice(1),c;this.options.extensions.startInline.forEach(f=>{c=f.call({lexer:this},p),typeof c=="number"&&c>=0&&(u=Math.min(u,c));}),u<1/0&&u>=0&&(a=e.substring(0,u+1));}if(o=this.tokenizer.inlineText(a)){e=e.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(s=o.raw.slice(-1)),i=true;let u=t.at(-1);u?.type==="text"?(u.raw+=o.raw,u.text+=o.text):t.push(o);continue}if(e){let u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return t}};var P$1=class P{options;parser;constructor(e){this.options=e||O$1;}space(e){return ""}code({text:e,lang:t,escaped:n}){let r=(t||"").match(m$1.notSpaceStart)?.[0],i=e.replace(m$1.endingNewline,"")+`
76
80
  `;return r?'<pre><code class="language-'+w$1(r)+'">'+(n?i:w$1(i,true))+`</code></pre>
77
81
  `:"<pre><code>"+(n?i:w$1(i,true))+`</code></pre>
@@ -17519,10 +17523,10 @@ function sinkListItem$3(itemType) {
17519
17523
  };
17520
17524
  }
17521
17525
 
17522
- var __defProp$5 = Object.defineProperty;
17526
+ var __defProp$6 = Object.defineProperty;
17523
17527
  var __export$3 = (target, all) => {
17524
17528
  for (var name in all)
17525
- __defProp$5(target, name, { get: all[name], enumerable: true });
17529
+ __defProp$6(target, name, { get: all[name], enumerable: true });
17526
17530
  };
17527
17531
 
17528
17532
  // src/helpers/createChainableState.ts
@@ -24984,10 +24988,10 @@ var Link$1 = Mark$2.create({
24984
24988
  }
24985
24989
  });
24986
24990
 
24987
- var __defProp$4 = Object.defineProperty;
24991
+ var __defProp$5 = Object.defineProperty;
24988
24992
  var __export$2 = (target, all) => {
24989
24993
  for (var name in all)
24990
- __defProp$4(target, name, { get: all[name], enumerable: true });
24994
+ __defProp$5(target, name, { get: all[name], enumerable: true });
24991
24995
  };
24992
24996
  var ListItemName$1 = "listItem";
24993
24997
  var TextStyleName$1 = "textStyle";
@@ -25490,11 +25494,11 @@ var TaskItem$1 = Node3$1.create({
25490
25494
  const checkboxStyler = document.createElement("span");
25491
25495
  const checkbox = document.createElement("input");
25492
25496
  const content = document.createElement("div");
25493
- const updateA11Y = () => {
25497
+ const updateA11Y = (currentNode) => {
25494
25498
  var _a, _b;
25495
- checkbox.ariaLabel = ((_b = (_a = this.options.a11y) == null ? void 0 : _a.checkboxLabel) == null ? void 0 : _b.call(_a, node, checkbox.checked)) || `Task item checkbox for ${node.textContent || "empty task item"}`;
25499
+ checkbox.ariaLabel = ((_b = (_a = this.options.a11y) == null ? void 0 : _a.checkboxLabel) == null ? void 0 : _b.call(_a, currentNode, checkbox.checked)) || `Task item checkbox for ${currentNode.textContent || "empty task item"}`;
25496
25500
  };
25497
- updateA11Y();
25501
+ updateA11Y(node);
25498
25502
  checkboxWrapper.contentEditable = "false";
25499
25503
  checkbox.type = "checkbox";
25500
25504
  checkbox.addEventListener("mousedown", (event) => event.preventDefault());
@@ -25543,7 +25547,7 @@ var TaskItem$1 = Node3$1.create({
25543
25547
  }
25544
25548
  listItem.dataset.checked = updatedNode.attrs.checked;
25545
25549
  checkbox.checked = updatedNode.attrs.checked;
25546
- updateA11Y();
25550
+ updateA11Y(updatedNode);
25547
25551
  return true;
25548
25552
  }
25549
25553
  };
@@ -29783,7 +29787,7 @@ Extension$1.create({
29783
29787
  const ButtonLikeLink$1 = Node3$1.create({
29784
29788
  name: "buttonLikeLink",
29785
29789
  group: "block",
29786
- content: "inline*",
29790
+ content: "paragraph+",
29787
29791
  defining: true,
29788
29792
  addAttributes() {
29789
29793
  return {
@@ -29794,14 +29798,14 @@ const ButtonLikeLink$1 = Node3$1.create({
29794
29798
  parseHTML() {
29795
29799
  return [
29796
29800
  {
29797
- tag: 'div[data-bgc-style="button"]:has(> a[href] > span)',
29801
+ tag: 'div[data-bgc-style="button"]:has(> a[href] > div)',
29798
29802
  getAttrs: (node) => {
29799
29803
  return {
29800
29804
  href: node.querySelector("a")?.getAttribute("href")
29801
29805
  };
29802
29806
  },
29803
29807
  contentElement(node) {
29804
- return node.querySelector("span") ?? node;
29808
+ return node.querySelector("a[href] > div") ?? node;
29805
29809
  }
29806
29810
  }
29807
29811
  ];
@@ -29815,7 +29819,7 @@ const ButtonLikeLink$1 = Node3$1.create({
29815
29819
  {
29816
29820
  href: HTMLAttributes.href
29817
29821
  },
29818
- ["span", {}, 0]
29822
+ ["div", {}, 0]
29819
29823
  ]
29820
29824
  ];
29821
29825
  },
@@ -29837,7 +29841,7 @@ const ButtonLikeLink$1 = Node3$1.create({
29837
29841
  if (hasLinkElement) {
29838
29842
  return false;
29839
29843
  }
29840
- return chain().toggleNode(this.name, "paragraph", attributes).run();
29844
+ return chain().toggleWrap(this.name, attributes).run();
29841
29845
  }
29842
29846
  };
29843
29847
  }
@@ -30148,97 +30152,145 @@ const BgeWysiwygEditorKit$1 = Extension$1.create({
30148
30152
  }
30149
30153
  });
30150
30154
 
30151
- var __defProp$3 = Object.defineProperty;
30152
- var __typeError$1 = (msg) => {
30155
+ function createElement$1(options, global = window) {
30156
+ const document = global.document;
30157
+ const wrapperElement = document.createElement(options.tag ?? "div");
30158
+ if (options.attributes) {
30159
+ for (const [key, value] of Object.entries(options.attributes)) {
30160
+ wrapperElement.setAttribute(key, value);
30161
+ }
30162
+ }
30163
+ if (options.className) {
30164
+ wrapperElement.className = options.className;
30165
+ }
30166
+ return wrapperElement;
30167
+ }
30168
+
30169
+ var __defProp$1$1 = Object.defineProperty;
30170
+ var __typeError$1$1 = (msg) => {
30153
30171
  throw TypeError(msg);
30154
30172
  };
30155
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
30156
- var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "" , value);
30157
- var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
30158
- var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
30159
- var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
30160
- var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
30161
- var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
30162
- var _editor$1, _editorRoot$1, _style$1, _textarea$1, _textareaDescriptor$1, _tiptapStyle$1, _BgeWysiwygEditorElement_instances$1, setToTextarea_fn$1;
30163
- const _BgeWysiwygEditorElement$1 = class _BgeWysiwygEditorElement extends HTMLElement {
30173
+ var __defNormalProp$1$1 = (obj, key, value) => key in obj ? __defProp$1$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
30174
+ var __publicField$1$1 = (obj, key, value) => __defNormalProp$1$1(obj, typeof key !== "symbol" ? key + "" : key, value);
30175
+ var __accessCheck$1$1 = (obj, member, msg) => member.has(obj) || __typeError$1$1("Cannot " + msg);
30176
+ var __privateGet$1$1 = (obj, member, getter) => (__accessCheck$1$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
30177
+ var __privateAdd$1$1 = (obj, member, value) => member.has(obj) ? __typeError$1$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
30178
+ var __privateSet$1$1 = (obj, member, value, setter) => (__accessCheck$1$1(obj, member, "write to private field"), member.set(obj, value), value);
30179
+ var __privateMethod$1 = (obj, member, method) => (__accessCheck$1$1(obj, member, "access private method"), method);
30180
+ var _editor$1, _editorRoot$1, _previewStyle$1, _textarea$1, _textareaDescriptor$1, _BgeWysiwygElement_instances$1, setToTextarea_fn$1, transaction_fn$1;
30181
+ const _BgeWysiwygElement$1 = class _BgeWysiwygElement extends HTMLElement {
30164
30182
  constructor() {
30165
30183
  super();
30166
- __privateAdd$1(this, _BgeWysiwygEditorElement_instances$1);
30167
- __privateAdd$1(this, _editor$1);
30168
- __privateAdd$1(this, _editorRoot$1);
30169
- __privateAdd$1(this, _style$1);
30170
- __privateAdd$1(this, _textarea$1);
30171
- __privateAdd$1(this, _textareaDescriptor$1);
30172
- __privateAdd$1(this, _tiptapStyle$1);
30173
- const initialValue = this.innerHTML.trim();
30184
+ __privateAdd$1$1(this, _BgeWysiwygElement_instances$1);
30185
+ __privateAdd$1$1(this, _editor$1, null);
30186
+ __privateAdd$1$1(this, _editorRoot$1, null);
30187
+ __privateAdd$1$1(this, _previewStyle$1, null);
30188
+ __privateAdd$1$1(this, _textarea$1, null);
30189
+ __privateAdd$1$1(this, _textareaDescriptor$1, null);
30174
30190
  this.attachShadow({ mode: "open" });
30175
- const label = this.getAttribute("label") ?? "\u5185\u5BB9";
30176
- const commands = (
30177
- // Get commands from attribute
30178
- this.getAttribute("commands")?.split(",").map((command) => command.trim().toLowerCase()) ?? // Default commands
30179
- [
30180
- "bold",
30181
- "italic",
30182
- "underline",
30183
- "strikethrough",
30184
- "link",
30185
- "button-like-link",
30186
- "blockquote",
30187
- "bullet-list",
30188
- "ordered-list",
30189
- "note",
30190
- "h3",
30191
- "h4",
30192
- "h5",
30193
- "h6",
30194
- "flex-box"
30195
- ]
30191
+ if (!this.shadowRoot) {
30192
+ throw new Error("Not supported shadow DOM");
30193
+ }
30194
+ }
30195
+ get value() {
30196
+ return __privateGet$1$1(this, _textarea$1)?.value ?? "";
30197
+ }
30198
+ set value(value) {
30199
+ if (!__privateGet$1$1(this, _textarea$1)) {
30200
+ throw new ReferenceError("<bge-wysiwyg> is not connected");
30201
+ }
30202
+ __privateGet$1$1(this, _textarea$1).value = value;
30203
+ }
30204
+ get editor() {
30205
+ if (!__privateGet$1$1(this, _editor$1)) {
30206
+ throw new ReferenceError("<bge-wysiwyg> is not connected");
30207
+ }
30208
+ return __privateGet$1$1(this, _editor$1);
30209
+ }
30210
+ set mode(mode) {
30211
+ if (!__privateGet$1$1(this, _editor$1) || !__privateGet$1$1(this, _textarea$1)) {
30212
+ return;
30213
+ }
30214
+ this.shadowRoot.querySelector(`[data-bge-mode]`)?.setAttribute(
30215
+ "data-bge-mode",
30216
+ mode
30196
30217
  );
30197
- this.shadowRoot.innerHTML = `
30198
- <fieldset>
30199
- <legend>${label}</legend>
30200
- <div data-bge-toolbar>
30201
- <div data-bge-toolbar-group>
30202
- ${commands.includes("bold") ? `<button type="button" data-bge-toolbar-button="bold">${IconBold$1}</button>` : ""}
30203
- ${commands.includes("italic") ? `<button type="button" data-bge-toolbar-button="italic">${IconItalic$1}</button>` : ""}
30204
- ${commands.includes("strikethrough") ? `<button type="button" data-bge-toolbar-button="strikethrough">${IconStrikethrough$1}</button>` : ""}
30205
- ${commands.includes("underline") ? `<button type="button" data-bge-toolbar-button="underline">${IconUnderline$1}</button>` : ""}
30206
- ${commands.includes("code") ? `<button type="button" data-bge-toolbar-button="code">${IconCode$1}</button>` : ""}
30207
- ${commands.includes("link") ? `<button type="button" data-bge-toolbar-button="link">${IconLink$1}</button>` : ""}
30208
- ${commands.includes("button-like-link") ? `<button type="button" data-bge-toolbar-button="button-like-link">${IconCloud$1}</button>` : ""}
30209
- ${commands.includes("blockquote") ? `<button type="button" data-bge-toolbar-button="blockquote">${IconBlockquote$1}</button>` : ""}
30210
- ${commands.includes("bullet-list") ? `<button type="button" data-bge-toolbar-button="bullet-list">${IconBulletList$1}</button>` : ""}
30211
- ${commands.includes("ordered-list") ? `<button type="button" data-bge-toolbar-button="ordered-list">${IconOrderedList$1}</button>` : ""}
30212
- ${commands.includes("note") ? `<button type="button" data-bge-toolbar-button="note">${IconNotes$1}</button>` : ""}
30213
- ${commands.includes("h1") ? `<button type="button" data-bge-toolbar-button="h1">${IconH1$1}</button>` : ""}
30214
- ${commands.includes("h2") ? `<button type="button" data-bge-toolbar-button="h2">${IconH2$1}</button>` : ""}
30215
- ${commands.includes("h3") ? `<button type="button" data-bge-toolbar-button="h3">${IconH3$1}</button>` : ""}
30216
- ${commands.includes("h4") ? `<button type="button" data-bge-toolbar-button="h4">${IconH4$1}</button>` : ""}
30217
- ${commands.includes("h5") ? `<button type="button" data-bge-toolbar-button="h5">${IconH5$1}</button>` : ""}
30218
- ${commands.includes("h6") ? `<button type="button" data-bge-toolbar-button="h6">${IconH6$1}</button>` : ""}
30219
- ${commands.includes("flex-box") ? `<button type="button" data-bge-toolbar-button="flex-box"><span data-bge-rotate>${IconAlignBoxCenterStretch$1}</span></button>` : ""}
30220
- </div>
30221
- <div data-bge-toolbar-group>
30222
- <button type="button" data-bge-toolbar-button="html-mode">HTML Mode</button>
30223
- </div>
30224
- </div>
30225
- <div data-bge-mode="wysiwyg">
30226
- <div data-bge-preview><div data-bge-editor-root></div></div>
30227
- <textarea aria-label="${label} HTML"></textarea>
30228
- </div>
30229
- </fieldset>
30218
+ if (mode === "wysiwyg") {
30219
+ __privateGet$1$1(this, _editor$1).commands.setContent(__privateGet$1$1(this, _textarea$1).value);
30220
+ }
30221
+ }
30222
+ connectedCallback() {
30223
+ if (!this.shadowRoot) {
30224
+ throw new Error("Not supported shadow DOM");
30225
+ }
30226
+ const initialValue = this.innerHTML.trim();
30227
+ const label = this.getAttribute("label") ?? "\u5185\u5BB9";
30228
+ const itemName = this.getAttribute("item-name");
30229
+ this.shadowRoot.innerHTML = `<div data-bge-mode="wysiwyg"><iframe></iframe><textarea aria-label="${label} HTML"></textarea></div>`;
30230
+ const preview = this.shadowRoot.querySelector("iframe");
30231
+ if (!preview || !preview.contentWindow || !preview.contentDocument) {
30232
+ throw new Error("Not supported iframe in shadow DOM");
30233
+ }
30234
+ __privateSet$1$1(this, _editorRoot$1, preview.contentDocument.createElement("div"));
30235
+ preview.contentDocument.body.append(__privateGet$1$1(this, _editorRoot$1));
30236
+ __privateSet$1$1(this, _previewStyle$1, preview.contentDocument.createElement("style"));
30237
+ preview.contentDocument.head.append(__privateGet$1$1(this, _previewStyle$1));
30238
+ const textarea = this.shadowRoot.querySelector("textarea");
30239
+ const controlUIStyle = document.createElement("style");
30240
+ this.shadowRoot.append(controlUIStyle);
30241
+ controlUIStyle.textContent = `
30242
+ :host {
30243
+ display: block;
30244
+ }
30245
+
30246
+ textarea,
30247
+ iframe {
30248
+ block-size: 50svh;
30249
+ inline-size: 100%;
30250
+ resize: vertical;
30251
+ overflow-y: auto;
30252
+ background: var(--bge-lightest-color);
30253
+ border: 1px solid var(--bge-border-color);
30254
+ border-radius: var(--border-radius);
30255
+ }
30256
+
30257
+ iframe[data-focus-within="true"],
30258
+ textarea:focus-visible {
30259
+ --bge-border-color: var(--bge-ui-primary-color);
30260
+ --bge-outline-color: var(--bge-ui-primary-color);
30261
+ outline: var(--bge-focus-outline-width) solid var(--bge-outline-color);
30262
+ }
30263
+
30264
+ textarea {
30265
+ font-family: var(--bge-font-family-monospace);
30266
+ }
30267
+
30268
+ [data-bge-mode="wysiwyg"] textarea {
30269
+ display: none;
30270
+ }
30271
+
30272
+ [data-bge-mode="html"] iframe {
30273
+ display: none;
30274
+ }
30230
30275
  `;
30231
- __privateSet$1(this, _style$1, document.createElement("style"));
30232
- this.shadowRoot.append(__privateGet$1(this, _style$1));
30233
- __privateSet$1(this, _editorRoot$1, this.shadowRoot.querySelector("[data-bge-editor-root]"));
30234
- __privateGet$1(this, _editorRoot$1).dataset.bgi = this.getAttribute("item-name") ?? "";
30235
- __privateSet$1(this, _textarea$1, this.shadowRoot.querySelector("textarea"));
30236
- const buttons = this.shadowRoot.querySelectorAll(
30237
- "[data-bge-toolbar-button]"
30238
- );
30239
- for (const button of buttons) {
30240
- button.addEventListener("click", () => bindToggle$1(button, editor));
30276
+ preview.contentDocument.body.addEventListener("focusin", () => {
30277
+ preview.dataset.focusWithin = "true";
30278
+ });
30279
+ preview.contentDocument.body.addEventListener("focusout", () => {
30280
+ delete preview.dataset.focusWithin;
30281
+ });
30282
+ if (_BgeWysiwygElement.wrapperElement) {
30283
+ const wrapperElement = createElement$1(
30284
+ _BgeWysiwygElement.wrapperElement,
30285
+ preview.contentWindow
30286
+ );
30287
+ __privateGet$1$1(this, _editorRoot$1).after(wrapperElement);
30288
+ wrapperElement.append(__privateGet$1$1(this, _editorRoot$1));
30241
30289
  }
30290
+ if (!textarea) {
30291
+ throw new Error("Not supported textarea in shadow DOM");
30292
+ }
30293
+ __privateSet$1$1(this, _textarea$1, textarea);
30242
30294
  const extensions = [
30243
30295
  index_default$1.configure({
30244
30296
  link: {
@@ -30250,112 +30302,64 @@ const _BgeWysiwygEditorElement$1 = class _BgeWysiwygEditorElement extends HTMLEl
30250
30302
  }),
30251
30303
  BgeWysiwygEditorKit$1
30252
30304
  ];
30253
- if (_BgeWysiwygEditorElement.extension) {
30254
- extensions.push(_BgeWysiwygEditorElement.extension);
30305
+ if (_BgeWysiwygElement.extensions) {
30306
+ extensions.push(..._BgeWysiwygElement.extensions);
30255
30307
  }
30256
- const editor = new Editor$1({
30257
- element: __privateGet$1(this, _editorRoot$1),
30308
+ __privateSet$1$1(this, _editor$1, new Editor$1({
30309
+ element: __privateGet$1$1(this, _editorRoot$1),
30258
30310
  extensions,
30259
30311
  autofocus: this.hasAttribute("autofocus"),
30260
- onTransaction: ({ editor: editor2 }) => {
30261
- for (const button of buttons) {
30262
- bindPressed$1(button, editor2);
30263
- }
30312
+ onTransaction: ({ editor }) => {
30313
+ const data = __privateMethod$1(this, _BgeWysiwygElement_instances$1, transaction_fn$1).call(this, editor);
30314
+ this.dispatchEvent(
30315
+ new CustomEvent("transaction", {
30316
+ detail: data,
30317
+ bubbles: true,
30318
+ composed: true
30319
+ })
30320
+ );
30264
30321
  },
30265
30322
  onUpdate: () => {
30266
30323
  this.syncWysiwygToTextarea();
30267
30324
  }
30268
- });
30269
- const htmlModeButton = this.shadowRoot.querySelector(
30270
- '[data-bge-toolbar-button="html-mode"]'
30271
- );
30272
- htmlModeButton.addEventListener("click", () => {
30273
- htmlModeButton.ariaPressed = htmlModeButton.ariaPressed === "true" ? "false" : "true";
30274
- const mode = htmlModeButton.ariaPressed === "true" ? "html" : "wysiwyg";
30275
- this.shadowRoot.querySelector(`[data-bge-mode]`)?.setAttribute(
30276
- "data-bge-mode",
30277
- mode
30278
- );
30279
- if (mode === "wysiwyg") {
30280
- __privateGet$1(this, _editor$1).commands.setContent(__privateGet$1(this, _textarea$1).value);
30281
- }
30282
- });
30283
- __privateSet$1(this, _editor$1, editor);
30284
- const contentEditable = this.shadowRoot.querySelector("[contenteditable]");
30285
- contentEditable.ariaLabel = `${label} WYSIWYG`;
30286
- __privateSet$1(this, _tiptapStyle$1, document.querySelector("style[data-tiptap-style]")?.textContent ?? "");
30287
- const textareaDescriptor = Object.getOwnPropertyDescriptor(
30325
+ }));
30326
+ if (itemName) {
30327
+ __privateGet$1$1(this, _editorRoot$1).dataset.bgi = itemName;
30328
+ }
30329
+ __privateSet$1$1(this, _textareaDescriptor$1, Object.getOwnPropertyDescriptor(
30288
30330
  HTMLTextAreaElement.prototype,
30289
30331
  "value"
30290
- );
30291
- if (!textareaDescriptor) {
30292
- throw new Error("textarea.value is not defined");
30293
- }
30294
- __privateSet$1(this, _textareaDescriptor$1, textareaDescriptor);
30295
- Object.defineProperty(__privateGet$1(this, _textarea$1), "value", {
30332
+ ));
30333
+ Object.defineProperty(__privateGet$1$1(this, _textarea$1), "value", {
30296
30334
  get: () => {
30297
- return __privateGet$1(this, _textareaDescriptor$1)?.get?.call(__privateGet$1(this, _textarea$1)) ?? "";
30335
+ return __privateGet$1$1(this, _textareaDescriptor$1)?.get?.call(__privateGet$1$1(this, _textarea$1)) ?? "";
30298
30336
  },
30299
- set: (val) => {
30300
- __privateGet$1(this, _editor$1).commands.setContent(val);
30301
- __privateMethod$1(this, _BgeWysiwygEditorElement_instances$1, setToTextarea_fn$1).call(this, val);
30337
+ set: (value) => {
30338
+ __privateGet$1$1(this, _editor$1)?.commands.setContent(value);
30302
30339
  }
30303
30340
  });
30304
30341
  if (initialValue) {
30305
- __privateGet$1(this, _textarea$1).value = initialValue;
30342
+ __privateGet$1$1(this, _textarea$1).value = initialValue;
30306
30343
  }
30307
30344
  }
30308
- get editor() {
30309
- return __privateGet$1(this, _editor$1);
30310
- }
30311
- get name() {
30312
- return this.getAttribute("name") ?? "";
30313
- }
30314
- get value() {
30315
- return __privateGet$1(this, _textarea$1).value;
30345
+ isActive(name) {
30346
+ return this.editor.isActive(name) ?? false;
30316
30347
  }
30317
30348
  setStyle(css) {
30318
- __privateGet$1(this, _style$1).textContent = `
30319
- :host {
30320
- display: block;
30321
- inline-size: 100%;
30322
- }
30323
-
30324
- :where(fieldset) {
30325
- padding: 1em;
30326
- border: 1px solid var(--bge-border-color);
30327
- border-radius: var(--border-radius);
30328
- }
30329
-
30330
- ${__privateGet$1(this, _tiptapStyle$1)}
30331
-
30332
- @scope ([data-bge-preview]) {
30333
- ${css}
30334
-
30335
- a:any-link {
30336
- pointer-events: none !important;
30337
- }
30338
- }
30339
-
30340
- textarea,
30341
- [data-bge-preview] {
30342
- block-size: 50svh;
30343
- inline-size: 100%;
30344
- resize: vertical;
30345
- overflow-y: auto;
30346
- background: var(--bge-lightest-color);
30347
- border: 1px solid var(--bge-border-color);
30348
- border-radius: var(--border-radius);
30349
- }
30349
+ if (!__privateGet$1$1(this, _previewStyle$1)) {
30350
+ throw new ReferenceError("<bge-wysiwyg> is not connected");
30351
+ }
30352
+ __privateGet$1$1(this, _previewStyle$1).textContent = `
30353
+ :where(html, body) {
30354
+ margin: 0;
30355
+ padding: 0;
30350
30356
 
30351
- [data-bge-preview] {
30352
- &:focus-within {
30353
- --bge-border-color: var(--bge-ui-primary-color);
30354
- --bge-outline-color: var(--bge-ui-primary-color);
30355
- outline: var(--bge-focus-outline-width) solid var(--bge-outline-color);
30357
+ :where(&, *) {
30358
+ box-sizing: border-box;
30356
30359
  }
30357
30360
  }
30358
30361
 
30362
+ iframe,
30359
30363
  [contenteditable] {
30360
30364
  padding: 1rem;
30361
30365
  block-size: 100%;
@@ -30366,136 +30370,332 @@ const _BgeWysiwygEditorElement$1 = class _BgeWysiwygEditorElement extends HTMLEl
30366
30370
  outline: none;
30367
30371
  }
30368
30372
 
30369
- textarea {
30370
- font-family: var(--bge-font-family-monospace);
30371
- }
30372
-
30373
- [data-bge-mode="wysiwyg"] textarea {
30374
- display: none;
30375
- }
30373
+ ${css}
30376
30374
 
30377
- [data-bge-mode="html"] [data-bge-preview] {
30378
- display: none;
30375
+ a:any-link {
30376
+ pointer-events: none !important;
30379
30377
  }
30380
-
30381
- [data-bge-label] {
30382
- margin-block-end: 0.5em;
30383
- }
30384
-
30385
- [data-bge-toolbar] {
30386
- display: flex;
30387
- flex-wrap: wrap;
30388
- gap: 0.25em;
30389
- align-items: center;
30390
- justify-content: space-between;
30391
- margin-block-end: 0.5em;
30392
- }
30393
-
30394
- [data-bge-toolbar-group] {
30395
- display: flex;
30396
- flex-wrap: wrap;
30397
- gap: 0.25em;
30398
- align-items: center;
30399
- }
30400
-
30401
- [data-bge-toolbar-button] {
30402
- --size: 1lh;
30403
- --stroke-width: 1.5;
30404
- --padding: 0.25em;
30405
- font-size: inherit;
30406
- border: none;
30407
- background: none;
30408
- cursor: pointer;
30409
- padding: 0.25em;
30410
- background: var(--bge-lightest-color);
30411
- border: 1px solid var(--bge-border-color);
30412
- border-radius: var(--border-radius);
30413
-
30414
- &:hover,
30415
- &:focus-visible {
30416
- --bge-border-color: var(--bge-ui-primary-color);
30417
- --bge-outline-color: var(--bge-ui-primary-color);
30418
- outline: var(--bge-focus-outline-width) solid var(--bge-outline-color);
30419
- }
30420
-
30421
- &:disabled {
30422
- color: inherit;
30423
- outline: none;
30424
- cursor: not-allowed;
30425
- opacity: 0.3;
30426
- }
30427
-
30428
- &[aria-pressed='true'] {
30429
- --stroke-width: 2;
30430
- color: #fff;
30431
- background-color: var(--bge-ui-primary-color);
30432
-
30433
- &:focus-visible {
30434
- box-shadow: 0 0 0 2px #fff inset;
30435
- }
30436
- }
30437
-
30438
- &:not(:has(svg)) {
30439
- padding-inline: calc(var(--padding) * 3);
30440
- }
30441
-
30442
- svg {
30443
- inline-size: var(--size);
30444
- block-size: var(--size);
30445
- stroke-width: var(--stroke-width);
30446
- stroke: currentcolor;
30447
- }
30448
-
30449
- [data-bge-rotate] {
30450
- rotate: -90deg;
30451
- display: block;
30452
- }
30453
- }`;
30378
+ `;
30454
30379
  }
30455
30380
  syncWysiwygToTextarea() {
30456
- let html = __privateGet$1(this, _editor$1).getHTML();
30381
+ let html = this.editor.getHTML();
30457
30382
  html = html.replaceAll("<p></p>", "");
30458
- __privateMethod$1(this, _BgeWysiwygEditorElement_instances$1, setToTextarea_fn$1).call(this, html);
30383
+ __privateMethod$1(this, _BgeWysiwygElement_instances$1, setToTextarea_fn$1).call(this, html);
30384
+ }
30385
+ toggleBlockquote() {
30386
+ this.editor.chain().focus().toggleBlockquote().run();
30387
+ }
30388
+ toggleBold() {
30389
+ this.editor.chain().focus().toggleBold().run();
30390
+ }
30391
+ toggleBulletList() {
30392
+ this.editor.chain().focus().toggleBulletList().run();
30393
+ }
30394
+ toggleButtonLikeLink(options) {
30395
+ this.editor.chain().focus().toggleButtonLikeLink(options).run();
30396
+ }
30397
+ toggleCode() {
30398
+ this.editor.chain().focus().toggleCode().run();
30399
+ }
30400
+ toggleFlexBox() {
30401
+ this.editor.chain().focus().toggleFlexBox().run();
30402
+ }
30403
+ toggleHeading(level) {
30404
+ this.editor.chain().focus().toggleHeading({ level }).run();
30405
+ }
30406
+ toggleItalic() {
30407
+ this.editor.chain().focus().toggleItalic().run();
30408
+ }
30409
+ toggleLink(options) {
30410
+ this.editor.chain().focus().toggleLink(options).run();
30411
+ }
30412
+ toggleNote() {
30413
+ this.editor.chain().focus().toggleNote().run();
30414
+ }
30415
+ toggleOrderedList() {
30416
+ this.editor.chain().focus().toggleOrderedList().run();
30417
+ }
30418
+ toggleStrike() {
30419
+ this.editor.chain().focus().toggleStrike().run();
30420
+ }
30421
+ toggleUnderline() {
30422
+ this.editor.chain().focus().toggleUnderline().run();
30459
30423
  }
30460
30424
  };
30461
30425
  _editor$1 = new WeakMap();
30462
30426
  _editorRoot$1 = new WeakMap();
30463
- _style$1 = new WeakMap();
30427
+ _previewStyle$1 = new WeakMap();
30464
30428
  _textarea$1 = new WeakMap();
30465
30429
  _textareaDescriptor$1 = new WeakMap();
30466
- _tiptapStyle$1 = new WeakMap();
30467
- _BgeWysiwygEditorElement_instances$1 = new WeakSet();
30430
+ _BgeWysiwygElement_instances$1 = new WeakSet();
30468
30431
  setToTextarea_fn$1 = function(html) {
30469
- __privateGet$1(this, _textareaDescriptor$1)?.set?.call(__privateGet$1(this, _textarea$1), html);
30432
+ if (!__privateGet$1$1(this, _textarea$1) || !__privateGet$1$1(this, _textareaDescriptor$1)) {
30433
+ throw new ReferenceError("<bge-wysiwyg> is not connected");
30434
+ }
30435
+ __privateGet$1$1(this, _textareaDescriptor$1).set?.call(__privateGet$1$1(this, _textarea$1), html);
30436
+ };
30437
+ transaction_fn$1 = function(editor) {
30438
+ const data = {
30439
+ state: {
30440
+ bold: {
30441
+ disabled: !editor.can().chain().focus().toggleBold().run(),
30442
+ active: editor.isActive("bold")
30443
+ },
30444
+ italic: {
30445
+ disabled: !editor.can().chain().focus().toggleItalic().run(),
30446
+ active: editor.isActive("italic")
30447
+ },
30448
+ underline: {
30449
+ disabled: !editor.can().chain().focus().toggleUnderline().run(),
30450
+ active: editor.isActive("underline")
30451
+ },
30452
+ strike: {
30453
+ disabled: !editor.can().chain().focus().toggleStrike().run(),
30454
+ active: editor.isActive("strike")
30455
+ },
30456
+ code: {
30457
+ disabled: !editor.can().chain().focus().toggleCode().run(),
30458
+ active: editor.isActive("code")
30459
+ },
30460
+ link: {
30461
+ disabled: !editor.can().chain().focus().toggleLink().run(),
30462
+ active: editor.isActive("link")
30463
+ },
30464
+ buttonLikeLink: {
30465
+ disabled: !editor.can().chain().focus().toggleButtonLikeLink().run(),
30466
+ active: editor.isActive("buttonLikeLink")
30467
+ },
30468
+ blockquote: {
30469
+ disabled: !editor.can().chain().focus().toggleBlockquote().run(),
30470
+ active: editor.isActive("blockquote")
30471
+ },
30472
+ bulletList: {
30473
+ disabled: !editor.can().chain().focus().toggleBulletList().run(),
30474
+ active: editor.isActive("bulletList")
30475
+ },
30476
+ orderedList: {
30477
+ disabled: !editor.can().chain().focus().toggleOrderedList().run(),
30478
+ active: editor.isActive("orderedList")
30479
+ },
30480
+ note: {
30481
+ disabled: !editor.can().chain().focus().toggleNote().run(),
30482
+ active: editor.isActive("note")
30483
+ },
30484
+ h1: {
30485
+ disabled: !editor.can().chain().focus().toggleHeading({ level: 1 }).run(),
30486
+ active: editor.isActive("heading", { level: 1 })
30487
+ },
30488
+ h2: {
30489
+ disabled: !editor.can().chain().focus().toggleHeading({ level: 2 }).run(),
30490
+ active: editor.isActive("heading", { level: 2 })
30491
+ },
30492
+ h3: {
30493
+ disabled: !editor.can().chain().focus().toggleHeading({ level: 3 }).run(),
30494
+ active: editor.isActive("heading", { level: 3 })
30495
+ },
30496
+ h4: {
30497
+ disabled: !editor.can().chain().focus().toggleHeading({ level: 4 }).run(),
30498
+ active: editor.isActive("heading", { level: 4 })
30499
+ },
30500
+ h5: {
30501
+ disabled: !editor.can().chain().focus().toggleHeading({ level: 5 }).run(),
30502
+ active: editor.isActive("heading", { level: 5 })
30503
+ },
30504
+ h6: {
30505
+ disabled: !editor.can().chain().focus().toggleHeading({ level: 6 }).run(),
30506
+ active: editor.isActive("heading", { level: 6 })
30507
+ },
30508
+ flexBox: {
30509
+ disabled: !editor.can().chain().focus().toggleFlexBox().run(),
30510
+ active: editor.isActive("flexBox")
30511
+ }
30512
+ }
30513
+ };
30514
+ return data;
30515
+ };
30516
+ __publicField$1$1(_BgeWysiwygElement$1, "extensions", null);
30517
+ __publicField$1$1(_BgeWysiwygElement$1, "wrapperElement", null);
30518
+
30519
+ var __defProp$4 = Object.defineProperty;
30520
+ var __typeError$2 = (msg) => {
30521
+ throw TypeError(msg);
30522
+ };
30523
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
30524
+ var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
30525
+ var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg);
30526
+ var __privateGet$2 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
30527
+ var __privateAdd$2 = (obj, member, value) => member.has(obj) ? __typeError$2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
30528
+ var __privateSet$2 = (obj, member, value, setter) => (__accessCheck$2(obj, member, "write to private field"), member.set(obj, value), value);
30529
+ var _wysiwygElement$1;
30530
+ const _BgeWysiwygEditorElement$1 = class _BgeWysiwygEditorElement extends HTMLElement {
30531
+ constructor() {
30532
+ super();
30533
+ __privateAdd$2(this, _wysiwygElement$1, null);
30534
+ const initialValue = this.innerHTML.trim();
30535
+ const label = this.getAttribute("label") ?? "\u5185\u5BB9";
30536
+ const itemName = this.getAttribute("item-name");
30537
+ const commands = (
30538
+ // Get commands from attribute
30539
+ this.getAttribute("commands")?.split(",").map((command) => command.trim().toLowerCase()) ?? // Default commands
30540
+ _BgeWysiwygEditorElement.defaultCommands
30541
+ );
30542
+ this.innerHTML = `
30543
+ <fieldset>
30544
+ <legend>${label}</legend>
30545
+ <div data-bge-toolbar>
30546
+ <div data-bge-toolbar-group>
30547
+ ${commands.includes("bold") ? `<button type="button" data-bge-toolbar-button="bold">${IconBold$1}</button>` : ""}
30548
+ ${commands.includes("italic") ? `<button type="button" data-bge-toolbar-button="italic">${IconItalic$1}</button>` : ""}
30549
+ ${commands.includes("strikethrough") ? `<button type="button" data-bge-toolbar-button="strikethrough">${IconStrikethrough$1}</button>` : ""}
30550
+ ${commands.includes("underline") ? `<button type="button" data-bge-toolbar-button="underline">${IconUnderline$1}</button>` : ""}
30551
+ ${commands.includes("code") ? `<button type="button" data-bge-toolbar-button="code">${IconCode$1}</button>` : ""}
30552
+ ${commands.includes("link") ? `<button type="button" data-bge-toolbar-button="link">${IconLink$1}</button>` : ""}
30553
+ ${commands.includes("button-like-link") ? `<button type="button" data-bge-toolbar-button="button-like-link">${IconCloud$1}</button>` : ""}
30554
+ ${commands.includes("blockquote") ? `<button type="button" data-bge-toolbar-button="blockquote">${IconBlockquote$1}</button>` : ""}
30555
+ ${commands.includes("bullet-list") ? `<button type="button" data-bge-toolbar-button="bullet-list">${IconBulletList$1}</button>` : ""}
30556
+ ${commands.includes("ordered-list") ? `<button type="button" data-bge-toolbar-button="ordered-list">${IconOrderedList$1}</button>` : ""}
30557
+ ${commands.includes("note") ? `<button type="button" data-bge-toolbar-button="note">${IconNotes$1}</button>` : ""}
30558
+ ${commands.includes("h1") ? `<button type="button" data-bge-toolbar-button="h1">${IconH1$1}</button>` : ""}
30559
+ ${commands.includes("h2") ? `<button type="button" data-bge-toolbar-button="h2">${IconH2$1}</button>` : ""}
30560
+ ${commands.includes("h3") ? `<button type="button" data-bge-toolbar-button="h3">${IconH3$1}</button>` : ""}
30561
+ ${commands.includes("h4") ? `<button type="button" data-bge-toolbar-button="h4">${IconH4$1}</button>` : ""}
30562
+ ${commands.includes("h5") ? `<button type="button" data-bge-toolbar-button="h5">${IconH5$1}</button>` : ""}
30563
+ ${commands.includes("h6") ? `<button type="button" data-bge-toolbar-button="h6">${IconH6$1}</button>` : ""}
30564
+ ${commands.includes("flex-box") ? `<button type="button" data-bge-toolbar-button="flex-box"><span data-bge-rotate>${IconAlignBoxCenterStretch$1}</span></button>` : ""}
30565
+ </div>
30566
+ <div data-bge-toolbar-group>
30567
+ <button type="button" data-bge-toolbar-button="html-mode">HTML Mode</button>
30568
+ </div>
30569
+ </div>
30570
+ <bge-wysiwyg ${itemName ? `item-name="${itemName}"` : ""}>
30571
+ ${initialValue}
30572
+ </bge-wysiwyg>
30573
+ </fieldset>
30574
+ `;
30575
+ const innerHTMLDescriptor = Object.getOwnPropertyDescriptor(
30576
+ Element.prototype,
30577
+ "innerHTML"
30578
+ );
30579
+ Object.defineProperty(this, "innerHTML", {
30580
+ configurable: true,
30581
+ enumerable: true,
30582
+ get() {
30583
+ return innerHTMLDescriptor.get.call(this);
30584
+ },
30585
+ set: (value) => {
30586
+ if (!__privateGet$2(this, _wysiwygElement$1)) {
30587
+ throw new ReferenceError("<bge-wysiwyg-editor> is not connected");
30588
+ }
30589
+ __privateGet$2(this, _wysiwygElement$1).value = value;
30590
+ }
30591
+ });
30592
+ }
30593
+ get editor() {
30594
+ if (!__privateGet$2(this, _wysiwygElement$1)) {
30595
+ throw new ReferenceError("<bge-wysiwyg-editor> is not connected");
30596
+ }
30597
+ return __privateGet$2(this, _wysiwygElement$1).editor;
30598
+ }
30599
+ get name() {
30600
+ return this.getAttribute("name") ?? "";
30601
+ }
30602
+ get value() {
30603
+ if (!__privateGet$2(this, _wysiwygElement$1)) {
30604
+ throw new ReferenceError("<bge-wysiwyg-editor> is not connected");
30605
+ }
30606
+ return __privateGet$2(this, _wysiwygElement$1).value;
30607
+ }
30608
+ connectedCallback() {
30609
+ __privateSet$2(this, _wysiwygElement$1, this.querySelector("bge-wysiwyg"));
30610
+ if (!__privateGet$2(this, _wysiwygElement$1)) {
30611
+ throw new Error("bge-wysiwyg-editor is not connected");
30612
+ }
30613
+ const buttons = this.querySelectorAll("[data-bge-toolbar-button]");
30614
+ for (const button of buttons) {
30615
+ button.addEventListener("click", () => {
30616
+ if (!__privateGet$2(this, _wysiwygElement$1)) {
30617
+ throw new ReferenceError("<bge-wysiwyg-editor> is not connected");
30618
+ }
30619
+ bindToggle$1(button, __privateGet$2(this, _wysiwygElement$1));
30620
+ });
30621
+ }
30622
+ __privateGet$2(this, _wysiwygElement$1).addEventListener("transaction", (event) => {
30623
+ for (const button of buttons) {
30624
+ updateButtonState$1(button, event.detail.state);
30625
+ }
30626
+ });
30627
+ const htmlModeButton = this.querySelector(
30628
+ '[data-bge-toolbar-button="html-mode"]'
30629
+ );
30630
+ htmlModeButton.addEventListener("click", () => {
30631
+ htmlModeButton.ariaPressed = htmlModeButton.ariaPressed === "true" ? "false" : "true";
30632
+ const mode = htmlModeButton.ariaPressed === "true" ? "html" : "wysiwyg";
30633
+ if (!__privateGet$2(this, _wysiwygElement$1)) {
30634
+ throw new ReferenceError("<bge-wysiwyg-editor> is not connected");
30635
+ }
30636
+ __privateGet$2(this, _wysiwygElement$1).mode = mode;
30637
+ });
30638
+ }
30639
+ setStyle(css) {
30640
+ if (!__privateGet$2(this, _wysiwygElement$1)) {
30641
+ throw new ReferenceError("<bge-wysiwyg-editor> is not connected");
30642
+ }
30643
+ __privateGet$2(this, _wysiwygElement$1).setStyle(css);
30644
+ }
30645
+ syncWysiwygToTextarea() {
30646
+ if (!__privateGet$2(this, _wysiwygElement$1)) {
30647
+ throw new ReferenceError("<bge-wysiwyg-editor> is not connected");
30648
+ }
30649
+ __privateGet$2(this, _wysiwygElement$1).syncWysiwygToTextarea();
30650
+ }
30470
30651
  };
30471
- __publicField$1(_BgeWysiwygEditorElement$1, "extension", null);
30472
- function bindToggle$1(button, editor) {
30652
+ _wysiwygElement$1 = new WeakMap();
30653
+ __publicField$2(_BgeWysiwygEditorElement$1, "extensions", null);
30654
+ __publicField$2(_BgeWysiwygEditorElement$1, "wrapperElement", null);
30655
+ __publicField$2(_BgeWysiwygEditorElement$1, "defaultCommands", [
30656
+ "bold",
30657
+ "italic",
30658
+ "underline",
30659
+ "strikethrough",
30660
+ "link",
30661
+ "button-like-link",
30662
+ "blockquote",
30663
+ "bullet-list",
30664
+ "ordered-list",
30665
+ "note",
30666
+ "h3",
30667
+ "h4",
30668
+ "h5",
30669
+ "h6",
30670
+ "flex-box"
30671
+ ]);
30672
+ function bindToggle$1(button, wysiwygElement) {
30473
30673
  const buttonType = button.dataset.bgeToolbarButton;
30474
30674
  switch (buttonType) {
30475
30675
  case "bold": {
30476
- editor.chain().focus().toggleBold().run();
30676
+ wysiwygElement.toggleBold();
30477
30677
  break;
30478
30678
  }
30479
30679
  case "italic": {
30480
- editor.chain().focus().toggleItalic().run();
30680
+ wysiwygElement.toggleItalic();
30481
30681
  break;
30482
30682
  }
30483
30683
  case "underline": {
30484
- editor.chain().focus().toggleUnderline().run();
30684
+ wysiwygElement.toggleUnderline();
30485
30685
  break;
30486
30686
  }
30487
30687
  case "strikethrough": {
30488
- editor.chain().focus().toggleStrike().run();
30688
+ wysiwygElement.toggleStrike();
30489
30689
  break;
30490
30690
  }
30491
30691
  case "code": {
30492
- editor.chain().focus().toggleCode().run();
30692
+ wysiwygElement.toggleCode();
30493
30693
  break;
30494
30694
  }
30495
30695
  case "link": {
30496
- if (editor.isActive("link")) {
30696
+ if (wysiwygElement.isActive("link")) {
30497
30697
  if (confirm("Are you sure you want to remove the link?")) {
30498
- editor.chain().focus().unsetLink().run();
30698
+ wysiwygElement.toggleLink();
30499
30699
  }
30500
30700
  break;
30501
30701
  }
@@ -30503,13 +30703,13 @@ function bindToggle$1(button, editor) {
30503
30703
  if (!link) {
30504
30704
  break;
30505
30705
  }
30506
- editor.chain().focus().toggleLink({ href: link }).run();
30706
+ wysiwygElement.toggleLink({ href: link });
30507
30707
  break;
30508
30708
  }
30509
30709
  case "button-like-link": {
30510
- if (editor.isActive("buttonLikeLink")) {
30710
+ if (wysiwygElement.isActive("buttonLikeLink")) {
30511
30711
  if (confirm("Are you sure you want to remove the button-like-link?")) {
30512
- editor.chain().focus().toggleButtonLikeLink().run();
30712
+ wysiwygElement.toggleButtonLikeLink();
30513
30713
  }
30514
30714
  break;
30515
30715
  }
@@ -30517,137 +30717,137 @@ function bindToggle$1(button, editor) {
30517
30717
  if (!link) {
30518
30718
  break;
30519
30719
  }
30520
- editor.chain().focus().toggleButtonLikeLink({ href: link }).run();
30720
+ wysiwygElement.toggleButtonLikeLink({ href: link });
30521
30721
  break;
30522
30722
  }
30523
30723
  case "blockquote": {
30524
- editor.chain().focus().toggleBlockquote().run();
30724
+ wysiwygElement.toggleBlockquote();
30525
30725
  break;
30526
30726
  }
30527
30727
  case "bullet-list": {
30528
- editor.chain().focus().toggleBulletList().run();
30728
+ wysiwygElement.toggleBulletList();
30529
30729
  break;
30530
30730
  }
30531
30731
  case "ordered-list": {
30532
- editor.chain().focus().toggleOrderedList().run();
30732
+ wysiwygElement.toggleOrderedList();
30533
30733
  break;
30534
30734
  }
30535
30735
  case "note": {
30536
- editor.chain().focus().toggleNote().run();
30736
+ wysiwygElement.toggleNote();
30537
30737
  break;
30538
30738
  }
30539
30739
  case "h2": {
30540
- editor.chain().focus().toggleHeading({ level: 2 }).run();
30740
+ wysiwygElement.toggleHeading(2);
30541
30741
  break;
30542
30742
  }
30543
30743
  case "h3": {
30544
- editor.chain().focus().toggleHeading({ level: 3 }).run();
30744
+ wysiwygElement.toggleHeading(3);
30545
30745
  break;
30546
30746
  }
30547
30747
  case "h4": {
30548
- editor.chain().focus().toggleHeading({ level: 4 }).run();
30748
+ wysiwygElement.toggleHeading(4);
30549
30749
  break;
30550
30750
  }
30551
30751
  case "h5": {
30552
- editor.chain().focus().toggleHeading({ level: 5 }).run();
30752
+ wysiwygElement.toggleHeading(5);
30553
30753
  break;
30554
30754
  }
30555
30755
  case "h6": {
30556
- editor.chain().focus().toggleHeading({ level: 6 }).run();
30756
+ wysiwygElement.toggleHeading(6);
30557
30757
  break;
30558
30758
  }
30559
30759
  case "flex-box": {
30560
- editor.chain().focus().toggleFlexBox().run();
30760
+ wysiwygElement.toggleFlexBox();
30561
30761
  break;
30562
30762
  }
30563
30763
  }
30564
30764
  }
30565
- function bindPressed$1(button, editor) {
30765
+ function updateButtonState$1(button, state) {
30566
30766
  const buttonType = button.dataset.bgeToolbarButton;
30567
30767
  switch (buttonType) {
30568
30768
  case "bold": {
30569
- button.disabled = !editor.can().chain().focus().toggleBold().run();
30570
- button.ariaPressed = editor.isActive("bold") ? "true" : "false";
30769
+ button.disabled = state.bold.disabled;
30770
+ button.ariaPressed = state.bold.active ? "true" : "false";
30571
30771
  break;
30572
30772
  }
30573
30773
  case "italic": {
30574
- button.disabled = !editor.can().chain().focus().toggleItalic().run();
30575
- button.ariaPressed = editor.isActive("italic") ? "true" : "false";
30774
+ button.disabled = state.italic.disabled;
30775
+ button.ariaPressed = state.italic.active ? "true" : "false";
30576
30776
  break;
30577
30777
  }
30578
30778
  case "underline": {
30579
- button.disabled = !editor.can().chain().focus().toggleUnderline().run();
30580
- button.ariaPressed = editor.isActive("underline") ? "true" : "false";
30779
+ button.disabled = state.underline.disabled;
30780
+ button.ariaPressed = state.underline.active ? "true" : "false";
30581
30781
  break;
30582
30782
  }
30583
30783
  case "strikethrough": {
30584
- button.disabled = !editor.can().chain().focus().toggleStrike().run();
30585
- button.ariaPressed = editor.isActive("strike") ? "true" : "false";
30784
+ button.disabled = state.strike.disabled;
30785
+ button.ariaPressed = state.strike.active ? "true" : "false";
30586
30786
  break;
30587
30787
  }
30588
30788
  case "code": {
30589
- button.disabled = !editor.can().chain().focus().toggleCode().run();
30590
- button.ariaPressed = editor.isActive("code") ? "true" : "false";
30789
+ button.disabled = state.code.disabled;
30790
+ button.ariaPressed = state.code.active ? "true" : "false";
30591
30791
  break;
30592
30792
  }
30593
30793
  case "link": {
30594
- button.disabled = !editor.can().chain().focus().toggleLink().run();
30595
- button.ariaPressed = editor.isActive("link") ? "true" : "false";
30794
+ button.disabled = state.link.disabled;
30795
+ button.ariaPressed = state.link.active ? "true" : "false";
30596
30796
  break;
30597
30797
  }
30598
30798
  case "button-like-link": {
30599
- button.disabled = !editor.can().chain().focus().toggleButtonLikeLink().run();
30600
- button.ariaPressed = editor.isActive("buttonLikeLink") ? "true" : "false";
30799
+ button.disabled = state.buttonLikeLink.disabled;
30800
+ button.ariaPressed = state.buttonLikeLink.active ? "true" : "false";
30601
30801
  break;
30602
30802
  }
30603
30803
  case "blockquote": {
30604
- button.disabled = !editor.can().chain().focus().toggleBlockquote().run();
30605
- button.ariaPressed = editor.isActive("blockquote") ? "true" : "false";
30804
+ button.disabled = state.blockquote.disabled;
30805
+ button.ariaPressed = state.blockquote.active ? "true" : "false";
30606
30806
  break;
30607
30807
  }
30608
30808
  case "bullet-list": {
30609
- button.disabled = !editor.can().chain().focus().toggleBulletList().run();
30610
- button.ariaPressed = editor.isActive("bulletList") ? "true" : "false";
30809
+ button.disabled = state.bulletList.disabled;
30810
+ button.ariaPressed = state.bulletList.active ? "true" : "false";
30611
30811
  break;
30612
30812
  }
30613
30813
  case "ordered-list": {
30614
- button.disabled = !editor.can().chain().focus().toggleOrderedList().run();
30615
- button.ariaPressed = editor.isActive("orderedList") ? "true" : "false";
30814
+ button.disabled = state.orderedList.disabled;
30815
+ button.ariaPressed = state.orderedList.active ? "true" : "false";
30616
30816
  break;
30617
30817
  }
30618
30818
  case "note": {
30619
- button.disabled = !editor.can().chain().focus().toggleNote().run();
30620
- button.ariaPressed = editor.isActive("note") ? "true" : "false";
30819
+ button.disabled = state.note.disabled;
30820
+ button.ariaPressed = state.note.active ? "true" : "false";
30621
30821
  break;
30622
30822
  }
30623
30823
  case "h2": {
30624
- button.disabled = !editor.can().chain().focus().toggleHeading({ level: 2 }).run();
30625
- button.ariaPressed = editor.isActive("heading", { level: 2 }) ? "true" : "false";
30824
+ button.disabled = state.h2.disabled;
30825
+ button.ariaPressed = state.h2.active ? "true" : "false";
30626
30826
  break;
30627
30827
  }
30628
30828
  case "h3": {
30629
- button.disabled = !editor.can().chain().focus().toggleHeading({ level: 3 }).run();
30630
- button.ariaPressed = editor.isActive("heading", { level: 3 }) ? "true" : "false";
30829
+ button.disabled = state.h3.disabled;
30830
+ button.ariaPressed = state.h3.active ? "true" : "false";
30631
30831
  break;
30632
30832
  }
30633
30833
  case "h4": {
30634
- button.disabled = !editor.can().chain().focus().toggleHeading({ level: 4 }).run();
30635
- button.ariaPressed = editor.isActive("heading", { level: 4 }) ? "true" : "false";
30834
+ button.disabled = state.h4.disabled;
30835
+ button.ariaPressed = state.h4.active ? "true" : "false";
30636
30836
  break;
30637
30837
  }
30638
30838
  case "h5": {
30639
- button.disabled = !editor.can().chain().focus().toggleHeading({ level: 5 }).run();
30640
- button.ariaPressed = editor.isActive("heading", { level: 5 }) ? "true" : "false";
30839
+ button.disabled = state.h5.disabled;
30840
+ button.ariaPressed = state.h5.active ? "true" : "false";
30641
30841
  break;
30642
30842
  }
30643
30843
  case "h6": {
30644
- button.disabled = !editor.can().chain().focus().toggleHeading({ level: 6 }).run();
30645
- button.ariaPressed = editor.isActive("heading", { level: 6 }) ? "true" : "false";
30844
+ button.disabled = state.h6.disabled;
30845
+ button.ariaPressed = state.h6.active ? "true" : "false";
30646
30846
  break;
30647
30847
  }
30648
30848
  case "flex-box": {
30649
- button.disabled = !editor.can().chain().focus().toggleFlexBox().run();
30650
- button.ariaPressed = editor.isActive("flexBox") ? "true" : "false";
30849
+ button.disabled = state.flexBox.disabled;
30850
+ button.ariaPressed = state.flexBox.active ? "true" : "false";
30651
30851
  break;
30652
30852
  }
30653
30853
  }
@@ -32290,10 +32490,10 @@ var editor$a = "<div>\n\t<label>\n\t\t<span>ボタンの種類</span>\n\t\t<sele
32290
32490
 
32291
32491
  var style$a = "/* No Styling */\n";
32292
32492
 
32293
- var template$C = "<div data-bgi-button-kind=\"link\" data-bge=\"kind:data-bgi-button-kind\">\n\t<a href=\"\" data-bge=\"link:href, target:target\">\n\t\t<span data-bge=\"text\">ボタン</span>\n\t</a>\n</div>\n";
32493
+ var template$C = "<a href=\"\" data-bgi-button-kind=\"link\" data-bge=\"link:href, target:target, kind:data-bgi-button-kind\">\n\t<div>\n\t\t<span data-bge=\"text\">ボタン</span>\n\t</div>\n</a>\n";
32294
32494
 
32295
32495
  var button = createItem({
32296
- version: "4.0.0-alpha.9",
32496
+ version: "4.0.0-alpha.11",
32297
32497
  name: "button",
32298
32498
  template: template$C,
32299
32499
  style: style$a,
@@ -32307,7 +32507,7 @@ var style$9 = "/* No Styling */\n";
32307
32507
  var template$B = "<details data-bge=\"open:open\">\n\t<summary data-bge=\"summary\">折りたたみコンテンツ</summary>\n\t<div data-bge=\"content\"><p>内容を入力してください</p></div>\n</details>\n";
32308
32508
 
32309
32509
  var details = createItem({
32310
- version: "4.0.0-alpha.9",
32510
+ version: "4.0.0-alpha.11",
32311
32511
  name: "details",
32312
32512
  template: template$B,
32313
32513
  style: style$9,
@@ -32321,7 +32521,7 @@ var style$8 = "[data-bgi='download-file'] {\n\t[data-bge*='size'] {\n\t\t&::befo
32321
32521
  var template$A = "<a href=\"./files/bgeditor/bg-sample.pdf\" target=\"_blank\" data-bge=\"path:href, download:download\">\n\t<div>\n\t\t<span data-bge=\"name\">サンプルダウンロードファイル</span>\n\t\t<span data-bge=\"formated-size, size:data-size\" data-size=\"138158\">134.92kB</span>\n\t</div>\n</a>\n";
32322
32522
 
32323
32523
  var downloadFile = createItem({
32324
- version: "4.0.0-alpha.9",
32524
+ version: "4.0.0-alpha.11",
32325
32525
  name: "download-file",
32326
32526
  template: template$A,
32327
32527
  style: style$8,
@@ -32360,7 +32560,7 @@ var style$7 = "[data-bgi='google-maps'] {\n\tdiv {\n\t\tinline-size: 100%;\n\t\t
32360
32560
  var template$z = "<div data-lat=\"35.681382\" data-lng=\"139.766084\" data-zoom=\"16\" data-bge=\"lat:data-lat, lng:data-lng, zoom:data-zoom\">\n\t<img data-bge=\"img:src\" src=\"https://maps.google.com/maps/api/staticmap?center=35.681382,139.766084&amp;zoom=16&amp;size=640x400&amp;markers=color:red|color:red|35.681382,139.766084&amp;scale=2&amp;key=%googleMapsApiKey%\" width=\"8\" height=\"5\" alt=\"Google Maps\" />\n</div>\n<a href=\"https://maps.apple.com/?q=35.681382,139.766084\" data-bge=\"url:href\" target=\"_blank\"><span>アプリで開く</span></a>\n";
32361
32561
 
32362
32562
  var googleMaps = createItem({
32363
- version: "4.0.0-alpha.9",
32563
+ version: "4.0.0-alpha.11",
32364
32564
  name: "google-maps",
32365
32565
  template: template$z,
32366
32566
  style: style$7,
@@ -32488,31 +32688,18 @@ var googleMaps = createItem({
32488
32688
  }
32489
32689
  });
32490
32690
 
32491
- var editor$6 = "<div>\n\t<label>\n\t\t<span>区切り線の種類</span>\n\t\t<select name=\"bge-kind\">\n\t\t\t<option value=\"primary\">標準</option>\n\t\t\t<option value=\"dashed\">破線</option>\n\t\t\t<option value=\"bold\">太い区切り線</option>\n\t\t\t<option value=\"narrow\">細い区切り線</option>\n\t\t\t<option value=\"short\">短い区切り線</option>\n\t\t</select>\n\t</label>\n</div>\n";
32691
+ var editor$6 = "<div>\n\t<label>\n\t\t<span>区切り線の種類</span>\n\t\t<select name=\"bge-kind\">\n\t\t\t<option value=\"primary\">標準</option>\n\t\t\t<option value=\"dashed\">破線</option>\n\t\t\t<option value=\"bold\">太い区切り線</option>\n\t\t\t<option value=\"narrow\">細い区切り線</option>\n\t\t</select>\n\t</label>\n</div>\n";
32492
32692
 
32493
32693
  var style$6 = "[data-bgi='hr'] {\n\t--inline-size: 100%;\n\t--border-color: #000;\n\t--border-width: 1px;\n\t--border-kind: solid;\n\n\t> div {\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t}\n\n\thr {\n\t\tinline-size: var(--inline-size);\n\t\tborder: var(--border-color) var(--border-kind) var(--border-width);\n\t}\n}\n";
32494
32694
 
32495
32695
  var template$y = "<div data-bgi-hr-kind=\"primary\" data-bge=\"kind:data-bgi-hr-kind\">\n\t<hr />\n</div>\n";
32496
32696
 
32497
32697
  var hr = createItem({
32498
- version: "4.0.0-alpha.9",
32698
+ version: "4.0.0-alpha.11",
32499
32699
  name: "hr",
32500
32700
  template: template$y,
32501
32701
  style: style$6,
32502
- editor: editor$6,
32503
- editorOptions: {
32504
- migrate(type) {
32505
- const data = type.export();
32506
- if (data.type) {
32507
- data.kind = data.type.replace(/^bgi-hr--/, "");
32508
- delete data.type;
32509
- }
32510
- if (!data.kind) {
32511
- data.kind = "primary";
32512
- }
32513
- return data;
32514
- }
32515
- }
32702
+ editor: editor$6
32516
32703
  });
32517
32704
 
32518
32705
  var editor$5 = "<div data-bge-dialog=\"2col\">\n\t<div data-bge-dialog-ui=\"sticky\">\n\t\t<div>\n\t\t\t<div data-bge-editor-ui=\"tabs\" data-bge-editor-ui-for=\"bgi-image__tabs-content\"></div>\n\n\t\t\t<div id=\"bgi-image__tabs-content\" role=\"tabpanel\" aria-label=\"画像\">\n\t\t\t\t<div data-bge-editor-ui=\"preview\"></div>\n\t\t\t\t<input type=\"hidden\" name=\"bge-path[]\" />\n\t\t\t\t<input type=\"hidden\" name=\"bge-alt[]\" />\n\t\t\t\t<input type=\"hidden\" name=\"bge-width[]\" />\n\t\t\t\t<input type=\"hidden\" name=\"bge-height[]\" />\n\t\t\t\t<input type=\"hidden\" name=\"bge-media[]\" />\n\n\t\t\t\t<input type=\"hidden\" name=\"bge-file-size\" />\n\t\t\t\t<div>\n\t\t\t\t\t<label>\n\t\t\t\t\t\t<span>メディアクエリー</span>\n\t\t\t\t\t\t<input type=\"text\" name=\"bge-media-input\" />\n\t\t\t\t\t</label>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<div>\n\t\t\t<fieldset>\n\t\t\t\t<legend>画像のサイズ</legend>\n\t\t\t\t<div role=\"radiogroup\" aria-labelledby=\"bgi-image__radio-group1\">\n\t\t\t\t\t<div id=\"bgi-image__radio-group1\">基準</div>\n\t\t\t\t\t<label><input type=\"radio\" name=\"bge-scale-type\" value=\"container\" /><span>基準</span></label>\n\t\t\t\t\t<label><input type=\"radio\" name=\"bge-scale-type\" value=\"original\" checked />画像基準</label>\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<span>\n\t\t\t\t\t\t<label for=\"bgi-image__range\">幅</label>\n\t\t\t\t\t\t<output name=\"bge-css-width\"></output>\n\t\t\t\t\t</span>\n\t\t\t\t\t<input id=\"bgi-image__range\" type=\"range\" name=\"bge-scale\" min=\"1\" max=\"100\" step=\"1\" value=\"100\" />\n\t\t\t\t</div>\n\t\t\t\t<div role=\"radiogroup\" aria-labelledby=\"bgi-image__radio-group2\">\n\t\t\t\t\t<div id=\"bgi-image__radio-group2\">縦横比</div>\n\t\t\t\t\t<label><input type=\"radio\" name=\"bge-aspect-ratio\" value=\"unset\" checked />オリジナル</label>\n\t\t\t\t\t<label><input type=\"radio\" name=\"bge-aspect-ratio\" value=\"1/1\" />1 : 1</label>\n\t\t\t\t\t<label><input type=\"radio\" name=\"bge-aspect-ratio\" value=\"4/3\" />4 : 3</label>\n\t\t\t\t\t<label><input type=\"radio\" name=\"bge-aspect-ratio\" value=\"16/9\" />16 : 9</label>\n\t\t\t\t</div>\n\t\t\t</fieldset>\n\t\t\t<label>\n\t\t\t\t<span>画像の代替テキスト(alt)</span>\n\t\t\t\t<input type=\"text\" name=\"bge-alt-editable\" />\n\t\t\t</label>\n\t\t\t<label>\n\t\t\t\t<span>キャプション</span>\n\t\t\t\t<input type=\"text\" name=\"bge-caption\" />\n\t\t\t</label>\n\t\t\t<fieldset>\n\t\t\t\t<legend>リンク</legend>\n\t\t\t\t<label><input type=\"checkbox\" name=\"bge-popup\" />ポップアップで画像を開く</label>\n\t\t\t\t<label>\n\t\t\t\t\t<span>リンク先URL</span>\n\t\t\t\t\t<input type=\"url\" name=\"bge-href\" />\n\t\t\t\t</label>\n\t\t\t\t<label><input type=\"checkbox\" name=\"bge-target-blank\" />別タブで開く</label>\n\t\t\t</fieldset>\n\t\t\t<label><input type=\"checkbox\" name=\"bge-lazy\" checked aria-describedby=\"bge-lazy-desc\" />遅延読み込み</label>\n\t\t\t<small id=\"bge-lazy-desc\">画像がブラウザの表示エリアに現れるまでファイルを読み込みません。</small>\n\t\t</div>\n\t</div>\n\t<div>\n\t\t<div data-bge-editor-ui=\"imageUploader\"></div>\n\t\t<div data-bge-editor-ui=\"imageList\"></div>\n\t</div>\n</div>\n";
@@ -32523,7 +32710,7 @@ var template$x = "<div data-bge=\":style, :scale, :scale-type, :aspect-ratio\" d
32523
32710
 
32524
32711
  const ORIGIN = "__org";
32525
32712
  var image = createItem({
32526
- version: "4.0.0-alpha.9",
32713
+ version: "4.0.0-alpha.11",
32527
32714
  name: "image",
32528
32715
  template: template$x,
32529
32716
  style: style$5,
@@ -32689,7 +32876,7 @@ var style$4 = "/* No Styling */\n";
32689
32876
  var template$w = "<table>\n\t<caption data-bge=\"caption\">\n\t\tキャプションを入力してください\n\t</caption>\n\t<tbody data-bge-list>\n\t\t<tr>\n\t\t\t<th data-bge=\"th\">表組の見出し</th>\n\t\t\t<td data-bge=\"td\">表組の内容を入力してください</td>\n\t\t</tr>\n\t</tbody>\n</table>\n";
32690
32877
 
32691
32878
  var table = createItem({
32692
- version: "4.0.0-alpha.9",
32879
+ version: "4.0.0-alpha.11",
32693
32880
  name: "table",
32694
32881
  template: template$w,
32695
32882
  style: style$4,
@@ -32717,7 +32904,7 @@ var style$3 = "/* No Styling */\n";
32717
32904
  var template$v = "<h2 data-bge=\"title-h2\">見出しを入力してください</h2>\n";
32718
32905
 
32719
32906
  var titleH2 = createItem({
32720
- version: "4.0.0-alpha.9",
32907
+ version: "4.0.0-alpha.11",
32721
32908
  name: "title-h2",
32722
32909
  template: template$v,
32723
32910
  style: style$3,
@@ -32731,7 +32918,7 @@ var style$2 = "/* No Styling */\n";
32731
32918
  var template$u = "<h3 data-bge=\"title-h3\">見出しを入力してください</h3>\n";
32732
32919
 
32733
32920
  var titleH3 = createItem({
32734
- version: "4.0.0-alpha.9",
32921
+ version: "4.0.0-alpha.11",
32735
32922
  name: "title-h3",
32736
32923
  template: template$u,
32737
32924
  style: style$2,
@@ -32745,7 +32932,7 @@ var style$1 = "/* No Styling */\n";
32745
32932
  var template$t = "<div data-bge=\"wysiwyg\"><p>本文を入力してください</p></div>\n";
32746
32933
 
32747
32934
  var wysiwyg = createItem({
32748
- version: "4.0.0-alpha.9",
32935
+ version: "4.0.0-alpha.11",
32749
32936
  name: "wysiwyg",
32750
32937
  template: template$t,
32751
32938
  style: style$1,
@@ -32760,7 +32947,7 @@ var template$s = "<div data-id=\"3KtWfp0UopM\" data-title=\"YouTube動画\" data
32760
32947
 
32761
32948
  const FALLBACK_TITLE = "YouTube\u52D5\u753B";
32762
32949
  var youtube = createItem({
32763
- version: "4.0.0-alpha.9",
32950
+ version: "4.0.0-alpha.11",
32764
32951
  name: "youtube",
32765
32952
  template: template$s,
32766
32953
  style: style$b,
@@ -33135,7 +33322,7 @@ const blocks = {
33135
33322
  disclosure: blockTemplate$o
33136
33323
  };
33137
33324
 
33138
- var general = ":root {\n\t--bge-grid-gap: 1rem;\n\t--bge-auto-fit-base-width: 40em;\n\n\t/* Custom margin */\n\t--bge-options-margin-normal: 3rem;\n\t--bge-options-margin-none: 0;\n\t--bge-options-margin-small: 1rem;\n\t--bge-options-margin-large: 8rem;\n\t--bge-options-margin: var(--bge-options-margin-normal);\n\n\t/* Custom background color */\n\t--bge-options-bgcolor-transparent: transparent;\n\t--bge-options-bgcolor-white: #fff;\n\t--bge-options-bgcolor-gray: #dfdfdf;\n\t--bge-options-bgcolor-blue: #eaf3f8;\n\t--bge-options-bgcolor-red: #fcc;\n\t--bge-options-bgcolor: var(--bge-options-bgcolor-transparent);\n\n\t/* Custom border style */\n\t--bge-options-border-none: none;\n\t--bge-options-border-solid: solid 1px currentColor;\n\t--bge-options-border-dashed: dashed 1px currentColor;\n\t--bge-options-border-dotted: dotted 1px currentColor;\n\t--bge-options-border-wide: solid 3px currentColor;\n\t--bge-options-border: var(--bge-options-border-none);\n\n\t/* Custom padding */\n\t--bge-options-padding-none: 0;\n\t--bge-options-padding-small: 1rem;\n\t--bge-options-padding-middle: 3rem;\n\t--bge-options-padding-large: 5rem;\n\t--bge-options-padding: var(--bge-options-padding-none);\n}\n\n:where([data-bge-container]) {\n\t--bge-container-margin-block-end: var(--bge-options-margin);\n\tmargin-block-end: var(--bge-container-margin-block-end);\n\tcontainer-name: bge-container;\n\tcontainer-type: inline-size;\n\n\t&:where(:last-child) {\n\t\t--bge-last-container-margin-block-end: 0;\n\t\t--bge-container-margin-block-end: var(--bge-last-container-margin-block-end);\n\t}\n}\n\n:where([data-bge-container-frame]) {\n\t--bge-container-background-color: var(--bge-options-bgcolor);\n\t--bge-container-border: var(--bge-options-border);\n\t--bge-container-padding: var(--bge-options-padding);\n\tpadding: var(--bge-container-padding);\n\tbackground-color: var(--bge-container-background-color);\n\tborder: var(--bge-container-border);\n}\n\n:where([data-bge-container='grid'], [data-bge-container^='grid:']) {\n\t&:where([data-bge-container$=':2'], [data-bge-container*=':2:'])\n\t\t:where([data-bge-container-frame]) {\n\t\t--bge-grid-col: 2;\n\t}\n\n\t&:where([data-bge-container$=':3'], [data-bge-container*=':3:'])\n\t\t:where([data-bge-container-frame]) {\n\t\t--bge-grid-col: 3;\n\t}\n\n\t&:where([data-bge-container$=':4'], [data-bge-container*=':4:'])\n\t\t:where([data-bge-container-frame]) {\n\t\t--bge-grid-col: 4;\n\t}\n\n\t&:where([data-bge-container$=':5'], [data-bge-container*=':5:'])\n\t\t:where([data-bge-container-frame]) {\n\t\t--bge-grid-col: 5;\n\t}\n\n\t:where([data-bge-container-frame]) {\n\t\tdisplay: grid;\n\t\tgrid-template-columns: repeat(var(--bge-grid-col, 1), minmax(0, 1fr));\n\t\tgap: var(--bge-grid-gap);\n\n\t\t&:is([data-bge-container*=':auto-fit:'] *) {\n\t\t\tgrid-template-columns: repeat(\n\t\t\t\tauto-fit,\n\t\t\t\tminmax(calc(var(--bge-auto-fit-base-width) / var(--bge-grid-col, 1)), 1fr)\n\t\t\t);\n\t\t}\n\t}\n\n\t:where([data-bge-group]) {\n\t\t--item-count: 1;\n\t\tdisplay: grid;\n\t\tgrid-template-rows: subgrid;\n\t\tgrid-row: span var(--item-count);\n\n\t\t/* Subgrid hack 2 items */\n\t\t&[data-bge-group]:has([data-bge-item]:nth-child(2):last-child) {\n\t\t\t--item-count: 2;\n\t\t}\n\n\t\t/* Subgrid hack 3 items */\n\t\t&[data-bge-group]:has([data-bge-item]:nth-child(3):last-child) {\n\t\t\t--item-count: 3;\n\t\t}\n\n\t\t/* Subgrid hack 4 items */\n\t\t&[data-bge-group]:has([data-bge-item]:nth-child(4):last-child) {\n\t\t\t--item-count: 4;\n\t\t}\n\n\t\t/* Subgrid hack 5 items */\n\t\t&[data-bge-group]:has([data-bge-item]:nth-child(5):last-child) {\n\t\t\t--item-count: 5;\n\t\t}\n\n\t\t/* Subgrid hack 6 items */\n\t\t&[data-bge-group]:has([data-bge-item]:nth-child(6):last-child) {\n\t\t\t--item-count: 6;\n\t\t}\n\n\t\t/* Subgrid hack 7 items */\n\t\t&[data-bge-group]:has([data-bge-item]:nth-child(7):last-child) {\n\t\t\t--item-count: 7;\n\t\t}\n\n\t\t/* Subgrid hack 8 items */\n\t\t&[data-bge-group]:has([data-bge-item]:nth-child(8):last-child) {\n\t\t\t--item-count: 8;\n\t\t}\n\t}\n\n\t:where([data-bge-item]) {\n\t\talign-self: self-start;\n\t\tcontainer-name: bge-item;\n\t\tcontainer-type: inline-size;\n\t}\n}\n\n:where([data-bge-container='inline'], [data-bge-container^='inline:']) {\n\t:where([data-bge-container-frame]) {\n\t\tdisplay: flex;\n\t\tflex-wrap: wrap;\n\t\tgap: var(--bge-grid-gap);\n\t\talign-items: stretch;\n\t\tjustify-content: center;\n\n\t\t&:where(:is([data-bge-container$=':center'], [data-bge-container*=':center:']) *) {\n\t\t\tjustify-content: center;\n\t\t}\n\n\t\t&:where(:is([data-bge-container$=':start'], [data-bge-container*=':start:']) *) {\n\t\t\tjustify-content: start;\n\t\t}\n\n\t\t&:where(:is([data-bge-container$=':end'], [data-bge-container*=':end:']) *) {\n\t\t\tjustify-content: end;\n\t\t}\n\n\t\t&:where(:is([data-bge-container$=':between'], [data-bge-container*=':between:']) *) {\n\t\t\tjustify-content: space-between;\n\t\t}\n\n\t\t&:where(:is([data-bge-container$=':around'], [data-bge-container*=':around:']) *) {\n\t\t\tjustify-content: space-around;\n\t\t}\n\n\t\t&:where(:is([data-bge-container$=':evenly'], [data-bge-container*=':evenly:']) *) {\n\t\t\tjustify-content: space-evenly;\n\t\t}\n\n\t\t&:where(\n\t\t\t:is([data-bge-container$=':align-center'], [data-bge-container*=':align-center:']) *\n\t\t) {\n\t\t\talign-items: center;\n\t\t}\n\n\t\t&:where(\n\t\t\t:is([data-bge-container$=':align-start'], [data-bge-container*=':align-start:']) *\n\t\t) {\n\t\t\talign-items: start;\n\t\t}\n\n\t\t&:where(\n\t\t\t:is([data-bge-container$=':align-end'], [data-bge-container*=':align-end:']) *\n\t\t) {\n\t\t\talign-items: end;\n\t\t}\n\n\t\t&:where(\n\t\t\t:is([data-bge-container$=':align-stretch'], [data-bge-container*=':align-stretch:'])\n\t\t\t\t*\n\t\t) {\n\t\t\talign-items: stretch;\n\t\t}\n\n\t\t&:where(\n\t\t\t:is(\n\t\t\t\t\t[data-bge-container$=':align-baseline'],\n\t\t\t\t\t[data-bge-container*=':align-baseline:']\n\t\t\t\t)\n\t\t\t\t*\n\t\t) {\n\t\t\t--align: baseline;\n\t\t}\n\n\t\t&:where(:is([data-bge-container$=':wrap'], [data-bge-container*=':wrap:']) *) {\n\t\t\tflex-wrap: wrap;\n\t\t}\n\n\t\t&:where(:is([data-bge-container$=':nowrap'], [data-bge-container*=':nowrap:']) *) {\n\t\t\tflex-wrap: nowrap;\n\t\t}\n\t}\n\n\t&:where([data-bge-container$=':immutable'], [data-bge-container*=':immutable:'])\n\t\t:where([data-bge-container-frame]) {\n\t\t& > * {\n\t\t\tflex: 1 1 auto;\n\t\t}\n\t}\n}\n\n:where([data-bge-container='float'], [data-bge-container^='float:']) {\n\t--bge-grid-float: none;\n\t--margin-inline: 0;\n\n\t&:where([data-bge-container$=':start'], [data-bge-container*=':start:']) {\n\t\t--bge-grid-float: inline-start;\n\t\t--margin-inline: 0 var(--bge-grid-gap);\n\t}\n\n\t&:where([data-bge-container$=':end'], [data-bge-container*=':end:']) {\n\t\t--bge-grid-float: inline-end;\n\t\t--margin-inline: var(--bge-grid-gap) 0;\n\t}\n\n\t:where([data-bge-container-frame]) {\n\t\t&::after {\n\t\t\tclear: both;\n\t\t\tdisplay: block;\n\t\t\tcontent: '';\n\t\t}\n\n\t\t& > :where(:first-child) {\n\t\t\tfloat: var(--bge-grid-float, none);\n\t\t\tinline-size: fit-content;\n\t\t\tmargin-inline: var(--margin-inline);\n\t\t}\n\t}\n}\n";
33325
+ var general = ":root {\n\t--bge-auto-fit-base-width: 40em;\n\n\t/* Custom width */\n\t--bge-options-width--normal: calc(800 / 16 * 1rem);\n\t--bge-options-width--small: calc(400 / 16 * 1rem);\n\t--bge-options-width--medium: calc(600 / 16 * 1rem);\n\t--bge-options-width--large: calc(1200 / 16 * 1rem);\n\t--bge-options-width--full: 100dvi;\n\t--bge-options-width: var(--bge-options-width--normal);\n\n\t/* Custom margin */\n\t--bge-options-margin--normal: 3rem;\n\t--bge-options-margin--none: 0;\n\t--bge-options-margin--small: 1rem;\n\t--bge-options-margin--large: 8rem;\n\t--bge-options-margin: var(--bge-options-margin--normal);\n\n\t/* Custom background color */\n\t--bge-options-bgcolor--transparent: transparent;\n\t--bge-options-bgcolor--white: #fff;\n\t--bge-options-bgcolor--gray: #dfdfdf;\n\t--bge-options-bgcolor--blue: #eaf3f8;\n\t--bge-options-bgcolor--red: #fcc;\n\t--bge-options-bgcolor: var(--bge-options-bgcolor--transparent);\n\n\t/* Custom border style */\n\t--bge-options-border--none: none;\n\t--bge-options-border--solid: solid 1px currentColor;\n\t--bge-options-border--dashed: dashed 1px currentColor;\n\t--bge-options-border--dotted: dotted 1px currentColor;\n\t--bge-options-border--wide: solid 3px currentColor;\n\t--bge-options-border: var(--bge-options-border--none);\n\n\t/* Custom padding-block */\n\t--bge-options-padding-block--none: 0;\n\t--bge-options-padding-block--small: 1rem;\n\t--bge-options-padding-block--middle: 3rem;\n\t--bge-options-padding-block--large: 5rem;\n\t--bge-options-padding-block: var(--bge-options-padding-block--none);\n\n\t/* Custom padding-inline */\n\t--bge-options-padding-inline--default-gutter: 2rem;\n\t--bge-options-padding-inline--none: 0;\n\t--bge-options-padding-inline--small: 1rem;\n\t--bge-options-padding-inline--middle: 3rem;\n\t--bge-options-padding-inline--large: 5rem;\n\t--bge-options-padding-inline: var(--bge-options-padding-inline--default-gutter);\n\n\t/* Custom gap */\n\t--bge-options-gap--normal: 1rem;\n\t--bge-options-gap--small: 0.5rem;\n\t--bge-options-gap--large: 2rem;\n\t--bge-options-gap: var(--bge-options-gap--normal);\n}\n\n:where([data-bge-container]) {\n\t--bge-container-margin-block-end: var(--bge-options-margin);\n\tinline-size: 100%;\n\tmax-inline-size: var(--bge-options-width);\n\tmargin-block-end: var(--bge-container-margin-block-end);\n\tmargin-inline: auto;\n\tcontainer-name: bge-container;\n\tcontainer-type: inline-size;\n\n\t&:where(:last-child) {\n\t\t--bge-last-container-margin-block-end: 0;\n\t\t--bge-container-margin-block-end: var(--bge-last-container-margin-block-end);\n\t}\n}\n\n:where([data-bge-container-frame]) {\n\t--bge-container-background-color: var(--bge-options-bgcolor);\n\t--bge-container-border: var(--bge-options-border);\n\t--bge-container-padding-block: var(--bge-options-padding-block);\n\t--bge-container-padding-inline: var(--bge-options-padding-inline);\n\tinline-size: 100%;\n\tpadding-block: var(--bge-container-padding-block);\n\tpadding-inline: var(--bge-container-padding-inline);\n\tbackground-color: var(--bge-container-background-color);\n\tborder: var(--bge-container-border);\n}\n\n:where([data-bge-container='grid'], [data-bge-container^='grid:']) {\n\t&:where([data-bge-container$=':2'], [data-bge-container*=':2:'])\n\t\t:where([data-bge-container-frame]) {\n\t\t--bge-grid-col: 2;\n\t}\n\n\t&:where([data-bge-container$=':3'], [data-bge-container*=':3:'])\n\t\t:where([data-bge-container-frame]) {\n\t\t--bge-grid-col: 3;\n\t}\n\n\t&:where([data-bge-container$=':4'], [data-bge-container*=':4:'])\n\t\t:where([data-bge-container-frame]) {\n\t\t--bge-grid-col: 4;\n\t}\n\n\t&:where([data-bge-container$=':5'], [data-bge-container*=':5:'])\n\t\t:where([data-bge-container-frame]) {\n\t\t--bge-grid-col: 5;\n\t}\n\n\t:where([data-bge-container-frame]) {\n\t\tdisplay: grid;\n\t\tgrid-template-columns: repeat(var(--bge-grid-col, 1), minmax(0, 1fr));\n\t\tgap: var(--bge-options-gap);\n\n\t\t&:is([data-bge-container*=':auto-fit:'] *) {\n\t\t\tgrid-template-columns: repeat(\n\t\t\t\tauto-fit,\n\t\t\t\tminmax(calc(var(--bge-auto-fit-base-width) / var(--bge-grid-col, 1)), 1fr)\n\t\t\t);\n\t\t}\n\t}\n\n\t:where([data-bge-group]) {\n\t\t--item-count: 1;\n\t\tdisplay: grid;\n\t\tgrid-template-rows: subgrid;\n\t\tgrid-row: span var(--item-count);\n\n\t\t/* Subgrid hack 2 items */\n\t\t&[data-bge-group]:has([data-bge-item]:nth-child(2):last-child) {\n\t\t\t--item-count: 2;\n\t\t}\n\n\t\t/* Subgrid hack 3 items */\n\t\t&[data-bge-group]:has([data-bge-item]:nth-child(3):last-child) {\n\t\t\t--item-count: 3;\n\t\t}\n\n\t\t/* Subgrid hack 4 items */\n\t\t&[data-bge-group]:has([data-bge-item]:nth-child(4):last-child) {\n\t\t\t--item-count: 4;\n\t\t}\n\n\t\t/* Subgrid hack 5 items */\n\t\t&[data-bge-group]:has([data-bge-item]:nth-child(5):last-child) {\n\t\t\t--item-count: 5;\n\t\t}\n\n\t\t/* Subgrid hack 6 items */\n\t\t&[data-bge-group]:has([data-bge-item]:nth-child(6):last-child) {\n\t\t\t--item-count: 6;\n\t\t}\n\n\t\t/* Subgrid hack 7 items */\n\t\t&[data-bge-group]:has([data-bge-item]:nth-child(7):last-child) {\n\t\t\t--item-count: 7;\n\t\t}\n\n\t\t/* Subgrid hack 8 items */\n\t\t&[data-bge-group]:has([data-bge-item]:nth-child(8):last-child) {\n\t\t\t--item-count: 8;\n\t\t}\n\t}\n\n\t:where([data-bge-item]) {\n\t\talign-self: self-start;\n\t\tcontainer-name: bge-item;\n\t\tcontainer-type: inline-size;\n\t}\n}\n\n:where([data-bge-container='inline'], [data-bge-container^='inline:']) {\n\t:where([data-bge-container-frame]) {\n\t\tdisplay: flex;\n\t\tflex-wrap: wrap;\n\t\tgap: var(--bge-options-gap);\n\t\talign-items: stretch;\n\t\tjustify-content: center;\n\n\t\t&:where(:is([data-bge-container$=':center'], [data-bge-container*=':center:']) *) {\n\t\t\tjustify-content: center;\n\t\t}\n\n\t\t&:where(:is([data-bge-container$=':start'], [data-bge-container*=':start:']) *) {\n\t\t\tjustify-content: start;\n\t\t}\n\n\t\t&:where(:is([data-bge-container$=':end'], [data-bge-container*=':end:']) *) {\n\t\t\tjustify-content: end;\n\t\t}\n\n\t\t&:where(:is([data-bge-container$=':between'], [data-bge-container*=':between:']) *) {\n\t\t\tjustify-content: space-between;\n\t\t}\n\n\t\t&:where(:is([data-bge-container$=':around'], [data-bge-container*=':around:']) *) {\n\t\t\tjustify-content: space-around;\n\t\t}\n\n\t\t&:where(:is([data-bge-container$=':evenly'], [data-bge-container*=':evenly:']) *) {\n\t\t\tjustify-content: space-evenly;\n\t\t}\n\n\t\t&:where(\n\t\t\t:is([data-bge-container$=':align-center'], [data-bge-container*=':align-center:']) *\n\t\t) {\n\t\t\talign-items: center;\n\t\t}\n\n\t\t&:where(\n\t\t\t:is([data-bge-container$=':align-start'], [data-bge-container*=':align-start:']) *\n\t\t) {\n\t\t\talign-items: start;\n\t\t}\n\n\t\t&:where(\n\t\t\t:is([data-bge-container$=':align-end'], [data-bge-container*=':align-end:']) *\n\t\t) {\n\t\t\talign-items: end;\n\t\t}\n\n\t\t&:where(\n\t\t\t:is([data-bge-container$=':align-stretch'], [data-bge-container*=':align-stretch:'])\n\t\t\t\t*\n\t\t) {\n\t\t\talign-items: stretch;\n\t\t}\n\n\t\t&:where(\n\t\t\t:is(\n\t\t\t\t\t[data-bge-container$=':align-baseline'],\n\t\t\t\t\t[data-bge-container*=':align-baseline:']\n\t\t\t\t)\n\t\t\t\t*\n\t\t) {\n\t\t\t--align: baseline;\n\t\t}\n\n\t\t&:where(:is([data-bge-container$=':wrap'], [data-bge-container*=':wrap:']) *) {\n\t\t\tflex-wrap: wrap;\n\t\t}\n\n\t\t&:where(:is([data-bge-container$=':nowrap'], [data-bge-container*=':nowrap:']) *) {\n\t\t\tflex-wrap: nowrap;\n\t\t}\n\t}\n\n\t&:where([data-bge-container$=':immutable'], [data-bge-container*=':immutable:'])\n\t\t:where([data-bge-container-frame]) {\n\t\t& > * {\n\t\t\tflex: 1 1 auto;\n\t\t}\n\t}\n}\n\n:where([data-bge-container='float'], [data-bge-container^='float:']) {\n\t--bge-grid-float: none;\n\t--margin-inline: 0;\n\n\t&:where([data-bge-container$=':start'], [data-bge-container*=':start:']) {\n\t\t--bge-grid-float: inline-start;\n\t\t--margin-inline: 0 var(--bge-options-gap);\n\t}\n\n\t&:where([data-bge-container$=':end'], [data-bge-container*=':end:']) {\n\t\t--bge-grid-float: inline-end;\n\t\t--margin-inline: var(--bge-options-gap) 0;\n\t}\n\n\t:where([data-bge-container-frame]) {\n\t\t&::after {\n\t\t\tclear: both;\n\t\t\tdisplay: block;\n\t\t\tcontent: '';\n\t\t}\n\n\t\t& > :where(:first-child) {\n\t\t\tfloat: var(--bge-grid-float, none);\n\t\t\tinline-size: fit-content;\n\t\t\tmargin-inline: var(--margin-inline);\n\t\t}\n\t}\n}\n";
33139
33326
 
33140
33327
  const camelCaseCache = new Map();
33141
33328
  /**
@@ -33166,7 +33353,7 @@ function kebabCase(str) {
33166
33353
  }
33167
33354
 
33168
33355
  /**
33169
- * marked v16.1.1 - a markdown parser
33356
+ * marked v16.1.2 - a markdown parser
33170
33357
  * Copyright (c) 2011-2025, Christopher Jeffrey. (MIT Licensed)
33171
33358
  * https://github.com/markedjs/marked
33172
33359
  */
@@ -33177,7 +33364,7 @@ function kebabCase(str) {
33177
33364
  */
33178
33365
 
33179
33366
  function L(){return {async:false,breaks:false,extensions:null,gfm:true,hooks:null,pedantic:false,renderer:null,silent:false,tokenizer:null,walkTokens:null}}var O=L();function H(l){O=l;}var E={exec:()=>null};function h$1(l,e=""){let t=typeof l=="string"?l:l.source,n={replace:(r,i)=>{let s=typeof i=="string"?i:i.source;return s=s.replace(m.caret,"$1"),t=t.replace(r,s),n},getRegex:()=>new RegExp(t,e)};return n}var m={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:l=>new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:l=>new RegExp(`^ {0,${Math.min(3,l-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:l=>new RegExp(`^ {0,${Math.min(3,l-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:l=>new RegExp(`^ {0,${Math.min(3,l-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:l=>new RegExp(`^ {0,${Math.min(3,l-1)}}#`),htmlBeginRegex:l=>new RegExp(`^ {0,${Math.min(3,l-1)}}<(?:[a-z].*>|!--)`,"i")},xe=/^(?:[ \t]*(?:\n|$))+/,be=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Re=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,C=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Oe=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,j=/(?:[*+-]|\d{1,9}[.)])/,se=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ie$2=h$1(se).replace(/bull/g,j).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Te=h$1(se).replace(/bull/g,j).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),F=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,we=/^[^\n]+/,Q=/(?!\s*\])(?:\\.|[^\[\]\\])+/,ye=h$1(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Q).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Pe=h$1(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,j).getRegex(),v="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",U=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Se=h$1("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",U).replace("tag",v).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),oe=h$1(F).replace("hr",C).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",v).getRegex(),$e=h$1(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",oe).getRegex(),K={blockquote:$e,code:be,def:ye,fences:Re,heading:Oe,hr:C,html:Se,lheading:ie$2,list:Pe,newline:xe,paragraph:oe,table:E,text:we},re$1=h$1("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",C).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",v).getRegex(),_e={...K,lheading:Te,table:re$1,paragraph:h$1(F).replace("hr",C).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",re$1).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",v).getRegex()},Le={...K,html:h$1(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",U).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:E,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:h$1(F).replace("hr",C).replace("heading",` *#{1,6} *[^
33180
- ]`).replace("lheading",ie$2).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Me=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ze=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ae=/^( {2,}|\\)\n(?!\s*$)/,Ae=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,D=/[\p{P}\p{S}]/u,X=/[\s\p{P}\p{S}]/u,le=/[^\s\p{P}\p{S}]/u,Ee=h$1(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,X).getRegex(),ue=/(?!~)[\p{P}\p{S}]/u,Ce=/(?!~)[\s\p{P}\p{S}]/u,Ie=/(?:[^\s\p{P}\p{S}]|~)/u,Be=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,pe=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,qe=h$1(pe,"u").replace(/punct/g,D).getRegex(),ve=h$1(pe,"u").replace(/punct/g,ue).getRegex(),ce="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",De=h$1(ce,"gu").replace(/notPunctSpace/g,le).replace(/punctSpace/g,X).replace(/punct/g,D).getRegex(),Ze=h$1(ce,"gu").replace(/notPunctSpace/g,Ie).replace(/punctSpace/g,Ce).replace(/punct/g,ue).getRegex(),Ge=h$1("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,le).replace(/punctSpace/g,X).replace(/punct/g,D).getRegex(),He=h$1(/\\(punct)/,"gu").replace(/punct/g,D).getRegex(),Ne=h$1(/^<(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(),je=h$1(U).replace("(?:-->|$)","-->").getRegex(),Fe=h$1("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",je).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),q=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Qe=h$1(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",q).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),he=h$1(/^!?\[(label)\]\[(ref)\]/).replace("label",q).replace("ref",Q).getRegex(),de=h$1(/^!?\[(ref)\](?:\[\])?/).replace("ref",Q).getRegex(),Ue=h$1("reflink|nolink(?!\\()","g").replace("reflink",he).replace("nolink",de).getRegex(),W={_backpedal:E,anyPunctuation:He,autolink:Ne,blockSkip:Be,br:ae,code:ze,del:E,emStrongLDelim:qe,emStrongRDelimAst:De,emStrongRDelimUnd:Ge,escape:Me,link:Qe,nolink:de,punctuation:Ee,reflink:he,reflinkSearch:Ue,tag:Fe,text:Ae,url:E},Ke={...W,link:h$1(/^!?\[(label)\]\((.*?)\)/).replace("label",q).getRegex(),reflink:h$1(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",q).getRegex()},N={...W,emStrongRDelimAst:Ze,emStrongLDelim:ve,url:h$1(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Xe={...N,br:h$1(ae).replace("{2,}","*").getRegex(),text:h$1(N.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},I={normal:K,gfm:_e,pedantic:Le},M={normal:W,gfm:N,breaks:Xe,pedantic:Ke};var We={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ke=l=>We[l];function w(l,e){if(e){if(m.escapeTest.test(l))return l.replace(m.escapeReplace,ke)}else if(m.escapeTestNoEncode.test(l))return l.replace(m.escapeReplaceNoEncode,ke);return l}function J(l){try{l=encodeURI(l).replace(m.percentDecode,"%");}catch{return null}return l}function V(l,e){let t=l.replace(m.findPipe,(i,s,o)=>{let a=false,u=s;for(;--u>=0&&o[u]==="\\";)a=!a;return a?"|":" |"}),n=t.split(m.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(m.slashPipe,"|");return n}function z(l,e,t){let n=l.length;if(n===0)return "";let r=0;for(;r<n;){let i=l.charAt(n-r-1);if(i===e&&true)r++;else break}return l.slice(0,n-r)}function ge(l,e){if(l.indexOf(e[1])===-1)return -1;let t=0;for(let n=0;n<l.length;n++)if(l[n]==="\\")n++;else if(l[n]===e[0])t++;else if(l[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function fe(l,e,t,n,r){let i=e.href,s=e.title||null,o=l[1].replace(r.other.outputLinkReplace,"$1");n.state.inLink=true;let a={type:l[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:s,text:o,tokens:n.inlineTokens(o)};return n.state.inLink=false,a}function Je(l,e,t){let n=l.match(t.other.indentCodeCompensation);if(n===null)return e;let r=n[1];return e.split(`
33367
+ ]`).replace("lheading",ie$2).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Me=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ze=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ae=/^( {2,}|\\)\n(?!\s*$)/,Ae=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,D=/[\p{P}\p{S}]/u,W=/[\s\p{P}\p{S}]/u,le=/[^\s\p{P}\p{S}]/u,Ee=h$1(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,W).getRegex(),ue=/(?!~)[\p{P}\p{S}]/u,Ce=/(?!~)[\s\p{P}\p{S}]/u,Ie=/(?:[^\s\p{P}\p{S}]|~)/u,Be=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,pe=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,qe=h$1(pe,"u").replace(/punct/g,D).getRegex(),ve=h$1(pe,"u").replace(/punct/g,ue).getRegex(),ce="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",De=h$1(ce,"gu").replace(/notPunctSpace/g,le).replace(/punctSpace/g,W).replace(/punct/g,D).getRegex(),Ze=h$1(ce,"gu").replace(/notPunctSpace/g,Ie).replace(/punctSpace/g,Ce).replace(/punct/g,ue).getRegex(),Ge=h$1("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,le).replace(/punctSpace/g,W).replace(/punct/g,D).getRegex(),He=h$1(/\\(punct)/,"gu").replace(/punct/g,D).getRegex(),Ne=h$1(/^<(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(),je=h$1(U).replace("(?:-->|$)","-->").getRegex(),Fe=h$1("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",je).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),q=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Qe=h$1(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",q).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),he=h$1(/^!?\[(label)\]\[(ref)\]/).replace("label",q).replace("ref",Q).getRegex(),de=h$1(/^!?\[(ref)\](?:\[\])?/).replace("ref",Q).getRegex(),Ue=h$1("reflink|nolink(?!\\()","g").replace("reflink",he).replace("nolink",de).getRegex(),X={_backpedal:E,anyPunctuation:He,autolink:Ne,blockSkip:Be,br:ae,code:ze,del:E,emStrongLDelim:qe,emStrongRDelimAst:De,emStrongRDelimUnd:Ge,escape:Me,link:Qe,nolink:de,punctuation:Ee,reflink:he,reflinkSearch:Ue,tag:Fe,text:Ae,url:E},Ke={...X,link:h$1(/^!?\[(label)\]\((.*?)\)/).replace("label",q).getRegex(),reflink:h$1(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",q).getRegex()},N={...X,emStrongRDelimAst:Ze,emStrongLDelim:ve,url:h$1(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},We={...N,br:h$1(ae).replace("{2,}","*").getRegex(),text:h$1(N.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},I={normal:K,gfm:_e,pedantic:Le},M={normal:X,gfm:N,breaks:We,pedantic:Ke};var Xe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ke=l=>Xe[l];function w(l,e){if(e){if(m.escapeTest.test(l))return l.replace(m.escapeReplace,ke)}else if(m.escapeTestNoEncode.test(l))return l.replace(m.escapeReplaceNoEncode,ke);return l}function J(l){try{l=encodeURI(l).replace(m.percentDecode,"%");}catch{return null}return l}function V(l,e){let t=l.replace(m.findPipe,(i,s,o)=>{let a=false,u=s;for(;--u>=0&&o[u]==="\\";)a=!a;return a?"|":" |"}),n=t.split(m.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(m.slashPipe,"|");return n}function z(l,e,t){let n=l.length;if(n===0)return "";let r=0;for(;r<n;){let i=l.charAt(n-r-1);if(i===e&&true)r++;else break}return l.slice(0,n-r)}function ge(l,e){if(l.indexOf(e[1])===-1)return -1;let t=0;for(let n=0;n<l.length;n++)if(l[n]==="\\")n++;else if(l[n]===e[0])t++;else if(l[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function fe(l,e,t,n,r){let i=e.href,s=e.title||null,o=l[1].replace(r.other.outputLinkReplace,"$1");n.state.inLink=true;let a={type:l[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:s,text:o,tokens:n.inlineTokens(o)};return n.state.inLink=false,a}function Je(l,e,t){let n=l.match(t.other.indentCodeCompensation);if(n===null)return e;let r=n[1];return e.split(`
33181
33368
  `).map(i=>{let s=i.match(t.other.beginningSpace);if(s===null)return i;let[o]=s;return o.length>=r.length?i.slice(r.length):i}).join(`
33182
33369
  `)}var y=class{options;rules;lexer;constructor(e){this.options=e||O;}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return {type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return {type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:z(n,`
33183
33370
  `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=Je(n,t[3]||"",this.rules);return {type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let r=z(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim());}return {type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return {type:"hr",raw:z(t[0],`
@@ -33203,14 +33390,18 @@ ${c}`:c;let f=this.lexer.state.top;if(this.lexer.state.top=true,this.lexer.block
33203
33390
  `):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let o of r)this.rules.other.tableAlignRight.test(o)?s.align.push("right"):this.rules.other.tableAlignCenter.test(o)?s.align.push("center"):this.rules.other.tableAlignLeft.test(o)?s.align.push("left"):s.align.push(null);for(let o=0;o<n.length;o++)s.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:true,align:s.align[o]});for(let o of i)s.rows.push(V(o,s.header.length).map((a,u)=>({text:a,tokens:this.lexer.inline(a),header:false,align:s.align[u]})));return s}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return {type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
33204
33391
  `?t[1].slice(0,-1):t[1];return {type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return {type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return {type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return !this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=true:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=false),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=true:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=false),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:false,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let s=z(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else {let s=ge(t[2],"()");if(s===-2)return;if(s>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,a).trim(),t[3]="";}}let r=t[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3]);}else i=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),fe(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[r.toLowerCase()];if(!i){let s=n[0].charAt(0);return {type:"text",raw:s,text:s}}return fe(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(r[1]||r[2]||"")||!n||this.rules.inline.punctuation.exec(n)){let s=[...r[0]].length-1,o,a,u=s,p=0,c=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+s);(r=c.exec(t))!=null;){if(o=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!o)continue;if(a=[...o].length,r[3]||r[4]){u+=a;continue}else if((r[5]||r[6])&&s%3&&!((s+a)%3)){p+=a;continue}if(u-=a,u>0)continue;a=Math.min(a,a+u+p);let f=[...r[0]][0].length,k=e.slice(0,s+r.index+f+a);if(Math.min(s,a)%2){let g=k.slice(1,-1);return {type:"em",raw:k,text:g,tokens:this.lexer.inlineTokens(g)}}let x=k.slice(2,-2);return {type:"strong",raw:k,text:x,tokens:this.lexer.inlineTokens(x)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return {type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return {type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,r;if(t[2]==="@")n=t[0],r="mailto:"+n;else {let i;do i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(i!==t[0]);n=t[0],t[1]==="www."?r="http://"+t[0]:r=t[0];}return {type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return {type:"text",raw:t[0],text:t[0],escaped:n}}}};var b=class l{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||O,this.options.tokenizer=this.options.tokenizer||new y,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:false,inRawBlock:false,top:true};let t={other:m,block:I.normal,inline:M.normal};this.options.pedantic?(t.block=I.pedantic,t.inline=M.pedantic):this.options.gfm&&(t.block=I.gfm,this.options.breaks?t.inline=M.breaks:t.inline=M.gfm),this.tokenizer.rules=t;}static get rules(){return {block:I,inline:M}}static lex(e,t){return new l(t).lex(e)}static lexInline(e,t){return new l(t).inlineTokens(e)}lex(e){e=e.replace(m.carriageReturn,`
33205
33392
  `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens);}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=false){for(this.options.pedantic&&(e=e.replace(m.tabCharGlobal," ").replace(m.spaceLine,""));e;){let r;if(this.options.extensions?.block?.some(s=>(r=s.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),true):false))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let s=t.at(-1);r.raw.length===1&&s!==void 0?s.raw+=`
33206
- `:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let s=t.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=`
33207
- `+r.raw,s.text+=`
33208
- `+r.text,this.inlineQueue.at(-1).src=s.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let s=t.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=`
33209
- `+r.raw,s.text+=`
33210
- `+r.raw,this.inlineQueue.at(-1).src=s.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title});continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let s=1/0,o=e.slice(1),a;this.options.extensions.startBlock.forEach(u=>{a=u.call({lexer:this},o),typeof a=="number"&&a>=0&&(s=Math.min(s,a));}),s<1/0&&s>=0&&(i=e.substring(0,s+1));}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let s=t.at(-1);n&&s?.type==="paragraph"?(s.raw+=`
33211
- `+r.raw,s.text+=`
33212
- `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let s=t.at(-1);s?.type==="text"?(s.raw+=`
33213
- `+r.raw,s.text+=`
33393
+ `:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let s=t.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(`
33394
+ `)?"":`
33395
+ `)+r.raw,s.text+=`
33396
+ `+r.text,this.inlineQueue.at(-1).src=s.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let s=t.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(`
33397
+ `)?"":`
33398
+ `)+r.raw,s.text+=`
33399
+ `+r.raw,this.inlineQueue.at(-1).src=s.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title});continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let s=1/0,o=e.slice(1),a;this.options.extensions.startBlock.forEach(u=>{a=u.call({lexer:this},o),typeof a=="number"&&a>=0&&(s=Math.min(s,a));}),s<1/0&&s>=0&&(i=e.substring(0,s+1));}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let s=t.at(-1);n&&s?.type==="paragraph"?(s.raw+=(s.raw.endsWith(`
33400
+ `)?"":`
33401
+ `)+r.raw,s.text+=`
33402
+ `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let s=t.at(-1);s?.type==="text"?(s.raw+=(s.raw.endsWith(`
33403
+ `)?"":`
33404
+ `)+r.raw,s.text+=`
33214
33405
  `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):t.push(r);continue}if(e){let s="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(s);break}else throw new Error(s)}}return this.state.top=true,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let o=Object.keys(this.tokens.links);if(o.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)o.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=false,s="";for(;e;){i||(s=""),i=false;let o;if(this.options.extensions?.inline?.some(u=>(o=u.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),true):false))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let u=t.at(-1);o.type==="text"&&u?.type==="text"?(u.raw+=o.raw,u.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,s)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let a=e;if(this.options.extensions?.startInline){let u=1/0,p=e.slice(1),c;this.options.extensions.startInline.forEach(f=>{c=f.call({lexer:this},p),typeof c=="number"&&c>=0&&(u=Math.min(u,c));}),u<1/0&&u>=0&&(a=e.substring(0,u+1));}if(o=this.tokenizer.inlineText(a)){e=e.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(s=o.raw.slice(-1)),i=true;let u=t.at(-1);u?.type==="text"?(u.raw+=o.raw,u.text+=o.text):t.push(o);continue}if(e){let u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return t}};var P=class{options;parser;constructor(e){this.options=e||O;}space(e){return ""}code({text:e,lang:t,escaped:n}){let r=(t||"").match(m.notSpaceStart)?.[0],i=e.replace(m.endingNewline,"")+`
33215
33406
  `;return r?'<pre><code class="language-'+w(r)+'">'+(n?i:w(i,true))+`</code></pre>
33216
33407
  `:"<pre><code>"+(n?i:w(i,true))+`</code></pre>
@@ -49689,10 +49880,10 @@ function sinkListItem$1(itemType) {
49689
49880
  };
49690
49881
  }
49691
49882
 
49692
- var __defProp$2 = Object.defineProperty;
49883
+ var __defProp$3 = Object.defineProperty;
49693
49884
  var __export$1 = (target, all) => {
49694
49885
  for (var name in all)
49695
- __defProp$2(target, name, { get: all[name], enumerable: true });
49886
+ __defProp$3(target, name, { get: all[name], enumerable: true });
49696
49887
  };
49697
49888
 
49698
49889
  // src/helpers/createChainableState.ts
@@ -57154,10 +57345,10 @@ var Link = Mark.create({
57154
57345
  }
57155
57346
  });
57156
57347
 
57157
- var __defProp$1 = Object.defineProperty;
57348
+ var __defProp$2 = Object.defineProperty;
57158
57349
  var __export = (target, all) => {
57159
57350
  for (var name in all)
57160
- __defProp$1(target, name, { get: all[name], enumerable: true });
57351
+ __defProp$2(target, name, { get: all[name], enumerable: true });
57161
57352
  };
57162
57353
  var ListItemName = "listItem";
57163
57354
  var TextStyleName = "textStyle";
@@ -57660,11 +57851,11 @@ var TaskItem = Node3.create({
57660
57851
  const checkboxStyler = document.createElement("span");
57661
57852
  const checkbox = document.createElement("input");
57662
57853
  const content = document.createElement("div");
57663
- const updateA11Y = () => {
57854
+ const updateA11Y = (currentNode) => {
57664
57855
  var _a, _b;
57665
- checkbox.ariaLabel = ((_b = (_a = this.options.a11y) == null ? void 0 : _a.checkboxLabel) == null ? void 0 : _b.call(_a, node, checkbox.checked)) || `Task item checkbox for ${node.textContent || "empty task item"}`;
57856
+ checkbox.ariaLabel = ((_b = (_a = this.options.a11y) == null ? void 0 : _a.checkboxLabel) == null ? void 0 : _b.call(_a, currentNode, checkbox.checked)) || `Task item checkbox for ${currentNode.textContent || "empty task item"}`;
57666
57857
  };
57667
- updateA11Y();
57858
+ updateA11Y(node);
57668
57859
  checkboxWrapper.contentEditable = "false";
57669
57860
  checkbox.type = "checkbox";
57670
57861
  checkbox.addEventListener("mousedown", (event) => event.preventDefault());
@@ -57713,7 +57904,7 @@ var TaskItem = Node3.create({
57713
57904
  }
57714
57905
  listItem.dataset.checked = updatedNode.attrs.checked;
57715
57906
  checkbox.checked = updatedNode.attrs.checked;
57716
- updateA11Y();
57907
+ updateA11Y(updatedNode);
57717
57908
  return true;
57718
57909
  }
57719
57910
  };
@@ -61953,7 +62144,7 @@ Extension.create({
61953
62144
  const ButtonLikeLink = Node3.create({
61954
62145
  name: "buttonLikeLink",
61955
62146
  group: "block",
61956
- content: "inline*",
62147
+ content: "paragraph+",
61957
62148
  defining: true,
61958
62149
  addAttributes() {
61959
62150
  return {
@@ -61964,14 +62155,14 @@ const ButtonLikeLink = Node3.create({
61964
62155
  parseHTML() {
61965
62156
  return [
61966
62157
  {
61967
- tag: 'div[data-bgc-style="button"]:has(> a[href] > span)',
62158
+ tag: 'div[data-bgc-style="button"]:has(> a[href] > div)',
61968
62159
  getAttrs: (node) => {
61969
62160
  return {
61970
62161
  href: node.querySelector("a")?.getAttribute("href")
61971
62162
  };
61972
62163
  },
61973
62164
  contentElement(node) {
61974
- return node.querySelector("span") ?? node;
62165
+ return node.querySelector("a[href] > div") ?? node;
61975
62166
  }
61976
62167
  }
61977
62168
  ];
@@ -61985,7 +62176,7 @@ const ButtonLikeLink = Node3.create({
61985
62176
  {
61986
62177
  href: HTMLAttributes.href
61987
62178
  },
61988
- ["span", {}, 0]
62179
+ ["div", {}, 0]
61989
62180
  ]
61990
62181
  ];
61991
62182
  },
@@ -62007,7 +62198,7 @@ const ButtonLikeLink = Node3.create({
62007
62198
  if (hasLinkElement) {
62008
62199
  return false;
62009
62200
  }
62010
- return chain().toggleNode(this.name, "paragraph", attributes).run();
62201
+ return chain().toggleWrap(this.name, attributes).run();
62011
62202
  }
62012
62203
  };
62013
62204
  }
@@ -62318,19 +62509,399 @@ const BgeWysiwygEditorKit = Extension.create({
62318
62509
  }
62319
62510
  });
62320
62511
 
62512
+ function createElement(options, global = window) {
62513
+ const document = global.document;
62514
+ const wrapperElement = document.createElement(options.tag ?? "div");
62515
+ if (options.attributes) {
62516
+ for (const [key, value] of Object.entries(options.attributes)) {
62517
+ wrapperElement.setAttribute(key, value);
62518
+ }
62519
+ }
62520
+ if (options.className) {
62521
+ wrapperElement.className = options.className;
62522
+ }
62523
+ return wrapperElement;
62524
+ }
62525
+
62526
+ var __defProp$1 = Object.defineProperty;
62527
+ var __typeError$1 = (msg) => {
62528
+ throw TypeError(msg);
62529
+ };
62530
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
62531
+ var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
62532
+ var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
62533
+ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
62534
+ var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
62535
+ var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
62536
+ var __privateMethod = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
62537
+ var _editor, _editorRoot, _previewStyle, _textarea, _textareaDescriptor, _BgeWysiwygElement_instances, setToTextarea_fn, transaction_fn;
62538
+ function defineBgeWysiwygElement(options, global = window) {
62539
+ if (options?.extensions) {
62540
+ BgeWysiwygElement.extensions = options.extensions;
62541
+ }
62542
+ if (options?.wrapperElement) {
62543
+ BgeWysiwygElement.wrapperElement = options.wrapperElement;
62544
+ }
62545
+ const tagName = `bge-wysiwyg`;
62546
+ if (!global.customElements.get(tagName)) {
62547
+ global.customElements.define(tagName, BgeWysiwygElement);
62548
+ }
62549
+ }
62550
+ const _BgeWysiwygElement = class _BgeWysiwygElement extends HTMLElement {
62551
+ constructor() {
62552
+ super();
62553
+ __privateAdd$1(this, _BgeWysiwygElement_instances);
62554
+ __privateAdd$1(this, _editor, null);
62555
+ __privateAdd$1(this, _editorRoot, null);
62556
+ __privateAdd$1(this, _previewStyle, null);
62557
+ __privateAdd$1(this, _textarea, null);
62558
+ __privateAdd$1(this, _textareaDescriptor, null);
62559
+ this.attachShadow({ mode: "open" });
62560
+ if (!this.shadowRoot) {
62561
+ throw new Error("Not supported shadow DOM");
62562
+ }
62563
+ }
62564
+ get value() {
62565
+ return __privateGet$1(this, _textarea)?.value ?? "";
62566
+ }
62567
+ set value(value) {
62568
+ if (!__privateGet$1(this, _textarea)) {
62569
+ throw new ReferenceError("<bge-wysiwyg> is not connected");
62570
+ }
62571
+ __privateGet$1(this, _textarea).value = value;
62572
+ }
62573
+ get editor() {
62574
+ if (!__privateGet$1(this, _editor)) {
62575
+ throw new ReferenceError("<bge-wysiwyg> is not connected");
62576
+ }
62577
+ return __privateGet$1(this, _editor);
62578
+ }
62579
+ set mode(mode) {
62580
+ if (!__privateGet$1(this, _editor) || !__privateGet$1(this, _textarea)) {
62581
+ return;
62582
+ }
62583
+ this.shadowRoot.querySelector(`[data-bge-mode]`)?.setAttribute(
62584
+ "data-bge-mode",
62585
+ mode
62586
+ );
62587
+ if (mode === "wysiwyg") {
62588
+ __privateGet$1(this, _editor).commands.setContent(__privateGet$1(this, _textarea).value);
62589
+ }
62590
+ }
62591
+ connectedCallback() {
62592
+ if (!this.shadowRoot) {
62593
+ throw new Error("Not supported shadow DOM");
62594
+ }
62595
+ const initialValue = this.innerHTML.trim();
62596
+ const label = this.getAttribute("label") ?? "\u5185\u5BB9";
62597
+ const itemName = this.getAttribute("item-name");
62598
+ this.shadowRoot.innerHTML = `<div data-bge-mode="wysiwyg"><iframe></iframe><textarea aria-label="${label} HTML"></textarea></div>`;
62599
+ const preview = this.shadowRoot.querySelector("iframe");
62600
+ if (!preview || !preview.contentWindow || !preview.contentDocument) {
62601
+ throw new Error("Not supported iframe in shadow DOM");
62602
+ }
62603
+ __privateSet$1(this, _editorRoot, preview.contentDocument.createElement("div"));
62604
+ preview.contentDocument.body.append(__privateGet$1(this, _editorRoot));
62605
+ __privateSet$1(this, _previewStyle, preview.contentDocument.createElement("style"));
62606
+ preview.contentDocument.head.append(__privateGet$1(this, _previewStyle));
62607
+ const textarea = this.shadowRoot.querySelector("textarea");
62608
+ const controlUIStyle = document.createElement("style");
62609
+ this.shadowRoot.append(controlUIStyle);
62610
+ controlUIStyle.textContent = `
62611
+ :host {
62612
+ display: block;
62613
+ }
62614
+
62615
+ textarea,
62616
+ iframe {
62617
+ block-size: 50svh;
62618
+ inline-size: 100%;
62619
+ resize: vertical;
62620
+ overflow-y: auto;
62621
+ background: var(--bge-lightest-color);
62622
+ border: 1px solid var(--bge-border-color);
62623
+ border-radius: var(--border-radius);
62624
+ }
62625
+
62626
+ iframe[data-focus-within="true"],
62627
+ textarea:focus-visible {
62628
+ --bge-border-color: var(--bge-ui-primary-color);
62629
+ --bge-outline-color: var(--bge-ui-primary-color);
62630
+ outline: var(--bge-focus-outline-width) solid var(--bge-outline-color);
62631
+ }
62632
+
62633
+ textarea {
62634
+ font-family: var(--bge-font-family-monospace);
62635
+ }
62636
+
62637
+ [data-bge-mode="wysiwyg"] textarea {
62638
+ display: none;
62639
+ }
62640
+
62641
+ [data-bge-mode="html"] iframe {
62642
+ display: none;
62643
+ }
62644
+ `;
62645
+ preview.contentDocument.body.addEventListener("focusin", () => {
62646
+ preview.dataset.focusWithin = "true";
62647
+ });
62648
+ preview.contentDocument.body.addEventListener("focusout", () => {
62649
+ delete preview.dataset.focusWithin;
62650
+ });
62651
+ if (_BgeWysiwygElement.wrapperElement) {
62652
+ const wrapperElement = createElement(
62653
+ _BgeWysiwygElement.wrapperElement,
62654
+ preview.contentWindow
62655
+ );
62656
+ __privateGet$1(this, _editorRoot).after(wrapperElement);
62657
+ wrapperElement.append(__privateGet$1(this, _editorRoot));
62658
+ }
62659
+ if (!textarea) {
62660
+ throw new Error("Not supported textarea in shadow DOM");
62661
+ }
62662
+ __privateSet$1(this, _textarea, textarea);
62663
+ const extensions = [
62664
+ index_default.configure({
62665
+ link: {
62666
+ HTMLAttributes: {
62667
+ target: null,
62668
+ rel: null
62669
+ }
62670
+ }
62671
+ }),
62672
+ BgeWysiwygEditorKit
62673
+ ];
62674
+ if (_BgeWysiwygElement.extensions) {
62675
+ extensions.push(..._BgeWysiwygElement.extensions);
62676
+ }
62677
+ __privateSet$1(this, _editor, new Editor({
62678
+ element: __privateGet$1(this, _editorRoot),
62679
+ extensions,
62680
+ autofocus: this.hasAttribute("autofocus"),
62681
+ onTransaction: ({ editor }) => {
62682
+ const data = __privateMethod(this, _BgeWysiwygElement_instances, transaction_fn).call(this, editor);
62683
+ this.dispatchEvent(
62684
+ new CustomEvent("transaction", {
62685
+ detail: data,
62686
+ bubbles: true,
62687
+ composed: true
62688
+ })
62689
+ );
62690
+ },
62691
+ onUpdate: () => {
62692
+ this.syncWysiwygToTextarea();
62693
+ }
62694
+ }));
62695
+ if (itemName) {
62696
+ __privateGet$1(this, _editorRoot).dataset.bgi = itemName;
62697
+ }
62698
+ __privateSet$1(this, _textareaDescriptor, Object.getOwnPropertyDescriptor(
62699
+ HTMLTextAreaElement.prototype,
62700
+ "value"
62701
+ ));
62702
+ Object.defineProperty(__privateGet$1(this, _textarea), "value", {
62703
+ get: () => {
62704
+ return __privateGet$1(this, _textareaDescriptor)?.get?.call(__privateGet$1(this, _textarea)) ?? "";
62705
+ },
62706
+ set: (value) => {
62707
+ __privateGet$1(this, _editor)?.commands.setContent(value);
62708
+ }
62709
+ });
62710
+ if (initialValue) {
62711
+ __privateGet$1(this, _textarea).value = initialValue;
62712
+ }
62713
+ }
62714
+ isActive(name) {
62715
+ return this.editor.isActive(name) ?? false;
62716
+ }
62717
+ setStyle(css) {
62718
+ if (!__privateGet$1(this, _previewStyle)) {
62719
+ throw new ReferenceError("<bge-wysiwyg> is not connected");
62720
+ }
62721
+ __privateGet$1(this, _previewStyle).textContent = `
62722
+ :where(html, body) {
62723
+ margin: 0;
62724
+ padding: 0;
62725
+
62726
+ :where(&, *) {
62727
+ box-sizing: border-box;
62728
+ }
62729
+ }
62730
+
62731
+ iframe,
62732
+ [contenteditable] {
62733
+ padding: 1rem;
62734
+ block-size: 100%;
62735
+ box-sizing: border-box;
62736
+ }
62737
+
62738
+ [contenteditable]:focus-visible {
62739
+ outline: none;
62740
+ }
62741
+
62742
+ ${css}
62743
+
62744
+ a:any-link {
62745
+ pointer-events: none !important;
62746
+ }
62747
+ `;
62748
+ }
62749
+ syncWysiwygToTextarea() {
62750
+ let html = this.editor.getHTML();
62751
+ html = html.replaceAll("<p></p>", "");
62752
+ __privateMethod(this, _BgeWysiwygElement_instances, setToTextarea_fn).call(this, html);
62753
+ }
62754
+ toggleBlockquote() {
62755
+ this.editor.chain().focus().toggleBlockquote().run();
62756
+ }
62757
+ toggleBold() {
62758
+ this.editor.chain().focus().toggleBold().run();
62759
+ }
62760
+ toggleBulletList() {
62761
+ this.editor.chain().focus().toggleBulletList().run();
62762
+ }
62763
+ toggleButtonLikeLink(options) {
62764
+ this.editor.chain().focus().toggleButtonLikeLink(options).run();
62765
+ }
62766
+ toggleCode() {
62767
+ this.editor.chain().focus().toggleCode().run();
62768
+ }
62769
+ toggleFlexBox() {
62770
+ this.editor.chain().focus().toggleFlexBox().run();
62771
+ }
62772
+ toggleHeading(level) {
62773
+ this.editor.chain().focus().toggleHeading({ level }).run();
62774
+ }
62775
+ toggleItalic() {
62776
+ this.editor.chain().focus().toggleItalic().run();
62777
+ }
62778
+ toggleLink(options) {
62779
+ this.editor.chain().focus().toggleLink(options).run();
62780
+ }
62781
+ toggleNote() {
62782
+ this.editor.chain().focus().toggleNote().run();
62783
+ }
62784
+ toggleOrderedList() {
62785
+ this.editor.chain().focus().toggleOrderedList().run();
62786
+ }
62787
+ toggleStrike() {
62788
+ this.editor.chain().focus().toggleStrike().run();
62789
+ }
62790
+ toggleUnderline() {
62791
+ this.editor.chain().focus().toggleUnderline().run();
62792
+ }
62793
+ };
62794
+ _editor = new WeakMap();
62795
+ _editorRoot = new WeakMap();
62796
+ _previewStyle = new WeakMap();
62797
+ _textarea = new WeakMap();
62798
+ _textareaDescriptor = new WeakMap();
62799
+ _BgeWysiwygElement_instances = new WeakSet();
62800
+ setToTextarea_fn = function(html) {
62801
+ if (!__privateGet$1(this, _textarea) || !__privateGet$1(this, _textareaDescriptor)) {
62802
+ throw new ReferenceError("<bge-wysiwyg> is not connected");
62803
+ }
62804
+ __privateGet$1(this, _textareaDescriptor).set?.call(__privateGet$1(this, _textarea), html);
62805
+ };
62806
+ transaction_fn = function(editor) {
62807
+ const data = {
62808
+ state: {
62809
+ bold: {
62810
+ disabled: !editor.can().chain().focus().toggleBold().run(),
62811
+ active: editor.isActive("bold")
62812
+ },
62813
+ italic: {
62814
+ disabled: !editor.can().chain().focus().toggleItalic().run(),
62815
+ active: editor.isActive("italic")
62816
+ },
62817
+ underline: {
62818
+ disabled: !editor.can().chain().focus().toggleUnderline().run(),
62819
+ active: editor.isActive("underline")
62820
+ },
62821
+ strike: {
62822
+ disabled: !editor.can().chain().focus().toggleStrike().run(),
62823
+ active: editor.isActive("strike")
62824
+ },
62825
+ code: {
62826
+ disabled: !editor.can().chain().focus().toggleCode().run(),
62827
+ active: editor.isActive("code")
62828
+ },
62829
+ link: {
62830
+ disabled: !editor.can().chain().focus().toggleLink().run(),
62831
+ active: editor.isActive("link")
62832
+ },
62833
+ buttonLikeLink: {
62834
+ disabled: !editor.can().chain().focus().toggleButtonLikeLink().run(),
62835
+ active: editor.isActive("buttonLikeLink")
62836
+ },
62837
+ blockquote: {
62838
+ disabled: !editor.can().chain().focus().toggleBlockquote().run(),
62839
+ active: editor.isActive("blockquote")
62840
+ },
62841
+ bulletList: {
62842
+ disabled: !editor.can().chain().focus().toggleBulletList().run(),
62843
+ active: editor.isActive("bulletList")
62844
+ },
62845
+ orderedList: {
62846
+ disabled: !editor.can().chain().focus().toggleOrderedList().run(),
62847
+ active: editor.isActive("orderedList")
62848
+ },
62849
+ note: {
62850
+ disabled: !editor.can().chain().focus().toggleNote().run(),
62851
+ active: editor.isActive("note")
62852
+ },
62853
+ h1: {
62854
+ disabled: !editor.can().chain().focus().toggleHeading({ level: 1 }).run(),
62855
+ active: editor.isActive("heading", { level: 1 })
62856
+ },
62857
+ h2: {
62858
+ disabled: !editor.can().chain().focus().toggleHeading({ level: 2 }).run(),
62859
+ active: editor.isActive("heading", { level: 2 })
62860
+ },
62861
+ h3: {
62862
+ disabled: !editor.can().chain().focus().toggleHeading({ level: 3 }).run(),
62863
+ active: editor.isActive("heading", { level: 3 })
62864
+ },
62865
+ h4: {
62866
+ disabled: !editor.can().chain().focus().toggleHeading({ level: 4 }).run(),
62867
+ active: editor.isActive("heading", { level: 4 })
62868
+ },
62869
+ h5: {
62870
+ disabled: !editor.can().chain().focus().toggleHeading({ level: 5 }).run(),
62871
+ active: editor.isActive("heading", { level: 5 })
62872
+ },
62873
+ h6: {
62874
+ disabled: !editor.can().chain().focus().toggleHeading({ level: 6 }).run(),
62875
+ active: editor.isActive("heading", { level: 6 })
62876
+ },
62877
+ flexBox: {
62878
+ disabled: !editor.can().chain().focus().toggleFlexBox().run(),
62879
+ active: editor.isActive("flexBox")
62880
+ }
62881
+ }
62882
+ };
62883
+ return data;
62884
+ };
62885
+ __publicField$1(_BgeWysiwygElement, "extensions", null);
62886
+ __publicField$1(_BgeWysiwygElement, "wrapperElement", null);
62887
+ let BgeWysiwygElement = _BgeWysiwygElement;
62888
+
62321
62889
  var __defProp = Object.defineProperty;
62322
62890
  var __typeError = (msg) => {
62323
62891
  throw TypeError(msg);
62324
62892
  };
62325
62893
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
62326
- var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
62894
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
62327
62895
  var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
62328
62896
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
62329
62897
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
62330
62898
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
62331
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
62332
- var _editor, _editorRoot, _style, _textarea, _textareaDescriptor, _tiptapStyle, _BgeWysiwygEditorElement_instances, setToTextarea_fn;
62333
- function defineBgeWysiwygEditorElement(extension, global = window) {
62899
+ var _wysiwygElement;
62900
+ function defineBgeWysiwygEditorElement(options, global = window) {
62901
+ defineBgeWysiwygElement(options, global);
62902
+ if (options?.wrapperElement) {
62903
+ BgeWysiwygEditorElement.wrapperElement = options.wrapperElement;
62904
+ }
62334
62905
  const tagName = `bge-wysiwyg-editor`;
62335
62906
  if (!global.customElements.get(tagName)) {
62336
62907
  global.customElements.define(tagName, BgeWysiwygEditorElement);
@@ -62339,38 +62910,16 @@ function defineBgeWysiwygEditorElement(extension, global = window) {
62339
62910
  const _BgeWysiwygEditorElement = class _BgeWysiwygEditorElement extends HTMLElement {
62340
62911
  constructor() {
62341
62912
  super();
62342
- __privateAdd(this, _BgeWysiwygEditorElement_instances);
62343
- __privateAdd(this, _editor);
62344
- __privateAdd(this, _editorRoot);
62345
- __privateAdd(this, _style);
62346
- __privateAdd(this, _textarea);
62347
- __privateAdd(this, _textareaDescriptor);
62348
- __privateAdd(this, _tiptapStyle);
62913
+ __privateAdd(this, _wysiwygElement, null);
62349
62914
  const initialValue = this.innerHTML.trim();
62350
- this.attachShadow({ mode: "open" });
62351
62915
  const label = this.getAttribute("label") ?? "\u5185\u5BB9";
62916
+ const itemName = this.getAttribute("item-name");
62352
62917
  const commands = (
62353
62918
  // Get commands from attribute
62354
62919
  this.getAttribute("commands")?.split(",").map((command) => command.trim().toLowerCase()) ?? // Default commands
62355
- [
62356
- "bold",
62357
- "italic",
62358
- "underline",
62359
- "strikethrough",
62360
- "link",
62361
- "button-like-link",
62362
- "blockquote",
62363
- "bullet-list",
62364
- "ordered-list",
62365
- "note",
62366
- "h3",
62367
- "h4",
62368
- "h5",
62369
- "h6",
62370
- "flex-box"
62371
- ]
62920
+ _BgeWysiwygEditorElement.defaultCommands
62372
62921
  );
62373
- this.shadowRoot.innerHTML = `
62922
+ this.innerHTML = `
62374
62923
  <fieldset>
62375
62924
  <legend>${label}</legend>
62376
62925
  <div data-bge-toolbar>
@@ -62398,281 +62947,136 @@ const _BgeWysiwygEditorElement = class _BgeWysiwygEditorElement extends HTMLElem
62398
62947
  <button type="button" data-bge-toolbar-button="html-mode">HTML Mode</button>
62399
62948
  </div>
62400
62949
  </div>
62401
- <div data-bge-mode="wysiwyg">
62402
- <div data-bge-preview><div data-bge-editor-root></div></div>
62403
- <textarea aria-label="${label} HTML"></textarea>
62404
- </div>
62950
+ <bge-wysiwyg ${itemName ? `item-name="${itemName}"` : ""}>
62951
+ ${initialValue}
62952
+ </bge-wysiwyg>
62405
62953
  </fieldset>
62406
62954
  `;
62407
- __privateSet(this, _style, document.createElement("style"));
62408
- this.shadowRoot.append(__privateGet(this, _style));
62409
- __privateSet(this, _editorRoot, this.shadowRoot.querySelector("[data-bge-editor-root]"));
62410
- __privateGet(this, _editorRoot).dataset.bgi = this.getAttribute("item-name") ?? "";
62411
- __privateSet(this, _textarea, this.shadowRoot.querySelector("textarea"));
62412
- const buttons = this.shadowRoot.querySelectorAll(
62413
- "[data-bge-toolbar-button]"
62955
+ const innerHTMLDescriptor = Object.getOwnPropertyDescriptor(
62956
+ Element.prototype,
62957
+ "innerHTML"
62414
62958
  );
62415
- for (const button of buttons) {
62416
- button.addEventListener("click", () => bindToggle(button, editor));
62417
- }
62418
- const extensions = [
62419
- index_default.configure({
62420
- link: {
62421
- HTMLAttributes: {
62422
- target: null,
62423
- rel: null
62424
- }
62959
+ Object.defineProperty(this, "innerHTML", {
62960
+ configurable: true,
62961
+ enumerable: true,
62962
+ get() {
62963
+ return innerHTMLDescriptor.get.call(this);
62964
+ },
62965
+ set: (value) => {
62966
+ if (!__privateGet(this, _wysiwygElement)) {
62967
+ throw new ReferenceError("<bge-wysiwyg-editor> is not connected");
62425
62968
  }
62426
- }),
62427
- BgeWysiwygEditorKit
62428
- ];
62429
- if (_BgeWysiwygEditorElement.extension) {
62430
- extensions.push(_BgeWysiwygEditorElement.extension);
62969
+ __privateGet(this, _wysiwygElement).value = value;
62970
+ }
62971
+ });
62972
+ }
62973
+ get editor() {
62974
+ if (!__privateGet(this, _wysiwygElement)) {
62975
+ throw new ReferenceError("<bge-wysiwyg-editor> is not connected");
62431
62976
  }
62432
- const editor = new Editor({
62433
- element: __privateGet(this, _editorRoot),
62434
- extensions,
62435
- autofocus: this.hasAttribute("autofocus"),
62436
- onTransaction: ({ editor: editor2 }) => {
62437
- for (const button of buttons) {
62438
- bindPressed(button, editor2);
62977
+ return __privateGet(this, _wysiwygElement).editor;
62978
+ }
62979
+ get name() {
62980
+ return this.getAttribute("name") ?? "";
62981
+ }
62982
+ get value() {
62983
+ if (!__privateGet(this, _wysiwygElement)) {
62984
+ throw new ReferenceError("<bge-wysiwyg-editor> is not connected");
62985
+ }
62986
+ return __privateGet(this, _wysiwygElement).value;
62987
+ }
62988
+ connectedCallback() {
62989
+ __privateSet(this, _wysiwygElement, this.querySelector("bge-wysiwyg"));
62990
+ if (!__privateGet(this, _wysiwygElement)) {
62991
+ throw new Error("bge-wysiwyg-editor is not connected");
62992
+ }
62993
+ const buttons = this.querySelectorAll("[data-bge-toolbar-button]");
62994
+ for (const button of buttons) {
62995
+ button.addEventListener("click", () => {
62996
+ if (!__privateGet(this, _wysiwygElement)) {
62997
+ throw new ReferenceError("<bge-wysiwyg-editor> is not connected");
62439
62998
  }
62440
- },
62441
- onUpdate: () => {
62442
- this.syncWysiwygToTextarea();
62999
+ bindToggle(button, __privateGet(this, _wysiwygElement));
63000
+ });
63001
+ }
63002
+ __privateGet(this, _wysiwygElement).addEventListener("transaction", (event) => {
63003
+ for (const button of buttons) {
63004
+ updateButtonState(button, event.detail.state);
62443
63005
  }
62444
63006
  });
62445
- const htmlModeButton = this.shadowRoot.querySelector(
63007
+ const htmlModeButton = this.querySelector(
62446
63008
  '[data-bge-toolbar-button="html-mode"]'
62447
63009
  );
62448
63010
  htmlModeButton.addEventListener("click", () => {
62449
63011
  htmlModeButton.ariaPressed = htmlModeButton.ariaPressed === "true" ? "false" : "true";
62450
63012
  const mode = htmlModeButton.ariaPressed === "true" ? "html" : "wysiwyg";
62451
- this.shadowRoot.querySelector(`[data-bge-mode]`)?.setAttribute(
62452
- "data-bge-mode",
62453
- mode
62454
- );
62455
- if (mode === "wysiwyg") {
62456
- __privateGet(this, _editor).commands.setContent(__privateGet(this, _textarea).value);
63013
+ if (!__privateGet(this, _wysiwygElement)) {
63014
+ throw new ReferenceError("<bge-wysiwyg-editor> is not connected");
62457
63015
  }
63016
+ __privateGet(this, _wysiwygElement).mode = mode;
62458
63017
  });
62459
- __privateSet(this, _editor, editor);
62460
- const contentEditable = this.shadowRoot.querySelector("[contenteditable]");
62461
- contentEditable.ariaLabel = `${label} WYSIWYG`;
62462
- __privateSet(this, _tiptapStyle, document.querySelector("style[data-tiptap-style]")?.textContent ?? "");
62463
- const textareaDescriptor = Object.getOwnPropertyDescriptor(
62464
- HTMLTextAreaElement.prototype,
62465
- "value"
62466
- );
62467
- if (!textareaDescriptor) {
62468
- throw new Error("textarea.value is not defined");
62469
- }
62470
- __privateSet(this, _textareaDescriptor, textareaDescriptor);
62471
- Object.defineProperty(__privateGet(this, _textarea), "value", {
62472
- get: () => {
62473
- return __privateGet(this, _textareaDescriptor)?.get?.call(__privateGet(this, _textarea)) ?? "";
62474
- },
62475
- set: (val) => {
62476
- __privateGet(this, _editor).commands.setContent(val);
62477
- __privateMethod(this, _BgeWysiwygEditorElement_instances, setToTextarea_fn).call(this, val);
62478
- }
62479
- });
62480
- if (initialValue) {
62481
- __privateGet(this, _textarea).value = initialValue;
62482
- }
62483
- }
62484
- get editor() {
62485
- return __privateGet(this, _editor);
62486
- }
62487
- get name() {
62488
- return this.getAttribute("name") ?? "";
62489
- }
62490
- get value() {
62491
- return __privateGet(this, _textarea).value;
62492
63018
  }
62493
63019
  setStyle(css) {
62494
- __privateGet(this, _style).textContent = `
62495
- :host {
62496
- display: block;
62497
- inline-size: 100%;
62498
- }
62499
-
62500
- :where(fieldset) {
62501
- padding: 1em;
62502
- border: 1px solid var(--bge-border-color);
62503
- border-radius: var(--border-radius);
62504
- }
62505
-
62506
- ${__privateGet(this, _tiptapStyle)}
62507
-
62508
- @scope ([data-bge-preview]) {
62509
- ${css}
62510
-
62511
- a:any-link {
62512
- pointer-events: none !important;
62513
- }
62514
- }
62515
-
62516
- textarea,
62517
- [data-bge-preview] {
62518
- block-size: 50svh;
62519
- inline-size: 100%;
62520
- resize: vertical;
62521
- overflow-y: auto;
62522
- background: var(--bge-lightest-color);
62523
- border: 1px solid var(--bge-border-color);
62524
- border-radius: var(--border-radius);
62525
- }
62526
-
62527
- [data-bge-preview] {
62528
- &:focus-within {
62529
- --bge-border-color: var(--bge-ui-primary-color);
62530
- --bge-outline-color: var(--bge-ui-primary-color);
62531
- outline: var(--bge-focus-outline-width) solid var(--bge-outline-color);
62532
- }
62533
- }
62534
-
62535
- [contenteditable] {
62536
- padding: 1rem;
62537
- block-size: 100%;
62538
- box-sizing: border-box;
62539
- }
62540
-
62541
- [contenteditable]:focus-visible {
62542
- outline: none;
62543
- }
62544
-
62545
- textarea {
62546
- font-family: var(--bge-font-family-monospace);
62547
- }
62548
-
62549
- [data-bge-mode="wysiwyg"] textarea {
62550
- display: none;
62551
- }
62552
-
62553
- [data-bge-mode="html"] [data-bge-preview] {
62554
- display: none;
62555
- }
62556
-
62557
- [data-bge-label] {
62558
- margin-block-end: 0.5em;
62559
- }
62560
-
62561
- [data-bge-toolbar] {
62562
- display: flex;
62563
- flex-wrap: wrap;
62564
- gap: 0.25em;
62565
- align-items: center;
62566
- justify-content: space-between;
62567
- margin-block-end: 0.5em;
62568
- }
62569
-
62570
- [data-bge-toolbar-group] {
62571
- display: flex;
62572
- flex-wrap: wrap;
62573
- gap: 0.25em;
62574
- align-items: center;
62575
- }
62576
-
62577
- [data-bge-toolbar-button] {
62578
- --size: 1lh;
62579
- --stroke-width: 1.5;
62580
- --padding: 0.25em;
62581
- font-size: inherit;
62582
- border: none;
62583
- background: none;
62584
- cursor: pointer;
62585
- padding: 0.25em;
62586
- background: var(--bge-lightest-color);
62587
- border: 1px solid var(--bge-border-color);
62588
- border-radius: var(--border-radius);
62589
-
62590
- &:hover,
62591
- &:focus-visible {
62592
- --bge-border-color: var(--bge-ui-primary-color);
62593
- --bge-outline-color: var(--bge-ui-primary-color);
62594
- outline: var(--bge-focus-outline-width) solid var(--bge-outline-color);
62595
- }
62596
-
62597
- &:disabled {
62598
- color: inherit;
62599
- outline: none;
62600
- cursor: not-allowed;
62601
- opacity: 0.3;
62602
- }
62603
-
62604
- &[aria-pressed='true'] {
62605
- --stroke-width: 2;
62606
- color: #fff;
62607
- background-color: var(--bge-ui-primary-color);
62608
-
62609
- &:focus-visible {
62610
- box-shadow: 0 0 0 2px #fff inset;
62611
- }
62612
- }
62613
-
62614
- &:not(:has(svg)) {
62615
- padding-inline: calc(var(--padding) * 3);
62616
- }
62617
-
62618
- svg {
62619
- inline-size: var(--size);
62620
- block-size: var(--size);
62621
- stroke-width: var(--stroke-width);
62622
- stroke: currentcolor;
62623
- }
62624
-
62625
- [data-bge-rotate] {
62626
- rotate: -90deg;
62627
- display: block;
62628
- }
62629
- }`;
63020
+ if (!__privateGet(this, _wysiwygElement)) {
63021
+ throw new ReferenceError("<bge-wysiwyg-editor> is not connected");
63022
+ }
63023
+ __privateGet(this, _wysiwygElement).setStyle(css);
62630
63024
  }
62631
63025
  syncWysiwygToTextarea() {
62632
- let html = __privateGet(this, _editor).getHTML();
62633
- html = html.replaceAll("<p></p>", "");
62634
- __privateMethod(this, _BgeWysiwygEditorElement_instances, setToTextarea_fn).call(this, html);
63026
+ if (!__privateGet(this, _wysiwygElement)) {
63027
+ throw new ReferenceError("<bge-wysiwyg-editor> is not connected");
63028
+ }
63029
+ __privateGet(this, _wysiwygElement).syncWysiwygToTextarea();
62635
63030
  }
62636
63031
  };
62637
- _editor = new WeakMap();
62638
- _editorRoot = new WeakMap();
62639
- _style = new WeakMap();
62640
- _textarea = new WeakMap();
62641
- _textareaDescriptor = new WeakMap();
62642
- _tiptapStyle = new WeakMap();
62643
- _BgeWysiwygEditorElement_instances = new WeakSet();
62644
- setToTextarea_fn = function(html) {
62645
- __privateGet(this, _textareaDescriptor)?.set?.call(__privateGet(this, _textarea), html);
62646
- };
62647
- __publicField(_BgeWysiwygEditorElement, "extension", null);
63032
+ _wysiwygElement = new WeakMap();
63033
+ __publicField(_BgeWysiwygEditorElement, "extensions", null);
63034
+ __publicField(_BgeWysiwygEditorElement, "wrapperElement", null);
63035
+ __publicField(_BgeWysiwygEditorElement, "defaultCommands", [
63036
+ "bold",
63037
+ "italic",
63038
+ "underline",
63039
+ "strikethrough",
63040
+ "link",
63041
+ "button-like-link",
63042
+ "blockquote",
63043
+ "bullet-list",
63044
+ "ordered-list",
63045
+ "note",
63046
+ "h3",
63047
+ "h4",
63048
+ "h5",
63049
+ "h6",
63050
+ "flex-box"
63051
+ ]);
62648
63052
  let BgeWysiwygEditorElement = _BgeWysiwygEditorElement;
62649
- function bindToggle(button, editor) {
63053
+ function bindToggle(button, wysiwygElement) {
62650
63054
  const buttonType = button.dataset.bgeToolbarButton;
62651
63055
  switch (buttonType) {
62652
63056
  case "bold": {
62653
- editor.chain().focus().toggleBold().run();
63057
+ wysiwygElement.toggleBold();
62654
63058
  break;
62655
63059
  }
62656
63060
  case "italic": {
62657
- editor.chain().focus().toggleItalic().run();
63061
+ wysiwygElement.toggleItalic();
62658
63062
  break;
62659
63063
  }
62660
63064
  case "underline": {
62661
- editor.chain().focus().toggleUnderline().run();
63065
+ wysiwygElement.toggleUnderline();
62662
63066
  break;
62663
63067
  }
62664
63068
  case "strikethrough": {
62665
- editor.chain().focus().toggleStrike().run();
63069
+ wysiwygElement.toggleStrike();
62666
63070
  break;
62667
63071
  }
62668
63072
  case "code": {
62669
- editor.chain().focus().toggleCode().run();
63073
+ wysiwygElement.toggleCode();
62670
63074
  break;
62671
63075
  }
62672
63076
  case "link": {
62673
- if (editor.isActive("link")) {
63077
+ if (wysiwygElement.isActive("link")) {
62674
63078
  if (confirm("Are you sure you want to remove the link?")) {
62675
- editor.chain().focus().unsetLink().run();
63079
+ wysiwygElement.toggleLink();
62676
63080
  }
62677
63081
  break;
62678
63082
  }
@@ -62680,13 +63084,13 @@ function bindToggle(button, editor) {
62680
63084
  if (!link) {
62681
63085
  break;
62682
63086
  }
62683
- editor.chain().focus().toggleLink({ href: link }).run();
63087
+ wysiwygElement.toggleLink({ href: link });
62684
63088
  break;
62685
63089
  }
62686
63090
  case "button-like-link": {
62687
- if (editor.isActive("buttonLikeLink")) {
63091
+ if (wysiwygElement.isActive("buttonLikeLink")) {
62688
63092
  if (confirm("Are you sure you want to remove the button-like-link?")) {
62689
- editor.chain().focus().toggleButtonLikeLink().run();
63093
+ wysiwygElement.toggleButtonLikeLink();
62690
63094
  }
62691
63095
  break;
62692
63096
  }
@@ -62694,137 +63098,137 @@ function bindToggle(button, editor) {
62694
63098
  if (!link) {
62695
63099
  break;
62696
63100
  }
62697
- editor.chain().focus().toggleButtonLikeLink({ href: link }).run();
63101
+ wysiwygElement.toggleButtonLikeLink({ href: link });
62698
63102
  break;
62699
63103
  }
62700
63104
  case "blockquote": {
62701
- editor.chain().focus().toggleBlockquote().run();
63105
+ wysiwygElement.toggleBlockquote();
62702
63106
  break;
62703
63107
  }
62704
63108
  case "bullet-list": {
62705
- editor.chain().focus().toggleBulletList().run();
63109
+ wysiwygElement.toggleBulletList();
62706
63110
  break;
62707
63111
  }
62708
63112
  case "ordered-list": {
62709
- editor.chain().focus().toggleOrderedList().run();
63113
+ wysiwygElement.toggleOrderedList();
62710
63114
  break;
62711
63115
  }
62712
63116
  case "note": {
62713
- editor.chain().focus().toggleNote().run();
63117
+ wysiwygElement.toggleNote();
62714
63118
  break;
62715
63119
  }
62716
63120
  case "h2": {
62717
- editor.chain().focus().toggleHeading({ level: 2 }).run();
63121
+ wysiwygElement.toggleHeading(2);
62718
63122
  break;
62719
63123
  }
62720
63124
  case "h3": {
62721
- editor.chain().focus().toggleHeading({ level: 3 }).run();
63125
+ wysiwygElement.toggleHeading(3);
62722
63126
  break;
62723
63127
  }
62724
63128
  case "h4": {
62725
- editor.chain().focus().toggleHeading({ level: 4 }).run();
63129
+ wysiwygElement.toggleHeading(4);
62726
63130
  break;
62727
63131
  }
62728
63132
  case "h5": {
62729
- editor.chain().focus().toggleHeading({ level: 5 }).run();
63133
+ wysiwygElement.toggleHeading(5);
62730
63134
  break;
62731
63135
  }
62732
63136
  case "h6": {
62733
- editor.chain().focus().toggleHeading({ level: 6 }).run();
63137
+ wysiwygElement.toggleHeading(6);
62734
63138
  break;
62735
63139
  }
62736
63140
  case "flex-box": {
62737
- editor.chain().focus().toggleFlexBox().run();
63141
+ wysiwygElement.toggleFlexBox();
62738
63142
  break;
62739
63143
  }
62740
63144
  }
62741
63145
  }
62742
- function bindPressed(button, editor) {
63146
+ function updateButtonState(button, state) {
62743
63147
  const buttonType = button.dataset.bgeToolbarButton;
62744
63148
  switch (buttonType) {
62745
63149
  case "bold": {
62746
- button.disabled = !editor.can().chain().focus().toggleBold().run();
62747
- button.ariaPressed = editor.isActive("bold") ? "true" : "false";
63150
+ button.disabled = state.bold.disabled;
63151
+ button.ariaPressed = state.bold.active ? "true" : "false";
62748
63152
  break;
62749
63153
  }
62750
63154
  case "italic": {
62751
- button.disabled = !editor.can().chain().focus().toggleItalic().run();
62752
- button.ariaPressed = editor.isActive("italic") ? "true" : "false";
63155
+ button.disabled = state.italic.disabled;
63156
+ button.ariaPressed = state.italic.active ? "true" : "false";
62753
63157
  break;
62754
63158
  }
62755
63159
  case "underline": {
62756
- button.disabled = !editor.can().chain().focus().toggleUnderline().run();
62757
- button.ariaPressed = editor.isActive("underline") ? "true" : "false";
63160
+ button.disabled = state.underline.disabled;
63161
+ button.ariaPressed = state.underline.active ? "true" : "false";
62758
63162
  break;
62759
63163
  }
62760
63164
  case "strikethrough": {
62761
- button.disabled = !editor.can().chain().focus().toggleStrike().run();
62762
- button.ariaPressed = editor.isActive("strike") ? "true" : "false";
63165
+ button.disabled = state.strike.disabled;
63166
+ button.ariaPressed = state.strike.active ? "true" : "false";
62763
63167
  break;
62764
63168
  }
62765
63169
  case "code": {
62766
- button.disabled = !editor.can().chain().focus().toggleCode().run();
62767
- button.ariaPressed = editor.isActive("code") ? "true" : "false";
63170
+ button.disabled = state.code.disabled;
63171
+ button.ariaPressed = state.code.active ? "true" : "false";
62768
63172
  break;
62769
63173
  }
62770
63174
  case "link": {
62771
- button.disabled = !editor.can().chain().focus().toggleLink().run();
62772
- button.ariaPressed = editor.isActive("link") ? "true" : "false";
63175
+ button.disabled = state.link.disabled;
63176
+ button.ariaPressed = state.link.active ? "true" : "false";
62773
63177
  break;
62774
63178
  }
62775
63179
  case "button-like-link": {
62776
- button.disabled = !editor.can().chain().focus().toggleButtonLikeLink().run();
62777
- button.ariaPressed = editor.isActive("buttonLikeLink") ? "true" : "false";
63180
+ button.disabled = state.buttonLikeLink.disabled;
63181
+ button.ariaPressed = state.buttonLikeLink.active ? "true" : "false";
62778
63182
  break;
62779
63183
  }
62780
63184
  case "blockquote": {
62781
- button.disabled = !editor.can().chain().focus().toggleBlockquote().run();
62782
- button.ariaPressed = editor.isActive("blockquote") ? "true" : "false";
63185
+ button.disabled = state.blockquote.disabled;
63186
+ button.ariaPressed = state.blockquote.active ? "true" : "false";
62783
63187
  break;
62784
63188
  }
62785
63189
  case "bullet-list": {
62786
- button.disabled = !editor.can().chain().focus().toggleBulletList().run();
62787
- button.ariaPressed = editor.isActive("bulletList") ? "true" : "false";
63190
+ button.disabled = state.bulletList.disabled;
63191
+ button.ariaPressed = state.bulletList.active ? "true" : "false";
62788
63192
  break;
62789
63193
  }
62790
63194
  case "ordered-list": {
62791
- button.disabled = !editor.can().chain().focus().toggleOrderedList().run();
62792
- button.ariaPressed = editor.isActive("orderedList") ? "true" : "false";
63195
+ button.disabled = state.orderedList.disabled;
63196
+ button.ariaPressed = state.orderedList.active ? "true" : "false";
62793
63197
  break;
62794
63198
  }
62795
63199
  case "note": {
62796
- button.disabled = !editor.can().chain().focus().toggleNote().run();
62797
- button.ariaPressed = editor.isActive("note") ? "true" : "false";
63200
+ button.disabled = state.note.disabled;
63201
+ button.ariaPressed = state.note.active ? "true" : "false";
62798
63202
  break;
62799
63203
  }
62800
63204
  case "h2": {
62801
- button.disabled = !editor.can().chain().focus().toggleHeading({ level: 2 }).run();
62802
- button.ariaPressed = editor.isActive("heading", { level: 2 }) ? "true" : "false";
63205
+ button.disabled = state.h2.disabled;
63206
+ button.ariaPressed = state.h2.active ? "true" : "false";
62803
63207
  break;
62804
63208
  }
62805
63209
  case "h3": {
62806
- button.disabled = !editor.can().chain().focus().toggleHeading({ level: 3 }).run();
62807
- button.ariaPressed = editor.isActive("heading", { level: 3 }) ? "true" : "false";
63210
+ button.disabled = state.h3.disabled;
63211
+ button.ariaPressed = state.h3.active ? "true" : "false";
62808
63212
  break;
62809
63213
  }
62810
63214
  case "h4": {
62811
- button.disabled = !editor.can().chain().focus().toggleHeading({ level: 4 }).run();
62812
- button.ariaPressed = editor.isActive("heading", { level: 4 }) ? "true" : "false";
63215
+ button.disabled = state.h4.disabled;
63216
+ button.ariaPressed = state.h4.active ? "true" : "false";
62813
63217
  break;
62814
63218
  }
62815
63219
  case "h5": {
62816
- button.disabled = !editor.can().chain().focus().toggleHeading({ level: 5 }).run();
62817
- button.ariaPressed = editor.isActive("heading", { level: 5 }) ? "true" : "false";
63220
+ button.disabled = state.h5.disabled;
63221
+ button.ariaPressed = state.h5.active ? "true" : "false";
62818
63222
  break;
62819
63223
  }
62820
63224
  case "h6": {
62821
- button.disabled = !editor.can().chain().focus().toggleHeading({ level: 6 }).run();
62822
- button.ariaPressed = editor.isActive("heading", { level: 6 }) ? "true" : "false";
63225
+ button.disabled = state.h6.disabled;
63226
+ button.ariaPressed = state.h6.active ? "true" : "false";
62823
63227
  break;
62824
63228
  }
62825
63229
  case "flex-box": {
62826
- button.disabled = !editor.can().chain().focus().toggleFlexBox().run();
62827
- button.ariaPressed = editor.isActive("flexBox") ? "true" : "false";
63230
+ button.disabled = state.flexBox.disabled;
63231
+ button.ariaPressed = state.flexBox.active ? "true" : "false";
62828
63232
  break;
62829
63233
  }
62830
63234
  }
@@ -62835,6 +63239,7 @@ const CSS_LAYER = {
62835
63239
  components: 'bge-components',
62836
63240
  ui: 'bge-ui',
62837
63241
  };
63242
+ const BLOCK_OPTION_CSS_CUSTOM_PROPERTY_PREFIX = '--bge-options-';
62838
63243
 
62839
63244
  /**
62840
63245
  *
@@ -63227,20 +63632,20 @@ async function createStylesheetFromUrl(url, layer) {
63227
63632
  return blobUrl;
63228
63633
  }
63229
63634
 
63230
- const PREFIX = '--bge-options-';
63231
63635
  /**
63232
- * Get all custom properties from editorArea
63233
- * @param editorArea
63636
+ * Get all custom properties from document
63637
+ * @param scope
63234
63638
  */
63235
- function getCustomProperties(editorArea) {
63639
+ function getCustomProperties(scope) {
63236
63640
  const categories = new Map();
63237
63641
  const defaultValues = new Map();
63238
- const scope = editorArea.containerElement.ownerDocument;
63239
63642
  searchCustomProperty(scope, (cssProperty, value) => {
63240
- if (!cssProperty.startsWith(PREFIX)) {
63643
+ if (!cssProperty.startsWith(BLOCK_OPTION_CSS_CUSTOM_PROPERTY_PREFIX)) {
63241
63644
  return;
63242
63645
  }
63243
- const [type, key] = cssProperty.slice(PREFIX.length).split('-');
63646
+ const [type, key] = cssProperty
63647
+ .slice(BLOCK_OPTION_CSS_CUSTOM_PROPERTY_PREFIX.length)
63648
+ .split('--');
63244
63649
  if (!type) {
63245
63650
  return;
63246
63651
  }
@@ -63266,7 +63671,7 @@ function getCustomProperties(editorArea) {
63266
63671
  continue;
63267
63672
  }
63268
63673
  for (const [key, customProperty] of currentMap.entries()) {
63269
- if (value === `var(${PREFIX}${category}-${key})`) {
63674
+ if (value === `var(${BLOCK_OPTION_CSS_CUSTOM_PROPERTY_PREFIX}${category}--${key})`) {
63270
63675
  customProperty.isDefault = true;
63271
63676
  }
63272
63677
  }
@@ -63275,11 +63680,10 @@ function getCustomProperties(editorArea) {
63275
63680
  }
63276
63681
  /**
63277
63682
  *
63278
- * @param editorArea
63683
+ * @param scope
63279
63684
  * @param property
63280
63685
  */
63281
- function getCustomProperty(editorArea, property) {
63282
- const scope = editorArea.containerElement.ownerDocument;
63686
+ function getCustomProperty(scope, property) {
63283
63687
  let result = null;
63284
63688
  searchCustomProperty(scope, (cssProperty, value) => {
63285
63689
  if (property instanceof RegExp) {
@@ -63501,7 +63905,7 @@ function sanitizeStyle(el) {
63501
63905
  const customProperties = [];
63502
63906
  const style = el.style;
63503
63907
  for (const property of style) {
63504
- if (property.startsWith('--bge-options-')) {
63908
+ if (property.startsWith(BLOCK_OPTION_CSS_CUSTOM_PROPERTY_PREFIX)) {
63505
63909
  customProperties.push([property, style.getPropertyValue(property)]);
63506
63910
  }
63507
63911
  }
@@ -65235,10 +65639,10 @@ class BurgerEditorEngine {
65235
65639
  return this.#currentBlock;
65236
65640
  }
65237
65641
  getCustomProperties() {
65238
- return getCustomProperties(this.#current);
65642
+ return getCustomProperties(this.#current.containerElement.ownerDocument);
65239
65643
  }
65240
65644
  getCustomProperty(property) {
65241
- return getCustomProperty(this.#current, property);
65645
+ return getCustomProperty(this.#current.containerElement.ownerDocument, property);
65242
65646
  }
65243
65647
  hasDraft() {
65244
65648
  return !!this.#draft;
@@ -65340,7 +65744,11 @@ class BurgerEditorEngine {
65340
65744
  engine.#current = engine.#main;
65341
65745
  engine.showMain();
65342
65746
  engine.save();
65343
- defineBgeWysiwygEditorElement();
65747
+ defineBgeWysiwygEditorElement({
65748
+ wrapperElement: {
65749
+ className: options.config.classList.join(' '),
65750
+ },
65751
+ });
65344
65752
  return engine;
65345
65753
  }
65346
65754
  static #addItem(seed) {
@@ -66193,23 +66601,35 @@ function exportContainerProps(containerPropsQuery) {
66193
66601
  *
66194
66602
  * @param el
66195
66603
  */
66196
- function exportOptions(el) {
66197
- const props = exportContainerProps(el.dataset.bgeContainer);
66198
- const classList = [...el.classList];
66199
- const id = el.id.replace(/^bge-/, '').trim() || null;
66604
+ function exportStyleOptions(el) {
66200
66605
  const style = {};
66201
66606
  for (const property of el.style) {
66202
- if (!property.startsWith('--bge-options-')) {
66607
+ if (!property.startsWith(BLOCK_OPTION_CSS_CUSTOM_PROPERTY_PREFIX)) {
66203
66608
  continue;
66204
66609
  }
66205
- const category = property.replace('--bge-options-', '');
66610
+ const category = property.replace(BLOCK_OPTION_CSS_CUSTOM_PROPERTY_PREFIX, '');
66206
66611
  const propValue = el.style.getPropertyValue(property);
66207
- const [, _category, propName] = propValue.match(/^var\(--bge-options-([a-z]+)-([a-z]+(?:-[a-z]+)*)\)$/) ?? [];
66612
+ const [, _category, propName] = propValue
66613
+ .replace(`var(${BLOCK_OPTION_CSS_CUSTOM_PROPERTY_PREFIX}`, '')
66614
+ .replace(/\)$/, '')
66615
+ .match(/^([a-z]+(?:-[a-z]+)*)--([a-z]+(?:-[a-z]+)*)$/) ?? [];
66208
66616
  if (category !== _category || !propName) {
66209
66617
  continue;
66210
66618
  }
66211
66619
  style[category] = propName;
66212
66620
  }
66621
+ return style;
66622
+ }
66623
+
66624
+ /**
66625
+ *
66626
+ * @param el
66627
+ */
66628
+ function exportOptions(el) {
66629
+ const props = exportContainerProps(el.dataset.bgeContainer);
66630
+ const classList = [...el.classList];
66631
+ const id = el.id.replace(/^bge-/, '').trim() || null;
66632
+ const style = exportStyleOptions(el);
66213
66633
  return {
66214
66634
  props,
66215
66635
  classList,
@@ -66250,6 +66670,22 @@ function importContainerProps(containerProps) {
66250
66670
  return query;
66251
66671
  }
66252
66672
 
66673
+ /**
66674
+ *
66675
+ * @param el
66676
+ * @param style
66677
+ */
66678
+ function importStyleOptions(el, style) {
66679
+ for (const [key, value] of Object.entries(style)) {
66680
+ if (value === '@@default') {
66681
+ continue;
66682
+ }
66683
+ const name = `${BLOCK_OPTION_CSS_CUSTOM_PROPERTY_PREFIX}${key}`;
66684
+ const variable = `var(${name}--${value})`;
66685
+ el.style.setProperty(name, variable);
66686
+ }
66687
+ }
66688
+
66253
66689
  /**
66254
66690
  *
66255
66691
  * @param el
@@ -66273,14 +66709,7 @@ function importOptions(el, options) {
66273
66709
  el.removeAttribute('id');
66274
66710
  }
66275
66711
  el.removeAttribute('style');
66276
- for (const [key, value] of Object.entries(style)) {
66277
- if (value === '@@default') {
66278
- continue;
66279
- }
66280
- const name = `--bge-options-${key}`;
66281
- const variable = `var(${name}-${value})`;
66282
- el.style.setProperty(name, variable);
66283
- }
66712
+ importStyleOptions(el, style);
66284
66713
  }
66285
66714
 
66286
66715
  /**
@@ -72034,6 +72463,8 @@ function set_attributes(element, prev, next, css_hash, skip_warning = false) {
72034
72463
  ) {
72035
72464
  // @ts-ignore
72036
72465
  element[name] = value;
72466
+ // remove it from attributes's cache
72467
+ if (name in attributes) attributes[name] = UNINITIALIZED;
72037
72468
  } else if (typeof value !== 'function') {
72038
72469
  set_attribute(element, name, value);
72039
72470
  }