likec4 1.20.2 → 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-XuOb1YP0.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-BTT9mi5e.js → main-DbAbBULM.js} +5487 -5443
- 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 +1277 -1145
- package/dist/cli/index.cjs +67 -65
- package/dist/cli/index.mjs +109 -107
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +114 -659
- package/dist/index.d.mts +114 -659
- package/dist/index.d.ts +114 -659
- 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 +24 -22
- package/react/index.js +947 -820
- package/react/style.css +1 -1
- package/dist/shared/likec4.DpEZnw1B.cjs +0 -1856
- package/dist/shared/likec4.EF3jY6Mw.mjs +0 -1856
package/dist/cli/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{f as
|
|
3
|
-
`).map(r=>r.split(" "));let n=0;return t.forEach(r=>{r.length>1&&
|
|
4
|
-
`)}rowToString(e,t){return this.rasterize(e).forEach((n,r)=>{let
|
|
5
|
-
`):r=
|
|
6
|
-
`),
|
|
7
|
-
`),r+=i.charAt(s);return t&&n&&(r=`${t}${r}${n}`),r}function Hs(i){return Vs(i,{stringWidth:e=>[...e].length,stripAnsi:Mi,wrap:zs})}function Gs(i,e){let t=Be(".",i),n;for(vi(t).isDirectory()||(t=Sn(t));;){if(n=e(t,Es(t)),n)return Be(t,n);if(t=Sn(n=t),n===t)break}}function Lt(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 s=r?r[0].length:0;s<i.length;s++){let u=i.charAt(s);n&&(n=!1,u=u.toUpperCase()),s!==0&&(u==="-"||u==="_")?n=!0:u!=="-"&&u!=="_"&&(t+=u)}return t}}function Ti(i,e){const t=i.toLowerCase();e=e||"-";let n="";for(let r=0;r<i.length;r++){const s=t.charAt(r),u=i.charAt(r);s!==u&&r>0?n+=`${e}${t.charAt(r)}`:n+=u}return n}function Ri(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 Ys(i){if(Array.isArray(i))return i.map(u=>typeof u!="string"?u+"":u);i=i.trim();let e=0,t=null,n=null,r=null;const s=[];for(let u=0;u<i.length;u++){if(t=n,n=i.charAt(u),n===" "&&!r){t!==" "&&e++;continue}n===r?r=null:(n==="'"||n==='"')&&!r&&(r=n),s[e]||(s[e]=""),s[e]+=n}return s}var Pe;(function(i){i.BOOLEAN="boolean",i.STRING="string",i.NUMBER="number",i.ARRAY="array"})(Pe||(Pe={}));let Ge;class qs{constructor(e){Ge=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=Ys(e),s=typeof e=="string",u=Js(Object.assign(Object.create(null),n.alias)),a=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),c=Object.assign(Object.create(null),n.default),h=n.configObjects||[],l=n.envPrefix,f=a["populate--"],p=f?"--":"_",C=Object.create(null),F=Object.create(null),w=n.__||Ge.format,m={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:[]},y=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,S=new RegExp("^--"+a["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(d){const D=typeof d=="object"?d.key:d,B=Object.keys(d).map(function(E){return{boolean:"bools",string:"strings",number:"numbers"}[E]}).filter(Boolean).pop();B&&(m[B][D]=!0),m.arrays[D]=!0,m.keys.push(D)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(d){m.bools[d]=!0,m.keys.push(d)}),[].concat(n.string||[]).filter(Boolean).forEach(function(d){m.strings[d]=!0,m.keys.push(d)}),[].concat(n.number||[]).filter(Boolean).forEach(function(d){m.numbers[d]=!0,m.keys.push(d)}),[].concat(n.count||[]).filter(Boolean).forEach(function(d){m.counts[d]=!0,m.keys.push(d)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(d){m.normalize[d]=!0,m.keys.push(d)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([d,D])=>{typeof D=="number"&&(m.nargs[d]=D,m.keys.push(d))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([d,D])=>{typeof D=="function"&&(m.coercions[d]=D,m.keys.push(d))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(d){m.configs[d]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([d,D])=>{(typeof D=="boolean"||typeof D=="function")&&(m.configs[d]=D)})),st(n.key,u,n.default,m.arrays),Object.keys(c).forEach(function(d){(m.aliases[d]||[]).forEach(function(D){c[D]=c[d]})});let R=null;Qt();let N=[];const W=Object.assign(Object.create(null),{_:[]}),Ce={};for(let d=0;d<r.length;d++){const D=r[d],B=D.replace(/^-{3,}/,"---");let E,g,I,O,P,pe;if(D!=="--"&&/^-/.test(D)&&ie(D))xe(D);else if(B.match(/^---+(=|$)/)){xe(D);continue}else if(D.match(/^--.+=/)||!a["short-option-groups"]&&D.match(/^-.+=/))O=D.match(/^--?([^=]+)=([\s\S]*)$/),O!==null&&Array.isArray(O)&&O.length>=3&&(M(O[1],m.arrays)?d=it(d,O[1],r,O[2]):M(O[1],m.nargs)!==!1?d=bt(d,O[1],r,O[2]):X(O[1],O[2],!0));else if(D.match(S)&&a["boolean-negation"])O=D.match(S),O!==null&&Array.isArray(O)&&O.length>=2&&(g=O[1],X(g,M(g,m.arrays)?[!1]:!1));else if(D.match(/^--.+/)||!a["short-option-groups"]&&D.match(/^-[^-]+/))O=D.match(/^--?(.+)/),O!==null&&Array.isArray(O)&&O.length>=2&&(g=O[1],M(g,m.arrays)?d=it(d,g,r):M(g,m.nargs)!==!1?d=bt(d,g,r):(P=r[d+1],P!==void 0&&(!P.match(/^-/)||P.match(y))&&!M(g,m.bools)&&!M(g,m.counts)||/^(true|false)$/.test(P)?(X(g,P),d++):X(g,re(g))));else if(D.match(/^-.\..+=/))O=D.match(/^-([^=]+)=([\s\S]*)$/),O!==null&&Array.isArray(O)&&O.length>=3&&X(O[1],O[2]);else if(D.match(/^-.\..+/)&&!D.match(y))P=r[d+1],O=D.match(/^-(.\..+)/),O!==null&&Array.isArray(O)&&O.length>=2&&(g=O[1],P!==void 0&&!P.match(/^-/)&&!M(g,m.bools)&&!M(g,m.counts)?(X(g,P),d++):X(g,re(g)));else if(D.match(/^-[^-]+/)&&!D.match(y)){I=D.slice(1,-1).split(""),E=!1;for(let we=0;we<I.length;we++){if(P=D.slice(we+2),I[we+1]&&I[we+1]==="="){pe=D.slice(we+3),g=I[we],M(g,m.arrays)?d=it(d,g,r,pe):M(g,m.nargs)!==!1?d=bt(d,g,r,pe):X(g,pe),E=!0;break}if(P==="-"){X(I[we],P);continue}if(/[A-Za-z]/.test(I[we])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(P)&&M(P,m.bools)===!1){X(I[we],P),E=!0;break}if(I[we+1]&&I[we+1].match(/\W/)){X(I[we],P),E=!0;break}else X(I[we],re(I[we]))}g=D.slice(-1)[0],!E&&g!=="-"&&(M(g,m.arrays)?d=it(d,g,r):M(g,m.nargs)!==!1?d=bt(d,g,r):(P=r[d+1],P!==void 0&&(!/^(-|--)[^-]/.test(P)||P.match(y))&&!M(g,m.bools)&&!M(g,m.counts)||/^(true|false)$/.test(P)?(X(g,P),d++):X(g,re(g))))}else if(D.match(/^-[0-9]$/)&&D.match(y)&&M(D.slice(1),m.bools))g=D.slice(1),X(g,re(g));else if(D==="--"){N=r.slice(d+1);break}else if(a["halt-at-non-option"]){N=r.slice(d);break}else xe(D)}K(W,!0),K(W,!1),V(W),de(),ne(W,m.aliases,c,!0),he(W),a["set-placeholder-key"]&&rt(W),Object.keys(m.counts).forEach(function(d){We(W,d.split("."))||X(d,0)}),f&&N.length&&(W[p]=[]),N.forEach(function(d){W[p].push(d)}),a["camel-case-expansion"]&&a["strip-dashed"]&&Object.keys(W).filter(d=>d!=="--"&&d.includes("-")).forEach(d=>{delete W[d]}),a["strip-aliased"]&&[].concat(...Object.keys(u).map(d=>u[d])).forEach(d=>{a["camel-case-expansion"]&&d.includes("-")&&delete W[d.split(".").map(D=>Lt(D)).join(".")],delete W[d]});function xe(d){const D=$("_",d);(typeof D=="string"||typeof D=="number")&&W._.push(D)}function bt(d,D,B,E){let g,I=M(D,m.nargs);if(I=typeof I!="number"||isNaN(I)?1:I,I===0)return je(E)||(R=Error(w("Argument unexpected for: %s",D))),X(D,re(D)),d;let O=je(E)?0:1;if(a["nargs-eats-options"])B.length-(d+1)+O<I&&(R=Error(w("Not enough arguments following: %s",D))),O=I;else{for(g=d+1;g<B.length&&(!B[g].match(/^-[^0-9]/)||B[g].match(y)||ie(B[g]));g++)O++;O<I&&(R=Error(w("Not enough arguments following: %s",D)))}let P=Math.min(O,I);for(!je(E)&&P>0&&(X(D,E),P--),g=d+1;g<P+d+1;g++)X(D,B[g]);return d+P}function it(d,D,B,E){let g=[],I=E||B[d+1];const O=M(D,m.nargs);if(M(D,m.bools)&&!/^(true|false)$/.test(I))g.push(!0);else if(je(I)||je(E)&&/^-/.test(I)&&!y.test(I)&&!ie(I)){if(c[D]!==void 0){const P=c[D];g=Array.isArray(P)?P:[P]}}else{je(E)||g.push(v(D,E,!0));for(let P=d+1;P<B.length&&!(!a["greedy-arrays"]&&g.length>0||O&&typeof O=="number"&&g.length>=O||(I=B[P],/^-/.test(I)&&!y.test(I)&&!ie(I)));P++)d=P,g.push(v(D,I,s))}return typeof O=="number"&&(O&&g.length<O||isNaN(O)&&g.length===0)&&(R=Error(w("Not enough arguments following: %s",D))),X(D,g),d}function X(d,D,B=s){if(/-/.test(d)&&a["camel-case-expansion"]){const I=d.split(".").map(function(O){return Lt(O)}).join(".");j(d,I)}const E=v(d,D,B),g=d.split(".");Ve(W,g,E),m.aliases[d]&&m.aliases[d].forEach(function(I){const O=I.split(".");Ve(W,O,E)}),g.length>1&&a["dot-notation"]&&(m.aliases[g[0]]||[]).forEach(function(I){let O=I.split(".");const P=[].concat(g);P.shift(),O=O.concat(P),(m.aliases[d]||[]).includes(O.join("."))||Ve(W,O,E)}),M(d,m.normalize)&&!M(d,m.arrays)&&[d].concat(m.aliases[d]||[]).forEach(function(O){Object.defineProperty(Ce,O,{enumerable:!0,get(){return D},set(P){D=typeof P=="string"?Ge.normalize(P):P}})})}function j(d,D){m.aliases[d]&&m.aliases[d].length||(m.aliases[d]=[D],C[D]=!0),m.aliases[D]&&m.aliases[D].length||j(D,d)}function v(d,D,B){B&&(D=Ks(D)),(M(d,m.bools)||M(d,m.counts))&&typeof D=="string"&&(D=D==="true");let E=Array.isArray(D)?D.map(function(g){return $(d,g)}):$(d,D);return M(d,m.counts)&&(je(E)||typeof E=="boolean")&&(E=Ln()),M(d,m.normalize)&&M(d,m.arrays)&&(Array.isArray(D)?E=D.map(g=>Ge.normalize(g)):E=Ge.normalize(D)),E}function $(d,D){return!a["parse-positional-numbers"]&&d==="_"||!M(d,m.strings)&&!M(d,m.bools)&&!Array.isArray(D)&&(Ri(D)&&a["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${D}`)))||!je(D)&&M(d,m.numbers))&&(D=Number(D)),D}function V(d){const D=Object.create(null);ne(D,m.aliases,c),Object.keys(m.configs).forEach(function(B){const E=d[B]||D[B];if(E)try{let g=null;const I=Ge.resolve(Ge.cwd(),E),O=m.configs[B];if(typeof O=="function"){try{g=O(I)}catch(P){g=P}if(g instanceof Error){R=g;return}}else g=Ge.require(I);Q(g)}catch(g){g.name==="PermissionDenied"?R=g:d[B]&&(R=Error(w("Invalid JSON config file: %s",E)))}})}function Q(d,D){Object.keys(d).forEach(function(B){const E=d[B],g=D?D+"."+B:B;typeof E=="object"&&E!==null&&!Array.isArray(E)&&a["dot-notation"]?Q(E,g):(!We(W,g.split("."))||M(g,m.arrays)&&a["combine-arrays"])&&X(g,E)})}function de(){typeof h<"u"&&h.forEach(function(d){Q(d)})}function K(d,D){if(typeof l>"u")return;const B=typeof l=="string"?l:"",E=Ge.env();Object.keys(E).forEach(function(g){if(B===""||g.lastIndexOf(B,0)===0){const I=g.split("__").map(function(O,P){return P===0&&(O=O.substring(B.length)),Lt(O)});(D&&m.configs[I.join(".")]||!D)&&!We(d,I)&&X(I.join("."),E[g])}})}function he(d){let D;const B=new Set;Object.keys(d).forEach(function(E){if(!B.has(E)&&(D=M(E,m.coercions),typeof D=="function"))try{const g=$(E,D(d[E]));[].concat(m.aliases[E]||[],E).forEach(I=>{B.add(I),d[I]=g})}catch(g){R=g}})}function rt(d){return m.keys.forEach(D=>{~D.indexOf(".")||typeof d[D]>"u"&&(d[D]=void 0)}),d}function ne(d,D,B,E=!1){Object.keys(B).forEach(function(g){We(d,g.split("."))||(Ve(d,g.split("."),B[g]),E&&(F[g]=!0),(D[g]||[]).forEach(function(I){We(d,I.split("."))||Ve(d,I.split("."),B[g])}))})}function We(d,D){let B=d;a["dot-notation"]||(D=[D.join(".")]),D.slice(0,-1).forEach(function(g){B=B[g]||{}});const E=D[D.length-1];return typeof B!="object"?!1:E in B}function Ve(d,D,B){let E=d;a["dot-notation"]||(D=[D.join(".")]),D.slice(0,-1).forEach(function(pe){pe=Ui(pe),typeof E=="object"&&E[pe]===void 0&&(E[pe]={}),typeof E[pe]!="object"||Array.isArray(E[pe])?(Array.isArray(E[pe])?E[pe].push({}):E[pe]=[E[pe],{}],E=E[pe][E[pe].length-1]):E=E[pe]});const g=Ui(D[D.length-1]),I=M(D.join("."),m.arrays),O=Array.isArray(B);let P=a["duplicate-arguments-array"];!P&&M(g,m.nargs)&&(P=!0,(!je(E[g])&&m.nargs[g]===1||Array.isArray(E[g])&&E[g].length===m.nargs[g])&&(E[g]=void 0)),B===Ln()?E[g]=Ln(E[g]):Array.isArray(E[g])?P&&I&&O?E[g]=a["flatten-duplicate-arrays"]?E[g].concat(B):(Array.isArray(E[g][0])?E[g]:[E[g]]).concat([B]):!P&&!!I==!!O?E[g]=B:E[g]=E[g].concat([B]):E[g]===void 0&&I?E[g]=O?B:[B]:P&&!(E[g]===void 0||M(g,m.counts)||M(g,m.bools))?E[g]=[E[g],B]:E[g]=B}function st(...d){d.forEach(function(D){Object.keys(D||{}).forEach(function(B){m.aliases[B]||(m.aliases[B]=[].concat(u[B]||[]),m.aliases[B].concat(B).forEach(function(E){if(/-/.test(E)&&a["camel-case-expansion"]){const g=Lt(E);g!==B&&m.aliases[B].indexOf(g)===-1&&(m.aliases[B].push(g),C[g]=!0)}}),m.aliases[B].concat(B).forEach(function(E){if(E.length>1&&/[A-Z]/.test(E)&&a["camel-case-expansion"]){const g=Ti(E,"-");g!==B&&m.aliases[B].indexOf(g)===-1&&(m.aliases[B].push(g),C[g]=!0)}}),m.aliases[B].forEach(function(E){m.aliases[E]=[B].concat(m.aliases[B].filter(function(g){return E!==g}))}))})})}function M(d,D){const B=[].concat(m.aliases[d]||[],d),E=Object.keys(D),g=B.find(I=>E.includes(I));return g?D[g]:!1}function vn(d){const D=Object.keys(m);return[].concat(D.map(E=>m[E])).some(function(E){return Array.isArray(E)?E.includes(d):E[d]})}function k(d,...D){return[].concat(...D).some(function(E){const g=d.match(E);return g&&vn(g[1])})}function te(d){if(d.match(y)||!d.match(/^-[^-]+/))return!1;let D=!0,B;const E=d.slice(1).split("");for(let g=0;g<E.length;g++){if(B=d.slice(g+2),!vn(E[g])){D=!1;break}if(E[g+1]&&E[g+1]==="="||B==="-"||/[A-Za-z]/.test(E[g])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(B)||E[g+1]&&E[g+1].match(/\W/))break}return D}function ie(d){return a["unknown-options-as-args"]&&q(d)}function q(d){return d=d.replace(/^-{3,}/,"--"),d.match(y)||te(d)?!1:!k(d,/^-+([^=]+?)=[\s\S]*$/,S,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function re(d){return!M(d,m.bools)&&!M(d,m.counts)&&`${d}`in c?c[d]:ue(Ie(d))}function ue(d){return{[Pe.BOOLEAN]:!0,[Pe.STRING]:"",[Pe.NUMBER]:void 0,[Pe.ARRAY]:[]}[d]}function Ie(d){let D=Pe.BOOLEAN;return M(d,m.strings)?D=Pe.STRING:M(d,m.numbers)?D=Pe.NUMBER:M(d,m.bools)?D=Pe.BOOLEAN:M(d,m.arrays)&&(D=Pe.ARRAY),D}function je(d){return d===void 0}function Qt(){Object.keys(m.counts).find(d=>M(d,m.arrays)?(R=Error(w("Invalid configuration: %s, opts.count excludes opts.array.",d)),!0):M(d,m.nargs)?(R=Error(w("Invalid configuration: %s, opts.count excludes opts.narg.",d)),!0):!1)}return{aliases:Object.assign({},m.aliases),argv:Object.assign(Ce,W),configuration:a,defaulted:Object.assign({},F),error:R,newAliases:Object.assign({},C)}}}function Js(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 s=r+1;s<e.length;s++)if(e[r].filter(function(a){return e[s].indexOf(a)!==-1}).length){e[r]=e[r].concat(e[s]),e.splice(s,1),n=!0;break}}return e.forEach(function(r){r=r.filter(function(u,a,c){return c.indexOf(u)===a});const s=r.pop();s!==void 0&&typeof s=="string"&&(t[s]=r)}),t}function Ln(i){return i!==void 0?i+1:1}function Ui(i){return i==="__proto__"?"___proto___":i}function Ks(i){return typeof i=="string"&&(i[0]==="'"||i[0]==='"')&&i[i.length-1]===i[0]?i.substring(1,i.length-1):i}var Pn,Nn,kn;const Wi=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,Vi=(Nn=(Pn=process==null?void 0:process.versions)===null||Pn===void 0?void 0:Pn.node)!==null&&Nn!==void 0?Nn:(kn=process==null?void 0:process.version)===null||kn===void 0?void 0:kn.slice(1);if(Vi&&Number(Vi.match(/^([^.]+)/)[1])<Wi)throw Error(`yargs parser supports a minimum Node.js version of ${Wi}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const Qs=process?process.env:{},zi=new qs({cwd:process.cwd,env:()=>Qs,format:Oi,normalize:Ds,resolve:Be,require:i=>{if(typeof require<"u")return require(i);if(i.match(/\.json$/))return JSON.parse($n(i,"utf8"));throw Error("only .json config files are supported in ESM")}}),Pt=function(e,t){return zi.parse(e.slice(),t).argv};Pt.detailed=function(i,e){return zi.parse(i.slice(),e)},Pt.camelCase=Lt,Pt.decamelize=Ti,Pt.looksLikeNumber=Ri;function Hi(){return Xs()?0:1}function Xs(){return Zs()&&!process.defaultApp}function Zs(){return!!process.versions.electron}function eu(i){return i.slice(Hi()+1)}function tu(){return process.argv[Hi()]}class fe extends Error{constructor(e){super(e||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,fe)}}const nu={fs:{readFileSync:$n,writeFile:bs},format:Oi,resolve:Be,exists:i=>{try{return vi(i).isFile()}catch{return!1}}};let Ne;class iu{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(),Ne.format.apply(Ne.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 s=function(){};typeof e[e.length-1]=="function"&&(s=e.pop()),this.cache[this.locale]||this._readLocaleFile();let u=r===1?t:n;this.cache[this.locale][t]&&(u=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:s})):s();const a=[u];return~u.indexOf("%d")&&a.push(r),Ne.format.apply(Ne.format,a.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,s){const u=t[s+1];n+=r,typeof u<"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,s=t.cb,u=this._resolveLocaleFile(n,r),a=JSON.stringify(this.cache[r],null,2);Ne.fs.writeFile(u,a,"utf-8",function(c){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),s(c)})}_readLocaleFile(){let e={};const t=this._resolveLocaleFile(this.directory,this.locale);try{Ne.fs.readFileSync&&(e=JSON.parse(Ne.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=Ne.resolve(e,"./",t+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~t.lastIndexOf("_")){const r=Ne.resolve(e,"./",t.split("_")[0]+".json");this._fileExistsSync(r)&&(n=r)}return n}_fileExistsSync(e){return Ne.exists(e)}}function ru(i,e){Ne=e;const t=new iu(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 su=i=>ru(i,nu),uu="require is not supported by ESM",Gi="loading a directory of commands is not supported yet for ESM";let Nt;try{Nt=ys(import.meta.url)}catch{Nt=process.cwd()}const ou=Nt.substring(0,Nt.lastIndexOf("node_modules")),au={assert:{notStrictEqual:ms,strictEqual:gs},cliui:Hs,findUp:Gs,getEnv:i=>process.env[i],inspect:Fs,getCallerFile:()=>{throw new fe(Gi)},getProcessArgvBin:tu,mainFilename:ou||process.cwd(),Parser:Pt,path:{basename:Cs,dirname:Sn,extname:ws,relative:As,resolve:Be},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:$n,require:()=>{throw new fe(uu)},requireDirectory:()=>{throw new fe(Gi)},stringWidth:i=>[...i].length,y18n:su({directory:Be(Nt,"../../../locales"),updateFiles:!1})};function ke(i,e,t,n){t.assert.notStrictEqual(i,e,n)}function Yi(i,e){e.assert.strictEqual(typeof i,"string")}function rn(i){return Object.keys(i)}function le(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 s={cmd:r.replace(n,""),demanded:[],optional:[]};return t.forEach((u,a)=>{let c=!1;u=u.replace(/\s/g,""),/\.+[\]>]/.test(u)&&a===t.length-1&&(c=!0),/^\[/.test(u)?s.optional.push({cmd:u.replace(n,"").split("|"),variadic:c}):s.demanded.push({cmd:u.replace(n,"").split("|"),variadic:c})}),s}const cu=["first","second","third","fourth","fifth","sixth"];function x(i,e,t){function n(){return typeof i=="object"?[{demanded:[],optional:[]},i,e]:[kt(`cmd ${i}`),e,t]}try{let r=0;const[s,u,a]=n(),c=[].slice.call(u);for(;c.length&&c[c.length-1]===void 0;)c.pop();const h=a||c.length;if(h<s.demanded.length)throw new fe(`Not enough arguments provided. Expected ${s.demanded.length} but received ${c.length}.`);const l=s.demanded.length+s.optional.length;if(h>l)throw new fe(`Too many arguments provided. Expected max ${l} but received ${h}.`);s.demanded.forEach(f=>{const p=c.shift(),C=qi(p);f.cmd.filter(w=>w===C||w==="*").length===0&&Ji(C,f.cmd,r),r+=1}),s.optional.forEach(f=>{if(c.length===0)return;const p=c.shift(),C=qi(p);f.cmd.filter(w=>w===C||w==="*").length===0&&Ji(C,f.cmd,r),r+=1})}catch(r){console.warn(r.stack)}}function qi(i){return Array.isArray(i)?"array":i===null?"null":typeof i}function Ji(i,e,t){throw new fe(`Invalid ${cu[t]||"manyith"} argument. Expected ${e.join(" or ")} but received ${i}.`)}class lu{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,t,n=!0,r=!1){if(x("<array|function> [boolean] [boolean] [boolean]",[e,t,n],arguments.length),Array.isArray(e)){for(let s=0;s<e.length;s++){if(typeof e[s]!="function")throw Error("middleware must be a function");const u=e[s];u.applyBeforeValidation=t,u.global=n}Array.prototype.push.apply(this.globalMiddleware,e)}else if(typeof e=="function"){const s=e;s.applyBeforeValidation=t,s.global=n,s.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 s=[...n[t]||[],t];return r.option?!s.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 fu(i){return i?i.map(e=>(e.applyBeforeValidation=!1,e)):[]}function Mt(i,e,t,n){return t.reduce((r,s)=>{if(s.applyBeforeValidation!==n)return r;if(s.mutates){if(s.applied)return r;s.applied=!0}if(le(r))return r.then(u=>Promise.all([u,s(u,e)])).then(([u,a])=>Object.assign(u,a));{const u=s(r,e);return le(u)?u.then(a=>Object.assign(r,a)):Object.assign(r,u)}},i)}function Tt(i,e,t=n=>{throw n}){try{const n=du(i)?i():i;return le(n)?n.then(r=>e(r)):e(n)}catch(n){return t(n)}}function du(i){return typeof i=="function"}function hu(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 yt=/(^\*)|(^\$0)/;class pu{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 s=typeof r.visit=="function"?r.visit:u=>u;r.visit=(u,a,c)=>{const h=s(u,a,c);if(h){if(this.requireCache.has(a))return h;this.requireCache.add(a),this.addHandler(h)}return h},this.shim.requireDirectory({require:t,filename:n},e,r)}addHandler(e,t,n,r,s,u){let a=[];const c=fu(s);if(r=r||(()=>{}),Array.isArray(e))if(gu(e))[e,...a]=e;else for(const h of e)this.addHandler(h);else if(Cu(e)){let h=Array.isArray(e.command)||typeof e.command=="string"?e.command:this.moduleName(e);e.aliases&&(h=[].concat(h).concat(e.aliases)),this.addHandler(h,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated);return}else if(Ki(n)){this.addHandler([e].concat(a),t,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof e=="string"){const h=kt(e);a=a.map(p=>kt(p).cmd);let l=!1;const f=[h.cmd].concat(a).filter(p=>yt.test(p)?(l=!0,!1):!0);f.length===0&&l&&f.push("$0"),l&&(h.cmd=f[0],a=f.slice(1),e=e.replace(yt,h.cmd)),a.forEach(p=>{this.aliasMap[p]=h.cmd}),t!==!1&&this.usage.command(e,t,l,a,u),this.handlers[h.cmd]={original:e,description:t,handler:r,builder:n||{},middlewares:c,deprecated:u,demanded:h.demanded,optional:h.optional},l&&(this.defaultCommand=this.handlers[h.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,s,u){const a=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand,c=t.getInternalMethods().getContext(),h=c.commands.slice(),l=!e;e&&(c.commands.push(e),c.fullCommands.push(a.original));const f=this.applyBuilderUpdateUsageAndParse(l,a,t,n.aliases,h,r,s,u);return le(f)?f.then(p=>this.applyMiddlewareAndGetResult(l,a,p.innerArgv,c,s,p.aliases,t)):this.applyMiddlewareAndGetResult(l,a,f.innerArgv,c,s,f.aliases,t)}applyBuilderUpdateUsageAndParse(e,t,n,r,s,u,a,c){const h=t.builder;let l=n;if(Mn(h)){n.getInternalMethods().getUsageInstance().freeze();const f=h(n.getInternalMethods().reset(r),c);if(le(f))return f.then(p=>(l=Lu(p)?p:n,this.parseAndUpdateUsage(e,t,l,s,u,a)))}else Du(h)&&(n.getInternalMethods().getUsageInstance().freeze(),l=n.getInternalMethods().reset(r),Object.keys(t.builder).forEach(f=>{l.option(f,h[f])}));return this.parseAndUpdateUsage(e,t,l,s,u,a)}parseAndUpdateUsage(e,t,n,r,s,u){e&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(r,t),t.description);const a=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,s,u);return le(a)?a.then(c=>({aliases:n.parsed.aliases,innerArgv:c})):{aliases:n.parsed.aliases,innerArgv:a}}shouldUpdateUsage(e){return!e.getInternalMethods().getUsageInstance().getUsageDisabled()&&e.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(e,t){const n=yt.test(t.original)?t.original.replace(yt,"").trim():t.original,r=e.filter(s=>!yt.test(s));return r.push(n),`$0 ${r.join(" ")}`}handleValidationAndGetResult(e,t,n,r,s,u,a,c){if(!u.getInternalMethods().getHasOutput()){const h=u.getInternalMethods().runValidation(s,c,u.parsed.error,e);n=Tt(n,l=>(h(l),l))}if(t.handler&&!u.getInternalMethods().getHasOutput()){u.getInternalMethods().setHasOutput();const h=!!u.getOptions().configuration["populate--"];u.getInternalMethods().postProcess(n,h,!1,!1),n=Mt(n,u,a,!1),n=Tt(n,l=>{const f=t.handler(l);return le(f)?f.then(()=>l):l}),e||u.getInternalMethods().getUsageInstance().cacheHelpMessage(),le(n)&&!u.getInternalMethods().hasParseCallback()&&n.catch(l=>{try{u.getInternalMethods().getUsageInstance().fail(null,l)}catch{}})}return e||(r.commands.pop(),r.fullCommands.pop()),n}applyMiddlewareAndGetResult(e,t,n,r,s,u,a){let c={};if(s)return n;a.getInternalMethods().getHasOutput()||(c=this.populatePositionals(t,n,r,a));const h=this.globalMiddleware.getMiddleware().slice(0).concat(t.middlewares),l=Mt(n,a,h,!0);return le(l)?l.then(f=>this.handleValidationAndGetResult(e,t,f,r,u,a,h,c)):this.handleValidationAndGetResult(e,t,l,r,u,a,h,c)}populatePositionals(e,t,n,r){t._=t._.slice(n.commands.length);const s=e.demanded.slice(0),u=e.optional.slice(0),a={};for(this.validation.positionalCount(s.length,t._.length);s.length;){const c=s.shift();this.populatePositional(c,t,a)}for(;u.length;){const c=u.shift();this.populatePositional(c,t,a)}return t._=n.commands.concat(t._.map(c=>""+c)),this.postProcessPositionals(t,a,this.cmdToParseOptions(e.original),r),a}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[s,...u]=r.cmd;r.variadic&&(t.array.push(s),t.default[s]=[]),t.alias[s]=u,t.demand[s]=!0}),n.optional.forEach(r=>{const[s,...u]=r.cmd;r.variadic&&(t.array.push(s),t.default[s]=[]),t.alias[s]=u}),t}postProcessPositionals(e,t,n,r){const s=Object.assign({},r.getOptions());s.default=Object.assign(n.default,s.default);for(const h of Object.keys(n.alias))s.alias[h]=(s.alias[h]||[]).concat(n.alias[h]);s.array=s.array.concat(n.array),s.config={};const u=[];if(Object.keys(t).forEach(h=>{t[h].map(l=>{s.configuration["unknown-options-as-args"]&&(s.key[h]=!0),u.push(`--${h}`),u.push(l)})}),!u.length)return;const a=Object.assign({},s.configuration,{"populate--":!1}),c=this.shim.Parser.detailed(u,Object.assign({},s,{configuration:a}));if(c.error)r.getInternalMethods().getUsageInstance().fail(c.error.message,c.error);else{const h=Object.keys(t);Object.keys(t).forEach(l=>{h.push(...c.aliases[l])}),Object.keys(c.argv).forEach(l=>{h.includes(l)&&(t[l]||(t[l]=c.argv[l]),!this.isInConfigs(r,l)&&!this.isDefaulted(r,l)&&Object.prototype.hasOwnProperty.call(e,l)&&Object.prototype.hasOwnProperty.call(c.argv,l)&&(Array.isArray(e[l])||Array.isArray(c.argv[l]))?e[l]=[].concat(e[l],c.argv[l]):e[l]=c.argv[l])})}}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=yt.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(Mn(t))return t(e,!0);Ki(t)||Object.keys(t).forEach(n=>{e.option(n,t[n])})}moduleName(e){const t=hu(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;ke(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();ke(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 mu(i,e,t,n){return new pu(i,e,t,n)}function Ki(i){return typeof i=="object"&&!!i.builder&&typeof i.handler=="function"}function gu(i){return i.every(e=>typeof e=="string")}function Mn(i){return typeof i=="function"}function Du(i){return typeof i=="object"}function Cu(i){return typeof i=="object"&&!Array.isArray(i)}function Rt(i={},e=()=>!0){const t={};return rn(i).forEach(n=>{e(n,i[n])&&(t[n]=i[n])}),t}function Ut(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 wu(i){return typeof i=="boolean"}function Au(i,e){const t=e.y18n.__,n={},r=[];n.failFn=function(v){r.push(v)};let s=null,u=null,a=!0;n.showHelpOnFail=function(v=!0,$){const[V,Q]=typeof v=="string"?[!0,v]:[v,$];return i.getInternalMethods().isGlobalContext()&&(u=Q),s=Q,a=V,n};let c=!1;n.fail=function(v,$){const V=i.getInternalMethods().getLoggerInstance();if(r.length)for(let Q=r.length-1;Q>=0;--Q){const de=r[Q];if(wu(de)){if($)throw $;if(v)throw Error(v)}else de(v,$,n)}else{if(i.getExitProcess()&&Ut(!0),!c){c=!0,a&&(i.showHelp("error"),V.error()),(v||$)&&V.error(v||$);const Q=s||u;Q&&((v||$)&&V.error(""),V.error(Q))}if($=$||new fe(v),i.getExitProcess())return i.exit(1);if(i.getInternalMethods().hasParseCallback())return i.exit(1,$);throw $}};let h=[],l=!1;n.usage=(j,v)=>j===null?(l=!0,h=[],n):(l=!1,h.push([j,v||""]),n),n.getUsage=()=>h,n.getUsageDisabled=()=>l,n.getPositionalGroupName=()=>t("Positionals:");let f=[];n.example=(j,v)=>{f.push([j,v||""])};let p=[];n.command=function(v,$,V,Q,de=!1){V&&(p=p.map(K=>(K[2]=!1,K))),p.push([v,$||"",V,Q,de])},n.getCommands=()=>p;let C={};n.describe=function(v,$){Array.isArray(v)?v.forEach(V=>{n.describe(V,$)}):typeof v=="object"?Object.keys(v).forEach(V=>{n.describe(V,v[V])}):C[v]=$},n.getDescriptions=()=>C;let F=[];n.epilog=j=>{F.push(j)};let w=!1,m;n.wrap=j=>{w=!0,m=j},n.getWrap=()=>e.getEnv("YARGS_DISABLE_WRAP")?null:(w||(m=bt(),w=!0),m);const y="__yargsString__:";n.deferY18nLookup=j=>y+j,n.help=function(){if(N)return N;R();const v=i.customScriptName?i.$0:e.path.basename(i.$0),$=i.getDemandedOptions(),V=i.getDemandedCommands(),Q=i.getDeprecatedOptions(),de=i.getGroups(),K=i.getOptions();let he=[];he=he.concat(Object.keys(C)),he=he.concat(Object.keys($)),he=he.concat(Object.keys(V)),he=he.concat(Object.keys(K.default)),he=he.filter(Ce),he=Object.keys(he.reduce((k,te)=>(te!=="_"&&(k[te]=!0),k),{}));const rt=n.getWrap(),ne=e.cliui({width:rt,wrap:!!rt});if(!l){if(h.length)h.forEach(k=>{ne.div({text:`${k[0].replace(/\$0/g,v)}`}),k[1]&&ne.div({text:`${k[1]}`,padding:[1,0,0,0]})}),ne.div();else if(p.length){let k=null;V._?k=`${v} <${t("command")}>
|
|
8
|
-
`:
|
|
9
|
-
`,ne.div(`${
|
|
10
|
-
`);ne.div(`${
|
|
11
|
-
`)}return ne.toString().replace(/\s*$/,"")};function
|
|
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
|
+
`).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
|
+
`)}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
|
+
`):r=u.text.split(`
|
|
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: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
|
+
`:b=`${L} [${t("command")}]
|
|
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
|
+
`);ne.div(`${b}
|
|
11
|
+
`)}return ne.toString().replace(/\s*$/,"")};function x(j,L,v){let H=0;return Array.isArray(j)||(j=Object.values(j).map(V=>[V])),j.forEach(V=>{H=Math.max(e.stringWidth(v?`${v} ${an(V[0])}`:an(V[0]))+yr(V[0]),H)}),L&&(H=Math.min(H,parseInt((L*.5).toString(),10))),H}function C(){const j=i.getDemandedOptions(),L=i.getOptions();(Object.keys(L.alias)||[]).forEach(v=>{L.alias[v].forEach(H=>{A[H]&&n.describe(v,A[H]),H in j&&i.demandOption(v,j[H]),L.boolean.includes(H)&&i.boolean(v),L.count.includes(H)&&i.count(v),L.string.includes(H)&&i.string(v),L.normalize.includes(H)&&i.normalize(v),L.array.includes(H)&&i.array(v),L.number.includes(H)&&i.number(v)})})}let _;n.cacheHelpMessage=function(){_=this.help()},n.clearCachedHelpMessage=function(){_=void 0},n.hasCachedHelpMessage=function(){return!!_};function y(j,L,v,H){let V=[],X=null;return Object.keys(v).forEach(U=>{V=V.concat(v[U])}),j.forEach(U=>{X=[U].concat(L[U]),X.some(re=>V.indexOf(re)!==-1)||v[H].push(U)}),V}function M(j){return i.getOptions().hiddenOptions.indexOf(j)<0||i.parsed.argv[i.getOptions().showHiddenOpt]}n.showHelp=j=>{const L=i.getInternalMethods().getLoggerInstance();j||(j="error"),(typeof j=="function"?j:L[j])(n.help())},n.functionDescription=j=>["(",j.name?e.Parser.decamelize(j.name,"-"):t("generated-value"),")"].join(""),n.stringifiedValues=function(L,v){let H="";const V=v||", ",X=[].concat(L);return!L||!X.length||X.forEach(U=>{H.length&&(H+=V),H+=JSON.stringify(U)}),H};function R(j,L){let v=`[${t("default:")} `;if(j===void 0&&!L)return null;if(L)v+=L;else switch(typeof j){case"string":v+=`"${j}"`;break;case"object":v+=JSON.stringify(j);break;default:v+=j}return`${v}]`}function W(){return e.process.stdColumns?Math.min(80,e.process.stdColumns):80}let z=null;n.version=j=>{z=j},n.showVersion=j=>{const L=i.getInternalMethods().getLoggerInstance();j||(j="error"),(typeof j=="function"?j:L[j])(z)},n.reset=function(L){return u=null,a=!1,l=[],f=!1,F=[],d=[],c=[],A=Wt(A,v=>!L[v]),n};const G=[];return n.freeze=function(){G.push({failMessage:u,failureOutput:a,usages:l,usageDisabled:f,epilogs:F,examples:d,commands:c,descriptions:A})},n.unfreeze=function(L=!1){const v=G.pop();v&&(L?(A={...v.descriptions,...A},c=[...v.commands,...c],l=[...v.usages,...l],d=[...v.examples,...d],F=[...v.epilogs,...F]):{failMessage:u,failureOutput:a,usages:l,usageDisabled:f,epilogs:F,examples:d,commands:c,descriptions:A}=v)},n}function zn(i){return typeof i=="object"}function go(i,e){return zn(i)?{text:i.text,indentation:i.indentation+e}:{text:i,indentation:e}}function yr(i){return zn(i)?i.indentation:0}function an(i){return zn(i)?i.text:i}const mo=`###-begin-{{app_name}}-completions-###
|
|
12
12
|
#
|
|
13
13
|
# yargs command completion script
|
|
14
14
|
#
|
|
@@ -36,7 +36,7 @@ _{{app_name}}_yargs_completions()
|
|
|
36
36
|
}
|
|
37
37
|
complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}
|
|
38
38
|
###-end-{{app_name}}-completions-###
|
|
39
|
-
`,
|
|
39
|
+
`,Do=`#compdef {{app_name}}
|
|
40
40
|
###-begin-{{app_name}}-completions-###
|
|
41
41
|
#
|
|
42
42
|
# yargs command completion script
|
|
@@ -55,14 +55,14 @@ _{{app_name}}_yargs_completions()
|
|
|
55
55
|
}
|
|
56
56
|
compdef _{{app_name}}_yargs_completions {{app_name}}
|
|
57
57
|
###-end-{{app_name}}-completions-###
|
|
58
|
-
`;class
|
|
58
|
+
`;class Co{constructor(e,t,n,r){var u,s,o;this.yargs=e,this.usage=t,this.command=n,this.shim=r,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(o=((u=this.shim.getEnv("SHELL"))===null||u===void 0?void 0:u.includes("zsh"))||((s=this.shim.getEnv("ZSH_NAME"))===null||s===void 0?void 0:s.includes("zsh")))!==null&&o!==void 0?o:!1}defaultCompletion(e,t,n,r){const u=this.command.getCommandHandlers();for(let o=0,a=e.length;o<a;++o)if(u[e[o]]&&u[e[o]].builder){const l=u[e[o]].builder;if(Vn(l)){this.indexAfterLastReset=o+1;const f=this.yargs.getInternalMethods().reset();return l(f,!0),f.argv}}const s=[];this.commandCompletions(s,e,n),this.optionCompletions(s,e,t,n),this.choicesFromOptionsCompletions(s,e,t,n),this.choicesFromPositionalsCompletions(s,e,t,n),r(null,s)}commandCompletions(e,t,n){const r=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&r[r.length-1]!==n&&!this.previousArgHasChoices(t)&&this.usage.getCommands().forEach(u=>{const s=kt(u[0]).cmd;if(t.indexOf(s)===-1)if(!this.zshShell)e.push(s);else{const o=u[1]||"";e.push(s.replace(/:/g,"\\:")+":"+o)}})}optionCompletions(e,t,n,r){if((r.match(/^-/)||r===""&&e.length===0)&&!this.previousArgHasChoices(t)){const u=this.yargs.getOptions(),s=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(u.key).forEach(o=>{const a=!!u.configuration["boolean-negation"]&&u.boolean.includes(o);!s.includes(o)&&!u.hiddenOptions.includes(o)&&!this.argsContainKey(t,o,a)&&this.completeOptionKey(o,e,r,a&&!!u.default[o])})}}choicesFromOptionsCompletions(e,t,n,r){if(this.previousArgHasChoices(t)){const u=this.getPreviousArgChoices(t);u&&u.length>0&&e.push(...u.map(s=>s.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(e,t,n,r){if(r===""&&e.length>0&&this.previousArgHasChoices(t))return;const u=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],s=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),o=u[n._.length-s-1];if(!o)return;const a=this.yargs.getOptions().choices[o]||[];for(const l of a)l.startsWith(r)&&e.push(l.replace(/:/g,"\\:"))}getPreviousArgChoices(e){if(e.length<1)return;let t=e[e.length-1],n="";if(!t.startsWith("-")&&e.length>1&&(n=t,t=e[e.length-2]),!t.startsWith("-"))return;const r=t.replace(/^-+/,""),u=this.yargs.getOptions(),s=[r,...this.yargs.getAliases()[r]||[]];let o;for(const a of s)if(Object.prototype.hasOwnProperty.call(u.key,a)&&Array.isArray(u.choices[a])){o=u.choices[a];break}if(o)return o.filter(a=>!n||a.startsWith(n))}previousArgHasChoices(e){const t=this.getPreviousArgChoices(e);return t!==void 0&&t.length>0}argsContainKey(e,t,n){const r=u=>e.indexOf((/^[^0-9]$/.test(u)?"-":"--")+u)!==-1;if(r(t)||n&&r(`no-${t}`))return!0;if(this.aliases){for(const u of this.aliases[t])if(r(u))return!0}return!1}completeOptionKey(e,t,n,r){var u,s,o,a;let l=e;if(this.zshShell){const A=this.usage.getDescriptions(),F=(s=(u=this===null||this===void 0?void 0:this.aliases)===null||u===void 0?void 0:u[e])===null||s===void 0?void 0:s.find(E=>{const x=A[E];return typeof x=="string"&&x.length>0}),w=F?A[F]:void 0,h=(a=(o=A[e])!==null&&o!==void 0?o:w)!==null&&a!==void 0?a:"";l=`${e.replace(/:/g,"\\:")}:${h.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}const f=A=>/^--/.test(A),d=A=>/^[^0-9]$/.test(A),c=!f(n)&&d(e)?"-":"--";t.push(c+l),r&&t.push(c+"no-"+l)}customCompletion(e,t,n,r){if(ze(this.customCompletionFunction,null,this.shim),Eo(this.customCompletionFunction)){const u=this.customCompletionFunction(n,t);return ye(u)?u.then(s=>{this.shim.process.nextTick(()=>{r(null,s)})}).catch(s=>{this.shim.process.nextTick(()=>{r(s,void 0)})}):r(null,u)}else return wo(this.customCompletionFunction)?this.customCompletionFunction(n,t,(u=r)=>this.defaultCompletion(e,t,n,u),u=>{r(null,u)}):this.customCompletionFunction(n,t,u=>{r(null,u)})}getCompletion(e,t){const n=e.length?e[e.length-1]:"",r=this.yargs.parse(e,!0),u=this.customCompletionFunction?s=>this.customCompletion(e,s,n,t):s=>this.defaultCompletion(e,s,n,t);return ye(r)?r.then(u):u(r)}generateCompletionScript(e,t){let n=this.zshShell?Do:mo;const r=this.shim.path.basename(e);return e.match(/\.js$/)&&(e=`./${e}`),n=n.replace(/{{app_name}}/g,r),n=n.replace(/{{completion_command}}/g,t),n.replace(/{{app_path}}/g,e)}registerFunction(e){this.customCompletionFunction=e}setParsed(e){this.aliases=e.aliases}}function Ao(i,e,t,n){return new Co(i,e,t,n)}function Eo(i){return i.length<3}function wo(i){return i.length>3}function bo(i,e){if(i.length===0)return e.length;if(e.length===0)return i.length;const t=[];let n;for(n=0;n<=e.length;n++)t[n]=[n];let r;for(r=0;r<=i.length;r++)t[0][r]=r;for(n=1;n<=e.length;n++)for(r=1;r<=i.length;r++)e.charAt(n-1)===i.charAt(r-1)?t[n][r]=t[n-1][r-1]:n>1&&r>1&&e.charAt(n-2)===i.charAt(r-1)&&e.charAt(n-1)===i.charAt(r-2)?t[n][r]=t[n-2][r-2]+1:t[n][r]=Math.min(t[n-1][r-1]+1,Math.min(t[n][r-1]+1,t[n-1][r]+1));return t[e.length][i.length]}const Fr=["$0","--","_"];function yo(i,e,t){const n=t.y18n.__,r=t.y18n.__n,u={};u.nonOptionCount=function(d){const c=i.getDemandedCommands(),F=d._.length+(d["--"]?d["--"].length:0)-i.getInternalMethods().getContext().commands.length;c._&&(F<c._.min||F>c._.max)&&(F<c._.min?c._.minMsg!==void 0?e.fail(c._.minMsg?c._.minMsg.replace(/\$0/g,F.toString()).replace(/\$1/,c._.min.toString()):null):e.fail(r("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",F,F.toString(),c._.min.toString())):F>c._.max&&(c._.maxMsg!==void 0?e.fail(c._.maxMsg?c._.maxMsg.replace(/\$0/g,F.toString()).replace(/\$1/,c._.max.toString()):null):e.fail(r("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",F,F.toString(),c._.max.toString()))))},u.positionalCount=function(d,c){c<d&&e.fail(r("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",c,c+"",d+""))},u.requiredArguments=function(d,c){let A=null;for(const F of Object.keys(c))(!Object.prototype.hasOwnProperty.call(d,F)||typeof d[F]>"u")&&(A=A||{},A[F]=c[F]);if(A){const F=[];for(const h of Object.keys(A)){const E=A[h];E&&F.indexOf(E)<0&&F.push(E)}const w=F.length?`
|
|
59
59
|
${F.join(`
|
|
60
|
-
`)}`:"";e.fail(r("Missing required argument: %s","Missing required arguments: %s",Object.keys(
|
|
61
|
-
${n("Argument: %s, Given: %s, Choices: %s",
|
|
62
|
-
`;p.forEach(F=>{C+=F}),e.fail(C)}};let c={};s.conflicts=function(f,p){x("<string|object> [array|string]",[f,p],arguments.length),typeof f=="object"?Object.keys(f).forEach(C=>{s.conflicts(C,f[C])}):(i.global(f),c[f]||(c[f]=[]),Array.isArray(p)?p.forEach(C=>s.conflicts(f,C)):c[f].push(p))},s.getConflicting=()=>c,s.conflicting=function(f){Object.keys(f).forEach(p=>{c[p]&&c[p].forEach(C=>{C&&f[p]!==void 0&&f[C]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",p,C))})}),i.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(c).forEach(p=>{c[p].forEach(C=>{C&&f[t.Parser.camelCase(p)]!==void 0&&f[t.Parser.camelCase(C)]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",p,C))})})},s.recommendCommands=function(f,p){p=p.sort((m,y)=>y.length-m.length);let F=null,w=1/0;for(let m=0,y;(y=p[m])!==void 0;m++){const S=_u(f,y);S<=3&&S<w&&(w=S,F=y)}F&&e.fail(n("Did you mean %s?",F))},s.reset=function(f){return u=Rt(u,p=>!f[p]),c=Rt(c,p=>!f[p]),s};const h=[];return s.freeze=function(){h.push({implied:u,conflicting:c})},s.unfreeze=function(){const f=h.pop();ke(f,void 0,t),{implied:u,conflicting:c}=f},s}let Rn=[],Wt;function Un(i,e,t,n){Wt=n;let r={};if(Object.prototype.hasOwnProperty.call(i,"extends")){if(typeof i.extends!="string")return r;const s=/\.json|\..*rc$/.test(i.extends);let u=null;if(s)u=xu(e,i.extends);else try{u=require.resolve(i.extends)}catch{return i}$u(u),Rn.push(u),r=s?JSON.parse(Wt.readFileSync(u,"utf8")):require(i.extends),delete i.extends,r=Un(r,Wt.path.dirname(u),t,Wt)}return Rn=[],t?Zi(r,i):Object.assign({},r,i)}function $u(i){if(Rn.indexOf(i)>-1)throw new fe(`Circular extended configurations: '${i}'.`)}function xu(i,e){return Wt.path.resolve(i,e)}function Zi(i,e){const t={};function n(r){return r&&typeof r=="object"&&!Array.isArray(r)}Object.assign(t,i);for(const r of Object.keys(e))n(e[r])&&n(t[r])?t[r]=Zi(i[r],e[r]):t[r]=e[r];return t}var _=function(i,e,t,n,r){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?r.call(i,t):r?r.value=t:e.set(i,t),t},o=function(i,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(i):n?n.value:e.get(i)},oe,ct,Vt,ve,be,un,Qe,lt,on,Oe,an,_e,Re,Fe,Se,cn,Bt,me,L,ln,fn,ye,ft,vt,dt,Xe,dn,T,ht,pt,mt,U,hn,Ue,se;function Iu(i){return(e=[],t=i.process.cwd(),n)=>{const r=new ju(e,t,n,i);return Object.defineProperty(r,"argv",{get:()=>r.parse(),enumerable:!0}),r.help(),r.version(),r}}const er=Symbol("copyDoubleDash"),tr=Symbol("copyDoubleDash"),Wn=Symbol("deleteFromParserHintObject"),nr=Symbol("emitWarning"),ir=Symbol("freeze"),rr=Symbol("getDollarZero"),gt=Symbol("getParserConfiguration"),sr=Symbol("getUsageConfiguration"),Vn=Symbol("guessLocale"),ur=Symbol("guessVersion"),or=Symbol("parsePositionalNumbers"),zn=Symbol("pkgUp"),Ze=Symbol("populateParserHintArray"),Ot=Symbol("populateParserHintSingleValueDictionary"),Hn=Symbol("populateParserHintArrayDictionary"),Gn=Symbol("populateParserHintDictionary"),Yn=Symbol("sanitizeKey"),qn=Symbol("setKey"),Jn=Symbol("unfreeze"),ar=Symbol("validateAsync"),cr=Symbol("getCommandInstance"),lr=Symbol("getContext"),fr=Symbol("getHasOutput"),dr=Symbol("getLoggerInstance"),hr=Symbol("getParseContext"),pr=Symbol("getUsageInstance"),mr=Symbol("getValidationInstance"),pn=Symbol("hasParseCallback"),gr=Symbol("isGlobalContext"),Dt=Symbol("postProcess"),Dr=Symbol("rebase"),Kn=Symbol("reset"),zt=Symbol("runYargsParserAndExecuteCommands"),Qn=Symbol("runValidation"),Cr=Symbol("setHasOutput"),Ct=Symbol("kTrackManuallySetKeys");class ju{constructor(e=[],t,n,r){this.customScriptName=!1,this.parsed=!1,oe.set(this,void 0),ct.set(this,void 0),Vt.set(this,{commands:[],fullCommands:[]}),ve.set(this,null),be.set(this,null),un.set(this,"show-hidden"),Qe.set(this,null),lt.set(this,!0),on.set(this,{}),Oe.set(this,!0),an.set(this,[]),_e.set(this,void 0),Re.set(this,{}),Fe.set(this,!1),Se.set(this,null),cn.set(this,!0),Bt.set(this,void 0),me.set(this,""),L.set(this,void 0),ln.set(this,void 0),fn.set(this,{}),ye.set(this,null),ft.set(this,null),vt.set(this,{}),dt.set(this,{}),Xe.set(this,void 0),dn.set(this,!1),T.set(this,void 0),ht.set(this,!1),pt.set(this,!1),mt.set(this,!1),U.set(this,void 0),hn.set(this,{}),Ue.set(this,null),se.set(this,void 0),_(this,T,r,"f"),_(this,Xe,e,"f"),_(this,ct,t,"f"),_(this,ln,n,"f"),_(this,_e,new lu(this),"f"),this.$0=this[rr](),this[Kn](),_(this,oe,o(this,oe,"f"),"f"),_(this,U,o(this,U,"f"),"f"),_(this,se,o(this,se,"f"),"f"),_(this,L,o(this,L,"f"),"f"),o(this,L,"f").showHiddenOpt=o(this,un,"f"),_(this,Bt,this[tr](),"f")}addHelpOpt(e,t){const n="help";return x("[string|boolean] [string]",[e,t],arguments.length),o(this,Se,"f")&&(this[Wn](o(this,Se,"f")),_(this,Se,null,"f")),e===!1&&t===void 0?this:(_(this,Se,typeof e=="string"?e:n,"f"),this.boolean(o(this,Se,"f")),this.describe(o(this,Se,"f"),t||o(this,U,"f").deferY18nLookup("Show help")),this)}help(e,t){return this.addHelpOpt(e,t)}addShowHiddenOpt(e,t){if(x("[string|boolean] [string]",[e,t],arguments.length),e===!1&&t===void 0)return this;const n=typeof e=="string"?e:o(this,un,"f");return this.boolean(n),this.describe(n,t||o(this,U,"f").deferY18nLookup("Show hidden options")),o(this,L,"f").showHiddenOpt=n,this}showHidden(e,t){return this.addShowHiddenOpt(e,t)}alias(e,t){return x("<object|string|array> [string|array]",[e,t],arguments.length),this[Hn](this.alias.bind(this),"alias",e,t),this}array(e){return x("<array|string>",[e],arguments.length),this[Ze]("array",e),this[Ct](e),this}boolean(e){return x("<array|string>",[e],arguments.length),this[Ze]("boolean",e),this[Ct](e),this}check(e,t){return x("<function> [boolean]",[e,t],arguments.length),this.middleware((n,r)=>Tt(()=>e(n,r.getOptions()),s=>(s?(typeof s=="string"||s instanceof Error)&&o(this,U,"f").fail(s.toString(),s):o(this,U,"f").fail(o(this,T,"f").y18n.__("Argument check failed: %s",e.toString())),n),s=>(o(this,U,"f").fail(s.message?s.message:s.toString(),s),n)),!1,t),this}choices(e,t){return x("<object|string|array> [string|array]",[e,t],arguments.length),this[Hn](this.choices.bind(this),"choices",e,t),this}coerce(e,t){if(x("<object|string|array> [function]",[e,t],arguments.length),Array.isArray(e)){if(!t)throw new fe("coerce callback must be provided");for(const n of e)this.coerce(n,t);return this}else if(typeof e=="object"){for(const n of Object.keys(e))this.coerce(n,e[n]);return this}if(!t)throw new fe("coerce callback must be provided");return o(this,L,"f").key[e]=!0,o(this,_e,"f").addCoerceMiddleware((n,r)=>{let s;return Object.prototype.hasOwnProperty.call(n,e)?Tt(()=>(s=r.getAliases(),t(n[e])),a=>{n[e]=a;const c=r.getInternalMethods().getParserConfiguration()["strip-aliased"];if(s[e]&&c!==!0)for(const h of s[e])n[h]=a;return n},a=>{throw new fe(a.message)}):n},e),this}conflicts(e,t){return x("<string|object> [string|array]",[e,t],arguments.length),o(this,se,"f").conflicts(e,t),this}config(e="config",t,n){return x("[object|string] [string|function] [function]",[e,t,n],arguments.length),typeof e=="object"&&!Array.isArray(e)?(e=Un(e,o(this,ct,"f"),this[gt]()["deep-merge-config"]||!1,o(this,T,"f")),o(this,L,"f").configObjects=(o(this,L,"f").configObjects||[]).concat(e),this):(typeof t=="function"&&(n=t,t=void 0),this.describe(e,t||o(this,U,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(e)?e:[e]).forEach(r=>{o(this,L,"f").config[r]=n||!0}),this)}completion(e,t,n){return x("[string] [string|boolean|function] [function]",[e,t,n],arguments.length),typeof t=="function"&&(n=t,t=void 0),_(this,be,e||o(this,be,"f")||"completion","f"),!t&&t!==!1&&(t="generate completion script"),this.command(o(this,be,"f"),t),n&&o(this,ve,"f").registerFunction(n),this}command(e,t,n,r,s,u){return x("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[e,t,n,r,s,u],arguments.length),o(this,oe,"f").addHandler(e,t,n,r,s,u),this}commands(e,t,n,r,s,u){return this.command(e,t,n,r,s,u)}commandDir(e,t){x("<string> [object]",[e,t],arguments.length);const n=o(this,ln,"f")||o(this,T,"f").require;return o(this,oe,"f").addDirectory(e,n,o(this,T,"f").getCallerFile(),t),this}count(e){return x("<array|string>",[e],arguments.length),this[Ze]("count",e),this[Ct](e),this}default(e,t,n){return x("<object|string|array> [*] [string]",[e,t,n],arguments.length),n&&(Yi(e,o(this,T,"f")),o(this,L,"f").defaultDescription[e]=n),typeof t=="function"&&(Yi(e,o(this,T,"f")),o(this,L,"f").defaultDescription[e]||(o(this,L,"f").defaultDescription[e]=o(this,U,"f").functionDescription(t)),t=t.call()),this[Ot](this.default.bind(this),"default",e,t),this}defaults(e,t,n){return this.default(e,t,n)}demandCommand(e=1,t,n,r){return x("[number] [number|string] [string|null|undefined] [string|null|undefined]",[e,t,n,r],arguments.length),typeof t!="number"&&(n=t,t=1/0),this.global("_",!1),o(this,L,"f").demandedCommands._={min:e,max:t,minMsg:n,maxMsg:r},this}demand(e,t,n){return Array.isArray(t)?(t.forEach(r=>{ke(n,!0,o(this,T,"f")),this.demandOption(r,n)}),t=1/0):typeof t!="number"&&(n=t,t=1/0),typeof e=="number"?(ke(n,!0,o(this,T,"f")),this.demandCommand(e,t,n,n)):Array.isArray(e)?e.forEach(r=>{ke(n,!0,o(this,T,"f")),this.demandOption(r,n)}):typeof n=="string"?this.demandOption(e,n):(n===!0||typeof n>"u")&&this.demandOption(e),this}demandOption(e,t){return x("<object|string|array> [string]",[e,t],arguments.length),this[Ot](this.demandOption.bind(this),"demandedOptions",e,t),this}deprecateOption(e,t){return x("<string> [string|boolean]",[e,t],arguments.length),o(this,L,"f").deprecatedOptions[e]=t,this}describe(e,t){return x("<object|string|array> [string]",[e,t],arguments.length),this[qn](e,!0),o(this,U,"f").describe(e,t),this}detectLocale(e){return x("<boolean>",[e],arguments.length),_(this,lt,e,"f"),this}env(e){return x("[string|boolean]",[e],arguments.length),e===!1?delete o(this,L,"f").envPrefix:o(this,L,"f").envPrefix=e||"",this}epilogue(e){return x("<string>",[e],arguments.length),o(this,U,"f").epilog(e),this}epilog(e){return this.epilogue(e)}example(e,t){return x("<string|array> [string]",[e,t],arguments.length),Array.isArray(e)?e.forEach(n=>this.example(...n)):o(this,U,"f").example(e,t),this}exit(e,t){_(this,Fe,!0,"f"),_(this,Qe,t,"f"),o(this,Oe,"f")&&o(this,T,"f").process.exit(e)}exitProcess(e=!0){return x("[boolean]",[e],arguments.length),_(this,Oe,e,"f"),this}fail(e){if(x("<function|boolean>",[e],arguments.length),typeof e=="boolean"&&e!==!1)throw new fe("Invalid first argument. Expected function or boolean 'false'");return o(this,U,"f").failFn(e),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(e,t){return x("<array> [function]",[e,t],arguments.length),t?o(this,ve,"f").getCompletion(e,t):new Promise((n,r)=>{o(this,ve,"f").getCompletion(e,(s,u)=>{s?r(s):n(u)})})}getDemandedOptions(){return x([],0),o(this,L,"f").demandedOptions}getDemandedCommands(){return x([],0),o(this,L,"f").demandedCommands}getDeprecatedOptions(){return x([],0),o(this,L,"f").deprecatedOptions}getDetectLocale(){return o(this,lt,"f")}getExitProcess(){return o(this,Oe,"f")}getGroups(){return Object.assign({},o(this,Re,"f"),o(this,dt,"f"))}getHelp(){if(_(this,Fe,!0,"f"),!o(this,U,"f").hasCachedHelpMessage()){if(!this.parsed){const t=this[zt](o(this,Xe,"f"),void 0,void 0,0,!0);if(le(t))return t.then(()=>o(this,U,"f").help())}const e=o(this,oe,"f").runDefaultBuilderOn(this);if(le(e))return e.then(()=>o(this,U,"f").help())}return Promise.resolve(o(this,U,"f").help())}getOptions(){return o(this,L,"f")}getStrict(){return o(this,ht,"f")}getStrictCommands(){return o(this,pt,"f")}getStrictOptions(){return o(this,mt,"f")}global(e,t){return x("<string|array> [boolean]",[e,t],arguments.length),e=[].concat(e),t!==!1?o(this,L,"f").local=o(this,L,"f").local.filter(n=>e.indexOf(n)===-1):e.forEach(n=>{o(this,L,"f").local.includes(n)||o(this,L,"f").local.push(n)}),this}group(e,t){x("<string|array> <string>",[e,t],arguments.length);const n=o(this,dt,"f")[t]||o(this,Re,"f")[t];o(this,dt,"f")[t]&&delete o(this,dt,"f")[t];const r={};return o(this,Re,"f")[t]=(n||[]).concat(e).filter(s=>r[s]?!1:r[s]=!0),this}hide(e){return x("<string>",[e],arguments.length),o(this,L,"f").hiddenOptions.push(e),this}implies(e,t){return x("<string|object> [number|string|array]",[e,t],arguments.length),o(this,se,"f").implies(e,t),this}locale(e){return x("[string]",[e],arguments.length),e===void 0?(this[Vn](),o(this,T,"f").y18n.getLocale()):(_(this,lt,!1,"f"),o(this,T,"f").y18n.setLocale(e),this)}middleware(e,t,n){return o(this,_e,"f").addMiddleware(e,!!t,n)}nargs(e,t){return x("<string|object|array> [number]",[e,t],arguments.length),this[Ot](this.nargs.bind(this),"narg",e,t),this}normalize(e){return x("<array|string>",[e],arguments.length),this[Ze]("normalize",e),this}number(e){return x("<array|string>",[e],arguments.length),this[Ze]("number",e),this[Ct](e),this}option(e,t){if(x("<string|object> [object]",[e,t],arguments.length),typeof e=="object")Object.keys(e).forEach(n=>{this.options(n,e[n])});else{typeof t!="object"&&(t={}),this[Ct](e),o(this,Ue,"f")&&(e==="version"||t?.alias==="version")&&this[nr](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
|
|
63
|
-
`),void 0,"versionWarning"),
|
|
64
|
-
`,"f"),
|
|
65
|
-
`,"f"),_(this,me,o(this,me,"f")+e.join(" "),"f")}}}[Wn](e){rn(o(this,L,"f")).forEach(t=>{if((r=>r==="configObjects")(t))return;const n=o(this,L,"f")[t];Array.isArray(n)?n.includes(e)&&n.splice(n.indexOf(e),1):typeof n=="object"&&delete n[e]}),delete o(this,U,"f").getDescriptions()[e]}[nr](e,t,n){o(this,on,"f")[n]||(o(this,T,"f").process.emitWarning(e,t),o(this,on,"f")[n]=!0)}[ir](){o(this,an,"f").push({options:o(this,L,"f"),configObjects:o(this,L,"f").configObjects.slice(0),exitProcess:o(this,Oe,"f"),groups:o(this,Re,"f"),strict:o(this,ht,"f"),strictCommands:o(this,pt,"f"),strictOptions:o(this,mt,"f"),completionCommand:o(this,be,"f"),output:o(this,me,"f"),exitError:o(this,Qe,"f"),hasOutput:o(this,Fe,"f"),parsed:this.parsed,parseFn:o(this,ye,"f"),parseContext:o(this,ft,"f")}),o(this,U,"f").freeze(),o(this,se,"f").freeze(),o(this,oe,"f").freeze(),o(this,_e,"f").freeze()}[rr](){let e="",t;return/\b(node|iojs|electron)(\.exe)?$/.test(o(this,T,"f").process.argv()[0])?t=o(this,T,"f").process.argv().slice(1,2):t=o(this,T,"f").process.argv().slice(0,1),e=t.map(n=>{const r=this[Dr](o(this,ct,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&r.length<n.length?r:n}).join(" ").trim(),o(this,T,"f").getEnv("_")&&o(this,T,"f").getProcessArgvBin()===o(this,T,"f").getEnv("_")&&(e=o(this,T,"f").getEnv("_").replace(`${o(this,T,"f").path.dirname(o(this,T,"f").process.execPath())}/`,"")),e}[gt](){return o(this,fn,"f")}[sr](){return o(this,hn,"f")}[Vn](){if(!o(this,lt,"f"))return;const e=o(this,T,"f").getEnv("LC_ALL")||o(this,T,"f").getEnv("LC_MESSAGES")||o(this,T,"f").getEnv("LANG")||o(this,T,"f").getEnv("LANGUAGE")||"en_US";this.locale(e.replace(/[.:].*/,""))}[ur](){return this[zn]().version||"unknown"}[or](e){const t=e["--"]?e["--"]:e._;for(let n=0,r;(r=t[n])!==void 0;n++)o(this,T,"f").Parser.looksLikeNumber(r)&&Number.isSafeInteger(Math.floor(parseFloat(`${r}`)))&&(t[n]=Number(r));return e}[zn](e){const t=e||"*";if(o(this,vt,"f")[t])return o(this,vt,"f")[t];let n={};try{let r=e||o(this,T,"f").mainFilename;!e&&o(this,T,"f").path.extname(r)&&(r=o(this,T,"f").path.dirname(r));const s=o(this,T,"f").findUp(r,(u,a)=>{if(a.includes("package.json"))return"package.json"});ke(s,void 0,o(this,T,"f")),n=JSON.parse(o(this,T,"f").readFileSync(s,"utf8"))}catch{}return o(this,vt,"f")[t]=n||{},o(this,vt,"f")[t]}[Ze](e,t){t=[].concat(t),t.forEach(n=>{n=this[Yn](n),o(this,L,"f")[e].push(n)})}[Ot](e,t,n,r){this[Gn](e,t,n,r,(s,u,a)=>{o(this,L,"f")[s][u]=a})}[Hn](e,t,n,r){this[Gn](e,t,n,r,(s,u,a)=>{o(this,L,"f")[s][u]=(o(this,L,"f")[s][u]||[]).concat(a)})}[Gn](e,t,n,r,s){if(Array.isArray(n))n.forEach(u=>{e(u,r)});else if((u=>typeof u=="object")(n))for(const u of rn(n))e(u,n[u]);else s(t,this[Yn](n),r)}[Yn](e){return e==="__proto__"?"___proto___":e}[qn](e,t){return this[Ot](this[qn].bind(this),"key",e,t),this}[Jn](){var e,t,n,r,s,u,a,c,h,l,f,p;const C=o(this,an,"f").pop();ke(C,void 0,o(this,T,"f"));let F;e=this,t=this,n=this,r=this,s=this,u=this,a=this,c=this,h=this,l=this,f=this,p=this,{options:{set value(w){_(e,L,w,"f")}}.value,configObjects:F,exitProcess:{set value(w){_(t,Oe,w,"f")}}.value,groups:{set value(w){_(n,Re,w,"f")}}.value,output:{set value(w){_(r,me,w,"f")}}.value,exitError:{set value(w){_(s,Qe,w,"f")}}.value,hasOutput:{set value(w){_(u,Fe,w,"f")}}.value,parsed:this.parsed,strict:{set value(w){_(a,ht,w,"f")}}.value,strictCommands:{set value(w){_(c,pt,w,"f")}}.value,strictOptions:{set value(w){_(h,mt,w,"f")}}.value,completionCommand:{set value(w){_(l,be,w,"f")}}.value,parseFn:{set value(w){_(f,ye,w,"f")}}.value,parseContext:{set value(w){_(p,ft,w,"f")}}.value}=C,o(this,L,"f").configObjects=F,o(this,U,"f").unfreeze(),o(this,se,"f").unfreeze(),o(this,oe,"f").unfreeze(),o(this,_e,"f").unfreeze()}[ar](e,t){return Tt(t,n=>(e(n),n))}getInternalMethods(){return{getCommandInstance:this[cr].bind(this),getContext:this[lr].bind(this),getHasOutput:this[fr].bind(this),getLoggerInstance:this[dr].bind(this),getParseContext:this[hr].bind(this),getParserConfiguration:this[gt].bind(this),getUsageConfiguration:this[sr].bind(this),getUsageInstance:this[pr].bind(this),getValidationInstance:this[mr].bind(this),hasParseCallback:this[pn].bind(this),isGlobalContext:this[gr].bind(this),postProcess:this[Dt].bind(this),reset:this[Kn].bind(this),runValidation:this[Qn].bind(this),runYargsParserAndExecuteCommands:this[zt].bind(this),setHasOutput:this[Cr].bind(this)}}[cr](){return o(this,oe,"f")}[lr](){return o(this,Vt,"f")}[fr](){return o(this,Fe,"f")}[dr](){return o(this,Bt,"f")}[hr](){return o(this,ft,"f")||{}}[pr](){return o(this,U,"f")}[mr](){return o(this,se,"f")}[pn](){return!!o(this,ye,"f")}[gr](){return o(this,cn,"f")}[Dt](e,t,n,r){return n||le(e)||(t||(e=this[er](e)),(this[gt]()["parse-positional-numbers"]||this[gt]()["parse-positional-numbers"]===void 0)&&(e=this[or](e)),r&&(e=Mt(e,this,o(this,_e,"f").getMiddleware(),!1))),e}[Kn](e={}){_(this,L,o(this,L,"f")||{},"f");const t={};t.local=o(this,L,"f").local||[],t.configObjects=o(this,L,"f").configObjects||[];const n={};t.local.forEach(u=>{n[u]=!0,(e[u]||[]).forEach(a=>{n[a]=!0})}),Object.assign(o(this,dt,"f"),Object.keys(o(this,Re,"f")).reduce((u,a)=>{const c=o(this,Re,"f")[a].filter(h=>!(h in n));return c.length>0&&(u[a]=c),u},{})),_(this,Re,{},"f");const r=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],s=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return r.forEach(u=>{t[u]=(o(this,L,"f")[u]||[]).filter(a=>!n[a])}),s.forEach(u=>{t[u]=Rt(o(this,L,"f")[u],a=>!n[a])}),t.envPrefix=o(this,L,"f").envPrefix,_(this,L,t,"f"),_(this,U,o(this,U,"f")?o(this,U,"f").reset(n):Au(this,o(this,T,"f")),"f"),_(this,se,o(this,se,"f")?o(this,se,"f").reset(n):Su(this,o(this,U,"f"),o(this,T,"f")),"f"),_(this,oe,o(this,oe,"f")?o(this,oe,"f").reset():mu(o(this,U,"f"),o(this,se,"f"),o(this,_e,"f"),o(this,T,"f")),"f"),o(this,ve,"f")||_(this,ve,Bu(this,o(this,U,"f"),o(this,oe,"f"),o(this,T,"f")),"f"),o(this,_e,"f").reset(),_(this,be,null,"f"),_(this,me,"","f"),_(this,Qe,null,"f"),_(this,Fe,!1,"f"),this.parsed=!1,this}[Dr](e,t){return o(this,T,"f").path.relative(e,t)}[zt](e,t,n,r=0,s=!1){let u=!!n||s;e=e||o(this,Xe,"f"),o(this,L,"f").__=o(this,T,"f").y18n.__,o(this,L,"f").configuration=this[gt]();const a=!!o(this,L,"f").configuration["populate--"],c=Object.assign({},o(this,L,"f").configuration,{"populate--":!0}),h=o(this,T,"f").Parser.detailed(e,Object.assign({},o(this,L,"f"),{configuration:{"parse-positional-numbers":!1,...c}})),l=Object.assign(h.argv,o(this,ft,"f"));let f;const p=h.aliases;let C=!1,F=!1;Object.keys(l).forEach(w=>{w===o(this,Se,"f")&&l[w]?C=!0:w===o(this,Ue,"f")&&l[w]&&(F=!0)}),l.$0=this.$0,this.parsed=h,r===0&&o(this,U,"f").clearCachedHelpMessage();try{if(this[Vn](),t)return this[Dt](l,a,!!n,!1);o(this,Se,"f")&&[o(this,Se,"f")].concat(p[o(this,Se,"f")]||[]).filter(R=>R.length>1).includes(""+l._[l._.length-1])&&(l._.pop(),C=!0),_(this,cn,!1,"f");const w=o(this,oe,"f").getCommands(),m=o(this,ve,"f").completionKey in l,y=C||m||s;if(l._.length){if(w.length){let S;for(let R=r||0,N;l._[R]!==void 0;R++)if(N=String(l._[R]),w.includes(N)&&N!==o(this,be,"f")){const W=o(this,oe,"f").runCommand(N,this,h,R+1,s,C||F||s);return this[Dt](W,a,!!n,!1)}else if(!S&&N!==o(this,be,"f")){S=N;break}!o(this,oe,"f").hasDefaultCommand()&&o(this,dn,"f")&&S&&!y&&o(this,se,"f").recommendCommands(S,w)}o(this,be,"f")&&l._.includes(o(this,be,"f"))&&!m&&(o(this,Oe,"f")&&Ut(!0),this.showCompletionScript(),this.exit(0))}if(o(this,oe,"f").hasDefaultCommand()&&!y){const S=o(this,oe,"f").runCommand(null,this,h,0,s,C||F||s);return this[Dt](S,a,!!n,!1)}if(m){o(this,Oe,"f")&&Ut(!0),e=[].concat(e);const S=e.slice(e.indexOf(`--${o(this,ve,"f").completionKey}`)+1);return o(this,ve,"f").getCompletion(S,(R,N)=>{if(R)throw new fe(R.message);(N||[]).forEach(W=>{o(this,Bt,"f").log(W)}),this.exit(0)}),this[Dt](l,!a,!!n,!1)}if(o(this,Fe,"f")||(C?(o(this,Oe,"f")&&Ut(!0),u=!0,this.showHelp("log"),this.exit(0)):F&&(o(this,Oe,"f")&&Ut(!0),u=!0,o(this,U,"f").showVersion("log"),this.exit(0))),!u&&o(this,L,"f").skipValidation.length>0&&(u=Object.keys(l).some(S=>o(this,L,"f").skipValidation.indexOf(S)>=0&&l[S]===!0)),!u){if(h.error)throw new fe(h.error.message);if(!m){const S=this[Qn](p,{},h.error);n||(f=Mt(l,this,o(this,_e,"f").getMiddleware(),!0)),f=this[ar](S,f??l),le(f)&&!n&&(f=f.then(()=>Mt(l,this,o(this,_e,"f").getMiddleware(),!1)))}}}catch(w){if(w instanceof fe)o(this,U,"f").fail(w.message,w);else throw w}return this[Dt](f??l,a,!!n,!0)}[Qn](e,t,n,r){const s={...this.getDemandedOptions()};return u=>{if(n)throw new fe(n.message);o(this,se,"f").nonOptionCount(u),o(this,se,"f").requiredArguments(u,s);let a=!1;o(this,pt,"f")&&(a=o(this,se,"f").unknownCommands(u)),o(this,ht,"f")&&!a?o(this,se,"f").unknownArguments(u,e,t,!!r):o(this,mt,"f")&&o(this,se,"f").unknownArguments(u,e,{},!1,!1),o(this,se,"f").limitedChoices(u),o(this,se,"f").implications(u),o(this,se,"f").conflicting(u)}}[Cr](){_(this,Fe,!0,"f")}[Ct](e){if(typeof e=="string")o(this,L,"f").key[e]=!0;else for(const t of e)o(this,L,"f").key[t]=!0}}function Lu(i){return!!i&&typeof i.getInternalMethods=="function"}const Pu=Iu(au),mn={type:"string",desc:"<directory> with LikeC4 sources (default is current directory)",normalize:!0,default:".",coerce:J},Me={alias:"use-dot-bin",boolean:!0,type:"boolean",desc:'use graphviz binaries ("dot" should be on PATH)',default:!1},wr={boolean:!0,type:"boolean",desc:'use hash history for navigation, e.g. "/#/view" instead of "/view"'},gn={alias:"o",type:"string",desc:"<directory> output directory",normalize:!0,coerce:J},Xn={alias:"w",type:"string",desc:'prefix for Webcomponents, e.g "c4" generates <c4-view ../>',default:"likec4"},Ar={alias:["base-url"],type:"string",desc:'base url the app is being served from, e.g. "/" or "/pages/"'},Er={boolean:!0,type:"boolean",desc:"overview all diagrams as graph [experimental]",default:!1},br=i=>i instanceof URL?$i(i):i;function Nu(i,{cwd:e=Bi.cwd(),type:t="file",stopAt:n}={}){let r=Ft.resolve(br(e)??"");const{root:s}=Ft.parse(r);for(n=Ft.resolve(r,br(n)??s);r&&r!==n&&r!==s;){const u=Ft.isAbsolute(i)?i:Ft.join(r,i);try{const a=Bs.statSync(u,{throwIfNoEntry:!1});if(t==="file"&&a?.isFile()||t==="directory"&&a?.isDirectory())return u}catch{}r=Ft.dirname(r)}}function ku({cwd:i=Bi.cwd()}={}){return Nu("package.json",{cwd:i})}const Dn=ut($i(import.meta.url)),Mu=`
|
|
60
|
+
`)}`:"";e.fail(r("Missing required argument: %s","Missing required arguments: %s",Object.keys(A).length,Object.keys(A).join(", ")+w))}},u.unknownArguments=function(d,c,A,F,w=!0){var h;const E=i.getInternalMethods().getCommandInstance().getCommands(),x=[],C=i.getInternalMethods().getContext();if(Object.keys(d).forEach(_=>{!Fr.includes(_)&&!Object.prototype.hasOwnProperty.call(A,_)&&!Object.prototype.hasOwnProperty.call(i.getInternalMethods().getParseContext(),_)&&!u.isValidAndSomeAliasIsNotNew(_,c)&&x.push(_)}),w&&(C.commands.length>0||E.length>0||F)&&d._.slice(C.commands.length).forEach(_=>{E.includes(""+_)||x.push(""+_)}),w){const y=((h=i.getDemandedCommands()._)===null||h===void 0?void 0:h.max)||0,M=C.commands.length+y;M<d._.length&&d._.slice(M).forEach(R=>{R=String(R),!C.commands.includes(R)&&!x.includes(R)&&x.push(R)})}x.length&&e.fail(r("Unknown argument: %s","Unknown arguments: %s",x.length,x.map(_=>_.trim()?_:`"${_}"`).join(", ")))},u.unknownCommands=function(d){const c=i.getInternalMethods().getCommandInstance().getCommands(),A=[],F=i.getInternalMethods().getContext();return(F.commands.length>0||c.length>0)&&d._.slice(F.commands.length).forEach(w=>{c.includes(""+w)||A.push(""+w)}),A.length>0?(e.fail(r("Unknown command: %s","Unknown commands: %s",A.length,A.join(", "))),!0):!1},u.isValidAndSomeAliasIsNotNew=function(d,c){if(!Object.prototype.hasOwnProperty.call(c,d))return!1;const A=i.parsed.newAliases;return[d,...c[d]].some(F=>!Object.prototype.hasOwnProperty.call(A,F)||!A[d])},u.limitedChoices=function(d){const c=i.getOptions(),A={};if(!Object.keys(c.choices).length)return;Object.keys(d).forEach(h=>{Fr.indexOf(h)===-1&&Object.prototype.hasOwnProperty.call(c.choices,h)&&[].concat(d[h]).forEach(E=>{c.choices[h].indexOf(E)===-1&&E!==void 0&&(A[h]=(A[h]||[]).concat(E))})});const F=Object.keys(A);if(!F.length)return;let w=n("Invalid values:");F.forEach(h=>{w+=`
|
|
61
|
+
${n("Argument: %s, Given: %s, Choices: %s",h,e.stringifiedValues(A[h]),e.stringifiedValues(c.choices[h]))}`}),e.fail(w)};let s={};u.implies=function(d,c){Q("<string|object> [array|number|string]",[d,c],arguments.length),typeof d=="object"?Object.keys(d).forEach(A=>{u.implies(A,d[A])}):(i.global(d),s[d]||(s[d]=[]),Array.isArray(c)?c.forEach(A=>u.implies(d,A)):(ze(c,void 0,t),s[d].push(c)))},u.getImplied=function(){return s};function o(f,d){const c=Number(d);return d=isNaN(c)?d:c,typeof d=="number"?d=f._.length>=d:d.match(/^--no-.+/)?(d=d.match(/^--no-(.+)/)[1],d=!Object.prototype.hasOwnProperty.call(f,d)):d=Object.prototype.hasOwnProperty.call(f,d),d}u.implications=function(d){const c=[];if(Object.keys(s).forEach(A=>{const F=A;(s[A]||[]).forEach(w=>{let h=F;const E=w;h=o(d,h),w=o(d,w),h&&!w&&c.push(` ${F} -> ${E}`)})}),c.length){let A=`${n("Implications failed:")}
|
|
62
|
+
`;c.forEach(F=>{A+=F}),e.fail(A)}};let a={};u.conflicts=function(d,c){Q("<string|object> [array|string]",[d,c],arguments.length),typeof d=="object"?Object.keys(d).forEach(A=>{u.conflicts(A,d[A])}):(i.global(d),a[d]||(a[d]=[]),Array.isArray(c)?c.forEach(A=>u.conflicts(d,A)):a[d].push(c))},u.getConflicting=()=>a,u.conflicting=function(d){Object.keys(d).forEach(c=>{a[c]&&a[c].forEach(A=>{A&&d[c]!==void 0&&d[A]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",c,A))})}),i.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(a).forEach(c=>{a[c].forEach(A=>{A&&d[t.Parser.camelCase(c)]!==void 0&&d[t.Parser.camelCase(A)]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",c,A))})})},u.recommendCommands=function(d,c){c=c.sort((h,E)=>E.length-h.length);let F=null,w=1/0;for(let h=0,E;(E=c[h])!==void 0;h++){const x=bo(d,E);x<=3&&x<w&&(w=x,F=E)}F&&e.fail(n("Did you mean %s?",F))},u.reset=function(d){return s=Wt(s,c=>!d[c]),a=Wt(a,c=>!d[c]),u};const l=[];return u.freeze=function(){l.push({implied:s,conflicting:a})},u.unfreeze=function(){const d=l.pop();ze(d,void 0,t),{implied:s,conflicting:a}=d},u}let qn=[],Vt;function Kn(i,e,t,n){Vt=n;let r={};if(Object.prototype.hasOwnProperty.call(i,"extends")){if(typeof i.extends!="string")return r;const u=/\.json|\..*rc$/.test(i.extends);let s=null;if(u)s=_o(e,i.extends);else try{s=require.resolve(i.extends)}catch{return i}Fo(s),qn.push(s),r=u?JSON.parse(Vt.readFileSync(s,"utf8")):require(i.extends),delete i.extends,r=Kn(r,Vt.path.dirname(s),t,Vt)}return qn=[],t?_r(r,i):Object.assign({},r,i)}function Fo(i){if(qn.indexOf(i)>-1)throw new Fe(`Circular extended configurations: '${i}'.`)}function _o(i,e){return Vt.path.resolve(i,e)}function _r(i,e){const t={};function n(r){return r&&typeof r=="object"&&!Array.isArray(r)}Object.assign(t,i);for(const r of Object.keys(e))n(e[r])&&n(t[r])?t[r]=_r(i[r],e[r]):t[r]=e[r];return t}var J=function(i,e,t,n,r){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?r.call(i,t):r?r.value=t:e.set(i,t),t},p=function(i,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(i):n?n.value:e.get(i)},Ae,pt,zt,Te,Le,cn,rt,ht,ln,Me,fn,ke,Ye,Ne,He,dn,xt,ve,Z,pn,hn,Pe,gt,$t,mt,st,gn,te,Dt,Ct,At,ie,mn,Je,Ce;function So(i){return(e=[],t=i.process.cwd(),n)=>{const r=new vo(e,t,n,i);return Object.defineProperty(r,"argv",{get:()=>r.parse(),enumerable:!0}),r.help(),r.version(),r}}const Sr=Symbol("copyDoubleDash"),vr=Symbol("copyDoubleDash"),Yn=Symbol("deleteFromParserHintObject"),xr=Symbol("emitWarning"),$r=Symbol("freeze"),Br=Symbol("getDollarZero"),Et=Symbol("getParserConfiguration"),Or=Symbol("getUsageConfiguration"),Jn=Symbol("guessLocale"),Rr=Symbol("guessVersion"),Ir=Symbol("parsePositionalNumbers"),Qn=Symbol("pkgUp"),ut=Symbol("populateParserHintArray"),Bt=Symbol("populateParserHintSingleValueDictionary"),Xn=Symbol("populateParserHintArrayDictionary"),Zn=Symbol("populateParserHintDictionary"),ei=Symbol("sanitizeKey"),ti=Symbol("setKey"),ni=Symbol("unfreeze"),Lr=Symbol("validateAsync"),Nr=Symbol("getCommandInstance"),Pr=Symbol("getContext"),jr=Symbol("getHasOutput"),Tr=Symbol("getLoggerInstance"),Mr=Symbol("getParseContext"),kr=Symbol("getUsageInstance"),Hr=Symbol("getValidationInstance"),Dn=Symbol("hasParseCallback"),Ur=Symbol("isGlobalContext"),wt=Symbol("postProcess"),Wr=Symbol("rebase"),ii=Symbol("reset"),qt=Symbol("runYargsParserAndExecuteCommands"),ri=Symbol("runValidation"),Gr=Symbol("setHasOutput"),bt=Symbol("kTrackManuallySetKeys");class vo{constructor(e=[],t,n,r){this.customScriptName=!1,this.parsed=!1,Ae.set(this,void 0),pt.set(this,void 0),zt.set(this,{commands:[],fullCommands:[]}),Te.set(this,null),Le.set(this,null),cn.set(this,"show-hidden"),rt.set(this,null),ht.set(this,!0),ln.set(this,{}),Me.set(this,!0),fn.set(this,[]),ke.set(this,void 0),Ye.set(this,{}),Ne.set(this,!1),He.set(this,null),dn.set(this,!0),xt.set(this,void 0),ve.set(this,""),Z.set(this,void 0),pn.set(this,void 0),hn.set(this,{}),Pe.set(this,null),gt.set(this,null),$t.set(this,{}),mt.set(this,{}),st.set(this,void 0),gn.set(this,!1),te.set(this,void 0),Dt.set(this,!1),Ct.set(this,!1),At.set(this,!1),ie.set(this,void 0),mn.set(this,{}),Je.set(this,null),Ce.set(this,void 0),J(this,te,r,"f"),J(this,st,e,"f"),J(this,pt,t,"f"),J(this,pn,n,"f"),J(this,ke,new io(this),"f"),this.$0=this[Br](),this[ii](),J(this,Ae,p(this,Ae,"f"),"f"),J(this,ie,p(this,ie,"f"),"f"),J(this,Ce,p(this,Ce,"f"),"f"),J(this,Z,p(this,Z,"f"),"f"),p(this,Z,"f").showHiddenOpt=p(this,cn,"f"),J(this,xt,this[vr](),"f")}addHelpOpt(e,t){const n="help";return Q("[string|boolean] [string]",[e,t],arguments.length),p(this,He,"f")&&(this[Yn](p(this,He,"f")),J(this,He,null,"f")),e===!1&&t===void 0?this:(J(this,He,typeof e=="string"?e:n,"f"),this.boolean(p(this,He,"f")),this.describe(p(this,He,"f"),t||p(this,ie,"f").deferY18nLookup("Show help")),this)}help(e,t){return this.addHelpOpt(e,t)}addShowHiddenOpt(e,t){if(Q("[string|boolean] [string]",[e,t],arguments.length),e===!1&&t===void 0)return this;const n=typeof e=="string"?e:p(this,cn,"f");return this.boolean(n),this.describe(n,t||p(this,ie,"f").deferY18nLookup("Show hidden options")),p(this,Z,"f").showHiddenOpt=n,this}showHidden(e,t){return this.addShowHiddenOpt(e,t)}alias(e,t){return Q("<object|string|array> [string|array]",[e,t],arguments.length),this[Xn](this.alias.bind(this),"alias",e,t),this}array(e){return Q("<array|string>",[e],arguments.length),this[ut]("array",e),this[bt](e),this}boolean(e){return Q("<array|string>",[e],arguments.length),this[ut]("boolean",e),this[bt](e),this}check(e,t){return Q("<function> [boolean]",[e,t],arguments.length),this.middleware((n,r)=>Ut(()=>e(n,r.getOptions()),u=>(u?(typeof u=="string"||u instanceof Error)&&p(this,ie,"f").fail(u.toString(),u):p(this,ie,"f").fail(p(this,te,"f").y18n.__("Argument check failed: %s",e.toString())),n),u=>(p(this,ie,"f").fail(u.message?u.message:u.toString(),u),n)),!1,t),this}choices(e,t){return Q("<object|string|array> [string|array]",[e,t],arguments.length),this[Xn](this.choices.bind(this),"choices",e,t),this}coerce(e,t){if(Q("<object|string|array> [function]",[e,t],arguments.length),Array.isArray(e)){if(!t)throw new Fe("coerce callback must be provided");for(const n of e)this.coerce(n,t);return this}else if(typeof e=="object"){for(const n of Object.keys(e))this.coerce(n,e[n]);return this}if(!t)throw new Fe("coerce callback must be provided");return p(this,Z,"f").key[e]=!0,p(this,ke,"f").addCoerceMiddleware((n,r)=>{let u;return Object.prototype.hasOwnProperty.call(n,e)?Ut(()=>(u=r.getAliases(),t(n[e])),o=>{n[e]=o;const a=r.getInternalMethods().getParserConfiguration()["strip-aliased"];if(u[e]&&a!==!0)for(const l of u[e])n[l]=o;return n},o=>{throw new Fe(o.message)}):n},e),this}conflicts(e,t){return Q("<string|object> [string|array]",[e,t],arguments.length),p(this,Ce,"f").conflicts(e,t),this}config(e="config",t,n){return Q("[object|string] [string|function] [function]",[e,t,n],arguments.length),typeof e=="object"&&!Array.isArray(e)?(e=Kn(e,p(this,pt,"f"),this[Et]()["deep-merge-config"]||!1,p(this,te,"f")),p(this,Z,"f").configObjects=(p(this,Z,"f").configObjects||[]).concat(e),this):(typeof t=="function"&&(n=t,t=void 0),this.describe(e,t||p(this,ie,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(e)?e:[e]).forEach(r=>{p(this,Z,"f").config[r]=n||!0}),this)}completion(e,t,n){return Q("[string] [string|boolean|function] [function]",[e,t,n],arguments.length),typeof t=="function"&&(n=t,t=void 0),J(this,Le,e||p(this,Le,"f")||"completion","f"),!t&&t!==!1&&(t="generate completion script"),this.command(p(this,Le,"f"),t),n&&p(this,Te,"f").registerFunction(n),this}command(e,t,n,r,u,s){return Q("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[e,t,n,r,u,s],arguments.length),p(this,Ae,"f").addHandler(e,t,n,r,u,s),this}commands(e,t,n,r,u,s){return this.command(e,t,n,r,u,s)}commandDir(e,t){Q("<string> [object]",[e,t],arguments.length);const n=p(this,pn,"f")||p(this,te,"f").require;return p(this,Ae,"f").addDirectory(e,n,p(this,te,"f").getCallerFile(),t),this}count(e){return Q("<array|string>",[e],arguments.length),this[ut]("count",e),this[bt](e),this}default(e,t,n){return Q("<object|string|array> [*] [string]",[e,t,n],arguments.length),n&&(Ar(e,p(this,te,"f")),p(this,Z,"f").defaultDescription[e]=n),typeof t=="function"&&(Ar(e,p(this,te,"f")),p(this,Z,"f").defaultDescription[e]||(p(this,Z,"f").defaultDescription[e]=p(this,ie,"f").functionDescription(t)),t=t.call()),this[Bt](this.default.bind(this),"default",e,t),this}defaults(e,t,n){return this.default(e,t,n)}demandCommand(e=1,t,n,r){return Q("[number] [number|string] [string|null|undefined] [string|null|undefined]",[e,t,n,r],arguments.length),typeof t!="number"&&(n=t,t=1/0),this.global("_",!1),p(this,Z,"f").demandedCommands._={min:e,max:t,minMsg:n,maxMsg:r},this}demand(e,t,n){return Array.isArray(t)?(t.forEach(r=>{ze(n,!0,p(this,te,"f")),this.demandOption(r,n)}),t=1/0):typeof t!="number"&&(n=t,t=1/0),typeof e=="number"?(ze(n,!0,p(this,te,"f")),this.demandCommand(e,t,n,n)):Array.isArray(e)?e.forEach(r=>{ze(n,!0,p(this,te,"f")),this.demandOption(r,n)}):typeof n=="string"?this.demandOption(e,n):(n===!0||typeof n>"u")&&this.demandOption(e),this}demandOption(e,t){return Q("<object|string|array> [string]",[e,t],arguments.length),this[Bt](this.demandOption.bind(this),"demandedOptions",e,t),this}deprecateOption(e,t){return Q("<string> [string|boolean]",[e,t],arguments.length),p(this,Z,"f").deprecatedOptions[e]=t,this}describe(e,t){return Q("<object|string|array> [string]",[e,t],arguments.length),this[ti](e,!0),p(this,ie,"f").describe(e,t),this}detectLocale(e){return Q("<boolean>",[e],arguments.length),J(this,ht,e,"f"),this}env(e){return Q("[string|boolean]",[e],arguments.length),e===!1?delete p(this,Z,"f").envPrefix:p(this,Z,"f").envPrefix=e||"",this}epilogue(e){return Q("<string>",[e],arguments.length),p(this,ie,"f").epilog(e),this}epilog(e){return this.epilogue(e)}example(e,t){return Q("<string|array> [string]",[e,t],arguments.length),Array.isArray(e)?e.forEach(n=>this.example(...n)):p(this,ie,"f").example(e,t),this}exit(e,t){J(this,Ne,!0,"f"),J(this,rt,t,"f"),p(this,Me,"f")&&p(this,te,"f").process.exit(e)}exitProcess(e=!0){return Q("[boolean]",[e],arguments.length),J(this,Me,e,"f"),this}fail(e){if(Q("<function|boolean>",[e],arguments.length),typeof e=="boolean"&&e!==!1)throw new Fe("Invalid first argument. Expected function or boolean 'false'");return p(this,ie,"f").failFn(e),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(e,t){return Q("<array> [function]",[e,t],arguments.length),t?p(this,Te,"f").getCompletion(e,t):new Promise((n,r)=>{p(this,Te,"f").getCompletion(e,(u,s)=>{u?r(u):n(s)})})}getDemandedOptions(){return Q([],0),p(this,Z,"f").demandedOptions}getDemandedCommands(){return Q([],0),p(this,Z,"f").demandedCommands}getDeprecatedOptions(){return Q([],0),p(this,Z,"f").deprecatedOptions}getDetectLocale(){return p(this,ht,"f")}getExitProcess(){return p(this,Me,"f")}getGroups(){return Object.assign({},p(this,Ye,"f"),p(this,mt,"f"))}getHelp(){if(J(this,Ne,!0,"f"),!p(this,ie,"f").hasCachedHelpMessage()){if(!this.parsed){const t=this[qt](p(this,st,"f"),void 0,void 0,0,!0);if(ye(t))return t.then(()=>p(this,ie,"f").help())}const e=p(this,Ae,"f").runDefaultBuilderOn(this);if(ye(e))return e.then(()=>p(this,ie,"f").help())}return Promise.resolve(p(this,ie,"f").help())}getOptions(){return p(this,Z,"f")}getStrict(){return p(this,Dt,"f")}getStrictCommands(){return p(this,Ct,"f")}getStrictOptions(){return p(this,At,"f")}global(e,t){return Q("<string|array> [boolean]",[e,t],arguments.length),e=[].concat(e),t!==!1?p(this,Z,"f").local=p(this,Z,"f").local.filter(n=>e.indexOf(n)===-1):e.forEach(n=>{p(this,Z,"f").local.includes(n)||p(this,Z,"f").local.push(n)}),this}group(e,t){Q("<string|array> <string>",[e,t],arguments.length);const n=p(this,mt,"f")[t]||p(this,Ye,"f")[t];p(this,mt,"f")[t]&&delete p(this,mt,"f")[t];const r={};return p(this,Ye,"f")[t]=(n||[]).concat(e).filter(u=>r[u]?!1:r[u]=!0),this}hide(e){return Q("<string>",[e],arguments.length),p(this,Z,"f").hiddenOptions.push(e),this}implies(e,t){return Q("<string|object> [number|string|array]",[e,t],arguments.length),p(this,Ce,"f").implies(e,t),this}locale(e){return Q("[string]",[e],arguments.length),e===void 0?(this[Jn](),p(this,te,"f").y18n.getLocale()):(J(this,ht,!1,"f"),p(this,te,"f").y18n.setLocale(e),this)}middleware(e,t,n){return p(this,ke,"f").addMiddleware(e,!!t,n)}nargs(e,t){return Q("<string|object|array> [number]",[e,t],arguments.length),this[Bt](this.nargs.bind(this),"narg",e,t),this}normalize(e){return Q("<array|string>",[e],arguments.length),this[ut]("normalize",e),this}number(e){return Q("<array|string>",[e],arguments.length),this[ut]("number",e),this[bt](e),this}option(e,t){if(Q("<string|object> [object]",[e,t],arguments.length),typeof e=="object")Object.keys(e).forEach(n=>{this.options(n,e[n])});else{typeof t!="object"&&(t={}),this[bt](e),p(this,Je,"f")&&(e==="version"||t?.alias==="version")&&this[xr](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
|
|
63
|
+
`),void 0,"versionWarning"),p(this,Z,"f").key[e]=!0,t.alias&&this.alias(e,t.alias);const n=t.deprecate||t.deprecated;n&&this.deprecateOption(e,n);const r=t.demand||t.required||t.require;r&&this.demand(e,r),t.demandOption&&this.demandOption(e,typeof t.demandOption=="string"?t.demandOption:void 0),t.conflicts&&this.conflicts(e,t.conflicts),"default"in t&&this.default(e,t.default),t.implies!==void 0&&this.implies(e,t.implies),t.nargs!==void 0&&this.nargs(e,t.nargs),t.config&&this.config(e,t.configParser),t.normalize&&this.normalize(e),t.choices&&this.choices(e,t.choices),t.coerce&&this.coerce(e,t.coerce),t.group&&this.group(e,t.group),(t.boolean||t.type==="boolean")&&(this.boolean(e),t.alias&&this.boolean(t.alias)),(t.array||t.type==="array")&&(this.array(e),t.alias&&this.array(t.alias)),(t.number||t.type==="number")&&(this.number(e),t.alias&&this.number(t.alias)),(t.string||t.type==="string")&&(this.string(e),t.alias&&this.string(t.alias)),(t.count||t.type==="count")&&this.count(e),typeof t.global=="boolean"&&this.global(e,t.global),t.defaultDescription&&(p(this,Z,"f").defaultDescription[e]=t.defaultDescription),t.skipValidation&&this.skipValidation(e);const u=t.describe||t.description||t.desc,s=p(this,ie,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(s,e)||typeof u=="string")&&this.describe(e,u),t.hidden&&this.hide(e),t.requiresArg&&this.requiresArg(e)}return this}options(e,t){return this.option(e,t)}parse(e,t,n){Q("[string|array] [function|boolean|object] [function]",[e,t,n],arguments.length),this[$r](),typeof e>"u"&&(e=p(this,st,"f")),typeof t=="object"&&(J(this,gt,t,"f"),t=n),typeof t=="function"&&(J(this,Pe,t,"f"),t=!1),t||J(this,st,e,"f"),p(this,Pe,"f")&&J(this,Me,!1,"f");const r=this[qt](e,!!t),u=this.parsed;return p(this,Te,"f").setParsed(this.parsed),ye(r)?r.then(s=>(p(this,Pe,"f")&&p(this,Pe,"f").call(this,p(this,rt,"f"),s,p(this,ve,"f")),s)).catch(s=>{throw p(this,Pe,"f")&&p(this,Pe,"f")(s,this.parsed.argv,p(this,ve,"f")),s}).finally(()=>{this[ni](),this.parsed=u}):(p(this,Pe,"f")&&p(this,Pe,"f").call(this,p(this,rt,"f"),r,p(this,ve,"f")),this[ni](),this.parsed=u,r)}parseAsync(e,t,n){const r=this.parse(e,t,n);return ye(r)?r:Promise.resolve(r)}parseSync(e,t,n){const r=this.parse(e,t,n);if(ye(r))throw new Fe(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return r}parserConfiguration(e){return Q("<object>",[e],arguments.length),J(this,hn,e,"f"),this}pkgConf(e,t){Q("<string> [string]",[e,t],arguments.length);let n=null;const r=this[Qn](t||p(this,pt,"f"));return r[e]&&typeof r[e]=="object"&&(n=Kn(r[e],t||p(this,pt,"f"),this[Et]()["deep-merge-config"]||!1,p(this,te,"f")),p(this,Z,"f").configObjects=(p(this,Z,"f").configObjects||[]).concat(n)),this}positional(e,t){Q("<string> <object>",[e,t],arguments.length);const n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];t=Wt(t,(s,o)=>s==="type"&&!["string","number","boolean"].includes(o)?!1:n.includes(s));const r=p(this,zt,"f").fullCommands[p(this,zt,"f").fullCommands.length-1],u=r?p(this,Ae,"f").cmdToParseOptions(r):{array:[],alias:{},default:{},demand:{}};return on(u).forEach(s=>{const o=u[s];Array.isArray(o)?o.indexOf(e)!==-1&&(t[s]=!0):o[e]&&!(s in t)&&(t[s]=o[e])}),this.group(e,p(this,ie,"f").getPositionalGroupName()),this.option(e,t)}recommendCommands(e=!0){return Q("[boolean]",[e],arguments.length),J(this,gn,e,"f"),this}required(e,t,n){return this.demand(e,t,n)}require(e,t,n){return this.demand(e,t,n)}requiresArg(e){return Q("<array|string|object> [number]",[e],arguments.length),typeof e=="string"&&p(this,Z,"f").narg[e]?this:(this[Bt](this.requiresArg.bind(this),"narg",e,NaN),this)}showCompletionScript(e,t){return Q("[string] [string]",[e,t],arguments.length),e=e||this.$0,p(this,xt,"f").log(p(this,Te,"f").generateCompletionScript(e,t||p(this,Le,"f")||"completion")),this}showHelp(e){if(Q("[string|function]",[e],arguments.length),J(this,Ne,!0,"f"),!p(this,ie,"f").hasCachedHelpMessage()){if(!this.parsed){const n=this[qt](p(this,st,"f"),void 0,void 0,0,!0);if(ye(n))return n.then(()=>{p(this,ie,"f").showHelp(e)}),this}const t=p(this,Ae,"f").runDefaultBuilderOn(this);if(ye(t))return t.then(()=>{p(this,ie,"f").showHelp(e)}),this}return p(this,ie,"f").showHelp(e),this}scriptName(e){return this.customScriptName=!0,this.$0=e,this}showHelpOnFail(e,t){return Q("[boolean|string] [string]",[e,t],arguments.length),p(this,ie,"f").showHelpOnFail(e,t),this}showVersion(e){return Q("[string|function]",[e],arguments.length),p(this,ie,"f").showVersion(e),this}skipValidation(e){return Q("<array|string>",[e],arguments.length),this[ut]("skipValidation",e),this}strict(e){return Q("[boolean]",[e],arguments.length),J(this,Dt,e!==!1,"f"),this}strictCommands(e){return Q("[boolean]",[e],arguments.length),J(this,Ct,e!==!1,"f"),this}strictOptions(e){return Q("[boolean]",[e],arguments.length),J(this,At,e!==!1,"f"),this}string(e){return Q("<array|string>",[e],arguments.length),this[ut]("string",e),this[bt](e),this}terminalWidth(){return Q([],0),p(this,te,"f").process.stdColumns}updateLocale(e){return this.updateStrings(e)}updateStrings(e){return Q("<object>",[e],arguments.length),J(this,ht,!1,"f"),p(this,te,"f").y18n.updateLocale(e),this}usage(e,t,n,r){if(Q("<string|null|undefined> [string|boolean] [function|object] [function]",[e,t,n,r],arguments.length),t!==void 0){if(ze(e,null,p(this,te,"f")),(e||"").match(/^\$0( |$)/))return this.command(e,t,n,r);throw new Fe(".usage() description must start with $0 if being used as alias for .command()")}else return p(this,ie,"f").usage(e),this}usageConfiguration(e){return Q("<object>",[e],arguments.length),J(this,mn,e,"f"),this}version(e,t,n){const r="version";if(Q("[boolean|string] [string] [string]",[e,t,n],arguments.length),p(this,Je,"f")&&(this[Yn](p(this,Je,"f")),p(this,ie,"f").version(void 0),J(this,Je,null,"f")),arguments.length===0)n=this[Rr](),e=r;else if(arguments.length===1){if(e===!1)return this;n=e,e=r}else arguments.length===2&&(n=t,t=void 0);return J(this,Je,typeof e=="string"?e:r,"f"),t=t||p(this,ie,"f").deferY18nLookup("Show version number"),p(this,ie,"f").version(n||void 0),this.boolean(p(this,Je,"f")),this.describe(p(this,Je,"f"),t),this}wrap(e){return Q("<number|null|undefined>",[e],arguments.length),p(this,ie,"f").wrap(e),this}[(Ae=new WeakMap,pt=new WeakMap,zt=new WeakMap,Te=new WeakMap,Le=new WeakMap,cn=new WeakMap,rt=new WeakMap,ht=new WeakMap,ln=new WeakMap,Me=new WeakMap,fn=new WeakMap,ke=new WeakMap,Ye=new WeakMap,Ne=new WeakMap,He=new WeakMap,dn=new WeakMap,xt=new WeakMap,ve=new WeakMap,Z=new WeakMap,pn=new WeakMap,hn=new WeakMap,Pe=new WeakMap,gt=new WeakMap,$t=new WeakMap,mt=new WeakMap,st=new WeakMap,gn=new WeakMap,te=new WeakMap,Dt=new WeakMap,Ct=new WeakMap,At=new WeakMap,ie=new WeakMap,mn=new WeakMap,Je=new WeakMap,Ce=new WeakMap,Sr)](e){if(!e._||!e["--"])return e;e._.push.apply(e._,e["--"]);try{delete e["--"]}catch{}return e}[vr](){return{log:(...e)=>{this[Dn]()||console.log(...e),J(this,Ne,!0,"f"),p(this,ve,"f").length&&J(this,ve,p(this,ve,"f")+`
|
|
64
|
+
`,"f"),J(this,ve,p(this,ve,"f")+e.join(" "),"f")},error:(...e)=>{this[Dn]()||console.error(...e),J(this,Ne,!0,"f"),p(this,ve,"f").length&&J(this,ve,p(this,ve,"f")+`
|
|
65
|
+
`,"f"),J(this,ve,p(this,ve,"f")+e.join(" "),"f")}}}[Yn](e){on(p(this,Z,"f")).forEach(t=>{if((r=>r==="configObjects")(t))return;const n=p(this,Z,"f")[t];Array.isArray(n)?n.includes(e)&&n.splice(n.indexOf(e),1):typeof n=="object"&&delete n[e]}),delete p(this,ie,"f").getDescriptions()[e]}[xr](e,t,n){p(this,ln,"f")[n]||(p(this,te,"f").process.emitWarning(e,t),p(this,ln,"f")[n]=!0)}[$r](){p(this,fn,"f").push({options:p(this,Z,"f"),configObjects:p(this,Z,"f").configObjects.slice(0),exitProcess:p(this,Me,"f"),groups:p(this,Ye,"f"),strict:p(this,Dt,"f"),strictCommands:p(this,Ct,"f"),strictOptions:p(this,At,"f"),completionCommand:p(this,Le,"f"),output:p(this,ve,"f"),exitError:p(this,rt,"f"),hasOutput:p(this,Ne,"f"),parsed:this.parsed,parseFn:p(this,Pe,"f"),parseContext:p(this,gt,"f")}),p(this,ie,"f").freeze(),p(this,Ce,"f").freeze(),p(this,Ae,"f").freeze(),p(this,ke,"f").freeze()}[Br](){let e="",t;return/\b(node|iojs|electron)(\.exe)?$/.test(p(this,te,"f").process.argv()[0])?t=p(this,te,"f").process.argv().slice(1,2):t=p(this,te,"f").process.argv().slice(0,1),e=t.map(n=>{const r=this[Wr](p(this,pt,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&r.length<n.length?r:n}).join(" ").trim(),p(this,te,"f").getEnv("_")&&p(this,te,"f").getProcessArgvBin()===p(this,te,"f").getEnv("_")&&(e=p(this,te,"f").getEnv("_").replace(`${p(this,te,"f").path.dirname(p(this,te,"f").process.execPath())}/`,"")),e}[Et](){return p(this,hn,"f")}[Or](){return p(this,mn,"f")}[Jn](){if(!p(this,ht,"f"))return;const e=p(this,te,"f").getEnv("LC_ALL")||p(this,te,"f").getEnv("LC_MESSAGES")||p(this,te,"f").getEnv("LANG")||p(this,te,"f").getEnv("LANGUAGE")||"en_US";this.locale(e.replace(/[.:].*/,""))}[Rr](){return this[Qn]().version||"unknown"}[Ir](e){const t=e["--"]?e["--"]:e._;for(let n=0,r;(r=t[n])!==void 0;n++)p(this,te,"f").Parser.looksLikeNumber(r)&&Number.isSafeInteger(Math.floor(parseFloat(`${r}`)))&&(t[n]=Number(r));return e}[Qn](e){const t=e||"*";if(p(this,$t,"f")[t])return p(this,$t,"f")[t];let n={};try{let r=e||p(this,te,"f").mainFilename;!e&&p(this,te,"f").path.extname(r)&&(r=p(this,te,"f").path.dirname(r));const u=p(this,te,"f").findUp(r,(s,o)=>{if(o.includes("package.json"))return"package.json"});ze(u,void 0,p(this,te,"f")),n=JSON.parse(p(this,te,"f").readFileSync(u,"utf8"))}catch{}return p(this,$t,"f")[t]=n||{},p(this,$t,"f")[t]}[ut](e,t){t=[].concat(t),t.forEach(n=>{n=this[ei](n),p(this,Z,"f")[e].push(n)})}[Bt](e,t,n,r){this[Zn](e,t,n,r,(u,s,o)=>{p(this,Z,"f")[u][s]=o})}[Xn](e,t,n,r){this[Zn](e,t,n,r,(u,s,o)=>{p(this,Z,"f")[u][s]=(p(this,Z,"f")[u][s]||[]).concat(o)})}[Zn](e,t,n,r,u){if(Array.isArray(n))n.forEach(s=>{e(s,r)});else if((s=>typeof s=="object")(n))for(const s of on(n))e(s,n[s]);else u(t,this[ei](n),r)}[ei](e){return e==="__proto__"?"___proto___":e}[ti](e,t){return this[Bt](this[ti].bind(this),"key",e,t),this}[ni](){var e,t,n,r,u,s,o,a,l,f,d,c;const A=p(this,fn,"f").pop();ze(A,void 0,p(this,te,"f"));let F;e=this,t=this,n=this,r=this,u=this,s=this,o=this,a=this,l=this,f=this,d=this,c=this,{options:{set value(w){J(e,Z,w,"f")}}.value,configObjects:F,exitProcess:{set value(w){J(t,Me,w,"f")}}.value,groups:{set value(w){J(n,Ye,w,"f")}}.value,output:{set value(w){J(r,ve,w,"f")}}.value,exitError:{set value(w){J(u,rt,w,"f")}}.value,hasOutput:{set value(w){J(s,Ne,w,"f")}}.value,parsed:this.parsed,strict:{set value(w){J(o,Dt,w,"f")}}.value,strictCommands:{set value(w){J(a,Ct,w,"f")}}.value,strictOptions:{set value(w){J(l,At,w,"f")}}.value,completionCommand:{set value(w){J(f,Le,w,"f")}}.value,parseFn:{set value(w){J(d,Pe,w,"f")}}.value,parseContext:{set value(w){J(c,gt,w,"f")}}.value}=A,p(this,Z,"f").configObjects=F,p(this,ie,"f").unfreeze(),p(this,Ce,"f").unfreeze(),p(this,Ae,"f").unfreeze(),p(this,ke,"f").unfreeze()}[Lr](e,t){return Ut(t,n=>(e(n),n))}getInternalMethods(){return{getCommandInstance:this[Nr].bind(this),getContext:this[Pr].bind(this),getHasOutput:this[jr].bind(this),getLoggerInstance:this[Tr].bind(this),getParseContext:this[Mr].bind(this),getParserConfiguration:this[Et].bind(this),getUsageConfiguration:this[Or].bind(this),getUsageInstance:this[kr].bind(this),getValidationInstance:this[Hr].bind(this),hasParseCallback:this[Dn].bind(this),isGlobalContext:this[Ur].bind(this),postProcess:this[wt].bind(this),reset:this[ii].bind(this),runValidation:this[ri].bind(this),runYargsParserAndExecuteCommands:this[qt].bind(this),setHasOutput:this[Gr].bind(this)}}[Nr](){return p(this,Ae,"f")}[Pr](){return p(this,zt,"f")}[jr](){return p(this,Ne,"f")}[Tr](){return p(this,xt,"f")}[Mr](){return p(this,gt,"f")||{}}[kr](){return p(this,ie,"f")}[Hr](){return p(this,Ce,"f")}[Dn](){return!!p(this,Pe,"f")}[Ur](){return p(this,dn,"f")}[wt](e,t,n,r){return n||ye(e)||(t||(e=this[Sr](e)),(this[Et]()["parse-positional-numbers"]||this[Et]()["parse-positional-numbers"]===void 0)&&(e=this[Ir](e)),r&&(e=Ht(e,this,p(this,ke,"f").getMiddleware(),!1))),e}[ii](e={}){J(this,Z,p(this,Z,"f")||{},"f");const t={};t.local=p(this,Z,"f").local||[],t.configObjects=p(this,Z,"f").configObjects||[];const n={};t.local.forEach(s=>{n[s]=!0,(e[s]||[]).forEach(o=>{n[o]=!0})}),Object.assign(p(this,mt,"f"),Object.keys(p(this,Ye,"f")).reduce((s,o)=>{const a=p(this,Ye,"f")[o].filter(l=>!(l in n));return a.length>0&&(s[o]=a),s},{})),J(this,Ye,{},"f");const r=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],u=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return r.forEach(s=>{t[s]=(p(this,Z,"f")[s]||[]).filter(o=>!n[o])}),u.forEach(s=>{t[s]=Wt(p(this,Z,"f")[s],o=>!n[o])}),t.envPrefix=p(this,Z,"f").envPrefix,J(this,Z,t,"f"),J(this,ie,p(this,ie,"f")?p(this,ie,"f").reset(n):ho(this,p(this,te,"f")),"f"),J(this,Ce,p(this,Ce,"f")?p(this,Ce,"f").reset(n):yo(this,p(this,ie,"f"),p(this,te,"f")),"f"),J(this,Ae,p(this,Ae,"f")?p(this,Ae,"f").reset():ao(p(this,ie,"f"),p(this,Ce,"f"),p(this,ke,"f"),p(this,te,"f")),"f"),p(this,Te,"f")||J(this,Te,Ao(this,p(this,ie,"f"),p(this,Ae,"f"),p(this,te,"f")),"f"),p(this,ke,"f").reset(),J(this,Le,null,"f"),J(this,ve,"","f"),J(this,rt,null,"f"),J(this,Ne,!1,"f"),this.parsed=!1,this}[Wr](e,t){return p(this,te,"f").path.relative(e,t)}[qt](e,t,n,r=0,u=!1){let s=!!n||u;e=e||p(this,st,"f"),p(this,Z,"f").__=p(this,te,"f").y18n.__,p(this,Z,"f").configuration=this[Et]();const o=!!p(this,Z,"f").configuration["populate--"],a=Object.assign({},p(this,Z,"f").configuration,{"populate--":!0}),l=p(this,te,"f").Parser.detailed(e,Object.assign({},p(this,Z,"f"),{configuration:{"parse-positional-numbers":!1,...a}})),f=Object.assign(l.argv,p(this,gt,"f"));let d;const c=l.aliases;let A=!1,F=!1;Object.keys(f).forEach(w=>{w===p(this,He,"f")&&f[w]?A=!0:w===p(this,Je,"f")&&f[w]&&(F=!0)}),f.$0=this.$0,this.parsed=l,r===0&&p(this,ie,"f").clearCachedHelpMessage();try{if(this[Jn](),t)return this[wt](f,o,!!n,!1);p(this,He,"f")&&[p(this,He,"f")].concat(c[p(this,He,"f")]||[]).filter(C=>C.length>1).includes(""+f._[f._.length-1])&&(f._.pop(),A=!0),J(this,dn,!1,"f");const w=p(this,Ae,"f").getCommands(),h=p(this,Te,"f").completionKey in f,E=A||h||u;if(f._.length){if(w.length){let x;for(let C=r||0,_;f._[C]!==void 0;C++)if(_=String(f._[C]),w.includes(_)&&_!==p(this,Le,"f")){const y=p(this,Ae,"f").runCommand(_,this,l,C+1,u,A||F||u);return this[wt](y,o,!!n,!1)}else if(!x&&_!==p(this,Le,"f")){x=_;break}!p(this,Ae,"f").hasDefaultCommand()&&p(this,gn,"f")&&x&&!E&&p(this,Ce,"f").recommendCommands(x,w)}p(this,Le,"f")&&f._.includes(p(this,Le,"f"))&&!h&&(p(this,Me,"f")&&Gt(!0),this.showCompletionScript(),this.exit(0))}if(p(this,Ae,"f").hasDefaultCommand()&&!E){const x=p(this,Ae,"f").runCommand(null,this,l,0,u,A||F||u);return this[wt](x,o,!!n,!1)}if(h){p(this,Me,"f")&&Gt(!0),e=[].concat(e);const x=e.slice(e.indexOf(`--${p(this,Te,"f").completionKey}`)+1);return p(this,Te,"f").getCompletion(x,(C,_)=>{if(C)throw new Fe(C.message);(_||[]).forEach(y=>{p(this,xt,"f").log(y)}),this.exit(0)}),this[wt](f,!o,!!n,!1)}if(p(this,Ne,"f")||(A?(p(this,Me,"f")&&Gt(!0),s=!0,this.showHelp("log"),this.exit(0)):F&&(p(this,Me,"f")&&Gt(!0),s=!0,p(this,ie,"f").showVersion("log"),this.exit(0))),!s&&p(this,Z,"f").skipValidation.length>0&&(s=Object.keys(f).some(x=>p(this,Z,"f").skipValidation.indexOf(x)>=0&&f[x]===!0)),!s){if(l.error)throw new Fe(l.error.message);if(!h){const x=this[ri](c,{},l.error);n||(d=Ht(f,this,p(this,ke,"f").getMiddleware(),!0)),d=this[Lr](x,d??f),ye(d)&&!n&&(d=d.then(()=>Ht(f,this,p(this,ke,"f").getMiddleware(),!1)))}}}catch(w){if(w instanceof Fe)p(this,ie,"f").fail(w.message,w);else throw w}return this[wt](d??f,o,!!n,!0)}[ri](e,t,n,r){const u={...this.getDemandedOptions()};return s=>{if(n)throw new Fe(n.message);p(this,Ce,"f").nonOptionCount(s),p(this,Ce,"f").requiredArguments(s,u);let o=!1;p(this,Ct,"f")&&(o=p(this,Ce,"f").unknownCommands(s)),p(this,Dt,"f")&&!o?p(this,Ce,"f").unknownArguments(s,e,t,!!r):p(this,At,"f")&&p(this,Ce,"f").unknownArguments(s,e,{},!1,!1),p(this,Ce,"f").limitedChoices(s),p(this,Ce,"f").implications(s),p(this,Ce,"f").conflicting(s)}}[Gr](){J(this,Ne,!0,"f")}[bt](e){if(typeof e=="string")p(this,Z,"f").key[e]=!0;else for(const t of e)p(this,Z,"f").key[t]=!0}}function xo(i){return!!i&&typeof i.getInternalMethods=="function"}const $o=So(to),Cn={type:"string",desc:"<directory> with LikeC4 sources (default is current directory)",normalize:!0,default:".",coerce:ce},qe={alias:"use-dot-bin",boolean:!0,type:"boolean",desc:'use graphviz binaries ("dot" should be on PATH)',default:!1},Vr={boolean:!0,type:"boolean",desc:'use hash history for navigation, e.g. "/#/view" instead of "/view"'},An={alias:"o",type:"string",desc:"<directory> output directory",normalize:!0,coerce:ce},si={alias:"w",type:"string",desc:'prefix for Webcomponents, e.g "c4" generates <c4-view ../>',default:"likec4"},zr={alias:["base-url"],type:"string",desc:'base url the app is being served from, e.g. "/" or "/pages/"'},qr={boolean:!0,type:"boolean",desc:"overview all diagrams as graph [experimental]",default:!1},Bo={boolean:!0,type:"boolean",desc:"outputs a single self-contained HTML file with all required resources inlined"},Kr=i=>i instanceof URL?nr(i):i;function Oo(i,{cwd:e=Qi.cwd(),type:t="file",stopAt:n}={}){let r=St.resolve(Kr(e)??"");const{root:u}=St.parse(r);for(n=St.resolve(r,Kr(n)??u);r&&r!==n&&r!==u;){const s=St.isAbsolute(i)?i:St.join(r,i);try{const o=Du.statSync(s,{throwIfNoEntry:!1});if(t==="file"&&o?.isFile()||t==="directory"&&o?.isDirectory())return s}catch{}r=St.dirname(r)}}function Ro({cwd:i=Qi.cwd()}={}){return Oo("package.json",{cwd:i})}const En=lt(nr(import.meta.url)),Io=`
|
|
66
66
|
/* prettier-ignore-start */
|
|
67
67
|
/* eslint-disable */
|
|
68
68
|
|
|
@@ -71,31 +71,31 @@ ${F.join(`
|
|
|
71
71
|
* DO NOT EDIT MANUALLY!
|
|
72
72
|
******************************************************************************/
|
|
73
73
|
|
|
74
|
-
`.trimStart(),
|
|
74
|
+
`.trimStart(),Lo=`
|
|
75
75
|
|
|
76
76
|
/* prettier-ignore-end */
|
|
77
|
-
`,
|
|
77
|
+
`,ui={banner:Io,footer:Lo};function Yr(){const i=Ro({cwd:En});if(!i)throw new Error("likec4 package folder not found");return lt(i)}function oi(){const i=Yr(),e=[ce(i,"__app__"),ce(En,"../__app__"),ce(En,"../../__app__"),ce(En,"../../dist/__app__")],t=Hs(e,it);if(!t)throw Be.error(`likec4 app root does not exist, tried:
|
|
78
78
|
${e.join(`
|
|
79
|
-
`)}`),new Error("likec4 app root does not exist");return t}async function
|
|
80
|
-
`),i}const
|
|
79
|
+
`)}`),new Error("likec4 app root does not exist");return t}async function ai(){const i=await nn(Lt(rn(),".likec4-public-"));return await dt(Lt(i,"likec4-views.js"),`// generated by likec4
|
|
80
|
+
`),i}const ci=1e4;function Jr(){const i=Yr();return{"likec4/icons":ce(i,"icons"),"likec4/react":ce(i,"react"),"likec4/model":ce(i,"dist/model")}}function No(i){var e,t;if(i){if("astNode"in i)return To(i);if(Array.isArray(i))return i.reduce(Qr,void 0);{const n=i,r=Po(n)?jo((t=(e=n?.root)===null||e===void 0?void 0:e.astNode)!==null&&t!==void 0?t:n?.astNode):void 0;return Ot(n,r)}}else return}function Po(i){return typeof i<"u"&&"element"in i&&"text"in i}function jo(i){try{return Wi(i).uri.toString()}catch{return}}function To(i){var e,t;const{astNode:n,property:r,index:u}=i??{},s=(e=n?.$cstNode)!==null&&e!==void 0?e:n?.$textRegion;if(!(n===void 0||s===void 0)){if(r===void 0)return Ot(s,li(n));{const o=a=>u!==void 0&&u>-1&&Array.isArray(n[r])?u<a.length?a[u]:void 0:a.reduce(Qr,void 0);if(!((t=s.assignments)===null||t===void 0)&&t[r]){const a=o(s.assignments[r]);return a&&Ot(a,li(n))}else if(n.$cstNode){const a=o(Us(n.$cstNode,r));return a&&Ot(a,li(n))}else return}}}function li(i){var e,t,n,r;return i.$cstNode?(t=(e=Wi(i))===null||e===void 0?void 0:e.uri)===null||t===void 0?void 0:t.toString():i.$textRegion?i.$textRegion.documentURI||((r=(n=new Ws(i,u=>u.$container?[u.$container]:[]).find(u=>{var s;return(s=u.$textRegion)===null||s===void 0?void 0:s.documentURI}))===null||n===void 0?void 0:n.$textRegion)===null||r===void 0?void 0:r.documentURI):void 0}function Ot(i,e){var t,n;const r={offset:i.offset,end:(t=i.end)!==null&&t!==void 0?t:i.offset+i.length,length:(n=i.length)!==null&&n!==void 0?n:i.end-i.offset};return i.range&&(r.range=i.range),e??(e=i.fileURI),e&&(r.fileURI=e),r}function Qr(i,e){var t,n;if(i){if(!e)return i&&Ot(i)}else return e&&Ot(e);const r=(t=i.end)!==null&&t!==void 0?t:i.offset+i.length,u=(n=e.end)!==null&&n!==void 0?n:e.offset+e.length,s=Math.min(i.offset,e.offset),o=Math.max(r,u),a=o-s,l={offset:s,end:o,length:a};if(i.range&&e.range&&(l.range={start:e.range.start.line<i.range.start.line||e.range.start.line===i.range.start.line&&e.range.start.character<i.range.start.character?e.range.start:i.range.start,end:e.range.end.line>i.range.end.line||e.range.end.line===i.range.end.line&&e.range.end.character>i.range.end.character?e.range.end:i.range.end}),i.fileURI||e.fileURI){const f=i.fileURI,d=e.fileURI,c=f&&d&&f!==d?`<unmergable text regions of ${f}, ${d}>`:f??d;l.fileURI=c}return l}class Mo{constructor(e){this.defaultIndentation=" ",this.pendingIndent=!0,this.currentIndents=[],this.recentNonImmediateIndents=[],this.traceData=[],this.lines=[[]],this.length=0,typeof e=="string"?this.defaultIndentation=e:typeof e=="number"&&(this.defaultIndentation="".padStart(e))}get content(){return this.lines.map(e=>e.join("")).join("")}get contentLength(){return this.length}get currentLineNumber(){return this.lines.length-1}get currentLineContent(){return this.lines[this.currentLineNumber].join("")}get currentPosition(){return{offset:this.contentLength,line:this.currentLineNumber,character:this.currentLineContent.length}}append(e,t){if(e.length>0){const n=t&&this.currentPosition;this.lines[this.currentLineNumber].push(e),this.length+=e.length,n&&this.indentPendingTraceRegions(n)}}indentPendingTraceRegions(e){for(let t=this.traceData.length-1;t>=0;t--){const n=this.traceData[t];n.targetStart&&n.targetStart.offset===e.offset&&(n.targetStart=this.currentPosition)}}increaseIndent(e){this.currentIndents.push(e),e.indentImmediately||this.recentNonImmediateIndents.push(e)}decreaseIndent(){this.currentIndents.pop()}get relevantIndents(){return this.currentIndents.filter(e=>!this.recentNonImmediateIndents.includes(e))}resetCurrentLine(){this.length-=this.lines[this.currentLineNumber].join("").length,this.lines[this.currentLineNumber]=[],this.pendingIndent=!0}addNewLine(){this.pendingIndent=!0,this.lines.push([]),this.recentNonImmediateIndents.length=0}pushTraceRegion(e){const t=ko(e,this.currentPosition,n=>{var r,u;return(u=(r=this.traceData[this.traceData.length-1])===null||r===void 0?void 0:r.children)===null||u===void 0?void 0:u.push(n)});return this.traceData.push(t),t}popTraceRegion(e){const t=this.traceData.pop();return this.assertTrue(t===e,"Trace region mismatch!"),t}getParentTraceSourceFileURI(){var e;for(let t=this.traceData.length-1;t>-1;t--){const n=(e=this.traceData[t].sourceRegion)===null||e===void 0?void 0:e.fileURI;if(n)return n}}assertTrue(e,t){if(!e)throw new Error(t)}}function ko(i,e,t){const n={sourceRegion:i,targetRegion:void 0,children:[],targetStart:e,complete:r=>{var u,s;return n.targetRegion={offset:n.targetStart.offset,end:r.offset,length:r.offset-n.targetStart.offset,range:{start:{line:n.targetStart.line,character:n.targetStart.character},end:{line:r.line,character:r.character}}},delete n.targetStart,((u=n.children)===null||u===void 0?void 0:u.length)===0&&delete n.children,!((s=n.targetRegion)===null||s===void 0)&&s.length&&t(n),delete n.complete,n}};return n}function Ho(i,e){const t=new Mo(e),n=t.pushTraceRegion(void 0);Xr(i,t),t.popTraceRegion(n),n.complete&&n.complete(t.currentPosition);const r=n.children&&n.children.length===1?n.children[0]:void 0,u=r?.targetRegion,s=n.targetRegion;return u&&r.sourceRegion&&u.offset===s.offset&&u.length===s.length?{text:t.content,trace:r}:{text:t.content,trace:n}}function Xr(i,e){typeof i=="string"?Uo(i,e):i instanceof di?Wo(i,e):i instanceof we?ts(i,e):i instanceof Yt&&Go(i,e)}function Zr(i,e){return typeof i=="string"?i.length!==0:i instanceof we?i.contents.some(t=>Zr(t,e)):i instanceof Yt?!(i.ifNotEmpty&&e.currentLineContent.length===0):!1}function Uo(i,e){i&&(e.pendingIndent&&es(e,!1),e.append(i))}function es(i,e){var t;let n="";for(const r of i.relevantIndents.filter(u=>u.indentEmptyLines||!e))n+=(t=r.indentation)!==null&&t!==void 0?t:i.defaultIndentation;i.append(n,!0),i.pendingIndent=!1}function ts(i,e){let t;const n=No(i.tracedSource);n&&(t=e.pushTraceRegion(n));for(const r of i.contents)Xr(r,e);if(t){e.popTraceRegion(t);const r=e.getParentTraceSourceFileURI();r&&n?.fileURI===r&&delete n.fileURI,t.complete&&t.complete(e.currentPosition)}}function Wo(i,e){var t;if(Zr(i,e)){i.indentImmediately&&!e.pendingIndent&&e.append((t=i.indentation)!==null&&t!==void 0?t:e.defaultIndentation,!0);try{e.increaseIndent(i),ts(i,e)}finally{e.decreaseIndent()}}}function Go(i,e){i.ifNotEmpty&&!Vo(e.currentLineContent)?e.resetCurrentLine():(e.pendingIndent&&es(e,!0),e.append(i.lineDelimiter),e.addNewLine())}function Vo(i){return i.trimStart()!==""}Object.freeze("__\xABSKIP^NEW^LINE^IF^EMPTY\xBB__");const zo=/\S|$/;function qo(i){const e=i.filter(n=>n.length>0).map(n=>n.search(zo)),t=e.length===0?0:Math.min(...e);return Math.max(0,t)}function ot(i,...e){const t=Yo(i),n=Jo(i,e,t);return Xo(n)}function Ko(i,e,t){return(n,...r)=>ea(i,e,t)(ot(n,...r))}function Yo(i){const e=i.join("_").split(Gi),t=e.length>1&&e[0].trim().length===0,n=t&&e.length>1&&e[e.length-1].trim().length===0;if(e.length===1||e.length!==0&&e[0].trim().length!==0||e.length===2&&e[1].trim().length===0)return{indentation:0,omitFirstLine:t,omitLastLine:n,trimLastLine:e.length!==1&&e[e.length-1].trim().length===0};{let r=t?e.slice(1):e;r=n?r.slice(0,r.length-1):r,r=r.filter(s=>s.length!==0);const u=qo(r);return{indentation:u,omitFirstLine:t,omitLastLine:n&&(e[e.length-1].length<u||!e[e.length-1].startsWith(r[0].substring(0,u)))}}}function Jo(i,e,{indentation:t,omitFirstLine:n,omitLastLine:r,trimLastLine:u}){const s=[];i.forEach((l,f)=>{s.push(...l.split(Gi).map((d,c)=>c===0||d.length<t?d:d.substring(t)).reduce(f===0?(d,c,A)=>A===0?n?[]:[c]:A===1&&d.length===0?[c]:d.concat(wn,c):(d,c,A)=>A===0?[c]:d.concat(wn,c),[]).filter(d=>!(typeof d=="string"&&d.length===0)).concat(Kt(e[f])?e[f]:e[f]!==void 0?{content:String(e[f])}:f<e.length?ns:[]))});const o=s.length,a=o!==0?s[o-1]:void 0;return(r||u)&&typeof a=="string"&&a.trim().length===0?n&&o!==1&&s[o-2]===wn?s.slice(0,o-2):s.slice(0,o-1):s}const wn={isNewLine:!0},ns={isUndefinedSegment:!0},is=i=>i===wn,fi=i=>i===ns,Qo=i=>i.content!==void 0;function Xo(i){return i.reduce((t,n,r)=>fi(n)?t:is(n)?{node:r!==0&&(fi(i[r-1])||Kt(i[r-1]))||r>1&&typeof i[r-1]=="string"&&(fi(i[r-2])||Kt(i[r-2]))?t.node.appendNewLineIfNotEmpty():t.node.appendNewLine()}:(()=>{var u;const s=(r===0||is(i[r-1]))&&typeof n=="string"&&n.length!==0?"".padStart(n.length-n.trimStart().length):"",o=Qo(n)?n.content:n;let a;return{node:t.indented?t.node:s.length!==0?t.node.indent({indentation:s,indentImmediately:!1,indentedChildren:l=>a=l.append(o)}):t.node.append(o),indented:a??((u=t.indented)===null||u===void 0?void 0:u.append(o))}})(),{node:new we}).node}const Zo=typeof process>"u"?`
|
|
81
81
|
`:process.platform==="win32"?`\r
|
|
82
82
|
`:`
|
|
83
|
-
`;function Ht(i){return i instanceof ce||i instanceof si||i instanceof Gt}function tt(i,e){return Ht(i)?Gu(i,e).text:String(i)}class ce{constructor(...e){this.contents=[],this.append(...e)}isEmpty(){return this.contents.length===0}trace(e,t,n){if(Zr(e)){if(this.tracedSource={astNode:e,property:t,index:n},this.tracedSource.property===void 0&&this.tracedSource.index!==void 0&&this.tracedSource.index>-1)throw new Error("Generation support: 'property' argument must not be 'undefined' if a non-negative value is assigned to 'index' in 'CompositeGeneratorNode.trace(...)'.")}else this.tracedSource=e;return this}append(...e){for(const t of e)typeof t=="function"?t(this):t&&this.contents.push(t);return this}appendIf(e,...t){return e?this.append(...t):this}appendNewLine(){return this.append(G)}appendNewLineIf(e){return e?this.append(G):this}appendNewLineIfNotEmpty(){return this.append(uo)}appendNewLineIfNotEmptyIf(e){return e?this.appendNewLineIfNotEmpty():this}appendTemplate(e,...t){return this.append(et(e,...t))}appendTemplateIf(e){return e?(t,...n)=>this.appendTemplate(t,...n):()=>this}indent(e){const{indentedChildren:t,indentation:n,indentEmptyLines:r,indentImmediately:s}=Array.isArray(e)||typeof e=="function"?{indentedChildren:e}:typeof e=="object"?e:{},u=new si(n,s,r);return this.contents.push(u),Array.isArray(t)?u.append(...t):t&&u.append(t),this}appendTraced(e,t,n){return r=>this.append(new ce().trace(e,t,n).append(r))}appendTracedIf(e,t,n,r){return e?this.appendTraced(typeof t=="function"?t():t,n,r):()=>this}appendTracedTemplate(e,t,n){return(r,...s)=>this.append(Zu(e,t,n)(r,...s))}appendTracedTemplateIf(e,t,n,r){return e?this.appendTracedTemplate(typeof t=="function"?t():t,n,r):()=>this}}function so(i,e,t){return n=>n instanceof ce&&n.tracedSource===void 0?n.trace(i,e,t):new ce().trace(i,e,t).append(n)}class si extends ce{constructor(e,t=!0,n=!1){super(),this.indentImmediately=!0,this.indentEmptyLines=!1,typeof e=="string"?this.indentation=e:typeof e=="number"&&(this.indentation="".padStart(e)),this.indentImmediately=t,this.indentEmptyLines=n}}class Gt{constructor(e,t=!1){this.ifNotEmpty=!1,this.lineDelimiter=e??ro,this.ifNotEmpty=t}}const G=new Gt,uo=new Gt(void 0,!0),Ir=i=>i===void 0||typeof i=="string"||Ht(i)?i:String(i);function $e(i,e=Ir,t={}){const n=typeof e=="function"?e:Ir,{filter:r,prefix:s,suffix:u,separator:a,appendNewLineIfNotEmpty:c,skipNewLineAfterLastItem:h}=typeof e=="object"?e:t,l=typeof s=="function"?s:()=>s,f=typeof u=="function"?u:()=>u;return oo(i,(p,C,F,w)=>{if(r&&!r(C,F,w))return p;const m=n(C,F,w);return m===void 0?p:(p??(p=new ce)).append(l(C,F,w)).append(m).append(f(C,F,w)).appendIf(!w,a).appendNewLineIfNotEmptyIf(!p.isEmpty()&&!!c&&(!w||!h))})}function oo(i,e,t){const n=i[Symbol.iterator]();let r=n.next(),s=0,u=t;for(;!r.done;){const a=n.next();u=e(u,r.value,s,!!a.done),r=a,s++}return u}var ao=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,co=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,lo=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,ui={Space_Separator:ao,ID_Start:co,ID_Continue:lo},ae={isSpaceSeparator(i){return typeof i=="string"&&ui.Space_Separator.test(i)},isIdStartChar(i){return typeof i=="string"&&(i>="a"&&i<="z"||i>="A"&&i<="Z"||i==="$"||i==="_"||ui.ID_Start.test(i))},isIdContinueChar(i){return typeof i=="string"&&(i>="a"&&i<="z"||i>="A"&&i<="Z"||i>="0"&&i<="9"||i==="$"||i==="_"||i==="\u200C"||i==="\u200D"||ui.ID_Continue.test(i))},isDigit(i){return typeof i=="string"&&/[0-9]/.test(i)},isHexDigit(i){return typeof i=="string"&&/[0-9A-Fa-f]/.test(i)}};let oi,Ae,Ye,wn,nt,Te,ge,ai,Yt;var fo=function(e,t){oi=String(e),Ae="start",Ye=[],wn=0,nt=1,Te=0,ge=void 0,ai=void 0,Yt=void 0;do ge=ho(),go[Ae]();while(ge.type!=="eof");return typeof t=="function"?ci({"":Yt},"",t):Yt};function ci(i,e,t){const n=i[e];if(n!=null&&typeof n=="object")if(Array.isArray(n))for(let r=0;r<n.length;r++){const s=String(r),u=ci(n,s,t);u===void 0?delete n[s]:Object.defineProperty(n,s,{value:u,writable:!0,enumerable:!0,configurable:!0})}else for(const r in n){const s=ci(n,r,t);s===void 0?delete n[r]:Object.defineProperty(n,r,{value:s,writable:!0,enumerable:!0,configurable:!0})}return t.call(i,e,n)}let H,z,qt,qe,Y;function ho(){for(H="default",z="",qt=!1,qe=1;;){Y=Je();const i=jr[H]();if(i)return i}}function Je(){if(oi[wn])return String.fromCodePoint(oi.codePointAt(wn))}function b(){const i=Je();return i===`
|
|
84
|
-
`?(
|
|
85
|
-
`:case"\r":case"\u2028":case"\u2029":
|
|
86
|
-
`:case"\r":case"\u2028":case"\u2029":
|
|
87
|
-
`:case"\r":throw
|
|
88
|
-
`;case"r":return
|
|
89
|
-
`:case"\u2028":case"\u2029":return
|
|
90
|
-
`&&
|
|
91
|
-
`+
|
|
92
|
-
`+
|
|
93
|
-
`+
|
|
94
|
-
`+
|
|
95
|
-
`+
|
|
96
|
-
`+
|
|
97
|
-
`,"\\n"),
|
|
98
|
-
`,"\\n")+'" .-':"-","> ",n.get(
|
|
83
|
+
`;function Kt(i){return i instanceof we||i instanceof di||i instanceof Yt}function at(i,e){return Kt(i)?Ho(i,e).text:String(i)}class we{constructor(...e){this.contents=[],this.append(...e)}isEmpty(){return this.contents.length===0}trace(e,t,n){if(Gs(e)){if(this.tracedSource={astNode:e,property:t,index:n},this.tracedSource.property===void 0&&this.tracedSource.index!==void 0&&this.tracedSource.index>-1)throw new Error("Generation support: 'property' argument must not be 'undefined' if a non-negative value is assigned to 'index' in 'CompositeGeneratorNode.trace(...)'.")}else this.tracedSource=e;return this}append(...e){for(const t of e)typeof t=="function"?t(this):t&&this.contents.push(t);return this}appendIf(e,...t){return e?this.append(...t):this}appendNewLine(){return this.append(le)}appendNewLineIf(e){return e?this.append(le):this}appendNewLineIfNotEmpty(){return this.append(ta)}appendNewLineIfNotEmptyIf(e){return e?this.appendNewLineIfNotEmpty():this}appendTemplate(e,...t){return this.append(ot(e,...t))}appendTemplateIf(e){return e?(t,...n)=>this.appendTemplate(t,...n):()=>this}indent(e){const{indentedChildren:t,indentation:n,indentEmptyLines:r,indentImmediately:u}=Array.isArray(e)||typeof e=="function"?{indentedChildren:e}:typeof e=="object"?e:{},s=new di(n,u,r);return this.contents.push(s),Array.isArray(t)?s.append(...t):t&&s.append(t),this}appendTraced(e,t,n){return r=>this.append(new we().trace(e,t,n).append(r))}appendTracedIf(e,t,n,r){return e?this.appendTraced(typeof t=="function"?t():t,n,r):()=>this}appendTracedTemplate(e,t,n){return(r,...u)=>this.append(Ko(e,t,n)(r,...u))}appendTracedTemplateIf(e,t,n,r){return e?this.appendTracedTemplate(typeof t=="function"?t():t,n,r):()=>this}}function ea(i,e,t){return n=>n instanceof we&&n.tracedSource===void 0?n.trace(i,e,t):new we().trace(i,e,t).append(n)}class di extends we{constructor(e,t=!0,n=!1){super(),this.indentImmediately=!0,this.indentEmptyLines=!1,typeof e=="string"?this.indentation=e:typeof e=="number"&&(this.indentation="".padStart(e)),this.indentImmediately=t,this.indentEmptyLines=n}}class Yt{constructor(e,t=!1){this.ifNotEmpty=!1,this.lineDelimiter=e??Zo,this.ifNotEmpty=t}}const le=new Yt,ta=new Yt(void 0,!0),rs=i=>i===void 0||typeof i=="string"||Kt(i)?i:String(i);function Ue(i,e=rs,t={}){const n=typeof e=="function"?e:rs,{filter:r,prefix:u,suffix:s,separator:o,appendNewLineIfNotEmpty:a,skipNewLineAfterLastItem:l}=typeof e=="object"?e:t,f=typeof u=="function"?u:()=>u,d=typeof s=="function"?s:()=>s;return na(i,(c,A,F,w)=>{if(r&&!r(A,F,w))return c;const h=n(A,F,w);return h===void 0?c:(c??(c=new we)).append(f(A,F,w)).append(h).append(d(A,F,w)).appendIf(!w,o).appendNewLineIfNotEmptyIf(!c.isEmpty()&&!!a&&(!w||!l))})}function na(i,e,t){const n=i[Symbol.iterator]();let r=n.next(),u=0,s=t;for(;!r.done;){const o=n.next();s=e(s,r.value,u,!!o.done),r=o,u++}return s}var ia=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ra=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,sa=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,pi={Space_Separator:ia,ID_Start:ra,ID_Continue:sa},Ee={isSpaceSeparator(i){return typeof i=="string"&&pi.Space_Separator.test(i)},isIdStartChar(i){return typeof i=="string"&&(i>="a"&&i<="z"||i>="A"&&i<="Z"||i==="$"||i==="_"||pi.ID_Start.test(i))},isIdContinueChar(i){return typeof i=="string"&&(i>="a"&&i<="z"||i>="A"&&i<="Z"||i>="0"&&i<="9"||i==="$"||i==="_"||i==="\u200C"||i==="\u200D"||pi.ID_Continue.test(i))},isDigit(i){return typeof i=="string"&&/[0-9]/.test(i)},isHexDigit(i){return typeof i=="string"&&/[0-9A-Fa-f]/.test(i)}};let hi,Re,et,bn,ct,Ke,xe,gi,Jt;var ua=function(e,t){hi=String(e),Re="start",et=[],bn=0,ct=1,Ke=0,xe=void 0,gi=void 0,Jt=void 0;do xe=oa(),la[Re]();while(xe.type!=="eof");return typeof t=="function"?mi({"":Jt},"",t):Jt};function mi(i,e,t){const n=i[e];if(n!=null&&typeof n=="object")if(Array.isArray(n))for(let r=0;r<n.length;r++){const u=String(r),s=mi(n,u,t);s===void 0?delete n[u]:Object.defineProperty(n,u,{value:s,writable:!0,enumerable:!0,configurable:!0})}else for(const r in n){const u=mi(n,r,t);u===void 0?delete n[r]:Object.defineProperty(n,r,{value:u,writable:!0,enumerable:!0,configurable:!0})}return t.call(i,e,n)}let ae,ue,Qt,tt,fe;function oa(){for(ae="default",ue="",Qt=!1,tt=1;;){fe=nt();const i=ss[ae]();if(i)return i}}function nt(){if(hi[bn])return String.fromCodePoint(hi.codePointAt(bn))}function N(){const i=nt();return i===`
|
|
84
|
+
`?(ct++,Ke=0):i?Ke+=i.length:Ke++,i&&(bn+=i.length),i}const ss={default(){switch(fe){case" ":case"\v":case"\f":case" ":case"\xA0":case"\uFEFF":case`
|
|
85
|
+
`:case"\r":case"\u2028":case"\u2029":N();return;case"/":N(),ae="comment";return;case void 0:return N(),me("eof")}if(Ee.isSpaceSeparator(fe)){N();return}return ss[Re]()},comment(){switch(fe){case"*":N(),ae="multiLineComment";return;case"/":N(),ae="singleLineComment";return}throw De(N())},multiLineComment(){switch(fe){case"*":N(),ae="multiLineCommentAsterisk";return;case void 0:throw De(N())}N()},multiLineCommentAsterisk(){switch(fe){case"*":N();return;case"/":N(),ae="default";return;case void 0:throw De(N())}N(),ae="multiLineComment"},singleLineComment(){switch(fe){case`
|
|
86
|
+
`:case"\r":case"\u2028":case"\u2029":N(),ae="default";return;case void 0:return N(),me("eof")}N()},value(){switch(fe){case"{":case"[":return me("punctuator",N());case"n":return N(),yt("ull"),me("null",null);case"t":return N(),yt("rue"),me("boolean",!0);case"f":return N(),yt("alse"),me("boolean",!1);case"-":case"+":N()==="-"&&(tt=-1),ae="sign";return;case".":ue=N(),ae="decimalPointLeading";return;case"0":ue=N(),ae="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":ue=N(),ae="decimalInteger";return;case"I":return N(),yt("nfinity"),me("numeric",1/0);case"N":return N(),yt("aN"),me("numeric",NaN);case'"':case"'":Qt=N()==='"',ue="",ae="string";return}throw De(N())},identifierNameStartEscape(){if(fe!=="u")throw De(N());N();const i=Di();switch(i){case"$":case"_":break;default:if(!Ee.isIdStartChar(i))throw us();break}ue+=i,ae="identifierName"},identifierName(){switch(fe){case"$":case"_":case"\u200C":case"\u200D":ue+=N();return;case"\\":N(),ae="identifierNameEscape";return}if(Ee.isIdContinueChar(fe)){ue+=N();return}return me("identifier",ue)},identifierNameEscape(){if(fe!=="u")throw De(N());N();const i=Di();switch(i){case"$":case"_":case"\u200C":case"\u200D":break;default:if(!Ee.isIdContinueChar(i))throw us();break}ue+=i,ae="identifierName"},sign(){switch(fe){case".":ue=N(),ae="decimalPointLeading";return;case"0":ue=N(),ae="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":ue=N(),ae="decimalInteger";return;case"I":return N(),yt("nfinity"),me("numeric",tt*(1/0));case"N":return N(),yt("aN"),me("numeric",NaN)}throw De(N())},zero(){switch(fe){case".":ue+=N(),ae="decimalPoint";return;case"e":case"E":ue+=N(),ae="decimalExponent";return;case"x":case"X":ue+=N(),ae="hexadecimal";return}return me("numeric",tt*0)},decimalInteger(){switch(fe){case".":ue+=N(),ae="decimalPoint";return;case"e":case"E":ue+=N(),ae="decimalExponent";return}if(Ee.isDigit(fe)){ue+=N();return}return me("numeric",tt*Number(ue))},decimalPointLeading(){if(Ee.isDigit(fe)){ue+=N(),ae="decimalFraction";return}throw De(N())},decimalPoint(){switch(fe){case"e":case"E":ue+=N(),ae="decimalExponent";return}if(Ee.isDigit(fe)){ue+=N(),ae="decimalFraction";return}return me("numeric",tt*Number(ue))},decimalFraction(){switch(fe){case"e":case"E":ue+=N(),ae="decimalExponent";return}if(Ee.isDigit(fe)){ue+=N();return}return me("numeric",tt*Number(ue))},decimalExponent(){switch(fe){case"+":case"-":ue+=N(),ae="decimalExponentSign";return}if(Ee.isDigit(fe)){ue+=N(),ae="decimalExponentInteger";return}throw De(N())},decimalExponentSign(){if(Ee.isDigit(fe)){ue+=N(),ae="decimalExponentInteger";return}throw De(N())},decimalExponentInteger(){if(Ee.isDigit(fe)){ue+=N();return}return me("numeric",tt*Number(ue))},hexadecimal(){if(Ee.isHexDigit(fe)){ue+=N(),ae="hexadecimalInteger";return}throw De(N())},hexadecimalInteger(){if(Ee.isHexDigit(fe)){ue+=N();return}return me("numeric",tt*Number(ue))},string(){switch(fe){case"\\":N(),ue+=aa();return;case'"':if(Qt)return N(),me("string",ue);ue+=N();return;case"'":if(!Qt)return N(),me("string",ue);ue+=N();return;case`
|
|
87
|
+
`:case"\r":throw De(N());case"\u2028":case"\u2029":fa(fe);break;case void 0:throw De(N())}ue+=N()},start(){switch(fe){case"{":case"[":return me("punctuator",N())}ae="value"},beforePropertyName(){switch(fe){case"$":case"_":ue=N(),ae="identifierName";return;case"\\":N(),ae="identifierNameStartEscape";return;case"}":return me("punctuator",N());case'"':case"'":Qt=N()==='"',ae="string";return}if(Ee.isIdStartChar(fe)){ue+=N(),ae="identifierName";return}throw De(N())},afterPropertyName(){if(fe===":")return me("punctuator",N());throw De(N())},beforePropertyValue(){ae="value"},afterPropertyValue(){switch(fe){case",":case"}":return me("punctuator",N())}throw De(N())},beforeArrayValue(){if(fe==="]")return me("punctuator",N());ae="value"},afterArrayValue(){switch(fe){case",":case"]":return me("punctuator",N())}throw De(N())},end(){throw De(N())}};function me(i,e){return{type:i,value:e,line:ct,column:Ke}}function yt(i){for(const e of i){if(nt()!==e)throw De(N());N()}}function aa(){switch(nt()){case"b":return N(),"\b";case"f":return N(),"\f";case"n":return N(),`
|
|
88
|
+
`;case"r":return N(),"\r";case"t":return N()," ";case"v":return N(),"\v";case"0":if(N(),Ee.isDigit(nt()))throw De(N());return"\0";case"x":return N(),ca();case"u":return N(),Di();case`
|
|
89
|
+
`:case"\u2028":case"\u2029":return N(),"";case"\r":return N(),nt()===`
|
|
90
|
+
`&&N(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw De(N());case void 0:throw De(N())}return N()}function ca(){let i="",e=nt();if(!Ee.isHexDigit(e)||(i+=N(),e=nt(),!Ee.isHexDigit(e)))throw De(N());return i+=N(),String.fromCodePoint(parseInt(i,16))}function Di(){let i="",e=4;for(;e-- >0;){const t=nt();if(!Ee.isHexDigit(t))throw De(N());i+=N()}return String.fromCodePoint(parseInt(i,16))}const la={start(){if(xe.type==="eof")throw Ft();Ci()},beforePropertyName(){switch(xe.type){case"identifier":case"string":gi=xe.value,Re="afterPropertyName";return;case"punctuator":yn();return;case"eof":throw Ft()}},afterPropertyName(){if(xe.type==="eof")throw Ft();Re="beforePropertyValue"},beforePropertyValue(){if(xe.type==="eof")throw Ft();Ci()},beforeArrayValue(){if(xe.type==="eof")throw Ft();if(xe.type==="punctuator"&&xe.value==="]"){yn();return}Ci()},afterPropertyValue(){if(xe.type==="eof")throw Ft();switch(xe.value){case",":Re="beforePropertyName";return;case"}":yn()}},afterArrayValue(){if(xe.type==="eof")throw Ft();switch(xe.value){case",":Re="beforeArrayValue";return;case"]":yn()}},end(){}};function Ci(){let i;switch(xe.type){case"punctuator":switch(xe.value){case"{":i={};break;case"[":i=[];break}break;case"null":case"boolean":case"numeric":case"string":i=xe.value;break}if(Jt===void 0)Jt=i;else{const e=et[et.length-1];Array.isArray(e)?e.push(i):Object.defineProperty(e,gi,{value:i,writable:!0,enumerable:!0,configurable:!0})}if(i!==null&&typeof i=="object")et.push(i),Array.isArray(i)?Re="beforeArrayValue":Re="beforePropertyName";else{const e=et[et.length-1];e==null?Re="end":Array.isArray(e)?Re="afterArrayValue":Re="afterPropertyValue"}}function yn(){et.pop();const i=et[et.length-1];i==null?Re="end":Array.isArray(i)?Re="afterArrayValue":Re="afterPropertyValue"}function De(i){return Fn(i===void 0?`JSON5: invalid end of input at ${ct}:${Ke}`:`JSON5: invalid character '${os(i)}' at ${ct}:${Ke}`)}function Ft(){return Fn(`JSON5: invalid end of input at ${ct}:${Ke}`)}function us(){return Ke-=5,Fn(`JSON5: invalid identifier character at ${ct}:${Ke}`)}function fa(i){console.warn(`JSON5: '${os(i)}' in strings is not valid ECMAScript; consider escaping`)}function os(i){const e={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(e[i])return e[i];if(i<" "){const t=i.charCodeAt(0).toString(16);return"\\x"+("00"+t).substring(t.length)}return i}function Fn(i){const e=new SyntaxError(i);return e.lineNumber=ct,e.columnNumber=Ke,e}var da=function(e,t,n){const r=[];let u="",s,o,a="",l;if(t!=null&&typeof t=="object"&&!Array.isArray(t)&&(n=t.space,l=t.quote,t=t.replacer),typeof t=="function")o=t;else if(Array.isArray(t)){s=[];for(const w of t){let h;typeof w=="string"?h=w:(typeof w=="number"||w instanceof String||w instanceof Number)&&(h=String(w)),h!==void 0&&s.indexOf(h)<0&&s.push(h)}}return n instanceof Number?n=Number(n):n instanceof String&&(n=String(n)),typeof n=="number"?n>0&&(n=Math.min(10,Math.floor(n)),a=" ".substr(0,n)):typeof n=="string"&&(a=n.substr(0,10)),f("",{"":e});function f(w,h){let E=h[w];switch(E!=null&&(typeof E.toJSON5=="function"?E=E.toJSON5(w):typeof E.toJSON=="function"&&(E=E.toJSON(w))),o&&(E=o.call(h,w,E)),E instanceof Number?E=Number(E):E instanceof String?E=String(E):E instanceof Boolean&&(E=E.valueOf()),E){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof E=="string")return d(E);if(typeof E=="number")return String(E);if(typeof E=="object")return Array.isArray(E)?F(E):c(E)}function d(w){const h={"'":.1,'"':.2},E={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let x="";for(let _=0;_<w.length;_++){const y=w[_];switch(y){case"'":case'"':h[y]++,x+=y;continue;case"\0":if(Ee.isDigit(w[_+1])){x+="\\x00";continue}}if(E[y]){x+=E[y];continue}if(y<" "){let M=y.charCodeAt(0).toString(16);x+="\\x"+("00"+M).substring(M.length);continue}x+=y}const C=l||Object.keys(h).reduce((_,y)=>h[_]<h[y]?_:y);return x=x.replace(new RegExp(C,"g"),E[C]),C+x+C}function c(w){if(r.indexOf(w)>=0)throw TypeError("Converting circular structure to JSON5");r.push(w);let h=u;u=u+a;let E=s||Object.keys(w),x=[];for(const _ of E){const y=f(_,w);if(y!==void 0){let M=A(_)+":";a!==""&&(M+=" "),M+=y,x.push(M)}}let C;if(x.length===0)C="{}";else{let _;if(a==="")_=x.join(","),C="{"+_+"}";else{let y=`,
|
|
91
|
+
`+u;_=x.join(y),C=`{
|
|
92
|
+
`+u+_+`,
|
|
93
|
+
`+h+"}"}}return r.pop(),u=h,C}function A(w){if(w.length===0)return d(w);const h=String.fromCodePoint(w.codePointAt(0));if(!Ee.isIdStartChar(h))return d(w);for(let E=h.length;E<w.length;E++)if(!Ee.isIdContinueChar(String.fromCodePoint(w.codePointAt(E))))return d(w);return w}function F(w){if(r.indexOf(w)>=0)throw TypeError("Converting circular structure to JSON5");r.push(w);let h=u;u=u+a;let E=[];for(let C=0;C<w.length;C++){const _=f(String(C),w);E.push(_!==void 0?_:"null")}let x;if(E.length===0)x="[]";else if(a==="")x="["+E.join(",")+"]";else{let C=`,
|
|
94
|
+
`+u,_=E.join(C);x=`[
|
|
95
|
+
`+u+_+`,
|
|
96
|
+
`+h+"]"}return r.pop(),u=h,x}};const pa={parse:ua,stringify:da};var _t=pa;const ha=i=>i.charAt(0).toLocaleUpperCase()+i.slice(1),ga=i=>i.split(".").map(ha).join(""),ma=i=>ga(i.parent?i.id.slice(i.parent.length+1):i.id),Da=({autoLayout:i})=>{switch(i.direction){case"TB":return"down";case"BT":return"up";case"LR":return"right";case"RL":return"left"}},Ca=({shape:i})=>{switch(i){case"queue":case"cylinder":case"rectangle":case"person":return i;case"storage":return"stored_data";case"mobile":case"browser":return"rectangle"}};function as(i){const{nodes:e,edges:t}=i,n=new Map,r=(s,o)=>{const a=ma(s),l=(o?o+".":"")+a;n.set(s.id,l);const f=JSON.stringify(s.title),d=Ca(s);return new we().append(a,": {",le).indent({indentedChildren:c=>c.append("label: ",f,le).appendIf(d!=="rectangle","shape: ",d,le).appendIf(s.children.length>0,le,Ue(e.filter(A=>A.parent===s.id),A=>r(A,l))),indentation:2}).append("}",le)},u=s=>new we().append(n.get(s.source)," -> ",n.get(s.target)).append(o=>s.label&&o.append(": ",JSON.stringify(s.label)));return at(new we().append("direction: ",Da(i),le,le).append(Ue(e.filter(s=>Vi(s.parent)),s=>r(s),{appendNewLineIfNotEmpty:!0})).appendIf(t.length>0,le,Ue(t,s=>u(s),{appendNewLineIfNotEmpty:!0})))}const Aa=i=>i.charAt(0).toLocaleUpperCase()+i.slice(1),Ea=i=>i.split(".").map(Aa).join(""),wa=i=>Ea(i.parent?i.id.slice(i.parent.length+1):i.id),ba=({shape:i})=>{switch(i){case"queue":case"cylinder":return["[(",")]"];case"person":return["[fa:fa-user ","]"];case"storage":return["([","])"];case"mobile":case"browser":case"rectangle":return["[","]"]}};function cs(i){const{nodes:e,edges:t}=i,n=new Map,r=(s,o)=>{const a=wa(s),l=(o?o+".":"")+a;n.set(s.id,l);const f=s.title.replaceAll(`
|
|
97
|
+
`,"\\n"),d=ba(s),c=new we;return s.children.length>0?c.append("subgraph ",l,"[",JSON.stringify(s.title),"]",le).indent({indentedChildren:[Ue(e.filter(A=>A.parent===s.id),A=>r(A,l),{appendNewLineIfNotEmpty:!0})],indentation:2}).append("end",le):c.append(l,d[0],f,d[1]),c},u=s=>new we().append(n.get(s.source)," -.",s.label?' "'+s.label.replaceAll(`
|
|
98
|
+
`,"\\n")+'" .-':"-","> ",n.get(s.target));return at(new we().appendIf(i.title!==null&&i.title.length>0,"---",le,`title: ${JSON.stringify(i.title)}`,le,"---",le).append("graph ",i.autoLayout.direction,le).indent({indentedChildren:s=>{s.append(Ue(e.filter(o=>Vi(o.parent)),o=>r(o),{appendNewLineIfNotEmpty:!0})).appendIf(t.length>0,Ue(t,o=>u(o),{appendNewLineIfNotEmpty:!0}))},indentation:2}))}function ya(i){const e=new we;return e.appendTemplate`
|
|
99
99
|
/* prettier-ignore-start */
|
|
100
100
|
/* eslint-disable */
|
|
101
101
|
|
|
@@ -106,7 +106,7 @@ ${e.join(`
|
|
|
106
106
|
|
|
107
107
|
import { LikeC4Model } from 'likec4/model'
|
|
108
108
|
|
|
109
|
-
export const likeC4Model = LikeC4Model.fromDump(${
|
|
109
|
+
export const likeC4Model = LikeC4Model.fromDump(${_t.stringify(i.$model,{space:2,quote:"'"})})
|
|
110
110
|
|
|
111
111
|
export type LikeC4ModelTypes = typeof likeC4Model.Aux
|
|
112
112
|
export type LikeC4ElementId = LikeC4ModelTypes['Fqn']
|
|
@@ -114,7 +114,7 @@ ${e.join(`
|
|
|
114
114
|
export type LikeC4ViewId = LikeC4ModelTypes['ViewId']
|
|
115
115
|
|
|
116
116
|
/* prettier-ignore-end */
|
|
117
|
-
`,
|
|
117
|
+
`,at(e)}function Fa(i){return Ue(i,e=>ot`${_t.stringify(e.id)}`,{separator:" | "})}function _a(i){const e=Array.from(i),t=new we;return t.appendTemplate`
|
|
118
118
|
/******************************************************************************
|
|
119
119
|
* This file was generated
|
|
120
120
|
* DO NOT EDIT MANUALLY!
|
|
@@ -125,10 +125,10 @@ ${e.join(`
|
|
|
125
125
|
// @ts-nocheck
|
|
126
126
|
|
|
127
127
|
import type { DiagramView } from 'likec4'
|
|
128
|
-
`.append(
|
|
129
|
-
export type LikeC4ViewId = ${
|
|
128
|
+
`.append(le,le),e.length===0?(t.append("export {}",le),at(t)):(t.appendTemplate`
|
|
129
|
+
export type LikeC4ViewId = ${Fa(e)};
|
|
130
130
|
export const LikeC4Views = {
|
|
131
|
-
`.indent({indentation:2,indentedChildren(n){n.appendNewLineIf(e.length>1).append(
|
|
131
|
+
`.indent({indentation:2,indentedChildren(n){n.appendNewLineIf(e.length>1).append(Ue(e,r=>ot`${_t.stringify(r.id)}: (${_t.stringify(r)} as unknown) as DiagramView`,{separator:",",appendNewLineIfNotEmpty:!0}))}}).append("} as const satisfies Record<LikeC4ViewId, DiagramView>",le,le).appendTemplate`
|
|
132
132
|
export type LikeC4Views = typeof LikeC4Views
|
|
133
133
|
|
|
134
134
|
export function isLikeC4ViewId(value: unknown): value is LikeC4ViewId {
|
|
@@ -140,8 +140,8 @@ ${e.join(`
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
/* prettier-ignore-end */
|
|
143
|
-
`.append(
|
|
144
|
-
`)+";"}function
|
|
143
|
+
`.append(le),at(t))}function Xt(i){i instanceof Set&&(i=[...i].sort(bu));const e=i.map(t=>` | ${JSON.stringify(t)}`);return e.length===0&&e.push(" never"),e.join(`
|
|
144
|
+
`)+";"}function Sa(i){const{fqns:e,tags:t,kinds:n}=rr([...i.elements()]).reduce((s,o)=>(s.fqns.push(o.id),s.kinds.add(o.kind),s.tags.push(...o.tags),s),{fqns:[],kinds:new Set,tags:[]}),r=rr([...i.deployment.elements()]).map(s=>s.id),{viewIds:u}=[...i.views()].reduce((s,o)=>(s.viewIds.add(o.id),s.tags.push(...o.tags),s.tags.push(...o.includedTags),s),{viewIds:new Set,tags:t});return`
|
|
145
145
|
/* prettier-ignore-start */
|
|
146
146
|
/* eslint-disable */
|
|
147
147
|
|
|
@@ -162,19 +162,19 @@ import type {
|
|
|
162
162
|
} from 'likec4/react'
|
|
163
163
|
|
|
164
164
|
type LikeC4ElementId =
|
|
165
|
-
${
|
|
165
|
+
${Xt(e)}
|
|
166
166
|
|
|
167
167
|
type LikeC4DeploymentId =
|
|
168
|
-
${
|
|
168
|
+
${Xt(r)}
|
|
169
169
|
|
|
170
170
|
type LikeC4ViewId =
|
|
171
|
-
${
|
|
171
|
+
${Xt(u)}
|
|
172
172
|
|
|
173
173
|
type LikeC4ElementKind =
|
|
174
|
-
${
|
|
174
|
+
${Xt(n)}
|
|
175
175
|
|
|
176
176
|
type LikeC4Tag =
|
|
177
|
-
${
|
|
177
|
+
${Xt(new Set(t))}
|
|
178
178
|
|
|
179
179
|
declare function isLikeC4ViewId(value: unknown): value is LikeC4ViewId;
|
|
180
180
|
|
|
@@ -224,7 +224,7 @@ export {
|
|
|
224
224
|
ReactLikeC4
|
|
225
225
|
}
|
|
226
226
|
/* prettier-ignore-end */
|
|
227
|
-
`.trimStart()}function
|
|
227
|
+
`.trimStart()}function va(i){const e=new we;return e.appendTemplate`
|
|
228
228
|
/******************************************************************************
|
|
229
229
|
* This file was generated
|
|
230
230
|
* DO NOT EDIT MANUALLY!
|
|
@@ -233,17 +233,17 @@ export {
|
|
|
233
233
|
|
|
234
234
|
export function d2Source(viewId) {
|
|
235
235
|
switch (viewId) {
|
|
236
|
-
`.appendNewLine().indent({indentation:4,indentedChildren(t){t.append(
|
|
236
|
+
`.appendNewLine().indent({indentation:4,indentedChildren(t){t.append(Ue(i,n=>ot`
|
|
237
237
|
case ${JSON.stringify(n.id)}: {
|
|
238
|
-
return ${JSON.stringify(
|
|
238
|
+
return ${JSON.stringify(as(n))}
|
|
239
239
|
}
|
|
240
240
|
`,{appendNewLineIfNotEmpty:!0})).appendTemplate`
|
|
241
241
|
default: {
|
|
242
242
|
throw new Error('Unknown viewId: ' + viewId)
|
|
243
243
|
}
|
|
244
|
-
`}}).append(
|
|
244
|
+
`}}).append(le," }",le).appendTemplate`
|
|
245
245
|
}
|
|
246
|
-
`.append(
|
|
246
|
+
`.append(le,le),at(e)}function xa(i){const e=new we;return e.appendTemplate`
|
|
247
247
|
/******************************************************************************
|
|
248
248
|
* This file was generated
|
|
249
249
|
* DO NOT EDIT MANUALLY!
|
|
@@ -252,7 +252,7 @@ export {
|
|
|
252
252
|
|
|
253
253
|
export function dotSource(viewId) {
|
|
254
254
|
switch (viewId) {
|
|
255
|
-
`.appendNewLine().indent({indentation:4,indentedChildren(t){t.append(
|
|
255
|
+
`.appendNewLine().indent({indentation:4,indentedChildren(t){t.append(Ue(Object.keys(i),n=>ot`
|
|
256
256
|
case ${JSON.stringify(n)}: {
|
|
257
257
|
return ${JSON.stringify(i[n].dot)}
|
|
258
258
|
}
|
|
@@ -260,12 +260,12 @@ export {
|
|
|
260
260
|
default: {
|
|
261
261
|
throw new Error('Unknown viewId: ' + viewId)
|
|
262
262
|
}
|
|
263
|
-
`}}).append(
|
|
263
|
+
`}}).append(le," }",le).appendTemplate`
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
export function svgSource(viewId) {
|
|
267
267
|
switch (viewId) {
|
|
268
|
-
`.appendNewLine().indent({indentation:4,indentedChildren(t){t.append(
|
|
268
|
+
`.appendNewLine().indent({indentation:4,indentedChildren(t){t.append(Ue(Object.keys(i),n=>ot`
|
|
269
269
|
case ${JSON.stringify(n)}: {
|
|
270
270
|
return ${JSON.stringify(i[n].svg)}
|
|
271
271
|
}
|
|
@@ -273,7 +273,7 @@ export {
|
|
|
273
273
|
default: {
|
|
274
274
|
throw new Error('Unknown viewId: ' + viewId)
|
|
275
275
|
}
|
|
276
|
-
`}}).append(
|
|
276
|
+
`}}).append(le," }",le,"}",le,le),at(e)}function $a(i){const e=Vs(i.flatMap(r=>r.nodes.map(u=>u.icon)),zi(qs),zi(r=>qi(r)&&!r.toLowerCase().startsWith("http")),zs()).sort(),{imports:t,cases:n}=e.reduce((r,u,s)=>{const[o,a]=u.split(":"),l="Icon"+s.toString().padStart(2,"0");return r.imports.push(`import ${l} from 'likec4/icons/${o}/${a}'`),r.cases.push(` '${o}:${a}': ${l}`),r},{imports:[],cases:[]});return`
|
|
277
277
|
${t.join(`
|
|
278
278
|
`)}
|
|
279
279
|
|
|
@@ -295,15 +295,15 @@ if (import.meta.hot) {
|
|
|
295
295
|
}
|
|
296
296
|
})
|
|
297
297
|
}
|
|
298
|
-
`}function
|
|
298
|
+
`}function Ba(i){const{views:e,...t}=i.$model;return`
|
|
299
299
|
import { createLikeC4Model } from 'likec4/model'
|
|
300
300
|
import { nano } from 'likec4/react'
|
|
301
301
|
|
|
302
302
|
// This is needed for better tree shaking
|
|
303
|
-
export const LikeC4Views = ${
|
|
303
|
+
export const LikeC4Views = ${_t.stringify(e)}
|
|
304
304
|
|
|
305
305
|
export const likeC4Model = /* @__PURE__ */ createLikeC4Model(Object.assign(
|
|
306
|
-
${
|
|
306
|
+
${_t.stringify(t)},
|
|
307
307
|
{views: LikeC4Views}
|
|
308
308
|
))
|
|
309
309
|
|
|
@@ -326,7 +326,7 @@ if (import.meta.hot) {
|
|
|
326
326
|
}
|
|
327
327
|
})
|
|
328
328
|
}
|
|
329
|
-
`}function
|
|
329
|
+
`}function Oa(i){const e=new we;return e.appendTemplate`
|
|
330
330
|
/******************************************************************************
|
|
331
331
|
* This file was generated
|
|
332
332
|
* DO NOT EDIT MANUALLY!
|
|
@@ -335,21 +335,21 @@ if (import.meta.hot) {
|
|
|
335
335
|
|
|
336
336
|
export function mmdSource(viewId) {
|
|
337
337
|
switch (viewId) {
|
|
338
|
-
`.appendNewLine().indent({indentation:4,indentedChildren(t){t.append(
|
|
338
|
+
`.appendNewLine().indent({indentation:4,indentedChildren(t){t.append(Ue(i,n=>ot`
|
|
339
339
|
case ${JSON.stringify(n.id)}: {
|
|
340
|
-
return ${JSON.stringify(
|
|
340
|
+
return ${JSON.stringify(cs(n))}
|
|
341
341
|
}
|
|
342
342
|
`,{appendNewLineIfNotEmpty:!0})).appendTemplate`
|
|
343
343
|
default: {
|
|
344
344
|
throw new Error('Unknown viewId: ' + viewId)
|
|
345
345
|
}
|
|
346
|
-
`}}).append(
|
|
346
|
+
`}}).append(le," }",le).appendTemplate`
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
-
`.append(
|
|
349
|
+
`.append(le,le),at(e)}function ls(i){return`
|
|
350
350
|
import { nano } from 'likec4/react'
|
|
351
351
|
|
|
352
|
-
export const $graph = nano.atom(${
|
|
352
|
+
export const $graph = nano.atom(${_t.stringify(i,null,2)})
|
|
353
353
|
|
|
354
354
|
export const useOverviewGraph = () => {
|
|
355
355
|
return nano.useStore($graph)
|
|
@@ -368,7 +368,7 @@ if (import.meta.hot) {
|
|
|
368
368
|
}
|
|
369
369
|
})
|
|
370
370
|
}
|
|
371
|
-
`}function
|
|
371
|
+
`}function Ra(i,e){const{imports:t,cases:n}=i.reduce((r,{id:u},s)=>{const o=ce(e,`${u}.png`);if(!it(o))return r;const a="Png"+s.toString().padStart(2,"0");return r.imports.push(`import ${a} from 'likec4/previews/${u}.png'`),r.cases.push(` ${JSON.stringify(u)}: ${a}`),r},{imports:[],cases:[]});return`
|
|
372
372
|
import { nano } from 'likec4/react'
|
|
373
373
|
// assets dir: ${e}
|
|
374
374
|
|
|
@@ -410,31 +410,33 @@ if (import.meta.hot) {
|
|
|
410
410
|
}
|
|
411
411
|
})
|
|
412
412
|
}
|
|
413
|
-
`}const To={id:"virtual:likec4/dot-sources",virtualId:"\0likec4-plugin/dot-sources.js",async load({likec4:i,logger:e}){e.info(A.dim("generating virtual:likec4/dot-sources"));const t=await i.viewsService.viewsAsGraphvizOut(),n=rs(t,({id:r,svg:s,dot:u})=>[r,{dot:u,svg:s}]);return Lo(n)}},Ro={id:"virtual:likec4/d2-sources",virtualId:"\0likec4-plugin/d2-sources.js",async load({likec4:i,logger:e}){e.info(A.dim("generating virtual:likec4/d2-sources"));const t=await i.viewsService.computedViews();return jo(t)}},Uo={id:"virtual:likec4/mmd-sources",virtualId:"\0likec4-plugin/mmd-sources.js",async load({likec4:i,logger:e}){e.info(A.dim("generating virtual:likec4/mmd-sources"));const t=await i.viewsService.computedViews();return ko(t)}},Wo={id:"virtual:likec4/icons",virtualId:"\0likec4-plugin/icons.js",async load({likec4:i,logger:e}){e.info(A.dim("generating virtual:likec4/icons"));const t=await i.viewsService.computedViews();return Po(t)}},Vo={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(A.dim("generating virtual:likec4/overview-graph"));const n=await i.viewsService.overviewGraph();return Mr(n)}catch(n){e.error(n)}return e.info(A.dim("generating empty virtual:likec4/overview-graph")),Mr({nodes:[],edges:[],bounds:{x:0,y:0,width:10,height:10}})}},Tr={id:"virtual:likec4/previews",virtualId:"\0likec4-plugin/previews.js",async load({likec4:i,logger:e,assetsDir:t}){e.info(A.dim("generating virtual:likec4/previews"));const n=await i.viewsService.computedViews();return Mo(n,t)}},zo={id:"virtual:likec4/model",virtualId:"\0likec4-plugin/model.js",async load({likec4:i,logger:e,assetsDir:t}){e.info(A.dim("generating virtual:likec4/model"));const n=await i.layoutedModel();return No(n)}},di=[Wo,To,Ro,Uo,Vo,Tr,zo],Ho=i=>{const e=i.toLowerCase();return e.endsWith(".c4")||e.endsWith(".likec4")||e.endsWith(".like-c4")};function hi({useOverviewGraph:i=!1,languageServices:e}){let t,n=e.workspace;return{name:"vite-plugin-likec4",configResolved(r){if(t=r.logger,i){const s=r.resolve.alias.find(u=>u.find==="likec4/previews")?.replacement;s?(n=s,t.info(A.dim("likec4/previews alias")+" "+A.dim(n))):t.warn("likec4/previews alias not found")}},resolveId(r){const s=di.find(u=>u.id===r);return s?s.virtualId:null},async load(r){const s=di.find(u=>u.virtualId===r);return s?await s.load({logger:t,likec4:e,assetsDir:n,useOverviewGraph:i}):null},configureServer(r){const s=is(1),u=()=>{s.clearQueue(),s(async()=>{const[h]=e.getErrors();if(h){r.ws.send({type:"error",err:{name:"LikeC4ValidationError",message:"Validation error: "+h.message.slice(0,500),stack:"",plugin:"vite-plugin-likec4",loc:{file:h.sourceFsPath,line:h.range.start.line+1,column:h.range.start.character+1}}});return}for(const l of di){const f=r.moduleGraph.getModuleById(l.virtualId);if(f&&f.importers.size>0){t.info(`${A.green("trigger hmr")} ${A.dim(f.url)}`);try{await r.reloadModule(f)}catch(p){t.error(p)}}}})},a=e.workspace;t.info(`${A.dim("watch")} ${a}`);const c=h=>l=>{Ho(l)&&e.notifyUpdate({[h]:l})};if(r.watcher.add(a).on("add",c("changed")).on("change",c("changed")).on("unlink",c("removed")),i&&!n.startsWith(e.workspace)){t.info(`${A.dim("watch")} ${n}`);const h=()=>{const l=r.moduleGraph.getModuleById(Tr.virtualId);l&&l.importers.size>0&&r.reloadModule(l)};r.watcher.add(n).on("add",h).on("change",h).on("unlink",h)}e.onModelUpdate(()=>{De.debug("likec4 model update"),u()})}}}const pi=async({languageServices:i,likec4AssetsDir:e,...t})=>{const n=t.customLogger??Le("c4:vite"),r=ei(),s=t?.useOverviewGraph===!0;n.info(`${A.cyan("likec4 app root")} ${A.dim(r)}`);const u=t.outputDir??J(i.workspace,"dist");n.info(A.cyan("output")+" "+A.dim(u));let a="/";t.base&&(a=ss(t.base),!us(a)&&a!=="./"&&(a=os(a))),a!=="/"&&n.info(`${A.green("app base url")} ${A.dim(a)}`);const c=t.webcomponentPrefix??"likec4";return{isDev:!1,likec4AssetsDir:e,webcomponentPrefix:c,root:r,languageServices:i,clearScreen:!1,base:a,resolve:{conditions:["production"],dedupe:["react","react-dom","react/jsx-runtime","react/jsx-dev-runtime","react-dom/client"],alias:{...yr(),"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(c),__USE_STYLE_BUNDLE__:"false",__USE_OVERVIEW_GRAPH__:s?"true":"false",__USE_HASH_HISTORY__:t?.useHashHistory===!0?"true":"false","process.env.NODE_ENV":'"production"'},build:{outDir:u,modulePreload:!1,emptyOutDir:!1,cssCodeSplit:!1,sourcemap:!1,cssMinify:!0,minify:!0,copyPublicDir:!0,chunkSizeWarningLimit:ni,rollupOptions:{treeshake:{preset:"recommended"},output:{hoistTransitiveImports:!1,compact:!0}}},customLogger:n,plugins:[xi(),hi({languageServices:i,useOverviewGraph:s})]}};async function mi({languageServices:i,outDir:e,base:t,webcomponentPrefix:n="likec4",filename:r="likec4-views.js"}){const s=Le("c4:lib"),u=ei();return s.info(A.cyan("outDir")+" "+A.dim(e)),{root:u,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:{...Zn},build:{outDir:e,emptyOutDir:!1,sourcemap:!1,minify:!0,assetsInlineLimit:100*1024,chunkSizeWarningLimit:ni,lib:{entry:"webcomponent/webcomponent.js",fileName(a,c){return r},formats:["iife"],name:"LikeC4Views"},commonjsOptions:{defaultIsModuleExports:a=>a.includes("react")?!0:"auto",requireReturnsDefault:"auto"},rollupOptions:{treeshake:{preset:"recommended"},output:{format:"iife",hoistTransitiveImports:!1,compact:!0}}},customLogger:s,plugins:[hi({languageServices:i,useOverviewGraph:!1})]}}const Go=["favicon.ico","robots.txt"],Yo=async({buildWebcomponent:i=!0,webcomponentPrefix:e="likec4",languageServices:t,likec4AssetsDir:n,...r})=>{n??=await Zt(xt(en(),".likec4-assets-"));const{isDev:s,...u}=await pi({...r,languageServices:t,likec4AssetsDir:n,webcomponentPrefix:e}),a=await ti();for(const l of Go){const f=J(u.root,l);Ke(f)&&_i(f,J(a,l))}const c=await t.diagrams();if(c.length===0)throw process.exitCode=1,new Error("no views found");if(c.forEach(l=>{l.hasLayoutDrift&&u.customLogger.warn(A.yellow("drift detected, manual layout can not be applied, view:")+" "+A.red(l.id))}),i){const l=await mi({webcomponentPrefix:e,languageServices:t,outDir:a,base:u.base});await jt(l)}await jt({...u,publicDir:a,mode:"production"});const h=J(u.build.outDir,"index.html");Ke(h)&&_i(h,J(u.build.outDir,"404.html"))};function Rr(i){if(i.resolvedUrls)return bi(i.resolvedUrls.network)??bi(i.resolvedUrls.local)}function Ur(i){if(!i.resolvedUrls)throw new Error("Vite server is not ready, no resolvedUrls");De.box([A.green("LikeC4 served at:"),"",A.dim("Local: ")+i.resolvedUrls.local.join(`
|
|
414
|
-
`+"".padEnd(9," ")),A.dim("Network: ")+i.resolvedUrls.network.join(`
|
|
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
|
+
`,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
|
+
`);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
|
+
`+"".padEnd(9," ")),O.dim("Network: ")+i.resolvedUrls.network.join(`
|
|
415
417
|
`+"".padEnd(9," "))].join(`
|
|
416
|
-
`))}class
|
|
417
|
-
`+w)),
|
|
418
|
-
`),await
|
|
419
|
-
${
|
|
420
|
-
${
|
|
421
|
-
|
|
422
|
-
${
|
|
423
|
-
${
|
|
424
|
-
`).trim(),style:{padding:2,borderColor:"green",borderStyle:"rounded"}}),r.stopAndLog()}async function
|
|
425
|
-
`+
|
|
426
|
-
${
|
|
427
|
-
${
|
|
428
|
-
|
|
429
|
-
${
|
|
430
|
-
${
|
|
431
|
-
`).trim(),style:{padding:2,borderColor:"green",borderStyle:"rounded"}}),r.stopAndLog()}async function
|
|
432
|
-
${
|
|
433
|
-
${
|
|
434
|
-
|
|
435
|
-
${
|
|
436
|
-
${
|
|
437
|
-
`)),
|
|
418
|
+
`))}class Is extends Error{constructor(e){super(`${e} is locked`)}}const Rt={old:new Set,young:new Set},lc=1e3*15,vn=1024,xn=65535;let Zt;const fc=()=>{const i=wu.networkInterfaces(),e=new Set([void 0,"0.0.0.0"]);for(const t of Object.values(i))for(const n of t)e.add(n.address);return e},Ls=i=>new Promise((e,t)=>{const n=Su.createServer();n.unref(),n.on("error",t),n.listen(i,()=>{const{port:r}=n.address();n.close(()=>{e(r)})})}),Ns=async(i,e)=>{if(i.host||i.port===0)return Ls(i);for(const t of e)try{await Ls({port:i.port,host:t})}catch(n){if(!["EADDRNOTAVAIL","EINVAL"].includes(n.code))throw n}return i.port},dc=function*(i){i&&(yield*i),yield 0};async function Ui(i){let e,t=new Set;if(i&&(i.port&&(e=typeof i.port=="number"?[i.port]:i.port),i.exclude)){const r=i.exclude;if(typeof r[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(const u of r){if(typeof u!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(u))throw new TypeError(`Number ${u} in the exclude option is not a safe integer and can't be used`)}t=new Set(r)}Zt===void 0&&(Zt=setTimeout(()=>{Zt=void 0,Rt.old=Rt.young,Rt.young=new Set},lc),Zt.unref&&Zt.unref());const n=fc();for(const r of dc(e))try{if(t.has(r))continue;let u=await Ns({...i,port:r},n);for(;Rt.old.has(u)||Rt.young.has(u);){if(r!==0)throw new Is(r);u=await Ns({...i,port:r},n)}return Rt.young.add(u),u}catch(u){if(!["EADDRINUSE","EACCES"].includes(u.code)&&!(u instanceof Is))throw u}throw new Error("No available ports found")}function $n(i,e){if(!Number.isInteger(i)||!Number.isInteger(e))throw new TypeError("`from` and `to` must be integer numbers");if(i<vn||i>xn)throw new RangeError(`'from' must be between ${vn} and ${xn}`);if(e<vn||e>xn)throw new RangeError(`'to' must be between ${vn} and ${xn}`);if(i>e)throw new RangeError("`to` must be greater than or equal to `from`");return function*(n,r){for(let u=n;u<=r;u++)yield u}(i,e)}async function Ps({buildWebcomponent:i=!0,hmr:e=!0,webcomponentPrefix:t="likec4",languageServices:n,likec4AssetsDir:r,openBrowser:u,...s}){r??=await nn(Lt(rn(),".likec4-assets-"));const{isDev:o,...a}=await ki({...s,languageServices:n,likec4AssetsDir:r,webcomponentPrefix:t}),l=await Ui({port:[5173,...$n(61e3,61010),...$n(62002,62010)]}),f=await Ui({port:$n(24678,24690)}),d=await ai();let c;if(i){const F=await Hi({webcomponentPrefix:t,languageServices:n,outDir:d,base:a.base});c=Pt({...F,logLevel:"warn"}).catch(w=>(Be.warn("webcomponent build failed",w),Be.warn("Ignoring error and continuing"),Promise.resolve()))}const A=await Fu({...a,define:Object.assign({},a.define,e&&{"process.env.NODE_ENV":'"development"'}),mode:e?"development":a.mode,publicDir:d,server:{host:"0.0.0.0",port:l,hmr:e&&{overlay:!0,port:f},fs:{strict:!1},open:u??!o}});return await A.listen(),c&&await c,A}async function pc({browserContext:i,views:e,output:t,logger:n,timeout:r,maxAttempts:u,outputType:s,theme:o}){let a;const l=e.map(c=>({view:c,attempt:1})),f=[];let d;for(;d=l.shift();){const{view:c,attempt:A}=d,F=`/export/${encodeURIComponent(c.id)}`;try{if(A>1){a&&(a.close({runBeforeUnload:!0}).catch(C=>n.error(`failed to close page: ${C}`)),a=void 0);const x=Yi(A*200,{min:200,max:1e3});n.info(O.cyan(F)+O.dim(` attempt ${A} of ${u} after ${x}ms`)),await vu(x)}else c.hasLayoutDrift&&n.warn(O.yellow("Drift detected, manual layout can not be applied, view may be invalid: ")+O.red(c.id)),n.info(O.cyan(F));a??=await i.newPage(),await a.setViewportSize({width:c.bounds.width+20*2,height:c.bounds.height+20*2}),await a.goto(F+`?padding=20&theme=${o}`);const w=a.getByRole("presentation");await w.waitFor(),c.nodes.some(x=>qi(x.icon)&&x.icon.toLowerCase().startsWith("http"))&&await hc(a,r);let h=".";s==="relative"&&(h=c.relativePath??".",h.includes("/")?h=h.slice(0,h.lastIndexOf("/")):h=".");const E=ce(t,h,`${c.id}.png`);await w.screenshot({path:E,omitBackground:!0}),f.push({view:c,path:E})}catch(w){a?.close({runBeforeUnload:!0}).catch(h=>n.error(`failed to close page: ${h}`)),n.error(O.red("failed "+F+`
|
|
419
|
+
`+w)),A<u&&(l.push({view:c,attempt:A+1}),n.info(O.dim(`retry ${F}`))),a=void 0}}return f}async function hc(i,e){let t=await i.locator("//img").all();if(!t.length)return;const n=t.map(r=>r.evaluate(u=>u.complete||new Promise((s,o)=>{u.onload=s,u.onerror=o}),{timeout:Math.max(3e4,e)}));await Promise.allSettled(n)}async function js({logger:i,serverUrl:e,theme:t="light",timeoutMs:n=15e3,views:r,output:u,outputType:s="relative",maxAttempts:o=3}){i.info(`${O.cyan("export output")} ${O.dim(u)}`),i.info(`${O.cyan("from server")} ${O.dim(e)}`);const a=or.executablePath();i.info(O.cyan("Start chromium")),i.info(O.dim(a));const l=await or.launch();i.info(O.cyan("Color scheme: ")+t);const f=await l.newContext({deviceScaleFactor:2,colorScheme:t,baseURL:e,ignoreHTTPSErrors:!0,reducedMotion:"reduce",isMobile:!1});f.setDefaultNavigationTimeout(n),f.setDefaultTimeout(n);try{return await pc({browserContext:f,views:r,output:u,outputType:s,logger:i,maxAttempts:o,timeout:n,theme:t})}finally{i.info(O.cyan("close chromium")),await f.close(),await l.close()}}async function Ts({path:i,useDotBin:e,theme:t="light",output:n,outputType:r,serverUrl:u,ignore:s=!1,timeoutMs:o=1e4,maxAttempts:a=3}){const l=We("c4:export"),f=iu(),d=await Qe.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"});n??=d.workspace;const c=await d.diagrams();if(!yu(c,1))throw l.warn("no views found"),new Error("no views found");let A;if(!u&&(l.info(O.cyan("start preview server")),A=await Ps({languageServices:d,buildWebcomponent:!1,openBrowser:!1,useOverviewGraph:!1,hmr:!1}),u=Os(A),!u))throw l.error("Vite server is not ready, no resolvedUrls"),new Error("Vite server is not ready, no resolvedUrls");try{const F=await js({logger:l,serverUrl:u,theme:t,timeoutMs:o,views:c,output:n,outputType:r,maxAttempts:a}),{pretty:w}=eu(f);if(F.length>0&&l.info(O.green(`exported ${F.length} views in ${w}`)),F.length!==c.length&&(s&&F.length>0?l.info(O.dim("ignore")+" "+O.red(`failed ${c.length-F.length} out of ${c.length} views`)):l.error(O.red(`failed ${c.length-F.length} out of ${c.length} views`))),F.length!==c.length&&(F.length===0||!s))throw new Error(`Failed ${c.length-F.length} out of ${c.length} views`)}finally{A&&(l.info(O.cyan("stop server")),await A.close().catch(F=>{l.error(F)}))}}const{cyan:Ms,dim:ks}=O;async function gc({path:i,useDotBin:e,useHashHistory:t,webcomponentPrefix:n,useOverview:r=!1,output:u,outputSingleFile:s,base:o}){const a=We("c4:build"),l=await Qe.fromWorkspace(i,{graphviz:e?"binary":"wasm",logger:"vite"}),f=u??ce(l.workspace,"dist");let d=ce(f,"assets");if(r)try{d=ce(f,"assets","previews"),await Xe(d,{recursive:!0}),a.info(`${Ms("Generate previews")} ${ks(d)}
|
|
420
|
+
`),await Ts({path:i,useDotBin:e,output:d,outputType:"flat",ignore:!0})}catch(c){a.error(O.red("Failed to generate previews")),a.error(c),a.warn(O.yellow("Ignore previews and continue build")),Tn(d,{recursive:!0,force:!0}),r=!1}await cc({base:o,useHashHistory:s||t,customLogger:a,useOverviewGraph:r,webcomponentPrefix:n,languageServices:l,likec4AssetsDir:d,outputDir:u,outputSingleFile:s}),r&&(a.info(`${Ms("clean previews")} ${ks(d)}`),Tn(d,{recursive:!0,force:!0}))}const mc={command:"build [path]",aliases:["bundle"],describe:"Build a static website",builder:i=>i.positional("path",Cn).option("output",{alias:"o",type:"string",desc:"output directory for production build",normalize:!0,coerce:ce}).option("base",zr).option("use-hash-history",Vr).option("use-dot",qe).option("webcomponent-prefix",si).option("use-overview",qr).option("output-single-file",Bo).example(`${O.green("$0 build -o ./build ./src")}`,O.gray("Search for likec4 files in 'src' and output static site to 'build'")),handler:async i=>{await gc({path:i.path,output:i.output,base:i.base,useHashHistory:i["use-hash-history"],useDotBin:i["use-dot"],useOverview:i["use-overview"]??!1,webcomponentPrefix:i["webcomponent-prefix"],outputSingleFile:i["output-single-file"]??!1})}};async function Dc(i,e,t){const n=".ts";e=e??ce(i.workspace,"likec4.generated"+n),Nt(e)!==n&&(e=e+n),await Xe(lt(e),{recursive:!0});const r=await i.diagrams(),u=_a([...r]);await dt(e,u),t.info(`${O.dim("generated")} ${ft(process.cwd(),e)}`)}async function Cc(i,e,t){await Xe(e,{recursive:!0}),t.info(`${O.dim("format")} ${O.green("dot")}`),t.info(`${O.dim("outdir")} ${e}`);const n=new Set,r=await i.viewsService.layoutAllViews();let u=0;for(const{diagram:s,dot:o}of r)try{const a=s.relativePath??"";a!==""&&!n.has(a)&&(await Xe(ce(e,a),{recursive:!0}),n.add(a));const l=ce(e,a,s.id+".dot");kn(o,`dot for ${s.id} not found`),await dt(l,o),t.info(`${O.dim("generated")} ${ft(process.cwd(),l)}`),u++}catch(a){t.error(`error while generating ${s.id}`,{error:a})}u>0&&t.info(`${O.dim("total")} ${u} files`)}async function Ac(i,e,t,n){await Xe(t,{recursive:!0}),n.info(`${O.dim("format")} ${O.green(e)}`),n.info(`${O.dim("outdir")} ${t}`);let r,u;switch(e){case"d2":r=".d2",u=as;break;case"mermaid":r=".mmd",u=cs;break;default:sr(e)}const s=new Set,o=await i.diagrams();let a=0;for(const l of o)try{let f=l.relativePath??".";f.includes("/")?f=f.slice(0,f.lastIndexOf("/")):f=".",f!==""&&!s.has(f)&&(await Xe(ce(t,f),{recursive:!0}),s.add(f));const d=ce(t,f,l.id+r),c=u(l);await dt(d,c),n.info(`${O.dim("generated")} ${ft(process.cwd(),d)}`),a++}catch(f){n.error(`error while generating ${l.id}`,{error:f})}a>0&&n.info(`${O.dim("total")} ${a} files`)}async function Bn({path:i,useDotBin:e,...t}){const n=We("c4:codegen"),r=It(n),u=await Qe.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"});if((await u.viewsService.computedViews()).length===0)throw n.warn("no views found"),process.exitCode=1,new Error("no views found");switch(t.format){case"views":{await Dc(u,t.outfile,n);break}case"dot":{await Cc(u,t.outdir??i,n);break}case"d2":case"mermaid":{await Ac(u,t.format,t.outdir??i,n);break}default:sr(t)}r.stopAndLog()}async function Ec({path:i,useDotBin:e,outfile:t}){const n=We("c4:codegen"),r=It(n),u=await Qe.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"});n.info(`${O.dim("format")} ${O.green("model")}`);const s=await u.layoutedModel();for(const d of s.views())d.$view.hasLayoutDrift&&n.warn(O.yellow("drift detected, manual layout can not be applied, view:")+" "+O.red(d.id));let o=ce(u.workspace,"likec4-model.ts");if(t&&(o=jn(t)?t:ce(t),it(t)&&(await Mn(t)).isDirectory()))throw new Error(`output file is a directory: ${t}`);const a=tn(o);n.info(`${O.dim("filename")} ${a}`);const l=Nt(a).toLocaleLowerCase();if(![".ts",".mts",".cts"].includes(l))throw n.error(`output file ${t} has extension "${l}"`),new Error(`output file ${t} must be a .ts, .mts or .cts file`);const f=lt(o);n.info(`${O.dim("outdir")} ${f}`),await Xe(f,{recursive:!0}),await dt(o,ya(s),{encoding:"utf-8"}),Be.box({message:Rn(`
|
|
421
|
+
${O.dim("Source with LikeC4Model generated:")}
|
|
422
|
+
${ft(In(),o)}
|
|
423
|
+
|
|
424
|
+
${O.dim("How to use:")}
|
|
425
|
+
${O.underline("https://likec4.dev/tooling/code-generation/model/")}
|
|
426
|
+
`).trim(),style:{padding:2,borderColor:"green",borderStyle:"rounded"}}),r.stopAndLog()}async function wc({languageServices:i,outDir:e,filename:t="likec4-react.mjs"}){const n=We("c4:react"),r=oi();return n.info(`${O.cyan("likec4 app root")} ${O.dim(r)}`),n.info(O.cyan("outDir")+" "+O.dim(e)),{customLogger:n,root:r,configFile:!1,clearScreen:!1,publicDir:!1,mode:"production",resolve:{conditions:["production"],alias:Jr()},esbuild:{banner:`'use client'
|
|
427
|
+
`+ui.banner,footer:ui.footer,jsx:"transform",jsxDev:!1,jsxSideEffects:!1,minifyIdentifiers:!1,minifySyntax:!1,minifyWhitespace:!1,tsconfigRaw:{compilerOptions:{target:"ES2022",useDefineForClassFields:!0,verbatimModuleSyntax:!0,jsx:"react-jsx"}}},build:{outDir:e,emptyOutDir:!1,sourcemap:!1,minify:!1,target:"es2022",copyPublicDir:!1,chunkSizeWarningLimit:ci,lib:{entry:"react/likec4.tsx",fileName(u,s){return t},formats:["es"]},rollupOptions:{output:{compact:!1,exports:"named"},external:["likec4/react","likec4/model","react","react-dom","react/jsx-runtime","react/jsx-dev-runtime","react-dom/client",/likec4\/icons\/.*/],onwarn(u,s){u.code!=="SOURCEMAP_ERROR"&&s(u)}}},plugins:[ir({}),Ei({languageServices:i,useOverviewGraph:!1})]}}async function bc({path:i,useDotBin:e,outfile:t}){const n=We("c4:codegen"),r=It(n),u=await Qe.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"});n.info(`${O.dim("format")} ${O.green("react")}`);const s=await u.diagrams();if(s.length===0)throw process.exitCode=1,new Error("no views found");s.forEach(A=>{A.hasLayoutDrift&&n.warn(O.yellow("drift detected, manual layout can not be applied, view:")+" "+O.red(A.id))});let o=ce(u.workspace,"likec4-views.js");if(t&&(o=jn(t)?t:ce(t),it(t)&&(await Mn(t)).isDirectory()))throw new Error(`output file is a directory: ${t}`);const a=lt(o);n.info(`${O.dim("outdir")} ${a}`);const l=tn(o);n.info(`${O.dim("filename")} ${l}`);const f=Nt(l).toLocaleLowerCase();if(![".js",".mjs",".jsx"].includes(f))throw n.error(`output file ${t} has extension "${f}"`),new Error(`output file ${t} must be a .js, .jsx or .mjs`);const d=await wc({languageServices:u,outDir:a,filename:l});await Pt({...d,logLevel:"warn"});const c=await u.layoutedModel();await dt(ce(a,tn(o,f)+(f===".mjs"?".d.mts":".d.ts")),Sa(c)),Be.box({message:Rn(`
|
|
428
|
+
${O.dim("Source generated:")}
|
|
429
|
+
${ft(In(),o)}
|
|
430
|
+
|
|
431
|
+
${O.dim("How to use:")}
|
|
432
|
+
${O.underline("https://likec4.dev/tooling/code-generation/react/")}
|
|
433
|
+
`).trim(),style:{padding:2,borderColor:"green",borderStyle:"rounded"}}),r.stopAndLog()}async function yc({path:i,useDotBin:e,webcomponentPrefix:t="likec4",outfile:n}){const r=We("c4:codegen"),u=It(r),s=await Qe.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"});r.info(`${O.dim("format")} ${O.green("webcomponent")}`);const o=await s.diagrams();if(!Ji(o,1))throw r.warn("no views found"),process.exitCode=1,new Error("no views found");o.forEach(F=>{F.hasLayoutDrift&&r.warn(O.yellow("drift detected, manual layout can not be applied, view:")+" "+O.red(F.id))});let a=ce(s.workspace,"likec4-views.js");if(n&&(a=jn(n)?n:ce(n),it(n)&&(await Mn(n)).isDirectory()))throw new Error(`output file is a directory: ${n}`);Be.debug(`${O.dim("outfilepath")} ${a}`);const l=tn(a);Be.debug(`${O.dim("filename")} ${l}`);const f=Nt(l).toLocaleLowerCase();if(f!==".js"&&f!==".mjs")throw Be.warn(`output file ${n} has extension "${f}"`),new Error(`output file ${n} must be a .js or .mjs`);const d=await ai();Be.debug(`${O.dim("created temp public")} ${d}`);const c=await Hi({languageServices:s,outDir:d,filename:l,webcomponentPrefix:t,base:"/"});Be.debug(`${O.dim("vite build webcomponent")}`),await Pt({...c,logLevel:"warn"});const A=ce(d,l);if(!it(A))throw new Error(`output file not found: ${A}`);await Xe(lt(a),{recursive:!0}),await Au(A,a),r.info(`${O.dim("generated")} ${a}`),Be.debug(`${O.dim("remove temp public")}`),await Eu(d,{recursive:!0,force:!0}),Be.box(Rn(`
|
|
434
|
+
${O.dim("Webcomponents generated to:")}
|
|
435
|
+
${ft(In(),a)}
|
|
436
|
+
|
|
437
|
+
${O.dim("Setup and usage instructions:")}
|
|
438
|
+
${O.blue("https://likec4.dev/tooling/code-generation/webcomponent/")}
|
|
439
|
+
`)),u.stopAndLog()}const Fc={command:"codegen <command> [path]",aliases:["generate","gen"],describe:"Generate various artifacts from LikeC4 sources",builder:i=>i.positional("path",Cn).command("react [path]","generate react component to render likec4 view",e=>e.option("outfile",{alias:"o",type:"string",desc:"<file> path to output file (.jsx, .mjs or .js)",normalize:!0,coerce:je}).option("use-dot",qe),async e=>{await bc({useDotBin:e.useDotBin,path:e.path,outfile:e.outfile})}).command({command:"webcomponent [path]",aliases:["wc","webcomp"],describe:"generate js with webcomponents",builder:e=>e.option("outfile",{alias:"o",type:"string",desc:"<file> path to output file (.mjs or .js)",normalize:!0,coerce:je}).option("webcomponent-prefix",si).option("use-dot",qe),handler:async e=>{await yc({useDotBin:e.useDotBin,path:e.path,outfile:e.outfile,webcomponentPrefix:e.webcomponentPrefix})}}).command({command:"model [path]",aliases:["ts"],describe:"generate LikeC4Model (.ts)",builder:e=>e.option("outfile",{alias:"o",type:"string",desc:"<file> path to output file (.ts)",normalize:!0,coerce:je}).option("use-dot",qe),handler:async e=>{await Ec({path:e.path,useDotBin:e.useDotBin,outfile:e.outfile})}}).command({command:"views-data [path]",aliases:["views"],describe:"generate likec4 views data (.ts)",builder:e=>e.option("outfile",{alias:"o",type:"string",desc:"<file> output .ts file",normalize:!0,coerce:je}).option("use-dot",qe),handler:async e=>{await Bn({format:"views",path:e.path,useDotBin:e.useDotBin,outfile:e.outfile})}}).command({command:"dot [path]",describe:"generate graphviz files (.dot)",builder:e=>e.option("outdir",An).option("use-dot",qe),handler:async e=>{await Bn({format:"dot",path:e.path,useDotBin:e.useDotBin,outdir:e.outdir})}}).command({command:"d2 [path]",describe:"generate D2 files (.d2)",builder:e=>e.option("outdir",An).option("use-dot",qe),handler:async e=>{await Bn({format:"d2",path:e.path,useDotBin:e.useDotBin,outdir:e.outdir})}}).command({command:"mermaid [path]",aliases:["mmd"],describe:"generate Mermaid files (.mmd)",builder:e=>e.option("outdir",An).option("use-dot",qe),handler:async e=>{await Bn({format:"mermaid",useDotBin:e.useDotBin,path:e.path,outdir:e.outdir})}}).epilog(`${O.bold("Examples:")}
|
|
438
440
|
likec4 gen react -o dist/likec4-views.mjs ./src/likec4
|
|
439
441
|
likec4 gen model -o likec4-model.ts
|
|
440
442
|
likec4 gen webcomponent -o likec4.js --webcomponent-prefix c4 --use-dot-bin ./src
|
|
@@ -442,17 +444,17 @@ if (import.meta.hot) {
|
|
|
442
444
|
likec4 gen ts --outfile ../likec4.ts
|
|
443
445
|
likec4 gen mmd --outdir assets/
|
|
444
446
|
likec4 gen dot -o out .
|
|
445
|
-
`),handler:()=>{}};async function
|
|
446
|
-
${
|
|
447
|
-
${
|
|
448
|
-
|
|
449
|
-
${
|
|
450
|
-
${
|
|
451
|
-
`),handler:async e=>{
|
|
452
|
-
${
|
|
453
|
-
${
|
|
454
|
-
|
|
455
|
-
${
|
|
456
|
-
${
|
|
457
|
-
`),handler:async e=>{await
|
|
458
|
-
if not specified search in current directory`,normalize:!0}).options({output:{alias:"o",type:"string",desc:"output directory from production build",normalize:!0},base:{type:"string",desc:"base url the app is being served from"}}).coerce(["path","output"],
|
|
447
|
+
`),handler:()=>{}};async function _c({path:i,useDotBin:e,outfile:t}){const n=We("c4:export"),r=It(n),u=await(await Qe.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"})).layoutedModel();Nt(t)!==".json"&&(t=t+".json"),await Xe(lt(t),{recursive:!0});const s=JSON.stringify(u.$model,null,2);await dt(t,s),n.info(`${O.dim("generated")} ${ft(process.cwd(),t)}`),r.stopAndLog("\u2713 export in ")}const Sc={command:"export <format> [path]",describe:"Export to images or JSON",builder:i=>i.usage(`${O.bold("Usage:")} $0 export <format> [path]`).positional("path",Cn).command({command:"png [path]",describe:"export views to PNG",builder:e=>e.option("output",An).option("theme",{choices:["light","dark"],desc:"color-scheme to use, default is light"}).option("flat",{boolean:!0,type:"boolean",desc:"ignore sources structure and export all PNGs in output directory"}).option("use-dot",qe).options({ignore:{boolean:!0,alias:"i",desc:"continue if some views failed to export"},timeout:{type:"number",alias:"t",desc:"(sec) timeout for playwright ",default:10},"max-attempts":{type:"number",describe:"",desc:"(number) max attempts to export failing view",default:3},"server-url":{type:"string",desc:"use this url instead of starting new likec4 server"}}).epilog(`${O.bold("Examples:")}
|
|
448
|
+
${O.green("$0 export png")}
|
|
449
|
+
${O.gray("Search for likec4 files in current directory and output PNG next to sources")}
|
|
450
|
+
|
|
451
|
+
${O.green("$0 export png --theme dark -o ./png src/likec4 ")}
|
|
452
|
+
${O.gray("Search for likec4 files in src/likec4 and output PNG with dark theme to png folder")}
|
|
453
|
+
`),handler:async e=>{kn(e.timeout>=1,"timeout must be >= 1"),kn(e["max-attempts"]>=1,"max-attempts must be >= 1"),await Ts({path:e.path,useDotBin:e.useDotBin,output:e.output,timeoutMs:e.timeout*1e3,maxAttempts:e.maxAttempts,ignore:e.ignore===!0,outputType:e.flat?"flat":"relative",serverUrl:e.serverUrl,theme:e.theme??"light"})}}).command({command:"json [path]",describe:"export model to JSON",builder:e=>e.option("outfile",{alias:"o",type:"string",desc:"<file> output .json file",default:"likec4.json",normalize:!0,coerce:ce}).option("use-dot",qe).epilog(`${O.bold("Examples:")}
|
|
454
|
+
${O.green("$0 export json")}
|
|
455
|
+
${O.gray("Search for likec4 files in current directory and output JSON to likec4.json")}
|
|
456
|
+
|
|
457
|
+
${O.green("$0 export json -o ./generated/likec4.json src/likec4 ")}
|
|
458
|
+
${O.gray("Search for likec4 files in src/likec4 and output JSON to generated/likec4.json")}
|
|
459
|
+
`),handler:async e=>{await _c({path:e.path,useDotBin:e.useDotBin,outfile:e.outfile})}}).updateStrings({"Commands:":O.bold("Formats:")}),handler:()=>{}};async function vc(i){const{isDev:e,...t}=await ki({...i,likec4AssetsDir:"",webcomponentPrefix:void 0}),n=await Ui({port:$n(62001,62010)}),r=i?.open??!1;return await _u({...t,mode:"production",preview:{host:"0.0.0.0",port:n,open:r}})}async function xc({path:i,output:e,base:t}){const n=await Qe.fromWorkspace(i,{logger:"vite"}),r=await vc({base:t,languageServices:n,outputDir:e,open:!0});Rs(r)}const $c={command:"preview [path]",describe:"Start local server to preview production build",builder:i=>i.positional("path",{type:"string",desc:`Directory with LikeC4 source files
|
|
460
|
+
if not specified search in current directory`,normalize:!0}).options({output:{alias:"o",type:"string",desc:"output directory from production build",normalize:!0},base:{type:"string",desc:"base url the app is being served from"}}).coerce(["path","output"],je).default("path",je("."),"."),async handler(i){await xc(i)}};async function Bc({path:i,useDotBin:e,webcomponentPrefix:t,useHashHistory:n,useOverview:r=!1,base:u}){const s=await Qe.fromWorkspace(i,{logger:"vite",graphviz:e?"binary":"wasm"}),o=await nn(Lt(rn(),".likec4-assets-"));process.env.NODE_ENV="development";const a=await Ps({buildWebcomponent:!0,hmr:!0,base:u,webcomponentPrefix:t,languageServices:s,useHashHistory:n,useOverviewGraph:r,likec4AssetsDir:o});if(a.config.logger.clearScreen("info"),Rs(a),!r)return;const l=await s.diagrams();if(Ji(l,1)){const f=We("c4:export"),d=Os(a);if(!d){f.error("no preview server url");return}f.info(O.cyan("wait 5sec before generating previews")),await ur(5e3);try{await js({serverUrl:d,logger:f,views:l,theme:"light",output:o,outputType:"flat"}),await ur(1e3),f.info(O.yellow("Note: changes in sources do not trigger preview updates, restart is required"))}catch(c){f.error(O.red("Failed to generate previews")),f.error(c)}}else a.config.logger.warn("no views found, no previews generated")}const Oc={command:"start [path]",aliases:["serve","dev"],describe:"Start local dev server to preview LikeC4 views",builder:i=>i.positional("path",Cn).option("base",zr).option("webcomponent-prefix",si).option("use-hash-history",Vr).option("use-overview",qr).option("use-dot",qe),handler:async i=>{await Bc({path:i.path,useDotBin:i["use-dot"],base:i.base,useOverview:i["use-overview"]??!1,webcomponentPrefix:i["webcomponent-prefix"],useHashHistory:i["use-hash-history"]})}};Be.level=tu.debug,Be.wrapConsole();const Rc=$o(qu(uu)).scriptName("likec4").usage("Usage: $0 <command>").command(Oc).command(mc).command(Fc).command(Sc).command($c).help("help").version(nu).alias("v","version").alias("h","help").demandCommand(1,"Please run with valid command").strict().recommendCommands().showHelpOnFail(!0,"Something is wrong, run with --help").updateStrings({"Options:":O.bold("Options:"),"Positionals:":O.bold("Arguments:"),"Commands:":O.bold("Commands:"),"Examples:":O.bold("Examples:")}).wrap(Yi(ru.columns-20,{min:80,max:120})).parseAsync();Rc.catch(()=>su(1)),process.on("unhandledRejection",i=>{Be.error(i)});
|