prettier-plugin-pegjs
Version:
A Prettier plugin for formatting Pegjs and Peggy-js grammars
25 lines • 161 kB
JavaScript
"use strict";var Kn=Object.defineProperty;var Xn=(i,d,r)=>d in i?Kn(i,d,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[d]=r;var YD=(i,d,r)=>(Xn(i,typeof d!="symbol"?d+"":d,r),r);var _n={exports:{}};(function(i,d){(function(r){function C(){var S=r();return S.default||S}i.exports=C()})(function(){var r=Object.create,C=Object.defineProperty,S=Object.getOwnPropertyDescriptor,y=Object.getOwnPropertyNames,w=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty,W=(u,D)=>()=>(u&&(D=u(u=0)),D),P=(u,D)=>()=>(D||u((D={exports:{}}).exports,D),D.exports),j=(u,D)=>{for(var n in D)C(u,n,{get:D[n],enumerable:!0})},G=(u,D,n,a)=>{if(D&&typeof D=="object"||typeof D=="function")for(let o of y(D))!O.call(u,o)&&o!==n&&C(u,o,{get:()=>D[o],enumerable:!(a=S(D,o))||a.enumerable});return u},M=(u,D,n)=>(n=u!=null?r(w(u)):{},G(D||!u||!u.__esModule?C(n,"default",{value:u,enumerable:!0}):n,u)),X=u=>G(C({},"__esModule",{value:!0}),u),I=(u,D,n)=>{if(!D.has(u))throw TypeError("Cannot "+n)},Q=(u,D,n)=>{if(D.has(u))throw TypeError("Cannot add the same private member more than once");D instanceof WeakSet?D.add(u):D.set(u,n)},Z=(u,D,n)=>(I(u,D,"access private method"),n),Iu=P(u=>{Object.defineProperty(u,"__esModule",{value:!0}),u.default=D;function D(){}D.prototype={diff:function(o,F){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},E=f.callback;typeof f=="function"&&(E=f,f={}),this.options=f;var A=this;function g(z){return E?(setTimeout(function(){E(void 0,z)},0),!0):z}o=this.castInput(o),F=this.castInput(F),o=this.removeEmpty(this.tokenize(o)),F=this.removeEmpty(this.tokenize(F));var m=F.length,x=o.length,h=1,k=m+x;f.maxEditLength&&(k=Math.min(k,f.maxEditLength));var $=[{newPos:-1,components:[]}],N=this.extractCommon($[0],F,o,0);if($[0].newPos+1>=m&&N+1>=x)return g([{value:this.join(F),count:F.length}]);function L(){for(var z=-1*h;z<=h;z+=2){var V=void 0,Y=$[z-1],J=$[z+1],Fu=(J?J.newPos:0)-z;Y&&($[z-1]=void 0);var iu=Y&&Y.newPos+1<m,Au=J&&0<=Fu&&Fu<x;if(!iu&&!Au){$[z]=void 0;continue}if(!iu||Au&&Y.newPos<J.newPos?(V=a(J),A.pushComponent(V.components,void 0,!0)):(V=Y,V.newPos++,A.pushComponent(V.components,!0,void 0)),Fu=A.extractCommon(V,F,o,z),V.newPos+1>=m&&Fu+1>=x)return g(n(A,V.components,F,o,A.useLongestToken));$[z]=V}h++}if(E)(function z(){setTimeout(function(){if(h>k)return E();L()||z()},0)})();else for(;h<=k;){var q=L();if(q)return q}},pushComponent:function(o,F,f){var E=o[o.length-1];E&&E.added===F&&E.removed===f?o[o.length-1]={count:E.count+1,added:F,removed:f}:o.push({count:1,added:F,removed:f})},extractCommon:function(o,F,f,E){for(var A=F.length,g=f.length,m=o.newPos,x=m-E,h=0;m+1<A&&x+1<g&&this.equals(F[m+1],f[x+1]);)m++,x++,h++;return h&&o.components.push({count:h}),o.newPos=m,x},equals:function(o,F){return this.options.comparator?this.options.comparator(o,F):o===F||this.options.ignoreCase&&o.toLowerCase()===F.toLowerCase()},removeEmpty:function(o){for(var F=[],f=0;f<o.length;f++)o[f]&&F.push(o[f]);return F},castInput:function(o){return o},tokenize:function(o){return o.split("")},join:function(o){return o.join("")}};function n(o,F,f,E,A){for(var g=0,m=F.length,x=0,h=0;g<m;g++){var k=F[g];if(k.removed){if(k.value=o.join(E.slice(h,h+k.count)),h+=k.count,g&&F[g-1].added){var $=F[g-1];F[g-1]=F[g],F[g]=$}}else{if(!k.added&&A){var N=f.slice(x,x+k.count);N=N.map(function(q,z){var V=E[h+z];return V.length>q.length?V:q}),k.value=o.join(N)}else k.value=o.join(f.slice(x,x+k.count));x+=k.count,k.added||(h+=k.count)}}var L=F[m-1];return m>1&&typeof L.value=="string"&&(L.added||L.removed)&&o.equals("",L.value)&&(F[m-2].value+=L.value,F.pop()),F}function a(o){return{newPos:o.newPos,components:o.components.slice(0)}}}),bu=P(u=>{Object.defineProperty(u,"__esModule",{value:!0}),u.diffArrays=o,u.arrayDiff=void 0;var D=n(Iu());function n(F){return F&&F.__esModule?F:{default:F}}var a=new D.default;u.arrayDiff=a,a.tokenize=function(F){return F.slice()},a.join=a.removeEmpty=function(F){return F};function o(F,f,E){return a.diff(F,f,E)}}),nu=P((u,D)=>{var n=new Proxy(String,{get:()=>n});D.exports=n}),$u={};j($u,{default:()=>Ae,shouldHighlight:()=>wu});var wu,Ae,pe=W(()=>{wu=()=>!1,Ae=String}),Be=P(u=>{Object.defineProperty(u,"__esModule",{value:!0}),u.codeFrameColumns=m,u.default=x;var D=(pe(),X($u)),n=nu(),a=n,o;function F(h){return h?(o!=null||(o=new a.constructor({enabled:!0,level:1})),o):a}var f=!1;function E(h){return{gutter:h.grey,marker:h.red.bold,message:h.red.bold}}var A=/\r\n|[\n\r\u2028\u2029]/;function g(h,k,$){let N=Object.assign({column:0,line:-1},h.start),L=Object.assign({},N,h.end),{linesAbove:q=2,linesBelow:z=3}=$||{},V=N.line,Y=N.column,J=L.line,Fu=L.column,iu=Math.max(V-(q+1),0),Au=Math.min(k.length,J+z);V===-1&&(iu=0),J===-1&&(Au=k.length);let Wu=J-V,lu={};if(Wu)for(let Pu=0;Pu<=Wu;Pu++){let zu=Pu+V;if(!Y)lu[zu]=!0;else if(Pu===0){let Se=k[zu-1].length;lu[zu]=[Y,Se-Y+1]}else if(Pu===Wu)lu[zu]=[0,Fu];else{let Se=k[zu-Pu].length;lu[zu]=[0,Se]}}else Y===Fu?Y?lu[V]=[Y,0]:lu[V]=!0:lu[V]=[Y,Fu-Y];return{start:iu,end:Au,markerLines:lu}}function m(h,k,$={}){let N=($.highlightCode||$.forceColor)&&(0,D.shouldHighlight)($),L=F($.forceColor),q=E(L),z=(lu,Pu)=>N?lu(Pu):Pu,V=h.split(A),{start:Y,end:J,markerLines:Fu}=g(k,V,$),iu=k.start&&typeof k.start.column=="number",Au=String(J).length,Wu=(N?(0,D.default)(h,$):h).split(A,J).slice(Y,J).map((lu,Pu)=>{let zu=Y+1+Pu,Se=` ${` ${zu}`.slice(-Au)} |`,o0=Fu[zu],Yn=!Fu[zu+1];if(o0){let cn="";if(Array.isArray(o0)){let Hn=lu.slice(0,Math.max(o0[0]-1,0)).replace(/[^\t]/g," "),Jn=o0[1]||1;cn=[`
`,z(q.gutter,Se.replace(/\d/g," "))," ",Hn,z(q.marker,"^").repeat(Jn)].join(""),Yn&&$.message&&(cn+=" "+z(q.message,$.message))}return[z(q.marker,">"),z(q.gutter,Se),lu.length>0?` ${lu}`:"",cn].join("")}else return` ${z(q.gutter,Se)}${lu.length>0?` ${lu}`:""}`}).join(`
`);return $.message&&!iu&&(Wu=`${" ".repeat(Au+1)}${$.message}
${Wu}`),N?L.reset(Wu):Wu}function x(h,k,$,N={}){if(!f){f=!0;let L="Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";{let q=new Error(L);q.name="DeprecationWarning",console.warn(new Error(L))}}return $=Math.max($,0),m(h,{start:{column:$,line:k}},N)}}),je={};j(je,{__debug:()=>Gn,check:()=>T,doc:()=>sD,format:()=>v,formatWithCursor:()=>p,getSupportInfo:()=>ne,util:()=>a0,version:()=>l});var ZD=(u,D,n,a)=>{if(!(u&&D==null))return D.replaceAll?D.replaceAll(n,a):n.global?D.replace(n,a):D.split(n).join(a)},de=ZD,E0=M(bu(),1),Gu="string",ku="array",Yu="cursor",xu="indent",Su="align",Bu="trim",K="group",fu="fill",cu="if-break",Du="indent-if-break",_u="line-suffix",Ou="line-suffix-boundary",eu="line",Cu="label",au="break-parent",QD=new Set([Yu,xu,Su,Bu,K,fu,cu,Du,_u,Ou,eu,Cu,au]);function A0(u){if(typeof u=="string")return Gu;if(Array.isArray(u))return ku;if(!u)return;let{type:D}=u;if(QD.has(D))return D}var ju=A0,p0=u=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(u);function B0(u){let D=u===null?"null":typeof u;if(D!=="string"&&D!=="object")return`Unexpected doc '${D}',
Expected it to be 'string' or 'object'.`;if(ju(u))throw new Error("doc is valid.");let n=Object.prototype.toString.call(u);if(n!=="[object Object]")return`Unexpected doc '${n}'.`;let a=p0([...QD].map(o=>`'${o}'`));return`Unexpected doc.type '${u.type}'.
Expected it to be ${a}.`}var d0=class extends Error{constructor(D){super(B0(D));YD(this,"name","InvalidDocError");this.doc=D}},Zu=d0,ur={};function g0(u,D,n,a){let o=[u];for(;o.length>0;){let F=o.pop();if(F===ur){n(o.pop());continue}n&&o.push(F,ur);let f=ju(F);if(!f)throw new Zu(F);if((D==null?void 0:D(F))!==!1)switch(f){case ku:case fu:{let E=f===ku?F:F.parts;for(let A=E.length,g=A-1;g>=0;--g)o.push(E[g]);break}case cu:o.push(F.flatContents,F.breakContents);break;case K:if(a&&F.expandedStates)for(let E=F.expandedStates.length,A=E-1;A>=0;--A)o.push(F.expandedStates[A]);else o.push(F.contents);break;case Su:case xu:case Du:case Cu:case _u:o.push(F.contents);break;case Gu:case Yu:case Bu:case Ou:case eu:case au:break;default:throw new Zu(F)}}}var fD=g0,h0=()=>{},er=h0;function ge(u){return{type:xu,contents:u}}function Qu(u,D){return{type:Su,contents:D,n:u}}function cD(u,D={}){return er(D.expandedStates),{type:K,id:D.id,contents:u,break:!!D.shouldBreak,expandedStates:D.expandedStates}}function v0(u){return Qu(Number.NEGATIVE_INFINITY,u)}function m0(u){return Qu({type:"root"},u)}function y0(u){return Qu(-1,u)}function Le(u,D){return cD(u[0],{...D,expandedStates:u})}function Dr(u){return{type:fu,parts:u}}function b0(u,D="",n={}){return{type:cu,breakContents:u,flatContents:D,groupId:n.groupId}}function $0(u,D){return{type:Du,contents:u,groupId:D.groupId,negate:D.negate}}function CD(u){return{type:_u,contents:u}}var w0={type:Ou},Me={type:au},k0={type:Bu},ED={type:eu,hard:!0},rr={type:eu,hard:!0,literal:!0},tr={type:eu},x0={type:eu,soft:!0},hu=[ED,Me],he=[rr,Me],Re={type:Yu};function AD(u,D){let n=[];for(let a=0;a<D.length;a++)a!==0&&n.push(u),n.push(D[a]);return n}function nr(u,D,n){let a=u;if(D>0){for(let o=0;o<Math.floor(D/n);++o)a=ge(a);a=Qu(D%n,a),a=Qu(Number.NEGATIVE_INFINITY,a)}return a}function S0(u,D){return u?{type:Cu,label:u,contents:D}:D}var ar=(u,D,n)=>{if(!(u&&D==null))return Array.isArray(D)||typeof D=="string"?D[n<0?D.length+n:n]:D.at(n)},uu=ar;function ir(u){let D=u.indexOf("\r");return D>=0?u.charAt(D+1)===`
`?"crlf":"cr":"lf"}function pD(u){switch(u){case"cr":return"\r";case"crlf":return`\r
`;default:return`
`}}function sr(u,D){let n;switch(D){case`
`:n=/\n/g;break;case"\r":n=/\r/g;break;case`\r
`:n=/\r\n/g;break;default:throw new Error(`Unexpected "eol" ${JSON.stringify(D)}.`)}let a=u.match(n);return a?a.length:0}function _0(u){return de(!1,u,/\r\n?/g,`
`)}var or=()=>/[#*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\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC3\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC08\uDC26](?:\u200D\u2B1B)?|[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g,O0={eastAsianWidth(u){var D=u.charCodeAt(0),n=u.length==2?u.charCodeAt(1):0,a=D;return 55296<=D&&D<=56319&&56320<=n&&n<=57343&&(D&=1023,n&=1023,a=D<<10|n,a+=65536),a==12288||65281<=a&&a<=65376||65504<=a&&a<=65510?"F":4352<=a&&a<=4447||4515<=a&&a<=4519||4602<=a&&a<=4607||9001<=a&&a<=9002||11904<=a&&a<=11929||11931<=a&&a<=12019||12032<=a&&a<=12245||12272<=a&&a<=12283||12289<=a&&a<=12350||12353<=a&&a<=12438||12441<=a&&a<=12543||12549<=a&&a<=12589||12593<=a&&a<=12686||12688<=a&&a<=12730||12736<=a&&a<=12771||12784<=a&&a<=12830||12832<=a&&a<=12871||12880<=a&&a<=13054||13056<=a&&a<=19903||19968<=a&&a<=42124||42128<=a&&a<=42182||43360<=a&&a<=43388||44032<=a&&a<=55203||55216<=a&&a<=55238||55243<=a&&a<=55291||63744<=a&&a<=64255||65040<=a&&a<=65049||65072<=a&&a<=65106||65108<=a&&a<=65126||65128<=a&&a<=65131||110592<=a&&a<=110593||127488<=a&&a<=127490||127504<=a&&a<=127546||127552<=a&&a<=127560||127568<=a&&a<=127569||131072<=a&&a<=194367||177984<=a&&a<=196605||196608<=a&&a<=262141?"W":"N"}},N0=/[^\x20-\x7F]/;function P0(u){if(!u)return 0;if(!N0.test(u))return u.length;u=u.replace(or()," ");let D=0;for(let n of u){let a=n.codePointAt(0);if(a<=31||a>=127&&a<=159||a>=768&&a<=879)continue;let o=O0.eastAsianWidth(n);D+=o==="F"||o==="W"?2:1}return D}var BD=P0,Fr=u=>{if(Array.isArray(u))return u;if(u.type!==fu)throw new Error(`Expect doc to be 'array' or '${fu}'.`);return u.parts};function We(u,D){if(typeof u=="string")return D(u);let n=new Map;return a(u);function a(F){if(n.has(F))return n.get(F);let f=o(F);return n.set(F,f),f}function o(F){switch(ju(F)){case ku:return D(F.map(a));case fu:return D({...F,parts:F.parts.map(a)});case cu:return D({...F,breakContents:a(F.breakContents),flatContents:a(F.flatContents)});case K:{let{expandedStates:f,contents:E}=F;return f?(f=f.map(a),E=f[0]):E=a(E),D({...F,contents:E,expandedStates:f})}case Su:case xu:case Du:case Cu:case _u:return D({...F,contents:a(F.contents)});case Gu:case Yu:case Bu:case Ou:case eu:case au:return D(F);default:throw new Zu(F)}}}function dD(u,D,n){let a=n,o=!1;function F(f){if(o)return!1;let E=D(f);E!==void 0&&(o=!0,a=E)}return fD(u,F),a}function T0(u){if(u.type===K&&u.break||u.type===eu&&u.hard||u.type===au)return!0}function I0(u){return dD(u,T0,!1)}function lr(u){if(u.length>0){let D=uu(!1,u,-1);!D.expandedStates&&!D.break&&(D.break="propagated")}return null}function j0(u){let D=new Set,n=[];function a(F){if(F.type===au&&lr(n),F.type===K){if(n.push(F),D.has(F))return!1;D.add(F)}}function o(F){F.type===K&&n.pop().break&&lr(n)}fD(u,a,o,!0)}function L0(u){return u.type===eu&&!u.hard?u.soft?"":" ":u.type===cu?u.flatContents:u}function M0(u){return We(u,L0)}function fr(u){for(u=[...u];u.length>=2&&uu(!1,u,-2).type===eu&&uu(!1,u,-1).type===au;)u.length-=2;if(u.length>0){let D=ve(uu(!1,u,-1));u[u.length-1]=D}return u}function ve(u){switch(ju(u)){case Su:case xu:case Du:case K:case _u:case Cu:{let D=ve(u.contents);return{...u,contents:D}}case cu:return{...u,breakContents:ve(u.breakContents),flatContents:ve(u.flatContents)};case fu:return{...u,parts:fr(u.parts)};case ku:return fr(u);case Gu:return u.replace(/[\n\r]*$/,"");case Yu:case Bu:case Ou:case eu:case au:break;default:throw new Zu(u)}return u}function cr(u){return ve(W0(u))}function R0(u){switch(ju(u)){case fu:if(u.parts.every(D=>D===""))return"";break;case K:if(!u.contents&&!u.id&&!u.break&&!u.expandedStates)return"";if(u.contents.type===K&&u.contents.id===u.id&&u.contents.break===u.break&&u.contents.expandedStates===u.expandedStates)return u.contents;break;case Su:case xu:case Du:case _u:if(!u.contents)return"";break;case cu:if(!u.flatContents&&!u.breakContents)return"";break;case ku:{let D=[];for(let n of u){if(!n)continue;let[a,...o]=Array.isArray(n)?n:[n];typeof a=="string"&&typeof uu(!1,D,-1)=="string"?D[D.length-1]+=a:D.push(a),D.push(...o)}return D.length===0?"":D.length===1?D[0]:D}case Gu:case Yu:case Bu:case Ou:case eu:case Cu:case au:break;default:throw new Zu(u)}return u}function W0(u){return We(u,D=>R0(D))}function z0(u,D=he){return We(u,n=>typeof n=="string"?AD(D,n.split(`
`)):n)}function q0(u){if(u.type===eu)return!0}function Cr(u){return dD(u,q0,!1)}function Hu(u,D){return u.type===Cu?{...u,contents:D(u.contents)}:D(u)}var su=Symbol("MODE_BREAK"),vu=Symbol("MODE_FLAT"),me=Symbol("cursor");function mu(){return{value:"",length:0,queue:[]}}function U0(u,D){return gD(u,{type:"indent"},D)}function V0(u,D,n){return D===Number.NEGATIVE_INFINITY?u.root||mu():D<0?gD(u,{type:"dedent"},n):D?D.type==="root"?{...u,root:u}:gD(u,{type:typeof D=="string"?"stringAlign":"numberAlign",n:D},n):u}function gD(u,D,n){let a=D.type==="dedent"?u.queue.slice(0,-1):[...u.queue,D],o="",F=0,f=0,E=0;for(let $ of a)switch($.type){case"indent":m(),n.useTabs?A(1):g(n.tabWidth);break;case"stringAlign":m(),o+=$.n,F+=$.n.length;break;case"numberAlign":f+=1,E+=$.n;break;default:throw new Error(`Unexpected type '${$.type}'`)}return h(),{...u,value:o,length:F,queue:a};function A($){o+=" ".repeat($),F+=n.tabWidth*$}function g($){o+=" ".repeat($),F+=$}function m(){n.useTabs?x():h()}function x(){f>0&&A(f),k()}function h(){E>0&&g(E),k()}function k(){f=0,E=0}}function ze(u){let D=0,n=0,a=u.length;u:for(;a--;){let o=u[a];if(o===me){n++;continue}for(let F=o.length-1;F>=0;F--){let f=o[F];if(f===" "||f===" ")D++;else{u[a]=o.slice(0,F+1);break u}}}if(D>0||n>0)for(u.length=a+1;n-- >0;)u.push(me);return D}function qe(u,D,n,a,o,F){if(n===Number.POSITIVE_INFINITY)return!0;let f=D.length,E=[u],A=[];for(;n>=0;){if(E.length===0){if(f===0)return!0;E.push(D[--f]);continue}let{mode:g,doc:m}=E.pop();switch(ju(m)){case Gu:A.push(m),n-=BD(m);break;case ku:case fu:{let x=Fr(m);for(let h=x.length-1;h>=0;h--)E.push({mode:g,doc:x[h]});break}case xu:case Su:case Du:case Cu:E.push({mode:g,doc:m.contents});break;case Bu:n+=ze(A);break;case K:{if(F&&m.break)return!1;let x=m.break?su:g,h=m.expandedStates&&x===su?uu(!1,m.expandedStates,-1):m.contents;E.push({mode:x,doc:h});break}case cu:{let x=(m.groupId?o[m.groupId]||vu:g)===su?m.breakContents:m.flatContents;x&&E.push({mode:g,doc:x});break}case eu:if(g===su||m.hard)return!0;m.soft||(A.push(" "),n--);break;case _u:a=!0;break;case Ou:if(a)return!1;break}}return!1}function Ju(u,D){let n={},a=D.printWidth,o=pD(D.endOfLine),F=0,f=[{ind:mu(),mode:su,doc:u}],E=[],A=!1,g=[],m=0;for(j0(u);f.length>0;){let{ind:h,mode:k,doc:$}=f.pop();switch(ju($)){case Gu:{let N=o!==`
`?de(!1,$,`
`,o):$;E.push(N),f.length>0&&(F+=BD(N));break}case ku:for(let N=$.length-1;N>=0;N--)f.push({ind:h,mode:k,doc:$[N]});break;case Yu:if(m>=2)throw new Error("There are too many 'cursor' in doc.");E.push(me),m++;break;case xu:f.push({ind:U0(h,D),mode:k,doc:$.contents});break;case Su:f.push({ind:V0(h,$.n,D),mode:k,doc:$.contents});break;case Bu:F-=ze(E);break;case K:switch(k){case vu:if(!A){f.push({ind:h,mode:$.break?su:vu,doc:$.contents});break}case su:{A=!1;let N={ind:h,mode:vu,doc:$.contents},L=a-F,q=g.length>0;if(!$.break&&qe(N,f,L,q,n))f.push(N);else if($.expandedStates){let z=uu(!1,$.expandedStates,-1);if($.break){f.push({ind:h,mode:su,doc:z});break}else for(let V=1;V<$.expandedStates.length+1;V++)if(V>=$.expandedStates.length){f.push({ind:h,mode:su,doc:z});break}else{let Y=$.expandedStates[V],J={ind:h,mode:vu,doc:Y};if(qe(J,f,L,q,n)){f.push(J);break}}}else f.push({ind:h,mode:su,doc:$.contents});break}}$.id&&(n[$.id]=uu(!1,f,-1).mode);break;case fu:{let N=a-F,{parts:L}=$;if(L.length===0)break;let[q,z]=L,V={ind:h,mode:vu,doc:q},Y={ind:h,mode:su,doc:q},J=qe(V,[],N,g.length>0,n,!0);if(L.length===1){J?f.push(V):f.push(Y);break}let Fu={ind:h,mode:vu,doc:z},iu={ind:h,mode:su,doc:z};if(L.length===2){J?f.push(Fu,V):f.push(iu,Y);break}L.splice(0,2);let Au={ind:h,mode:k,doc:Dr(L)},Wu=L[0];qe({ind:h,mode:vu,doc:[q,z,Wu]},[],N,g.length>0,n,!0)?f.push(Au,Fu,V):J?f.push(Au,iu,V):f.push(Au,iu,Y);break}case cu:case Du:{let N=$.groupId?n[$.groupId]:k;if(N===su){let L=$.type===cu?$.breakContents:$.negate?$.contents:ge($.contents);L&&f.push({ind:h,mode:k,doc:L})}if(N===vu){let L=$.type===cu?$.flatContents:$.negate?ge($.contents):$.contents;L&&f.push({ind:h,mode:k,doc:L})}break}case _u:g.push({ind:h,mode:k,doc:$.contents});break;case Ou:g.length>0&&f.push({ind:h,mode:k,doc:ED});break;case eu:switch(k){case vu:if($.hard)A=!0;else{$.soft||(E.push(" "),F+=1);break}case su:if(g.length>0){f.push({ind:h,mode:k,doc:$},...g.reverse()),g.length=0;break}$.literal?h.root?(E.push(o,h.root.value),F=h.root.length):(E.push(o),F=0):(F-=ze(E),E.push(o+h.value),F=h.length);break}break;case Cu:f.push({ind:h,mode:k,doc:$.contents});break;case au:break;default:throw new Zu($)}f.length===0&&g.length>0&&(f.push(...g.reverse()),g.length=0)}let x=E.indexOf(me);if(x!==-1){let h=E.indexOf(me,x+1),k=E.slice(0,x).join(""),$=E.slice(x+1,h).join(""),N=E.slice(h+1).join("");return{formatted:k+$+N,cursorNodeStart:k.length,cursorNodeText:$}}return{formatted:E.join("")}}function du(u){var D;if(!u)return"";if(Array.isArray(u)){let n=[];for(let a of u)if(Array.isArray(a))n.push(...du(a));else{let o=du(a);o!==""&&n.push(o)}return n}return u.type===cu?{...u,breakContents:du(u.breakContents),flatContents:du(u.flatContents)}:u.type===K?{...u,contents:du(u.contents),expandedStates:(D=u.expandedStates)==null?void 0:D.map(du)}:u.type===fu?{type:"fill",parts:u.parts.map(du)}:u.contents?{...u,contents:du(u.contents)}:u}function G0(u){let D=Object.create(null),n=new Set;return a(du(u));function a(F,f,E){var A,g;if(typeof F=="string")return JSON.stringify(F);if(Array.isArray(F)){let m=F.map(a).filter(Boolean);return m.length===1?m[0]:`[${m.join(", ")}]`}if(F.type===eu){let m=((A=E==null?void 0:E[f+1])==null?void 0:A.type)===au;return F.literal?m?"literalline":"literallineWithoutBreakParent":F.hard?m?"hardline":"hardlineWithoutBreakParent":F.soft?"softline":"line"}if(F.type===au)return((g=E==null?void 0:E[f-1])==null?void 0:g.type)===eu&&E[f-1].hard?void 0:"breakParent";if(F.type===Bu)return"trim";if(F.type===xu)return"indent("+a(F.contents)+")";if(F.type===Su)return F.n===Number.NEGATIVE_INFINITY?"dedentToRoot("+a(F.contents)+")":F.n<0?"dedent("+a(F.contents)+")":F.n.type==="root"?"markAsRoot("+a(F.contents)+")":"align("+JSON.stringify(F.n)+", "+a(F.contents)+")";if(F.type===cu)return"ifBreak("+a(F.breakContents)+(F.flatContents?", "+a(F.flatContents):"")+(F.groupId?(F.flatContents?"":', ""')+`, { groupId: ${o(F.groupId)} }`:"")+")";if(F.type===Du){let m=[];F.negate&&m.push("negate: true"),F.groupId&&m.push(`groupId: ${o(F.groupId)}`);let x=m.length>0?`, { ${m.join(", ")} }`:"";return`indentIfBreak(${a(F.contents)}${x})`}if(F.type===K){let m=[];F.break&&F.break!=="propagated"&&m.push("shouldBreak: true"),F.id&&m.push(`id: ${o(F.id)}`);let x=m.length>0?`, { ${m.join(", ")} }`:"";return F.expandedStates?`conditionalGroup([${F.expandedStates.map(h=>a(h)).join(",")}]${x})`:`group(${a(F.contents)}${x})`}if(F.type===fu)return`fill([${F.parts.map(m=>a(m)).join(", ")}])`;if(F.type===_u)return"lineSuffix("+a(F.contents)+")";if(F.type===Ou)return"lineSuffixBoundary";if(F.type===Cu)return`label(${JSON.stringify(F.label)}, ${a(F.contents)})`;throw new Error("Unknown doc type "+F.type)}function o(F){if(typeof F!="symbol")return JSON.stringify(String(F));if(F in D)return D[F];let f=F.description||"symbol";for(let E=0;;E++){let A=f+(E>0?` #${E}`:"");if(!n.has(A))return n.add(A),D[F]=`Symbol.for(${JSON.stringify(A)})`}}}function Y0(u,D,n=0){let a=0;for(let o=n;o<u.length;++o)u[o]===" "?a=a+D-a%D:a++;return a}var hD=Y0,vD=class extends Error{constructor(){super(...arguments);YD(this,"name","ConfigError")}},Er=class extends Error{constructor(){super(...arguments);YD(this,"name","UndefinedParserError")}},H0={cursorOffset:{category:"Special",type:"int",default:-1,range:{start:-1,end:1/0,step:1},description:`Print (to stderr) where a cursor at the given position would move to after formatting.
This option cannot be used with --range-start and --range-end.`,cliCategory:"Editor"},endOfLine:{category:"Global",type:"choice",default:"lf",description:"Which end of line characters to apply.",choices:[{value:"lf",description:"Line Feed only (\\n), common on Linux and macOS as well as inside git repos"},{value:"crlf",description:"Carriage Return + Line Feed characters (\\r\\n), common on Windows"},{value:"cr",description:"Carriage Return character only (\\r), used very rarely"},{value:"auto",description:`Maintain existing
(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:u=>typeof u=="string"||typeof u=="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:"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"}]},plugins:{type:"path",array:!0,default:[{value:[]}],category:"Global",description:"Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",exception:u=>typeof u=="string"||typeof u=="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.
This option cannot be used with --cursor-offset.`,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.
This option cannot be used with --cursor-offset.`,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 Ar({plugins:u=[],showDeprecated:D=!1}={}){let n=u.flatMap(o=>o.languages??[]),a=[];for(let o of K0(Object.assign({},...u.map(({options:F})=>F),H0)))!D&&o.deprecated||(Array.isArray(o.choices)&&(D||(o.choices=o.choices.filter(F=>!F.deprecated)),o.name==="parser"&&(o.choices=[...o.choices,...J0(o.choices,n,u)])),o.pluginDefaults=Object.fromEntries(u.filter(F=>{var f;return((f=F.defaultOptions)==null?void 0:f[o.name])!==void 0}).map(F=>[F.name,F.defaultOptions[o.name]])),a.push(o));return{languages:n,options:a}}function*J0(u,D,n){let a=new Set(u.map(o=>o.value));for(let o of D)if(o.parsers){for(let F of o.parsers)if(!a.has(F)){a.add(F);let f=n.find(A=>A.parsers&&Object.prototype.hasOwnProperty.call(A.parsers,F)),E=o.name;f!=null&&f.name&&(E+=` (plugin: ${f.name})`),yield{value:F,description:E}}}}function K0(u){let D=[];for(let[n,a]of Object.entries(u)){let o={name:n,...a};Array.isArray(o.default)&&(o.default=uu(!1,o.default,-1).value),D.push(o)}return D}var X0=u=>u.split(/[/\\]/).pop();function pr(u,D){if(!D)return;let n=X0(D).toLowerCase();return u.find(a=>{var o,F;return((o=a.extensions)==null?void 0:o.some(f=>n.endsWith(f)))||((F=a.filenames)==null?void 0:F.some(f=>f.toLowerCase()===n))})}function Z0(u,D){if(D)return u.find(({name:n})=>n.toLowerCase()===D)??u.find(({aliases:n})=>n==null?void 0:n.includes(D))??u.find(({extensions:n})=>n==null?void 0:n.includes(`.${D}`))}function Br(u,D){let n=u.plugins.flatMap(o=>o.languages??[]),a=Z0(n,D.language)??pr(n,D.physicalFile)??pr(n,D.file)??(D.physicalFile,void 0);return a==null?void 0:a.parsers[0]}var dr=Br,ue={key:u=>/^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(u)?u:JSON.stringify(u),value(u){if(u===null||typeof u!="object")return JSON.stringify(u);if(Array.isArray(u))return`[${u.map(n=>ue.value(n)).join(", ")}]`;let D=Object.keys(u);return D.length===0?"{}":`{ ${D.map(n=>`${ue.key(n)}: ${ue.value(u[n])}`).join(", ")} }`},pair:({key:u,value:D})=>ue.value({[u]:D})},gr=M(nu(),1),Q0=(u,D,{descriptor:n})=>{let a=[`${gr.default.yellow(typeof u=="string"?n.key(u):n.pair(u))} is deprecated`];return D&&a.push(`we now treat it as ${gr.default.blue(typeof D=="string"?n.key(D):n.pair(D))}`),a.join("; ")+"."},ee=M(nu(),1),ye=Symbol.for("vnopts.VALUE_NOT_EXIST"),Ue=Symbol.for("vnopts.VALUE_UNCHANGED"),hr=" ".repeat(2),ut=(u,D,n)=>{let{text:a,list:o}=n.normalizeExpectedResult(n.schemas[u].expected(n)),F=[];return a&&F.push(vr(u,D,a,n.descriptor)),o&&F.push([vr(u,D,o.title,n.descriptor)].concat(o.values.map(f=>mr(f,n.loggerPrintWidth))).join(`
`)),yr(F,n.loggerPrintWidth)};function vr(u,D,n,a){return[`Invalid ${ee.default.red(a.key(u))} value.`,`Expected ${ee.default.blue(n)},`,`but received ${D===ye?ee.default.gray("nothing"):ee.default.red(a.value(D))}.`].join(" ")}function mr({text:u,list:D},n){let a=[];return u&&a.push(`- ${ee.default.blue(u)}`),D&&a.push([`- ${ee.default.blue(D.title)}:`].concat(D.values.map(o=>mr(o,n-hr.length).replace(/^|\n/g,`$&${hr}`))).join(`
`)),yr(a,n)}function yr(u,D){if(u.length===1)return u[0];let[n,a]=u,[o,F]=u.map(f=>f.split(`
`,1)[0].length);return o>D&&o>F?a:n}var br=M(nu(),1),mD=[],$r=[];function et(u,D){if(u===D)return 0;let n=u;u.length>D.length&&(u=D,D=n);let a=u.length,o=D.length;for(;a>0&&u.charCodeAt(~-a)===D.charCodeAt(~-o);)a--,o--;let F=0;for(;F<a&&u.charCodeAt(F)===D.charCodeAt(F);)F++;if(a-=F,o-=F,a===0)return o;let f,E,A,g,m=0,x=0;for(;m<a;)$r[m]=u.charCodeAt(F+m),mD[m]=++m;for(;x<o;)for(f=D.charCodeAt(F+x),A=x++,E=x,m=0;m<a;m++)g=f===$r[m]?A:A+1,A=mD[m],E=mD[m]=A>E?g>E?E+1:g:g>A?A+1:g;return E}var wr=(u,D,{descriptor:n,logger:a,schemas:o})=>{let F=[`Ignored unknown option ${br.default.yellow(n.pair({key:u,value:D}))}.`],f=Object.keys(o).sort().find(E=>et(u,E)<3);f&&F.push(`Did you mean ${br.default.blue(n.key(f))}?`),a.warn(F.join(" "))},kr=["default","expected","validate","deprecated","forward","redirect","overlap","preprocess","postprocess"];function Dt(u,D){let n=new u(D),a=Object.create(n);for(let o of kr)o in D&&(a[o]=xr(D[o],n,Lu.prototype[o].length));return a}var Lu=class{static create(u){return Dt(this,u)}constructor(u){this.name=u.name}default(u){}expected(u){return"nothing"}validate(u,D){return!1}deprecated(u,D){return!1}forward(u,D){}redirect(u,D){}overlap(u,D,n){return u}preprocess(u,D){return u}postprocess(u,D){return Ue}};function xr(u,D,n){return typeof u=="function"?(...a)=>u(...a.slice(0,n-1),D,...a.slice(n-1)):()=>u}var rt=class extends Lu{constructor(u){super(u),this._sourceName=u.sourceName}expected(u){return u.schemas[this._sourceName].expected(u)}validate(u,D){return D.schemas[this._sourceName].validate(u,D)}redirect(u,D){return this._sourceName}},tt=class extends Lu{expected(){return"anything"}validate(){return!0}},nt=class extends Lu{constructor({valueSchema:u,name:D=u.name,...n}){super({...n,name:D}),this._valueSchema=u}expected(u){let{text:D,list:n}=u.normalizeExpectedResult(this._valueSchema.expected(u));return{text:D&&`an array of ${D}`,list:n&&{title:"an array of the following values",values:[{list:n}]}}}validate(u,D){if(!Array.isArray(u))return!1;let n=[];for(let a of u){let o=D.normalizeValidateResult(this._valueSchema.validate(a,D),a);o!==!0&&n.push(o.value)}return n.length===0?!0:{value:n}}deprecated(u,D){let n=[];for(let a of u){let o=D.normalizeDeprecatedResult(this._valueSchema.deprecated(a,D),a);o!==!1&&n.push(...o.map(({value:F})=>({value:[F]})))}return n}forward(u,D){let n=[];for(let a of u){let o=D.normalizeForwardResult(this._valueSchema.forward(a,D),a);n.push(...o.map(Sr))}return n}redirect(u,D){let n=[],a=[];for(let o of u){let F=D.normalizeRedirectResult(this._valueSchema.redirect(o,D),o);"remain"in F&&n.push(F.remain),a.push(...F.redirect.map(Sr))}return n.length===0?{redirect:a}:{redirect:a,remain:n}}overlap(u,D){return u.concat(D)}};function Sr({from:u,to:D}){return{from:[u],to:D}}var at=class extends Lu{expected(){return"true or false"}validate(u){return typeof u=="boolean"}};function it(u,D){let n=Object.create(null);for(let a of u){let o=a[D];if(n[o])throw new Error(`Duplicate ${D} ${JSON.stringify(o)}`);n[o]=a}return n}function st(u,D){let n=new Map;for(let a of u){let o=a[D];if(n.has(o))throw new Error(`Duplicate ${D} ${JSON.stringify(o)}`);n.set(o,a)}return n}function ot(){let u=Object.create(null);return D=>{let n=JSON.stringify(D);return u[n]?!0:(u[n]=!0,!1)}}function Ft(u,D){let n=[],a=[];for(let o of u)D(o)?n.push(o):a.push(o);return[n,a]}function _r(u){return u===Math.floor(u)}function Or(u,D){if(u===D)return 0;let n=typeof u,a=typeof D,o=["undefined","object","boolean","number","string"];return n!==a?o.indexOf(n)-o.indexOf(a):n!=="string"?Number(u)-Number(D):u.localeCompare(D)}function lt(u){return(...D)=>{let n=u(...D);return typeof n=="string"?new Error(n):n}}function Nr(u){return u===void 0?{}:u}function Pr(u){if(typeof u=="string")return{text:u};let{text:D,list:n}=u;return ft((D||n)!==void 0,"Unexpected `expected` result, there should be at least one field."),n?{text:D,list:{title:n.title,values:n.values.map(Pr)}}:{text:D}}function yD(u,D){return u===!0?!0:u===!1?{value:D}:u}function Tr(u,D,n=!1){return u===!1?!1:u===!0?n?!0:[{value:D}]:"value"in u?[u]:u.length===0?!1:u}function Ir(u,D){return typeof u=="string"||"key"in u?{from:D,to:u}:"from"in u?{from:u.from,to:u.to}:{from:D,to:u.to}}function bD(u,D){return u===void 0?[]:Array.isArray(u)?u.map(n=>Ir(n,D)):[Ir(u,D)]}function jr(u,D){let n=bD(typeof u=="object"&&"redirect"in u?u.redirect:u,D);return n.length===0?{remain:D,redirect:n}:typeof u=="object"&&"remain"in u?{remain:u.remain,redirect:n}:{redirect:n}}function ft(u,D){if(!u)throw new Error(D)}var ct=class extends Lu{constructor(u){super(u),this._choices=st(u.choices.map(D=>D&&typeof D=="object"?D:{value:D}),"value")}expected({descriptor:u}){let D=Array.from(this._choices.keys()).map(o=>this._choices.get(o)).filter(({hidden:o})=>!o).map(o=>o.value).sort(Or).map(u.value),n=D.slice(0,-2),a=D.slice(-2);return{text:n.concat(a.join(" or ")).join(", "),list:{title:"one of the following values",values:D}}}validate(u){return this._choices.has(u)}deprecated(u){let D=this._choices.get(u);return D&&D.deprecated?{value:u}:!1}forward(u){let D=this._choices.get(u);return D?D.forward:void 0}redirect(u){let D=this._choices.get(u);return D?D.redirect:void 0}},Ct=class extends Lu{expected(){return"a number"}validate(u,D){return typeof u=="number"}},Et=class extends Ct{expected(){return"an integer"}validate(u,D){return D.normalizeValidateResult(super.validate(u,D),u)===!0&&_r(u)}},Lr=class extends Lu{expected(){return"a string"}validate(u){return typeof u=="string"}},At=ue,pt=wr,Bt=ut,dt=Q0,gt=class{constructor(u,D){let{logger:n=console,loggerPrintWidth:a=80,descriptor:o=At,unknown:F=pt,invalid:f=Bt,deprecated:E=dt,missing:A=()=>!1,required:g=()=>!1,preprocess:m=h=>h,postprocess:x=()=>Ue}=D||{};this._utils={descriptor:o,logger:n||{warn:()=>{}},loggerPrintWidth:a,schemas:it(u,"name"),normalizeDefaultResult:Nr,normalizeExpectedResult:Pr,normalizeDeprecatedResult:Tr,normalizeForwardResult:bD,normalizeRedirectResult:jr,normalizeValidateResult:yD},this._unknownHandler=F,this._invalidHandler=lt(f),this._deprecatedHandler=E,this._identifyMissing=(h,k)=>!(h in k)||A(h,k),this._identifyRequired=g,this._preprocess=m,this._postprocess=x,this.cleanHistory()}cleanHistory(){this._hasDeprecationWarned=ot()}normalize(u){let D={},n=[this._preprocess(u,this._utils)],a=()=>{for(;n.length!==0;){let o=n.shift(),F=this._applyNormalization(o,D);n.push(...F)}};a();for(let o of Object.keys(this._utils.schemas)){let F=this._utils.schemas[o];if(!(o in D)){let f=Nr(F.default(this._utils));"value"in f&&n.push({[o]:f.value})}}a();for(let o of Object.keys(this._utils.schemas)){if(!(o in D))continue;let F=this._utils.schemas[o],f=D[o],E=F.postprocess(f,this._utils);E!==Ue&&(this._applyValidation(E,o,F),D[o]=E)}return this._applyPostprocess(D),this._applyRequiredCheck(D),D}_applyNormalization(u,D){let n=[],{knownKeys:a,unknownKeys:o}=this._partitionOptionKeys(u);for(let F of a){let f=this._utils.schemas[F],E=f.preprocess(u[F],this._utils);this._applyValidation(E,F,f);let A=({from:x,to:h})=>{n.push(typeof h=="string"?{[h]:x}:{[h.key]:h.value})},g=({value:x,redirectTo:h})=>{let k=Tr(f.deprecated(x,this._utils),E,!0);if(k!==!1)if(k===!0)this._hasDeprecationWarned(F)||this._utils.logger.warn(this._deprecatedHandler(F,h,this._utils));else for(let{value:$}of k){let N={key:F,value:$};if(!this._hasDeprecationWarned(N)){let L=typeof h=="string"?{key:h,value:$}:h;this._utils.logger.warn(this._deprecatedHandler(N,L,this._utils))}}};bD(f.forward(E,this._utils),E).forEach(A);let m=jr(f.redirect(E,this._utils),E);if(m.redirect.forEach(A),"remain"in m){let x=m.remain;D[F]=F in D?f.overlap(D[F],x,this._utils):x,g({value:x})}for(let{from:x,to:h}of m.redirect)g({value:x,redirectTo:h})}for(let F of o){let f=u[F];this._applyUnknownHandler(F,f,D,(E,A)=>{n.push({[E]:A})})}return n}_applyRequiredCheck(u){for(let D of Object.keys(this._utils.schemas))if(this._identifyMissing(D,u)&&this._identifyRequired(D))throw this._invalidHandler(D,ye,this._utils)}_partitionOptionKeys(u){let[D,n]=Ft(Object.keys(u).filter(a=>!this._identifyMissing(a,u)),a=>a in this._utils.schemas);return{knownKeys:D,unknownKeys:n}}_applyValidation(u,D,n){let a=yD(n.validate(u,this._utils),u);if(a!==!0)throw this._invalidHandler(D,a.value,this._utils)}_applyUnknownHandler(u,D,n,a){let o=this._unknownHandler(u,D,this._utils);if(o)for(let F of Object.keys(o)){if(this._identifyMissing(F,o))continue;let f=o[F];F in this._utils.schemas?a(F,f):n[F]=f}}_applyPostprocess(u){let D=this._postprocess(u,this._utils);if(D!==Ue){if(D.delete)for(let n of D.delete)delete u[n];if(D.override){let{knownKeys:n,unknownKeys:a}=this._partitionOptionKeys(D.override);for(let o of n){let F=D.override[o];this._applyValidation(F,o,this._utils.schemas[o]),u[o]=F}for(let o of a){let F=D.override[o];this._applyUnknownHandler(o,F,u,(f,E)=>{let A=this._utils.schemas[f];this._applyValidation(E,f,A),u[f]=E})}}}}},$D;function ht(u,D,{logger:n=!1,isCLI:a=!1,passThrough:o=!1,FlagSchema:F,descriptor:f}={}){if(a){if(!F)throw new Error("'FlagSchema' option is required.");if(!f)throw new Error("'descriptor' option is required.")}else f=ue;let E=o?Array.isArray(o)?(h,k)=>o.includes(h)?{[h]:k}:void 0:(h,k)=>({[h]:k}):(h,k,$)=>{let{_:N,...L}=$.schemas;return wr(h,k,{...$,schemas:L})},A=vt(D,{isCLI:a,FlagSchema:F}),g=new gt(A,{logger:n,unknown:E,descriptor:f}),m=n!==!1;m&&$D&&(g._hasDeprecationWarned=$D);let x=g.normalize(u);return m&&($D=g._hasDeprecationWarned),x}function vt(u,{isCLI:D,FlagSchema:n}){let a=[];D&&a.push(tt.create({name:"_"}));for(let o of u)a.push(mt(o,{isCLI:D,optionInfos:u,FlagSchema:n})),o.alias&&D&&a.push(rt.create({name:o.alias,sourceName:o.name}));return a}function mt(u,{isCLI:D,optionInfos:n,FlagSchema:a}){let{name:o}=u,F={name:o},f,E={};switch(u.type){case"int":f=Et,D&&(F.preprocess=Number);break;case"string":f=Lr;break;case"choice":f=ct,F.choices=u.choices.map(A=>A!=null&&A.redirect?{...A,redirect:{to:{key:u.name,value:A.redirect}}}:A);break;case"boolean":f=at;brea