turnish 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,69 +1,118 @@
1
- var Turnish=(function(){"use strict";function H(t,e){const n=t;return n.isBlock=T(n),n.isCode=n.nodeName==="CODE"||n.parentNode?.isCode,n.isBlank=v(n),n.flankingWhitespace=_(n,e),n}function v(t){return!O(t)&&!V(t)&&/^\s*$/i.test(t.textContent||"")&&!U(t)&&!W(t)}function _(t,e){const n=t;if(n.isBlock||e.preformattedCode&&n.isCode)return{leading:"",trailing:""};const r=$(t.textContent||"");return r.leadingAscii&&b("left",t,e)&&(r.leading=r.leadingNonAscii),r.trailingAscii&&b("right",t,e)&&(r.trailing=r.trailingNonAscii),{leading:r.leading,trailing:r.trailing}}function $(t){const e=t.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return e?{leading:e[1],leadingAscii:e[2],leadingNonAscii:e[3],trailing:e[4],trailingNonAscii:e[5],trailingAscii:e[6]}:{leading:"",leadingAscii:"",leadingNonAscii:"",trailing:"",trailingNonAscii:"",trailingAscii:""}}function b(t,e,n){let r,i,s;return t==="left"?(r=e.previousSibling,i=/ $/):(r=e.nextSibling,i=/^ /),r&&(r.nodeType===3?s=i.test(r.nodeValue||""):n.preformattedCode&&r.nodeName==="CODE"?s=!1:r.nodeType===1&&!T(r)&&(s=i.test(r.textContent||""))),s||!1}const p={Element:1,Text:3,CDATASection:4};function N(t,e){return Array(e+1).join(t)}function C(t){return t.replace(/^\n*/,"")}function S(t){let e=t.length;for(;e>0&&t[e-1]===`
2
- `;)e--;return t.substring(0,e)}function x(t){return S(C(t))}const F=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function T(t){return k(t,F)}const I=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function O(t){return k(t,I)}function U(t){return D(t,I)}const w=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"],z=["P","BR","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","UL","OL","LI","PRE","CODE","HR","A","EM","I","STRONG","B","IMG","DIV","SPAN","TABLE","THEAD","TBODY","TR","TH","TD"];function V(t){return k(t,w)}function W(t){return D(t,w)}function k(t,e){return e.indexOf(t.nodeName)>=0}function D(t,e){return e.some(function(n){return t.nodeType!==p.Element?!1:t.getElementsByTagName(n).length})}function L(t){return t?t.replace(/(\n+\s*)+/g,`
3
- `):""}function G(t){return L(t).replace(/[\t\r\n]+/g," ").replace(/ {2,}/g," ").trim()}function g(t){return L(t).replace(/[\t\r\n]+/g," ")}const f={};f.paragraph={filter:"p",replacement:function(t){return`
1
+ var Turnish=(function(){"use strict";class ne extends Error{reason;filename;line;column;source;constructor(e,n,i,r,s){super(`${e}:${i}:${r}: ${n}`),this.reason=n,this.filename=e,this.line=i,this.column=r,this.source=s}}class ie{start;end;source;constructor(e,n,i){this.start=e,this.end=n,this.source=i}}var f;(function(t){t.stylesheet="stylesheet",t.rule="rule",t.declaration="declaration",t.comment="comment",t.container="container",t.charset="charset",t.document="document",t.customMedia="custom-media",t.fontFace="font-face",t.host="host",t.import="import",t.keyframes="keyframes",t.keyframe="keyframe",t.layer="layer",t.media="media",t.namespace="namespace",t.page="page",t.startingStyle="starting-style",t.supports="supports"})(f||(f={}));const V=(t,e,n)=>{let i=n,r=1e4;do{const s=e.map(c=>t.indexOf(c,i));s.push(t.indexOf("\\",i));const l=s.filter(c=>c!==-1);if(l.length===0)return-1;const u=Math.min(...l);if(t[u]!=="\\")return u;i=u+2,r--}while(r>0);throw new Error("Too many escaping")},C=(t,e,n)=>{let i=n,r=1e4;do{const s=e.map(c=>t.indexOf(c,i));s.push(t.indexOf("(",i)),s.push(t.indexOf('"',i)),s.push(t.indexOf("'",i)),s.push(t.indexOf("\\",i));const l=s.filter(c=>c!==-1);if(l.length===0)return-1;const u=Math.min(...l);switch(t[u]){case"\\":i=u+2;break;case"(":{const c=C(t,[")"],u+1);if(c===-1)return-1;i=c+1}break;case'"':{const c=V(t,['"'],u+1);if(c===-1)return-1;i=c+1}break;case"'":{const c=V(t,["'"],u+1);if(c===-1)return-1;i=c+1}break;default:return u}r--}while(r>0);throw new Error("Too many escaping")},w=/\/\*[^]*?(?:\*\/|$)/g;function T(t){return t?t.trim():""}function O(t,e){const n=t&&typeof t.type=="string",i=n?t:e;for(const r in t){const s=t[r];Array.isArray(s)?s.forEach(l=>{O(l,i)}):s&&typeof s=="object"&&O(s,i)}return n&&Object.defineProperty(t,"parent",{configurable:!0,writable:!0,enumerable:!1,value:e||null}),t}class re{level=0;indentation=" ";compress=!1;constructor(e){typeof e?.indent=="string"&&(this.indentation=e?.indent),e?.compress&&(this.compress=!0)}emit(e,n){return e}indent(e){return this.level=this.level||1,e?(this.level+=e,""):Array(this.level).join(this.indentation)}visit(e){switch(e.type){case f.stylesheet:return this.stylesheet(e);case f.rule:return this.rule(e);case f.declaration:return this.declaration(e);case f.comment:return this.comment(e);case f.container:return this.container(e);case f.charset:return this.charset(e);case f.document:return this.document(e);case f.customMedia:return this.customMedia(e);case f.fontFace:return this.fontFace(e);case f.host:return this.host(e);case f.import:return this.import(e);case f.keyframes:return this.keyframes(e);case f.keyframe:return this.keyframe(e);case f.layer:return this.layer(e);case f.media:return this.media(e);case f.namespace:return this.namespace(e);case f.page:return this.page(e);case f.startingStyle:return this.startingStyle(e);case f.supports:return this.supports(e)}}mapVisit(e,n){let i="";n=n||"";for(let r=0,s=e.length;r<s;r++)i+=this.visit(e[r]),n&&r<s-1&&(i+=this.emit(n));return i}compile(e){return this.compress?e.stylesheet.rules.map(this.visit,this).join(""):this.stylesheet(e)}stylesheet(e){return this.mapVisit(e.stylesheet.rules,`
2
+
3
+ `)}comment(e){return this.compress?this.emit("",e.position):this.emit(`${this.indent()}/*${e.comment}*/`,e.position)}container(e){return this.compress?this.emit(`@container ${e.container}`,e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}"):this.emit(`${this.indent()}@container ${e.container}`,e.position)+this.emit(` {
4
+ ${this.indent(1)}`)+this.mapVisit(e.rules,`
5
+
6
+ `)+this.emit(`
7
+ ${this.indent(-1)}${this.indent()}}`)}layer(e){return this.compress?this.emit(`@layer ${e.layer}`,e.position)+(e.rules?this.emit("{")+this.mapVisit(e.rules)+this.emit("}"):";"):this.emit(`${this.indent()}@layer ${e.layer}`,e.position)+(e.rules?this.emit(` {
8
+ ${this.indent(1)}`)+this.mapVisit(e.rules,`
9
+
10
+ `)+this.emit(`
11
+ ${this.indent(-1)}${this.indent()}}`):";")}import(e){return this.emit(`@import ${e.import};`,e.position)}media(e){return this.compress?this.emit(`@media ${e.media}`,e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}"):this.emit(`${this.indent()}@media ${e.media}`,e.position)+this.emit(` {
12
+ ${this.indent(1)}`)+this.mapVisit(e.rules,`
13
+
14
+ `)+this.emit(`
15
+ ${this.indent(-1)}${this.indent()}}`)}document(e){const n=`@${e.vendor||""}document ${e.document}`;return this.compress?this.emit(n,e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}"):this.emit(n,e.position)+this.emit(` {
16
+ ${this.indent(1)}`)+this.mapVisit(e.rules,`
17
+
18
+ `)+this.emit(`${this.indent(-1)}
19
+ }`)}charset(e){return this.emit(`@charset ${e.charset};`,e.position)}namespace(e){return this.emit(`@namespace ${e.namespace};`,e.position)}startingStyle(e){return this.compress?this.emit("@starting-style",e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}"):this.emit(`${this.indent()}@starting-style`,e.position)+this.emit(` {
20
+ ${this.indent(1)}`)+this.mapVisit(e.rules,`
21
+
22
+ `)+this.emit(`
23
+ ${this.indent(-1)}${this.indent()}}`)}supports(e){return this.compress?this.emit(`@supports ${e.supports}`,e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}"):this.emit(`${this.indent()}@supports ${e.supports}`,e.position)+this.emit(` {
24
+ ${this.indent(1)}`)+this.mapVisit(e.rules,`
25
+
26
+ `)+this.emit(`
27
+ ${this.indent(-1)}${this.indent()}}`)}keyframes(e){return this.compress?this.emit(`@${e.vendor||""}keyframes ${e.name}`,e.position)+this.emit("{")+this.mapVisit(e.keyframes)+this.emit("}"):this.emit(`@${e.vendor||""}keyframes ${e.name}`,e.position)+this.emit(` {
28
+ ${this.indent(1)}`)+this.mapVisit(e.keyframes,`
29
+ `)+this.emit(`${this.indent(-1)}}`)}keyframe(e){const n=e.declarations;return this.compress?this.emit(e.values.join(","),e.position)+this.emit("{")+this.mapVisit(n)+this.emit("}"):this.emit(this.indent())+this.emit(e.values.join(", "),e.position)+this.emit(` {
30
+ ${this.indent(1)}`)+this.mapVisit(n,`
31
+ `)+this.emit(`${this.indent(-1)}
32
+ ${this.indent()}}
33
+ `)}page(e){if(this.compress){const i=e.selectors.length?e.selectors.join(", "):"";return this.emit(`@page ${i}`,e.position)+this.emit("{")+this.mapVisit(e.declarations)+this.emit("}")}const n=e.selectors.length?`${e.selectors.join(", ")} `:"";return this.emit(`@page ${n}`,e.position)+this.emit(`{
34
+ `)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
35
+ `)+this.emit(this.indent(-1))+this.emit(`
36
+ }`)}fontFace(e){return this.compress?this.emit("@font-face",e.position)+this.emit("{")+this.mapVisit(e.declarations)+this.emit("}"):this.emit("@font-face ",e.position)+this.emit(`{
37
+ `)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
38
+ `)+this.emit(this.indent(-1))+this.emit(`
39
+ }`)}host(e){return this.compress?this.emit("@host",e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}"):this.emit("@host",e.position)+this.emit(` {
40
+ ${this.indent(1)}`)+this.mapVisit(e.rules,`
41
+
42
+ `)+this.emit(`${this.indent(-1)}
43
+ }`)}customMedia(e){return this.emit(`@custom-media ${e.name} ${e.media};`,e.position)}rule(e){const n=e.declarations;if(!n.length)return"";if(this.compress)return this.emit(e.selectors.join(","),e.position)+this.emit("{")+this.mapVisit(n)+this.emit("}");const i=this.indent();return this.emit(e.selectors.map(r=>i+r).join(`,
44
+ `),e.position)+this.emit(` {
45
+ `)+this.emit(this.indent(1))+this.mapVisit(n,`
46
+ `)+this.emit(this.indent(-1))+this.emit(`
47
+ ${this.indent()}}`)}declaration(e){return this.compress?this.emit(`${e.property}:${e.value}`,e.position)+this.emit(";"):e.property==="grid-template-areas"?this.emit(this.indent())+this.emit(e.property+": "+e.value.split(`
48
+ `).join(`
49
+ `.padEnd(22)+this.indent()),e.position)+this.emit(";"):this.emit(this.indent())+this.emit(`${e.property}: ${e.value}`,e.position)+this.emit(";")}}var se={parse:(t,e)=>{e=e||{};let n=1,i=1;function r(){const a={line:n,column:i};return o=>(o.position=new ie(a,{line:n,column:i},e?.source||""),E(),o)}const s=[];function l(a){const o=new ne(e?.source||"",a,n,i,t);if(!e?.silent)throw o;s.push(o)}function u(){const a=/^{\s*/.exec(t);return!!a&&(m(a),!0)}function c(){const a=/^}/.exec(t);return!!a&&(m(a),!0)}function g(){let a;const o=[];for(E(),d(o);t.length&&t.charAt(0)!=="}"&&(a=Ie()||Be(),a);)o.push(a),d(o);return o}function m(a){const o=a[0];return(function(h){const p=h.match(/\n/g);p&&(n+=p.length);const y=h.lastIndexOf(`
50
+ `);i=~y?h.length-y:i+h.length})(o),t=t.slice(o.length),a}function E(){const a=/^\s*/.exec(t);a&&m(a)}function d(a){a=a||[];let o=$();for(;o;)a.push(o),o=$();return a}function $(){const a=r();if(t.charAt(0)!=="/"||t.charAt(1)!=="*")return;const o=/^\/\*[^]*?\*\//.exec(t);return o?(m(o),a({type:f.comment,comment:o[0].slice(2,-2)})):l("End of comment missing")}function J(){const a=/^([^{]+)/.exec(t);if(a)return m(a),((o,h)=>{const p=[];let y=0;for(;y<o.length;){const N=C(o,h,y);if(N===-1)return p.push(o.substring(y)),p;p.push(o.substring(y,N)),y=N+1}return p})(T(a[0]).replace(w,""),[","]).map(o=>T(o))}function A(){const a=r(),o=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/.exec(t);if(!o)return;m(o);const h=T(o[0]),p=/^:\s*/.exec(t);if(!p)return l("property missing ':'");m(p);let y="";const N=C(t,[";","}"]);N!==-1&&(y=t.substring(0,N),m([y]),y=T(y).replace(w,""));const R=a({type:f.declaration,property:h.replace(w,""),value:y}),te=/^[;\s]*/.exec(t);return te&&m(te),R}function Z(){const a=[];if(!u())return l("missing '{'");d(a);let o=A();for(;o;)a.push(o),d(a),o=A();return c()?a:l("missing '}'")}function ee(){const a=[],o=r();let h=/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/.exec(t);for(;h;){const p=m(h);a.push(p[1]);const y=/^,\s*/.exec(t);y&&m(y),h=/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/.exec(t)}if(a.length)return o({type:f.keyframe,values:a,declarations:Z()||[]})}const ve=P("import"),Le=P("charset"),De=P("namespace");function P(a){const o=new RegExp("^@"+a+`\\s*((?::?[^;'"]|"(?:\\\\"|[^"])*?"|'(?:\\\\'|[^'])*?')+)(?:;|$)`);return()=>{const h=r(),p=o.exec(t);if(!p)return;const y=m(p),N={type:a};return N[a]=y[1].trim(),h(N)}}function Ie(){if(t[0]==="@")return(function(){const a=r(),o=/^@([-\w]+)?keyframes\s*/.exec(t);if(!o)return;const h=m(o)[1],p=/^([-\w]+)\s*/.exec(t);if(!p)return l("@keyframes missing name");const y=m(p)[1];if(!u())return l("@keyframes missing '{'");let N=d(),R=ee();for(;R;)N.push(R),N=N.concat(d()),R=ee();return c()?a({type:f.keyframes,name:y,vendor:h,keyframes:N}):l("@keyframes missing '}'")})()||(function(){const a=r(),o=/^@media *([^{]+)/.exec(t);if(!o)return;const h=T(m(o)[1]);if(!u())return l("@media missing '{'");const p=d().concat(g());return c()?a({type:f.media,media:h,rules:p}):l("@media missing '}'")})()||(function(){const a=r(),o=/^@custom-media\s+(--\S+)\s+([^{;\s][^{;]*);/.exec(t);if(!o)return;const h=m(o);return a({type:f.customMedia,name:T(h[1]),media:T(h[2])})})()||(function(){const a=r(),o=/^@supports *([^{]+)/.exec(t);if(!o)return;const h=T(m(o)[1]);if(!u())return l("@supports missing '{'");const p=d().concat(g());return c()?a({type:f.supports,supports:h,rules:p}):l("@supports missing '}'")})()||ve()||Le()||De()||(function(){const a=r(),o=/^@([-\w]+)?document *([^{]+)/.exec(t);if(!o)return;const h=m(o),p=T(h[1]),y=T(h[2]);if(!u())return l("@document missing '{'");const N=d().concat(g());return c()?a({type:f.document,document:y,vendor:p,rules:N}):l("@document missing '}'")})()||(function(){const a=r(),o=/^@page */.exec(t);if(!o)return;m(o);const h=J()||[];if(!u())return l("@page missing '{'");let p=d(),y=A();for(;y;)p.push(y),p=p.concat(d()),y=A();return c()?a({type:f.page,selectors:h,declarations:p}):l("@page missing '}'")})()||(function(){const a=r(),o=/^@host\s*/.exec(t);if(!o)return;if(m(o),!u())return l("@host missing '{'");const h=d().concat(g());return c()?a({type:f.host,rules:h}):l("@host missing '}'")})()||(function(){const a=r(),o=/^@font-face\s*/.exec(t);if(!o)return;if(m(o),!u())return l("@font-face missing '{'");let h=d(),p=A();for(;p;)h.push(p),h=h.concat(d()),p=A();return c()?a({type:f.fontFace,declarations:h}):l("@font-face missing '}'")})()||(function(){const a=r(),o=/^@container *([^{]+)/.exec(t);if(!o)return;const h=T(m(o)[1]);if(!u())return l("@container missing '{'");const p=d().concat(g());return c()?a({type:f.container,container:h,rules:p}):l("@container missing '}'")})()||(function(){const a=r(),o=/^@starting-style\s*/.exec(t);if(!o)return;if(m(o),!u())return l("@starting-style missing '{'");const h=d().concat(g());return c()?a({type:f.startingStyle,rules:h}):l("@starting-style missing '}'")})()||(function(){const a=r(),o=/^@layer *([^{;@]+)/.exec(t);if(!o)return;const h=T(m(o)[1]);if(!u()){const y=/^[;\s]*/.exec(t);return y&&m(y),a({type:f.layer,layer:h})}const p=d().concat(g());return c()?a({type:f.layer,layer:h,rules:p}):l("@layer missing '}'")})()}function Be(){const a=r(),o=J();return o?(d(),a({type:f.rule,selectors:o,declarations:Z()||[]})):l("selector missing")}return O((function(){const a=g();return{type:f.stylesheet,stylesheet:{source:e?.source,rules:a,parsingErrors:s}}})())},stringify:(t,e)=>new re(e||{}).compile(t)};function oe(t,e){const n=t;return n.isBlock=M(n),n.isCode=n.nodeName==="CODE"||n.parentNode?.isCode,n.isBlank=ae(n),n.flankingWhitespace=ce(n,e),n}function ae(t){return!z(t)&&!fe(t)&&/^\s*$/i.test(t.textContent||"")&&!me(t)&&!pe(t)}function ce(t,e){const n=t;if(n.isBlock||e.preformattedCode&&n.isCode)return{leading:"",trailing:""};const i=le(t.textContent||"");return i.leadingAscii&&H("left",t,e)&&(i.leading=i.leadingNonAscii),i.trailingAscii&&H("right",t,e)&&(i.trailing=i.trailingNonAscii),{leading:i.leading,trailing:i.trailing}}function le(t){const e=t.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return e?{leading:e[1],leadingAscii:e[2],leadingNonAscii:e[3],trailing:e[4],trailingNonAscii:e[5],trailingAscii:e[6]}:{leading:"",leadingAscii:"",leadingNonAscii:"",trailing:"",trailingNonAscii:"",trailingAscii:""}}function H(t,e,n){let i,r,s;return t==="left"?(i=e.previousSibling,r=/ $/):(i=e.nextSibling,r=/^ /),i&&(i.nodeType===3?s=r.test(i.nodeValue||""):n.preformattedCode&&i.nodeName==="CODE"?s=!1:i.nodeType===1&&!M(i)&&(s=r.test(i.textContent||""))),s||!1}const x={Element:1,Text:3,CDATASection:4};function S(t,e){return Array(e+1).join(t)}function F(t){return t.replace(/^\n*/,"")}function _(t){let e=t.length;for(;e>0&&t[e-1]===`
51
+ `;)e--;return t.substring(0,e)}function U(t){return _(F(t))}const ue=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function M(t){return v(t,ue)}const j=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function z(t){return v(t,j)}function me(t){return G(t,j)}const W=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"],he=["P","BR","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","UL","OL","LI","PRE","CODE","HR","A","EM","I","STRONG","B","IMG","DIV","SPAN","TABLE","THEAD","TBODY","TR","TH","TD"];function fe(t){return v(t,W)}function pe(t){return G(t,W)}function v(t,e){return e.indexOf(t.nodeName)>=0}function G(t,e){return e.some(function(n){return t.nodeType!==x.Element?!1:t.getElementsByTagName(n).length})}function K(t){return t?t.replace(/(\n+\s*)+/g,`
52
+ `):""}function de(t){return K(t).replace(/[\t\r\n]+/g," ").replace(/ {2,}/g," ").trim()}function b(t){return K(t).replace(/[\t\r\n]+/g," ")}function ge(t){const e=t.parentNode;return e?e.nodeType===x.Element&&e.classList&&e.classList.contains("code")&&e.nodeName==="TD"&&t.nodeName==="PRE":!1}function ye(t){if(t.nodeName!=="PRE"||t.nodeType!==x.Element)return!1;const e=t.getAttribute("style");if(!e)return!1;const n=se.parse("pre {"+e+"}");if(!n.stylesheet.rules.length)return!1;const i=n.stylesheet.rules[0];if(!("declarations"in i)||!i.declarations)return!1;const r=i.declarations.find(l=>"property"in l?l.property.toLowerCase()==="font-family":!1);return!r||"value"in r&&!r.value?!1:"value"in r&&r.value.split(",").map(l=>l.trim().toLowerCase()).indexOf("monospace")>=0}function Y(t){return ge(t)||ye(t)?!0:t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"||!1}const k={};k.paragraph={filter:"p",replacement:function(t){return`
4
53
 
5
54
  `+t+`
6
55
 
7
- `}},f.lineBreak={filter:"br",replacement:function(t,e,n){return n.br+`
8
- `}},f.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(t,e,n){const r=Number(e.nodeName.charAt(1));if(n.headingStyle==="setext"&&r<3){const i=N(r===1?"=":"-",t.length);return`
56
+ `}},k.lineBreak={filter:"br",replacement:function(t,e,n){return n.br+`
57
+ `}},k.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(t,e,n){const i=Number(e.nodeName.charAt(1));if(n.headingStyle==="setext"&&i<3){const r=S(i===1?"=":"-",t.length);return`
9
58
 
10
59
  `+t+`
11
- `+i+`
60
+ `+r+`
12
61
 
13
62
  `}else return`
14
63
 
15
- `+N("#",r)+" "+t+`
64
+ `+S("#",i)+" "+t+`
16
65
 
17
- `}},f.blockquote={filter:"blockquote",replacement:function(t){return t=x(t).replace(/^/gm,"> "),`
66
+ `}},k.blockquote={filter:"blockquote",replacement:function(t){return t=U(t).replace(/^/gm,"> "),`
18
67
 
19
68
  `+t+`
20
69
 
21
- `}},f.list={filter:["ul","ol"],replacement:function(t,e){const n=e.parentNode;return n.nodeName==="LI"&&n.lastElementChild===e?`
70
+ `}},k.list={filter:["ul","ol"],replacement:function(t,e){const n=e.parentNode;return n.nodeName==="LI"&&n.lastElementChild===e?`
22
71
  `+t:`
23
72
 
24
73
  `+t+`
25
74
 
26
- `}},f.listItem={filter:"li",replacement:function(t,e,n){let r=n.bulletListMarker+" ".repeat(n.listMarkerSpaceCount);const i=e.parentNode;if(i.nodeName==="OL"){const d=i.getAttribute("start"),h=Array.prototype.indexOf.call(i.children,e);r=(d?Number(d)+h:h+1)+"."+" ".repeat(n.listMarkerSpaceCount)}const s=/\n$/.test(t);if(t=x(t)+(s?`
27
- `:""),e.childNodes.length>0&&Array.from(e.childNodes).every(d=>d.nodeType===p.Text&&/^\s*$/.test(d.nodeValue||"")||d.nodeType===p.Element&&["UL","OL"].includes(d.nodeName))&&t.trim()!=="")return t+(e.nextSibling?`
28
- `:"");let a=0,l=i;for(;l;){if(l.nodeName==="UL"||l.nodeName==="OL"){const d=l.parentNode;d&&d.nodeName==="LI"&&a++}l=l.parentNode}let o=n.listItemIndent==="tab"?" ":" ".repeat(n.listItemIndentSpaceCount),u=o.repeat(a);const m=/\n(?!\s*(?:\d+\.\s|[-+*]\s))/gm;return t=t.replace(m,`
29
- `+o),u+r+t+(e.nextSibling?`
30
- `:"")}},f.indentedCodeBlock={filter:function(t,e){return!!(e&&e.codeBlockStyle==="indented"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE")},replacement:function(t,e){return!e||!e.firstChild?"":`
75
+ `}},k.listItem={filter:"li",replacement:function(t,e,n){let i=n.bulletListMarker+" ".repeat(n.listMarkerSpaceCount);const r=e.parentNode;if(r.nodeName==="OL"){const d=r.getAttribute("start"),$=Array.prototype.indexOf.call(r.children,e);i=(d?Number(d)+$:$+1)+"."+" ".repeat(n.listMarkerSpaceCount)}const s=/\n$/.test(t);if(t=U(t)+(s?`
76
+ `:""),e.childNodes.length>0&&Array.from(e.childNodes).every(d=>d.nodeType===x.Text&&/^\s*$/.test(d.nodeValue||"")||d.nodeType===x.Element&&["UL","OL"].includes(d.nodeName))&&t.trim()!=="")return t+(e.nextSibling?`
77
+ `:"");let u=0,c=r;for(;c;){if(c.nodeName==="UL"||c.nodeName==="OL"){const d=c.parentNode;d&&d.nodeName==="LI"&&u++}c=c.parentNode}let g=n.listItemIndent==="tab"?" ":" ".repeat(n.listItemIndentSpaceCount),m=g.repeat(u);const E=/\n(?!\s*(?:\d+\.\s|[-+*]\s))/gm;return t=t.replace(E,`
78
+ `+g),m+i+t+(e.nextSibling?`
79
+ `:"")}},k.indentedCodeBlock={filter:function(t,e){return!!(e&&e.codeBlockStyle==="indented"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE")},replacement:function(t,e){return!e||!e.firstChild?"":`
31
80
 
32
81
  `+e.firstChild.textContent.replace(/\n/g,`
33
82
  `)+`
34
83
 
35
- `}},f.fencedCodeBlock={filter:function(t,e){return!!(e&&e.codeBlockStyle==="fenced"&&t.nodeName==="PRE")},replacement:function(t,e,n){const r=e,i=r.firstChild,s=i&&i.nodeName==="CODE"?i:r,a=((s.getAttribute("class")||"").match(/(?:lang|language)-(\S+)/)||[null,""])[1],l=s.textContent||"",o=n.fence?.charAt(0)||"`";let u=3;const m=new RegExp("^"+o+"{3,}","gm");let d;for(;d=m.exec(l);)d[0].length>=u&&(u=d[0].length+1);const h=N(o,u);return`
84
+ `}},k.fencedCodeBlock={filter:function(t,e){return!!(e&&e.codeBlockStyle==="fenced"&&t.nodeName==="PRE")},replacement:function(t,e,n){const i=e,r=i.firstChild,s=r&&r.nodeName==="CODE"?r:i,u=((s.getAttribute("class")||"").match(/(?:lang|language)-(\S+)/)||[null,""])[1],c=s.textContent||"",g=n.fence?.charAt(0)||"`";let m=3;const E=new RegExp("^"+g+"{3,}","gm");let d;for(;d=E.exec(c);)d[0].length>=m&&(m=d[0].length+1);const $=S(g,m);return`
36
85
 
37
- `+h+a+`
38
- `+l.replace(/\n$/,"")+`
39
- `+h+`
86
+ `+$+u+`
87
+ `+c.replace(/\n$/,"")+`
88
+ `+$+`
40
89
 
41
- `}},f.horizontalRule={filter:"hr",replacement:function(t,e,n){return`
90
+ `}},k.horizontalRule={filter:"hr",replacement:function(t,e,n){return`
42
91
 
43
92
  `+n.hr+`
44
93
 
45
- `}},f.inlineLink={filter:function(t,e){return!!(e?.linkStyle==="inlined"&&t.nodeName==="A"&&t.getAttribute("href"))},replacement:function(t,e){const n=G(t);let r=e.getAttribute("href")?.replace(/([()])/g,"\\$1"),i;const s=e.getAttribute("title");return s?i=' "'+g(s).replace(/"/g,'\\"')+'"':i="","["+n+"]("+r+i+")"}};const R={filter:function(t,e){return!!(e&&e.linkStyle==="referenced"&&t.nodeName==="A"&&t.getAttribute("href"))},replacement:function(t,e,n){const r=R,i=e.getAttribute("href");let s;const c=e.getAttribute("title");c?s=' "'+g(c)+'"':s="";const a=i+s;let l,o;switch(n.linkReferenceStyle){case"collapsed":l="["+t+"][]",o="["+t+"]: "+a;break;case"shortcut":l="["+t+"]",o="["+t+"]: "+a;break;default:{let u;const m=r.urlReferenceIdMap.get(a);n.linkReferenceDeduplication==="full"&&m?(u=m,o="["+u+"]: "+i+s):(u=r.references.length+1,r.urlReferenceIdMap.set(a,u),o="["+u+"]: "+i+s,r.references.push(o)),l="["+t+"]["+u+"]";break}}return n.linkReferenceStyle!=="full"&&(n.linkReferenceDeduplication==="full"?r.urlReferenceIdMap.has(a)||(r.urlReferenceIdMap.set(a,1),r.references.push(o)):r.references.push(o)),l},references:[],urlReferenceIdMap:new Map,append:()=>{const t=R;let e="";return t.references&&t.references.length&&(e=`
94
+ `}},k.inlineLink={filter:function(t,e){return!!(e?.linkStyle==="inlined"&&t.nodeName==="A"&&t.getAttribute("href"))},replacement:function(t,e){const n=de(t);let i=e.getAttribute("href")?.replace(/([()])/g,"\\$1"),r;const s=e.getAttribute("title");return s?r=' "'+b(s).replace(/"/g,'\\"')+'"':r="","["+n+"]("+i+r+")"}};const L={filter:function(t,e){return!!(e&&e.linkStyle==="referenced"&&t.nodeName==="A"&&t.getAttribute("href"))},replacement:function(t,e,n){const i=L,r=e.getAttribute("href");let s;const l=e.getAttribute("title");l?s=' "'+b(l)+'"':s="";const u=r+s;let c,g;switch(n.linkReferenceStyle){case"collapsed":c="["+t+"][]",g="["+t+"]: "+u;break;case"shortcut":c="["+t+"]",g="["+t+"]: "+u;break;default:{let m;const E=i.urlReferenceIdMap.get(u);n.linkReferenceDeduplication==="full"&&E?(m=E,g="["+m+"]: "+r+s):(m=i.references.length+1,i.urlReferenceIdMap.set(u,m),g="["+m+"]: "+r+s,i.references.push(g)),c="["+t+"]["+m+"]";break}}return n.linkReferenceStyle!=="full"&&(n.linkReferenceDeduplication==="full"?i.urlReferenceIdMap.has(u)||(i.urlReferenceIdMap.set(u,1),i.references.push(g)):i.references.push(g)),c},references:[],urlReferenceIdMap:new Map,append:()=>{const t=L;let e="";return t.references&&t.references.length&&(e=`
46
95
 
47
96
  `+t.references.join(`
48
97
  `)+`
49
98
 
50
- `,t.references=[],t.urlReferenceIdMap=new Map),e}};f.referenceLink=R,f.emphasis={filter:["em","i"],replacement:(t,e,n)=>(t=t.trim(),t?n.emDelimiter+t+n.emDelimiter:"")},f.strong={filter:["strong","b"],replacement:(t,e,n)=>(t=t.trim(),t?n.strongDelimiter+t+n.strongDelimiter:"")},f.code={filter:t=>{const e=t.previousSibling||t.nextSibling,r=t.parentNode.nodeName==="PRE"&&!e;return t.nodeName==="CODE"&&!r},replacement:t=>{const e=t.replace(/\r?\n|\r/g," "),n=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"";let r="`";const i=e.match(/`+/gm)||[];for(;i.includes(r);)r=r+"`";return r+n+e+n+r}},f.image={filter:"img",replacement:function(t,e){const n=e.getAttribute("alt"),r=n?g(n):"",i=e.getAttribute("src")||"",s=e.getAttribute("title"),c=s?g(s):"",a=c?' "'+c+'"':"";return i?"!["+r+"]("+i+a+")":""}};class K{options;_keep;_remove;blankRule;keepReplacement;markdownIncludingHtmlReplacement;defaultRule;array;constructor(e){this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.markdownIncludingHtmlReplacement=e.markdownIncludingHtmlReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[];for(const n in e.rules)this.array.push(e.rules[n])}add(e,n){this.array.unshift(n)}keep(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})}remove(e){this._remove.unshift({filter:e,replacement:function(){return""}})}forNode(e){if(e.isBlank)return this.blankRule;if(this.options.htmlRetentionMode==="preserveAll"&&this.isUnsupportedElement(e))return{replacement:this.keepReplacement};if(this.options.htmlRetentionMode==="markdownIncludingHtml"&&this.isUnsupportedElement(e))return{replacement:this.markdownIncludingHtmlReplacement};let n;return(n=E(this.array,e,this.options))||(n=E(this._keep,e,this.options))||(n=E(this._remove,e,this.options))?n:this.defaultRule}isUnsupportedElement(e){const n=e.nodeName;if(n==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"){const r=e.firstChild;if(r.attributes&&r.attributes.length>0){for(let i=0;i<r.attributes.length;i++)if(r.attributes[i].name.toLowerCase()!=="class")return!0}}if(e.attributes&&e.attributes.length>0)switch(n){case"IMG":for(let i=0;i<e.attributes.length;i++){const s=e.attributes[i].name.toLowerCase();if(s!=="src"&&s!=="alt"&&s!=="title")return!0}return!1;case"A":for(let i=0;i<e.attributes.length;i++){const s=e.attributes[i].name.toLowerCase();if(s!=="href"&&s!=="title")return!0}return!1;case"CODE":const r=e.parentNode;if(r&&r.nodeName==="PRE"){for(let i=0;i<e.attributes.length;i++)if(e.attributes[i].name.toLowerCase()!=="class")return!0;return!1}default:return!0}return z.indexOf(n)===-1}forEach(e){for(let n=0;n<this.array.length;n++)e(this.array[n],n)}}function E(t,e,n){for(let r=0;r<t.length;r++){const i=t[r];if(j(i,e,n))return i}}function j(t,e,n){const r=t.filter;if(typeof r=="string"){if(r===e.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(e.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r(e,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function");return!1}function Y(t){const e=t.element,n=t.isBlock,r=t.isVoid,i=t.isPre||function(o){return o.nodeName==="PRE"};if(!e.firstChild||i(e))return;let s=null,c=!1,a=null,l=M(a,e,i);for(;l!==e;){if(l.nodeType===p.Text||l.nodeType===p.CDATASection){const u=l;let m=u.data.replace(/[ \r\n\t]+/g," ");if((!s||/ $/.test(s.data))&&!c&&m[0]===" "&&(m=m.substr(1)),!m){l=A(l);continue}u.data=m,s=u}else if(l.nodeType===p.Element)n(l)||l.nodeName==="BR"?(s&&(s.data=s.data.replace(/ $/,"")),s=null,c=!1):r(l)||i(l)?(s=null,c=!0):s&&(c=!1);else{l=A(l);continue}const o=M(a,l,i);a=l,l=o}s&&(s.data=s.data.replace(/ $/,""),s.data||A(s))}function A(t){const e=t.nextSibling??t.parentNode;return t.parentNode&&t.parentNode.removeChild(t),e}function M(t,e,n){return t&&t.parentNode===e||n(e)?e.nextSibling??e.parentNode:e.firstChild??e.nextSibling??e.parentNode}const y=typeof window<"u"?window:typeof globalThis<"u"?globalThis:{};function q(){const t=typeof y.DOMParser<"u"?y.DOMParser:void 0;let e=!1;if(!t)return!1;try{new t().parseFromString("","text/html")&&(e=!0)}catch{}return e}class B{parseFromString(e,n){throw new Error("Not implemented")}}function Q(){if(typeof window<"u"&&typeof document<"u"&&(typeof process>"u"||process.browser),typeof window<"u"){class t extends B{parseFromString(n,r){const i=document.implementation.createHTMLDocument("");return i.open(),i.write(n),i.close(),i}}return new t}else{const t=require("@mixmark-io/domino");class e extends B{parseFromString(r,i){return t.createDocument(r)}}return new e}}const X=()=>q()?new y.DOMParser:Q();function J(t,{preformattedCode:e}){let n;return typeof t=="string"?n=ee().parseFromString('<x-turnish id="turnish-root">'+t+"</x-turnish>","text/html").getElementById("turnish-root"):n=t.cloneNode(!0),Y({element:n,isBlock:T,isVoid:O,isPre:e?te:void 0}),n}let Z;function ee(){return Z??=X()}function te(t){return t.nodeName==="PRE"||t.nodeName==="CODE"}const ne=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/_/g,"\\_"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/<([^>]*)>/g,"\\<$1\\>"],[/^>/g,"\\>"],[/^(\d+)\. /g,"$1\\. "]],re={rules:f,headingStyle:"atx",hr:"---",bulletListMarker:"-",listMarkerSpaceCount:1,listItemIndent:"space",listItemIndentSpaceCount:4,codeBlockStyle:"fenced",fence:"```",emDelimiter:"*",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",linkReferenceDeduplication:"full",br:" ",preformattedCode:!1,htmlRetentionMode:"standard",blankReplacement:(t,e)=>e.isBlock?`
99
+ `,t.references=[],t.urlReferenceIdMap=new Map),e}};k.referenceLink=L,k.emphasis={filter:["em","i"],replacement:(t,e,n)=>(t=t.trim(),t?n.emDelimiter+t+n.emDelimiter:"")},k.strong={filter:["strong","b"],replacement:(t,e,n)=>(t=t.trim(),t?n.strongDelimiter+t+n.strongDelimiter:"")},k.code={filter:t=>{const e=t.parentNode,n=Y(e);return t.nodeName==="CODE"&&!n},replacement:t=>{const e=t.replace(/\r?\n|\r/g," "),n=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"";let i="`";const r=e.match(/`+/gm)||[];for(;r.includes(i);)i=i+"`";return i+n+e+n+i}},k.image={filter:"img",replacement:function(t,e){const n=e.getAttribute("alt"),i=n?b(n):"",r=e.getAttribute("src")||"",s=e.getAttribute("title"),l=s?b(s):"",u=l?' "'+l+'"':"";return r?"!["+i+"]("+r+u+")":""}};class ke{options;_keep;_remove;blankRule;keepReplacement;markdownIncludingHtmlReplacement;defaultRule;array;constructor(e){this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.markdownIncludingHtmlReplacement=e.markdownIncludingHtmlReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[];for(const n in e.rules)this.array.push(e.rules[n])}add(e,n){this.array.unshift(n)}keep(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})}remove(e){this._remove.unshift({filter:e,replacement:function(){return""}})}forNode(e){if(e.isBlank)return this.blankRule;if(this.options.htmlRetentionMode==="preserveAll"&&this.isUnsupportedElement(e))return{replacement:this.keepReplacement};if(this.options.htmlRetentionMode==="markdownIncludingHtml"&&this.isUnsupportedElement(e))return{replacement:this.markdownIncludingHtmlReplacement};let n;return(n=D(this.array,e,this.options))||(n=D(this._keep,e,this.options))||(n=D(this._remove,e,this.options))?n:this.defaultRule}isUnsupportedElement(e){const n=e.nodeName;if(n==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"){const i=e.firstChild;if(i.attributes&&i.attributes.length>0){for(let r=0;r<i.attributes.length;r++)if(i.attributes[r].name.toLowerCase()!=="class")return!0}}if(e.attributes&&e.attributes.length>0)switch(n){case"IMG":for(let r=0;r<e.attributes.length;r++){const s=e.attributes[r].name.toLowerCase();if(s!=="src"&&s!=="alt"&&s!=="title")return!0}return!1;case"A":for(let r=0;r<e.attributes.length;r++){const s=e.attributes[r].name.toLowerCase();if(s!=="href"&&s!=="title")return!0}return!1;case"CODE":const i=e.parentNode;if(i&&i.nodeName==="PRE"){for(let r=0;r<e.attributes.length;r++)if(e.attributes[r].name.toLowerCase()!=="class")return!0;return!1}default:return!0}return he.indexOf(n)===-1}forEach(e){for(let n=0;n<this.array.length;n++)e(this.array[n],n)}}function D(t,e,n){for(let i=0;i<t.length;i++){const r=t[i];if(Ne(r,e,n))return r}}function Ne(t,e,n){const i=t.filter;if(typeof i=="string"){if(i===e.nodeName.toLowerCase())return!0}else if(Array.isArray(i)){if(i.indexOf(e.nodeName.toLowerCase())>-1)return!0}else if(typeof i=="function"){if(i(e,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function");return!1}function Ee(t){const e=t.element,n=t.isBlock,i=t.isVoid,r=t.isPre||function(g){return g.nodeName==="PRE"};if(!e.firstChild||r(e))return;let s=null,l=!1,u=null,c=q(u,e,r);for(;c!==e;){if(c.nodeType===x.Text||c.nodeType===x.CDATASection){const m=c;let E=m.data.replace(/[ \r\n\t]+/g," ");if((!s||/ $/.test(s.data))&&!l&&E[0]===" "&&(E=E.substr(1)),!E){c=I(c);continue}m.data=E,s=m}else if(c.nodeType===x.Element)n(c)||c.nodeName==="BR"?(s&&(s.data=s.data.replace(/ $/,"")),s=null,l=!1):i(c)||r(c)?(s=null,l=!0):s&&(l=!1);else{c=I(c);continue}const g=q(u,c,r);u=c,c=g}s&&(s.data=s.data.replace(/ $/,""),s.data||I(s))}function I(t){const e=t.nextSibling??t.parentNode;return t.parentNode&&t.parentNode.removeChild(t),e}function q(t,e,n){return t&&t.parentNode===e||n(e)?e.nextSibling??e.parentNode:e.firstChild??e.nextSibling??e.parentNode}const B=typeof window<"u"?window:typeof globalThis<"u"?globalThis:{};function Te(){const t=typeof B.DOMParser<"u"?B.DOMParser:void 0;let e=!1;if(!t)return!1;try{new t().parseFromString("","text/html")&&(e=!0)}catch{}return e}class Q{parseFromString(e,n){throw new Error("Not implemented")}}function xe(){if(typeof window<"u"&&typeof document<"u"&&(typeof process>"u"||process.browser),typeof window<"u"){class t extends Q{parseFromString(n,i){const r=document.implementation.createHTMLDocument("");return r.open(),r.write(n),r.close(),r}}return new t}else{const t=require("@mixmark-io/domino");class e extends Q{parseFromString(i,r){return t.createDocument(i)}}return new e}}const $e=()=>Te()?new B.DOMParser:xe();function Ae(t,{preformattedCode:e}){let n;return typeof t=="string"?n=be().parseFromString('<x-turnish id="turnish-root">'+t+"</x-turnish>","text/html").getElementById("turnish-root"):n=t.cloneNode(!0),Ee({element:n,isBlock:M,isVoid:z,isPre:e?Ce:void 0}),n}let Re;function be(){return Re??=$e()}function Ce(t){return t.nodeName==="PRE"||t.nodeName==="CODE"}const we=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/_/g,"\\_"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/<([^>]*)>/g,"\\<$1\\>"],[/^>/g,"\\>"],[/^(\d+)\. /g,"$1\\. "]],Oe={rules:k,headingStyle:"atx",hr:"---",bulletListMarker:"-",listMarkerSpaceCount:1,listItemIndent:"space",listItemIndentSpaceCount:4,codeBlockStyle:"fenced",fence:"```",emDelimiter:"*",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",linkReferenceDeduplication:"full",br:" ",preformattedCode:!1,htmlRetentionMode:"standard",blankReplacement:(t,e)=>e.isBlock?`
51
100
 
52
101
  `:"",keepReplacement:(t,e)=>e.isBlock?`
53
102
 
54
103
  `+e.outerHTML+`
55
104
 
56
- `:e.outerHTML,markdownIncludingHtmlReplacement:(t,e)=>{const n=e.nodeName.toLowerCase();let r="";if(e.attributes&&e.attributes.length>0){const l=[];for(let o=0;o<e.attributes.length;o++){const u=e.attributes[o];l.push(`${u.name}="${u.value}"`)}r=" "+l.join(" ")}r+=' markdown="1"';const i=`<${n}${r}>`,s=`</${n}>`,c=t.trim(),a=i+`
57
- `+c+`
105
+ `:e.outerHTML,markdownIncludingHtmlReplacement:(t,e)=>{const n=e.nodeName.toLowerCase();let i="";if(e.attributes&&e.attributes.length>0){const c=[];for(let g=0;g<e.attributes.length;g++){const m=e.attributes[g];c.push(`${m.name}="${m.value}"`)}i=" "+c.join(" ")}i+=' markdown="1"';const r=`<${n}${i}>`,s=`</${n}>`,l=t.trim(),u=r+`
106
+ `+l+`
58
107
  `+s;return e.isBlock?`
59
108
 
60
- `+a+`
109
+ `+u+`
61
110
 
62
- `:a},defaultReplacement:function(t,e){return e.isBlock?`
111
+ `:u},defaultReplacement:function(t,e){return e.isBlock?`
63
112
 
64
113
  `+t+`
65
114
 
66
- `:t}};class ie{options;rules;constructor(e){this.options=Object.assign({},re,e),this.rules=new K(this.options)}render(e){if(!se(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";const n=this.process(J(e,this.options));return this.postProcess(n)}use(e){if(Array.isArray(e))for(let n=0;n<e.length;n++)this.use(e[n]);else if(typeof e=="function")e(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this}addRule(e,n){return this.rules.add(e,n),this}keep(e){return this.rules.keep(e),this}remove(e){return this.rules.remove(e),this}escape(e){return ne.reduce(function(n,r){return n.replace(r[0],r[1])},e)}process(e){return Array.from(e.childNodes).reduce((n,r)=>{const i=H(r,this.options);let s="";if(i.nodeType===p.Text){let c=i.nodeValue??"";if(r.previousSibling&&r.previousSibling.nodeType===p.Element){const a=r.previousSibling;a.nodeName==="INPUT"&&a.getAttribute("type")==="checkbox"&&(c=c.replace(/^\s+/,""))}s=i.isCode?c:this.escape(c)}else i.nodeType===p.Element&&(s=this.replacementForNode(i));return P(n,s)},"")}postProcess(e){for(const n of this.rules.array)n.append&&(e=P(e,n.append(this.options)));return e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}replacementForNode(e){const n=this.rules.forNode(e);let r=this.process(e);const i=e.flankingWhitespace;return(i.leading||i.trailing)&&(r=r.trim()),i.leading+n.replacement(r,e,this.options)+i.trailing}}function P(t,e){const n=S(t),r=C(e),i=Math.max(t.length-n.length,e.length-r.length),s=`
115
+ `:t}};class Se{options;rules;constructor(e){this.options=Object.assign({},Oe,e),this.rules=new ke(this.options)}render(e){if(!Me(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";const n=this.process(Ae(e,this.options));return this.postProcess(n)}use(e){if(Array.isArray(e))for(let n=0;n<e.length;n++)this.use(e[n]);else if(typeof e=="function")e(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this}addRule(e,n){return this.rules.add(e,n),this}keep(e){return this.rules.keep(e),this}remove(e){return this.rules.remove(e),this}escape(e){return we.reduce(function(n,i){return n.replace(i[0],i[1])},e)}process(e){return Array.from(e.childNodes).reduce((n,i)=>{const r=oe(i,this.options);let s="";if(r.nodeType===x.Text){let l=r.nodeValue??"";if(i.previousSibling&&i.previousSibling.nodeType===x.Element){const u=i.previousSibling;u.nodeName==="INPUT"&&u.getAttribute("type")==="checkbox"&&(l=l.replace(/^\s+/,""))}s=r.isCode?l:this.escape(l)}else r.nodeType===x.Element&&(s=this.replacementForNode(r));return X(n,s)},"")}postProcess(e){for(const n of this.rules.array)n.append&&(e=X(e,n.append(this.options)));return e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}replacementForNode(e){const n=this.rules.forNode(e);let i=this.process(e);const r=e.flankingWhitespace;return(r.leading||r.trailing)&&(i=i.trim()),r.leading+n.replacement(i,e,this.options)+r.trailing}isCodeBlock(e){return Y(e)}}function X(t,e){const n=_(t),i=F(e),r=Math.max(t.length-n.length,e.length-i.length),s=`
67
116
 
68
- `.substring(0,i);return n+s+r}function se(t){return t!=null&&(typeof t=="string"||t.nodeType&&(t.nodeType===1||t.nodeType===9||t.nodeType===11))}return ie})();
117
+ `.substring(0,r);return n+s+i}function Me(t){return t!=null&&(typeof t=="string"||t.nodeType&&(t.nodeType===1||t.nodeType===9||t.nodeType===11))}return Se})();
69
118
  //# sourceMappingURL=index.iife.js.map