prettier 3.6.0 → 3.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.
@@ -58,6 +58,6 @@ ${r.content}`};var Vl=new Set(["position","raw"]);function fi(e,r,t){if((e.type=
58
58
  `)return L;let a=r===" "||r===`
59
59
  `&&xf(e,n);return kf(e,r,t,n)?a?_r:Sr:a?" ":""}var Bf=new Set(["listItem","definition"]);function ji(e){var a,i;let{previous:r,next:t}=e;return(r==null?void 0:r.type)==="sentence"&&((a=z(!1,r.children,-1))==null?void 0:a.type)==="word"&&!z(!1,r.children,-1).hasTrailingPunctuation||(t==null?void 0:t.type)==="sentence"&&((i=t.children[0])==null?void 0:i.type)==="word"&&!t.children[0].hasLeadingPunctuation}function Tf(e,r,t){var a;let{node:n}=e;if(Lf(e)){let i=[""],u=Nr(r.originalText.slice(n.position.start.offset,n.position.end.offset));for(let o of u){if(o.type==="word"){i.push([i.pop(),o.value]);continue}let s=Bt(e,o.value,r.proseWrap,!0);if(G(s)===Y){i.push([i.pop(),s]);continue}i.push(s,"")}return ze(i)}switch(n.type){case"front-matter":return r.originalText.slice(n.position.start.offset,n.position.end.offset);case"root":return n.children.length===0?"":[Sf(e,r,t),L];case"paragraph":return Ui(e,r,t);case"sentence":return Yi(e,t);case"word":{let i=R(!1,R(!1,n.value,"*",String.raw`\*`),new RegExp([`(^|${Se.source})(_+)`,`(_+)(${Se.source}|$)`].join("|"),"gu"),(s,l,c,f,p)=>R(!1,c?`${l}${c}`:`${f}${p}`,"_",String.raw`\_`)),u=(s,l,c)=>s.type==="sentence"&&c===0,o=(s,l,c)=>Ct(s.children[c-1]);return i!==n.value&&(e.match(void 0,u,o)||e.match(void 0,u,(s,l,c)=>s.type==="emphasis"&&c===0,o))&&(i=i.replace(/^(\\?[*_])+/u,s=>R(!1,s,"\\",""))),i}case"whitespace":{let{next:i}=e,u=i&&/^>|^(?:[*+-]|#{1,6}|\d+[).])$/u.test(i.value)?"never":r.proseWrap;return Bt(e,n.value,u)}case"emphasis":{let i;if(Ct(n.children[0]))i=r.originalText[n.position.start.offset];else{let u=ji(e),o=((a=e.parent)==null?void 0:a.type)==="strong"&&ji(e.ancestors);i=u||o||e.hasAncestor(s=>s.type==="emphasis")?"*":"_"}return[i,j(e,r,t),i]}case"strong":return["**",j(e,r,t),"**"];case"delete":return["~~",j(e,r,t),"~~"];case"inlineCode":{let i=r.proseWrap==="preserve"?n.value:R(!1,n.value,`
60
60
  `," "),u=ei(i,"`"),o="`".repeat(u||1),s=i.startsWith("`")||i.endsWith("`")||/^[\n ]/u.test(i)&&/[\n ]$/u.test(i)&&/[^\n ]/u.test(i)?" ":"";return[o,s,i,s,o]}case"wikiLink":{let i="";return r.proseWrap==="preserve"?i=n.value:i=R(!1,n.value,/[\t\n]+/gu," "),["[[",i,"]]"]}case"link":switch(r.originalText[n.position.start.offset]){case"<":{let i="mailto:";return["<",n.url.startsWith(i)&&r.originalText.slice(n.position.start.offset+1,n.position.start.offset+1+i.length)!==i?n.url.slice(i.length):n.url,">"]}case"[":return["[",j(e,r,t),"](",Tt(n.url,")"),zr(n.title,r),")"];default:return r.originalText.slice(n.position.start.offset,n.position.end.offset)}case"image":return["![",n.alt||"","](",Tt(n.url,")"),zr(n.title,r),")"];case"blockquote":return["> ",Ae("> ",j(e,r,t))];case"heading":return["#".repeat(n.depth)+" ",j(e,r,t)];case"code":{if(n.isIndented){let o=" ".repeat(4);return Ae(o,[o,be(n.value,L)])}let i=r.__inJsTemplate?"~":"`",u=i.repeat(Math.max(3,Pr(n.value,i)+1));return[u,n.lang||"",n.meta?" "+n.meta:"",L,be(Mr(n,r.originalText),L),L,u]}case"html":{let{parent:i,isLast:u}=e,o=i.type==="root"&&u?n.value.trimEnd():n.value,s=/^<!--.*-->$/su.test(o);return be(o,s?L:_e(nr))}case"list":{let i=Hi(n,e.parent),u=ki(n,r);return j(e,r,t,{processor(o){let s=c(),l=o.node;if(l.children.length===2&&l.children[1].type==="html"&&l.children[0].position.start.column!==l.children[1].position.start.column)return[s,Wi(o,r,t,s)];return[s,Ae(" ".repeat(s.length),Wi(o,r,t,s))];function c(){let f=n.ordered?(o.isFirst?n.start:u?1:n.start+o.index)+(i%2===0?". ":") "):i%2===0?"- ":"* ";return(n.isAligned||n.hasIndentedCodeblock)&&n.ordered?qf(f,r):f}}})}case"thematicBreak":{let{ancestors:i}=e,u=i.findIndex(s=>s.type==="list");return u===-1?"---":Hi(i[u],i[u+1])%2===0?"***":"---"}case"linkReference":return["[",j(e,r,t),"]",n.referenceType==="full"?qt(n):n.referenceType==="collapsed"?"[]":""];case"imageReference":switch(n.referenceType){case"full":return["![",n.alt||"","]",qt(n)];default:return["![",n.alt,"]",n.referenceType==="collapsed"?"[]":""]}case"definition":{let i=r.proseWrap==="always"?_r:" ";return Ue([qt(n),":",ir([i,Tt(n.url),n.title===null?"":[i,zr(n.title,r,!1)]])])}case"footnote":return["[^",j(e,r,t),"]"];case"footnoteReference":return Qi(n);case"footnoteDefinition":{let i=n.children.length===1&&n.children[0].type==="paragraph"&&(r.proseWrap==="never"||r.proseWrap==="preserve"&&n.children[0].position.start.line===n.children[0].position.end.line);return[Qi(n),": ",i?j(e,r,t):Ue([Ae(" ".repeat(4),j(e,r,t,{processor:({isFirst:u})=>u?Ue([Sr,t()]):t()}))])]}case"table":return Mi(e,r,t);case"tableCell":return j(e,r,t);case"break":return/\s/u.test(r.originalText[n.position.start.offset])?[" ",_e(nr)]:["\\",L];case"liquidNode":return be(n.value,L);case"import":case"export":case"jsx":return n.value;case"esComment":return["{/* ",n.value," */}"];case"math":return["$$",L,n.value?[be(n.value,L),L]:"","$$"];case"inlineMath":return r.originalText.slice(Pe(n),Oe(n));case"tableRow":case"listItem":case"text":default:throw new ni(n,"Markdown")}}function Wi(e,r,t,n){let{node:a}=e,i=a.checked===null?"":a.checked?"[x] ":"[ ] ";return[i,j(e,r,t,{processor({node:u,isFirst:o}){if(o&&u.type!=="list")return Ae(" ".repeat(i.length),t());let s=" ".repeat(Rf(r.tabWidth-n.length,0,3));return[s,Ae(s,t())]}})]}function qf(e,r){let t=n();return e+" ".repeat(t>=4?0:t);function n(){let a=e.length%r.tabWidth;return a===0?0:r.tabWidth-a}}function Hi(e,r){return _f(e,r,t=>t.ordered===e.ordered)}function _f(e,r,t){let n=-1;for(let a of r.children)if(a.type===e.type&&t(a)?n++:n=-1,a===e)return n}function Sf(e,r,t){let n=[],a=null,{children:i}=e.node;for(let[u,o]of i.entries())switch(_t(o)){case"start":a===null&&(a={index:u,offset:o.position.end.offset});break;case"end":a!==null&&(n.push({start:a,end:{index:u,offset:o.position.start.offset}}),a=null);break;default:break}return j(e,r,t,{processor({index:u}){if(n.length>0){let o=n[0];if(u===o.start.index)return[Ki(i[o.start.index]),r.originalText.slice(o.start.offset,o.end.offset),Ki(i[o.end.index])];if(o.start.index<u&&u<o.end.index)return!1;if(u===o.end.index)return n.shift(),!1}return t()}})}function j(e,r,t,n={}){let{processor:a=t}=n,i=[];return e.each(()=>{let u=a(e);u!==!1&&(i.length>0&&Pf(e)&&(i.push(L),(Of(e,r)||Ji(e))&&i.push(L),Ji(e)&&i.push(L)),i.push(u))},"children"),i}function Ki(e){if(e.type==="html")return e.value;if(e.type==="paragraph"&&Array.isArray(e.children)&&e.children.length===1&&e.children[0].type==="esComment")return["{/* ",e.children[0].value," */}"]}function _t(e){let r;if(e.type==="html")r=e.value.match(/^<!--\s*prettier-ignore(?:-(start|end))?\s*-->$/u);else{let t;e.type==="esComment"?t=e:e.type==="paragraph"&&e.children.length===1&&e.children[0].type==="esComment"&&(t=e.children[0]),t&&(r=t.value.match(/^prettier-ignore(?:-(start|end))?$/u))}return r?r[1]||"next":!1}function Pf({node:e,parent:r}){let t=vt.has(e.type),n=e.type==="html"&&Rr.has(r.type);return!t&&!n}function Xi(e,r){return e.type==="listItem"&&(e.spread||r.originalText.charAt(e.position.end.offset-1)===`
61
- `)}function Of({node:e,previous:r,parent:t},n){if(Xi(r,n))return!0;let u=r.type===e.type&&Bf.has(e.type),o=t.type==="listItem"&&(e.type==="list"||!Xi(t,n)),s=_t(r)==="next",l=e.type==="html"&&r.type==="html"&&r.position.end.line+1===e.position.start.line,c=e.type==="html"&&t.type==="listItem"&&r.type==="paragraph"&&r.position.end.line+1===e.position.start.line;return!(u||o||s||l||c)}function Ji({node:e,previous:r}){let t=r.type==="list",n=e.type==="code"&&e.isIndented;return t&&n}function Lf(e){let r=e.findAncestor(t=>t.type==="linkReference"||t.type==="imageReference");return r&&(r.type!=="linkReference"||r.referenceType!=="full")}var If=(e,r)=>{for(let t of r)e=R(!1,e,t,encodeURIComponent(t));return e};function Tt(e,r=[]){let t=[" ",...Array.isArray(r)?r:[r]];return new RegExp(t.map(n=>le(n)).join("|"),"u").test(e)?`<${If(e,"<>")}>`:e}function zr(e,r,t=!0){if(!e)return"";if(t)return" "+zr(e,r,!1);if(e=R(!1,e,/\\(?=["')])/gu,""),e.includes('"')&&e.includes("'")&&!e.includes(")"))return`(${e})`;let n=ti(e,r.singleQuote);return e=R(!1,e,"\\","\\\\"),e=R(!1,e,n,`\\${n}`),`${n}${e}${n}`}function Rf(e,r,t){return Math.max(r,Math.min(e,t))}function Nf(e){return e.index>0&&_t(e.previous)==="next"}function qt(e){return`[${(0,Zi.default)(e.label)}]`}function Qi(e){return`[^${e.label}]`}var Mf={preprocess:Gi,print:Tf,embed:Bi,massageAstNode:Di,hasPrettierIgnore:Nf,insertPragma:ci,getVisitorKeys:_i},eu=Mf;var ru=[{name:"Markdown",type:"prose",extensions:[".md",".livemd",".markdown",".mdown",".mdwn",".mkd",".mkdn",".mkdown",".ronn",".scd",".workbook"],tmScope:"text.md",aceMode:"markdown",aliases:["md","pandoc"],codemirrorMode:"gfm",codemirrorMimeType:"text/x-gfm",filenames:["contents.lr","README"],wrap:!0,parsers:["markdown"],vscodeLanguageIds:["markdown"],linguistLanguageId:222},{name:"MDX",type:"prose",extensions:[".mdx"],tmScope:"text.md",aceMode:"markdown",aliases:["md","pandoc"],codemirrorMode:"gfm",codemirrorMimeType:"text/x-gfm",filenames:[],wrap:!0,parsers:["mdx"],vscodeLanguageIds:["mdx"],linguistLanguageId:222}];var St={bracketSpacing:{category:"Common",type:"boolean",default:!0,description:"Print spaces between brackets.",oppositeDescription:"Do not print spaces between brackets."},objectWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap object literals.",choices:[{value:"preserve",description:"Keep as multi-line, if there is a newline between the opening brace and first property."},{value:"collapse",description:"Fit to a single line when possible."}]},singleQuote:{category:"Common",type:"boolean",default:!1,description:"Use single quotes instead of double quotes."},proseWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap prose.",choices:[{value:"always",description:"Wrap prose if it exceeds the print width."},{value:"never",description:"Do not wrap prose."},{value:"preserve",description:"Wrap prose as-is."}]},bracketSameLine:{category:"Common",type:"boolean",default:!1,description:"Put > of opening tags on the last line instead of on a new line."},singleAttributePerLine:{category:"Common",type:"boolean",default:!1,description:"Enforce single attribute per line in HTML, Vue and JSX."}};var Uf={proseWrap:St.proseWrap,singleQuote:St.singleQuote},tu=Uf;var zn={};Yn(zn,{markdown:()=>tF,mdx:()=>nF,remark:()=>tF});var gl=Me(iu(),1),El=Me(gu(),1),vl=Me(pc(),1),Cl=Me(al(),1);var Hm=/^import\s/u,Km=/^export\s/u,ol=String.raw`[a-z][a-z0-9]*(\.[a-z][a-z0-9]*)*|`,sl=/<!---->|<!---?[^>-](?:-?[^-])*-->/u,Xm=/^\{\s*\/\*(.*)\*\/\s*\}/u,Jm=`
61
+ `)}function Of({node:e,previous:r,parent:t},n){if(Xi(r,n)||e.type==="list"&&t.type==="listItem"&&r.type==="code")return!0;let i=r.type===e.type&&Bf.has(e.type),u=t.type==="listItem"&&(e.type==="list"||!Xi(t,n)),o=_t(r)==="next",s=e.type==="html"&&r.type==="html"&&r.position.end.line+1===e.position.start.line,l=e.type==="html"&&t.type==="listItem"&&r.type==="paragraph"&&r.position.end.line+1===e.position.start.line;return!(i||u||o||s||l)}function Ji({node:e,previous:r}){let t=r.type==="list",n=e.type==="code"&&e.isIndented;return t&&n}function Lf(e){let r=e.findAncestor(t=>t.type==="linkReference"||t.type==="imageReference");return r&&(r.type!=="linkReference"||r.referenceType!=="full")}var If=(e,r)=>{for(let t of r)e=R(!1,e,t,encodeURIComponent(t));return e};function Tt(e,r=[]){let t=[" ",...Array.isArray(r)?r:[r]];return new RegExp(t.map(n=>le(n)).join("|"),"u").test(e)?`<${If(e,"<>")}>`:e}function zr(e,r,t=!0){if(!e)return"";if(t)return" "+zr(e,r,!1);if(e=R(!1,e,/\\(?=["')])/gu,""),e.includes('"')&&e.includes("'")&&!e.includes(")"))return`(${e})`;let n=ti(e,r.singleQuote);return e=R(!1,e,"\\","\\\\"),e=R(!1,e,n,`\\${n}`),`${n}${e}${n}`}function Rf(e,r,t){return Math.max(r,Math.min(e,t))}function Nf(e){return e.index>0&&_t(e.previous)==="next"}function qt(e){return`[${(0,Zi.default)(e.label)}]`}function Qi(e){return`[^${e.label}]`}var Mf={preprocess:Gi,print:Tf,embed:Bi,massageAstNode:Di,hasPrettierIgnore:Nf,insertPragma:ci,getVisitorKeys:_i},eu=Mf;var ru=[{name:"Markdown",type:"prose",extensions:[".md",".livemd",".markdown",".mdown",".mdwn",".mkd",".mkdn",".mkdown",".ronn",".scd",".workbook"],tmScope:"text.md",aceMode:"markdown",aliases:["md","pandoc"],codemirrorMode:"gfm",codemirrorMimeType:"text/x-gfm",filenames:["contents.lr","README"],wrap:!0,parsers:["markdown"],vscodeLanguageIds:["markdown"],linguistLanguageId:222},{name:"MDX",type:"prose",extensions:[".mdx"],tmScope:"text.md",aceMode:"markdown",aliases:["md","pandoc"],codemirrorMode:"gfm",codemirrorMimeType:"text/x-gfm",filenames:[],wrap:!0,parsers:["mdx"],vscodeLanguageIds:["mdx"],linguistLanguageId:222}];var St={bracketSpacing:{category:"Common",type:"boolean",default:!0,description:"Print spaces between brackets.",oppositeDescription:"Do not print spaces between brackets."},objectWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap object literals.",choices:[{value:"preserve",description:"Keep as multi-line, if there is a newline between the opening brace and first property."},{value:"collapse",description:"Fit to a single line when possible."}]},singleQuote:{category:"Common",type:"boolean",default:!1,description:"Use single quotes instead of double quotes."},proseWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap prose.",choices:[{value:"always",description:"Wrap prose if it exceeds the print width."},{value:"never",description:"Do not wrap prose."},{value:"preserve",description:"Wrap prose as-is."}]},bracketSameLine:{category:"Common",type:"boolean",default:!1,description:"Put > of opening tags on the last line instead of on a new line."},singleAttributePerLine:{category:"Common",type:"boolean",default:!1,description:"Enforce single attribute per line in HTML, Vue and JSX."}};var Uf={proseWrap:St.proseWrap,singleQuote:St.singleQuote},tu=Uf;var zn={};Yn(zn,{markdown:()=>tF,mdx:()=>nF,remark:()=>tF});var gl=Me(iu(),1),El=Me(gu(),1),vl=Me(pc(),1),Cl=Me(al(),1);var Hm=/^import\s/u,Km=/^export\s/u,ol=String.raw`[a-z][a-z0-9]*(\.[a-z][a-z0-9]*)*|`,sl=/<!---->|<!---?[^>-](?:-?[^-])*-->/u,Xm=/^\{\s*\/\*(.*)\*\/\s*\}/u,Jm=`
62
62
 
63
63
  `,cl=e=>Hm.test(e),Un=e=>Km.test(e),ll=(e,r)=>{let t=r.indexOf(Jm),n=r.slice(0,t);if(Un(n)||cl(n))return e(n)({type:Un(n)?"export":"import",value:n})},fl=(e,r)=>{let t=Xm.exec(r);if(t)return e(t[0])({type:"esComment",value:t[1].trim()})};ll.locator=e=>Un(e)||cl(e)?-1:1;fl.locator=(e,r)=>e.indexOf("{",r);var Dl=function(){let{Parser:e}=this,{blockTokenizers:r,blockMethods:t,inlineTokenizers:n,inlineMethods:a}=e.prototype;r.esSyntax=ll,n.esComment=fl,t.splice(t.indexOf("paragraph"),0,"esSyntax"),a.splice(a.indexOf("text"),0,"esComment")};var Qm=function(){let e=this.Parser.prototype;e.blockMethods=["frontMatter",...e.blockMethods],e.blockTokenizers.frontMatter=r;function r(t,n){let a=Ge(n);if(a.frontMatter)return t(a.frontMatter.raw)(a.frontMatter)}r.onlyAtStart=!0},pl=Qm;function Zm(){return e=>ye(e,(r,t,[n])=>r.type!=="html"||sl.test(r.value)||Rr.has(n.type)?r:{...r,type:"jsx"})}var hl=Zm;var eF=function(){let e=this.Parser.prototype,r=e.inlineMethods;r.splice(r.indexOf("text"),0,"liquid"),e.inlineTokenizers.liquid=t;function t(n,a){let i=a.match(/^(\{%.*?%\}|\{\{.*?\}\})/su);if(i)return n(i[0])({type:"liquidNode",value:i[0]})}t.locator=function(n,a){return n.indexOf("{",a)}},dl=eF;var rF=function(){let e="wikiLink",r=/^\[\[(?<linkContents>.+?)\]\]/su,t=this.Parser.prototype,n=t.inlineMethods;n.splice(n.indexOf("link"),0,e),t.inlineTokenizers.wikiLink=a;function a(i,u){let o=r.exec(u);if(o){let s=o.groups.linkContents.trim();return i(o[0])({type:e,value:s})}}a.locator=function(i,u){return i.indexOf("[",u)}},ml=rF;function bl({isMDX:e}){return r=>{let t=(0,Cl.default)().use(vl.default,{commonmark:!0,...e&&{blocks:[ol]}}).use(gl.default).use(pl).use(El.default).use(e?Dl:Fl).use(dl).use(e?hl:Fl).use(ml);return t.run(t.parse(r))}}function Fl(){}var Al={astFormat:"mdast",hasPragma:oi,hasIgnorePragma:si,locStart:Pe,locEnd:Oe},tF={...Al,parse:bl({isMDX:!1})},nF={...Al,parse:bl({isMDX:!0})};var iF={mdast:eu};return Tl(uF);});
@@ -58,6 +58,6 @@ ${r.content}`};var Vl=new Set(["position","raw"]);function fi(e,r,t){if((e.type=
58
58
  `)return L;let a=r===" "||r===`
59
59
  `&&wf(e,n);return kf(e,r,t,n)?a?qr:_r:a?" ":""}var Bf=new Set(["listItem","definition"]);function ji(e){var a,i;let{previous:r,next:t}=e;return(r==null?void 0:r.type)==="sentence"&&((a=z(!1,r.children,-1))==null?void 0:a.type)==="word"&&!z(!1,r.children,-1).hasTrailingPunctuation||(t==null?void 0:t.type)==="sentence"&&((i=t.children[0])==null?void 0:i.type)==="word"&&!t.children[0].hasLeadingPunctuation}function Tf(e,r,t){var a;let{node:n}=e;if(Lf(e)){let i=[""],u=Rr(r.originalText.slice(n.position.start.offset,n.position.end.offset));for(let o of u){if(o.type==="word"){i.push([i.pop(),o.value]);continue}let s=Bt(e,o.value,r.proseWrap,!0);if(G(s)===Y){i.push([i.pop(),s]);continue}i.push(s,"")}return ze(i)}switch(n.type){case"front-matter":return r.originalText.slice(n.position.start.offset,n.position.end.offset);case"root":return n.children.length===0?"":[Sf(e,r,t),L];case"paragraph":return Ui(e,r,t);case"sentence":return Yi(e,t);case"word":{let i=R(!1,R(!1,n.value,"*",String.raw`\*`),new RegExp([`(^|${Se.source})(_+)`,`(_+)(${Se.source}|$)`].join("|"),"gu"),(s,l,c,f,p)=>R(!1,c?`${l}${c}`:`${f}${p}`,"_",String.raw`\_`)),u=(s,l,c)=>s.type==="sentence"&&c===0,o=(s,l,c)=>Ct(s.children[c-1]);return i!==n.value&&(e.match(void 0,u,o)||e.match(void 0,u,(s,l,c)=>s.type==="emphasis"&&c===0,o))&&(i=i.replace(/^(\\?[*_])+/u,s=>R(!1,s,"\\",""))),i}case"whitespace":{let{next:i}=e,u=i&&/^>|^(?:[*+-]|#{1,6}|\d+[).])$/u.test(i.value)?"never":r.proseWrap;return Bt(e,n.value,u)}case"emphasis":{let i;if(Ct(n.children[0]))i=r.originalText[n.position.start.offset];else{let u=ji(e),o=((a=e.parent)==null?void 0:a.type)==="strong"&&ji(e.ancestors);i=u||o||e.hasAncestor(s=>s.type==="emphasis")?"*":"_"}return[i,j(e,r,t),i]}case"strong":return["**",j(e,r,t),"**"];case"delete":return["~~",j(e,r,t),"~~"];case"inlineCode":{let i=r.proseWrap==="preserve"?n.value:R(!1,n.value,`
60
60
  `," "),u=ei(i,"`"),o="`".repeat(u||1),s=i.startsWith("`")||i.endsWith("`")||/^[\n ]/u.test(i)&&/[\n ]$/u.test(i)&&/[^\n ]/u.test(i)?" ":"";return[o,s,i,s,o]}case"wikiLink":{let i="";return r.proseWrap==="preserve"?i=n.value:i=R(!1,n.value,/[\t\n]+/gu," "),["[[",i,"]]"]}case"link":switch(r.originalText[n.position.start.offset]){case"<":{let i="mailto:";return["<",n.url.startsWith(i)&&r.originalText.slice(n.position.start.offset+1,n.position.start.offset+1+i.length)!==i?n.url.slice(i.length):n.url,">"]}case"[":return["[",j(e,r,t),"](",Tt(n.url,")"),Ur(n.title,r),")"];default:return r.originalText.slice(n.position.start.offset,n.position.end.offset)}case"image":return["![",n.alt||"","](",Tt(n.url,")"),Ur(n.title,r),")"];case"blockquote":return["> ",Ae("> ",j(e,r,t))];case"heading":return["#".repeat(n.depth)+" ",j(e,r,t)];case"code":{if(n.isIndented){let o=" ".repeat(4);return Ae(o,[o,be(n.value,L)])}let i=r.__inJsTemplate?"~":"`",u=i.repeat(Math.max(3,Sr(n.value,i)+1));return[u,n.lang||"",n.meta?" "+n.meta:"",L,be(Nr(n,r.originalText),L),L,u]}case"html":{let{parent:i,isLast:u}=e,o=i.type==="root"&&u?n.value.trimEnd():n.value,s=/^<!--.*-->$/su.test(o);return be(o,s?L:_e(nr))}case"list":{let i=Hi(n,e.parent),u=ki(n,r);return j(e,r,t,{processor(o){let s=c(),l=o.node;if(l.children.length===2&&l.children[1].type==="html"&&l.children[0].position.start.column!==l.children[1].position.start.column)return[s,Wi(o,r,t,s)];return[s,Ae(" ".repeat(s.length),Wi(o,r,t,s))];function c(){let f=n.ordered?(o.isFirst?n.start:u?1:n.start+o.index)+(i%2===0?". ":") "):i%2===0?"- ":"* ";return(n.isAligned||n.hasIndentedCodeblock)&&n.ordered?qf(f,r):f}}})}case"thematicBreak":{let{ancestors:i}=e,u=i.findIndex(s=>s.type==="list");return u===-1?"---":Hi(i[u],i[u+1])%2===0?"***":"---"}case"linkReference":return["[",j(e,r,t),"]",n.referenceType==="full"?qt(n):n.referenceType==="collapsed"?"[]":""];case"imageReference":switch(n.referenceType){case"full":return["![",n.alt||"","]",qt(n)];default:return["![",n.alt,"]",n.referenceType==="collapsed"?"[]":""]}case"definition":{let i=r.proseWrap==="always"?qr:" ";return Ue([qt(n),":",ir([i,Tt(n.url),n.title===null?"":[i,Ur(n.title,r,!1)]])])}case"footnote":return["[^",j(e,r,t),"]"];case"footnoteReference":return Qi(n);case"footnoteDefinition":{let i=n.children.length===1&&n.children[0].type==="paragraph"&&(r.proseWrap==="never"||r.proseWrap==="preserve"&&n.children[0].position.start.line===n.children[0].position.end.line);return[Qi(n),": ",i?j(e,r,t):Ue([Ae(" ".repeat(4),j(e,r,t,{processor:({isFirst:u})=>u?Ue([_r,t()]):t()}))])]}case"table":return Mi(e,r,t);case"tableCell":return j(e,r,t);case"break":return/\s/u.test(r.originalText[n.position.start.offset])?[" ",_e(nr)]:["\\",L];case"liquidNode":return be(n.value,L);case"import":case"export":case"jsx":return n.value;case"esComment":return["{/* ",n.value," */}"];case"math":return["$$",L,n.value?[be(n.value,L),L]:"","$$"];case"inlineMath":return r.originalText.slice(Pe(n),Oe(n));case"tableRow":case"listItem":case"text":default:throw new ni(n,"Markdown")}}function Wi(e,r,t,n){let{node:a}=e,i=a.checked===null?"":a.checked?"[x] ":"[ ] ";return[i,j(e,r,t,{processor({node:u,isFirst:o}){if(o&&u.type!=="list")return Ae(" ".repeat(i.length),t());let s=" ".repeat(Rf(r.tabWidth-n.length,0,3));return[s,Ae(s,t())]}})]}function qf(e,r){let t=n();return e+" ".repeat(t>=4?0:t);function n(){let a=e.length%r.tabWidth;return a===0?0:r.tabWidth-a}}function Hi(e,r){return _f(e,r,t=>t.ordered===e.ordered)}function _f(e,r,t){let n=-1;for(let a of r.children)if(a.type===e.type&&t(a)?n++:n=-1,a===e)return n}function Sf(e,r,t){let n=[],a=null,{children:i}=e.node;for(let[u,o]of i.entries())switch(_t(o)){case"start":a===null&&(a={index:u,offset:o.position.end.offset});break;case"end":a!==null&&(n.push({start:a,end:{index:u,offset:o.position.start.offset}}),a=null);break;default:break}return j(e,r,t,{processor({index:u}){if(n.length>0){let o=n[0];if(u===o.start.index)return[Ki(i[o.start.index]),r.originalText.slice(o.start.offset,o.end.offset),Ki(i[o.end.index])];if(o.start.index<u&&u<o.end.index)return!1;if(u===o.end.index)return n.shift(),!1}return t()}})}function j(e,r,t,n={}){let{processor:a=t}=n,i=[];return e.each(()=>{let u=a(e);u!==!1&&(i.length>0&&Pf(e)&&(i.push(L),(Of(e,r)||Ji(e))&&i.push(L),Ji(e)&&i.push(L)),i.push(u))},"children"),i}function Ki(e){if(e.type==="html")return e.value;if(e.type==="paragraph"&&Array.isArray(e.children)&&e.children.length===1&&e.children[0].type==="esComment")return["{/* ",e.children[0].value," */}"]}function _t(e){let r;if(e.type==="html")r=e.value.match(/^<!--\s*prettier-ignore(?:-(start|end))?\s*-->$/u);else{let t;e.type==="esComment"?t=e:e.type==="paragraph"&&e.children.length===1&&e.children[0].type==="esComment"&&(t=e.children[0]),t&&(r=t.value.match(/^prettier-ignore(?:-(start|end))?$/u))}return r?r[1]||"next":!1}function Pf({node:e,parent:r}){let t=vt.has(e.type),n=e.type==="html"&&Ir.has(r.type);return!t&&!n}function Xi(e,r){return e.type==="listItem"&&(e.spread||r.originalText.charAt(e.position.end.offset-1)===`
61
- `)}function Of({node:e,previous:r,parent:t},n){if(Xi(r,n))return!0;let u=r.type===e.type&&Bf.has(e.type),o=t.type==="listItem"&&(e.type==="list"||!Xi(t,n)),s=_t(r)==="next",l=e.type==="html"&&r.type==="html"&&r.position.end.line+1===e.position.start.line,c=e.type==="html"&&t.type==="listItem"&&r.type==="paragraph"&&r.position.end.line+1===e.position.start.line;return!(u||o||s||l||c)}function Ji({node:e,previous:r}){let t=r.type==="list",n=e.type==="code"&&e.isIndented;return t&&n}function Lf(e){let r=e.findAncestor(t=>t.type==="linkReference"||t.type==="imageReference");return r&&(r.type!=="linkReference"||r.referenceType!=="full")}var If=(e,r)=>{for(let t of r)e=R(!1,e,t,encodeURIComponent(t));return e};function Tt(e,r=[]){let t=[" ",...Array.isArray(r)?r:[r]];return new RegExp(t.map(n=>le(n)).join("|"),"u").test(e)?`<${If(e,"<>")}>`:e}function Ur(e,r,t=!0){if(!e)return"";if(t)return" "+Ur(e,r,!1);if(e=R(!1,e,/\\(?=["')])/gu,""),e.includes('"')&&e.includes("'")&&!e.includes(")"))return`(${e})`;let n=ti(e,r.singleQuote);return e=R(!1,e,"\\","\\\\"),e=R(!1,e,n,`\\${n}`),`${n}${e}${n}`}function Rf(e,r,t){return Math.max(r,Math.min(e,t))}function Nf(e){return e.index>0&&_t(e.previous)==="next"}function qt(e){return`[${(0,Zi.default)(e.label)}]`}function Qi(e){return`[^${e.label}]`}var Mf={preprocess:Gi,print:Tf,embed:Bi,massageAstNode:Di,hasPrettierIgnore:Nf,insertPragma:ci,getVisitorKeys:_i},eu=Mf;var ru=[{name:"Markdown",type:"prose",extensions:[".md",".livemd",".markdown",".mdown",".mdwn",".mkd",".mkdn",".mkdown",".ronn",".scd",".workbook"],tmScope:"text.md",aceMode:"markdown",aliases:["md","pandoc"],codemirrorMode:"gfm",codemirrorMimeType:"text/x-gfm",filenames:["contents.lr","README"],wrap:!0,parsers:["markdown"],vscodeLanguageIds:["markdown"],linguistLanguageId:222},{name:"MDX",type:"prose",extensions:[".mdx"],tmScope:"text.md",aceMode:"markdown",aliases:["md","pandoc"],codemirrorMode:"gfm",codemirrorMimeType:"text/x-gfm",filenames:[],wrap:!0,parsers:["mdx"],vscodeLanguageIds:["mdx"],linguistLanguageId:222}];var St={bracketSpacing:{category:"Common",type:"boolean",default:!0,description:"Print spaces between brackets.",oppositeDescription:"Do not print spaces between brackets."},objectWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap object literals.",choices:[{value:"preserve",description:"Keep as multi-line, if there is a newline between the opening brace and first property."},{value:"collapse",description:"Fit to a single line when possible."}]},singleQuote:{category:"Common",type:"boolean",default:!1,description:"Use single quotes instead of double quotes."},proseWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap prose.",choices:[{value:"always",description:"Wrap prose if it exceeds the print width."},{value:"never",description:"Do not wrap prose."},{value:"preserve",description:"Wrap prose as-is."}]},bracketSameLine:{category:"Common",type:"boolean",default:!1,description:"Put > of opening tags on the last line instead of on a new line."},singleAttributePerLine:{category:"Common",type:"boolean",default:!1,description:"Enforce single attribute per line in HTML, Vue and JSX."}};var Uf={proseWrap:St.proseWrap,singleQuote:St.singleQuote},tu=Uf;var zn={};$n(zn,{markdown:()=>tF,mdx:()=>nF,remark:()=>tF});var gl=Me(iu(),1),El=Me(gu(),1),vl=Me(pc(),1),Cl=Me(al(),1);var Hm=/^import\s/u,Km=/^export\s/u,ol=String.raw`[a-z][a-z0-9]*(\.[a-z][a-z0-9]*)*|`,sl=/<!---->|<!---?[^>-](?:-?[^-])*-->/u,Xm=/^\{\s*\/\*(.*)\*\/\s*\}/u,Jm=`
61
+ `)}function Of({node:e,previous:r,parent:t},n){if(Xi(r,n)||e.type==="list"&&t.type==="listItem"&&r.type==="code")return!0;let i=r.type===e.type&&Bf.has(e.type),u=t.type==="listItem"&&(e.type==="list"||!Xi(t,n)),o=_t(r)==="next",s=e.type==="html"&&r.type==="html"&&r.position.end.line+1===e.position.start.line,l=e.type==="html"&&t.type==="listItem"&&r.type==="paragraph"&&r.position.end.line+1===e.position.start.line;return!(i||u||o||s||l)}function Ji({node:e,previous:r}){let t=r.type==="list",n=e.type==="code"&&e.isIndented;return t&&n}function Lf(e){let r=e.findAncestor(t=>t.type==="linkReference"||t.type==="imageReference");return r&&(r.type!=="linkReference"||r.referenceType!=="full")}var If=(e,r)=>{for(let t of r)e=R(!1,e,t,encodeURIComponent(t));return e};function Tt(e,r=[]){let t=[" ",...Array.isArray(r)?r:[r]];return new RegExp(t.map(n=>le(n)).join("|"),"u").test(e)?`<${If(e,"<>")}>`:e}function Ur(e,r,t=!0){if(!e)return"";if(t)return" "+Ur(e,r,!1);if(e=R(!1,e,/\\(?=["')])/gu,""),e.includes('"')&&e.includes("'")&&!e.includes(")"))return`(${e})`;let n=ti(e,r.singleQuote);return e=R(!1,e,"\\","\\\\"),e=R(!1,e,n,`\\${n}`),`${n}${e}${n}`}function Rf(e,r,t){return Math.max(r,Math.min(e,t))}function Nf(e){return e.index>0&&_t(e.previous)==="next"}function qt(e){return`[${(0,Zi.default)(e.label)}]`}function Qi(e){return`[^${e.label}]`}var Mf={preprocess:Gi,print:Tf,embed:Bi,massageAstNode:Di,hasPrettierIgnore:Nf,insertPragma:ci,getVisitorKeys:_i},eu=Mf;var ru=[{name:"Markdown",type:"prose",extensions:[".md",".livemd",".markdown",".mdown",".mdwn",".mkd",".mkdn",".mkdown",".ronn",".scd",".workbook"],tmScope:"text.md",aceMode:"markdown",aliases:["md","pandoc"],codemirrorMode:"gfm",codemirrorMimeType:"text/x-gfm",filenames:["contents.lr","README"],wrap:!0,parsers:["markdown"],vscodeLanguageIds:["markdown"],linguistLanguageId:222},{name:"MDX",type:"prose",extensions:[".mdx"],tmScope:"text.md",aceMode:"markdown",aliases:["md","pandoc"],codemirrorMode:"gfm",codemirrorMimeType:"text/x-gfm",filenames:[],wrap:!0,parsers:["mdx"],vscodeLanguageIds:["mdx"],linguistLanguageId:222}];var St={bracketSpacing:{category:"Common",type:"boolean",default:!0,description:"Print spaces between brackets.",oppositeDescription:"Do not print spaces between brackets."},objectWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap object literals.",choices:[{value:"preserve",description:"Keep as multi-line, if there is a newline between the opening brace and first property."},{value:"collapse",description:"Fit to a single line when possible."}]},singleQuote:{category:"Common",type:"boolean",default:!1,description:"Use single quotes instead of double quotes."},proseWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap prose.",choices:[{value:"always",description:"Wrap prose if it exceeds the print width."},{value:"never",description:"Do not wrap prose."},{value:"preserve",description:"Wrap prose as-is."}]},bracketSameLine:{category:"Common",type:"boolean",default:!1,description:"Put > of opening tags on the last line instead of on a new line."},singleAttributePerLine:{category:"Common",type:"boolean",default:!1,description:"Enforce single attribute per line in HTML, Vue and JSX."}};var Uf={proseWrap:St.proseWrap,singleQuote:St.singleQuote},tu=Uf;var zn={};$n(zn,{markdown:()=>tF,mdx:()=>nF,remark:()=>tF});var gl=Me(iu(),1),El=Me(gu(),1),vl=Me(pc(),1),Cl=Me(al(),1);var Hm=/^import\s/u,Km=/^export\s/u,ol=String.raw`[a-z][a-z0-9]*(\.[a-z][a-z0-9]*)*|`,sl=/<!---->|<!---?[^>-](?:-?[^-])*-->/u,Xm=/^\{\s*\/\*(.*)\*\/\s*\}/u,Jm=`
62
62
 
63
63
  `,cl=e=>Hm.test(e),Un=e=>Km.test(e),ll=(e,r)=>{let t=r.indexOf(Jm),n=r.slice(0,t);if(Un(n)||cl(n))return e(n)({type:Un(n)?"export":"import",value:n})},fl=(e,r)=>{let t=Xm.exec(r);if(t)return e(t[0])({type:"esComment",value:t[1].trim()})};ll.locator=e=>Un(e)||cl(e)?-1:1;fl.locator=(e,r)=>e.indexOf("{",r);var Dl=function(){let{Parser:e}=this,{blockTokenizers:r,blockMethods:t,inlineTokenizers:n,inlineMethods:a}=e.prototype;r.esSyntax=ll,n.esComment=fl,t.splice(t.indexOf("paragraph"),0,"esSyntax"),a.splice(a.indexOf("text"),0,"esComment")};var Qm=function(){let e=this.Parser.prototype;e.blockMethods=["frontMatter",...e.blockMethods],e.blockTokenizers.frontMatter=r;function r(t,n){let a=Ge(n);if(a.frontMatter)return t(a.frontMatter.raw)(a.frontMatter)}r.onlyAtStart=!0},pl=Qm;function Zm(){return e=>ye(e,(r,t,[n])=>r.type!=="html"||sl.test(r.value)||Ir.has(n.type)?r:{...r,type:"jsx"})}var hl=Zm;var eF=function(){let e=this.Parser.prototype,r=e.inlineMethods;r.splice(r.indexOf("text"),0,"liquid"),e.inlineTokenizers.liquid=t;function t(n,a){let i=a.match(/^(\{%.*?%\}|\{\{.*?\}\})/su);if(i)return n(i[0])({type:"liquidNode",value:i[0]})}t.locator=function(n,a){return n.indexOf("{",a)}},dl=eF;var rF=function(){let e="wikiLink",r=/^\[\[(?<linkContents>.+?)\]\]/su,t=this.Parser.prototype,n=t.inlineMethods;n.splice(n.indexOf("link"),0,e),t.inlineTokenizers.wikiLink=a;function a(i,u){let o=r.exec(u);if(o){let s=o.groups.linkContents.trim();return i(o[0])({type:e,value:s})}}a.locator=function(i,u){return i.indexOf("[",u)}},ml=rF;function bl({isMDX:e}){return r=>{let t=(0,Cl.default)().use(vl.default,{commonmark:!0,...e&&{blocks:[ol]}}).use(gl.default).use(pl).use(El.default).use(e?Dl:Fl).use(dl).use(e?hl:Fl).use(ml);return t.run(t.parse(r))}}function Fl(){}var Al={astFormat:"mdast",hasPragma:oi,hasIgnorePragma:si,locStart:Pe,locEnd:Oe},tF={...Al,parse:bl({isMDX:!1})},nF={...Al,parse:bl({isMDX:!0})};var iF={mdast:eu};var p2=Gn;export{p2 as default,ru as languages,tu as options,zn as parsers,iF as printers};