UNPKG

svgfusion

Version:

Convert SVG files into blazing-fast React and Vue 3 components with automatic color extraction, full TypeScript support, and seamless integration into any modern workflow.

30 lines 118 kB
import {toReactProp,camelCase}from'svgfusion-utils';export{formatComponentName,pascalCase,sanitizeComponentName,svgToComponentName}from'svgfusion-utils';import {ComponentGenerator}from'svgfusion-core';var mt=Object.defineProperty;var Lr=(e,t,r)=>t in e?mt(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r;var H=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Mr=(e,t)=>()=>(e&&(t=e(e=0)),t);var Vr=(e,t)=>{for(var r in t)mt(e,r,{get:t[r],enumerable:true});};var Fe=(e,t,r)=>Lr(e,t+"",r);var ft={};Vr(ft,{__debug:()=>Ir,check:()=>Pr,default:()=>Ds,doc:()=>st,format:()=>dt,formatWithCursor:()=>ct,getSupportInfo:()=>Tr,util:()=>ot,version:()=>Or});function uu(e,t,r){return ru.diff(e,t,r)}function nu(e){let t=e.indexOf("\r");return t!==-1?e.charAt(t+1)===` `?"crlf":"cr":"lf"}function Ke(e){switch(e){case "cr":return "\r";case "crlf":return `\r `;default:return ` `}}function Kt(e,t){let r;switch(t){case ` `:r=/\n/gu;break;case "\r":r=/\r/gu;break;case `\r `:r=/\r\n/gu;break;default:throw new Error(`Unexpected "eol" ${JSON.stringify(t)}.`)}let u=e.match(r);return u?u.length:0}function iu(e){return we(false,e,/\r\n?/gu,` `)}function ou(e){let t=e.length;for(;t>0&&(e[t-1]==="\r"||e[t-1]===` `);)t--;return t<e.length?e.slice(0,t):e}function au(e){if(typeof e=="string")return ee;if(Array.isArray(e))return j;if(!e)return;let{type:t}=e;if(Xt.has(t))return t}function Du(e){let t=e===null?"null":typeof e;if(t!=="string"&&t!=="object")return `Unexpected doc '${t}', Expected it to be 'string' or 'object'.`;if(te(e))throw new Error("doc is valid.");let r=Object.prototype.toString.call(e);if(r!=="[object Object]")return `Unexpected doc '${r}'.`;let u=lu([...Xt].map(n=>`'${n}'`));return `Unexpected doc.type '${e.type}'. Expected it to be ${u}.`}function cu(e,t,r,u){let n=[e];for(;n.length>0;){let i=n.pop();if(i===Ft){r(n.pop());continue}r&&n.push(i,Ft);let s=te(i);if(!s)throw new ie(i);if(t?.(i)!==false)switch(s){case j:case P:{let o=s===j?i:i.parts;for(let a=o.length,l=a-1;l>=0;--l)n.push(o[l]);break}case x:n.push(i.flatContents,i.breakContents);break;case S:if(u&&i.expandedStates)for(let o=i.expandedStates.length,a=o-1;a>=0;--a)n.push(i.expandedStates[a]);else n.push(i.contents);break;case _:case W:case M:case T:case V:n.push(i.contents);break;case ee:case q:case L:case R:case w:case B:break;default:throw new ie(i)}}}function ke(e,t){if(typeof e=="string")return t(e);let r=new Map;return u(e);function u(i){if(r.has(i))return r.get(i);let s=n(i);return r.set(i,s),s}function n(i){switch(te(i)){case j:return t(i.map(u));case P:return t({...i,parts:i.parts.map(u)});case x:return t({...i,breakContents:u(i.breakContents),flatContents:u(i.flatContents)});case S:{let{expandedStates:s,contents:o}=i;return s?(s=s.map(u),o=s[0]):o=u(o),t({...i,contents:o,expandedStates:s})}case _:case W:case M:case T:case V:return t({...i,contents:u(i.contents)});case ee:case q:case L:case R:case w:case B:return t(i);default:throw new ie(i)}}}function Ye(e,t,r){let u=r,n=false;function i(s){if(n)return false;let o=t(s);o!==void 0&&(n=true,u=o);}return Xe(e,i),u}function du(e){if(e.type===S&&e.break||e.type===w&&e.hard||e.type===B)return true}function fu(e){return Ye(e,du,false)}function gt(e){if(e.length>0){let t=b(false,e,-1);!t.expandedStates&&!t.break&&(t.break="propagated");}return null}function hu(e){let t=new Set,r=[];function u(i){if(i.type===B&&gt(r),i.type===S){if(r.push(i),t.has(i))return false;t.add(i);}}function n(i){i.type===S&&r.pop().break&&gt(r);}Xe(e,u,n,true);}function mu(e){return e.type===w&&!e.hard?e.soft?"":" ":e.type===x?e.flatContents:e}function Fu(e){return ke(e,mu)}function Ct(e){for(e=[...e];e.length>=2&&b(false,e,-2).type===w&&b(false,e,-1).type===B;)e.length-=2;if(e.length>0){let t=pe(b(false,e,-1));e[e.length-1]=t;}return e}function pe(e){switch(te(e)){case W:case M:case S:case V:case T:{let t=pe(e.contents);return {...e,contents:t}}case x:return {...e,breakContents:pe(e.breakContents),flatContents:pe(e.flatContents)};case P:return {...e,parts:Ct(e.parts)};case j:return Ct(e);case ee:return ou(e);case _:case q:case L:case R:case w:case B:break;default:throw new ie(e)}return e}function Yt(e){return pe(Cu(e))}function gu(e){switch(te(e)){case P:if(e.parts.every(t=>t===""))return "";break;case S:if(!e.contents&&!e.id&&!e.break&&!e.expandedStates)return "";if(e.contents.type===S&&e.contents.id===e.id&&e.contents.break===e.break&&e.contents.expandedStates===e.expandedStates)return e.contents;break;case _:case W:case M:case V:if(!e.contents)return "";break;case x:if(!e.flatContents&&!e.breakContents)return "";break;case j:{let t=[];for(let r of e){if(!r)continue;let[u,...n]=Array.isArray(r)?r:[r];typeof u=="string"&&typeof b(false,t,-1)=="string"?t[t.length-1]+=u:t.push(u),t.push(...n);}return t.length===0?"":t.length===1?t[0]:t}case ee:case q:case L:case R:case w:case T:case B:break;default:throw new ie(e)}return e}function Cu(e){return ke(e,t=>gu(t))}function Eu(e,t=rr){return ke(e,r=>typeof r=="string"?ur(t,r.split(` `)):r)}function yu(e){if(e.type===w)return true}function vu(e){return Ye(e,yu,false)}function Ee(e,t){return e.type===T?{...e,contents:t(e.contents)}:t(e)}function be(e){return O(e),{type:W,contents:e}}function se(e,t){return O(t),{type:_,contents:t,n:e}}function Qt(e,t={}){return O(e),Zt(t.expandedStates,true),{type:S,id:t.id,contents:e,break:!!t.shouldBreak,expandedStates:t.expandedStates}}function wu(e){return se(Number.NEGATIVE_INFINITY,e)}function ku(e){return se({type:"root"},e)}function Su(e){return se(-1,e)}function xu(e,t){return Qt(e[0],{...t,expandedStates:e})}function Bu(e){return bu(e),{type:P,parts:e}}function Au(e,t="",r={}){return O(e),t!==""&&O(t),{type:x,breakContents:e,flatContents:t,groupId:r.groupId}}function $u(e,t){return O(e),{type:M,contents:e,groupId:t.groupId,negate:t.negate}}function Le(e){return O(e),{type:V,contents:e}}function ur(e,t){O(e),Zt(t);let r=[];for(let u=0;u<t.length;u++)u!==0&&r.push(e),r.push(t[u]);return r}function nr(e,t,r){O(e);let u=e;if(t>0){for(let n=0;n<Math.floor(t/r);++n)u=be(u);u=se(t%r,u),u=se(Number.NEGATIVE_INFINITY,u);}return u}function Tu(e,t){return O(t),e?{type:T,label:e,contents:t}:t}function I(e){var t;if(!e)return "";if(Array.isArray(e)){let r=[];for(let u of e)if(Array.isArray(u))r.push(...I(u));else {let n=I(u);n!==""&&r.push(n);}return r}return e.type===x?{...e,breakContents:I(e.breakContents),flatContents:I(e.flatContents)}:e.type===S?{...e,contents:I(e.contents),expandedStates:(t=e.expandedStates)==null?void 0:t.map(I)}:e.type===P?{type:"fill",parts:e.parts.map(I)}:e.contents?{...e,contents:I(e.contents)}:e}function Iu(e){let t=Object.create(null),r=new Set;return u(I(e));function u(i,s,o){var a,l;if(typeof i=="string")return JSON.stringify(i);if(Array.isArray(i)){let p=i.map(u).filter(Boolean);return p.length===1?p[0]:`[${p.join(", ")}]`}if(i.type===w){let p=((a=o?.[s+1])==null?void 0:a.type)===B;return i.literal?p?"literalline":"literallineWithoutBreakParent":i.hard?p?"hardline":"hardlineWithoutBreakParent":i.soft?"softline":"line"}if(i.type===B)return ((l=o?.[s-1])==null?void 0:l.type)===w&&o[s-1].hard?void 0:"breakParent";if(i.type===L)return "trim";if(i.type===W)return "indent("+u(i.contents)+")";if(i.type===_)return i.n===Number.NEGATIVE_INFINITY?"dedentToRoot("+u(i.contents)+")":i.n<0?"dedent("+u(i.contents)+")":i.n.type==="root"?"markAsRoot("+u(i.contents)+")":"align("+JSON.stringify(i.n)+", "+u(i.contents)+")";if(i.type===x)return "ifBreak("+u(i.breakContents)+(i.flatContents?", "+u(i.flatContents):"")+(i.groupId?(i.flatContents?"":', ""')+`, { groupId: ${n(i.groupId)} }`:"")+")";if(i.type===M){let p=[];i.negate&&p.push("negate: true"),i.groupId&&p.push(`groupId: ${n(i.groupId)}`);let f=p.length>0?`, { ${p.join(", ")} }`:"";return `indentIfBreak(${u(i.contents)}${f})`}if(i.type===S){let p=[];i.break&&i.break!=="propagated"&&p.push("shouldBreak: true"),i.id&&p.push(`id: ${n(i.id)}`);let f=p.length>0?`, { ${p.join(", ")} }`:"";return i.expandedStates?`conditionalGroup([${i.expandedStates.map(D=>u(D)).join(",")}]${f})`:`group(${u(i.contents)}${f})`}if(i.type===P)return `fill([${i.parts.map(p=>u(p)).join(", ")}])`;if(i.type===V)return "lineSuffix("+u(i.contents)+")";if(i.type===R)return "lineSuffixBoundary";if(i.type===T)return `label(${JSON.stringify(i.label)}, ${u(i.contents)})`;if(i.type===q)return "cursor";throw new Error("Unknown doc type "+i.type)}function n(i){if(typeof i!="symbol")return JSON.stringify(String(i));if(i in t)return t[i];let s=i.description||"symbol";for(let o=0;;o++){let a=s+(o>0?` #${o}`:"");if(!r.has(a))return r.add(a),t[i]=`Symbol.for(${JSON.stringify(a)})`}}}function Wu(e){return e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510}function _u(e){return e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9776&&e<=9783||e>=9800&&e<=9811||e===9855||e>=9866&&e<=9871||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12773||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e===94192||e===94193||e>=94208&&e<=100343||e>=100352&&e<=101589||e>=101631&&e<=101640||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e>=119552&&e<=119638||e>=119648&&e<=119670||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128727||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129673||e>=129679&&e<=129734||e>=129742&&e<=129756||e>=129759&&e<=129769||e>=129776&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141}function Vu(e){if(!e)return 0;if(!Mu.test(e))return e.length;e=e.replace(ju()," ");let t=0;for(let r of e){let u=r.codePointAt(0);u<=31||u>=127&&u<=159||u>=768&&u<=879||(t+=Lu(u)?1:2);}return t}function ir(){return {value:"",length:0,queue:[]}}function Ru(e,t){return Ve(e,{type:"indent"},t)}function zu(e,t,r){return t===Number.NEGATIVE_INFINITY?e.root||ir():t<0?Ve(e,{type:"dedent"},r):t?t.type==="root"?{...e,root:e}:Ve(e,{type:typeof t=="string"?"stringAlign":"numberAlign",n:t},r):e}function Ve(e,t,r){let u=t.type==="dedent"?e.queue.slice(0,-1):[...e.queue,t],n="",i=0,s=0,o=0;for(let c of u)switch(c.type){case "indent":p(),r.useTabs?a(1):l(r.tabWidth);break;case "stringAlign":p(),n+=c.n,i+=c.n.length;break;case "numberAlign":s+=1,o+=c.n;break;default:throw new Error(`Unexpected type '${c.type}'`)}return D(),{...e,value:n,length:i,queue:u};function a(c){n+=" ".repeat(c),i+=r.tabWidth*c;}function l(c){n+=" ".repeat(c),i+=c;}function p(){r.useTabs?f():D();}function f(){s>0&&a(s),d();}function D(){o>0&&l(o),d();}function d(){s=0,o=0;}}function Re(e){let t=0,r=0,u=e.length;e:for(;u--;){let n=e[u];if(n===ue){r++;continue}for(let i=n.length-1;i>=0;i--){let s=n[i];if(s===" "||s===" ")t++;else {e[u]=n.slice(0,i+1);break e}}}if(t>0||r>0)for(e.length=u+1;r-- >0;)e.push(ue);return t}function ge(e,t,r,u,n,i){if(r===Number.POSITIVE_INFINITY)return true;let s=t.length,o=[e],a=[];for(;r>=0;){if(o.length===0){if(s===0)return true;o.push(t[--s]);continue}let{mode:l,doc:p}=o.pop(),f=te(p);switch(f){case ee:a.push(p),r-=et(p);break;case j:case P:{let D=f===j?p:p.parts,d=p[Me]??0;for(let c=D.length-1;c>=d;c--)o.push({mode:l,doc:D[c]});break}case W:case _:case M:case T:o.push({mode:l,doc:p.contents});break;case L:r+=Re(a);break;case S:{if(i&&p.break)return false;let D=p.break?k:l,d=p.expandedStates&&D===k?b(false,p.expandedStates,-1):p.contents;o.push({mode:D,doc:d});break}case x:{let D=(p.groupId?n[p.groupId]||$:l)===k?p.breakContents:p.flatContents;D&&o.push({mode:l,doc:D});break}case w:if(l===k||p.hard)return true;p.soft||(a.push(" "),r--);break;case V:u=true;break;case R:if(u)return false;break}}return false}function xe(e,t){let r={},u=t.printWidth,n=Ke(t.endOfLine),i=0,s=[{ind:ir(),mode:k,doc:e}],o=[],a=false,l=[],p=0;for(hu(e);s.length>0;){let{ind:D,mode:d,doc:c}=s.pop();switch(te(c)){case ee:{let h=n!==` `?we(false,c,` `,n):c;o.push(h),s.length>0&&(i+=et(h));break}case j:for(let h=c.length-1;h>=0;h--)s.push({ind:D,mode:d,doc:c[h]});break;case q:if(p>=2)throw new Error("There are too many 'cursor' in doc.");o.push(ue),p++;break;case W:s.push({ind:Ru(D,t),mode:d,doc:c.contents});break;case _:s.push({ind:zu(D,c.n,t),mode:d,doc:c.contents});break;case L:i-=Re(o);break;case S:switch(d){case $:if(!a){s.push({ind:D,mode:c.break?k:$,doc:c.contents});break}case k:{a=false;let h={ind:D,mode:$,doc:c.contents},m=u-i,F=l.length>0;if(!c.break&&ge(h,s,m,F,r))s.push(h);else if(c.expandedStates){let C=b(false,c.expandedStates,-1);if(c.break){s.push({ind:D,mode:k,doc:C});break}else for(let E=1;E<c.expandedStates.length+1;E++)if(E>=c.expandedStates.length){s.push({ind:D,mode:k,doc:C});break}else {let y=c.expandedStates[E],g={ind:D,mode:$,doc:y};if(ge(g,s,m,F,r)){s.push(g);break}}}else s.push({ind:D,mode:k,doc:c.contents});break}}c.id&&(r[c.id]=b(false,s,-1).mode);break;case P:{let h=u-i,m=c[Me]??0,{parts:F}=c,C=F.length-m;if(C===0)break;let E=F[m+0],y=F[m+1],g={ind:D,mode:$,doc:E},v={ind:D,mode:k,doc:E},A=ge(g,[],h,l.length>0,r,true);if(C===1){A?s.push(g):s.push(v);break}let re={ind:D,mode:$,doc:y},Ne={ind:D,mode:k,doc:y};if(C===2){A?s.push(re,g):s.push(Ne,v);break}let _r=F[m+2],Oe={ind:D,mode:d,doc:{...c,[Me]:m+2}};ge({ind:D,mode:$,doc:[E,y,_r]},[],h,l.length>0,r,true)?s.push(Oe,re,g):A?s.push(Oe,Ne,g):s.push(Oe,Ne,v);break}case x:case M:{let h=c.groupId?r[c.groupId]:d;if(h===k){let m=c.type===x?c.breakContents:c.negate?c.contents:be(c.contents);m&&s.push({ind:D,mode:d,doc:m});}if(h===$){let m=c.type===x?c.flatContents:c.negate?be(c.contents):c.contents;m&&s.push({ind:D,mode:d,doc:m});}break}case V:l.push({ind:D,mode:d,doc:c.contents});break;case R:l.length>0&&s.push({ind:D,mode:d,doc:Qe});break;case w:switch(d){case $:if(c.hard)a=true;else {c.soft||(o.push(" "),i+=1);break}case k:if(l.length>0){s.push({ind:D,mode:d,doc:c},...l.reverse()),l.length=0;break}c.literal?D.root?(o.push(n,D.root.value),i=D.root.length):(o.push(n),i=0):(i-=Re(o),o.push(n+D.value),i=D.length);break}break;case T:s.push({ind:D,mode:d,doc:c.contents});break;case B:break;default:throw new ie(c)}s.length===0&&l.length>0&&(s.push(...l.reverse()),l.length=0);}let f=o.indexOf(ue);if(f!==-1){let D=o.indexOf(ue,f+1);if(D===-1)return {formatted:o.filter(m=>m!==ue).join("")};let d=o.slice(0,f).join(""),c=o.slice(f+1,D).join(""),h=o.slice(D+1).join("");return {formatted:d+c+h,cursorNodeStart:d.length,cursorNodeText:c}}return {formatted:o.join("")}}function Gu(e,t,r=0){let u=0;for(let n=r;n<e.length;++n)e[n]===" "?u=u+t-u%t:u++;return u}function Hu(e){return e!==null&&typeof e=="object"}function*Be(e,t){let{getVisitorKeys:r,filter:u=()=>true}=t,n=i=>Uu(i)&&u(i);for(let i of r(e)){let s=e[i];if(Array.isArray(s))for(let o of s)n(o)&&(yield o);else n(s)&&(yield s);}}function*Ku(e,t){let r=[e];for(let u=0;u<r.length;u++){let n=r[u];for(let i of Be(n,t))yield i,r.push(i);}}function Xu(e,t){return Be(e,t).next().done}function fe(e){return (t,r,u)=>{let n=!!(u!=null&&u.backwards);if(r===false)return false;let{length:i}=t,s=r;for(;s>=0&&s<i;){let o=t.charAt(s);if(e instanceof RegExp){if(!e.test(o))return s}else if(!e.includes(o))return s;n?s--:s++;}return s===-1||s===i?s:false}}function Zu(e,t,r){let u=!!(r!=null&&r.backwards);if(t===false)return false;let n=e.charAt(t);if(u){if(e.charAt(t-1)==="\r"&&n===` `)return t-2;if(n===` `||n==="\r"||n==="\u2028"||n==="\u2029")return t-1}else {if(n==="\r"&&e.charAt(t+1)===` `)return t+2;if(n===` `||n==="\r"||n==="\u2028"||n==="\u2029")return t+1}return t}function Qu(e,t,r={}){let u=G(e,r.backwards?t-1:t,r),n=Q(e,u,r);return u!==n}function en(e){return Array.isArray(e)&&e.length>0}function un(e){return e?t=>e(t,lr):rn}function nn(e){let t=e.type||e.kind||"(unknown type)",r=String(e.name||e.id&&(typeof e.id=="object"?e.id.name:e.id)||e.key&&(typeof e.key=="object"?e.key.name:e.key)||e.value&&(typeof e.value=="object"?"":String(e.value))||e.operator||"");return r.length>20&&(r=r.slice(0,19)+"\u2026"),t+(r?" "+r:"")}function rt(e,t){(e.comments??(e.comments=[])).push(t),t.printed=false,t.nodeDescription=nn(e);}function ce(e,t){t.leading=true,t.trailing=false,rt(e,t);}function K(e,t,r){t.leading=false,t.trailing=false,r&&(t.marker=r),rt(e,t);}function de(e,t){t.leading=false,t.trailing=true,rt(e,t);}function ut(e,t){if(Pe.has(e))return Pe.get(e);let{printer:{getCommentChildNodes:r,canAttachComment:u,getVisitorKeys:n},locStart:i,locEnd:s}=t;if(!u)return [];let o=(r?.(e,t)??[...Be(e,{getVisitorKeys:Ae(n)})]).flatMap(a=>u(a)?[a]:ut(a,t));return o.sort((a,l)=>i(a)-i(l)||s(a)-s(l)),Pe.set(e,o),o}function Dr(e,t,r,u){let{locStart:n,locEnd:i}=r,s=n(t),o=i(t),a=ut(e,r),l,p,f=0,D=a.length;for(;f<D;){let d=f+D>>1,c=a[d],h=n(c),m=i(c);if(h<=s&&o<=m)return Dr(c,t,r,c);if(m<=s){l=c,f=d+1;continue}if(o<=h){p=c,D=d;continue}throw new Error("Comment location overlaps with node location")}if(u?.type==="TemplateLiteral"){let{quasis:d}=u,c=Ie(d,t,r);l&&Ie(d,l,r)!==c&&(l=null),p&&Ie(d,p,r)!==c&&(p=null);}return {enclosingNode:u,precedingNode:l,followingNode:p}}function sn(e,t){let{comments:r}=e;if(delete e.comments,!tn(r)||!t.printer.canAttachComment)return;let u=[],{printer:{experimentalFeatures:{avoidAstMutation:n=false}={},handleComments:i={}},originalText:s}=t,{ownLine:o=Te,endOfLine:a=Te,remaining:l=Te}=i,p=r.map((f,D)=>({...Dr(e,f,t),comment:f,text:s,options:t,ast:e,isLastComment:r.length-1===D}));for(let[f,D]of p.entries()){let{comment:d,precedingNode:c,enclosingNode:h,followingNode:m,text:F,options:C,ast:E,isLastComment:y}=D,g;if(n?g=[D]:(d.enclosingNode=h,d.precedingNode=c,d.followingNode=m,g=[d,F,C,E,y]),on(F,C,p,f))d.placement="ownLine",o(...g)||(m?ce(m,d):c?de(c,d):K(h||E,d));else if(an(F,C,p,f))d.placement="endOfLine",a(...g)||(c?de(c,d):m?ce(m,d):K(h||E,d));else if(d.placement="remaining",!l(...g))if(c&&m){let v=u.length;v>0&&u[v-1].followingNode!==m&&Et(u,C),u.push(D);}else c?de(c,d):m?ce(m,d):K(h||E,d);}if(Et(u,t),!n)for(let f of r)delete f.precedingNode,delete f.enclosingNode,delete f.followingNode;}function on(e,t,r,u){let{comment:n,precedingNode:i}=r[u],{locStart:s,locEnd:o}=t,a=s(n);if(i)for(let l=u-1;l>=0;l--){let{comment:p,precedingNode:f}=r[l];if(f!==i||!pr(e.slice(o(p),a)))break;a=s(p);}return z(e,a,{backwards:true})}function an(e,t,r,u){let{comment:n,followingNode:i}=r[u],{locStart:s,locEnd:o}=t,a=o(n);if(i)for(let l=u+1;l<r.length;l++){let{comment:p,followingNode:f}=r[l];if(f!==i||!pr(e.slice(a,s(p))))break;a=o(p);}return z(e,a)}function Et(e,t){var r,u;let n=e.length;if(n===0)return;let{precedingNode:i,followingNode:s}=e[0],o=t.locStart(s),a;for(a=n;a>0;--a){let{comment:l,precedingNode:p,followingNode:f}=e[a-1];Ge.strictEqual(p,i),Ge.strictEqual(f,s);let D=t.originalText.slice(t.locEnd(l),o);if(((u=(r=t.printer).isGap)==null?void 0:u.call(r,D,t))??/^[\s(]*$/u.test(D))o=t.locStart(l);else break}for(let[l,{comment:p}]of e.entries())l<a?de(i,p):ce(s,p);for(let l of [i,s])l.comments&&l.comments.length>1&&l.comments.sort((p,f)=>t.locStart(p)-t.locStart(f));e.length=0;}function Ie(e,t,r){let u=r.locStart(t)-1;for(let n=1;n<e.length;++n)if(u<r.locStart(e[n]))return n-1;return 0}function ln(e,t){let r=t-1;r=G(e,r,{backwards:true}),r=Q(e,r,{backwards:true}),r=G(e,r,{backwards:true});let u=Q(e,r,{backwards:true});return r!==u}function cr(e,t){let r=e.node;return r.printed=true,t.printer.printComment(e,t)}function Dn(e,t){var r;let u=e.node,n=[cr(e,t)],{printer:i,originalText:s,locStart:o,locEnd:a}=t;if((r=i.isBlockComment)!=null&&r.call(i,u)){let p=z(s,a(u))?z(s,o(u),{backwards:true})?Z:tr:" ";n.push(p);}else n.push(Z);let l=Q(s,G(s,a(u)));return l!==false&&z(s,l)&&n.push(Z),n}function pn(e,t,r){var u;let n=e.node,i=cr(e,t),{printer:s,originalText:o,locStart:a}=t,l=(u=s.isBlockComment)==null?void 0:u.call(s,n);if(r!=null&&r.hasLineSuffix&&!(r!=null&&r.isBlock)||z(o,a(n),{backwards:true})){let p=nt(o,a(n));return {doc:Le([Z,p?Z:"",i]),isBlock:l,hasLineSuffix:true}}return !l||r!=null&&r.hasLineSuffix?{doc:[Le([" ",i]),Se],isBlock:l,hasLineSuffix:true}:{doc:[" ",i],isBlock:l,hasLineSuffix:false}}function cn(e,t){let r=e.node;if(!r)return {};let u=t[Symbol.for("printedComments")];if((r.comments||[]).filter(o=>!u.has(o)).length===0)return {leading:"",trailing:""};let n=[],i=[],s;return e.each(()=>{let o=e.node;if(u!=null&&u.has(o))return;let{leading:a,trailing:l}=o;a?n.push(Dn(e,t)):l&&(s=pn(e,t,s),i.push(s.doc));},"comments"),{leading:n,trailing:i}}function dn(e,t,r){let{leading:u,trailing:n}=cn(e,r);return !u&&!n?t:Ee(t,i=>[u,i,n])}function fn(e){let{[Symbol.for("comments")]:t,[Symbol.for("printedComments")]:r}=e;for(let u of t){if(!u.printed&&!r.has(u))throw new Error('Comment "'+u.value.trim()+'" was not printed. Please report this error!');delete u.printed;}}function hn(e){return ()=>{}}function fr({plugins:e=[],showDeprecated:t=false}={}){let r=e.flatMap(n=>n.languages??[]),u=[];for(let n of Cn(Object.assign({},...e.map(({options:i})=>i),Fn)))!t&&n.deprecated||(Array.isArray(n.choices)&&(t||(n.choices=n.choices.filter(i=>!i.deprecated)),n.name==="parser"&&(n.choices=[...n.choices,...gn(n.choices,r,e)])),n.pluginDefaults=Object.fromEntries(e.filter(i=>{var s;return ((s=i.defaultOptions)==null?void 0:s[n.name])!==void 0}).map(i=>[i.name,i.defaultOptions[n.name]])),u.push(n));return {languages:r,options:u}}function*gn(e,t,r){let u=new Set(e.map(n=>n.value));for(let n of t)if(n.parsers){for(let i of n.parsers)if(!u.has(i)){u.add(i);let s=r.find(a=>a.parsers&&Object.prototype.hasOwnProperty.call(a.parsers,i)),o=n.name;s!=null&&s.name&&(o+=` (plugin: ${s.name})`),yield {value:i,description:o};}}}function Cn(e){let t=[];for(let[r,u]of Object.entries(e)){let n={name:r,...u};Array.isArray(n.default)&&(n.default=b(false,n.default,-1).value),t.push(n);}return t}function hr(e){if(e=e instanceof URL?e:new URL(e),e.protocol!=="file:")throw new TypeError(`URL must be a file URL: received "${e.protocol}"`);return e}function bn(e){return e=hr(e),decodeURIComponent(e.pathname.replace(/%(?![0-9A-Fa-f]{2})/g,"%25"))}function wn(e){e=hr(e);let t=decodeURIComponent(e.pathname.replace(/\//g,"\\").replace(/%(?![0-9A-Fa-f]{2})/g,"%25")).replace(/^\\*([A-Za-z]:)(\\|$)/,"$1\\");return e.hostname!==""&&(t=`\\\\${e.hostname}${t}`),t}function kn(e){return vn?wn(e):bn(e)}function xt(e,t){if(!t)return;let r=xn(t).toLowerCase();return e.find(({filenames:u})=>u?.some(n=>n.toLowerCase()===r))??e.find(({extensions:u})=>u?.some(n=>r.endsWith(n)))}function Bn(e,t){if(t)return e.find(({name:r})=>r.toLowerCase()===t)??e.find(({aliases:r})=>r?.includes(t))??e.find(({extensions:r})=>r?.includes(`.${t}`))}function Bt(e,t){if(t){if(String(t).startsWith("file:"))try{t=Sn(t);}catch{return}if(typeof t=="string")return e.find(({isSupported:r})=>r?.({filepath:t}))}}function An(e,t){let r=yn(false,e.plugins).flatMap(n=>n.languages??[]),u=Bn(r,t.language)??xt(r,t.physicalFile)??xt(r,t.file)??Bt(r,t.physicalFile)??Bt(r,t.file)??(t.physicalFile,void 0);return u?.parsers[0]}function $t(e,t,r,u){return [`Invalid ${N.red(u.key(e))} value.`,`Expected ${N.blue(r)},`,`but received ${t===Fr?N.gray("nothing"):N.red(u.value(t))}.`].join(" ")}function gr({text:e,list:t},r){let u=[];return e&&u.push(`- ${N.blue(e)}`),t&&u.push([`- ${N.blue(t.title)}:`].concat(t.values.map(n=>gr(n,r-At.length).replace(/^|\n/g,`$&${At}`))).join(` `)),Cr(u,r)}function Cr(e,t){if(e.length===1)return e[0];let[r,u]=e,[n,i]=e.map(s=>s.split(` `,1)[0].length);return n>t&&n>i?u:r}function Pn(e,t){if(e===t)return 0;let r=e;e.length>t.length&&(e=t,t=r);let u=e.length,n=t.length;for(;u>0&&e.charCodeAt(~-u)===t.charCodeAt(~-n);)u--,n--;let i=0;for(;i<u&&e.charCodeAt(i)===t.charCodeAt(i);)i++;if(u-=i,n-=i,u===0)return n;let s,o,a,l,p=0,f=0;for(;p<u;)Nt[p]=e.charCodeAt(i+p),je[p]=++p;for(;f<n;)for(s=t.charCodeAt(i+f),a=f++,o=f,p=0;p<u;p++)l=s===Nt[p]?a:a+1,a=je[p],o=je[p]=a>o?l>o?o+1:l:l>a?a+1:l;return o}function In(e,t){let r=new e(t),u=Object.create(r);for(let n of Tn)n in t&&(u[n]=jn(t[n],r,J.prototype[n].length));return u}function jn(e,t,r){return typeof e=="function"?(...u)=>e(...u.slice(0,r-1),t,...u.slice(r-1)):()=>e}function Ot({from:e,to:t}){return {from:[e],to:t}}function Vn(e,t){let r=Object.create(null);for(let u of e){let n=u[t];if(r[n])throw new Error(`Duplicate ${t} ${JSON.stringify(n)}`);r[n]=u;}return r}function Rn(e,t){let r=new Map;for(let u of e){let n=u[t];if(r.has(n))throw new Error(`Duplicate ${t} ${JSON.stringify(n)}`);r.set(n,u);}return r}function zn(){let e=Object.create(null);return t=>{let r=JSON.stringify(t);return e[r]?true:(e[r]=true,false)}}function Gn(e,t){let r=[],u=[];for(let n of e)t(n)?r.push(n):u.push(n);return [r,u]}function qn(e){return e===Math.floor(e)}function Jn(e,t){if(e===t)return 0;let r=typeof e,u=typeof t,n=["undefined","object","boolean","number","string"];return r!==u?n.indexOf(r)-n.indexOf(u):r!=="string"?Number(e)-Number(t):e.localeCompare(t)}function Hn(e){return (...t)=>{let r=e(...t);return typeof r=="string"?new Error(r):r}}function Pt(e){return e===void 0?{}:e}function yr(e){if(typeof e=="string")return {text:e};let{text:t,list:r}=e;return Un((t||r)!==void 0,"Unexpected `expected` result, there should be at least one field."),r?{text:t,list:{title:r.title,values:r.values.map(yr)}}:{text:t}}function Tt(e,t){return e===true?true:e===false?{value:t}:e}function It(e,t,r=false){return e===false?false:e===true?r?true:[{value:t}]:"value"in e?[e]:e.length===0?false:e}function jt(e,t){return typeof e=="string"||"key"in e?{from:t,to:e}:"from"in e?{from:e.from,to:e.to}:{from:t,to:e.to}}function qe(e,t){return e===void 0?[]:Array.isArray(e)?e.map(r=>jt(r,t)):[jt(e,t)]}function Wt(e,t){let r=qe(typeof e=="object"&&"redirect"in e?e.redirect:e,t);return r.length===0?{remain:t,redirect:r}:typeof e=="object"&&"remain"in e?{remain:e.remain,redirect:r}:{redirect:r}}function Un(e,t){if(!e)throw new Error(t)}function ui(e,t,{logger:r=false,isCLI:u=false,passThrough:n=false,FlagSchema:i,descriptor:s}={}){if(u){if(!i)throw new Error("'FlagSchema' option is required.");if(!s)throw new Error("'descriptor' option is required.")}else s=ne;let o=n?Array.isArray(n)?(D,d)=>n.includes(D)?{[D]:d}:void 0:(D,d)=>({[D]:d}):(D,d,c)=>{let{_:h,...m}=c.schemas;return Er(D,d,{...c,schemas:m})},a=ni(t,{isCLI:u,FlagSchema:i}),l=new ri(a,{logger:r,unknown:o,descriptor:s}),p=r!==false;p&&We&&(l._hasDeprecationWarned=We);let f=l.normalize(e);return p&&(We=l._hasDeprecationWarned),f}function ni(e,{isCLI:t,FlagSchema:r}){let u=[];t&&u.push(_n.create({name:"_"}));for(let n of e)u.push(ii(n,{isCLI:t,optionInfos:e,FlagSchema:r})),n.alias&&t&&u.push(Wn.create({name:n.alias,sourceName:n.name}));return u}function ii(e,{isCLI:t,optionInfos:r,FlagSchema:u}){let{name:n}=e,i={name:n},s,o={};switch(e.type){case "int":s=Yn,t&&(i.preprocess=Number);break;case "string":s=_t;break;case "choice":s=Kn,i.choices=e.choices.map(a=>a!=null&&a.redirect?{...a,redirect:{to:{key:e.name,value:a.redirect}}}:a);break;case "boolean":s=Mn;break;case "flag":s=u,i.flags=r.flatMap(a=>[a.alias,a.description&&a.name,a.oppositeDescription&&`no-${a.name}`].filter(Boolean));break;case "path":s=_t;break;default:throw new Error(`Unexpected type ${e.type}`)}if(e.exception?i.validate=(a,l,p)=>e.exception(a)||l.validate(a,p):i.validate=(a,l,p)=>a===void 0||l.validate(a,p),e.redirect&&(o.redirect=a=>a?{to:typeof e.redirect=="string"?e.redirect:{key:e.redirect.option,value:e.redirect.value}}:void 0),e.deprecated&&(o.deprecated=true),t&&!e.array){let a=i.preprocess||(l=>l);i.preprocess=(l,p,f)=>p.preprocess(a(Array.isArray(l)?b(false,l,-1):l),f);}return e.array?Ln.create({...t?{preprocess:a=>Array.isArray(a)?a:[a]}:{},...o,valueSchema:s.create(i)}):s.create({...i,...o})}function br(e,t){if(!t)throw new Error("parserName is required.");let r=vr(false,e,n=>n.parsers&&Object.prototype.hasOwnProperty.call(n.parsers,t));if(r)return r;let u=`Couldn't resolve parser "${t}".`;throw u+=" Plugins must be explicitly added to the standalone bundle.",new dr(u)}function ai(e,t){if(!t)throw new Error("astFormat is required.");let r=vr(false,e,n=>n.printers&&Object.prototype.hasOwnProperty.call(n.printers,t));if(r)return r;let u=`Couldn't find plugin for AST format "${t}".`;throw u+=" Plugins must be explicitly added to the standalone bundle.",new dr(u)}function it({plugins:e,parser:t}){let r=br(e,t);return wr(r,t)}function wr(e,t){let r=e.parsers[t];return typeof r=="function"?r():r}function li(e,t){let r=e.printers[t];return typeof r=="function"?r():r}async function Di(e,t={}){var r;let u={...e};if(!u.parser)if(u.filepath){if(u.parser=$n(u,{physicalFile:u.filepath}),!u.parser)throw new yt(`No parser could be inferred for file "${u.filepath}".`)}else throw new yt("No parser and no file path given, couldn't infer a parser.");let n=fr({plugins:e.plugins,showDeprecated:true}).options,i={...Lt,...Object.fromEntries(n.filter(D=>D.default!==void 0).map(D=>[D.name,D.default]))},s=br(u.plugins,u.parser),o=await wr(s,u.parser);u.astFormat=o.astFormat,u.locEnd=o.locEnd,u.locStart=o.locStart;let a=(r=s.printers)!=null&&r[o.astFormat]?s:ai(u.plugins,o.astFormat),l=await li(a,o.astFormat);u.printer=l;let p=a.defaultOptions?Object.fromEntries(Object.entries(a.defaultOptions).filter(([,D])=>D!==void 0)):{},f={...i,...p};for(let[D,d]of Object.entries(f))(u[D]===null||u[D]===void 0)&&(u[D]=d);return u.parser==="json"&&(u.trailingComma="none"),si(u,n,{passThrough:Object.keys(Lt),...t})}async function ci(e,t){let r=await it(t),u=r.preprocess?r.preprocess(e,t):e;t.originalText=u;let n;try{n=await r.parse(u,t,t);}catch(i){di(i,e);}return {text:u,ast:n}}function di(e,t){let{loc:r}=e;if(r){let u=(0, pi.codeFrameColumns)(t,r,{highlightCode:true});throw e.message+=` `+u,e.codeFrame=u,e}throw e}async function fi(e,t,r,u,n){let{embeddedLanguageFormatting:i,printer:{embed:s,hasPrettierIgnore:o=()=>false,getVisitorKeys:a}}=r;if(!s||i!=="auto")return;if(s.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 l=Ae(s.getVisitorKeys??a),p=[];d();let f=e.stack;for(let{print:c,node:h,pathStack:m}of p)try{e.stack=m;let F=await c(D,t,e,r);F&&n.set(h,F);}catch(F){if(globalThis.PRETTIER_DEBUG)throw F}e.stack=f;function D(c,h){return hi(c,h,r,u)}function d(){let{node:c}=e;if(c===null||typeof c!="object"||o(e))return;for(let m of l(c))Array.isArray(c[m])?e.each(d,m):e.call(d,m);let h=s(e,r);if(h){if(typeof h=="function"){p.push({print:h,node:c,pathStack:[...e.stack]});return}n.set(c,h);}}}async function hi(e,t,r,u){let n=await oe({...r,...t,parentParser:r.parser,originalText:e,cursorOffset:void 0,rangeStart:void 0,rangeEnd:void 0},{passThrough:true}),{ast:i}=await he(e,n),s=await u(i,n);return Yt(s)}function mi(e,t){let{originalText:r,[Symbol.for("comments")]:u,locStart:n,locEnd:i,[Symbol.for("printedComments")]:s}=t,{node:o}=e,a=n(o),l=i(o);for(let p of u)n(p)>=a&&i(p)<=l&&s.add(p);return r.slice(a,l)}async function $e(e,t){({ast:e}=await kr(e,t));let r=new Map,u=new Ju(e),n=mn(t),i=new Map;await fi(u,o,t,$e,i);let s=await Mt(u,t,o,void 0,i);if(fn(t),t.cursorOffset>=0){if(t.nodeAfterCursor&&!t.nodeBeforeCursor)return [Y,s];if(t.nodeBeforeCursor&&!t.nodeAfterCursor)return [s,Y]}return s;function o(l,p){return l===void 0||l===u?a(p):Array.isArray(l)?u.call(()=>a(p),...l):u.call(()=>a(p),l)}function a(l){n(u);let p=u.node;if(p==null)return "";let f=p&&typeof p=="object"&&l===void 0;if(f&&r.has(p))return r.get(p);let D=Mt(u,t,o,l,i);return f&&r.set(p,D),D}}function Mt(e,t,r,u,n){var i;let{node:s}=e,{printer:o}=t,a;switch((i=o.hasPrettierIgnore)!=null&&i.call(o,e)?a=Fi(e,t):n.has(s)?a=n.get(s):a=o.print(e,t,r,u),s){case t.cursorNode:a=Ee(a,l=>[Y,l,Y]);break;case t.nodeBeforeCursor:a=Ee(a,l=>[l,Y]);break;case t.nodeAfterCursor:a=Ee(a,l=>[Y,l]);break}return o.printComment&&(!o.willPrintOwnComments||!o.willPrintOwnComments(e,t))&&(a=dn(e,a,t)),a}async function kr(e,t){let r=e.comments??[];t[Symbol.for("comments")]=r,t[Symbol.for("printedComments")]=new Set,sn(e,t);let{printer:{preprocess:u}}=t;return e=u?await u(e,t):e,{ast:e,comments:r}}function gi(e,t){let{cursorOffset:r,locStart:u,locEnd:n}=t,i=Ae(t.printer.getVisitorKeys),s=d=>u(d)<=r&&n(d)>=r,o=e,a=[e];for(let d of Ku(e,{getVisitorKeys:i,filter:s}))a.push(d),o=d;if(Xu(o,{getVisitorKeys:i}))return {cursorNode:o};let l,p,f=-1,D=Number.POSITIVE_INFINITY;for(;a.length>0&&(l===void 0||p===void 0);){o=a.pop();let d=l!==void 0,c=p!==void 0;for(let h of Be(o,{getVisitorKeys:i})){if(!d){let m=n(h);m<=r&&m>f&&(l=h,f=m);}if(!c){let m=u(h);m>=r&&m<D&&(p=h,D=m);}}}return {nodeBeforeCursor:l,nodeAfterCursor:p}}function Ci(e,t){let{printer:{massageAstNode:r,getVisitorKeys:u}}=t;if(!r)return e;let n=Ae(u),i=r.ignoredProperties??new Set;return s(e);function s(o,a){if(!(o!==null&&typeof o=="object"))return o;if(Array.isArray(o))return o.map(D=>s(D,a)).filter(Boolean);let l={},p=new Set(n(o));for(let D in o)!Object.prototype.hasOwnProperty.call(o,D)||i.has(D)||(p.has(D)?l[D]=s(o[D],o):l[D]=o[D]);let f=r(o,l,a);if(f!==null)return f??l}}function wi(e,t){let r=[e.node,...e.parentNodes],u=new Set([t.node,...t.parentNodes]);return r.find(n=>xr.has(n.type)&&u.has(n))}function Vt(e){let t=vi(false,e,r=>r.type!=="Program"&&r.type!=="File");return t===-1?e:e.slice(0,t+1)}function ki(e,t,{locStart:r,locEnd:u}){let n=e.node,i=t.node;if(n===i)return {startNode:n,endNode:i};let s=r(e.node);for(let a of Vt(t.parentNodes))if(r(a)>=s)i=a;else break;let o=u(t.node);for(let a of Vt(e.parentNodes)){if(u(a)<=o)n=a;else break;if(n===i)break}return {startNode:n,endNode:i}}function Je(e,t,r,u,n=[],i){let{locStart:s,locEnd:o}=r,a=s(e),l=o(e);if(!(t>l||t<a||i==="rangeEnd"&&t===a||i==="rangeStart"&&t===l)){for(let p of ut(e,r)){let f=Je(p,t,r,u,[e,...n],i);if(f)return f}if(!u||u(e,n[0]))return {node:e,parentNodes:n}}}function Si(e,t){return t!=="DeclareExportDeclaration"&&e!=="TypeParameterDeclaration"&&(e==="Directive"||e==="TypeAlias"||e==="TSExportAssignment"||e.startsWith("Declare")||e.startsWith("TSDeclare")||e.endsWith("Statement")||e.endsWith("Declaration"))}function Rt(e,t,r){if(!t)return false;switch(e.parser){case "flow":case "hermes":case "babel":case "babel-flow":case "babel-ts":case "typescript":case "acorn":case "espree":case "meriyah":case "oxc":case "oxc-ts":case "__babel_estree":return Si(t.type,r?.type);case "json":case "json5":case "jsonc":case "json-stringify":return xr.has(t.type);case "graphql":return xi.has(t.kind);case "vue":return t.tag!=="root"}return false}function Bi(e,t,r){let{rangeStart:u,rangeEnd:n,locStart:i,locEnd:s}=t;Ge.ok(n>u);let o=e.slice(u,n).search(/\S/u),a=o===-1;if(!a)for(u+=o;n>u&&!/\S/u.test(e[n-1]);--n);let l=Je(r,u,t,(d,c)=>Rt(t,d,c),[],"rangeStart"),p=a?l:Je(r,n,t,d=>Rt(t,d),[],"rangeEnd");if(!l||!p)return {rangeStart:0,rangeEnd:0};let f,D;if(bi(t)){let d=wi(l,p);f=d,D=d;}else ({startNode:f,endNode:D}=ki(l,p,t));return {rangeStart:Math.min(i(f),i(D)),rangeEnd:Math.max(s(f),s(D))}}async function Ar(e,t,r=0){if(!e||e.trim().length===0)return {formatted:"",cursorOffset:-1,comments:[]};let{ast:u,text:n}=await he(e,t);t.cursorOffset>=0&&(t={...t,...Sr(u,t)});let i=await $e(u,t);r>0&&(i=nr([Z,i],r,t.tabWidth));let s=xe(i,t);if(r>0){let a=s.formatted.trim();s.cursorNodeStart!==void 0&&(s.cursorNodeStart-=s.formatted.indexOf(a),s.cursorNodeStart<0&&(s.cursorNodeStart=0,s.cursorNodeText=s.cursorNodeText.trimStart()),s.cursorNodeStart+s.cursorNodeText.length>a.length&&(s.cursorNodeText=s.cursorNodeText.trimEnd())),s.formatted=a+Ke(t.endOfLine);}let o=t[Symbol.for("comments")];if(t.cursorOffset>=0){let a,l,p,f;if((t.cursorNode||t.nodeBeforeCursor||t.nodeAfterCursor)&&s.cursorNodeText)if(p=s.cursorNodeStart,f=s.cursorNodeText,t.cursorNode)a=t.locStart(t.cursorNode),l=n.slice(a,t.locEnd(t.cursorNode));else {if(!t.nodeBeforeCursor&&!t.nodeAfterCursor)throw new Error("Cursor location must contain at least one of cursorNode, nodeBeforeCursor, nodeAfterCursor");a=t.nodeBeforeCursor?t.locEnd(t.nodeBeforeCursor):0;let F=t.nodeAfterCursor?t.locStart(t.nodeAfterCursor):n.length;l=n.slice(a,F);}else a=0,l=n,p=0,f=s.formatted;let D=t.cursorOffset-a;if(l===f)return {formatted:s.formatted,cursorOffset:p+D,comments:o};let d=l.split("");d.splice(D,0,zt);let c=f.split(""),h=uu(d,c),m=p;for(let F of h)if(F.removed){if(F.value.includes(zt))break}else m+=F.count;return {formatted:s.formatted,cursorOffset:m,comments:o}}return {formatted:s.formatted,cursorOffset:-1,comments:o}}async function Ai(e,t){let{ast:r,text:u}=await he(e,t),{rangeStart:n,rangeEnd:i}=Bi(u,t,r),s=u.slice(n,i),o=Math.min(n,u.lastIndexOf(` `,n)+1),a=u.slice(o,n).match(/^\s*/u)[0],l=tt(a,t.tabWidth),p=await Ar(s,{...t,rangeStart:0,rangeEnd:Number.POSITIVE_INFINITY,cursorOffset:t.cursorOffset>n&&t.cursorOffset<=i?t.cursorOffset-n:-1,endOfLine:"lf"},l),f=p.formatted.trimEnd(),{cursorOffset:D}=t;D>i?D+=f.length-s.length:p.cursorOffset>=0&&(D=p.cursorOffset+n);let d=u.slice(0,n)+f+u.slice(i);if(t.endOfLine!=="lf"){let c=Ke(t.endOfLine);D>=0&&c===`\r `&&(D+=Kt(d.slice(0,D),` `)),d=we(false,d,` `,c);}return {formatted:d,cursorOffset:D,comments:p.comments}}function _e(e,t,r){return typeof t!="number"||Number.isNaN(t)||t<0||t>e.length?r:t}function Gt(e,t){let{cursorOffset:r,rangeStart:u,rangeEnd:n}=t;return r=_e(e,r,-1),u=_e(e,u,0),n=_e(e,n,e.length),{...t,cursorOffset:r,rangeStart:u,rangeEnd:n}}function $r(e,t){let{cursorOffset:r,rangeStart:u,rangeEnd:n,endOfLine:i}=Gt(e,t),s=e.charAt(0)===Br;if(s&&(e=e.slice(1),r--,u--,n--),i==="auto"&&(i=nu(e)),e.includes("\r")){let o=a=>Kt(e.slice(0,Math.max(a,0)),`\r `);r-=o(r),u-=o(u),n-=o(n),e=iu(e);}return {hasBOM:s,text:e,options:Gt(e,{...t,cursorOffset:r,rangeStart:u,rangeEnd:n,endOfLine:i})}}async function qt(e,t){let r=await it(t);return !r.hasPragma||r.hasPragma(e)}async function $i(e,t){var r;let u=await it(t);return (r=u.hasIgnorePragma)==null?void 0:r.call(u,e)}async function Nr(e,t){let{hasBOM:r,text:u,options:n}=$r(e,await oe(t));if(n.rangeStart>=n.rangeEnd&&u!==""||n.requirePragma&&!await qt(u,n)||n.checkIgnorePragma&&await $i(u,n))return {formatted:e,cursorOffset:t.cursorOffset,comments:[]};let i;return n.rangeStart>0||n.rangeEnd<u.length?i=await Ai(u,n):(!n.requirePragma&&n.insertPragma&&n.printer.insertPragma&&!await qt(u,n)&&(u=n.printer.insertPragma(u)),i=await Ar(u,n)),r&&(i.formatted=Br+i.formatted,i.cursorOffset>=0&&i.cursorOffset++),i}async function Ni(e,t,r){let{text:u,options:n}=$r(e,await oe(t)),i=await he(u,n);return r&&(r.preprocessForPrint&&(i.ast=await kr(i.ast,n)),r.massage&&(i.ast=Ei(i.ast,n))),i}async function Oi(e,t){t=await oe(t);let r=await $e(e,t);return xe(r,t)}async function Pi(e,t){let r=Iu(e),{formatted:u}=await Nr(r,{...t,parser:"__js_expression"});return u}async function Ti(e,t){t=await oe(t);let{ast:r}=await he(e,t);return t.cursorOffset>=0&&(t={...t,...Sr(r,t)}),$e(r,t)}async function Ii(e,t){return xe(e,await oe(t))}function Li(e,t){if(t===false)return false;if(e.charAt(t)==="/"&&e.charAt(t+1)==="*"){for(let r=t+2;r<e.length;++r)if(e.charAt(r)==="*"&&e.charAt(r+1)==="/")return r+2}return t}function Mi(e,t){return t===false?false:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?ar(e,t):t}function Vi(e,t){let r=null,u=t;for(;u!==r;)r=u,u=G(e,u),u=at(e,u),u=lt(e,u),u=Q(e,u);return u}function Ri(e,t){let r=null,u=t;for(;u!==r;)r=u,u=or(e,u),u=at(e,u),u=G(e,u);return u=lt(e,u),u=Q(e,u),u!==false&&z(e,u)}function zi(e,t){let r=e.lastIndexOf(` `);return r===-1?0:tt(e.slice(r+1).match(/^[\t ]*/u)[0],t)}function qi(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Ji(e,t){let r=e.match(new RegExp(`(${qi(t)})+`,"gu"));return r===null?0:r.reduce((u,n)=>Math.max(u,n.length/t.length),0)}function Ui(e,t){let r=Dt(e,t);return r===false?"":e.charAt(r)}function Xi(e,t){let r=t===true||t===Ce?Ce:Jt,u=r===Ce?Jt:Ce,n=0,i=0;for(let s of e)s===r?n++:s===u&&i++;return n>i?u:r}function Zi(e,t,r){for(let u=t;u<r;++u)if(e.charAt(u)===` `)return true;return false}function es(e,t,r={}){return G(e,r.backwards?t-1:t,r)!==t}function rs(e,t,r){let u=t==='"'?"'":'"',n=we(false,e,/\\(.)|(["'])/gsu,(i,s,o)=>s===u?s:o===t?"\\"+o:o||(r&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(s)?s:"\\"+s));return t+n+t}function ns(e,t,r){return Dt(e,r(t))}function is(e,t){return arguments.length===2||typeof t=="number"?Dt(e,t):ns(...arguments)}function ss(e,t,r){return nt(e,r(t))}function os(e,t){return arguments.length===2||typeof t=="number"?nt(e,t):ss(...arguments)}function as(e,t,r){return pt(e,r(t))}function ls(e,t){return arguments.length===2||typeof t=="number"?pt(e,t):as(...arguments)}function X(e,t=1){return async(...r)=>{let u=r[t]??{},n=u.plugins??[];return r[t]={...u,plugins:Array.isArray(n)?n:Object.values(n)},e(...r)}}async function dt(e,t){let{formatted:r}=await ct(e,{...t,cursorOffset:-1});return r}async function Pr(e,t){return await dt(e,t)===e}var Rr,He,zr,Gr,qr,Jr,Ht,Hr,Ue,Ur,Kr,Xr,Yr,De,Zr,Ut,Qr,we,eu,tu,ru,ee,j,q,W,_,L,S,P,x,M,V,R,w,T,B,Xt,su,b,te,lu,pu,ie,Ft,Xe,Ze,O,Zt,bu,Nu,Se,Ou,Qe,er,tr,Pu,Z,rr,Y,ju,Lu,Mu,et,k,$,ue,Me,tt,U,ze,ye,qu,Ju,sr,Ge,Uu,Yu,G,or,ar,Q,z,tn,lr,rn,Ae,Pe,Te,pr,nt,mn,dr,yt,Fn,En,yn,vt,bt,wt,kt,St,vn,Sn,xn,$n,ne,mr,N,Nn,Fr,ve,At,On,je,Nt,Er,Tn,J,Wn,_n,Ln,Mn,Kn,Xn,Yn,_t,Zn,Qn,ei,ti,ri,We,si,oi,vr,Lt,oe,pi,he,Fi,Sr,Ei,yi,vi,bi,xr,xi,Br,zt,st,ji,Wi,_i,Or,ot,at,lt,Dt,pt,Gi,Hi,Ki,Ce,Jt,Yi,Qi,ts,us,ct,Tr,Ir,Ds,ht=Mr(()=>{Rr=Object.create,He=Object.defineProperty,zr=Object.getOwnPropertyDescriptor,Gr=Object.getOwnPropertyNames,qr=Object.getPrototypeOf,Jr=Object.prototype.hasOwnProperty,Ht=e=>{throw TypeError(e)},Hr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ue=(e,t)=>{for(var r in t)He(e,r,{get:t[r],enumerable:true});},Ur=(e,t,r,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Gr(t))!Jr.call(e,n)&&n!==r&&He(e,n,{get:()=>t[n],enumerable:!(u=zr(t,n))||u.enumerable});return e},Kr=(e,t,r)=>(r=e!=null?Rr(qr(e)):{},Ur(t||!e||!e.__esModule?He(r,"default",{value:e,enumerable:true}):r,e)),Xr=(e,t,r)=>t.has(e)||Ht("Cannot "+r),Yr=(e,t,r)=>t.has(e)?Ht("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),De=(e,t,r)=>(Xr(e,t,"access private method"),r),Zr=Hr(e=>{Object.defineProperty(e,"__esModule",{value:true});function t(){return new Proxy({},{get:()=>i=>i})}var r=/\r\n|[\n\r\u2028\u2029]/;function u(i,s,o){let a=Object.assign({column:0,line:-1},i.start),l=Object.assign({},a,i.end),{linesAbove:p=2,linesBelow:f=3}=o||{},D=a.line,d=a.column,c=l.line,h=l.column,m=Math.max(D-(p+1),0),F=Math.min(s.length,c+f);D===-1&&(m=0),c===-1&&(F=s.length);let C=c-D,E={};if(C)for(let y=0;y<=C;y++){let g=y+D;if(!d)E[g]=true;else if(y===0){let v=s[g-1].length;E[g]=[d,v-d+1];}else if(y===C)E[g]=[0,h];else {let v=s[g-y].length;E[g]=[0,v];}}else d===h?d?E[D]=[d,0]:E[D]=true:E[D]=[d,h-d];return {start:m,end:F,markerLines:E}}function n(i,s,o={}){let a=t(),l=i.split(r),{start:p,end:f,markerLines:D}=u(s,l,o),d=s.start&&typeof s.start.column=="number",c=String(f).length,h=i.split(r,f).slice(p,f).map((m,F)=>{let C=p+1+F,E=` ${` ${C}`.slice(-c)} |`,y=D[C],g=!D[C+1];if(y){let v="";if(Array.isArray(y)){let A=m.slice(0,Math.max(y[0]-1,0)).replace(/[^\t]/g," "),re=y[1]||1;v=[` `,a.gutter(E.replace(/\d/g," "))," ",A,a.marker("^").repeat(re)].join(""),g&&o.message&&(v+=" "+a.message(o.message));}return [a.marker(">"),a.gutter(E),m.length>0?` ${m}`:"",v].join("")}else return ` ${a.gutter(E)}${m.length>0?` ${m}`:""}`}).join(` `);return o.message&&!d&&(h=`${" ".repeat(c+1)}${o.message} ${h}`),h}e.codeFrameColumns=n;}),Ut={};Ue(Ut,{__debug:()=>Ir,check:()=>Pr,doc:()=>st,format:()=>dt,formatWithCursor:()=>ct,getSupportInfo:()=>Tr,util:()=>ot,version:()=>Or});Qr=(e,t,r,u)=>{if(!(e&&t==null))return t.replaceAll?t.replaceAll(r,u):r.global?t.replace(r,u):t.split(r).join(u)},we=Qr,eu=class{diff(e,t,r={}){let u;typeof r=="function"?(u=r,r={}):"callback"in r&&(u=r.callback);let n=this.castInput(e,r),i=this.castInput(t,r),s=this.removeEmpty(this.tokenize(n,r)),o=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(s,o,r,u)}diffWithOptionsObj(e,t,r,u){var n;let i=F=>{if(F=this.postProcess(F,r),u){setTimeout(function(){u(F);},0);return}else return F},s=t.length,o=e.length,a=1,l=s+o;r.maxEditLength!=null&&(l=Math.min(l,r.maxEditLength));let p=(n=r.timeout)!==null&&n!==void 0?n:1/0,f=Date.now()+p,D=[{oldPos:-1,lastComponent:void 0}],d=this.extractCommon(D[0],t,e,0,r);if(D[0].oldPos+1>=o&&d+1>=s)return i(this.buildValues(D[0].lastComponent,t,e));let c=-1/0,h=1/0,m=()=>{for(let F=Math.max(c,-a);F<=Math.min(h,a);F+=2){let C,E=D[F-1],y=D[F+1];E&&(D[F-1]=void 0);let g=false;if(y){let A=y.oldPos-F;g=y&&0<=A&&A<s;}let v=E&&E.oldPos+1<o;if(!g&&!v){D[F]=void 0;continue}if(!v||g&&E.oldPos<y.oldPos?C=this.addToPath(y,true,false,0,r):C=this.addToPath(E,false,true,1,r),d=this.extractCommon(C,t,e,F,r),C.oldPos+1>=o&&d+1>=s)return i(this.buildValues(C.lastComponent,t,e))||true;D[F]=C,C.oldPos+1>=o&&(h=Math.min(h,F-1)),d+1>=s&&(c=Math.max(c,F+1));}a++;};if(u)(function F(){setTimeout(function(){if(a>l||Date.now()>f)return u(void 0);m()||F();},0);})();else for(;a<=l&&Date.now()<=f;){let F=m();if(F)return F}}addToPath(e,t,r,u,n){let i=e.lastComponent;return i&&!n.oneChangePerToken&&i.added===t&&i.removed===r?{oldPos:e.oldPos+u,lastComponent:{count:i.count+1,added:t,removed:r,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+u,lastComponent:{count:1,added:t,removed:r,previousComponent:i}}}extractCommon(e,t,r,u,n){let i=t.length,s=r.length,o=e.oldPos,a=o-u,l=0;for(;a+1<i&&o+1<s&&this.equals(r[o+1],t[a+1],n);)a++,o++,l++,n.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:false,removed:false});return l&&!n.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:false,removed:false}),e.oldPos=o,a}equals(e,t,r){return r.comparator?r.comparator(e,t):e===t||!!r.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let r=0;r<e.length;r++)e[r]&&t.push(e[r]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return false}buildValues(e,t,r){let u=[],n;for(;e;)u.push(e),n=e.previousComponent,delete e.previousComponent,e=n;u.reverse();let i=u.length,s=0,o=0,a=0;for(;s<i;s++){let l=u[s];if(l.removed)l.value=this.join(r.slice(a,a+l.count)),a+=l.count;else {if(!l.added&&this.useLongestToken){let p=t.slice(o,o+l.count);p=p.map(function(f,D){let d=r[a+D];return d.length>f.length?d:f}),l.value=this.join(p);}else l.value=this.join(t.slice(o,o+l.count));o+=l.count,l.added||(a+=l.count);}}return u}},tu=class extends eu{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}},ru=new tu;ee="string",j="array",q="cursor",W="indent",_="align",L="trim",S="group",P="fill",x="if-break",M="indent-if-break",V="line-suffix",R="line-suffix-boundary",w="line",T="label",B="break-parent",Xt=new Set([q,W,_,L,S,P,x,M,V,R,w,T,B]),su=(e,t,r)=>{if(!(e&&t==null))return Array.isArray(t)||typeof t=="string"?t[r<0?t.length+r:r]:t.at(r)},b=su;te=au,lu=e=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(e);pu=class extends Error{constructor(t){super(Du(t));Fe(this,"name","InvalidDocError");this.doc=t;}},ie=pu,Ft={};Xe=cu;Ze=()=>{},O=Ze,Zt=Ze,bu=Ze;Nu={type:R},Se={type:B},Ou={type:L},Qe={type:w,hard:true},er={type:w,hard:true,literal:true},tr={type:w},Pu={type:w,soft:true},Z=[Qe,Se],rr=[er,Se],Y={type:q};ju=()=>/[#*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\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](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\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]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\