turnish 1.6.1 → 1.6.2

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.
@@ -47,9 +47,9 @@ ${this.indent(1)}`)+this.mapVisit(e.rules,`
47
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
48
  `).join(`
49
49
  `.padEnd(22)+this.indent()),e.position)+this.emit(";"):this.emit(this.indent())+this.emit(`${e.property}: ${e.value}`,e.position)+this.emit(";")}}var ae={parse:(t,e)=>{e=e||{};let n=1,i=1;function r(){const a={line:n,column:i};return o=>(o.position=new se(a,{line:n,column:i},e?.source||""),E(),o)}const s=[];function l(a){const o=new re(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=Be()||Pe(),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=R();for(;o;)a.push(o),o=R();return a}function R(){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 ee(){const a=/^([^{]+)/.exec(t);if(a)return m(a),((o,h)=>{const p=[];let y=0;for(;y<o.length;){const N=w(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(O,""),[","]).map(o=>T(o))}function $(){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=w(t,[";","}"]);N!==-1&&(y=t.substring(0,N),m([y]),y=T(y).replace(O,""));const A=a({type:f.declaration,property:h.replace(O,""),value:y}),ie=/^[;\s]*/.exec(t);return ie&&m(ie),A}function te(){const a=[];if(!u())return l("missing '{'");d(a);let o=$();for(;o;)a.push(o),d(a),o=$();return c()?a:l("missing '}'")}function ne(){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:te()||[]})}const Le=V("import"),De=V("charset"),Ie=V("namespace");function V(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 Be(){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(),A=ne();for(;A;)N.push(A),N=N.concat(d()),A=ne();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 '}'")})()||Le()||De()||Ie()||(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=ee()||[];if(!u())return l("@page missing '{'");let p=d(),y=$();for(;y;)p.push(y),p=p.concat(d()),y=$();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=$();for(;p;)h.push(p),h=h.concat(d()),p=$();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 Pe(){const a=r(),o=ee();return o?(d(),a({type:f.rule,selectors:o,declarations:te()||[]})):l("selector missing")}return S((function(){const a=g();return{type:f.stylesheet,stylesheet:{source:e?.source,rules:a,parsingErrors:s}}})())},stringify:(t,e)=>new oe(e||{}).compile(t)};function ce(t,e){const n=t;return n.isBlock=v(n),n.isCode=n.nodeName==="CODE"||n.parentNode?.isCode,n.isBlank=le(n),n.flankingWhitespace=ue(n,e),n}function le(t){return!W(t)&&!de(t)&&/^\s*$/i.test(t.textContent||"")&&!fe(t)&&!ge(t)}function ue(t,e){const n=t;if(n.isBlock||e.preformattedCode&&n.isCode)return{leading:"",trailing:""};const i=me(t.textContent||"");return i.leadingAscii&&F("left",t,e)&&(i.leading=i.leadingNonAscii),i.trailingAscii&&F("right",t,e)&&(i.trailing=i.trailingNonAscii),{leading:i.leading,trailing:i.trailing}}function me(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 F(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&&!v(i)&&(s=r.test(i.textContent||""))),s||!1}const x={Element:1,Text:3,CDATASection:4,Comment:8};function M(t,e){return Array(e+1).join(t)}function _(t){return t.replace(/^\n*/,"")}function U(t){let e=t.length;for(;e>0&&t[e-1]===`
51
- `;)e--;return t.substring(0,e)}function j(t){return U(_(t))}const he=["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 v(t){return L(t,he)}const z=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function W(t){return L(t,z)}function fe(t){return K(t,z)}const G=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"],pe=["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 de(t){return L(t,G)}function ge(t){return K(t,G)}function L(t,e){return e.indexOf(t.nodeName)>=0}function K(t,e){return e.some(function(n){return t.nodeType!==x.Element?!1:t.getElementsByTagName(n).length})}function Y(t){return t?t.replace(/(\n+\s*)+/g,`
52
- `):""}function ye(t){return Y(t).replace(/[\t\r\n]+/g," ").replace(/ {2,}/g," ").trim()}function C(t){return Y(t).replace(/[\t\r\n]+/g," ")}function ke(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 Ne(t){if(t.nodeName!=="PRE"||t.nodeType!==x.Element)return!1;const e=t.getAttribute("style");if(!e)return!1;const n=ae.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 q(t){return ke(t)||Ne(t)?!0:t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"||!1}const k={};k.paragraph={filter:"p",replacement:function(t){return`
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 ee(){const a=/^([^{]+)/.exec(t);if(a)return m(a),((o,h)=>{const p=[];let y=0;for(;y<o.length;){const N=w(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(O,""),[","]).map(o=>T(o))}function x(){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=w(t,[";","}"]);N!==-1&&(y=t.substring(0,N),m([y]),y=T(y).replace(O,""));const A=a({type:f.declaration,property:h.replace(O,""),value:y}),ie=/^[;\s]*/.exec(t);return ie&&m(ie),A}function te(){const a=[];if(!u())return l("missing '{'");d(a);let o=x();for(;o;)a.push(o),d(a),o=x();return c()?a:l("missing '}'")}function ne(){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:te()||[]})}const Le=V("import"),De=V("charset"),Ie=V("namespace");function V(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 Be(){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(),A=ne();for(;A;)N.push(A),N=N.concat(d()),A=ne();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 '}'")})()||Le()||De()||Ie()||(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=ee()||[];if(!u())return l("@page missing '{'");let p=d(),y=x();for(;y;)p.push(y),p=p.concat(d()),y=x();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=x();for(;p;)h.push(p),h=h.concat(d()),p=x();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 Pe(){const a=r(),o=ee();return o?(d(),a({type:f.rule,selectors:o,declarations:te()||[]})):l("selector missing")}return S((function(){const a=g();return{type:f.stylesheet,stylesheet:{source:e?.source,rules:a,parsingErrors:s}}})())},stringify:(t,e)=>new oe(e||{}).compile(t)};function ce(t,e){const n=t;return n.isBlock=v(n),n.isCode=n.nodeName==="CODE"||n.parentNode?.isCode,n.isBlank=le(n),n.flankingWhitespace=ue(n,e),n}function le(t){return!W(t)&&!de(t)&&/^\s*$/i.test(t.textContent||"")&&!fe(t)&&!ge(t)}function ue(t,e){const n=t;if(n.isBlock||e.preformattedCode&&n.isCode)return{leading:"",trailing:""};const i=me(t.textContent||"");return i.leadingAscii&&F("left",t,e)&&(i.leading=i.leadingNonAscii),i.trailingAscii&&F("right",t,e)&&(i.trailing=i.trailingNonAscii),{leading:i.leading,trailing:i.trailing}}function me(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 F(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&&!v(i)&&(s=r.test(i.textContent||""))),s||!1}const R={Element:1,Text:3,CDATASection:4,Comment:8};function M(t,e){return Array(e+1).join(t)}function _(t){return t.replace(/^\n*/,"")}function U(t){let e=t.length;for(;e>0&&t[e-1]===`
51
+ `;)e--;return t.substring(0,e)}function j(t){return U(_(t))}const he=["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 v(t){return L(t,he)}const z=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function W(t){return L(t,z)}function fe(t){return K(t,z)}const G=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"],pe=["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 de(t){return L(t,G)}function ge(t){return K(t,G)}function L(t,e){return e.indexOf(t.nodeName)>=0}function K(t,e){return e.some(function(n){return t.nodeType!==R.Element?!1:t.getElementsByTagName(n).length})}function Y(t){return t?t.replace(/(\n+\s*)+/g,`
52
+ `):""}function ye(t){return Y(t).replace(/[\t\r\n]+/g," ").replace(/ {2,}/g," ").trim()}function C(t){return Y(t).replace(/[\t\r\n]+/g," ")}function ke(t){const e=t.parentNode;return e?e.nodeType===R.Element&&e.classList&&e.classList.contains("code")&&e.nodeName==="TD"&&t.nodeName==="PRE":!1}function Ne(t){if(t.nodeName!=="PRE"||t.nodeType!==R.Element)return!1;const e=t.getAttribute("style");if(!e)return!1;const n=ae.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 q(t){return ke(t)||Ne(t)?!0:t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"||!1}const k={};k.paragraph={filter:"p",replacement:function(t){return`
53
53
 
54
54
  `+t+`
55
55
 
@@ -72,8 +72,8 @@ ${this.indent()}}`)}declaration(e){return this.compress?this.emit(`${e.property}
72
72
 
73
73
  `+t+`
74
74
 
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"),R=Array.prototype.indexOf.call(r.children,e);i=(d?Number(d)+R:R+1)+"."+" ".repeat(n.listMarkerSpaceCount)}const s=/\n$/.test(t);if(t=j(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?`
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=j(t)+(s?`
76
+ `:""),e.childNodes.length>0&&Array.from(e.childNodes).every(d=>d.nodeType===R.Text&&/^\s*$/.test(d.nodeValue||"")||d.nodeType===R.Element&&["UL","OL"].includes(d.nodeName))&&t.trim()!=="")return t+(e.nextSibling?`
77
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
78
  `+g),m+i+t+(e.nextSibling?`
79
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?"":`
@@ -81,11 +81,11 @@ ${this.indent()}}`)}declaration(e){return this.compress?this.emit(`${e.property}
81
81
  `+e.firstChild.textContent.replace(/\n/g,`
82
82
  `)+`
83
83
 
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 R=M(g,m);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 $=M(g,m);return`
85
85
 
86
- `+R+u+`
86
+ `+$+u+`
87
87
  `+c.replace(/\n$/,"")+`
88
- `+R+`
88
+ `+$+`
89
89
 
90
90
  `}},k.horizontalRule={filter:"hr",replacement:function(t,e,n){return`
91
91
 
@@ -96,7 +96,7 @@ ${this.indent()}}`)}declaration(e){return this.compress?this.emit(`${e.property}
96
96
  `+t.references.join(`
97
97
  `)+`
98
98
 
99
- `,t.references=[],t.urlReferenceIdMap=new Map),e}};k.referenceLink=D,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=q(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?C(n):"",r=e.getAttribute("src")||"",s=e.getAttribute("title"),l=s?C(s):"",u=l?' "'+l+'"':"";return r?"!["+i+"]("+r+u+")":""}};class Q{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=I(this.array,e,this.options))||(n=I(this._keep,e,this.options))||(n=I(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 pe.indexOf(n)===-1}forEach(e){for(let n=0;n<this.array.length;n++)e(this.array[n],n)}}function I(t,e,n){for(let i=0;i<t.length;i++){const r=t[i];if(Ee(r,e,n))return r}}function Ee(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 Te(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=X(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=B(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=B(c);continue}const g=X(u,c,r);u=c,c=g}s&&(s.data=s.data.replace(/ $/,""),s.data||B(s))}function B(t){const e=t.nextSibling??t.parentNode;return t.parentNode&&t.parentNode.removeChild(t),e}function X(t,e,n){return t&&t.parentNode===e||n(e)?e.nextSibling??e.parentNode:e.firstChild??e.nextSibling??e.parentNode}const P=typeof window<"u"?window:typeof globalThis<"u"?globalThis:{};function xe(){const t=typeof P.DOMParser<"u"?P.DOMParser:void 0;let e=!1;if(!t)return!1;try{new t().parseFromString("","text/html")&&(e=!0)}catch{}return e}class J{parseFromString(e,n){throw new Error("Not implemented")}}function Re(){if(typeof window<"u"&&typeof document<"u"&&(typeof process>"u"||process.browser),typeof window<"u"){class t extends J{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 J{parseFromString(i,r){return t.createDocument(i)}}return new e}}const $e=()=>xe()?new P.DOMParser:Re();function be(t,{preformattedCode:e}){let n;return typeof t=="string"?n=Ce().parseFromString('<x-turnish id="turnish-root">'+t+"</x-turnish>","text/html").getElementById("turnish-root"):n=t.cloneNode(!0),Te({element:n,isBlock:v,isVoid:W,isPre:e?we:void 0}),n}let Ae;function Ce(){return Ae??=$e()}function we(t){return t.nodeName==="PRE"||t.nodeName==="CODE"}const Oe=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/_/g,"\\_"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/<([^>]*)>/g,"\\<$1\\>"],[/^>/g,"\\>"],[/^(\d+)\. /g,"$1\\. "]],Se={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?`
99
+ `,t.references=[],t.urlReferenceIdMap=new Map),e}};k.referenceLink=D,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=q(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?C(n):"",r=e.getAttribute("src")||"",s=e.getAttribute("title"),l=s?C(s):"",u=l?' "'+l+'"':"";return r?"!["+i+"]("+r+u+")":""}};class Q{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=I(this.array,e,this.options))||(n=I(this._keep,e,this.options))||(n=I(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 pe.indexOf(n)===-1}forEach(e){for(let n=0;n<this.array.length;n++)e(this.array[n],n)}}function I(t,e,n){for(let i=0;i<t.length;i++){const r=t[i];if(Ee(r,e,n))return r}}function Ee(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 Te(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=X(u,e,r);for(;c!==e;){if(c.nodeType===R.Text||c.nodeType===R.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=B(c);continue}m.data=E,s=m}else if(c.nodeType===R.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=B(c);continue}const g=X(u,c,r);u=c,c=g}s&&(s.data=s.data.replace(/ $/,""),s.data||B(s))}function B(t){const e=t.nextSibling??t.parentNode;return t.parentNode&&t.parentNode.removeChild(t),e}function X(t,e,n){return t&&t.parentNode===e||n(e)?e.nextSibling??e.parentNode:e.firstChild??e.nextSibling??e.parentNode}const P=typeof window<"u"?window:typeof globalThis<"u"?globalThis:{};function Re(){const t=typeof P.DOMParser<"u"?P.DOMParser:void 0;let e=!1;if(!t)return!1;try{new t().parseFromString("","text/html")&&(e=!0)}catch{}return e}class J{parseFromString(e,n){throw new Error("Not implemented")}}function $e(){if(typeof window<"u"&&typeof document<"u"&&(typeof process>"u"||process.browser),typeof window<"u"){class t extends J{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 J{parseFromString(i,r){return t.createDocument(i)}}return new e}}const be=()=>Re()?new P.DOMParser:$e();function xe(t,{preformattedCode:e}){let n;return typeof t=="string"?n=Ce().parseFromString('<x-turnish id="turnish-root">'+t+"</x-turnish>","text/html").getElementById("turnish-root"):n=t.cloneNode(!0),Te({element:n,isBlock:v,isVoid:W,isPre:e?we:void 0}),n}let Ae;function Ce(){return Ae??=be()}function we(t){return t.nodeName==="PRE"||t.nodeName==="CODE"}const Oe=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/_/g,"\\_"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/<([^>]*)>/g,"\\<$1\\>"],[/^>/g,"\\>"],[/^(\d+)\. /g,"$1\\. "]],Se={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?`
100
100
 
101
101
  `:"",keepReplacement:(t,e)=>e.isBlock?`
102
102
 
@@ -112,7 +112,7 @@ ${this.indent()}}`)}declaration(e){return this.compress?this.emit(`${e.property}
112
112
 
113
113
  `+t+`
114
114
 
115
- `:t}};class Me{options;rules;constructor(e){this.options=Object.assign({},Se,e),this.rules=new Q(this.options)}render(e){if(!ve(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";const n=this.process(be(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 Oe.reduce(function(n,i){return n.replace(i[0],i[1])},e)}process(e){return Array.from(e.childNodes).reduce((n,i)=>{const r=ce(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 Z(n,s)},"")}postProcess(e){for(const n of this.rules.array)n.append&&(e=Z(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 q(e)}}function Z(t,e){const n=U(t),i=_(e),r=Math.max(t.length-n.length,e.length-i.length),s=`
115
+ `:t}};class Me{options;rules;constructor(e){this.options=Object.assign({},Se,e),this.rules=new Q(this.options)}render(e){if(!ve(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";const n=this.process(xe(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 Oe.reduce(function(n,i){return n.replace(i[0],i[1])},e)}process(e){return Array.from(e.childNodes).reduce((n,i)=>{const r=ce(i,this.options);let s="";if(r.nodeType===R.Text){let l=r.nodeValue??"";if(i.previousSibling&&i.previousSibling.nodeType===R.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===R.Element&&(s=this.replacementForNode(r));return Z(n,s)},"")}postProcess(e){for(const n of this.rules.array)n.append&&(e=Z(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}}function Z(t,e){const n=U(t),i=_(e),r=Math.max(t.length-n.length,e.length-i.length),s=`
116
116
 
117
- `.substring(0,r);return n+s+i}function ve(t){return t!=null&&(typeof t=="string"||t.nodeType&&(t.nodeType===1||t.nodeType===9||t.nodeType===11))}return b.NodeTypes=x,b.Rules=Q,b.default=Me,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),b})({});
117
+ `.substring(0,r);return n+s+i}function ve(t){return t!=null&&(typeof t=="string"||t.nodeType&&(t.nodeType===1||t.nodeType===9||t.nodeType===11))}return b.NodeTypes=R,b.Rules=Q,b.default=Me,b.isCodeBlock=q,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),b})({});
118
118
  //# sourceMappingURL=index.iife.js.map