29 lines
81 KiB
JavaScript
29 lines
81 KiB
JavaScript
(function(t){function e(){var o=t();return o.default||o}if(typeof exports=="object"&&typeof module=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var f=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this||{};f.prettier=e()}})(function(){"use strict";var yt=Object.defineProperty;var Ru=Object.getOwnPropertyDescriptor;var vu=Object.getOwnPropertyNames;var Lu=Object.prototype.hasOwnProperty;var At=(t,e)=>{for(var r in e)yt(t,r,{get:e[r],enumerable:!0})},Mu=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of vu(e))!Lu.call(t,u)&&u!==r&&yt(t,u,{get:()=>e[u],enumerable:!(n=Ru(e,u))||n.enumerable});return t};var Yu=t=>Mu(yt({},"__esModule",{value:!0}),t);var Ji={};At(Ji,{__debug:()=>Hi,check:()=>Gi,doc:()=>cr,format:()=>Su,formatWithCursor:()=>Pu,getSupportInfo:()=>Ki,util:()=>lr,version:()=>_u});var X=(t,e)=>(r,n,...u)=>r|1&&n==null?void 0:(e.call(n)??n[t]).apply(n,u);var ju=String.prototype.replaceAll??function(t,e){return t.global?this.replace(t,e):this.split(t).join(e)},Uu=X("replaceAll",function(){if(typeof this=="string")return ju}),ne=Uu;var Ne=class{diff(e,r,n={}){let u;typeof n=="function"?(u=n,n={}):"callback"in n&&(u=n.callback);let o=this.castInput(e,n),i=this.castInput(r,n),D=this.removeEmpty(this.tokenize(o,n)),s=this.removeEmpty(this.tokenize(i,n));return this.diffWithOptionsObj(D,s,n,u)}diffWithOptionsObj(e,r,n,u){var o;let i=C=>{if(C=this.postProcess(C,n),u){setTimeout(function(){u(C)},0);return}else return C},D=r.length,s=e.length,a=1,c=D+s;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let p=(o=n.timeout)!==null&&o!==void 0?o:1/0,l=Date.now()+p,m=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(m[0],r,e,0,n);if(m[0].oldPos+1>=s&&f+1>=D)return i(this.buildValues(m[0].lastComponent,r,e));let F=-1/0,d=1/0,E=()=>{for(let C=Math.max(F,-a);C<=Math.min(d,a);C+=2){let h,_=m[C-1],P=m[C+1];_&&(m[C-1]=void 0);let A=!1;if(P){let J=P.oldPos-C;A=P&&0<=J&&J<D}let B=_&&_.oldPos+1<s;if(!A&&!B){m[C]=void 0;continue}if(!B||A&&_.oldPos<P.oldPos?h=this.addToPath(P,!0,!1,0,n):h=this.addToPath(_,!1,!0,1,n),f=this.extractCommon(h,r,e,C,n),h.oldPos+1>=s&&f+1>=D)return i(this.buildValues(h.lastComponent,r,e))||!0;m[C]=h,h.oldPos+1>=s&&(d=Math.min(d,C-1)),f+1>=D&&(F=Math.max(F,C+1))}a++};if(u)(function C(){setTimeout(function(){if(a>c||Date.now()>l)return u(void 0);E()||C()},0)})();else for(;a<=c&&Date.now()<=l;){let C=E();if(C)return C}}addToPath(e,r,n,u,o){let i=e.lastComponent;return i&&!o.oneChangePerToken&&i.added===r&&i.removed===n?{oldPos:e.oldPos+u,lastComponent:{count:i.count+1,added:r,removed:n,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+u,lastComponent:{count:1,added:r,removed:n,previousComponent:i}}}extractCommon(e,r,n,u,o){let i=r.length,D=n.length,s=e.oldPos,a=s-u,c=0;for(;a+1<i&&s+1<D&&this.equals(n[s+1],r[a+1],o);)a++,s++,c++,o.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return c&&!o.oneChangePerToken&&(e.lastComponent={count:c,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,a}equals(e,r,n){return n.comparator?n.comparator(e,r):e===r||!!n.ignoreCase&&e.toLowerCase()===r.toLowerCase()}removeEmpty(e){let r=[];for(let n=0;n<e.length;n++)e[n]&&r.push(e[n]);return r}castInput(e,r){return e}tokenize(e,r){return Array.from(e)}join(e){return e.join("")}postProcess(e,r){return e}get useLongestToken(){return!1}buildValues(e,r,n){let u=[],o;for(;e;)u.push(e),o=e.previousComponent,delete e.previousComponent,e=o;u.reverse();let i=u.length,D=0,s=0,a=0;for(;D<i;D++){let c=u[D];if(c.removed)c.value=this.join(n.slice(a,a+c.count)),a+=c.count;else{if(!c.added&&this.useLongestToken){let p=r.slice(s,s+c.count);p=p.map(function(l,m){let f=n[a+m];return f.length>l.length?f:l}),c.value=this.join(p)}else c.value=this.join(r.slice(s,s+c.count));s+=c.count,c.added||(a+=c.count)}}return u}};var xt=class extends Ne{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}},mr=new xt;function Bt(t,e,r){return mr.diff(t,e,r)}var Vu=()=>{},k
|
|||
|
|
`,ze=`
|
||
|
|
`,zu=ze;function hr(t){let e=t.indexOf(Tt);return e!==-1?t.charAt(e+1)===ze?Er:Fr:$u}function we(t){return t===Fr?Tt:t===Er?Cr:zu}var Gu=new Map([[ze,/\n/g],[Tt,/\r/g],[Cr,/\r\n/g]]);function Nt(t,e){let r=Gu.get(e);return t.match(r)?.length??0}var Ku=/\r\n?/g;function gr(t){return ne(0,t,Ku,ze)}var ue=Symbol.for("comments");function Hu(t){return this[t<0?this.length+t:t]}var Ju=X("at",function(){if(Array.isArray(this)||typeof this=="string")return Hu}),y=Ju;var G="string",U="array",V="cursor",I="indent",R="align",v="trim",x="group",S="fill",T="if-break",L="indent-if-break",M="line-suffix",Y="line-suffix-boundary",g="line",b="label",N="break-parent",Ge=new Set([V,I,R,v,x,S,T,L,M,Y,g,b,N]);function _r(t){let e=t.length;for(;e>0&&(t[e-1]==="\r"||t[e-1]===`
|
||
|
|
`);)e--;return e<t.length?t.slice(0,e):t}function Fe(t,e,r){if(!t.has(e)){let n=r(e);t.set(e,n)}return t.get(e)}function qu(t){if(typeof t=="string")return G;if(Array.isArray(t))return U;if(!t)return;let{type:e}=t;if(Ge.has(e))return e}var q=qu;var Xu=t=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(t);function Qu(t){let e=t===null?"null":typeof t;if(e!=="string"&&e!=="object")return`Unexpected doc '${e}',
|
||
|
|
Expected it to be 'string' or 'object'.`;if(q(t))throw new Error("doc is valid.");let r=Object.prototype.toString.call(t);if(r!=="[object Object]")return`Unexpected doc '${r}'.`;let n=Xu([...Ge].map(u=>`'${u}'`));return`Unexpected doc.type '${t.type}'.
|
||
|
|
Expected it to be ${n}.`}var wt=class extends Error{name="InvalidDocError";constructor(e){super(Qu(e)),this.doc=e}},Z=wt;var yr={};function Zu(t,e,r,n){let u=[t];for(;u.length>0;){let o=u.pop();if(o===yr){r(u.pop());continue}r&&u.push(o,yr);let i=q(o);if(!i)throw new Z(o);if(e?.(o)!==!1)switch(i){case U:case S:{let D=i===U?o:o.parts;for(let s=D.length,a=s-1;a>=0;--a)u.push(D[a]);break}case T:u.push(o.flatContents,o.breakContents);break;case x:if(n&&o.expandedStates)for(let D=o.expandedStates.length,s=D-1;s>=0;--s)u.push(o.expandedStates[s]);else u.push(o.contents);break;case R:case I:case L:case b:case M:u.push(o.contents);break;case G:case V:case v:case Y:case g:case N:break;default:throw new Z(o)}}}var Oe=Zu;function Se(t,e){if(typeof t=="string")return e(t);let r=new Map;return n(t);function n(o){return Fe(r,o,u)}function u(o){switch(q(o)){case U:return e(o.map(n));case S:return e({...o,parts:o.parts.map(n)});case T:return e({...o,breakContents:n(o.breakContents),flatContents:n(o.flatContents)});case x:{let{expandedStates:i,contents:D}=o;return i?(i=i.map(n),D=i[0]):D=n(D),e({...o,contents:D,expandedStates:i})}case R:case I:case L:case b:case M:return e({...o,contents:n(o.contents)});case G:case V:case v:case Y:case g:case N:return e(o);default:throw new Z(o)}}}function Ke(t,e,r){let n=r,u=!1;function o(i){if(u)return!1;let D=e(i);D!==void 0&&(u=!0,n=D)}return Oe(t,o),n}function eo(t){if(t.type===x&&t.break||t.type===g&&t.hard||t.type===N)return!0}function Br(t){return Ke(t,eo,!1)}function Ar(t){if(t.length>0){let e=y(0,t,-1);!e.expandedStates&&!e.break&&(e.break="propagated")}return null}function Tr(t){let e=new Set,r=[];function n(o){if(o.type===N&&Ar(r),o.type===x){if(r.push(o),e.has(o))return!1;e.add(o)}}function u(o){o.type===x&&r.pop().break&&Ar(r)}Oe(t,n,u,!0)}function to(t){return t.type===g&&!t.hard?t.soft?"":" ":t.type===T?t.flatContents:t}function Nr(t){return Se(t,to)}function xr(t){for(t=[...t];t.length>=2&&y(0,t,-2).type===g&&y(0,t,-1).type===N;)t.length-=2;if(t.length>0){let e=Pe(y(0,t,-1));t[t.length-1]=e}return t}function Pe(t){switch(q(t)){case I:case L:case x:case M:case b:{let e=Pe(t.contents);return{...t,contents:e}}case T:return{...t,breakContents:Pe(t.breakContents),flatContents:Pe(t.flatContents)};case S:return{...t,parts:xr(t.parts)};case U:return xr(t);case G:return _r(t);case R:case V:case v:case Y:case g:case N:break;default:throw new Z(t)}return t}function He(t){return Pe(no(t))}function ro(t){switch(q(t)){case S:{let{parts:e}=t;if(e.every(r=>r===""))return"";if(e.length===1)return e[0];break}case x:if(!t.contents&&!t.id&&!t.break&&!t.expandedStates)return"";if(t.contents.type===x&&t.contents.id===t.id&&t.contents.break===t.break&&t.contents.expandedStates===t.expandedStates)return t.contents;break;case R:case I:case L:case M:if(!t.contents)return"";break;case T:if(!t.flatContents&&!t.breakContents)return"";break;case U:{let e=[];for(let r of t){if(!r)continue;let[n,...u]=Array.isArray(r)?r:[r];typeof n=="string"&&typeof y(0,e,-1)=="string"?e[e.length-1]+=n:e.push(n),e.push(...u)}return e.length===0?"":e.length===1?e[0]:e}case G:case V:case v:case Y:case g:case b:case N:break;default:throw new Z(t)}return t}function no(t){return Se(t,e=>ro(e))}function wr(t,e=Je){return Se(t,r=>typeof r=="string"?be(e,r.split(`
|
||
|
|
`)):r)}function uo(t){if(t.type===g)return!0}function Or(t){return Ke(t,uo,!1)}function Ee(t,e){return t.type===b?{...t,contents:e(t.contents)}:e(t)}var w=k,qe=k,Pr=k,Sr=k;function oe(t){return w(t),{type:I,contents:t}}function De(t,e){return Sr(t),w(e),{type:R,contents:e,n:t}}function br(t){return De(Number.NEGATIVE_INFINITY,t)}function Xe(t){return De({type:"root"},t)}function kr(t){return De(-1,t)}function Qe(t,e,r){w(t);let n=t;if(e>0){for(let u=0;u<Math.floor(e/r);++u)n=oe(n);n=De(e%r,n),n=De(Number.NEGATIVE_INFINITY,n)}return n}var ae={type:N};var ee={type:V};function Ir(t){return Pr(t),{type:S,parts:t}}function Ot(t,e={}){return w(t),qe(e.expandedStates,!0),{type:x,id:e.id,contents:t,break:!!e.shouldBreak,expandedStates:e.expandedStates}}function Rr(t,e){return Ot(t[0],{...e,expandedStates:t})}function vr(t,e="",r={}){return w(t),e!==""&&w(e),{type:T,breakContents:t,flatContents:e,groupId:r.groupId}}function Lr(t,e){return w(t),{type:L,contents:t,groupId:e.groupId,negate:e.negate}}function be(t,e){w(t),qe(e);let r=[];for(let n=0;n<e.length;n++)n!==0&&r.push(t),r.push(e[n]);return r}function Mr(t,e){return w(e),t?{type:b,label:t,contents:e}:e}var Ze={type:g},Yr={type:g,soft:!0},ke={type:g,hard:!0},W=[ke,ae],Pt={type:g,hard:!0,literal:!0},Je=[Pt,ae];function Ie(t){return w(t),{type:M,contents:t}}var jr={type:Y};var Ur={type:v};function te(t){if(!t)return"";if(Array.isArray(t)){let e=[];for(let r of t)if(Array.isArray(r))e.push(...te(r));else{let n=te(r);n!==""&&e.push(n)}return e}return t.type===T?{...t,breakContents:te(t.breakContents),flatContents:te(t.flatContents)}:t.type===x?{...t,contents:te(t.contents),expandedStates:t.expandedStates?.map(te)}:t.type===S?{type:"fill",parts:t.parts.map(te)}:t.contents?{...t,contents:te(t.contents)}:t}function Vr(t){let e=Object.create(null),r=new Set;return n(te(t));function n(o,i,D){if(typeof o=="string")return JSON.stringify(o);if(Array.isArray(o)){let s=o.map(n).filter(Boolean);return s.length===1?s[0]:`[${s.join(", ")}]`}if(o.type===g){let s=D?.[i+1]?.type===N;return o.literal?s?"literalline":"literallineWithoutBreakParent":o.hard?s?"hardline":"hardlineWithoutBreakParent":o.soft?"softline":"line"}if(o.type===N)return D?.[i-1]?.type===g&&D[i-1].hard?void 0:"breakParent";if(o.type===v)return"trim";if(o.type===I)return"indent("+n(o.contents)+")";if(o.type===R)return o.n===Number.NEGATIVE_INFINITY?"dedentToRoot("+n(o.contents)+")":o.n<0?"dedent("+n(o.contents)+")":o.n.type==="root"?"markAsRoot("+n(o.contents)+")":"align("+JSON.stringify(o.n)+", "+n(o.contents)+")";if(o.type===T)return"ifBreak("+n(o.breakContents)+(o.flatContents?", "+n(o.flatContents):"")+(o.groupId?(o.flatContents?"":', ""')+`, { groupId: ${u(o.groupId)} }`:"")+")";if(o.type===L){let s=[];o.negate&&s.push("negate: true"),o.groupId&&s.push(`groupId: ${u(o.groupId)}`);let a=s.length>0?`, { ${s.join(", ")} }`:"";return`indentIfBreak(${n(o.contents)}${a})`}if(o.type===x){let s=[];o.break&&o.break!=="propagated"&&s.push("shouldBreak: true"),o.id&&s.push(`id: ${u(o.id)}`);let a=s.length>0?`, { ${s.join(", ")} }`:"";return o.expandedStates?`conditionalGroup([${o.expandedStates.map(c=>n(c)).join(",")}]${a})`:`group(${n(o.contents)}${a})`}if(o.type===S)return`fill([${o.parts.map(s=>n(s)).join(", ")}])`;if(o.type===M)return"lineSuffix("+n(o.contents)+")";if(o.type===Y)return"lineSuffixBoundary";if(o.type===b)return`label(${JSON.stringify(o.label)}, ${n(o.contents)})`;if(o.type===V)return"cursor";throw new Error("Unknown doc type "+o.type)}function u(o){if(typeof o!="symbol")return JSON.stringify(String(o));if(o in e)return e[o];let i=o.description||"symbol";for(let D=0;;D++){let s=i+(D>0?` #${D}`:"");if(!r.has(s))return r.add(s),e[o]=`Symbol.for(${JSON.stringify(s)})`}}}var Wr=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666
|
||
|
|
`?ne(0,d,`
|
||
|
|
`,u):d;E&&(a.write(E),i.length>0&&(o+=Re(E)));break}case U:for(let E=d.length-1;E>=0;E--)i.push({indent:f,mode:F,doc:d[E]});break;case V:a.markPosition();break;case I:i.push({indent:Zr(f,e),mode:F,doc:d.contents});break;case R:i.push({indent:Qr(f,d.n,e),mode:F,doc:d.contents});break;case v:o-=a.trim();break;case x:{let E=(function(){if(F===Q&&!D)return{indent:f,mode:d.break?K:Q,doc:d.contents};D=!1;let h=n-o,_=s.length>0,P={indent:f,mode:Q,doc:d.contents};if(!d.break&&tt(P,i,h,_,r))return P;if(!d.expandedStates)return{indent:f,mode:K,doc:d.contents};if(!d.break)for(let A=1;A<d.expandedStates.length-1;A++){let B={indent:f,mode:Q,doc:d.expandedStates[A]};if(tt(B,i,h,_,r))return B}return{indent:f,mode:K,doc:y(0,d.expandedStates,-1)}})();i.push(E),d.id&&(r[d.id]=E.mode);break}case S:{let E=n-o,C=d[Lt]??0,{parts:h}=d,_=h.length-C;if(_===0)break;let P=h[C+0],A=h[C+1],B={indent:f,mode:Q,doc:P},J={indent:f,mode:K,doc:P},$e=tt(B,[],E,s.length>0,r,!0);if(_===1){$e?i.push(B):i.push(J);break}let pr={indent:f,mode:Q,doc:A},_t={indent:f,mode:K,doc:A};if(_===2){$e?i.push(pr,B):i.push(_t,J);break}let bu=h[C+2],ku={indent:f,mode:F,doc:{...d,[Lt]:C+2}},Iu=tt({indent:f,mode:Q,doc:[P,A,bu]},[],E,s.length>0,r,!0);i.push(ku),Iu?i.push(pr,B):$e?i.push(_t,B):i.push(_t,J);break}case T:case L:{let E=d.groupId?r[d.groupId]:F;if(E===K){let C=d.type===T?d.breakContents:d.negate?d.contents:oe(d.contents);C&&i.push({indent:f,mode:F,doc:C})}if(E===Q){let C=d.type===T?d.flatContents:d.negate?oe(d.contents):d.contents;C&&i.push({indent:f,mode:F,doc:C})}break}case M:s.push({indent:f,mode:F,doc:d.contents});break;case Y:s.length>0&&i.push({indent:f,mode:F,doc:ke});break;case g:switch(F){case Q:if(!d.hard){d.soft||(a.write(" "),o+=1);break}D=!0;case K:if(s.length>0){i.push({indent:f,mode:F,doc:d},...s.reverse()),s.length=0;break}d.literal?(a.write(u),o=0,f.root&&(f.root.value&&a.write(f.root.value),o=f.root.length)):(a.trim(),a.write(u+f.value),o=f.length);break}break;case b:i.push({indent:f,mode:F,doc:d.contents});break;case N:break;default:throw new Z(d)}i.length===0&&s.length>0&&(i.push(...s.reverse()),s.length=0)}let{text:c,positions:p}=a.finish();if(p.length!==2)return{formatted:c};let[l,m]=p;return{formatted:c,cursorNodeStart:l,cursorNodeText:c.slice(l,m)}}function mo(t,e,r=0){let n=0;for(let u=r;u<t.length;++u)t[u]===" "?n=n+e-n%e:n++;return n}var he=mo;var Mt=class{constructor(e){this.stack=[e]}get key(){let{stack:e,siblings:r}=this;return y(0,e,r===null?-2:-4)??null}get index(){return this.siblings===null?null:y(0,this.stack,-2)}get node(){return y(0,this.stack,-1)}get parent(){return this.getNode(1)}get grandparent(){return this.getNode(2)}get isInArray(){return this.siblings!==null}get siblings(){let{stack:e}=this,r=y(0,e,-3);return Array.isArray(r)?r:null}get next(){let{siblings:e}=this;return e===null?null:e[this.index+1]}get previous(){let{siblings:e}=this;return e===null?null:e[this.index-1]}get isFirst(){return this.index===0}get isLast(){let{siblings:e,index:r}=this;return e!==null&&r===e.length-1}get isRoot(){return this.stack.length===1}get root(){return this.stack[0]}get ancestors(){return[...this.#e()]}getName(){let{stack:e}=this,{length:r}=e;return r>1?y(0,e,-2):null}getValue(){return y(0,this.stack,-1)}getNode(e=0){let r=this.#t(e);return r===-1?null:this.stack[r]}getParentNode(e=0){return this.getNode(e+1)}#t(e){let{stack:r}=this;for(let n=r.length-1;n>=0;n-=2)if(!Array.isArray(r[n])&&--e<0)return n;return-1}call(e,...r){let{stack:n}=this,{length:u}=n,o=y(0,n,-1);for(let i of r)o=o?.[i],n.push(i,o);try{return e(this)}finally{n.length=u}}callParent(e,r=0){let n=this.#t(r+1),u=this.stack.splice(n+1);try{return e(this)}finally{this.stack.push(...u)}}each(e,...r){let{stack:n}=this,{length:u}=n,o=y(0,n,-1);for(let i of r)o=o[i],n.push(i,o);try{for(let i=0;i<o.length;++i)n.push(i,o[i]),e(this,i,o),n.length-=2}finally{n.length=u}}map(e,...r){let n=[];return this.each((u,o,i)=>{n[o]=e(u,o,i)},...r),n}match(...e){let r=this.stack.length-1,n=null,u=this.stack[r--];for(let o of e){if(u===void 0)return!1;let i=null;if(typeof n=="number"&&(i=n,n
|
||
|
|
`||t==="\r"||t==="\u2028"||t==="\u2029";function Co(t,e,r){if(e===!1)return!1;let n=!!r?.backwards,u=t.charAt(e);if(n){if(t.charAt(e-1)==="\r"&&u===`
|
||
|
|
`)return e-2;if(nn(u))return e-1}else{if(u==="\r"&&t.charAt(e+1)===`
|
||
|
|
`)return e+2;if(nn(u))return e+1}return e}var $=Co;function ho(t,e,r={}){let n=j(t,r.backwards?e-1:e,r),u=$(t,n,r);return n!==u}var H=ho;function*ye(t,e){let{getVisitorKeys:r,filter:n=()=>!0}=e,u=o=>ge(o)&&n(o);for(let o of r(t)){let i=t[o];if(Array.isArray(i))for(let D of i)u(D)&&(yield D);else u(i)&&(yield i)}}function*un(t,e){let r=[t];for(let n=0;n<r.length;n++){let u=r[n];for(let o of ye(u,e))yield o,r.push(o)}}function on(t,e){return ye(t,e).next().done}function go(t,e,r){let{filter:n}=r;if(!n)return[];let u,o=(r.getChildren?.(t,r)??[...ye(t,{getVisitorKeys:r.getVisitorKeys})]).flatMap(s=>(u??(u=[t,...e]),n(s,u)?[s]:sn(s,u,r))),{locStart:i,locEnd:D}=r;return o.sort((s,a)=>i(s)-i(a)||D(s)-D(a)),o}function sn(t,e,r){return Fe(r.cache,t,n=>go(n,e,r))}var ot=sn;function _o(t){let e=t.type||t.kind||"(unknown type)",r=String(t.name||t.id&&(typeof t.id=="object"?t.id.name:t.id)||t.key&&(typeof t.key=="object"?t.key.name:t.key)||t.value&&(typeof t.value=="object"?"":String(t.value))||t.operator||"");return r.length>20&&(r=r.slice(0,19)+"\u2026"),e+(r?" "+r:"")}function Yt(t,e){(t.comments??(t.comments=[])).push(e),e.printed=!1,e.nodeDescription=_o(t)}function ce(t,e){e.leading=!0,e.trailing=!1,Yt(t,e)}function re(t,e,r){e.leading=!1,e.trailing=!1,r&&(e.marker=r),Yt(t,e)}function fe(t,e){e.leading=!1,e.trailing=!0,Yt(t,e)}var Vt=new WeakMap;function an(t,e,r,n,u=[]){let{locStart:o,locEnd:i}=r,D=o(e),s=i(e),a=ot(t,u,{cache:Vt,locStart:o,locEnd:i,getVisitorKeys:r.getVisitorKeys,filter:r.printer.canAttachComment,getChildren:r.printer.getCommentChildNodes}),c,p,l=0,m=a.length;for(;l<m;){let f=l+m>>1,F=a[f],d=o(F),E=i(F);if(d<=D&&s<=E)return an(F,e,r,F,[F,...u]);if(E<=D){c=F,l=f+1;continue}if(s<=d){p=F,m=f;continue}throw new Error("Comment location overlaps with node location")}if(n?.type==="TemplateLiteral"){let{quasis:f}=n,F=Ut(f,e,r);c&&Ut(f,c,r)!==F&&(c=null),p&&Ut(f,p,r)!==F&&(p=null)}return{enclosingNode:n,precedingNode:c,followingNode:p}}var jt=()=>!1;function cn(t,e){let{comments:r}=t;if(delete t.comments,!rt(r)||!e.printer.canAttachComment)return;let n=[],{printer:{features:{experimental_avoidAstMutation:u},handleComments:o={}},originalText:i}=e,{ownLine:D=jt,endOfLine:s=jt,remaining:a=jt}=o,c=r.map((l,m)=>({...an(t,l,e),comment:l,text:i,options:e,ast:t,isLastComment:r.length-1===m,placement:void 0})),p=!u;for(let[l,m]of c.entries()){let{comment:f,precedingNode:F,enclosingNode:d,followingNode:E,text:C,options:h,ast:_,isLastComment:P}=m,A=yo(C,h,c,l)?"ownLine":Ao(C,h,c,l)?"endOfLine":"remaining",B;if(u?(m.placement=A,B=[m]):B=[f,C,h,_,P],p&&(f.enclosingNode=d,f.precedingNode=F,f.followingNode=E),f.placement=A,A==="ownLine")D(...B)||(E?ce(E,f):F?fe(F,f):d?re(d,f):re(_,f));else if(A==="endOfLine")s(...B)||(F?fe(F,f):E?ce(E,f):d?re(d,f):re(_,f));else if(!a(...B))if(F&&E){let J=n.length;J>0&&n[J-1].followingNode!==E&&Dn(n,h),n.push(m)}else F?fe(F,f):E?ce(E,f):d?re(d,f):re(_,f)}if(Dn(n,e),p)for(let l of r)delete l.precedingNode,delete l.enclosingNode,delete l.followingNode}var fn=t=>!/[\S\n\u2028\u2029]/.test(t);function yo(t,e,r,n){let{comment:u,precedingNode:o}=r[n],{locStart:i,locEnd:D}=e,s=i(u);if(o)for(let a=n-1;a>=0;a--){let{comment:c,precedingNode:p}=r[a];if(p!==o||!fn(t.slice(D(c),s)))break;s=i(c)}return H(t,s,{backwards:!0})}function Ao(t,e,r,n){let{comment:u,followingNode:o}=r[n],{locStart:i,locEnd:D}=e,s=D(u);if(o)for(let a=n+1;a<r.length;a++){let{comment:c,followingNode:p}=r[a];if(p!==o||!fn(t.slice(s,i(c))))break;s=D(c)}return H(t,s)}function Dn(t,e){let r=t.length;if(r===0)return;let{precedingNode:n,followingNode:u}=t[0],o=e.locStart(u),i;for(i=r;i>0;--i){let{comment:D,precedingNode:s,followingNode:a}=t[i-1];k(s,n),k(a,u);let c=e.originalText.slice(e.locEnd(D),o);if(e.printer.isGap?.(c,e)??/^[\s(]*$/.test(c))o=e.locStart(D);else break}for(let[D,{comment:s}]of t.entries())D<i?fe(n,s):ce(u,s);for(let D of[n,u])D.comments&&D.comments.length>1&&D.comments.sort((s,a)=>e.locStart(s)-e.locStart(a));t.length=0}function Ut(t,e,r){let n=r.locStart(e)-1;for(let u=1;u<t.length;++u)if(n<r.locStart(t[u]))return u-1;return 0}
|
||
|
|
(mixed values within one file are normalised by looking at what's used after the first line)`}]},filepath:{category:"Special",type:"path",description:"Specify the input filepath. This will be used to do parser inference.",cliName:"stdin-filepath",cliCategory:"Other",cliDescription:"Path to the file to pretend that stdin comes from."},insertPragma:{category:"Special",type:"boolean",default:!1,description:"Insert @format pragma into file's first docblock comment.",cliCategory:"Other"},parser:{category:"Global",type:"choice",default:void 0,description:"Which parser to use.",exception:t=>typeof t=="string"||typeof t=="function",choices:[{value:"flow",description:"Flow"},{value:"babel",description:"JavaScript"},{value:"babel-flow",description:"Flow"},{value:"babel-ts",description:"TypeScript"},{value:"typescript",description:"TypeScript"},{value:"acorn",description:"JavaScript"},{value:"espree",description:"JavaScript"},{value:"meriyah",description:"JavaScript"},{value:"css",description:"CSS"},{value:"less",description:"Less"},{value:"scss",description:"SCSS"},{value:"json",description:"JSON"},{value:"json5",description:"JSON5"},{value:"jsonc",description:"JSON with Comments"},{value:"json-stringify",description:"JSON.stringify"},{value:"graphql",description:"GraphQL"},{value:"markdown",description:"Markdown"},{value:"mdx",description:"MDX"},{value:"vue",description:"Vue"},{value:"yaml",description:"YAML"},{value:"glimmer",description:"Ember / Handlebars"},{value:"html",description:"HTML"},{value:"angular",description:"Angular"},{value:"lwc",description:"Lightning Web Components"},{value:"mjml",description:"MJML"}]},plugins:{type:"path",array:!0,default:[{value:[]}],category:"Global",description:"Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",exception:t=>typeof t=="string"||typeof t=="object",cliName:"plugin",cliCategory:"Config"},printWidth:{category:"Global",type:"int",default:80,description:"The line length where Prettier will try wrap.",range:{start:0,end:1/0,step:1}},rangeEnd:{category:"Special",type:"int",default:1/0,range:{start:0,end:1/0,step:1},description:`Format code ending at a given character offset (exclusive).
|
||
|
|
The range will extend forwards to the end of the selected statement.`,cliCategory:"Editor"},rangeStart:{category:"Special",type:"int",default:0,range:{start:0,end:1/0,step:1},description:`Format code starting at a given character offset.
|
||
|
|
The range will extend backwards to the start of the first line containing the selected statement.`,cliCategory:"Editor"},requirePragma:{category:"Special",type:"boolean",default:!1,description:"Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted.",cliCategory:"Other"},tabWidth:{type:"int",category:"Global",default:2,description:"Number of spaces per indentation level.",range:{start:0,end:1/0,step:1}},useTabs:{category:"Global",type:"boolean",default:!1,description:"Indent with tabs instead of spaces."},embeddedLanguageFormatting:{category:"Global",type:"choice",default:"auto",description:"Control how Prettier formats quoted code embedded in the file.",choices:[{value:"auto",description:"Format embedded code if Prettier can automatically identify it."},{value:"off",description:"Never automatically format embedded code."}]}};function it({plugins:t=[],showDeprecated:e=!1}={}){let r=t.flatMap(u=>u.languages??[]),n=[];for(let u of So(Object.assign({},...t.map(({options:o})=>o),En)))!e&&u.deprecated||(Array.isArray(u.choices)&&(e||(u.choices=u.choices.filter(o=>!o.deprecated)),u.name==="parser"&&(u.choices=[...u.choices,...Po(u.choices,r,t)])),u.pluginDefaults=Object.fromEntries(t.filter(o=>o.defaultOptions?.[u.name]!==void 0).map(o=>[o.name,o.defaultOptions[u.name]])),n.push(u));return{languages:r,options:n}}function*Po(t,e,r){let n=new Set(t.map(u=>u.value));for(let u of e)if(u.parsers){for(let o of u.parsers)if(!n.has(o)){n.add(o);let i=r.find(s=>s.parsers&&le(s.parsers,o)),D=u.name;i?.name&&(D+=` (plugin: ${i.name})`),yield{value:o,description:D}}}}function So(t){let e=[];for(let[r,n]of Object.entries(t)){let u={name:r,...n};Array.isArray(u.default)&&(u.default=y(0,u.default,-1).value),e.push(u)}return e}var bo=Array.prototype.toReversed??function(){return[...this].reverse()},ko=X("toReversed",function(){if(Array.isArray(this))return bo}),Cn=ko;function Io(){let t=globalThis,e=t.process?.platform;if(typeof e=="string")return e.startsWith("win");let r=t.Deno?.build?.os;return typeof r=="string"?r==="windows":t.navigator?.platform?.startsWith("Win")??!1}var Ro=Io();function hn(t){if(t=t instanceof URL?t:new URL(t),t.protocol!=="file:")throw new TypeError(`URL must be a file URL: received "${t.protocol}"`);return t}function vo(t){return t=hn(t),decodeURIComponent(t.pathname.replace(/%(?![0-9A-Fa-f]{2})/g,"%25"))}function Lo(t){t=hn(t);let e=decodeURIComponent(t.pathname.replace(/\//g,"\\").replace(/%(?![0-9A-Fa-f]{2})/g,"%25")).replace(/^\\*([A-Za-z]:)(\\|$)/,"$1\\");return t.hostname!==""&&(e=`\\\\${t.hostname}${e}`),e}function Wt(t){return Ro?Lo(t):vo(t)}var gn=t=>String(t).split(/[/\\]/).pop(),_n=t=>String(t).startsWith("file:");function yn(t,e){if(!e)return;let r=gn(e).toLowerCase();return t.find(({filenames:n})=>n?.some(u=>u.toLowerCase()===r))??t.find(({extensions:n})=>n?.some(u=>r.endsWith(u)))}function Mo(t,e){if(e)return t.find(({name:r})=>r.toLowerCase()===e)??t.find(({aliases:r})=>r?.includes(e))??t.find(({extensions:r})=>r?.includes(`.${e}`))}var Yo=void 0;function An(t,e){if(e){if(_n(e))try{e=Wt(e)}catch{return}if(typeof e=="string")return t.find(({isSupported:r})=>r?.({filepath:e}))}}function jo(t,e){let r=Cn(0,t.plugins).flatMap(u=>u.languages??[]);return(Mo(r,e.language)??yn(r,e.physicalFile)??yn(r,e.file)??An(r,e.physicalFile)??An(r,e.file)??Yo?.(r,e.physicalFile))?.parsers[0]}var st=jo;var ie={key:t=>/^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(t)?t:JSON.stringify(t),value(t){if(t===null||typeof t!="object")return JSON.stringify(t);if(Array.isArray(t))return`[${t.map(r=>ie.value(r)).join(", ")}]`;let e=Object.keys(t);return e.length===0?"{}":`{ ${e.map(r=>`${ie.key(r)}: ${ie.value(t[r])}`).join(", ")} }`},pair:({key:t,value:e})=>ie.value({[t]:e})};var xn=new Proxy(String,{get:()=>xn}),z=xn;var Bn=(t,e,{descriptor:r})=>{let n=[`${z.yellow(typeof t=="string"?r.key(t):r.pair(t))} is deprecated`];return e&&n.push(`we now treat it as ${z.blue(typeof e=="string"?r.key(e):r.pair(e))}`),n.join("; ")+"."};var Dt=Symbol.for("vnopts.VALUE_NOT_EXIST"),Ae=Symbo
|
||
|
|
`)),Pn(o,r.loggerPrintWidth)};function Nn(t,e,r,n){return[`Invalid ${z.red(n.key(t))} value.`,`Expected ${z.blue(r)},`,`but received ${e===Dt?z.gray("nothing"):z.red(n.value(e))}.`].join(" ")}function On({text:t,list:e},r){let n=[];return t&&n.push(`- ${z.blue(t)}`),e&&n.push([`- ${z.blue(e.title)}:`].concat(e.values.map(u=>On(u,r-Tn.length).replace(/^|\n/g,`$&${Tn}`))).join(`
|
||
|
|
`)),Pn(n,r)}function Pn(t,e){if(t.length===1)return t[0];let[r,n]=t,[u,o]=t.map(i=>i.split(`
|
||
|
|
`,1)[0].length);return u>e&&u>o?n:r}var xe=[],$t=[];function at(t,e,r){if(t===e)return 0;let n=r?.maxDistance,u=t;t.length>e.length&&(t=e,e=u);let o=t.length,i=e.length;for(;o>0&&t.charCodeAt(~-o)===e.charCodeAt(~-i);)o--,i--;let D=0;for(;D<o&&t.charCodeAt(D)===e.charCodeAt(D);)D++;if(o-=D,i-=D,n!==void 0&&i-o>n)return n;if(o===0)return n!==void 0&&i>n?n:i;let s,a,c,p,l=0,m=0;for(;l<o;)$t[l]=t.charCodeAt(D+l),xe[l]=++l;for(;m<i;){for(s=e.charCodeAt(D+m),c=m++,a=m,l=0;l<o;l++)p=s===$t[l]?c:c+1,c=xe[l],a=xe[l]=c>a?p>a?a+1:p:p>c?c+1:p;if(n!==void 0){let f=a;for(l=0;l<o;l++)xe[l]<f&&(f=xe[l]);if(f>n)return n}}return xe.length=o,$t.length=o,n!==void 0&&a>n?n:a}function Sn(t,e,r){if(!Array.isArray(e)||e.length===0)return;let n=r?.maxDistance,u=t.length;for(let s of e)if(s===t)return s;if(n===0)return;let o,i=Number.POSITIVE_INFINITY,D=new Set;for(let s of e){if(D.has(s))continue;D.add(s);let a=Math.abs(s.length-u);if(a>=i||n!==void 0&&a>n)continue;let c=Number.isFinite(i)?n===void 0?i:Math.min(i,n):n,p=c===void 0?at(t,s):at(t,s,{maxDistance:c});if(n!==void 0&&p>n)continue;let l=p;if(c!==void 0&&p===c&&c===n&&(l=at(t,s)),l<i&&(i=l,o=s,i===0))break}if(!(n!==void 0&&i>n))return o}var ct=(t,e,{descriptor:r,logger:n,schemas:u})=>{let o=[`Ignored unknown option ${z.yellow(r.pair({key:t,value:e}))}.`],i=Sn(t,Object.keys(u),{maxDistance:3});i&&o.push(`Did you mean ${z.blue(r.key(i))}?`),n.warn(o.join(" "))};var Uo=["default","expected","validate","deprecated","forward","redirect","overlap","preprocess","postprocess"];function Vo(t,e){let r=new t(e),n=Object.create(r);for(let u of Uo)u in e&&(n[u]=Wo(e[u],r,O.prototype[u].length));return n}var O=class{static create(e){return Vo(this,e)}constructor(e){this.name=e.name}default(e){}expected(e){return"nothing"}validate(e,r){return!1}deprecated(e,r){return!1}forward(e,r){}redirect(e,r){}overlap(e,r,n){return e}preprocess(e,r){return e}postprocess(e,r){return Ae}};function Wo(t,e,r){return typeof t=="function"?(...n)=>t(...n.slice(0,r-1),e,...n.slice(r-1)):()=>t}var ft=class extends O{constructor(e){super(e),this._sourceName=e.sourceName}expected(e){return e.schemas[this._sourceName].expected(e)}validate(e,r){return r.schemas[this._sourceName].validate(e,r)}redirect(e,r){return this._sourceName}};var lt=class extends O{expected(){return"anything"}validate(){return!0}};var pt=class extends O{constructor({valueSchema:e,name:r=e.name,...n}){super({...n,name:r}),this._valueSchema=e}expected(e){let{text:r,list:n}=e.normalizeExpectedResult(this._valueSchema.expected(e));return{text:r&&`an array of ${r}`,list:n&&{title:"an array of the following values",values:[{list:n}]}}}validate(e,r){if(!Array.isArray(e))return!1;let n=[];for(let u of e){let o=r.normalizeValidateResult(this._valueSchema.validate(u,r),u);o!==!0&&n.push(o.value)}return n.length===0?!0:{value:n}}deprecated(e,r){let n=[];for(let u of e){let o=r.normalizeDeprecatedResult(this._valueSchema.deprecated(u,r),u);o!==!1&&n.push(...o.map(({value:i})=>({value:[i]})))}return n}forward(e,r){let n=[];for(let u of e){let o=r.normalizeForwardResult(this._valueSchema.forward(u,r),u);n.push(...o.map(bn))}return n}redirect(e,r){let n=[],u=[];for(let o of e){let i=r.normalizeRedirectResult(this._valueSchema.redirect(o,r),o);"remain"in i&&n.push(i.remain),u.push(...i.redirect.map(bn))}return n.length===0?{redirect:u}:{redirect:u,remain:n}}overlap(e,r){return e.concat(r)}};function bn({from:t,to:e}){return{from:[t],to:e}}var mt=class extends O{expected(){return"true or false"}validate(e){return typeof e=="boolean"}};function In(t,e){let r=Object.create(null);for(let n of t){let u=n[e];if(r[u])throw new Error(`Duplicate ${e} ${JSON.stringify(u)}`);r[u]=n}return r}function Rn(t,e){let r=new Map;for(let n of t){let u=n[e];if(r.has(u))throw new Error(`Duplicate ${e} ${JSON.stringify(u)}`);r.set(u,n)}return r}function vn(){let t=Object.create(null);return e=>{let r=JSON.stringify(e);return t[r]?!0:(t[r]=!0,!1)}}function Ln(t,e){let r=[],n=[];for(let u of t)e(u)?r.push(u):n.push(u);return[r,n]}function Mn(t){return t===Math.floor(t)}function Yn(t,e){if(t===
|
||
|
|
`,u.gutter(h.replace(/\d/g," "))," ",B,u.marker("^").repeat(J)].join(""),P&&r.message&&(A+=" "+u.message(r.message))}return[u.marker(">"),u.gutter(h),F.length>0?` ${F}`:"",A].join("")}else return` ${u.gutter(h)}${F.length>0?` ${F}`:""}`}).join(`
|
||
|
|
`);return r.message&&!p&&(f=`${" ".repeat(l+1)}${r.message}
|
||
|
|
${f}`),u.reset(f)}function eu(t,e,r={}){return Zn(t,e,r)}async function ci(t,e){let r=await Ue(e),n=r.preprocess?await r.preprocess(t,e):t;e.originalText=n;let u;try{u=await r.parse(n,e,e)}catch(o){fi(o,t)}return{text:n,ast:u}}function fi(t,e){let{loc:r}=t;if(r){let{start:n,end:u}=r;n&&(n={line:n.line,column:n.column-1}),u&&(u={line:u.line,column:u.column-1});let o=eu(e,{start:n,end:u},{highlightCode:!0});t.message+=`
|
||
|
|
`+o,t.codeFrame=o}throw t}var me=ci;async function tu(t,e,r,n,u){if(r.embeddedLanguageFormatting!=="auto")return;let{printer:o}=r,{embed:i}=o;if(!i)return;if(i.length>2)throw new Error("printer.embed has too many parameters. The API changed in Prettier v3. Please update your plugin. See https://prettier.io/docs/plugins#optional-embed");let{hasPrettierIgnore:D}=o,{getVisitorKeys:s}=i,a=[];l();let c=t.stack;for(let{print:m,node:f,pathStack:F}of a)try{t.stack=F;let d=await m(p,e,t,r);d&&u.set(f,d)}catch(d){if(globalThis.PRETTIER_DEBUG)throw d}t.stack=c;function p(m,f){return li(m,f,r,n)}function l(){let{node:m}=t;if(m===null||typeof m!="object"||D?.(t))return;for(let F of s(m))Array.isArray(m[F])?t.each(l,F):t.call(l,F);let f=i(t,r);if(f){if(typeof f=="function"){a.push({print:f,node:m,pathStack:[...t.stack]});return}u.set(m,f)}}}async function li(t,e,r,n){let u=await se({...r,...e,parentParser:r.parser,originalText:t,cursorOffset:void 0,rangeStart:void 0,rangeEnd:void 0},{passThrough:!0}),{ast:o}=await me(t,u),i=await n(o,u);return He(i)}function pi(t,e,r,n){let{originalText:u,[ue]:o,locStart:i,locEnd:D,[Symbol.for("printedComments")]:s}=e,{node:a}=t,c=i(a),p=D(a);for(let m of o)i(m)>=c&&D(m)<=p&&s.add(m);let{printPrettierIgnored:l}=e.printer;return l?l(t,e,r,n):u.slice(c,p)}var ru=pi;async function Ve(t,e){({ast:t}=await or(t,e));let r=new Map,n=new tn(t),u=Fn(e),o=new Map;await tu(n,D,e,Ve,o);let i=await nu(n,e,D,void 0,o);if(dn(e),e.cursorOffset>=0){if(e.nodeAfterCursor&&!e.nodeBeforeCursor)return[ee,i];if(e.nodeBeforeCursor&&!e.nodeAfterCursor)return[i,ee]}return i;function D(a,c){return a===void 0||a===n?s(c):Array.isArray(a)?n.call(()=>s(c),...a):n.call(()=>s(c),a)}function s(a){u(n);let c=n.node;if(c==null)return"";let p=ge(c)&&a===void 0;if(p&&r.has(c))return r.get(c);let l=nu(n,e,D,a,o);return p&&r.set(c,l),l}}function nu(t,e,r,n,u){let{node:o}=t,{printer:i}=e,D;switch(i.hasPrettierIgnore?.(t)?D=ru(t,e,r,n):u.has(o)?D=u.get(o):D=i.print(t,e,r,n),o){case e.cursorNode:D=Ee(D,s=>[ee,s,ee]);break;case e.nodeBeforeCursor:D=Ee(D,s=>[s,ee]);break;case e.nodeAfterCursor:D=Ee(D,s=>[ee,s]);break}return i.printComment&&rt(o.comments)&&!i.willPrintOwnComments?.(t,e)&&(D=mn(t,D,e)),D}async function or(t,e){let r=t.comments??[];e[ue]=r,e[Symbol.for("printedComments")]=new Set,cn(t,e);let{printer:{preprocess:n}}=e;return t=n?await n(t,e):t,{ast:t,comments:r}}function mi(t,e){let{cursorOffset:r,locStart:n,locEnd:u,getVisitorKeys:o}=e,i=m=>n(m)<=r&&u(m)>=r,D=t,s=[t];for(let m of un(t,{getVisitorKeys:o,filter:i}))s.push(m),D=m;if(on(D,{getVisitorKeys:o}))return{cursorNode:D};let a,c,p=-1,l=Number.POSITIVE_INFINITY;for(;s.length>0&&(a===void 0||c===void 0);){D=s.pop();let m=a!==void 0,f=c!==void 0;for(let F of ye(D,{getVisitorKeys:o})){if(!m){let d=u(F);d<=r&&d>p&&(a=F,p=d)}if(!f){let d=n(F);d>=r&&d<l&&(c=F,l=d)}}}return{nodeBeforeCursor:a,nodeAfterCursor:c}}var ir=mi;function di(t,e){let{printer:r}=e,n=r.massageAstNode;if(!n)return t;let{getVisitorKeys:u}=r,{ignoredProperties:o}=n;return i(t);function i(D,s){if(!ge(D))return D;if(Array.isArray(D))return D.map(l=>i(l,s)).filter(Boolean);let a={},c=new Set(u(D));for(let l in D)!le(D,l)||o?.has(l)||(c.has(l)?a[l]=i(D[l],D):a[l]=D[l]);let p=n(D,a,s);if(p!==null)return p??a}}var uu=di;var Fi=Array.prototype.findLastIndex??function(t){for(let e=this.length-1;e>=0;e--){let r=this[e];if(t(r,e,this))return e}return-1},Ei=X("findLastIndex",function(){if(Array.isArray(this))return Fi}),ou=Ei;function Ci(t,e){return e=new Set(e),t.find(r=>Du.has(r.type)&&e.has(r))}function iu(t){let e=ou(0,t,r=>r.type!=="Program"&&r.type!=="File");return e===-1?t:t.slice(0,e+1)}function hi(t,e,{locStart:r,locEnd:n}){let[u,...o]=t,[i,...D]=e;if(u===i)return[u,i];let s=r(u);for(let c of iu(D))if(r(c)>=s)i=c;else break;let a=n(i);for(let c of iu(o)){if(n(c)<=a)u=c;else break;if(u===i)break}return[u,i]}function sr(t,e,r,n,u=[],o,i){let{locStart:D,locEnd:s}=i,a=D(t),c=s(t);if(e>c||e<a||o==="rangeEnd"&&e===a||o==="rangeStart"&&e===c)return;let p=[t,...u],l=ot(t,p,{cache:Vt,locStart:D,locEnd:s,getVisitorKeys:r.getVi
|
||
|
|
`,u)+1),s=n.slice(D,u).match(/^\s*/)[0],a=he(s,e.tabWidth),c=await mu(i,{...e,rangeStart:0,rangeEnd:Number.POSITIVE_INFINITY,cursorOffset:e.cursorOffset>u&&e.cursorOffset<=o?e.cursorOffset-u:-1,endOfLine:"lf"},a),p=c.formatted.trimEnd(),{cursorOffset:l}=e;l>o?l+=p.length-i.length:c.cursorOffset>=0&&(l=c.cursorOffset+u);let m=n.slice(0,u)+p+n.slice(o);if(e.endOfLine!=="lf"){let f=we(e.endOfLine);l>=0&&f===`\r
|
||
|
|
`&&(l+=Nt(m.slice(0,l),`
|
||
|
|
`)),m=ne(0,m,`
|
||
|
|
`,f)}return{formatted:m,cursorOffset:l,comments:c.comments}}function Dr(t,e,r){return typeof e!="number"||Number.isNaN(e)||e<0||e>t.length?r:e}function fu(t,e){let{cursorOffset:r,rangeStart:n,rangeEnd:u}=e;return r=Dr(t,r,-1),n=Dr(t,n,0),u=Dr(t,u,t.length),{...e,cursorOffset:r,rangeStart:n,rangeEnd:u}}function du(t,e){let{cursorOffset:r,rangeStart:n,rangeEnd:u,endOfLine:o}=fu(t,e),i=t.charAt(0)===pu;if(i&&(t=t.slice(1),r--,n--,u--),o==="auto"&&(o=hr(t)),t.includes("\r")){let D=s=>Nt(t.slice(0,Math.max(s,0)),`\r
|
||
|
|
`);r-=D(r),n-=D(n),u-=D(u),t=gr(t)}return{hasBOM:i,text:t,options:fu(t,{...e,cursorOffset:r,rangeStart:n,rangeEnd:u,endOfLine:o})}}async function lu(t,e){let r=await Ue(e);return!r.hasPragma||r.hasPragma(t)}async function Ai(t,e){return(await Ue(e)).hasIgnorePragma?.(t)}async function ar(t,e){let{hasBOM:r,text:n,options:u}=du(t,await se(e));if(u.rangeStart>=u.rangeEnd&&n!==""||u.requirePragma&&!await lu(n,u)||u.checkIgnorePragma&&await Ai(n,u))return{formatted:t,cursorOffset:e.cursorOffset,comments:[]};let o;return u.rangeStart>0||u.rangeEnd<n.length?o=await yi(n,u):(!u.requirePragma&&u.insertPragma&&u.printer.insertPragma&&!await lu(n,u)&&(n=u.printer.insertPragma(n)),o=await mu(n,u)),r&&(o.formatted=pu+o.formatted,o.cursorOffset>=0&&o.cursorOffset++),o}async function Fu(t,e,r){let{text:n,options:u}=du(t,await se(e)),o=await me(n,u);return r&&(r.preprocessForPrint&&(o.ast=await or(o.ast,u)),r.massage&&(o.ast=uu(o.ast,u))),o}async function Eu(t,e){e=await se(e);let r=await Ve(t,e);return Ce(r,e)}async function Cu(t,e){let r=Vr(t),{formatted:n}=await ar(r,{...e,parser:"__js_expression"});return n}async function hu(t,e){e=await se(e);let{ast:r}=await me(t,e);return e.cursorOffset>=0&&(e={...e,...ir(r,e)}),Ve(r,e)}async function gu(t,e){return Ce(t,await se(e))}var cr={};At(cr,{builders:()=>Bi,printer:()=>Ti,utils:()=>Ni});var Bi={join:be,line:Ze,softline:Yr,hardline:W,literalline:Je,group:Ot,conditionalGroup:Rr,fill:Ir,lineSuffix:Ie,lineSuffixBoundary:jr,cursor:ee,breakParent:ae,ifBreak:vr,trim:Ur,indent:oe,indentIfBreak:Lr,align:De,addAlignmentToDoc:Qe,markAsRoot:Xe,dedentToRoot:br,dedent:kr,hardlineWithoutBreakParent:ke,literallineWithoutBreakParent:Pt,label:Mr,concat:t=>t},Ti={printDocToString:Ce},Ni={willBreak:Br,traverseDoc:Oe,findInDoc:Ke,mapDoc:Se,removeLines:Nr,stripTrailingHardline:He,replaceEndOfLine:wr,canBreak:Or};var _u="3.9.6";var lr={};At(lr,{addDanglingComment:()=>re,addLeadingComment:()=>ce,addTrailingComment:()=>fe,getAlignmentSize:()=>he,getIndentSize:()=>yu,getMaxContinuousCount:()=>Au,getNextNonSpaceNonCommentCharacter:()=>xu,getNextNonSpaceNonCommentCharacterIndex:()=>ji,getPreferredQuote:()=>Nu,getStringWidth:()=>Re,hasNewline:()=>H,hasNewlineInRange:()=>wu,hasSpaces:()=>Ou,isNextLineEmpty:()=>zi,isNextLineEmptyAfterIndex:()=>gt,isPreviousLineEmpty:()=>Vi,makeString:()=>$i,skip:()=>_e,skipEverythingButNewLine:()=>ut,skipInlineComment:()=>Be,skipNewline:()=>$,skipSpaces:()=>j,skipToLineEnd:()=>nt,skipTrailingComment:()=>Te,skipWhitespace:()=>rn});function wi(t,e){if(e===!1)return!1;if(t.charAt(e)==="/"&&t.charAt(e+1)==="*"){for(let r=e+2;r<t.length;++r)if(t.charAt(r)==="*"&&t.charAt(r+1)==="/")return r+2}return e}var Be=wi;function Oi(t,e){return e===!1?!1:t.charAt(e)==="/"&&t.charAt(e+1)==="/"?ut(t,e):e}var Te=Oi;function Pi(t,e){let r=null,n=e;for(;n!==r;)r=n,n=j(t,n),n=Be(t,n),n=Te(t,n),n=$(t,n);return n}var We=Pi;function Si(t,e){let r=null,n=e;for(;n!==r;)r=n,n=nt(t,n),n=Be(t,n),n=j(t,n);return n=Te(t,n),n=$(t,n),n!==!1&&H(t,n)}var gt=Si;function bi(t,e){let r=t.lastIndexOf(`
|
||
|
|
`);return r===-1?0:he(t.slice(r+1).match(/^[\t ]*/)[0],e)}var yu=bi;function fr(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function ki(t,e){let r=t.matchAll(new RegExp(`(?:${fr(e)})+`,"g"));return r.reduce||(r=[...r]),r.reduce((n,[u])=>Math.max(n,u.length),0)/e.length}var Au=ki;function Ii(t,e){let r=We(t,e);return r===!1?"":t.charAt(r)}var xu=Ii;var Bu=Object.freeze({character:"'",codePoint:39}),Tu=Object.freeze({character:'"',codePoint:34}),Ri=Object.freeze({preferred:Bu,alternate:Tu}),vi=Object.freeze({preferred:Tu,alternate:Bu});function Nu(t,e){let{preferred:r,alternate:n}=e===!0||e==="'"?Ri:vi,{length:u}=t,o=0,i=0;for(let D=0;D<u;D++){let s=t.charCodeAt(D);s===r.codePoint?o++:s===n.codePoint&&i++}return(o>i?n:r).character}function Li(t,e,r){for(let n=e;n<r;++n)if(t.charAt(n)===`
|
||
|
|
`)return!0;return!1}var wu=Li;function Mi(t,e,r={}){return j(t,r.backwards?e-1:e,r)!==e}var Ou=Mi;function Yi(t,e,r){return We(t,r(e))}function ji(t,e){return arguments.length===2||typeof e=="number"?We(t,e):Yi(...arguments)}function Ui(t,e,r){return ve(t,r(e))}function Vi(t,e){return arguments.length===2||typeof e=="number"?ve(t,e):Ui(...arguments)}function Wi(t,e,r){return gt(t,r(e))}function $i(t,e,r){let n=e==='"'?"'":'"',o=ne(0,t,/\\(.)|(["'])/gs,(i,D,s)=>D===n?D:s===e?"\\"+s:s||(r&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/.test(D)?D:"\\"+D));return e+o+e}function zi(t,e){return arguments.length===2||typeof e=="number"?gt(t,e):Wi(...arguments)}function de(t,e=1){return async(...r)=>{let n=r[e]??{},u=n.plugins??[];return r[e]={...n,plugins:Array.isArray(u)?u:Object.values(u)},await t(...r)}}var Pu=de(ar);async function Su(t,e){let{formatted:r}=await Pu(t,{...e,cursorOffset:-1});return r}async function Gi(t,e){return await Su(t,e)===t}var Ki=de(it,0),Hi={parse:de(Fu),formatAST:de(Eu),formatDoc:de(Cu),printToDoc:de(hu),printDocToString:de(gu)};return Yu(Ji);});
|