likec4 1.20.3 → 1.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/__app__/src/chunks/{-index-overview-TebwYeV7.js → -index-overview-Csw3b-Fk.js} +4 -4
- package/__app__/src/chunks/{likec4-D8rQPdul.js → likec4-fsbHEjF3.js} +479 -478
- package/__app__/src/chunks/{main-DSlxn73B.js → main-DbAbBULM.js} +5105 -5106
- package/__app__/src/chunks/{mantine-D3AsIG-5.js → mantine-BdYO4lQg.js} +3837 -3743
- package/__app__/src/chunks/{tanstack-router-BE0xJAYp.js → tanstack-router-H-3IPlI6.js} +1 -1
- package/__app__/src/main.js +1 -1
- package/__app__/src/style.css +1 -1
- package/__app__/webcomponent/webcomponent.js +888 -799
- package/dist/cli/index.cjs +36 -36
- package/dist/cli/index.mjs +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +90 -27
- package/dist/index.d.mts +90 -27
- package/dist/index.d.ts +90 -27
- package/dist/index.mjs +1 -1
- package/dist/model/index.cjs +1 -1
- package/dist/model/index.d.cts +2 -2
- package/dist/model/index.d.mts +2 -2
- package/dist/model/index.d.ts +2 -2
- package/dist/model/index.mjs +1 -1
- package/dist/shared/likec4.BH2DNgw1.mjs +1855 -0
- package/dist/shared/likec4.DIyCHEbR.cjs +1855 -0
- package/package.json +19 -19
- package/react/index.js +553 -469
- package/react/style.css +1 -1
- package/dist/shared/likec4.32ndthTo.cjs +0 -1855
- package/dist/shared/likec4.BgEQuI_b.mjs +0 -1855
package/dist/cli/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{f as Hs,H as Be,
|
|
2
|
+
import{f as Hs,H as Be,a as Us,g as Wi,T as Ws,N as Gi,i as Gs,n as Vi,C as Vs,b as zs,c as zi,d as qi,t as qs,p as Ks,u as O,l as Ys,e as Js,h as We,w as Qs,j as Xs,k as Zs,m as Ki,o as Yi,L as Qe,q as eu,s as It,r as Rn,v as Ji,x as tu,y as nu}from"../shared/likec4.BH2DNgw1.mjs";import Qi,{hrtime as iu,cwd as In,stdout as ru,exit as su,argv as uu}from"node:process";import{strictEqual as ou,notStrictEqual as au}from"assert";import Ln,{resolve as je,dirname as Nn,normalize as cu,relative as lu,extname as fu,basename as du}from"path";import{statSync as Xi,readdirSync as pu,readFileSync as Pn,writeFile as hu}from"fs";import Zi,{format as er,inspect as gu}from"util";import{fileURLToPath as mu}from"url";import St,{resolve as ce,dirname as lt,join as Lt,relative as ft,extname as Nt,isAbsolute as jn,basename as tn}from"node:path";import Du,{existsSync as it,copyFileSync as tr,readdirSync as Cu,rmSync as Tn}from"node:fs";import{mkdtemp as nn,writeFile as dt,mkdir as Xe,stat as Mn,copyFile as Au,rm as Eu}from"node:fs/promises";import wu,{tmpdir as rn}from"node:os";import{fileURLToPath as nr}from"node:url";import ir from"@vitejs/plugin-react-swc";import{sortNaturalByFqn as rr,compareNatural as bu,hasAtLeast as yu,nonexhaustive as sr,invariant as kn,delay as ur}from"@likec4/core";import{build as Pt,createServer as Fu,preview as _u}from"vite";import{chromium as or}from"playwright";import Su from"node:net";import{setTimeout as vu}from"node:timers/promises";import"tty";import"node:util";import"os";import"crypto";import"net";import"child_process";import"node:tty";import"@likec4/core/types";import"events";import"buffer";import"@hpcc-js/wasm-graphviz";import"@likec4/core/compute-view";import"node:child_process";import"node:string_decoder";import"node:events";import"node:v8";import"node:stream";import"node:buffer";import"node:stream/promises";import"@likec4/core/model";const xu={right:Lu,center:Nu},$u=0,sn=1,Bu=2,un=3;class Ou{constructor(e){var t;this.width=e.width,this.wrap=(t=e.wrap)!==null&&t!==void 0?t:!0,this.rows=[]}span(...e){const t=this.div(...e);t.span=!0}resetOutput(){this.rows=[]}div(...e){if(e.length===0&&this.div(""),this.wrap&&this.shouldApplyLayoutDSL(...e)&&typeof e[0]=="string")return this.applyLayoutDSL(e[0]);const t=e.map(n=>typeof n=="string"?this.colFromString(n):n);return this.rows.push(t),t}shouldApplyLayoutDSL(...e){return e.length===1&&typeof e[0]=="string"&&/[\t\n]/.test(e[0])}applyLayoutDSL(e){const t=e.split(`
|
|
3
3
|
`).map(r=>r.split(" "));let n=0;return t.forEach(r=>{r.length>1&&Ie.stringWidth(r[0])>n&&(n=Math.min(Math.floor(this.width*.5),Ie.stringWidth(r[0])))}),t.forEach(r=>{this.div(...r.map((u,s)=>({text:u.trim(),padding:this.measurePadding(u),width:s===0&&r.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(e){return{text:e,padding:this.measurePadding(e)}}measurePadding(e){const t=Ie.stripAnsi(e);return[0,t.match(/\s*$/)[0].length,0,t.match(/^\s*/)[0].length]}toString(){const e=[];return this.rows.forEach(t=>{this.rowToString(t,e)}),e.filter(t=>!t.hidden).map(t=>t.text).join(`
|
|
4
4
|
`)}rowToString(e,t){return this.rasterize(e).forEach((n,r)=>{let u="";n.forEach((s,o)=>{const{width:a}=e[o],l=this.negatePadding(e[o]);let f=s;if(l>Ie.stringWidth(s)&&(f+=" ".repeat(l-Ie.stringWidth(s))),e[o].align&&e[o].align!=="left"&&this.wrap){const c=xu[e[o].align];f=c(f,l),Ie.stringWidth(f)<l&&(f+=" ".repeat((a||0)-Ie.stringWidth(f)-1))}const d=e[o].padding||[0,0,0,0];d[un]&&(u+=" ".repeat(d[un])),u+=ar(e[o],f,"| "),u+=f,u+=ar(e[o],f," |"),d[sn]&&(u+=" ".repeat(d[sn])),r===0&&t.length>0&&(u=this.renderInline(u,t[t.length-1]))}),t.push({text:u.replace(/ +$/,""),span:e.span})}),t}renderInline(e,t){const n=e.match(/^ */),r=n?n[0].length:0,u=t.text,s=Ie.stringWidth(u.trimRight());return t.span?this.wrap?r<s?e:(t.hidden=!0,u.trimRight()+" ".repeat(r-s)+e.trimLeft()):(t.hidden=!0,u+e):e}rasterize(e){const t=[],n=this.columnWidths(e);let r;return e.forEach((u,s)=>{u.width=n[s],this.wrap?r=Ie.wrap(u.text,this.negatePadding(u),{hard:!0}).split(`
|
|
5
5
|
`):r=u.text.split(`
|
|
6
6
|
`),u.border&&(r.unshift("."+"-".repeat(this.negatePadding(u)+2)+"."),r.push("'"+"-".repeat(this.negatePadding(u)+2)+"'")),u.padding&&(r.unshift(...new Array(u.padding[$u]||0).fill("")),r.push(...new Array(u.padding[Bu]||0).fill(""))),r.forEach((o,a)=>{t[a]||t.push([]);const l=t[a];for(let f=0;f<s;f++)l[f]===void 0&&l.push("");l.push(o)})}),t}negatePadding(e){let t=e.width||0;return e.padding&&(t-=(e.padding[un]||0)+(e.padding[sn]||0)),e.border&&(t-=4),t}columnWidths(e){if(!this.wrap)return e.map(s=>s.width||Ie.stringWidth(s.text));let t=e.length,n=this.width;const r=e.map(s=>{if(s.width)return t--,n-=s.width,s.width}),u=t?Math.floor(n/t):0;return r.map((s,o)=>s===void 0?Math.max(u,Ru(e[o])):s)}}function ar(i,e,t){return i.border?/[.']-+[.']/.test(e)?"":e.trim().length!==0?t:" ":""}function Ru(i){const e=i.padding||[],t=1+(e[un]||0)+(e[sn]||0);return i.border?t+4:t}function Iu(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Lu(i,e){i=i.trim();const t=Ie.stringWidth(i);return t<e?" ".repeat(e-t)+i:i}function Nu(i,e){i=i.trim();const t=Ie.stringWidth(i);return t>=e?i:" ".repeat(e-t>>1)+i}let Ie;function Pu(i,e){return Ie=e,new Ou({width:i?.width||Iu(),wrap:i?.wrap})}const cr=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function lr(i){return i.replace(cr,"")}function ju(i,e){const[t,n]=i.match(cr)||["",""];i=lr(i);let r="";for(let u=0;u<i.length;u++)u!==0&&u%e===0&&(r+=`
|
|
7
|
-
`),r+=i.charAt(u);return t&&n&&(r=`${t}${r}${n}`),r}function Tu(i){return Pu(i,{stringWidth:e=>[...e].length,stripAnsi:lr,wrap:ju})}function Mu(i,e){let t=je(".",i),n;for(Xi(t).isDirectory()||(t=Nn(t));;){if(n=e(t,pu(t)),n)return je(t,n);if(t=Nn(n=t),n===t)break}}function jt(i){if(i!==i.toLowerCase()&&i!==i.toUpperCase()||(i=i.toLowerCase()),i.indexOf("-")===-1&&i.indexOf("_")===-1)return i;{let t="",n=!1;const r=i.match(/^-+/);for(let u=r?r[0].length:0;u<i.length;u++){let s=i.charAt(u);n&&(n=!1,s=s.toUpperCase()),u!==0&&(s==="-"||s==="_")?n=!0:s!=="-"&&s!=="_"&&(t+=s)}return t}}function fr(i,e){const t=i.toLowerCase();e=e||"-";let n="";for(let r=0;r<i.length;r++){const u=t.charAt(r),s=i.charAt(r);u!==s&&r>0?n+=`${e}${t.charAt(r)}`:n+=s}return n}function dr(i){return i==null?!1:typeof i=="number"||/^0x[0-9a-f]+$/i.test(i)?!0:/^0[^.]/.test(i)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(i)}function ku(i){if(Array.isArray(i))return i.map(s=>typeof s!="string"?s+"":s);i=i.trim();let e=0,t=null,n=null,r=null;const u=[];for(let s=0;s<i.length;s++){if(t=n,n=i.charAt(s),n===" "&&!r){t!==" "&&e++;continue}n===r?r=null:(n==="'"||n==='"')&&!r&&(r=n),u[e]||(u[e]=""),u[e]+=n}return u}var Ge;(function(i){i.BOOLEAN="boolean",i.STRING="string",i.NUMBER="number",i.ARRAY="array"})(Ge||(Ge={}));let Ze;class Hu{constructor(e){Ze=e}parse(e,t){const n=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},t),r=ku(e),u=typeof e=="string",s=Uu(Object.assign(Object.create(null),n.alias)),o=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},n.configuration),a=Object.assign(Object.create(null),n.default),l=n.configObjects||[],f=n.envPrefix,d=o["populate--"],c=d?"--":"_",A=Object.create(null),F=Object.create(null),w=n.__||Ze.format,h={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},E=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,x=new RegExp("^--"+o["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(m){const D=typeof m=="object"?m.key:m,P=Object.keys(m).map(function(B){return{boolean:"bools",string:"strings",number:"numbers"}[B]}).filter(Boolean).pop();P&&(h[P][D]=!0),h.arrays[D]=!0,h.keys.push(D)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(m){h.bools[m]=!0,h.keys.push(m)}),[].concat(n.string||[]).filter(Boolean).forEach(function(m){h.strings[m]=!0,h.keys.push(m)}),[].concat(n.number||[]).filter(Boolean).forEach(function(m){h.numbers[m]=!0,h.keys.push(m)}),[].concat(n.count||[]).filter(Boolean).forEach(function(m){h.counts[m]=!0,h.keys.push(m)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(m){h.normalize[m]=!0,h.keys.push(m)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([m,D])=>{typeof D=="number"&&(h.nargs[m]=D,h.keys.push(m))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([m,D])=>{typeof D=="function"&&(h.coercions[m]=D,h.keys.push(m))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(m){h.configs[m]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([m,D])=>{(typeof D=="boolean"||typeof D=="function")&&(h.configs[m]=D)})),_e(n.key,s,n.default,h.arrays),Object.keys(a).forEach(function(m){(h.aliases[m]||[]).forEach(function(D){a[D]=a[m]})});let C=null;Oe();let _=[];const y=Object.assign(Object.create(null),{_:[]}),M={};for(let m=0;m<r.length;m++){const D=r[m],P=D.replace(/^-{3,}/,"---");let B,g,k,S,T,oe;if(D!=="--"&&/^-/.test(D)&&Y(D))R(D);else if(P.match(/^---+(=|$)/)){R(D);continue}else if(D.match(/^--.+=/)||!o["short-option-groups"]&&D.match(/^-.+=/))S=D.match(/^--?([^=]+)=([\s\S]*)$/),S!==null&&Array.isArray(S)&&S.length>=3&&(q(S[1],h.arrays)?m=z(m,S[1],r,S[2]):q(S[1],h.nargs)!==!1?m=W(m,S[1],r,S[2]):G(S[1],S[2],!0));else if(D.match(x)&&o["boolean-negation"])S=D.match(x),S!==null&&Array.isArray(S)&&S.length>=2&&(g=S[1],G(g,q(g,h.arrays)?[!1]:!1));else if(D.match(/^--.+/)||!o["short-option-groups"]&&D.match(/^-[^-]+/))S=D.match(/^--?(.+)/),S!==null&&Array.isArray(S)&&S.length>=2&&(g=S[1],q(g,h.arrays)?m=z(m,g,r):q(g,h.nargs)!==!1?m=W(m,g,r):(T=r[m+1],T!==void 0&&(!T.match(/^-/)||T.match(E))&&!q(g,h.bools)&&!q(g,h.counts)||/^(true|false)$/.test(T)?(G(g,T),m++):G(g,pe(g))));else if(D.match(/^-.\..+=/))S=D.match(/^-([^=]+)=([\s\S]*)$/),S!==null&&Array.isArray(S)&&S.length>=3&&G(S[1],S[2]);else if(D.match(/^-.\..+/)&&!D.match(E))T=r[m+1],S=D.match(/^-(.\..+)/),S!==null&&Array.isArray(S)&&S.length>=2&&(g=S[1],T!==void 0&&!T.match(/^-/)&&!q(g,h.bools)&&!q(g,h.counts)?(G(g,T),m++):G(g,pe(g)));else if(D.match(/^-[^-]+/)&&!D.match(E)){k=D.slice(1,-1).split(""),B=!1;for(let he=0;he<k.length;he++){if(T=D.slice(he+2),k[he+1]&&k[he+1]==="="){oe=D.slice(he+3),g=k[he],q(g,h.arrays)?m=z(m,g,r,oe):q(g,h.nargs)!==!1?m=W(m,g,r,oe):G(g,oe),B=!0;break}if(T==="-"){G(k[he],T);continue}if(/[A-Za-z]/.test(k[he])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(T)&&q(T,h.bools)===!1){G(k[he],T),B=!0;break}if(k[he+1]&&k[he+1].match(/\W/)){G(k[he],T),B=!0;break}else G(k[he],pe(k[he]))}g=D.slice(-1)[0],!B&&g!=="-"&&(q(g,h.arrays)?m=z(m,g,r):q(g,h.nargs)!==!1?m=W(m,g,r):(T=r[m+1],T!==void 0&&(!/^(-|--)[^-]/.test(T)||T.match(E))&&!q(g,h.bools)&&!q(g,h.counts)||/^(true|false)$/.test(T)?(G(g,T),m++):G(g,pe(g))))}else if(D.match(/^-[0-9]$/)&&D.match(E)&&q(D.slice(1),h.bools))g=D.slice(1),G(g,pe(g));else if(D==="--"){_=r.slice(m+1);break}else if(o["halt-at-non-option"]){_=r.slice(m);break}else R(D)}U(y,!0),U(y,!1),H(y),X(),ne(y,h.aliases,a,!0),re(y),o["set-placeholder-key"]&&be(y),Object.keys(h.counts).forEach(function(m){$(y,m.split("."))||G(m,0)}),d&&_.length&&(y[c]=[]),_.forEach(function(m){y[c].push(m)}),o["camel-case-expansion"]&&o["strip-dashed"]&&Object.keys(y).filter(m=>m!=="--"&&m.includes("-")).forEach(m=>{delete y[m]}),o["strip-aliased"]&&[].concat(...Object.keys(s).map(m=>s[m])).forEach(m=>{o["camel-case-expansion"]&&m.includes("-")&&delete y[m.split(".").map(D=>jt(D)).join(".")],delete y[m]});function R(m){const D=v("_",m);(typeof D=="string"||typeof D=="number")&&y._.push(D)}function W(m,D,P,B){let g,k=q(D,h.nargs);if(k=typeof k!="number"||isNaN(k)?1:k,k===0)return $e(B)||(C=Error(w("Argument unexpected for: %s",D))),G(D,pe(D)),m;let S=$e(B)?0:1;if(o["nargs-eats-options"])P.length-(m+1)+S<k&&(C=Error(w("Not enough arguments following: %s",D))),S=k;else{for(g=m+1;g<P.length&&(!P[g].match(/^-[^0-9]/)||P[g].match(E)||Y(P[g]));g++)S++;S<k&&(C=Error(w("Not enough arguments following: %s",D)))}let T=Math.min(S,k);for(!$e(B)&&T>0&&(G(D,B),T--),g=m+1;g<T+m+1;g++)G(D,P[g]);return m+T}function z(m,D,P,B){let g=[],k=B||P[m+1];const S=q(D,h.nargs);if(q(D,h.bools)&&!/^(true|false)$/.test(k))g.push(!0);else if($e(k)||$e(B)&&/^-/.test(k)&&!E.test(k)&&!Y(k)){if(a[D]!==void 0){const T=a[D];g=Array.isArray(T)?T:[T]}}else{$e(B)||g.push(L(D,B,!0));for(let T=m+1;T<P.length&&!(!o["greedy-arrays"]&&g.length>0||S&&typeof S=="number"&&g.length>=S||(k=P[T],/^-/.test(k)&&!E.test(k)&&!Y(k)));T++)m=T,g.push(L(D,k,u))}return typeof S=="number"&&(S&&g.length<S||isNaN(S)&&g.length===0)&&(C=Error(w("Not enough arguments following: %s",D))),G(D,g),m}function G(m,D,P=u){if(/-/.test(m)&&o["camel-case-expansion"]){const k=m.split(".").map(function(S){return jt(S)}).join(".");j(m,k)}const B=L(m,D,P),g=m.split(".");ge(y,g,B),h.aliases[m]&&h.aliases[m].forEach(function(k){const S=k.split(".");ge(y,S,B)}),g.length>1&&o["dot-notation"]&&(h.aliases[g[0]]||[]).forEach(function(k){let S=k.split(".");const T=[].concat(g);T.shift(),S=S.concat(T),(h.aliases[m]||[]).includes(S.join("."))||ge(y,S,B)}),q(m,h.normalize)&&!q(m,h.arrays)&&[m].concat(h.aliases[m]||[]).forEach(function(S){Object.defineProperty(M,S,{enumerable:!0,get(){return D},set(T){D=typeof T=="string"?Ze.normalize(T):T}})})}function j(m,D){h.aliases[m]&&h.aliases[m].length||(h.aliases[m]=[D],A[D]=!0),h.aliases[D]&&h.aliases[D].length||j(D,m)}function L(m,D,P){P&&(D=Wu(D)),(q(m,h.bools)||q(m,h.counts))&&typeof D=="string"&&(D=D==="true");let B=Array.isArray(D)?D.map(function(g){return v(m,g)}):v(m,D);return q(m,h.counts)&&($e(B)||typeof B=="boolean")&&(B=Hn()),q(m,h.normalize)&&q(m,h.arrays)&&(Array.isArray(D)?B=D.map(g=>Ze.normalize(g)):B=Ze.normalize(D)),B}function v(m,D){return!o["parse-positional-numbers"]&&m==="_"||!q(m,h.strings)&&!q(m,h.bools)&&!Array.isArray(D)&&(dr(D)&&o["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${D}`)))||!$e(D)&&q(m,h.numbers))&&(D=Number(D)),D}function H(m){const D=Object.create(null);ne(D,h.aliases,a),Object.keys(h.configs).forEach(function(P){const B=m[P]||D[P];if(B)try{let g=null;const k=Ze.resolve(Ze.cwd(),B),S=h.configs[P];if(typeof S=="function"){try{g=S(k)}catch(T){g=T}if(g instanceof Error){C=g;return}}else g=Ze.require(k);V(g)}catch(g){g.name==="PermissionDenied"?C=g:m[P]&&(C=Error(w("Invalid JSON config file: %s",B)))}})}function V(m,D){Object.keys(m).forEach(function(P){const B=m[P],g=D?D+"."+P:P;typeof B=="object"&&B!==null&&!Array.isArray(B)&&o["dot-notation"]?V(B,g):(!$(y,g.split("."))||q(g,h.arrays)&&o["combine-arrays"])&&G(g,B)})}function X(){typeof l<"u"&&l.forEach(function(m){V(m)})}function U(m,D){if(typeof f>"u")return;const P=typeof f=="string"?f:"",B=Ze.env();Object.keys(B).forEach(function(g){if(P===""||g.lastIndexOf(P,0)===0){const k=g.split("__").map(function(S,T){return T===0&&(S=S.substring(P.length)),jt(S)});(D&&h.configs[k.join(".")]||!D)&&!$(m,k)&&G(k.join("."),B[g])}})}function re(m){let D;const P=new Set;Object.keys(m).forEach(function(B){if(!P.has(B)&&(D=q(B,h.coercions),typeof D=="function"))try{const g=v(B,D(m[B]));[].concat(h.aliases[B]||[],B).forEach(k=>{P.add(k),m[k]=g})}catch(g){C=g}})}function be(m){return h.keys.forEach(D=>{~D.indexOf(".")||typeof m[D]>"u"&&(m[D]=void 0)}),m}function ne(m,D,P,B=!1){Object.keys(P).forEach(function(g){$(m,g.split("."))||(ge(m,g.split("."),P[g]),B&&(F[g]=!0),(D[g]||[]).forEach(function(k){$(m,k.split("."))||ge(m,k.split("."),P[g])}))})}function $(m,D){let P=m;o["dot-notation"]||(D=[D.join(".")]),D.slice(0,-1).forEach(function(g){P=P[g]||{}});const B=D[D.length-1];return typeof P!="object"?!1:B in P}function ge(m,D,P){let B=m;o["dot-notation"]||(D=[D.join(".")]),D.slice(0,-1).forEach(function(oe){oe=pr(oe),typeof B=="object"&&B[oe]===void 0&&(B[oe]={}),typeof B[oe]!="object"||Array.isArray(B[oe])?(Array.isArray(B[oe])?B[oe].push({}):B[oe]=[B[oe],{}],B=B[oe][B[oe].length-1]):B=B[oe]});const g=pr(D[D.length-1]),k=q(D.join("."),h.arrays),S=Array.isArray(P);let T=o["duplicate-arguments-array"];!T&&q(g,h.nargs)&&(T=!0,(!$e(B[g])&&h.nargs[g]===1||Array.isArray(B[g])&&B[g].length===h.nargs[g])&&(B[g]=void 0)),P===Hn()?B[g]=Hn(B[g]):Array.isArray(B[g])?T&&k&&S?B[g]=o["flatten-duplicate-arrays"]?B[g].concat(P):(Array.isArray(B[g][0])?B[g]:[B[g]]).concat([P]):!T&&!!k==!!S?B[g]=P:B[g]=B[g].concat([P]):B[g]===void 0&&k?B[g]=S?P:[P]:T&&!(B[g]===void 0||q(g,h.counts)||q(g,h.bools))?B[g]=[B[g],P]:B[g]=P}function _e(...m){m.forEach(function(D){Object.keys(D||{}).forEach(function(P){h.aliases[P]||(h.aliases[P]=[].concat(s[P]||[]),h.aliases[P].concat(P).forEach(function(B){if(/-/.test(B)&&o["camel-case-expansion"]){const g=jt(B);g!==P&&h.aliases[P].indexOf(g)===-1&&(h.aliases[P].push(g),A[g]=!0)}}),h.aliases[P].concat(P).forEach(function(B){if(B.length>1&&/[A-Z]/.test(B)&&o["camel-case-expansion"]){const g=fr(B,"-");g!==P&&h.aliases[P].indexOf(g)===-1&&(h.aliases[P].push(g),A[g]=!0)}}),h.aliases[P].forEach(function(B){h.aliases[B]=[P].concat(h.aliases[P].filter(function(g){return B!==g}))}))})})}function q(m,D){const P=[].concat(h.aliases[m]||[],m),B=Object.keys(D),g=P.find(k=>B.includes(k));return g?D[g]:!1}function I(m){const D=Object.keys(h);return[].concat(D.map(B=>h[B])).some(function(B){return Array.isArray(B)?B.includes(m):B[m]})}function b(m,...D){return[].concat(...D).some(function(B){const g=m.match(B);return g&&I(g[1])})}function K(m){if(m.match(E)||!m.match(/^-[^-]+/))return!1;let D=!0,P;const B=m.slice(1).split("");for(let g=0;g<B.length;g++){if(P=m.slice(g+2),!I(B[g])){D=!1;break}if(B[g+1]&&B[g+1]==="="||P==="-"||/[A-Za-z]/.test(B[g])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(P)||B[g+1]&&B[g+1].match(/\W/))break}return D}function Y(m){return o["unknown-options-as-args"]&&ee(m)}function ee(m){return m=m.replace(/^-{3,}/,"--"),m.match(E)||K(m)?!1:!b(m,/^-+([^=]+?)=[\s\S]*$/,x,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function pe(m){return!q(m,h.bools)&&!q(m,h.counts)&&`${m}`in a?a[m]:se(de(m))}function se(m){return{[Ge.BOOLEAN]:!0,[Ge.STRING]:"",[Ge.NUMBER]:void 0,[Ge.ARRAY]:[]}[m]}function de(m){let D=Ge.BOOLEAN;return q(m,h.strings)?D=Ge.STRING:q(m,h.numbers)?D=Ge.NUMBER:q(m,h.bools)?D=Ge.BOOLEAN:q(m,h.arrays)&&(D=Ge.ARRAY),D}function $e(m){return m===void 0}function Oe(){Object.keys(h.counts).find(m=>q(m,h.arrays)?(C=Error(w("Invalid configuration: %s, opts.count excludes opts.array.",m)),!0):q(m,h.nargs)?(C=Error(w("Invalid configuration: %s, opts.count excludes opts.narg.",m)),!0):!1)}return{aliases:Object.assign({},h.aliases),argv:Object.assign(M,y),configuration:o,defaulted:Object.assign({},F),error:C,newAliases:Object.assign({},A)}}}function Uu(i){const e=[],t=Object.create(null);let n=!0;for(Object.keys(i).forEach(function(r){e.push([].concat(i[r],r))});n;){n=!1;for(let r=0;r<e.length;r++)for(let u=r+1;u<e.length;u++)if(e[r].filter(function(o){return e[u].indexOf(o)!==-1}).length){e[r]=e[r].concat(e[u]),e.splice(u,1),n=!0;break}}return e.forEach(function(r){r=r.filter(function(s,o,a){return a.indexOf(s)===o});const u=r.pop();u!==void 0&&typeof u=="string"&&(t[u]=r)}),t}function Hn(i){return i!==void 0?i+1:1}function pr(i){return i==="__proto__"?"___proto___":i}function Wu(i){return typeof i=="string"&&(i[0]==="'"||i[0]==='"')&&i[i.length-1]===i[0]?i.substring(1,i.length-1):i}var Un,Wn,Gn;const hr=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,gr=(Wn=(Un=process==null?void 0:process.versions)===null||Un===void 0?void 0:Un.node)!==null&&Wn!==void 0?Wn:(Gn=process==null?void 0:process.version)===null||Gn===void 0?void 0:Gn.slice(1);if(gr&&Number(gr.match(/^([^.]+)/)[1])<hr)throw Error(`yargs parser supports a minimum Node.js version of ${hr}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const Gu=process?process.env:{},mr=new Hu({cwd:process.cwd,env:()=>Gu,format:er,normalize:cu,resolve:je,require:i=>{if(typeof require<"u")return require(i);if(i.match(/\.json$/))return JSON.parse(Pn(i,"utf8"));throw Error("only .json config files are supported in ESM")}}),Tt=function(e,t){return mr.parse(e.slice(),t).argv};Tt.detailed=function(i,e){return mr.parse(i.slice(),e)},Tt.camelCase=jt,Tt.decamelize=fr,Tt.looksLikeNumber=dr;function Dr(){return Vu()?0:1}function Vu(){return zu()&&!process.defaultApp}function zu(){return!!process.versions.electron}function qu(i){return i.slice(Dr()+1)}function Ku(){return process.argv[Dr()]}class Fe extends Error{constructor(e){super(e||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,Fe)}}const Yu={fs:{readFileSync:Pn,writeFile:hu},format:er,resolve:je,exists:i=>{try{return Xi(i).isFile()}catch{return!1}}};let Ve;class Ju{constructor(e){e=e||{},this.directory=e.directory||"./locales",this.updateFiles=typeof e.updateFiles=="boolean"?e.updateFiles:!0,this.locale=e.locale||"en",this.fallbackToLanguage=typeof e.fallbackToLanguage=="boolean"?e.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...e){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);const t=e.shift();let n=function(){};return typeof e[e.length-1]=="function"&&(n=e.pop()),n=n||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][t]&&this.updateFiles?(this.cache[this.locale][t]=t,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),Ve.format.apply(Ve.format,[this.cache[this.locale][t]||t].concat(e))}__n(){const e=Array.prototype.slice.call(arguments),t=e.shift(),n=e.shift(),r=e.shift();let u=function(){};typeof e[e.length-1]=="function"&&(u=e.pop()),this.cache[this.locale]||this._readLocaleFile();let s=r===1?t:n;this.cache[this.locale][t]&&(s=this.cache[this.locale][t][r===1?"one":"other"]),!this.cache[this.locale][t]&&this.updateFiles?(this.cache[this.locale][t]={one:t,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:u})):u();const o=[s];return~s.indexOf("%d")&&o.push(r),Ve.format.apply(Ve.format,o.concat(e))}setLocale(e){this.locale=e}getLocale(){return this.locale}updateLocale(e){this.cache[this.locale]||this._readLocaleFile();for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(this.cache[this.locale][t]=e[t])}_taggedLiteral(e,...t){let n="";return e.forEach(function(r,u){const s=t[u+1];n+=r,typeof s<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(t,1)))}_enqueueWrite(e){this.writeQueue.push(e),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){const e=this,t=this.writeQueue[0],n=t.directory,r=t.locale,u=t.cb,s=this._resolveLocaleFile(n,r),o=JSON.stringify(this.cache[r],null,2);Ve.fs.writeFile(s,o,"utf-8",function(a){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),u(a)})}_readLocaleFile(){let e={};const t=this._resolveLocaleFile(this.directory,this.locale);try{Ve.fs.readFileSync&&(e=JSON.parse(Ve.fs.readFileSync(t,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+t),n.code==="ENOENT")e={};else throw n}this.cache[this.locale]=e}_resolveLocaleFile(e,t){let n=Ve.resolve(e,"./",t+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~t.lastIndexOf("_")){const r=Ve.resolve(e,"./",t.split("_")[0]+".json");this._fileExistsSync(r)&&(n=r)}return n}_fileExistsSync(e){return Ve.exists(e)}}function Qu(i,e){Ve=e;const t=new Ju(i);return{__:t.__.bind(t),__n:t.__n.bind(t),setLocale:t.setLocale.bind(t),getLocale:t.getLocale.bind(t),updateLocale:t.updateLocale.bind(t),locale:t.locale}}const Xu=i=>Qu(i,Yu),Zu="require is not supported by ESM",Cr="loading a directory of commands is not supported yet for ESM";let Mt;try{Mt=mu(import.meta.url)}catch{Mt=process.cwd()}const eo=Mt.substring(0,Mt.lastIndexOf("node_modules")),to={assert:{notStrictEqual:ou,strictEqual:au},cliui:Tu,findUp:Mu,getEnv:i=>process.env[i],inspect:gu,getCallerFile:()=>{throw new Fe(Cr)},getProcessArgvBin:Ku,mainFilename:eo||process.cwd(),Parser:Tt,path:{basename:lu,dirname:Nn,extname:fu,relative:du,resolve:je},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(i,e)=>process.emitWarning(i,e),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:Pn,require:()=>{throw new Fe(Zu)},requireDirectory:()=>{throw new Fe(Cr)},stringWidth:i=>[...i].length,y18n:Xu({directory:je(Mt,"../../../locales"),updateFiles:!1})};function ze(i,e,t,n){t.assert.notStrictEqual(i,e,n)}function Ar(i,e){e.assert.strictEqual(typeof i,"string")}function on(i){return Object.keys(i)}function ye(i){return!!i&&!!i.then&&typeof i.then=="function"}function kt(i){const t=i.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,r=t.shift();if(!r)throw new Error(`No command found in: ${i}`);const u={cmd:r.replace(n,""),demanded:[],optional:[]};return t.forEach((s,o)=>{let a=!1;s=s.replace(/\s/g,""),/\.+[\]>]/.test(s)&&o===t.length-1&&(a=!0),/^\[/.test(s)?u.optional.push({cmd:s.replace(n,"").split("|"),variadic:a}):u.demanded.push({cmd:s.replace(n,"").split("|"),variadic:a})}),u}const no=["first","second","third","fourth","fifth","sixth"];function Q(i,e,t){function n(){return typeof i=="object"?[{demanded:[],optional:[]},i,e]:[kt(`cmd ${i}`),e,t]}try{let r=0;const[u,s,o]=n(),a=[].slice.call(s);for(;a.length&&a[a.length-1]===void 0;)a.pop();const l=o||a.length;if(l<u.demanded.length)throw new Fe(`Not enough arguments provided. Expected ${u.demanded.length} but received ${a.length}.`);const f=u.demanded.length+u.optional.length;if(l>f)throw new Fe(`Too many arguments provided. Expected max ${f} but received ${l}.`);u.demanded.forEach(d=>{const c=a.shift(),A=Er(c);d.cmd.filter(w=>w===A||w==="*").length===0&&wr(A,d.cmd,r),r+=1}),u.optional.forEach(d=>{if(a.length===0)return;const c=a.shift(),A=Er(c);d.cmd.filter(w=>w===A||w==="*").length===0&&wr(A,d.cmd,r),r+=1})}catch(r){console.warn(r.stack)}}function Er(i){return Array.isArray(i)?"array":i===null?"null":typeof i}function wr(i,e,t){throw new Fe(`Invalid ${no[t]||"manyith"} argument. Expected ${e.join(" or ")} but received ${i}.`)}class io{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,t,n=!0,r=!1){if(Q("<array|function> [boolean] [boolean] [boolean]",[e,t,n],arguments.length),Array.isArray(e)){for(let u=0;u<e.length;u++){if(typeof e[u]!="function")throw Error("middleware must be a function");const s=e[u];s.applyBeforeValidation=t,s.global=n}Array.prototype.push.apply(this.globalMiddleware,e)}else if(typeof e=="function"){const u=e;u.applyBeforeValidation=t,u.global=n,u.mutates=r,this.globalMiddleware.push(e)}return this.yargs}addCoerceMiddleware(e,t){const n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(r=>{const u=[...n[t]||[],t];return r.option?!u.includes(r.option):!0}),e.option=t,this.addMiddleware(e,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){const e=this.frozens.pop();e!==void 0&&(this.globalMiddleware=e)}reset(){this.globalMiddleware=this.globalMiddleware.filter(e=>e.global)}}function ro(i){return i?i.map(e=>(e.applyBeforeValidation=!1,e)):[]}function Ht(i,e,t,n){return t.reduce((r,u)=>{if(u.applyBeforeValidation!==n)return r;if(u.mutates){if(u.applied)return r;u.applied=!0}if(ye(r))return r.then(s=>Promise.all([s,u(s,e)])).then(([s,o])=>Object.assign(s,o));{const s=u(r,e);return ye(s)?s.then(o=>Object.assign(r,o)):Object.assign(r,s)}},i)}function Ut(i,e,t=n=>{throw n}){try{const n=so(i)?i():i;return ye(n)?n.then(r=>e(r)):e(n)}catch(n){return t(n)}}function so(i){return typeof i=="function"}function uo(i){if(typeof require>"u")return null;for(let e=0,t=Object.keys(require.cache),n;e<t.length;e++)if(n=require.cache[t[e]],n.exports===i)return n;return null}const vt=/(^\*)|(^\$0)/;class oo{constructor(e,t,n,r){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=r,this.usage=e,this.globalMiddleware=n,this.validation=t}addDirectory(e,t,n,r){r=r||{},typeof r.recurse!="boolean"&&(r.recurse=!1),Array.isArray(r.extensions)||(r.extensions=["js"]);const u=typeof r.visit=="function"?r.visit:s=>s;r.visit=(s,o,a)=>{const l=u(s,o,a);if(l){if(this.requireCache.has(o))return l;this.requireCache.add(o),this.addHandler(l)}return l},this.shim.requireDirectory({require:t,filename:n},e,r)}addHandler(e,t,n,r,u,s){let o=[];const a=ro(u);if(r=r||(()=>{}),Array.isArray(e))if(co(e))[e,...o]=e;else for(const l of e)this.addHandler(l);else if(fo(e)){let l=Array.isArray(e.command)||typeof e.command=="string"?e.command:this.moduleName(e);e.aliases&&(l=[].concat(l).concat(e.aliases)),this.addHandler(l,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated);return}else if(br(n)){this.addHandler([e].concat(o),t,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof e=="string"){const l=kt(e);o=o.map(c=>kt(c).cmd);let f=!1;const d=[l.cmd].concat(o).filter(c=>vt.test(c)?(f=!0,!1):!0);d.length===0&&f&&d.push("$0"),f&&(l.cmd=d[0],o=d.slice(1),e=e.replace(vt,l.cmd)),o.forEach(c=>{this.aliasMap[c]=l.cmd}),t!==!1&&this.usage.command(e,t,f,o,s),this.handlers[l.cmd]={original:e,description:t,handler:r,builder:n||{},middlewares:a,deprecated:s,demanded:l.demanded,optional:l.optional},f&&(this.defaultCommand=this.handlers[l.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(e,t,n,r,u,s){const o=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand,a=t.getInternalMethods().getContext(),l=a.commands.slice(),f=!e;e&&(a.commands.push(e),a.fullCommands.push(o.original));const d=this.applyBuilderUpdateUsageAndParse(f,o,t,n.aliases,l,r,u,s);return ye(d)?d.then(c=>this.applyMiddlewareAndGetResult(f,o,c.innerArgv,a,u,c.aliases,t)):this.applyMiddlewareAndGetResult(f,o,d.innerArgv,a,u,d.aliases,t)}applyBuilderUpdateUsageAndParse(e,t,n,r,u,s,o,a){const l=t.builder;let f=n;if(Vn(l)){n.getInternalMethods().getUsageInstance().freeze();const d=l(n.getInternalMethods().reset(r),a);if(ye(d))return d.then(c=>(f=xo(c)?c:n,this.parseAndUpdateUsage(e,t,f,u,s,o)))}else lo(l)&&(n.getInternalMethods().getUsageInstance().freeze(),f=n.getInternalMethods().reset(r),Object.keys(t.builder).forEach(d=>{f.option(d,l[d])}));return this.parseAndUpdateUsage(e,t,f,u,s,o)}parseAndUpdateUsage(e,t,n,r,u,s){e&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(r,t),t.description);const o=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,u,s);return ye(o)?o.then(a=>({aliases:n.parsed.aliases,innerArgv:a})):{aliases:n.parsed.aliases,innerArgv:o}}shouldUpdateUsage(e){return!e.getInternalMethods().getUsageInstance().getUsageDisabled()&&e.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(e,t){const n=vt.test(t.original)?t.original.replace(vt,"").trim():t.original,r=e.filter(u=>!vt.test(u));return r.push(n),`$0 ${r.join(" ")}`}handleValidationAndGetResult(e,t,n,r,u,s,o,a){if(!s.getInternalMethods().getHasOutput()){const l=s.getInternalMethods().runValidation(u,a,s.parsed.error,e);n=Ut(n,f=>(l(f),f))}if(t.handler&&!s.getInternalMethods().getHasOutput()){s.getInternalMethods().setHasOutput();const l=!!s.getOptions().configuration["populate--"];s.getInternalMethods().postProcess(n,l,!1,!1),n=Ht(n,s,o,!1),n=Ut(n,f=>{const d=t.handler(f);return ye(d)?d.then(()=>f):f}),e||s.getInternalMethods().getUsageInstance().cacheHelpMessage(),ye(n)&&!s.getInternalMethods().hasParseCallback()&&n.catch(f=>{try{s.getInternalMethods().getUsageInstance().fail(null,f)}catch{}})}return e||(r.commands.pop(),r.fullCommands.pop()),n}applyMiddlewareAndGetResult(e,t,n,r,u,s,o){let a={};if(u)return n;o.getInternalMethods().getHasOutput()||(a=this.populatePositionals(t,n,r,o));const l=this.globalMiddleware.getMiddleware().slice(0).concat(t.middlewares),f=Ht(n,o,l,!0);return ye(f)?f.then(d=>this.handleValidationAndGetResult(e,t,d,r,s,o,l,a)):this.handleValidationAndGetResult(e,t,f,r,s,o,l,a)}populatePositionals(e,t,n,r){t._=t._.slice(n.commands.length);const u=e.demanded.slice(0),s=e.optional.slice(0),o={};for(this.validation.positionalCount(u.length,t._.length);u.length;){const a=u.shift();this.populatePositional(a,t,o)}for(;s.length;){const a=s.shift();this.populatePositional(a,t,o)}return t._=n.commands.concat(t._.map(a=>""+a)),this.postProcessPositionals(t,o,this.cmdToParseOptions(e.original),r),o}populatePositional(e,t,n){const r=e.cmd[0];e.variadic?n[r]=t._.splice(0).map(String):t._.length&&(n[r]=[String(t._.shift())])}cmdToParseOptions(e){const t={array:[],default:{},alias:{},demand:{}},n=kt(e);return n.demanded.forEach(r=>{const[u,...s]=r.cmd;r.variadic&&(t.array.push(u),t.default[u]=[]),t.alias[u]=s,t.demand[u]=!0}),n.optional.forEach(r=>{const[u,...s]=r.cmd;r.variadic&&(t.array.push(u),t.default[u]=[]),t.alias[u]=s}),t}postProcessPositionals(e,t,n,r){const u=Object.assign({},r.getOptions());u.default=Object.assign(n.default,u.default);for(const l of Object.keys(n.alias))u.alias[l]=(u.alias[l]||[]).concat(n.alias[l]);u.array=u.array.concat(n.array),u.config={};const s=[];if(Object.keys(t).forEach(l=>{t[l].map(f=>{u.configuration["unknown-options-as-args"]&&(u.key[l]=!0),s.push(`--${l}`),s.push(f)})}),!s.length)return;const o=Object.assign({},u.configuration,{"populate--":!1}),a=this.shim.Parser.detailed(s,Object.assign({},u,{configuration:o}));if(a.error)r.getInternalMethods().getUsageInstance().fail(a.error.message,a.error);else{const l=Object.keys(t);Object.keys(t).forEach(f=>{l.push(...a.aliases[f])}),Object.keys(a.argv).forEach(f=>{l.includes(f)&&(t[f]||(t[f]=a.argv[f]),!this.isInConfigs(r,f)&&!this.isDefaulted(r,f)&&Object.prototype.hasOwnProperty.call(e,f)&&Object.prototype.hasOwnProperty.call(a.argv,f)&&(Array.isArray(e[f])||Array.isArray(a.argv[f]))?e[f]=[].concat(e[f],a.argv[f]):e[f]=a.argv[f])})}}isDefaulted(e,t){const{default:n}=e.getOptions();return Object.prototype.hasOwnProperty.call(n,t)||Object.prototype.hasOwnProperty.call(n,this.shim.Parser.camelCase(t))}isInConfigs(e,t){const{configObjects:n}=e.getOptions();return n.some(r=>Object.prototype.hasOwnProperty.call(r,t))||n.some(r=>Object.prototype.hasOwnProperty.call(r,this.shim.Parser.camelCase(t)))}runDefaultBuilderOn(e){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(e)){const n=vt.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");e.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}const t=this.defaultCommand.builder;if(Vn(t))return t(e,!0);br(t)||Object.keys(t).forEach(n=>{e.option(n,t[n])})}moduleName(e){const t=uo(e);if(!t)throw new Error(`No command name given for module: ${this.shim.inspect(e)}`);return this.commandFromFilename(t.filename)}commandFromFilename(e){return this.shim.path.basename(e,this.shim.path.extname(e))}extractDesc({describe:e,description:t,desc:n}){for(const r of[e,t,n]){if(typeof r=="string"||r===!1)return r;ze(r,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){const e=this.frozens.pop();ze(e,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=e}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}}function ao(i,e,t,n){return new oo(i,e,t,n)}function br(i){return typeof i=="object"&&!!i.builder&&typeof i.handler=="function"}function co(i){return i.every(e=>typeof e=="string")}function Vn(i){return typeof i=="function"}function lo(i){return typeof i=="object"}function fo(i){return typeof i=="object"&&!Array.isArray(i)}function Wt(i={},e=()=>!0){const t={};return on(i).forEach(n=>{e(n,i[n])&&(t[n]=i[n])}),t}function Gt(i){typeof process>"u"||[process.stdout,process.stderr].forEach(e=>{const t=e;t._handle&&t.isTTY&&typeof t._handle.setBlocking=="function"&&t._handle.setBlocking(i)})}function po(i){return typeof i=="boolean"}function ho(i,e){const t=e.y18n.__,n={},r=[];n.failFn=function(L){r.push(L)};let u=null,s=null,o=!0;n.showHelpOnFail=function(L=!0,v){const[H,V]=typeof L=="string"?[!0,L]:[L,v];return i.getInternalMethods().isGlobalContext()&&(s=V),u=V,o=H,n};let a=!1;n.fail=function(L,v){const H=i.getInternalMethods().getLoggerInstance();if(r.length)for(let V=r.length-1;V>=0;--V){const X=r[V];if(po(X)){if(v)throw v;if(L)throw Error(L)}else X(L,v,n)}else{if(i.getExitProcess()&&Gt(!0),!a){a=!0,o&&(i.showHelp("error"),H.error()),(L||v)&&H.error(L||v);const V=u||s;V&&((L||v)&&H.error(""),H.error(V))}if(v=v||new Fe(L),i.getExitProcess())return i.exit(1);if(i.getInternalMethods().hasParseCallback())return i.exit(1,v);throw v}};let l=[],f=!1;n.usage=(j,L)=>j===null?(f=!0,l=[],n):(f=!1,l.push([j,L||""]),n),n.getUsage=()=>l,n.getUsageDisabled=()=>f,n.getPositionalGroupName=()=>t("Positionals:");let d=[];n.example=(j,L)=>{d.push([j,L||""])};let c=[];n.command=function(L,v,H,V,X=!1){H&&(c=c.map(U=>(U[2]=!1,U))),c.push([L,v||"",H,V,X])},n.getCommands=()=>c;let A={};n.describe=function(L,v){Array.isArray(L)?L.forEach(H=>{n.describe(H,v)}):typeof L=="object"?Object.keys(L).forEach(H=>{n.describe(H,L[H])}):A[L]=v},n.getDescriptions=()=>A;let F=[];n.epilog=j=>{F.push(j)};let w=!1,h;n.wrap=j=>{w=!0,h=j},n.getWrap=()=>e.getEnv("YARGS_DISABLE_WRAP")?null:(w||(h=W(),w=!0),h);const E="__yargsString__:";n.deferY18nLookup=j=>E+j,n.help=function(){if(_)return _;C();const L=i.customScriptName?i.$0:e.path.basename(i.$0),v=i.getDemandedOptions(),H=i.getDemandedCommands(),V=i.getDeprecatedOptions(),X=i.getGroups(),U=i.getOptions();let re=[];re=re.concat(Object.keys(A)),re=re.concat(Object.keys(v)),re=re.concat(Object.keys(H)),re=re.concat(Object.keys(U.default)),re=re.filter(M),re=Object.keys(re.reduce((b,K)=>(K!=="_"&&(b[K]=!0),b),{}));const be=n.getWrap(),ne=e.cliui({width:be,wrap:!!be});if(!f){if(l.length)l.forEach(b=>{ne.div({text:`${b[0].replace(/\$0/g,L)}`}),b[1]&&ne.div({text:`${b[1]}`,padding:[1,0,0,0]})}),ne.div();else if(c.length){let b=null;H._?b=`${L} <${t("command")}>
|
|
7
|
+
`),r+=i.charAt(u);return t&&n&&(r=`${t}${r}${n}`),r}function Tu(i){return Pu(i,{stringWidth:e=>[...e].length,stripAnsi:lr,wrap:ju})}function Mu(i,e){let t=je(".",i),n;for(Xi(t).isDirectory()||(t=Nn(t));;){if(n=e(t,pu(t)),n)return je(t,n);if(t=Nn(n=t),n===t)break}}function jt(i){if(i!==i.toLowerCase()&&i!==i.toUpperCase()||(i=i.toLowerCase()),i.indexOf("-")===-1&&i.indexOf("_")===-1)return i;{let t="",n=!1;const r=i.match(/^-+/);for(let u=r?r[0].length:0;u<i.length;u++){let s=i.charAt(u);n&&(n=!1,s=s.toUpperCase()),u!==0&&(s==="-"||s==="_")?n=!0:s!=="-"&&s!=="_"&&(t+=s)}return t}}function fr(i,e){const t=i.toLowerCase();e=e||"-";let n="";for(let r=0;r<i.length;r++){const u=t.charAt(r),s=i.charAt(r);u!==s&&r>0?n+=`${e}${t.charAt(r)}`:n+=s}return n}function dr(i){return i==null?!1:typeof i=="number"||/^0x[0-9a-f]+$/i.test(i)?!0:/^0[^.]/.test(i)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(i)}function ku(i){if(Array.isArray(i))return i.map(s=>typeof s!="string"?s+"":s);i=i.trim();let e=0,t=null,n=null,r=null;const u=[];for(let s=0;s<i.length;s++){if(t=n,n=i.charAt(s),n===" "&&!r){t!==" "&&e++;continue}n===r?r=null:(n==="'"||n==='"')&&!r&&(r=n),u[e]||(u[e]=""),u[e]+=n}return u}var Ge;(function(i){i.BOOLEAN="boolean",i.STRING="string",i.NUMBER="number",i.ARRAY="array"})(Ge||(Ge={}));let Ze;class Hu{constructor(e){Ze=e}parse(e,t){const n=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},t),r=ku(e),u=typeof e=="string",s=Uu(Object.assign(Object.create(null),n.alias)),o=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},n.configuration),a=Object.assign(Object.create(null),n.default),l=n.configObjects||[],f=n.envPrefix,d=o["populate--"],c=d?"--":"_",A=Object.create(null),F=Object.create(null),w=n.__||Ze.format,h={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},E=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,x=new RegExp("^--"+o["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(m){const D=typeof m=="object"?m.key:m,P=Object.keys(m).map(function(B){return{boolean:"bools",string:"strings",number:"numbers"}[B]}).filter(Boolean).pop();P&&(h[P][D]=!0),h.arrays[D]=!0,h.keys.push(D)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(m){h.bools[m]=!0,h.keys.push(m)}),[].concat(n.string||[]).filter(Boolean).forEach(function(m){h.strings[m]=!0,h.keys.push(m)}),[].concat(n.number||[]).filter(Boolean).forEach(function(m){h.numbers[m]=!0,h.keys.push(m)}),[].concat(n.count||[]).filter(Boolean).forEach(function(m){h.counts[m]=!0,h.keys.push(m)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(m){h.normalize[m]=!0,h.keys.push(m)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([m,D])=>{typeof D=="number"&&(h.nargs[m]=D,h.keys.push(m))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([m,D])=>{typeof D=="function"&&(h.coercions[m]=D,h.keys.push(m))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(m){h.configs[m]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([m,D])=>{(typeof D=="boolean"||typeof D=="function")&&(h.configs[m]=D)})),_e(n.key,s,n.default,h.arrays),Object.keys(a).forEach(function(m){(h.aliases[m]||[]).forEach(function(D){a[D]=a[m]})});let C=null;Oe();let _=[];const y=Object.assign(Object.create(null),{_:[]}),M={};for(let m=0;m<r.length;m++){const D=r[m],P=D.replace(/^-{3,}/,"---");let B,g,k,S,T,oe;if(D!=="--"&&/^-/.test(D)&&Y(D))R(D);else if(P.match(/^---+(=|$)/)){R(D);continue}else if(D.match(/^--.+=/)||!o["short-option-groups"]&&D.match(/^-.+=/))S=D.match(/^--?([^=]+)=([\s\S]*)$/),S!==null&&Array.isArray(S)&&S.length>=3&&(q(S[1],h.arrays)?m=z(m,S[1],r,S[2]):q(S[1],h.nargs)!==!1?m=W(m,S[1],r,S[2]):G(S[1],S[2],!0));else if(D.match(x)&&o["boolean-negation"])S=D.match(x),S!==null&&Array.isArray(S)&&S.length>=2&&(g=S[1],G(g,q(g,h.arrays)?[!1]:!1));else if(D.match(/^--.+/)||!o["short-option-groups"]&&D.match(/^-[^-]+/))S=D.match(/^--?(.+)/),S!==null&&Array.isArray(S)&&S.length>=2&&(g=S[1],q(g,h.arrays)?m=z(m,g,r):q(g,h.nargs)!==!1?m=W(m,g,r):(T=r[m+1],T!==void 0&&(!T.match(/^-/)||T.match(E))&&!q(g,h.bools)&&!q(g,h.counts)||/^(true|false)$/.test(T)?(G(g,T),m++):G(g,pe(g))));else if(D.match(/^-.\..+=/))S=D.match(/^-([^=]+)=([\s\S]*)$/),S!==null&&Array.isArray(S)&&S.length>=3&&G(S[1],S[2]);else if(D.match(/^-.\..+/)&&!D.match(E))T=r[m+1],S=D.match(/^-(.\..+)/),S!==null&&Array.isArray(S)&&S.length>=2&&(g=S[1],T!==void 0&&!T.match(/^-/)&&!q(g,h.bools)&&!q(g,h.counts)?(G(g,T),m++):G(g,pe(g)));else if(D.match(/^-[^-]+/)&&!D.match(E)){k=D.slice(1,-1).split(""),B=!1;for(let he=0;he<k.length;he++){if(T=D.slice(he+2),k[he+1]&&k[he+1]==="="){oe=D.slice(he+3),g=k[he],q(g,h.arrays)?m=z(m,g,r,oe):q(g,h.nargs)!==!1?m=W(m,g,r,oe):G(g,oe),B=!0;break}if(T==="-"){G(k[he],T);continue}if(/[A-Za-z]/.test(k[he])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(T)&&q(T,h.bools)===!1){G(k[he],T),B=!0;break}if(k[he+1]&&k[he+1].match(/\W/)){G(k[he],T),B=!0;break}else G(k[he],pe(k[he]))}g=D.slice(-1)[0],!B&&g!=="-"&&(q(g,h.arrays)?m=z(m,g,r):q(g,h.nargs)!==!1?m=W(m,g,r):(T=r[m+1],T!==void 0&&(!/^(-|--)[^-]/.test(T)||T.match(E))&&!q(g,h.bools)&&!q(g,h.counts)||/^(true|false)$/.test(T)?(G(g,T),m++):G(g,pe(g))))}else if(D.match(/^-[0-9]$/)&&D.match(E)&&q(D.slice(1),h.bools))g=D.slice(1),G(g,pe(g));else if(D==="--"){_=r.slice(m+1);break}else if(o["halt-at-non-option"]){_=r.slice(m);break}else R(D)}U(y,!0),U(y,!1),H(y),X(),ne(y,h.aliases,a,!0),re(y),o["set-placeholder-key"]&&be(y),Object.keys(h.counts).forEach(function(m){$(y,m.split("."))||G(m,0)}),d&&_.length&&(y[c]=[]),_.forEach(function(m){y[c].push(m)}),o["camel-case-expansion"]&&o["strip-dashed"]&&Object.keys(y).filter(m=>m!=="--"&&m.includes("-")).forEach(m=>{delete y[m]}),o["strip-aliased"]&&[].concat(...Object.keys(s).map(m=>s[m])).forEach(m=>{o["camel-case-expansion"]&&m.includes("-")&&delete y[m.split(".").map(D=>jt(D)).join(".")],delete y[m]});function R(m){const D=v("_",m);(typeof D=="string"||typeof D=="number")&&y._.push(D)}function W(m,D,P,B){let g,k=q(D,h.nargs);if(k=typeof k!="number"||isNaN(k)?1:k,k===0)return $e(B)||(C=Error(w("Argument unexpected for: %s",D))),G(D,pe(D)),m;let S=$e(B)?0:1;if(o["nargs-eats-options"])P.length-(m+1)+S<k&&(C=Error(w("Not enough arguments following: %s",D))),S=k;else{for(g=m+1;g<P.length&&(!P[g].match(/^-[^0-9]/)||P[g].match(E)||Y(P[g]));g++)S++;S<k&&(C=Error(w("Not enough arguments following: %s",D)))}let T=Math.min(S,k);for(!$e(B)&&T>0&&(G(D,B),T--),g=m+1;g<T+m+1;g++)G(D,P[g]);return m+T}function z(m,D,P,B){let g=[],k=B||P[m+1];const S=q(D,h.nargs);if(q(D,h.bools)&&!/^(true|false)$/.test(k))g.push(!0);else if($e(k)||$e(B)&&/^-/.test(k)&&!E.test(k)&&!Y(k)){if(a[D]!==void 0){const T=a[D];g=Array.isArray(T)?T:[T]}}else{$e(B)||g.push(L(D,B,!0));for(let T=m+1;T<P.length&&!(!o["greedy-arrays"]&&g.length>0||S&&typeof S=="number"&&g.length>=S||(k=P[T],/^-/.test(k)&&!E.test(k)&&!Y(k)));T++)m=T,g.push(L(D,k,u))}return typeof S=="number"&&(S&&g.length<S||isNaN(S)&&g.length===0)&&(C=Error(w("Not enough arguments following: %s",D))),G(D,g),m}function G(m,D,P=u){if(/-/.test(m)&&o["camel-case-expansion"]){const k=m.split(".").map(function(S){return jt(S)}).join(".");j(m,k)}const B=L(m,D,P),g=m.split(".");ge(y,g,B),h.aliases[m]&&h.aliases[m].forEach(function(k){const S=k.split(".");ge(y,S,B)}),g.length>1&&o["dot-notation"]&&(h.aliases[g[0]]||[]).forEach(function(k){let S=k.split(".");const T=[].concat(g);T.shift(),S=S.concat(T),(h.aliases[m]||[]).includes(S.join("."))||ge(y,S,B)}),q(m,h.normalize)&&!q(m,h.arrays)&&[m].concat(h.aliases[m]||[]).forEach(function(S){Object.defineProperty(M,S,{enumerable:!0,get(){return D},set(T){D=typeof T=="string"?Ze.normalize(T):T}})})}function j(m,D){h.aliases[m]&&h.aliases[m].length||(h.aliases[m]=[D],A[D]=!0),h.aliases[D]&&h.aliases[D].length||j(D,m)}function L(m,D,P){P&&(D=Wu(D)),(q(m,h.bools)||q(m,h.counts))&&typeof D=="string"&&(D=D==="true");let B=Array.isArray(D)?D.map(function(g){return v(m,g)}):v(m,D);return q(m,h.counts)&&($e(B)||typeof B=="boolean")&&(B=Hn()),q(m,h.normalize)&&q(m,h.arrays)&&(Array.isArray(D)?B=D.map(g=>Ze.normalize(g)):B=Ze.normalize(D)),B}function v(m,D){return!o["parse-positional-numbers"]&&m==="_"||!q(m,h.strings)&&!q(m,h.bools)&&!Array.isArray(D)&&(dr(D)&&o["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${D}`)))||!$e(D)&&q(m,h.numbers))&&(D=Number(D)),D}function H(m){const D=Object.create(null);ne(D,h.aliases,a),Object.keys(h.configs).forEach(function(P){const B=m[P]||D[P];if(B)try{let g=null;const k=Ze.resolve(Ze.cwd(),B),S=h.configs[P];if(typeof S=="function"){try{g=S(k)}catch(T){g=T}if(g instanceof Error){C=g;return}}else g=Ze.require(k);V(g)}catch(g){g.name==="PermissionDenied"?C=g:m[P]&&(C=Error(w("Invalid JSON config file: %s",B)))}})}function V(m,D){Object.keys(m).forEach(function(P){const B=m[P],g=D?D+"."+P:P;typeof B=="object"&&B!==null&&!Array.isArray(B)&&o["dot-notation"]?V(B,g):(!$(y,g.split("."))||q(g,h.arrays)&&o["combine-arrays"])&&G(g,B)})}function X(){typeof l<"u"&&l.forEach(function(m){V(m)})}function U(m,D){if(typeof f>"u")return;const P=typeof f=="string"?f:"",B=Ze.env();Object.keys(B).forEach(function(g){if(P===""||g.lastIndexOf(P,0)===0){const k=g.split("__").map(function(S,T){return T===0&&(S=S.substring(P.length)),jt(S)});(D&&h.configs[k.join(".")]||!D)&&!$(m,k)&&G(k.join("."),B[g])}})}function re(m){let D;const P=new Set;Object.keys(m).forEach(function(B){if(!P.has(B)&&(D=q(B,h.coercions),typeof D=="function"))try{const g=v(B,D(m[B]));[].concat(h.aliases[B]||[],B).forEach(k=>{P.add(k),m[k]=g})}catch(g){C=g}})}function be(m){return h.keys.forEach(D=>{~D.indexOf(".")||typeof m[D]>"u"&&(m[D]=void 0)}),m}function ne(m,D,P,B=!1){Object.keys(P).forEach(function(g){$(m,g.split("."))||(ge(m,g.split("."),P[g]),B&&(F[g]=!0),(D[g]||[]).forEach(function(k){$(m,k.split("."))||ge(m,k.split("."),P[g])}))})}function $(m,D){let P=m;o["dot-notation"]||(D=[D.join(".")]),D.slice(0,-1).forEach(function(g){P=P[g]||{}});const B=D[D.length-1];return typeof P!="object"?!1:B in P}function ge(m,D,P){let B=m;o["dot-notation"]||(D=[D.join(".")]),D.slice(0,-1).forEach(function(oe){oe=pr(oe),typeof B=="object"&&B[oe]===void 0&&(B[oe]={}),typeof B[oe]!="object"||Array.isArray(B[oe])?(Array.isArray(B[oe])?B[oe].push({}):B[oe]=[B[oe],{}],B=B[oe][B[oe].length-1]):B=B[oe]});const g=pr(D[D.length-1]),k=q(D.join("."),h.arrays),S=Array.isArray(P);let T=o["duplicate-arguments-array"];!T&&q(g,h.nargs)&&(T=!0,(!$e(B[g])&&h.nargs[g]===1||Array.isArray(B[g])&&B[g].length===h.nargs[g])&&(B[g]=void 0)),P===Hn()?B[g]=Hn(B[g]):Array.isArray(B[g])?T&&k&&S?B[g]=o["flatten-duplicate-arrays"]?B[g].concat(P):(Array.isArray(B[g][0])?B[g]:[B[g]]).concat([P]):!T&&!!k==!!S?B[g]=P:B[g]=B[g].concat([P]):B[g]===void 0&&k?B[g]=S?P:[P]:T&&!(B[g]===void 0||q(g,h.counts)||q(g,h.bools))?B[g]=[B[g],P]:B[g]=P}function _e(...m){m.forEach(function(D){Object.keys(D||{}).forEach(function(P){h.aliases[P]||(h.aliases[P]=[].concat(s[P]||[]),h.aliases[P].concat(P).forEach(function(B){if(/-/.test(B)&&o["camel-case-expansion"]){const g=jt(B);g!==P&&h.aliases[P].indexOf(g)===-1&&(h.aliases[P].push(g),A[g]=!0)}}),h.aliases[P].concat(P).forEach(function(B){if(B.length>1&&/[A-Z]/.test(B)&&o["camel-case-expansion"]){const g=fr(B,"-");g!==P&&h.aliases[P].indexOf(g)===-1&&(h.aliases[P].push(g),A[g]=!0)}}),h.aliases[P].forEach(function(B){h.aliases[B]=[P].concat(h.aliases[P].filter(function(g){return B!==g}))}))})})}function q(m,D){const P=[].concat(h.aliases[m]||[],m),B=Object.keys(D),g=P.find(k=>B.includes(k));return g?D[g]:!1}function I(m){const D=Object.keys(h);return[].concat(D.map(B=>h[B])).some(function(B){return Array.isArray(B)?B.includes(m):B[m]})}function b(m,...D){return[].concat(...D).some(function(B){const g=m.match(B);return g&&I(g[1])})}function K(m){if(m.match(E)||!m.match(/^-[^-]+/))return!1;let D=!0,P;const B=m.slice(1).split("");for(let g=0;g<B.length;g++){if(P=m.slice(g+2),!I(B[g])){D=!1;break}if(B[g+1]&&B[g+1]==="="||P==="-"||/[A-Za-z]/.test(B[g])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(P)||B[g+1]&&B[g+1].match(/\W/))break}return D}function Y(m){return o["unknown-options-as-args"]&&ee(m)}function ee(m){return m=m.replace(/^-{3,}/,"--"),m.match(E)||K(m)?!1:!b(m,/^-+([^=]+?)=[\s\S]*$/,x,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function pe(m){return!q(m,h.bools)&&!q(m,h.counts)&&`${m}`in a?a[m]:se(de(m))}function se(m){return{[Ge.BOOLEAN]:!0,[Ge.STRING]:"",[Ge.NUMBER]:void 0,[Ge.ARRAY]:[]}[m]}function de(m){let D=Ge.BOOLEAN;return q(m,h.strings)?D=Ge.STRING:q(m,h.numbers)?D=Ge.NUMBER:q(m,h.bools)?D=Ge.BOOLEAN:q(m,h.arrays)&&(D=Ge.ARRAY),D}function $e(m){return m===void 0}function Oe(){Object.keys(h.counts).find(m=>q(m,h.arrays)?(C=Error(w("Invalid configuration: %s, opts.count excludes opts.array.",m)),!0):q(m,h.nargs)?(C=Error(w("Invalid configuration: %s, opts.count excludes opts.narg.",m)),!0):!1)}return{aliases:Object.assign({},h.aliases),argv:Object.assign(M,y),configuration:o,defaulted:Object.assign({},F),error:C,newAliases:Object.assign({},A)}}}function Uu(i){const e=[],t=Object.create(null);let n=!0;for(Object.keys(i).forEach(function(r){e.push([].concat(i[r],r))});n;){n=!1;for(let r=0;r<e.length;r++)for(let u=r+1;u<e.length;u++)if(e[r].filter(function(o){return e[u].indexOf(o)!==-1}).length){e[r]=e[r].concat(e[u]),e.splice(u,1),n=!0;break}}return e.forEach(function(r){r=r.filter(function(s,o,a){return a.indexOf(s)===o});const u=r.pop();u!==void 0&&typeof u=="string"&&(t[u]=r)}),t}function Hn(i){return i!==void 0?i+1:1}function pr(i){return i==="__proto__"?"___proto___":i}function Wu(i){return typeof i=="string"&&(i[0]==="'"||i[0]==='"')&&i[i.length-1]===i[0]?i.substring(1,i.length-1):i}var Un,Wn,Gn;const hr=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,gr=(Wn=(Un=process==null?void 0:process.versions)===null||Un===void 0?void 0:Un.node)!==null&&Wn!==void 0?Wn:(Gn=process==null?void 0:process.version)===null||Gn===void 0?void 0:Gn.slice(1);if(gr&&Number(gr.match(/^([^.]+)/)[1])<hr)throw Error(`yargs parser supports a minimum Node.js version of ${hr}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const Gu=process?process.env:{},mr=new Hu({cwd:process.cwd,env:()=>Gu,format:er,normalize:cu,resolve:je,require:i=>{if(typeof require<"u")return require(i);if(i.match(/\.json$/))return JSON.parse(Pn(i,"utf8"));throw Error("only .json config files are supported in ESM")}}),Tt=function(e,t){return mr.parse(e.slice(),t).argv};Tt.detailed=function(i,e){return mr.parse(i.slice(),e)},Tt.camelCase=jt,Tt.decamelize=fr,Tt.looksLikeNumber=dr;function Dr(){return Vu()?0:1}function Vu(){return zu()&&!process.defaultApp}function zu(){return!!process.versions.electron}function qu(i){return i.slice(Dr()+1)}function Ku(){return process.argv[Dr()]}class Fe extends Error{constructor(e){super(e||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,Fe)}}const Yu={fs:{readFileSync:Pn,writeFile:hu},format:er,resolve:je,exists:i=>{try{return Xi(i).isFile()}catch{return!1}}};let Ve;class Ju{constructor(e){e=e||{},this.directory=e.directory||"./locales",this.updateFiles=typeof e.updateFiles=="boolean"?e.updateFiles:!0,this.locale=e.locale||"en",this.fallbackToLanguage=typeof e.fallbackToLanguage=="boolean"?e.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...e){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);const t=e.shift();let n=function(){};return typeof e[e.length-1]=="function"&&(n=e.pop()),n=n||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][t]&&this.updateFiles?(this.cache[this.locale][t]=t,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),Ve.format.apply(Ve.format,[this.cache[this.locale][t]||t].concat(e))}__n(){const e=Array.prototype.slice.call(arguments),t=e.shift(),n=e.shift(),r=e.shift();let u=function(){};typeof e[e.length-1]=="function"&&(u=e.pop()),this.cache[this.locale]||this._readLocaleFile();let s=r===1?t:n;this.cache[this.locale][t]&&(s=this.cache[this.locale][t][r===1?"one":"other"]),!this.cache[this.locale][t]&&this.updateFiles?(this.cache[this.locale][t]={one:t,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:u})):u();const o=[s];return~s.indexOf("%d")&&o.push(r),Ve.format.apply(Ve.format,o.concat(e))}setLocale(e){this.locale=e}getLocale(){return this.locale}updateLocale(e){this.cache[this.locale]||this._readLocaleFile();for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(this.cache[this.locale][t]=e[t])}_taggedLiteral(e,...t){let n="";return e.forEach(function(r,u){const s=t[u+1];n+=r,typeof s<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(t,1)))}_enqueueWrite(e){this.writeQueue.push(e),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){const e=this,t=this.writeQueue[0],n=t.directory,r=t.locale,u=t.cb,s=this._resolveLocaleFile(n,r),o=JSON.stringify(this.cache[r],null,2);Ve.fs.writeFile(s,o,"utf-8",function(a){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),u(a)})}_readLocaleFile(){let e={};const t=this._resolveLocaleFile(this.directory,this.locale);try{Ve.fs.readFileSync&&(e=JSON.parse(Ve.fs.readFileSync(t,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+t),n.code==="ENOENT")e={};else throw n}this.cache[this.locale]=e}_resolveLocaleFile(e,t){let n=Ve.resolve(e,"./",t+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~t.lastIndexOf("_")){const r=Ve.resolve(e,"./",t.split("_")[0]+".json");this._fileExistsSync(r)&&(n=r)}return n}_fileExistsSync(e){return Ve.exists(e)}}function Qu(i,e){Ve=e;const t=new Ju(i);return{__:t.__.bind(t),__n:t.__n.bind(t),setLocale:t.setLocale.bind(t),getLocale:t.getLocale.bind(t),updateLocale:t.updateLocale.bind(t),locale:t.locale}}const Xu=i=>Qu(i,Yu),Zu="require is not supported by ESM",Cr="loading a directory of commands is not supported yet for ESM";let Mt;try{Mt=mu(import.meta.url)}catch{Mt=process.cwd()}const eo=Mt.substring(0,Mt.lastIndexOf("node_modules")),to={assert:{notStrictEqual:au,strictEqual:ou},cliui:Tu,findUp:Mu,getEnv:i=>process.env[i],inspect:gu,getCallerFile:()=>{throw new Fe(Cr)},getProcessArgvBin:Ku,mainFilename:eo||process.cwd(),Parser:Tt,path:{basename:du,dirname:Nn,extname:fu,relative:lu,resolve:je},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(i,e)=>process.emitWarning(i,e),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:Pn,require:()=>{throw new Fe(Zu)},requireDirectory:()=>{throw new Fe(Cr)},stringWidth:i=>[...i].length,y18n:Xu({directory:je(Mt,"../../../locales"),updateFiles:!1})};function ze(i,e,t,n){t.assert.notStrictEqual(i,e,n)}function Ar(i,e){e.assert.strictEqual(typeof i,"string")}function on(i){return Object.keys(i)}function ye(i){return!!i&&!!i.then&&typeof i.then=="function"}function kt(i){const t=i.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,r=t.shift();if(!r)throw new Error(`No command found in: ${i}`);const u={cmd:r.replace(n,""),demanded:[],optional:[]};return t.forEach((s,o)=>{let a=!1;s=s.replace(/\s/g,""),/\.+[\]>]/.test(s)&&o===t.length-1&&(a=!0),/^\[/.test(s)?u.optional.push({cmd:s.replace(n,"").split("|"),variadic:a}):u.demanded.push({cmd:s.replace(n,"").split("|"),variadic:a})}),u}const no=["first","second","third","fourth","fifth","sixth"];function Q(i,e,t){function n(){return typeof i=="object"?[{demanded:[],optional:[]},i,e]:[kt(`cmd ${i}`),e,t]}try{let r=0;const[u,s,o]=n(),a=[].slice.call(s);for(;a.length&&a[a.length-1]===void 0;)a.pop();const l=o||a.length;if(l<u.demanded.length)throw new Fe(`Not enough arguments provided. Expected ${u.demanded.length} but received ${a.length}.`);const f=u.demanded.length+u.optional.length;if(l>f)throw new Fe(`Too many arguments provided. Expected max ${f} but received ${l}.`);u.demanded.forEach(d=>{const c=a.shift(),A=Er(c);d.cmd.filter(w=>w===A||w==="*").length===0&&wr(A,d.cmd,r),r+=1}),u.optional.forEach(d=>{if(a.length===0)return;const c=a.shift(),A=Er(c);d.cmd.filter(w=>w===A||w==="*").length===0&&wr(A,d.cmd,r),r+=1})}catch(r){console.warn(r.stack)}}function Er(i){return Array.isArray(i)?"array":i===null?"null":typeof i}function wr(i,e,t){throw new Fe(`Invalid ${no[t]||"manyith"} argument. Expected ${e.join(" or ")} but received ${i}.`)}class io{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,t,n=!0,r=!1){if(Q("<array|function> [boolean] [boolean] [boolean]",[e,t,n],arguments.length),Array.isArray(e)){for(let u=0;u<e.length;u++){if(typeof e[u]!="function")throw Error("middleware must be a function");const s=e[u];s.applyBeforeValidation=t,s.global=n}Array.prototype.push.apply(this.globalMiddleware,e)}else if(typeof e=="function"){const u=e;u.applyBeforeValidation=t,u.global=n,u.mutates=r,this.globalMiddleware.push(e)}return this.yargs}addCoerceMiddleware(e,t){const n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(r=>{const u=[...n[t]||[],t];return r.option?!u.includes(r.option):!0}),e.option=t,this.addMiddleware(e,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){const e=this.frozens.pop();e!==void 0&&(this.globalMiddleware=e)}reset(){this.globalMiddleware=this.globalMiddleware.filter(e=>e.global)}}function ro(i){return i?i.map(e=>(e.applyBeforeValidation=!1,e)):[]}function Ht(i,e,t,n){return t.reduce((r,u)=>{if(u.applyBeforeValidation!==n)return r;if(u.mutates){if(u.applied)return r;u.applied=!0}if(ye(r))return r.then(s=>Promise.all([s,u(s,e)])).then(([s,o])=>Object.assign(s,o));{const s=u(r,e);return ye(s)?s.then(o=>Object.assign(r,o)):Object.assign(r,s)}},i)}function Ut(i,e,t=n=>{throw n}){try{const n=so(i)?i():i;return ye(n)?n.then(r=>e(r)):e(n)}catch(n){return t(n)}}function so(i){return typeof i=="function"}function uo(i){if(typeof require>"u")return null;for(let e=0,t=Object.keys(require.cache),n;e<t.length;e++)if(n=require.cache[t[e]],n.exports===i)return n;return null}const vt=/(^\*)|(^\$0)/;class oo{constructor(e,t,n,r){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=r,this.usage=e,this.globalMiddleware=n,this.validation=t}addDirectory(e,t,n,r){r=r||{},typeof r.recurse!="boolean"&&(r.recurse=!1),Array.isArray(r.extensions)||(r.extensions=["js"]);const u=typeof r.visit=="function"?r.visit:s=>s;r.visit=(s,o,a)=>{const l=u(s,o,a);if(l){if(this.requireCache.has(o))return l;this.requireCache.add(o),this.addHandler(l)}return l},this.shim.requireDirectory({require:t,filename:n},e,r)}addHandler(e,t,n,r,u,s){let o=[];const a=ro(u);if(r=r||(()=>{}),Array.isArray(e))if(co(e))[e,...o]=e;else for(const l of e)this.addHandler(l);else if(fo(e)){let l=Array.isArray(e.command)||typeof e.command=="string"?e.command:this.moduleName(e);e.aliases&&(l=[].concat(l).concat(e.aliases)),this.addHandler(l,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated);return}else if(br(n)){this.addHandler([e].concat(o),t,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof e=="string"){const l=kt(e);o=o.map(c=>kt(c).cmd);let f=!1;const d=[l.cmd].concat(o).filter(c=>vt.test(c)?(f=!0,!1):!0);d.length===0&&f&&d.push("$0"),f&&(l.cmd=d[0],o=d.slice(1),e=e.replace(vt,l.cmd)),o.forEach(c=>{this.aliasMap[c]=l.cmd}),t!==!1&&this.usage.command(e,t,f,o,s),this.handlers[l.cmd]={original:e,description:t,handler:r,builder:n||{},middlewares:a,deprecated:s,demanded:l.demanded,optional:l.optional},f&&(this.defaultCommand=this.handlers[l.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(e,t,n,r,u,s){const o=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand,a=t.getInternalMethods().getContext(),l=a.commands.slice(),f=!e;e&&(a.commands.push(e),a.fullCommands.push(o.original));const d=this.applyBuilderUpdateUsageAndParse(f,o,t,n.aliases,l,r,u,s);return ye(d)?d.then(c=>this.applyMiddlewareAndGetResult(f,o,c.innerArgv,a,u,c.aliases,t)):this.applyMiddlewareAndGetResult(f,o,d.innerArgv,a,u,d.aliases,t)}applyBuilderUpdateUsageAndParse(e,t,n,r,u,s,o,a){const l=t.builder;let f=n;if(Vn(l)){n.getInternalMethods().getUsageInstance().freeze();const d=l(n.getInternalMethods().reset(r),a);if(ye(d))return d.then(c=>(f=xo(c)?c:n,this.parseAndUpdateUsage(e,t,f,u,s,o)))}else lo(l)&&(n.getInternalMethods().getUsageInstance().freeze(),f=n.getInternalMethods().reset(r),Object.keys(t.builder).forEach(d=>{f.option(d,l[d])}));return this.parseAndUpdateUsage(e,t,f,u,s,o)}parseAndUpdateUsage(e,t,n,r,u,s){e&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(r,t),t.description);const o=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,u,s);return ye(o)?o.then(a=>({aliases:n.parsed.aliases,innerArgv:a})):{aliases:n.parsed.aliases,innerArgv:o}}shouldUpdateUsage(e){return!e.getInternalMethods().getUsageInstance().getUsageDisabled()&&e.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(e,t){const n=vt.test(t.original)?t.original.replace(vt,"").trim():t.original,r=e.filter(u=>!vt.test(u));return r.push(n),`$0 ${r.join(" ")}`}handleValidationAndGetResult(e,t,n,r,u,s,o,a){if(!s.getInternalMethods().getHasOutput()){const l=s.getInternalMethods().runValidation(u,a,s.parsed.error,e);n=Ut(n,f=>(l(f),f))}if(t.handler&&!s.getInternalMethods().getHasOutput()){s.getInternalMethods().setHasOutput();const l=!!s.getOptions().configuration["populate--"];s.getInternalMethods().postProcess(n,l,!1,!1),n=Ht(n,s,o,!1),n=Ut(n,f=>{const d=t.handler(f);return ye(d)?d.then(()=>f):f}),e||s.getInternalMethods().getUsageInstance().cacheHelpMessage(),ye(n)&&!s.getInternalMethods().hasParseCallback()&&n.catch(f=>{try{s.getInternalMethods().getUsageInstance().fail(null,f)}catch{}})}return e||(r.commands.pop(),r.fullCommands.pop()),n}applyMiddlewareAndGetResult(e,t,n,r,u,s,o){let a={};if(u)return n;o.getInternalMethods().getHasOutput()||(a=this.populatePositionals(t,n,r,o));const l=this.globalMiddleware.getMiddleware().slice(0).concat(t.middlewares),f=Ht(n,o,l,!0);return ye(f)?f.then(d=>this.handleValidationAndGetResult(e,t,d,r,s,o,l,a)):this.handleValidationAndGetResult(e,t,f,r,s,o,l,a)}populatePositionals(e,t,n,r){t._=t._.slice(n.commands.length);const u=e.demanded.slice(0),s=e.optional.slice(0),o={};for(this.validation.positionalCount(u.length,t._.length);u.length;){const a=u.shift();this.populatePositional(a,t,o)}for(;s.length;){const a=s.shift();this.populatePositional(a,t,o)}return t._=n.commands.concat(t._.map(a=>""+a)),this.postProcessPositionals(t,o,this.cmdToParseOptions(e.original),r),o}populatePositional(e,t,n){const r=e.cmd[0];e.variadic?n[r]=t._.splice(0).map(String):t._.length&&(n[r]=[String(t._.shift())])}cmdToParseOptions(e){const t={array:[],default:{},alias:{},demand:{}},n=kt(e);return n.demanded.forEach(r=>{const[u,...s]=r.cmd;r.variadic&&(t.array.push(u),t.default[u]=[]),t.alias[u]=s,t.demand[u]=!0}),n.optional.forEach(r=>{const[u,...s]=r.cmd;r.variadic&&(t.array.push(u),t.default[u]=[]),t.alias[u]=s}),t}postProcessPositionals(e,t,n,r){const u=Object.assign({},r.getOptions());u.default=Object.assign(n.default,u.default);for(const l of Object.keys(n.alias))u.alias[l]=(u.alias[l]||[]).concat(n.alias[l]);u.array=u.array.concat(n.array),u.config={};const s=[];if(Object.keys(t).forEach(l=>{t[l].map(f=>{u.configuration["unknown-options-as-args"]&&(u.key[l]=!0),s.push(`--${l}`),s.push(f)})}),!s.length)return;const o=Object.assign({},u.configuration,{"populate--":!1}),a=this.shim.Parser.detailed(s,Object.assign({},u,{configuration:o}));if(a.error)r.getInternalMethods().getUsageInstance().fail(a.error.message,a.error);else{const l=Object.keys(t);Object.keys(t).forEach(f=>{l.push(...a.aliases[f])}),Object.keys(a.argv).forEach(f=>{l.includes(f)&&(t[f]||(t[f]=a.argv[f]),!this.isInConfigs(r,f)&&!this.isDefaulted(r,f)&&Object.prototype.hasOwnProperty.call(e,f)&&Object.prototype.hasOwnProperty.call(a.argv,f)&&(Array.isArray(e[f])||Array.isArray(a.argv[f]))?e[f]=[].concat(e[f],a.argv[f]):e[f]=a.argv[f])})}}isDefaulted(e,t){const{default:n}=e.getOptions();return Object.prototype.hasOwnProperty.call(n,t)||Object.prototype.hasOwnProperty.call(n,this.shim.Parser.camelCase(t))}isInConfigs(e,t){const{configObjects:n}=e.getOptions();return n.some(r=>Object.prototype.hasOwnProperty.call(r,t))||n.some(r=>Object.prototype.hasOwnProperty.call(r,this.shim.Parser.camelCase(t)))}runDefaultBuilderOn(e){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(e)){const n=vt.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");e.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}const t=this.defaultCommand.builder;if(Vn(t))return t(e,!0);br(t)||Object.keys(t).forEach(n=>{e.option(n,t[n])})}moduleName(e){const t=uo(e);if(!t)throw new Error(`No command name given for module: ${this.shim.inspect(e)}`);return this.commandFromFilename(t.filename)}commandFromFilename(e){return this.shim.path.basename(e,this.shim.path.extname(e))}extractDesc({describe:e,description:t,desc:n}){for(const r of[e,t,n]){if(typeof r=="string"||r===!1)return r;ze(r,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){const e=this.frozens.pop();ze(e,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=e}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}}function ao(i,e,t,n){return new oo(i,e,t,n)}function br(i){return typeof i=="object"&&!!i.builder&&typeof i.handler=="function"}function co(i){return i.every(e=>typeof e=="string")}function Vn(i){return typeof i=="function"}function lo(i){return typeof i=="object"}function fo(i){return typeof i=="object"&&!Array.isArray(i)}function Wt(i={},e=()=>!0){const t={};return on(i).forEach(n=>{e(n,i[n])&&(t[n]=i[n])}),t}function Gt(i){typeof process>"u"||[process.stdout,process.stderr].forEach(e=>{const t=e;t._handle&&t.isTTY&&typeof t._handle.setBlocking=="function"&&t._handle.setBlocking(i)})}function po(i){return typeof i=="boolean"}function ho(i,e){const t=e.y18n.__,n={},r=[];n.failFn=function(L){r.push(L)};let u=null,s=null,o=!0;n.showHelpOnFail=function(L=!0,v){const[H,V]=typeof L=="string"?[!0,L]:[L,v];return i.getInternalMethods().isGlobalContext()&&(s=V),u=V,o=H,n};let a=!1;n.fail=function(L,v){const H=i.getInternalMethods().getLoggerInstance();if(r.length)for(let V=r.length-1;V>=0;--V){const X=r[V];if(po(X)){if(v)throw v;if(L)throw Error(L)}else X(L,v,n)}else{if(i.getExitProcess()&&Gt(!0),!a){a=!0,o&&(i.showHelp("error"),H.error()),(L||v)&&H.error(L||v);const V=u||s;V&&((L||v)&&H.error(""),H.error(V))}if(v=v||new Fe(L),i.getExitProcess())return i.exit(1);if(i.getInternalMethods().hasParseCallback())return i.exit(1,v);throw v}};let l=[],f=!1;n.usage=(j,L)=>j===null?(f=!0,l=[],n):(f=!1,l.push([j,L||""]),n),n.getUsage=()=>l,n.getUsageDisabled=()=>f,n.getPositionalGroupName=()=>t("Positionals:");let d=[];n.example=(j,L)=>{d.push([j,L||""])};let c=[];n.command=function(L,v,H,V,X=!1){H&&(c=c.map(U=>(U[2]=!1,U))),c.push([L,v||"",H,V,X])},n.getCommands=()=>c;let A={};n.describe=function(L,v){Array.isArray(L)?L.forEach(H=>{n.describe(H,v)}):typeof L=="object"?Object.keys(L).forEach(H=>{n.describe(H,L[H])}):A[L]=v},n.getDescriptions=()=>A;let F=[];n.epilog=j=>{F.push(j)};let w=!1,h;n.wrap=j=>{w=!0,h=j},n.getWrap=()=>e.getEnv("YARGS_DISABLE_WRAP")?null:(w||(h=W(),w=!0),h);const E="__yargsString__:";n.deferY18nLookup=j=>E+j,n.help=function(){if(_)return _;C();const L=i.customScriptName?i.$0:e.path.basename(i.$0),v=i.getDemandedOptions(),H=i.getDemandedCommands(),V=i.getDeprecatedOptions(),X=i.getGroups(),U=i.getOptions();let re=[];re=re.concat(Object.keys(A)),re=re.concat(Object.keys(v)),re=re.concat(Object.keys(H)),re=re.concat(Object.keys(U.default)),re=re.filter(M),re=Object.keys(re.reduce((b,K)=>(K!=="_"&&(b[K]=!0),b),{}));const be=n.getWrap(),ne=e.cliui({width:be,wrap:!!be});if(!f){if(l.length)l.forEach(b=>{ne.div({text:`${b[0].replace(/\$0/g,L)}`}),b[1]&&ne.div({text:`${b[1]}`,padding:[1,0,0,0]})}),ne.div();else if(c.length){let b=null;H._?b=`${L} <${t("command")}>
|
|
8
8
|
`:b=`${L} [${t("command")}]
|
|
9
9
|
`,ne.div(`${b}`)}}if(c.length>1||c.length===1&&!c[0][2]){ne.div(t("Commands:"));const b=i.getInternalMethods().getContext(),K=b.commands.length?`${b.commands.join(" ")} `:"";i.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(c=c.sort((ee,pe)=>ee[0].localeCompare(pe[0])));const Y=L?`${L} `:"";c.forEach(ee=>{const pe=`${Y}${K}${ee[0].replace(/^\$0 ?/,"")}`;ne.span({text:pe,padding:[0,2,0,2],width:x(c,be,`${L}${K}`)+4},{text:ee[1]});const se=[];ee[2]&&se.push(`[${t("default")}]`),ee[3]&&ee[3].length&&se.push(`[${t("aliases:")} ${ee[3].join(", ")}]`),ee[4]&&(typeof ee[4]=="string"?se.push(`[${t("deprecated: %s",ee[4])}]`):se.push(`[${t("deprecated")}]`)),se.length?ne.div({text:se.join(" "),padding:[0,0,0,2],align:"right"}):ne.div()}),ne.div()}const $=(Object.keys(U.alias)||[]).concat(Object.keys(i.parsed.newAliases)||[]);re=re.filter(b=>!i.parsed.newAliases[b]&&$.every(K=>(U.alias[K]||[]).indexOf(b)===-1));const ge=t("Options:");X[ge]||(X[ge]=[]),y(re,U.alias,X,ge);const _e=b=>/^--/.test(an(b)),q=Object.keys(X).filter(b=>X[b].length>0).map(b=>{const K=X[b].filter(M).map(Y=>{if($.includes(Y))return Y;for(let ee=0,pe;(pe=$[ee])!==void 0;ee++)if((U.alias[pe]||[]).includes(Y))return pe;return Y});return{groupName:b,normalizedKeys:K}}).filter(({normalizedKeys:b})=>b.length>0).map(({groupName:b,normalizedKeys:K})=>{const Y=K.reduce((ee,pe)=>(ee[pe]=[pe].concat(U.alias[pe]||[]).map(se=>b===n.getPositionalGroupName()?se:(/^[0-9]$/.test(se)?U.boolean.includes(pe)?"-":"--":se.length>1?"--":"-")+se).sort((se,de)=>_e(se)===_e(de)?0:_e(se)?1:-1).join(", "),ee),{});return{groupName:b,normalizedKeys:K,switches:Y}});if(q.filter(({groupName:b})=>b!==n.getPositionalGroupName()).some(({normalizedKeys:b,switches:K})=>!b.every(Y=>_e(K[Y])))&&q.filter(({groupName:b})=>b!==n.getPositionalGroupName()).forEach(({normalizedKeys:b,switches:K})=>{b.forEach(Y=>{_e(K[Y])&&(K[Y]=go(K[Y],4))})}),q.forEach(({groupName:b,normalizedKeys:K,switches:Y})=>{ne.div(b),K.forEach(ee=>{const pe=Y[ee];let se=A[ee]||"",de=null;se.includes(E)&&(se=t(se.substring(E.length))),U.boolean.includes(ee)&&(de=`[${t("boolean")}]`),U.count.includes(ee)&&(de=`[${t("count")}]`),U.string.includes(ee)&&(de=`[${t("string")}]`),U.normalize.includes(ee)&&(de=`[${t("string")}]`),U.array.includes(ee)&&(de=`[${t("array")}]`),U.number.includes(ee)&&(de=`[${t("number")}]`);const $e=D=>typeof D=="string"?`[${t("deprecated: %s",D)}]`:`[${t("deprecated")}]`,Oe=[ee in V?$e(V[ee]):null,de,ee in v?`[${t("required")}]`:null,U.choices&&U.choices[ee]?`[${t("choices:")} ${n.stringifiedValues(U.choices[ee])}]`:null,R(U.default[ee],U.defaultDescription[ee])].filter(Boolean).join(" ");ne.span({text:an(pe),padding:[0,2,0,2+yr(pe)],width:x(Y,be)+4},se);const m=i.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;Oe&&!m?ne.div({text:Oe,padding:[0,0,0,2],align:"right"}):ne.div()}),ne.div()}),d.length&&(ne.div(t("Examples:")),d.forEach(b=>{b[0]=b[0].replace(/\$0/g,L)}),d.forEach(b=>{b[1]===""?ne.div({text:b[0],padding:[0,2,0,2]}):ne.div({text:b[0],padding:[0,2,0,2],width:x(d,be)+4},{text:b[1]})}),ne.div()),F.length>0){const b=F.map(K=>K.replace(/\$0/g,L)).join(`
|
|
10
10
|
`);ne.div(`${b}
|
|
@@ -410,7 +410,7 @@ if (import.meta.hot) {
|
|
|
410
410
|
}
|
|
411
411
|
})
|
|
412
412
|
}
|
|
413
|
-
`}const Ia={id:"virtual:likec4/dot-sources",virtualId:"\0likec4-plugin/dot-sources.js",async load({likec4:i,logger:e}){e.info(O.dim("generating virtual:likec4/dot-sources"));const t=await i.viewsService.viewsAsGraphvizOut(),n=Ys(t,({id:r,svg:u,dot:s})=>[r,{dot:s,svg:u}]);return xa(n)}},La={id:"virtual:likec4/d2-sources",virtualId:"\0likec4-plugin/d2-sources.js",async load({likec4:i,logger:e}){e.info(O.dim("generating virtual:likec4/d2-sources"));const t=await i.viewsService.computedViews();return va(t)}},Na={id:"virtual:likec4/mmd-sources",virtualId:"\0likec4-plugin/mmd-sources.js",async load({likec4:i,logger:e}){e.info(O.dim("generating virtual:likec4/mmd-sources"));const t=await i.viewsService.computedViews();return Oa(t)}},Pa={id:"virtual:likec4/icons",virtualId:"\0likec4-plugin/icons.js",async load({likec4:i,logger:e}){e.info(O.dim("generating virtual:likec4/icons"));const t=await i.viewsService.computedViews();return $a(t)}},ja={id:"virtual:likec4/overview-graph",virtualId:"\0likec4-plugin/overview-graph.js",async load({likec4:i,logger:e,useOverviewGraph:t}){if(t===!0)try{e.info(O.dim("generating virtual:likec4/overview-graph"));const n=await i.viewsService.overviewGraph();return ls(n)}catch(n){e.error(n)}return e.info(O.dim("generating empty virtual:likec4/overview-graph")),ls({nodes:[],edges:[],bounds:{x:0,y:0,width:10,height:10}})}},fs={id:"virtual:likec4/previews",virtualId:"\0likec4-plugin/previews.js",async load({likec4:i,logger:e,assetsDir:t}){e.info(O.dim("generating virtual:likec4/previews"));const n=await i.viewsService.computedViews();return Ra(n,t)}},Ta={id:"virtual:likec4/model",virtualId:"\0likec4-plugin/model.js",async load({likec4:i,logger:e,assetsDir:t}){e.info(O.dim("generating virtual:likec4/model"));const n=await i.layoutedModel();return Ba(n)}},Ai=[Pa,Ia,La,Na,ja,fs,Ta],Ma=i=>{const e=i.toLowerCase();return e.endsWith(".c4")||e.endsWith(".likec4")||e.endsWith(".like-c4")};function Ei({useOverviewGraph:i=!1,languageServices:e}){let t,n=e.workspace;return{name:"vite-plugin-likec4",configResolved(r){if(t=r.logger,i){const u=r.resolve.alias.find(s=>s.find==="likec4/previews")?.replacement;u?(n=u,t.info(O.dim("likec4/previews alias")+" "+O.dim(n))):t.warn("likec4/previews alias not found")}},resolveId(r){const u=Ai.find(s=>s.id===r);return u?u.virtualId:null},async load(r){const u=Ai.find(s=>s.virtualId===r);return u?await u.load({logger:t,likec4:e,assetsDir:n,useOverviewGraph:i}):null},configureServer(r){const u=Ks(1),s=()=>{u.clearQueue(),u(async()=>{const[l]=e.getErrors();if(l){r.ws.send({type:"error",err:{name:"LikeC4ValidationError",message:"Validation error: "+l.message.slice(0,500),stack:"",plugin:"vite-plugin-likec4",loc:{file:l.sourceFsPath,line:l.range.start.line+1,column:l.range.start.character+1}}});return}for(const f of Ai){const d=r.moduleGraph.getModuleById(f.virtualId);if(d&&d.importers.size>0){t.info(`${O.green("trigger hmr")} ${O.dim(d.url)}`);try{await r.reloadModule(d)}catch(c){t.error(c)}}}})},o=e.workspace;t.info(`${O.dim("watch")} ${o}`);const a=l=>f=>{Ma(f)&&e.notifyUpdate({[l]:f})};if(r.watcher.add(o).on("add",a("changed")).on("change",a("changed")).on("unlink",a("removed")),i&&!n.startsWith(e.workspace)){t.info(`${O.dim("watch")} ${n}`);const l=()=>{const f=r.moduleGraph.getModuleById(fs.virtualId);f&&f.importers.size>0&&r.reloadModule(f)};r.watcher.add(n).on("add",l).on("change",l).on("unlink",l)}e.onModelUpdate(()=>{Be.debug("likec4 model update"),s()})}}}var wi={},ds;function bi(){return ds||(ds=1,function(i){i.isInteger=e=>typeof e=="number"?Number.isInteger(e):typeof e=="string"&&e.trim()!==""?Number.isInteger(Number(e)):!1,i.find=(e,t)=>e.nodes.find(n=>n.type===t),i.exceedsLimit=(e,t,n=1,r)=>r===!1||!i.isInteger(e)||!i.isInteger(t)?!1:(Number(t)-Number(e))/Number(n)>=r,i.escapeNode=(e,t=0,n)=>{const r=e.nodes[t];r&&(n&&r.type===n||r.type==="open"||r.type==="close")&&r.escaped!==!0&&(r.value="\\"+r.value,r.escaped=!0)},i.encloseBrace=e=>e.type!=="brace"||e.commas>>0+e.ranges>>0?!1:(e.invalid=!0,!0),i.isInvalidBrace=e=>e.type!=="brace"?!1:e.invalid===!0||e.dollar?!0:!(e.commas>>0+e.ranges>>0)||e.open!==!0||e.close!==!0?(e.invalid=!0,!0):!1,i.isOpenOrClose=e=>e.type==="open"||e.type==="close"?!0:e.open===!0||e.close===!0,i.reduce=e=>e.reduce((t,n)=>(n.type==="text"&&t.push(n.value),n.type==="range"&&(n.type="text"),t),[]),i.flatten=(...e)=>{const t=[],n=r=>{for(let u=0;u<r.length;u++){const s=r[u];if(Array.isArray(s)){n(s);continue}s!==void 0&&t.push(s)}return t};return n(e),t}}(wi)),wi}var yi,ps;function Fi(){if(ps)return yi;ps=1;const i=bi();return yi=(e,t={})=>{const n=(r,u={})=>{const s=t.escapeInvalid&&i.isInvalidBrace(u),o=r.invalid===!0&&t.escapeInvalid===!0;let a="";if(r.value)return(s||o)&&i.isOpenOrClose(r)?"\\"+r.value:r.value;if(r.value)return r.value;if(r.nodes)for(const l of r.nodes)a+=n(l);return a};return n(e)},yi}var _i,hs;function ka(){return hs||(hs=1,_i=function(i){return typeof i=="number"?i-i===0:typeof i=="string"&&i.trim()!==""?Number.isFinite?Number.isFinite(+i):isFinite(+i):!1}),_i}var Si,gs;function Ha(){if(gs)return Si;gs=1;const i=ka(),e=(h,E,x)=>{if(i(h)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(E===void 0||h===E)return String(h);if(i(E)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let C={relaxZeros:!0,...x};typeof C.strictZeros=="boolean"&&(C.relaxZeros=C.strictZeros===!1);let _=String(C.relaxZeros),y=String(C.shorthand),M=String(C.capture),R=String(C.wrap),W=h+":"+E+"="+_+y+M+R;if(e.cache.hasOwnProperty(W))return e.cache[W].result;let z=Math.min(h,E),G=Math.max(h,E);if(Math.abs(z-G)===1){let V=h+"|"+E;return C.capture?`(${V})`:C.wrap===!1?V:`(?:${V})`}let j=F(h)||F(E),L={min:h,max:E,a:z,b:G},v=[],H=[];if(j&&(L.isPadded=j,L.maxLen=String(L.max).length),z<0){let V=G<0?Math.abs(G):1;H=u(V,Math.abs(z),L,C),z=L.a=0}return G>=0&&(v=u(z,G,L,C)),L.negatives=H,L.positives=v,L.result=t(H,v),C.capture===!0?L.result=`(${L.result})`:C.wrap!==!1&&v.length+H.length>1&&(L.result=`(?:${L.result})`),e.cache[W]=L,L.result};function t(h,E,x){let C=s(h,E,"-",!1),_=s(E,h,"",!1),y=s(h,E,"-?",!0);return C.concat(y).concat(_).join("|")}function n(h,E){let x=1,C=1,_=f(h,x),y=new Set([E]);for(;h<=_&&_<=E;)y.add(_),x+=1,_=f(h,x);for(_=d(E+1,C)-1;h<_&&_<=E;)y.add(_),C+=1,_=d(E+1,C)-1;return y=[...y],y.sort(a),y}function r(h,E,x){if(h===E)return{pattern:h,count:[],digits:0};let C=o(h,E),_=C.length,y="",M=0;for(let R=0;R<_;R++){let[W,z]=C[R];W===z?y+=W:W!=="0"||z!=="9"?y+=A(W,z):M++}return M&&(y+=x.shorthand===!0?"\\d":"[0-9]"),{pattern:y,count:[M],digits:_}}function u(h,E,x,C){let _=n(h,E),y=[],M=h,R;for(let W=0;W<_.length;W++){let z=_[W],G=r(String(M),String(z),C),j="";if(!x.isPadded&&R&&R.pattern===G.pattern){R.count.length>1&&R.count.pop(),R.count.push(G.count[0]),R.string=R.pattern+c(R.count),M=z+1;continue}x.isPadded&&(j=w(z,x,C)),G.string=j+G.pattern+c(G.count),y.push(G),M=z+1,R=G}return y}function s(h,E,x,C,_){let y=[];for(let M of h){let{string:R}=M;!C&&!l(E,"string",R)&&y.push(x+R),C&&l(E,"string",R)&&y.push(x+R)}return y}function o(h,E){let x=[];for(let C=0;C<h.length;C++)x.push([h[C],E[C]]);return x}function a(h,E){return h>E?1:E>h?-1:0}function l(h,E,x){return h.some(C=>C[E]===x)}function f(h,E){return Number(String(h).slice(0,-E)+"9".repeat(E))}function d(h,E){return h-h%Math.pow(10,E)}function c(h){let[E=0,x=""]=h;return x||E>1?`{${E+(x?","+x:"")}}`:""}function A(h,E,x){return`[${h}${E-h===1?"":"-"}${E}]`}function F(h){return/^-?(0+)\d/.test(h)}function w(h,E,x){if(!E.isPadded)return h;let C=Math.abs(E.maxLen-String(h).length),_=x.relaxZeros!==!1;switch(C){case 0:return"";case 1:return _?"0?":"0";case 2:return _?"0{0,2}":"00";default:return _?`0{0,${C}}`:`0{${C}}`}}return e.cache={},e.clearCache=()=>e.cache={},Si=e,Si}var vi,ms;function Ds(){if(ms)return vi;ms=1;const i=Zi,e=Ha(),t=C=>C!==null&&typeof C=="object"&&!Array.isArray(C),n=C=>_=>C===!0?Number(_):String(_),r=C=>typeof C=="number"||typeof C=="string"&&C!=="",u=C=>Number.isInteger(+C),s=C=>{let _=`${C}`,y=-1;if(_[0]==="-"&&(_=_.slice(1)),_==="0")return!1;for(;_[++y]==="0";);return y>0},o=(C,_,y)=>typeof C=="string"||typeof _=="string"?!0:y.stringify===!0,a=(C,_,y)=>{if(_>0){let M=C[0]==="-"?"-":"";M&&(C=C.slice(1)),C=M+C.padStart(M?_-1:_,"0")}return y===!1?String(C):C},l=(C,_)=>{let y=C[0]==="-"?"-":"";for(y&&(C=C.slice(1),_--);C.length<_;)C="0"+C;return y?"-"+C:C},f=(C,_,y)=>{C.negatives.sort((G,j)=>G<j?-1:G>j?1:0),C.positives.sort((G,j)=>G<j?-1:G>j?1:0);let M=_.capture?"":"?:",R="",W="",z;return C.positives.length&&(R=C.positives.map(G=>l(String(G),y)).join("|")),C.negatives.length&&(W=`-(${M}${C.negatives.map(G=>l(String(G),y)).join("|")})`),R&&W?z=`${R}|${W}`:z=R||W,_.wrap?`(${M}${z})`:z},d=(C,_,y,M)=>{if(y)return e(C,_,{wrap:!1,...M});let R=String.fromCharCode(C);if(C===_)return R;let W=String.fromCharCode(_);return`[${R}-${W}]`},c=(C,_,y)=>{if(Array.isArray(C)){let M=y.wrap===!0,R=y.capture?"":"?:";return M?`(${R}${C.join("|")})`:C.join("|")}return e(C,_,y)},A=(...C)=>new RangeError("Invalid range arguments: "+i.inspect(...C)),F=(C,_,y)=>{if(y.strictRanges===!0)throw A([C,_]);return[]},w=(C,_)=>{if(_.strictRanges===!0)throw new TypeError(`Expected step "${C}" to be a number`);return[]},h=(C,_,y=1,M={})=>{let R=Number(C),W=Number(_);if(!Number.isInteger(R)||!Number.isInteger(W)){if(M.strictRanges===!0)throw A([C,_]);return[]}R===0&&(R=0),W===0&&(W=0);let z=R>W,G=String(C),j=String(_),L=String(y);y=Math.max(Math.abs(y),1);let v=s(G)||s(j)||s(L),H=v?Math.max(G.length,j.length,L.length):0,V=v===!1&&o(C,_,M)===!1,X=M.transform||n(V);if(M.toRegex&&y===1)return d(l(C,H),l(_,H),!0,M);let U={negatives:[],positives:[]},re=$=>U[$<0?"negatives":"positives"].push(Math.abs($)),be=[],ne=0;for(;z?R>=W:R<=W;)M.toRegex===!0&&y>1?re(R):be.push(a(X(R,ne),H,V)),R=z?R-y:R+y,ne++;return M.toRegex===!0?y>1?f(U,M,H):c(be,null,{wrap:!1,...M}):be},E=(C,_,y=1,M={})=>{if(!u(C)&&C.length>1||!u(_)&&_.length>1)return F(C,_,M);let R=M.transform||(V=>String.fromCharCode(V)),W=`${C}`.charCodeAt(0),z=`${_}`.charCodeAt(0),G=W>z,j=Math.min(W,z),L=Math.max(W,z);if(M.toRegex&&y===1)return d(j,L,!1,M);let v=[],H=0;for(;G?W>=z:W<=z;)v.push(R(W,H)),W=G?W-y:W+y,H++;return M.toRegex===!0?c(v,null,{wrap:!1,options:M}):v},x=(C,_,y,M={})=>{if(_==null&&r(C))return[C];if(!r(C)||!r(_))return F(C,_,M);if(typeof y=="function")return x(C,_,1,{transform:y});if(t(y))return x(C,_,0,y);let R={...M};return R.capture===!0&&(R.wrap=!0),y=y||R.step||1,u(y)?u(C)&&u(_)?h(C,_,y,R):E(C,_,Math.max(Math.abs(y),1),R):y!=null&&!t(y)?w(y,R):x(C,_,1,y)};return vi=x,vi}var xi,Cs;function Ua(){if(Cs)return xi;Cs=1;const i=Ds(),e=bi();return xi=(n,r={})=>{const u=(s,o={})=>{const a=e.isInvalidBrace(o),l=s.invalid===!0&&r.escapeInvalid===!0,f=a===!0||l===!0,d=r.escapeInvalid===!0?"\\":"";let c="";if(s.isOpen===!0)return d+s.value;if(s.isClose===!0)return console.log("node.isClose",d,s.value),d+s.value;if(s.type==="open")return f?d+s.value:"(";if(s.type==="close")return f?d+s.value:")";if(s.type==="comma")return s.prev.type==="comma"?"":f?s.value:"|";if(s.value)return s.value;if(s.nodes&&s.ranges>0){const A=e.reduce(s.nodes),F=i(...A,{...r,wrap:!1,toRegex:!0,strictZeros:!0});if(F.length!==0)return A.length>1&&F.length>1?`(${F})`:F}if(s.nodes)for(const A of s.nodes)c+=u(A,s);return c};return u(n)},xi}var $i,As;function Wa(){if(As)return $i;As=1;const i=Ds(),e=Fi(),t=bi(),n=(u="",s="",o=!1)=>{const a=[];if(u=[].concat(u),s=[].concat(s),!s.length)return u;if(!u.length)return o?t.flatten(s).map(l=>`{${l}}`):s;for(const l of u)if(Array.isArray(l))for(const f of l)a.push(n(f,s,o));else for(let f of s)o===!0&&typeof f=="string"&&(f=`{${f}}`),a.push(Array.isArray(f)?n(l,f,o):l+f);return t.flatten(a)};return $i=(u,s={})=>{const o=s.rangeLimit===void 0?1e3:s.rangeLimit,a=(l,f={})=>{l.queue=[];let d=f,c=f.queue;for(;d.type!=="brace"&&d.type!=="root"&&d.parent;)d=d.parent,c=d.queue;if(l.invalid||l.dollar){c.push(n(c.pop(),e(l,s)));return}if(l.type==="brace"&&l.invalid!==!0&&l.nodes.length===2){c.push(n(c.pop(),["{}"]));return}if(l.nodes&&l.ranges>0){const h=t.reduce(l.nodes);if(t.exceedsLimit(...h,s.step,o))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let E=i(...h,s);E.length===0&&(E=e(l,s)),c.push(n(c.pop(),E)),l.nodes=[];return}const A=t.encloseBrace(l);let F=l.queue,w=l;for(;w.type!=="brace"&&w.type!=="root"&&w.parent;)w=w.parent,F=w.queue;for(let h=0;h<l.nodes.length;h++){const E=l.nodes[h];if(E.type==="comma"&&l.type==="brace"){h===1&&F.push(""),F.push("");continue}if(E.type==="close"){c.push(n(c.pop(),F,A));continue}if(E.value&&E.type!=="open"){F.push(n(F.pop(),E.value));continue}E.nodes&&a(E,l)}return F};return t.flatten(a(u))},$i}var Bi,Es;function Ga(){return Es||(Es=1,Bi={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
|
|
413
|
+
`}const Ia={id:"virtual:likec4/dot-sources",virtualId:"\0likec4-plugin/dot-sources.js",async load({likec4:i,logger:e}){e.info(O.dim("generating virtual:likec4/dot-sources"));const t=await i.viewsService.viewsAsGraphvizOut(),n=Ys(t,({id:r,svg:u,dot:s})=>[r,{dot:s,svg:u}]);return xa(n)}},La={id:"virtual:likec4/d2-sources",virtualId:"\0likec4-plugin/d2-sources.js",async load({likec4:i,logger:e}){e.info(O.dim("generating virtual:likec4/d2-sources"));const t=await i.viewsService.computedViews();return va(t)}},Na={id:"virtual:likec4/mmd-sources",virtualId:"\0likec4-plugin/mmd-sources.js",async load({likec4:i,logger:e}){e.info(O.dim("generating virtual:likec4/mmd-sources"));const t=await i.viewsService.computedViews();return Oa(t)}},Pa={id:"virtual:likec4/icons",virtualId:"\0likec4-plugin/icons.js",async load({likec4:i,logger:e}){e.info(O.dim("generating virtual:likec4/icons"));const t=await i.viewsService.computedViews();return $a(t)}},ja={id:"virtual:likec4/overview-graph",virtualId:"\0likec4-plugin/overview-graph.js",async load({likec4:i,logger:e,useOverviewGraph:t}){if(t===!0)try{e.info(O.dim("generating virtual:likec4/overview-graph"));const n=await i.viewsService.overviewGraph();return ls(n)}catch(n){e.error(n)}return e.info(O.dim("generating empty virtual:likec4/overview-graph")),ls({nodes:[],edges:[],bounds:{x:0,y:0,width:10,height:10}})}},fs={id:"virtual:likec4/previews",virtualId:"\0likec4-plugin/previews.js",async load({likec4:i,logger:e,assetsDir:t}){e.info(O.dim("generating virtual:likec4/previews"));const n=await i.viewsService.computedViews();return Ra(n,t)}},Ta={id:"virtual:likec4/model",virtualId:"\0likec4-plugin/model.js",async load({likec4:i,logger:e,assetsDir:t}){e.info(O.dim("generating virtual:likec4/model"));const n=await i.layoutedModel();return Ba(n)}},Ai=[Pa,Ia,La,Na,ja,fs,Ta],Ma=i=>{const e=i.toLowerCase();return e.endsWith(".c4")||e.endsWith(".likec4")||e.endsWith(".like-c4")};function Ei({useOverviewGraph:i=!1,languageServices:e}){let t,n=e.workspace;return{name:"vite-plugin-likec4",configResolved(r){if(t=r.logger,i){const u=r.resolve.alias.find(s=>s.find==="likec4/previews")?.replacement;u?(n=u,t.info(O.dim("likec4/previews alias")+" "+O.dim(n))):t.warn("likec4/previews alias not found")}},resolveId(r){const u=Ai.find(s=>s.id===r);return u?u.virtualId:null},async load(r){const u=Ai.find(s=>s.virtualId===r);return u?await u.load({logger:t,likec4:e,assetsDir:n,useOverviewGraph:i}):null},configureServer(r){const u=Ks(1),s=()=>{u.clearQueue(),u(async()=>{const[l]=e.getErrors();if(l){r.ws.send({type:"error",err:{name:"LikeC4ValidationError",message:"Validation error: "+l.message.slice(0,500),stack:"",plugin:"vite-plugin-likec4",loc:{file:l.sourceFsPath,line:l.range.start.line+1,column:l.range.start.character+1}}});return}for(const f of Ai){const d=r.moduleGraph.getModuleById(f.virtualId);if(d&&d.importers.size>0){t.info(`${O.green("trigger hmr")} ${O.dim(d.url)}`);try{await r.reloadModule(d)}catch(c){t.error(c)}}}})},o=e.workspace;t.info(`${O.dim("watch")} ${o}`);const a=l=>f=>{Ma(f)&&e.notifyUpdate({[l]:f})};if(r.watcher.add(o).on("add",a("changed")).on("change",a("changed")).on("unlink",a("removed")),i&&!n.startsWith(e.workspace)){t.info(`${O.dim("watch")} ${n}`);const l=()=>{const f=r.moduleGraph.getModuleById(fs.virtualId);f&&f.importers.size>0&&r.reloadModule(f)};r.watcher.add(n).on("add",l).on("change",l).on("unlink",l)}e.onModelUpdate(()=>{Be.debug("likec4 model update"),s()})}}}var wi={},ds;function bi(){return ds||(ds=1,function(i){i.isInteger=e=>typeof e=="number"?Number.isInteger(e):typeof e=="string"&&e.trim()!==""?Number.isInteger(Number(e)):!1,i.find=(e,t)=>e.nodes.find(n=>n.type===t),i.exceedsLimit=(e,t,n=1,r)=>r===!1||!i.isInteger(e)||!i.isInteger(t)?!1:(Number(t)-Number(e))/Number(n)>=r,i.escapeNode=(e,t=0,n)=>{const r=e.nodes[t];r&&(n&&r.type===n||r.type==="open"||r.type==="close")&&r.escaped!==!0&&(r.value="\\"+r.value,r.escaped=!0)},i.encloseBrace=e=>e.type!=="brace"||e.commas>>0+e.ranges>>0?!1:(e.invalid=!0,!0),i.isInvalidBrace=e=>e.type!=="brace"?!1:e.invalid===!0||e.dollar?!0:!(e.commas>>0+e.ranges>>0)||e.open!==!0||e.close!==!0?(e.invalid=!0,!0):!1,i.isOpenOrClose=e=>e.type==="open"||e.type==="close"?!0:e.open===!0||e.close===!0,i.reduce=e=>e.reduce((t,n)=>(n.type==="text"&&t.push(n.value),n.type==="range"&&(n.type="text"),t),[]),i.flatten=(...e)=>{const t=[],n=r=>{for(let u=0;u<r.length;u++){const s=r[u];if(Array.isArray(s)){n(s);continue}s!==void 0&&t.push(s)}return t};return n(e),t}}(wi)),wi}var yi,ps;function Fi(){if(ps)return yi;ps=1;const i=bi();return yi=(e,t={})=>{const n=(r,u={})=>{const s=t.escapeInvalid&&i.isInvalidBrace(u),o=r.invalid===!0&&t.escapeInvalid===!0;let a="";if(r.value)return(s||o)&&i.isOpenOrClose(r)?"\\"+r.value:r.value;if(r.value)return r.value;if(r.nodes)for(const l of r.nodes)a+=n(l);return a};return n(e)},yi}var _i,hs;function ka(){return hs||(hs=1,_i=function(i){return typeof i=="number"?i-i===0:typeof i=="string"&&i.trim()!==""?Number.isFinite?Number.isFinite(+i):isFinite(+i):!1}),_i}var Si,gs;function Ha(){if(gs)return Si;gs=1;const i=ka(),e=(h,E,x)=>{if(i(h)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(E===void 0||h===E)return String(h);if(i(E)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let C={relaxZeros:!0,...x};typeof C.strictZeros=="boolean"&&(C.relaxZeros=C.strictZeros===!1);let _=String(C.relaxZeros),y=String(C.shorthand),M=String(C.capture),R=String(C.wrap),W=h+":"+E+"="+_+y+M+R;if(e.cache.hasOwnProperty(W))return e.cache[W].result;let z=Math.min(h,E),G=Math.max(h,E);if(Math.abs(z-G)===1){let V=h+"|"+E;return C.capture?`(${V})`:C.wrap===!1?V:`(?:${V})`}let j=F(h)||F(E),L={min:h,max:E,a:z,b:G},v=[],H=[];if(j&&(L.isPadded=j,L.maxLen=String(L.max).length),z<0){let V=G<0?Math.abs(G):1;H=u(V,Math.abs(z),L,C),z=L.a=0}return G>=0&&(v=u(z,G,L,C)),L.negatives=H,L.positives=v,L.result=t(H,v),C.capture===!0?L.result=`(${L.result})`:C.wrap!==!1&&v.length+H.length>1&&(L.result=`(?:${L.result})`),e.cache[W]=L,L.result};function t(h,E,x){let C=s(h,E,"-",!1)||[],_=s(E,h,"",!1)||[],y=s(h,E,"-?",!0)||[];return C.concat(y).concat(_).join("|")}function n(h,E){let x=1,C=1,_=f(h,x),y=new Set([E]);for(;h<=_&&_<=E;)y.add(_),x+=1,_=f(h,x);for(_=d(E+1,C)-1;h<_&&_<=E;)y.add(_),C+=1,_=d(E+1,C)-1;return y=[...y],y.sort(a),y}function r(h,E,x){if(h===E)return{pattern:h,count:[],digits:0};let C=o(h,E),_=C.length,y="",M=0;for(let R=0;R<_;R++){let[W,z]=C[R];W===z?y+=W:W!=="0"||z!=="9"?y+=A(W,z):M++}return M&&(y+=x.shorthand===!0?"\\d":"[0-9]"),{pattern:y,count:[M],digits:_}}function u(h,E,x,C){let _=n(h,E),y=[],M=h,R;for(let W=0;W<_.length;W++){let z=_[W],G=r(String(M),String(z),C),j="";if(!x.isPadded&&R&&R.pattern===G.pattern){R.count.length>1&&R.count.pop(),R.count.push(G.count[0]),R.string=R.pattern+c(R.count),M=z+1;continue}x.isPadded&&(j=w(z,x,C)),G.string=j+G.pattern+c(G.count),y.push(G),M=z+1,R=G}return y}function s(h,E,x,C,_){let y=[];for(let M of h){let{string:R}=M;!C&&!l(E,"string",R)&&y.push(x+R),C&&l(E,"string",R)&&y.push(x+R)}return y}function o(h,E){let x=[];for(let C=0;C<h.length;C++)x.push([h[C],E[C]]);return x}function a(h,E){return h>E?1:E>h?-1:0}function l(h,E,x){return h.some(C=>C[E]===x)}function f(h,E){return Number(String(h).slice(0,-E)+"9".repeat(E))}function d(h,E){return h-h%Math.pow(10,E)}function c(h){let[E=0,x=""]=h;return x||E>1?`{${E+(x?","+x:"")}}`:""}function A(h,E,x){return`[${h}${E-h===1?"":"-"}${E}]`}function F(h){return/^-?(0+)\d/.test(h)}function w(h,E,x){if(!E.isPadded)return h;let C=Math.abs(E.maxLen-String(h).length),_=x.relaxZeros!==!1;switch(C){case 0:return"";case 1:return _?"0?":"0";case 2:return _?"0{0,2}":"00";default:return _?`0{0,${C}}`:`0{${C}}`}}return e.cache={},e.clearCache=()=>e.cache={},Si=e,Si}var vi,ms;function Ds(){if(ms)return vi;ms=1;const i=Zi,e=Ha(),t=C=>C!==null&&typeof C=="object"&&!Array.isArray(C),n=C=>_=>C===!0?Number(_):String(_),r=C=>typeof C=="number"||typeof C=="string"&&C!=="",u=C=>Number.isInteger(+C),s=C=>{let _=`${C}`,y=-1;if(_[0]==="-"&&(_=_.slice(1)),_==="0")return!1;for(;_[++y]==="0";);return y>0},o=(C,_,y)=>typeof C=="string"||typeof _=="string"?!0:y.stringify===!0,a=(C,_,y)=>{if(_>0){let M=C[0]==="-"?"-":"";M&&(C=C.slice(1)),C=M+C.padStart(M?_-1:_,"0")}return y===!1?String(C):C},l=(C,_)=>{let y=C[0]==="-"?"-":"";for(y&&(C=C.slice(1),_--);C.length<_;)C="0"+C;return y?"-"+C:C},f=(C,_,y)=>{C.negatives.sort((G,j)=>G<j?-1:G>j?1:0),C.positives.sort((G,j)=>G<j?-1:G>j?1:0);let M=_.capture?"":"?:",R="",W="",z;return C.positives.length&&(R=C.positives.map(G=>l(String(G),y)).join("|")),C.negatives.length&&(W=`-(${M}${C.negatives.map(G=>l(String(G),y)).join("|")})`),R&&W?z=`${R}|${W}`:z=R||W,_.wrap?`(${M}${z})`:z},d=(C,_,y,M)=>{if(y)return e(C,_,{wrap:!1,...M});let R=String.fromCharCode(C);if(C===_)return R;let W=String.fromCharCode(_);return`[${R}-${W}]`},c=(C,_,y)=>{if(Array.isArray(C)){let M=y.wrap===!0,R=y.capture?"":"?:";return M?`(${R}${C.join("|")})`:C.join("|")}return e(C,_,y)},A=(...C)=>new RangeError("Invalid range arguments: "+i.inspect(...C)),F=(C,_,y)=>{if(y.strictRanges===!0)throw A([C,_]);return[]},w=(C,_)=>{if(_.strictRanges===!0)throw new TypeError(`Expected step "${C}" to be a number`);return[]},h=(C,_,y=1,M={})=>{let R=Number(C),W=Number(_);if(!Number.isInteger(R)||!Number.isInteger(W)){if(M.strictRanges===!0)throw A([C,_]);return[]}R===0&&(R=0),W===0&&(W=0);let z=R>W,G=String(C),j=String(_),L=String(y);y=Math.max(Math.abs(y),1);let v=s(G)||s(j)||s(L),H=v?Math.max(G.length,j.length,L.length):0,V=v===!1&&o(C,_,M)===!1,X=M.transform||n(V);if(M.toRegex&&y===1)return d(l(C,H),l(_,H),!0,M);let U={negatives:[],positives:[]},re=$=>U[$<0?"negatives":"positives"].push(Math.abs($)),be=[],ne=0;for(;z?R>=W:R<=W;)M.toRegex===!0&&y>1?re(R):be.push(a(X(R,ne),H,V)),R=z?R-y:R+y,ne++;return M.toRegex===!0?y>1?f(U,M,H):c(be,null,{wrap:!1,...M}):be},E=(C,_,y=1,M={})=>{if(!u(C)&&C.length>1||!u(_)&&_.length>1)return F(C,_,M);let R=M.transform||(V=>String.fromCharCode(V)),W=`${C}`.charCodeAt(0),z=`${_}`.charCodeAt(0),G=W>z,j=Math.min(W,z),L=Math.max(W,z);if(M.toRegex&&y===1)return d(j,L,!1,M);let v=[],H=0;for(;G?W>=z:W<=z;)v.push(R(W,H)),W=G?W-y:W+y,H++;return M.toRegex===!0?c(v,null,{wrap:!1,options:M}):v},x=(C,_,y,M={})=>{if(_==null&&r(C))return[C];if(!r(C)||!r(_))return F(C,_,M);if(typeof y=="function")return x(C,_,1,{transform:y});if(t(y))return x(C,_,0,y);let R={...M};return R.capture===!0&&(R.wrap=!0),y=y||R.step||1,u(y)?u(C)&&u(_)?h(C,_,y,R):E(C,_,Math.max(Math.abs(y),1),R):y!=null&&!t(y)?w(y,R):x(C,_,1,y)};return vi=x,vi}var xi,Cs;function Ua(){if(Cs)return xi;Cs=1;const i=Ds(),e=bi();return xi=(n,r={})=>{const u=(s,o={})=>{const a=e.isInvalidBrace(o),l=s.invalid===!0&&r.escapeInvalid===!0,f=a===!0||l===!0,d=r.escapeInvalid===!0?"\\":"";let c="";if(s.isOpen===!0)return d+s.value;if(s.isClose===!0)return console.log("node.isClose",d,s.value),d+s.value;if(s.type==="open")return f?d+s.value:"(";if(s.type==="close")return f?d+s.value:")";if(s.type==="comma")return s.prev.type==="comma"?"":f?s.value:"|";if(s.value)return s.value;if(s.nodes&&s.ranges>0){const A=e.reduce(s.nodes),F=i(...A,{...r,wrap:!1,toRegex:!0,strictZeros:!0});if(F.length!==0)return A.length>1&&F.length>1?`(${F})`:F}if(s.nodes)for(const A of s.nodes)c+=u(A,s);return c};return u(n)},xi}var $i,As;function Wa(){if(As)return $i;As=1;const i=Ds(),e=Fi(),t=bi(),n=(u="",s="",o=!1)=>{const a=[];if(u=[].concat(u),s=[].concat(s),!s.length)return u;if(!u.length)return o?t.flatten(s).map(l=>`{${l}}`):s;for(const l of u)if(Array.isArray(l))for(const f of l)a.push(n(f,s,o));else for(let f of s)o===!0&&typeof f=="string"&&(f=`{${f}}`),a.push(Array.isArray(f)?n(l,f,o):l+f);return t.flatten(a)};return $i=(u,s={})=>{const o=s.rangeLimit===void 0?1e3:s.rangeLimit,a=(l,f={})=>{l.queue=[];let d=f,c=f.queue;for(;d.type!=="brace"&&d.type!=="root"&&d.parent;)d=d.parent,c=d.queue;if(l.invalid||l.dollar){c.push(n(c.pop(),e(l,s)));return}if(l.type==="brace"&&l.invalid!==!0&&l.nodes.length===2){c.push(n(c.pop(),["{}"]));return}if(l.nodes&&l.ranges>0){const h=t.reduce(l.nodes);if(t.exceedsLimit(...h,s.step,o))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let E=i(...h,s);E.length===0&&(E=e(l,s)),c.push(n(c.pop(),E)),l.nodes=[];return}const A=t.encloseBrace(l);let F=l.queue,w=l;for(;w.type!=="brace"&&w.type!=="root"&&w.parent;)w=w.parent,F=w.queue;for(let h=0;h<l.nodes.length;h++){const E=l.nodes[h];if(E.type==="comma"&&l.type==="brace"){h===1&&F.push(""),F.push("");continue}if(E.type==="close"){c.push(n(c.pop(),F,A));continue}if(E.value&&E.type!=="open"){F.push(n(F.pop(),E.value));continue}E.nodes&&a(E,l)}return F};return t.flatten(a(u))},$i}var Bi,Es;function Ga(){return Es||(Es=1,Bi={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
|
|
414
414
|
`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}),Bi}var Oi,ws;function Va(){if(ws)return Oi;ws=1;const i=Fi(),{MAX_LENGTH:e,CHAR_BACKSLASH:t,CHAR_BACKTICK:n,CHAR_COMMA:r,CHAR_DOT:u,CHAR_LEFT_PARENTHESES:s,CHAR_RIGHT_PARENTHESES:o,CHAR_LEFT_CURLY_BRACE:a,CHAR_RIGHT_CURLY_BRACE:l,CHAR_LEFT_SQUARE_BRACKET:f,CHAR_RIGHT_SQUARE_BRACKET:d,CHAR_DOUBLE_QUOTE:c,CHAR_SINGLE_QUOTE:A,CHAR_NO_BREAK_SPACE:F,CHAR_ZERO_WIDTH_NOBREAK_SPACE:w}=Ga();return Oi=(E,x={})=>{if(typeof E!="string")throw new TypeError("Expected a string");const C=x||{},_=typeof C.maxLength=="number"?Math.min(e,C.maxLength):e;if(E.length>_)throw new SyntaxError(`Input length (${E.length}), exceeds max characters (${_})`);const y={type:"root",input:E,nodes:[]},M=[y];let R=y,W=y,z=0;const G=E.length;let j=0,L=0,v;const H=()=>E[j++],V=X=>{if(X.type==="text"&&W.type==="dot"&&(W.type="text"),W&&W.type==="text"&&X.type==="text"){W.value+=X.value;return}return R.nodes.push(X),X.parent=R,X.prev=W,W=X,X};for(V({type:"bos"});j<G;)if(R=M[M.length-1],v=H(),!(v===w||v===F)){if(v===t){V({type:"text",value:(x.keepEscaping?v:"")+H()});continue}if(v===d){V({type:"text",value:"\\"+v});continue}if(v===f){z++;let X;for(;j<G&&(X=H());){if(v+=X,X===f){z++;continue}if(X===t){v+=H();continue}if(X===d&&(z--,z===0))break}V({type:"text",value:v});continue}if(v===s){R=V({type:"paren",nodes:[]}),M.push(R),V({type:"text",value:v});continue}if(v===o){if(R.type!=="paren"){V({type:"text",value:v});continue}R=M.pop(),V({type:"text",value:v}),R=M[M.length-1];continue}if(v===c||v===A||v===n){const X=v;let U;for(x.keepQuotes!==!0&&(v="");j<G&&(U=H());){if(U===t){v+=U+H();continue}if(U===X){x.keepQuotes===!0&&(v+=U);break}v+=U}V({type:"text",value:v});continue}if(v===a){L++;const U={type:"brace",open:!0,close:!1,dollar:W.value&&W.value.slice(-1)==="$"||R.dollar===!0,depth:L,commas:0,ranges:0,nodes:[]};R=V(U),M.push(R),V({type:"open",value:v});continue}if(v===l){if(R.type!=="brace"){V({type:"text",value:v});continue}const X="close";R=M.pop(),R.close=!0,V({type:X,value:v}),L--,R=M[M.length-1];continue}if(v===r&&L>0){if(R.ranges>0){R.ranges=0;const X=R.nodes.shift();R.nodes=[X,{type:"text",value:i(R)}]}V({type:"comma",value:v}),R.commas++;continue}if(v===u&&L>0&&R.commas===0){const X=R.nodes;if(L===0||X.length===0){V({type:"text",value:v});continue}if(W.type==="dot"){if(R.range=[],W.value+=v,W.type="range",R.nodes.length!==3&&R.nodes.length!==5){R.invalid=!0,R.ranges=0,W.type="text";continue}R.ranges++,R.args=[];continue}if(W.type==="range"){X.pop();const U=X[X.length-1];U.value+=W.value+v,W=U,R.ranges--;continue}V({type:"dot",value:v});continue}V({type:"text",value:v})}do if(R=M.pop(),R.type!=="root"){R.nodes.forEach(re=>{re.nodes||(re.type==="open"&&(re.isOpen=!0),re.type==="close"&&(re.isClose=!0),re.nodes||(re.type="text"),re.invalid=!0)});const X=M[M.length-1],U=X.nodes.indexOf(R);X.nodes.splice(U,1,...R.nodes)}while(M.length>0);return V({type:"eos"}),y},Oi}var Ri,bs;function za(){if(bs)return Ri;bs=1;const i=Fi(),e=Ua(),t=Wa(),n=Va(),r=(u,s={})=>{let o=[];if(Array.isArray(u))for(const a of u){const l=r.create(a,s);Array.isArray(l)?o.push(...l):o.push(l)}else o=[].concat(r.create(u,s));return s&&s.expand===!0&&s.nodupes===!0&&(o=[...new Set(o)]),o};return r.parse=(u,s={})=>n(u,s),r.stringify=(u,s={})=>i(typeof u=="string"?r.parse(u,s):u,s),r.compile=(u,s={})=>(typeof u=="string"&&(u=r.parse(u,s)),e(u,s)),r.expand=(u,s={})=>{typeof u=="string"&&(u=r.parse(u,s));let o=t(u,s);return s.noempty===!0&&(o=o.filter(Boolean)),s.nodupes===!0&&(o=[...new Set(o)]),o},r.create=(u,s={})=>u===""||u.length<3?[u]:s.expand!==!0?r.compile(u,s):r.expand(u,s),Ri=r,Ri}var Ii={},Li,ys;function _n(){if(ys)return Li;ys=1;const i=Ln,e="\\\\/",t=`[^${e}]`,n="\\.",r="\\+",u="\\?",s="\\/",o="(?=.)",a="[^/]",l=`(?:${s}|$)`,f=`(?:^|${s})`,d=`${n}{1,2}${l}`,c=`(?!${n})`,A=`(?!${f}${d})`,F=`(?!${n}{0,1}${l})`,w=`(?!${d})`,h=`[^.${s}]`,E=`${a}*?`,x={DOT_LITERAL:n,PLUS_LITERAL:r,QMARK_LITERAL:u,SLASH_LITERAL:s,ONE_CHAR:o,QMARK:a,END_ANCHOR:l,DOTS_SLASH:d,NO_DOT:c,NO_DOTS:A,NO_DOT_SLASH:F,NO_DOTS_SLASH:w,QMARK_NO_DOT:h,STAR:E,START_ANCHOR:f},C={...x,SLASH_LITERAL:`[${e}]`,QMARK:t,STAR:`${t}*?`,DOTS_SLASH:`${n}{1,2}(?:[${e}]|$)`,NO_DOT:`(?!${n})`,NO_DOTS:`(?!(?:^|[${e}])${n}{1,2}(?:[${e}]|$))`,NO_DOT_SLASH:`(?!${n}{0,1}(?:[${e}]|$))`,NO_DOTS_SLASH:`(?!${n}{1,2}(?:[${e}]|$))`,QMARK_NO_DOT:`[^.${e}]`,START_ANCHOR:`(?:^|[${e}])`,END_ANCHOR:`(?:[${e}]|$)`},_={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};return Li={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:_,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:i.sep,extglobChars(y){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${y.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(y){return y===!0?C:x}},Li}var Fs;function Sn(){return Fs||(Fs=1,function(i){const e=Ln,t=process.platform==="win32",{REGEX_BACKSLASH:n,REGEX_REMOVE_BACKSLASH:r,REGEX_SPECIAL_CHARS:u,REGEX_SPECIAL_CHARS_GLOBAL:s}=_n();i.isObject=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),i.hasRegexChars=o=>u.test(o),i.isRegexChar=o=>o.length===1&&i.hasRegexChars(o),i.escapeRegex=o=>o.replace(s,"\\$1"),i.toPosixSlashes=o=>o.replace(n,"/"),i.removeBackslashes=o=>o.replace(r,a=>a==="\\"?"":a),i.supportsLookbehinds=()=>{const o=process.version.slice(1).split(".").map(Number);return o.length===3&&o[0]>=9||o[0]===8&&o[1]>=10},i.isWindows=o=>o&&typeof o.windows=="boolean"?o.windows:t===!0||e.sep==="\\",i.escapeLast=(o,a,l)=>{const f=o.lastIndexOf(a,l);return f===-1?o:o[f-1]==="\\"?i.escapeLast(o,a,f-1):`${o.slice(0,f)}\\${o.slice(f)}`},i.removePrefix=(o,a={})=>{let l=o;return l.startsWith("./")&&(l=l.slice(2),a.prefix="./"),l},i.wrapOutput=(o,a={},l={})=>{const f=l.contains?"":"^",d=l.contains?"":"$";let c=`${f}(?:${o})${d}`;return a.negated===!0&&(c=`(?:^(?!${c}).*$)`),c}}(Ii)),Ii}var Ni,_s;function qa(){if(_s)return Ni;_s=1;const i=Sn(),{CHAR_ASTERISK:e,CHAR_AT:t,CHAR_BACKWARD_SLASH:n,CHAR_COMMA:r,CHAR_DOT:u,CHAR_EXCLAMATION_MARK:s,CHAR_FORWARD_SLASH:o,CHAR_LEFT_CURLY_BRACE:a,CHAR_LEFT_PARENTHESES:l,CHAR_LEFT_SQUARE_BRACKET:f,CHAR_PLUS:d,CHAR_QUESTION_MARK:c,CHAR_RIGHT_CURLY_BRACE:A,CHAR_RIGHT_PARENTHESES:F,CHAR_RIGHT_SQUARE_BRACKET:w}=_n(),h=C=>C===o||C===n,E=C=>{C.isPrefix!==!0&&(C.depth=C.isGlobstar?1/0:1)};return Ni=(C,_)=>{const y=_||{},M=C.length-1,R=y.parts===!0||y.scanToEnd===!0,W=[],z=[],G=[];let j=C,L=-1,v=0,H=0,V=!1,X=!1,U=!1,re=!1,be=!1,ne=!1,$=!1,ge=!1,_e=!1,q=!1,I=0,b,K,Y={value:"",depth:0,isGlob:!1};const ee=()=>L>=M,pe=()=>j.charCodeAt(L+1),se=()=>(b=K,j.charCodeAt(++L));for(;L<M;){K=se();let D;if(K===n){$=Y.backslashes=!0,K=se(),K===a&&(ne=!0);continue}if(ne===!0||K===a){for(I++;ee()!==!0&&(K=se());){if(K===n){$=Y.backslashes=!0,se();continue}if(K===a){I++;continue}if(ne!==!0&&K===u&&(K=se())===u){if(V=Y.isBrace=!0,U=Y.isGlob=!0,q=!0,R===!0)continue;break}if(ne!==!0&&K===r){if(V=Y.isBrace=!0,U=Y.isGlob=!0,q=!0,R===!0)continue;break}if(K===A&&(I--,I===0)){ne=!1,V=Y.isBrace=!0,q=!0;break}}if(R===!0)continue;break}if(K===o){if(W.push(L),z.push(Y),Y={value:"",depth:0,isGlob:!1},q===!0)continue;if(b===u&&L===v+1){v+=2;continue}H=L+1;continue}if(y.noext!==!0&&(K===d||K===t||K===e||K===c||K===s)===!0&&pe()===l){if(U=Y.isGlob=!0,re=Y.isExtglob=!0,q=!0,K===s&&L===v&&(_e=!0),R===!0){for(;ee()!==!0&&(K=se());){if(K===n){$=Y.backslashes=!0,K=se();continue}if(K===F){U=Y.isGlob=!0,q=!0;break}}continue}break}if(K===e){if(b===e&&(be=Y.isGlobstar=!0),U=Y.isGlob=!0,q=!0,R===!0)continue;break}if(K===c){if(U=Y.isGlob=!0,q=!0,R===!0)continue;break}if(K===f){for(;ee()!==!0&&(D=se());){if(D===n){$=Y.backslashes=!0,se();continue}if(D===w){X=Y.isBracket=!0,U=Y.isGlob=!0,q=!0;break}}if(R===!0)continue;break}if(y.nonegate!==!0&&K===s&&L===v){ge=Y.negated=!0,v++;continue}if(y.noparen!==!0&&K===l){if(U=Y.isGlob=!0,R===!0){for(;ee()!==!0&&(K=se());){if(K===l){$=Y.backslashes=!0,K=se();continue}if(K===F){q=!0;break}}continue}break}if(U===!0){if(q=!0,R===!0)continue;break}}y.noext===!0&&(re=!1,U=!1);let de=j,$e="",Oe="";v>0&&($e=j.slice(0,v),j=j.slice(v),H-=v),de&&U===!0&&H>0?(de=j.slice(0,H),Oe=j.slice(H)):U===!0?(de="",Oe=j):de=j,de&&de!==""&&de!=="/"&&de!==j&&h(de.charCodeAt(de.length-1))&&(de=de.slice(0,-1)),y.unescape===!0&&(Oe&&(Oe=i.removeBackslashes(Oe)),de&&$===!0&&(de=i.removeBackslashes(de)));const m={prefix:$e,input:C,start:v,base:de,glob:Oe,isBrace:V,isBracket:X,isGlob:U,isExtglob:re,isGlobstar:be,negated:ge,negatedExtglob:_e};if(y.tokens===!0&&(m.maxDepth=0,h(K)||z.push(Y),m.tokens=z),y.parts===!0||y.tokens===!0){let D;for(let P=0;P<W.length;P++){const B=D?D+1:v,g=W[P],k=C.slice(B,g);y.tokens&&(P===0&&v!==0?(z[P].isPrefix=!0,z[P].value=$e):z[P].value=k,E(z[P]),m.maxDepth+=z[P].depth),(P!==0||k!=="")&&G.push(k),D=g}if(D&&D+1<C.length){const P=C.slice(D+1);G.push(P),y.tokens&&(z[z.length-1].value=P,E(z[z.length-1]),m.maxDepth+=z[z.length-1].depth)}m.slashes=W,m.parts=G}return m},Ni}var Pi,Ss;function Ka(){if(Ss)return Pi;Ss=1;const i=_n(),e=Sn(),{MAX_LENGTH:t,POSIX_REGEX_SOURCE:n,REGEX_NON_SPECIAL_CHARS:r,REGEX_SPECIAL_CHARS_BACKREF:u,REPLACEMENTS:s}=i,o=(f,d)=>{if(typeof d.expandRange=="function")return d.expandRange(...f,d);f.sort();const c=`[${f.join("-")}]`;try{new RegExp(c)}catch{return f.map(F=>e.escapeRegex(F)).join("..")}return c},a=(f,d)=>`Missing ${f}: "${d}" - use "\\\\${d}" to match literal characters`,l=(f,d)=>{if(typeof f!="string")throw new TypeError("Expected a string");f=s[f]||f;const c={...d},A=typeof c.maxLength=="number"?Math.min(t,c.maxLength):t;let F=f.length;if(F>A)throw new SyntaxError(`Input length: ${F}, exceeds maximum allowed length: ${A}`);const w={type:"bos",value:"",output:c.prepend||""},h=[w],E=c.capture?"":"?:",x=e.isWindows(d),C=i.globChars(x),_=i.extglobChars(C),{DOT_LITERAL:y,PLUS_LITERAL:M,SLASH_LITERAL:R,ONE_CHAR:W,DOTS_SLASH:z,NO_DOT:G,NO_DOT_SLASH:j,NO_DOTS_SLASH:L,QMARK:v,QMARK_NO_DOT:H,STAR:V,START_ANCHOR:X}=C,U=g=>`(${E}(?:(?!${X}${g.dot?z:y}).)*?)`,re=c.dot?"":G,be=c.dot?v:H;let ne=c.bash===!0?U(c):V;c.capture&&(ne=`(${ne})`),typeof c.noext=="boolean"&&(c.noextglob=c.noext);const $={input:f,index:-1,start:0,dot:c.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:h};f=e.removePrefix(f,$),F=f.length;const ge=[],_e=[],q=[];let I=w,b;const K=()=>$.index===F-1,Y=$.peek=(g=1)=>f[$.index+g],ee=$.advance=()=>f[++$.index]||"",pe=()=>f.slice($.index+1),se=(g="",k=0)=>{$.consumed+=g,$.index+=k},de=g=>{$.output+=g.output!=null?g.output:g.value,se(g.value)},$e=()=>{let g=1;for(;Y()==="!"&&(Y(2)!=="("||Y(3)==="?");)ee(),$.start++,g++;return g%2===0?!1:($.negated=!0,$.start++,!0)},Oe=g=>{$[g]++,q.push(g)},m=g=>{$[g]--,q.pop()},D=g=>{if(I.type==="globstar"){const k=$.braces>0&&(g.type==="comma"||g.type==="brace"),S=g.extglob===!0||ge.length&&(g.type==="pipe"||g.type==="paren");g.type!=="slash"&&g.type!=="paren"&&!k&&!S&&($.output=$.output.slice(0,-I.output.length),I.type="star",I.value="*",I.output=ne,$.output+=I.output)}if(ge.length&&g.type!=="paren"&&(ge[ge.length-1].inner+=g.value),(g.value||g.output)&&de(g),I&&I.type==="text"&&g.type==="text"){I.value+=g.value,I.output=(I.output||"")+g.value;return}g.prev=I,h.push(g),I=g},P=(g,k)=>{const S={..._[k],conditions:1,inner:""};S.prev=I,S.parens=$.parens,S.output=$.output;const T=(c.capture?"(":"")+S.open;Oe("parens"),D({type:g,value:k,output:$.output?"":W}),D({type:"paren",extglob:!0,value:ee(),output:T}),ge.push(S)},B=g=>{let k=g.close+(c.capture?")":""),S;if(g.type==="negate"){let T=ne;if(g.inner&&g.inner.length>1&&g.inner.includes("/")&&(T=U(c)),(T!==ne||K()||/^\)+$/.test(pe()))&&(k=g.close=`)$))${T}`),g.inner.includes("*")&&(S=pe())&&/^\.[^\\/.]+$/.test(S)){const oe=l(S,{...d,fastpaths:!1}).output;k=g.close=`)${oe})${T})`}g.prev.type==="bos"&&($.negatedExtglob=!0)}D({type:"paren",extglob:!0,value:b,output:k}),m("parens")};if(c.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(f)){let g=!1,k=f.replace(u,(S,T,oe,he,Se,On)=>he==="\\"?(g=!0,S):he==="?"?T?T+he+(Se?v.repeat(Se.length):""):On===0?be+(Se?v.repeat(Se.length):""):v.repeat(oe.length):he==="."?y.repeat(oe.length):he==="*"?T?T+he+(Se?ne:""):ne:T?S:`\\${S}`);return g===!0&&(c.unescape===!0?k=k.replace(/\\/g,""):k=k.replace(/\\+/g,S=>S.length%2===0?"\\\\":S?"\\":"")),k===f&&c.contains===!0?($.output=f,$):($.output=e.wrapOutput(k,$,d),$)}for(;!K();){if(b=ee(),b==="\0")continue;if(b==="\\"){const S=Y();if(S==="/"&&c.bash!==!0||S==="."||S===";")continue;if(!S){b+="\\",D({type:"text",value:b});continue}const T=/^\\+/.exec(pe());let oe=0;if(T&&T[0].length>2&&(oe=T[0].length,$.index+=oe,oe%2!==0&&(b+="\\")),c.unescape===!0?b=ee():b+=ee(),$.brackets===0){D({type:"text",value:b});continue}}if($.brackets>0&&(b!=="]"||I.value==="["||I.value==="[^")){if(c.posix!==!1&&b===":"){const S=I.value.slice(1);if(S.includes("[")&&(I.posix=!0,S.includes(":"))){const T=I.value.lastIndexOf("["),oe=I.value.slice(0,T),he=I.value.slice(T+2),Se=n[he];if(Se){I.value=oe+Se,$.backtrack=!0,ee(),!w.output&&h.indexOf(I)===1&&(w.output=W);continue}}}(b==="["&&Y()!==":"||b==="-"&&Y()==="]")&&(b=`\\${b}`),b==="]"&&(I.value==="["||I.value==="[^")&&(b=`\\${b}`),c.posix===!0&&b==="!"&&I.value==="["&&(b="^"),I.value+=b,de({value:b});continue}if($.quotes===1&&b!=='"'){b=e.escapeRegex(b),I.value+=b,de({value:b});continue}if(b==='"'){$.quotes=$.quotes===1?0:1,c.keepQuotes===!0&&D({type:"text",value:b});continue}if(b==="("){Oe("parens"),D({type:"paren",value:b});continue}if(b===")"){if($.parens===0&&c.strictBrackets===!0)throw new SyntaxError(a("opening","("));const S=ge[ge.length-1];if(S&&$.parens===S.parens+1){B(ge.pop());continue}D({type:"paren",value:b,output:$.parens?")":"\\)"}),m("parens");continue}if(b==="["){if(c.nobracket===!0||!pe().includes("]")){if(c.nobracket!==!0&&c.strictBrackets===!0)throw new SyntaxError(a("closing","]"));b=`\\${b}`}else Oe("brackets");D({type:"bracket",value:b});continue}if(b==="]"){if(c.nobracket===!0||I&&I.type==="bracket"&&I.value.length===1){D({type:"text",value:b,output:`\\${b}`});continue}if($.brackets===0){if(c.strictBrackets===!0)throw new SyntaxError(a("opening","["));D({type:"text",value:b,output:`\\${b}`});continue}m("brackets");const S=I.value.slice(1);if(I.posix!==!0&&S[0]==="^"&&!S.includes("/")&&(b=`/${b}`),I.value+=b,de({value:b}),c.literalBrackets===!1||e.hasRegexChars(S))continue;const T=e.escapeRegex(I.value);if($.output=$.output.slice(0,-I.value.length),c.literalBrackets===!0){$.output+=T,I.value=T;continue}I.value=`(${E}${T}|${I.value})`,$.output+=I.value;continue}if(b==="{"&&c.nobrace!==!0){Oe("braces");const S={type:"brace",value:b,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};_e.push(S),D(S);continue}if(b==="}"){const S=_e[_e.length-1];if(c.nobrace===!0||!S){D({type:"text",value:b,output:b});continue}let T=")";if(S.dots===!0){const oe=h.slice(),he=[];for(let Se=oe.length-1;Se>=0&&(h.pop(),oe[Se].type!=="brace");Se--)oe[Se].type!=="dots"&&he.unshift(oe[Se].value);T=o(he,c),$.backtrack=!0}if(S.comma!==!0&&S.dots!==!0){const oe=$.output.slice(0,S.outputIndex),he=$.tokens.slice(S.tokensIndex);S.value=S.output="\\{",b=T="\\}",$.output=oe;for(const Se of he)$.output+=Se.output||Se.value}D({type:"brace",value:b,output:T}),m("braces"),_e.pop();continue}if(b==="|"){ge.length>0&&ge[ge.length-1].conditions++,D({type:"text",value:b});continue}if(b===","){let S=b;const T=_e[_e.length-1];T&&q[q.length-1]==="braces"&&(T.comma=!0,S="|"),D({type:"comma",value:b,output:S});continue}if(b==="/"){if(I.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",h.pop(),I=w;continue}D({type:"slash",value:b,output:R});continue}if(b==="."){if($.braces>0&&I.type==="dot"){I.value==="."&&(I.output=y);const S=_e[_e.length-1];I.type="dots",I.output+=b,I.value+=b,S.dots=!0;continue}if($.braces+$.parens===0&&I.type!=="bos"&&I.type!=="slash"){D({type:"text",value:b,output:y});continue}D({type:"dot",value:b,output:y});continue}if(b==="?"){if(!(I&&I.value==="(")&&c.noextglob!==!0&&Y()==="("&&Y(2)!=="?"){P("qmark",b);continue}if(I&&I.type==="paren"){const T=Y();let oe=b;if(T==="<"&&!e.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(I.value==="("&&!/[!=<:]/.test(T)||T==="<"&&!/<([!=]|\w+>)/.test(pe()))&&(oe=`\\${b}`),D({type:"text",value:b,output:oe});continue}if(c.dot!==!0&&(I.type==="slash"||I.type==="bos")){D({type:"qmark",value:b,output:H});continue}D({type:"qmark",value:b,output:v});continue}if(b==="!"){if(c.noextglob!==!0&&Y()==="("&&(Y(2)!=="?"||!/[!=<:]/.test(Y(3)))){P("negate",b);continue}if(c.nonegate!==!0&&$.index===0){$e();continue}}if(b==="+"){if(c.noextglob!==!0&&Y()==="("&&Y(2)!=="?"){P("plus",b);continue}if(I&&I.value==="("||c.regex===!1){D({type:"plus",value:b,output:M});continue}if(I&&(I.type==="bracket"||I.type==="paren"||I.type==="brace")||$.parens>0){D({type:"plus",value:b});continue}D({type:"plus",value:M});continue}if(b==="@"){if(c.noextglob!==!0&&Y()==="("&&Y(2)!=="?"){D({type:"at",extglob:!0,value:b,output:""});continue}D({type:"text",value:b});continue}if(b!=="*"){(b==="$"||b==="^")&&(b=`\\${b}`);const S=r.exec(pe());S&&(b+=S[0],$.index+=S[0].length),D({type:"text",value:b});continue}if(I&&(I.type==="globstar"||I.star===!0)){I.type="star",I.star=!0,I.value+=b,I.output=ne,$.backtrack=!0,$.globstar=!0,se(b);continue}let g=pe();if(c.noextglob!==!0&&/^\([^?]/.test(g)){P("star",b);continue}if(I.type==="star"){if(c.noglobstar===!0){se(b);continue}const S=I.prev,T=S.prev,oe=S.type==="slash"||S.type==="bos",he=T&&(T.type==="star"||T.type==="globstar");if(c.bash===!0&&(!oe||g[0]&&g[0]!=="/")){D({type:"star",value:b,output:""});continue}const Se=$.braces>0&&(S.type==="comma"||S.type==="brace"),On=ge.length&&(S.type==="pipe"||S.type==="paren");if(!oe&&S.type!=="paren"&&!Se&&!On){D({type:"star",value:b,output:""});continue}for(;g.slice(0,3)==="/**";){const en=f[$.index+4];if(en&&en!=="/")break;g=g.slice(3),se("/**",3)}if(S.type==="bos"&&K()){I.type="globstar",I.value+=b,I.output=U(c),$.output=I.output,$.globstar=!0,se(b);continue}if(S.type==="slash"&&S.prev.type!=="bos"&&!he&&K()){$.output=$.output.slice(0,-(S.output+I.output).length),S.output=`(?:${S.output}`,I.type="globstar",I.output=U(c)+(c.strictSlashes?")":"|$)"),I.value+=b,$.globstar=!0,$.output+=S.output+I.output,se(b);continue}if(S.type==="slash"&&S.prev.type!=="bos"&&g[0]==="/"){const en=g[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(S.output+I.output).length),S.output=`(?:${S.output}`,I.type="globstar",I.output=`${U(c)}${R}|${R}${en})`,I.value+=b,$.output+=S.output+I.output,$.globstar=!0,se(b+ee()),D({type:"slash",value:"/",output:""});continue}if(S.type==="bos"&&g[0]==="/"){I.type="globstar",I.value+=b,I.output=`(?:^|${R}|${U(c)}${R})`,$.output=I.output,$.globstar=!0,se(b+ee()),D({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-I.output.length),I.type="globstar",I.output=U(c),I.value+=b,$.output+=I.output,$.globstar=!0,se(b);continue}const k={type:"star",value:b,output:ne};if(c.bash===!0){k.output=".*?",(I.type==="bos"||I.type==="slash")&&(k.output=re+k.output),D(k);continue}if(I&&(I.type==="bracket"||I.type==="paren")&&c.regex===!0){k.output=b,D(k);continue}($.index===$.start||I.type==="slash"||I.type==="dot")&&(I.type==="dot"?($.output+=j,I.output+=j):c.dot===!0?($.output+=L,I.output+=L):($.output+=re,I.output+=re),Y()!=="*"&&($.output+=W,I.output+=W)),D(k)}for(;$.brackets>0;){if(c.strictBrackets===!0)throw new SyntaxError(a("closing","]"));$.output=e.escapeLast($.output,"["),m("brackets")}for(;$.parens>0;){if(c.strictBrackets===!0)throw new SyntaxError(a("closing",")"));$.output=e.escapeLast($.output,"("),m("parens")}for(;$.braces>0;){if(c.strictBrackets===!0)throw new SyntaxError(a("closing","}"));$.output=e.escapeLast($.output,"{"),m("braces")}if(c.strictSlashes!==!0&&(I.type==="star"||I.type==="bracket")&&D({type:"maybe_slash",value:"",output:`${R}?`}),$.backtrack===!0){$.output="";for(const g of $.tokens)$.output+=g.output!=null?g.output:g.value,g.suffix&&($.output+=g.suffix)}return $};return l.fastpaths=(f,d)=>{const c={...d},A=typeof c.maxLength=="number"?Math.min(t,c.maxLength):t,F=f.length;if(F>A)throw new SyntaxError(`Input length: ${F}, exceeds maximum allowed length: ${A}`);f=s[f]||f;const w=e.isWindows(d),{DOT_LITERAL:h,SLASH_LITERAL:E,ONE_CHAR:x,DOTS_SLASH:C,NO_DOT:_,NO_DOTS:y,NO_DOTS_SLASH:M,STAR:R,START_ANCHOR:W}=i.globChars(w),z=c.dot?y:_,G=c.dot?M:_,j=c.capture?"":"?:",L={negated:!1,prefix:""};let v=c.bash===!0?".*?":R;c.capture&&(v=`(${v})`);const H=re=>re.noglobstar===!0?v:`(${j}(?:(?!${W}${re.dot?C:h}).)*?)`,V=re=>{switch(re){case"*":return`${z}${x}${v}`;case".*":return`${h}${x}${v}`;case"*.*":return`${z}${v}${h}${x}${v}`;case"*/*":return`${z}${v}${E}${x}${G}${v}`;case"**":return z+H(c);case"**/*":return`(?:${z}${H(c)}${E})?${G}${x}${v}`;case"**/*.*":return`(?:${z}${H(c)}${E})?${G}${v}${h}${x}${v}`;case"**/.*":return`(?:${z}${H(c)}${E})?${h}${x}${v}`;default:{const be=/^(.*?)\.(\w+)$/.exec(re);if(!be)return;const ne=V(be[1]);return ne?ne+h+be[2]:void 0}}},X=e.removePrefix(f,L);let U=V(X);return U&&c.strictSlashes!==!0&&(U+=`${E}?`),U},Pi=l,Pi}var ji,vs;function Ya(){if(vs)return ji;vs=1;const i=Ln,e=qa(),t=Ka(),n=Sn(),r=_n(),u=o=>o&&typeof o=="object"&&!Array.isArray(o),s=(o,a,l=!1)=>{if(Array.isArray(o)){const E=o.map(C=>s(C,a,l));return C=>{for(const _ of E){const y=_(C);if(y)return y}return!1}}const f=u(o)&&o.tokens&&o.input;if(o===""||typeof o!="string"&&!f)throw new TypeError("Expected pattern to be a non-empty string");const d=a||{},c=n.isWindows(a),A=f?s.compileRe(o,a):s.makeRe(o,a,!1,!0),F=A.state;delete A.state;let w=()=>!1;if(d.ignore){const E={...a,ignore:null,onMatch:null,onResult:null};w=s(d.ignore,E,l)}const h=(E,x=!1)=>{const{isMatch:C,match:_,output:y}=s.test(E,A,a,{glob:o,posix:c}),M={glob:o,state:F,regex:A,posix:c,input:E,output:y,match:_,isMatch:C};return typeof d.onResult=="function"&&d.onResult(M),C===!1?(M.isMatch=!1,x?M:!1):w(E)?(typeof d.onIgnore=="function"&&d.onIgnore(M),M.isMatch=!1,x?M:!1):(typeof d.onMatch=="function"&&d.onMatch(M),x?M:!0)};return l&&(h.state=F),h};return s.test=(o,a,l,{glob:f,posix:d}={})=>{if(typeof o!="string")throw new TypeError("Expected input to be a string");if(o==="")return{isMatch:!1,output:""};const c=l||{},A=c.format||(d?n.toPosixSlashes:null);let F=o===f,w=F&&A?A(o):o;return F===!1&&(w=A?A(o):o,F=w===f),(F===!1||c.capture===!0)&&(c.matchBase===!0||c.basename===!0?F=s.matchBase(o,a,l,d):F=a.exec(w)),{isMatch:!!F,match:F,output:w}},s.matchBase=(o,a,l,f=n.isWindows(l))=>(a instanceof RegExp?a:s.makeRe(a,l)).test(i.basename(o)),s.isMatch=(o,a,l)=>s(a,l)(o),s.parse=(o,a)=>Array.isArray(o)?o.map(l=>s.parse(l,a)):t(o,{...a,fastpaths:!1}),s.scan=(o,a)=>e(o,a),s.compileRe=(o,a,l=!1,f=!1)=>{if(l===!0)return o.output;const d=a||{},c=d.contains?"":"^",A=d.contains?"":"$";let F=`${c}(?:${o.output})${A}`;o&&o.negated===!0&&(F=`^(?!${F}).*$`);const w=s.toRegex(F,a);return f===!0&&(w.state=o),w},s.makeRe=(o,a={},l=!1,f=!1)=>{if(!o||typeof o!="string")throw new TypeError("Expected a non-empty string");let d={negated:!1,fastpaths:!0};return a.fastpaths!==!1&&(o[0]==="."||o[0]==="*")&&(d.output=t.fastpaths(o,a)),d.output||(d=t(o,a)),s.compileRe(d,a,l,f)},s.toRegex=(o,a)=>{try{const l=a||{};return new RegExp(o,l.flags||(l.nocase?"i":""))}catch(l){if(a&&a.debug===!0)throw l;return/$^/}},s.constants=r,ji=s,ji}var Ti,xs;function Ja(){return xs||(xs=1,Ti=Ya()),Ti}var Mi,$s;function Qa(){if($s)return Mi;$s=1;const i=Zi,e=za(),t=Ja(),n=Sn(),r=o=>o===""||o==="./",u=o=>{const a=o.indexOf("{");return a>-1&&o.indexOf("}",a)>-1},s=(o,a,l)=>{a=[].concat(a),o=[].concat(o);let f=new Set,d=new Set,c=new Set,A=0,F=E=>{c.add(E.output),l&&l.onResult&&l.onResult(E)};for(let E=0;E<a.length;E++){let x=t(String(a[E]),{...l,onResult:F},!0),C=x.state.negated||x.state.negatedExtglob;C&&A++;for(let _ of o){let y=x(_,!0);(C?!y.isMatch:y.isMatch)&&(C?f.add(y.output):(f.delete(y.output),d.add(y.output)))}}let h=(A===a.length?[...c]:[...d]).filter(E=>!f.has(E));if(l&&h.length===0){if(l.failglob===!0)throw new Error(`No matches found for "${a.join(", ")}"`);if(l.nonull===!0||l.nullglob===!0)return l.unescape?a.map(E=>E.replace(/\\/g,"")):a}return h};return s.match=s,s.matcher=(o,a)=>t(o,a),s.isMatch=(o,a,l)=>t(a,l)(o),s.any=s.isMatch,s.not=(o,a,l={})=>{a=[].concat(a).map(String);let f=new Set,d=[],c=F=>{l.onResult&&l.onResult(F),d.push(F.output)},A=new Set(s(o,a,{...l,onResult:c}));for(let F of d)A.has(F)||f.add(F);return[...f]},s.contains=(o,a,l)=>{if(typeof o!="string")throw new TypeError(`Expected a string: "${i.inspect(o)}"`);if(Array.isArray(a))return a.some(f=>s.contains(o,f,l));if(typeof a=="string"){if(r(o)||r(a))return!1;if(o.includes(a)||o.startsWith("./")&&o.slice(2).includes(a))return!0}return s.isMatch(o,a,{...l,contains:!0})},s.matchKeys=(o,a,l)=>{if(!n.isObject(o))throw new TypeError("Expected the first argument to be an object");let f=s(Object.keys(o),a,l),d={};for(let c of f)d[c]=o[c];return d},s.some=(o,a,l)=>{let f=[].concat(o);for(let d of[].concat(a)){let c=t(String(d),l);if(f.some(A=>c(A)))return!0}return!1},s.every=(o,a,l)=>{let f=[].concat(o);for(let d of[].concat(a)){let c=t(String(d),l);if(!f.every(A=>c(A)))return!1}return!0},s.all=(o,a,l)=>{if(typeof o!="string")throw new TypeError(`Expected a string: "${i.inspect(o)}"`);return[].concat(a).every(f=>t(f,l)(o))},s.capture=(o,a,l)=>{let f=n.isWindows(l),c=t.makeRe(String(o),{...l,capture:!0}).exec(f?n.toPosixSlashes(a):a);if(c)return c.slice(1).map(A=>A===void 0?"":A)},s.makeRe=(...o)=>t.makeRe(...o),s.scan=(...o)=>t.scan(...o),s.parse=(o,a)=>{let l=[];for(let f of[].concat(o||[]))for(let d of e(String(f),a))l.push(t.parse(d,a));return l},s.braces=(o,a)=>{if(typeof o!="string")throw new TypeError("Expected a string");return a&&a.nobrace===!0||!u(o)?[o]:e(o,a)},s.braceExpand=(o,a)=>{if(typeof o!="string")throw new TypeError("Expected a string");return s.braces(o,{...a,expand:!0})},s.hasBraces=u,Mi=s,Mi}var Xa=Qa();const Bs=Js(Xa),Za={useRecommendedBuildConfig:!0,removeViteModuleLoader:!1,deleteInlinedFiles:!0};function ec(i,e,t,n=!1){const r=new RegExp(`<script([^>]*?) src="[./]*${e}"([^>]*)></script>`),u=/"?__VITE_PRELOAD__"?/g,s=t.replace(u,"void 0").replace(/<(\/script>|!--)/g,"\\x3C$1"),o=i.replace(r,(a,l,f)=>`<script${l}${f}>${s.trim()}</script>`);return n?uc(o):o}function tc(i,e,t){const n=new RegExp(`<link([^>]*?) href="[./]*${e}"([^>]*?)>`),r=t.replace('@charset "UTF-8";',"");return i.replace(n,(s,o,a)=>`<style${o}${a}>${r.trim()}</style>`)}const nc=/\.[mc]?js$/,ic=/\.css$/,rc=/\.html?$/;function sc({useRecommendedBuildConfig:i=!0,removeViteModuleLoader:e=!1,inlinePattern:t=[],deleteInlinedFiles:n=!0}=Za){function r(u){console.debug(`NOTE: asset not inlined: ${u}`)}return{name:"vite:singlefile",config:i?oc:void 0,enforce:"post",generateBundle:(u,s)=>{console.debug(`
|
|
415
415
|
`);const o={html:[],css:[],js:[],other:[]};for(const l of Object.keys(s))rc.test(l)?o.html.push(l):ic.test(l)?o.css.push(l):nc.test(l)?o.js.push(l):o.other.push(l);const a=[];for(const l of o.html){const f=s[l];let d=f.source;for(const c of o.js){if(t.length&&!Bs.isMatch(c,t)){r(c);continue}const A=s[c];A.code!=null&&(console.debug(`Inlining: ${c}`),a.push(c),d=ec(d,A.fileName,A.code,e))}for(const c of o.css){if(t.length&&!Bs.isMatch(c,t)){r(c);continue}const A=s[c];console.debug(`Inlining: ${c}`),a.push(c),d=tc(d,A.fileName,A.source)}f.source=d}if(n)for(const l of a)delete s[l];for(const l of o.other)r(l)}}}const uc=i=>i.replace(/(<script type="module" crossorigin>\s*)\(function(?: polyfill)?\(\)\s*\{[\s\S]*?\}\)\(\);/,'<script type="module">'),oc=i=>{i.build||(i.build={}),i.build.assetsInlineLimit=()=>!0,i.build.chunkSizeWarningLimit=1e8,i.build.cssCodeSplit=!1,i.base="./",i.build.assetsDir="",i.build.rollupOptions||(i.build.rollupOptions={}),i.build.rollupOptions.output||(i.build.rollupOptions.output={});const e=t=>{t.inlineDynamicImports=!0};if(Array.isArray(i.build.rollupOptions.output))for(const t of i.build.rollupOptions.output)e(t);else e(i.build.rollupOptions.output)},ki=async({languageServices:i,likec4AssetsDir:e,...t})=>{const n=t.customLogger??We("c4:vite"),r=oi(),u=t?.useOverviewGraph===!0;n.info(`${O.cyan("likec4 app root")} ${O.dim(r)}`);const s=t.outputDir??ce(i.workspace,"dist");n.info(O.cyan("output")+" "+O.dim(s));let o="/";t.base&&(o=Qs(t.base),!Xs(o)&&o!=="./"&&(o=Zs(o))),o!=="/"&&n.info(`${O.green("app base url")} ${O.dim(o)}`);const a=t.webcomponentPrefix??"likec4";return{isDev:!1,likec4AssetsDir:e,webcomponentPrefix:a,root:r,languageServices:i,clearScreen:!1,base:o,resolve:{conditions:["production"],dedupe:["react","react-dom","react/jsx-runtime","react/jsx-dev-runtime","react-dom/client"],alias:{...Jr(),"likec4/previews":e}},configFile:!1,mode:"production",optimizeDeps:{force:!0,include:["react","react-dom","react/jsx-runtime","react/jsx-dev-runtime","react/jsx-dev-runtime","react-dom/client"]},define:{WEBCOMPONENT_PREFIX:JSON.stringify(a),__USE_STYLE_BUNDLE__:"false",__USE_OVERVIEW_GRAPH__:u?"true":"false",__USE_HASH_HISTORY__:t?.useHashHistory===!0?"true":"false","process.env.NODE_ENV":'"production"'},build:{outDir:s,modulePreload:!1,emptyOutDir:!1,cssCodeSplit:!1,sourcemap:!1,cssMinify:!0,minify:!0,copyPublicDir:!0,chunkSizeWarningLimit:ci,rollupOptions:{treeshake:{preset:"recommended"},output:{hoistTransitiveImports:!1,compact:!0}}},customLogger:n,plugins:[ir(),Ei({languageServices:i,useOverviewGraph:u})].concat(t.outputSingleFile?[sc()]:[])}};async function Hi({languageServices:i,outDir:e,base:t,webcomponentPrefix:n="likec4",filename:r="likec4-views.js"}){const u=We("c4:lib"),s=oi();return u.info(O.cyan("outDir")+" "+O.dim(e)),{root:s,clearScreen:!1,base:t,configFile:!1,publicDir:!1,mode:"production",resolve:{conditions:["production"]},define:{WEBCOMPONENT_PREFIX:JSON.stringify(n),"process.env.NODE_ENV":'"production"'},esbuild:{...ui},build:{outDir:e,emptyOutDir:!1,sourcemap:!1,minify:!0,assetsInlineLimit:100*1024,chunkSizeWarningLimit:ci,lib:{entry:"webcomponent/webcomponent.js",fileName(o,a){return r},formats:["iife"],name:"LikeC4Views"},commonjsOptions:{defaultIsModuleExports:o=>o.includes("react")?!0:"auto",requireReturnsDefault:"auto"},rollupOptions:{treeshake:{preset:"recommended"},output:{format:"iife",hoistTransitiveImports:!1,compact:!0}}},customLogger:u,plugins:[Ei({languageServices:i,useOverviewGraph:!1})]}}const ac=["favicon.ico","robots.txt"],cc=async({buildWebcomponent:i=!0,webcomponentPrefix:e="likec4",languageServices:t,likec4AssetsDir:n,outputSingleFile:r,...u})=>{n??=await nn(Lt(rn(),".likec4-assets-"));const{isDev:s,...o}=await ki({...u,languageServices:t,likec4AssetsDir:n,webcomponentPrefix:e,outputSingleFile:r}),a=await ai();for(const f of ac){const d=ce(o.root,f);it(d)&&tr(d,ce(a,f))}const l=await t.diagrams();if(l.length===0)throw process.exitCode=1,new Error("no views found");if(l.forEach(f=>{f.hasLayoutDrift&&o.customLogger.warn(O.yellow("drift detected, manual layout can not be applied, view:")+" "+O.red(f.id))}),i){const f=await Hi({webcomponentPrefix:e,languageServices:t,outDir:a,base:o.base});await Pt(f)}if(await Pt({...o,publicDir:a,mode:"production"}),r)for(let f of Cu(ce(o.build.outDir)).filter(d=>d!=="index.html"))Tn(ce(o.build.outDir,f),{recursive:!0});else{const f=ce(o.build.outDir,"index.html");it(f)&&tr(f,ce(o.build.outDir,"404.html"))}};function Os(i){if(i.resolvedUrls)return Ki(i.resolvedUrls.network)??Ki(i.resolvedUrls.local)}function Rs(i){if(!i.resolvedUrls)throw new Error("Vite server is not ready, no resolvedUrls");Be.box([O.green("LikeC4 served at:"),"",O.dim("Local: ")+i.resolvedUrls.local.join(`
|
|
416
416
|
`+"".padEnd(9," ")),O.dim("Network: ")+i.resolvedUrls.network.join(`
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";require("@likec4/core");const model=require("@likec4/core/model"),LikeC4=require("./shared/likec4.DIyCHEbR.cjs");require("node:fs"),require("node:path"),require("node:url"),require("tty"),require("node:util"),require("util"),require("path"),require("os"),require("crypto"),require("net"),require("url"),require("fs"),require("child_process"),require("node:process"),require("node:tty"),require("@likec4/core/types"),require("events"),require("buffer"),require("@hpcc-js/wasm-graphviz"),require("@likec4/core/compute-view"),require("vite"),require("node:child_process"),require("node:string_decoder"),require("node:timers/promises"),require("node:os"),require("node:events"),require("node:v8"),require("node:stream"),require("node:buffer"),require("node:stream/promises"),exports.LikeC4DeploymentModel=model.LikeC4DeploymentModel,exports.LikeC4Model=model.LikeC4Model,exports.LikeC4ViewModel=model.LikeC4ViewModel,exports.LikeC4=LikeC4.L;
|