@seeka-labs/cli-apps 1.1.38 → 2.0.7-rc.1

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.
Files changed (95) hide show
  1. package/dist/index.js +31 -36
  2. package/dist/index.js.map +4 -4
  3. package/dist/init-template/.gitlab-ci.yml +47 -0
  4. package/dist/init-template/.yarnrc.yml +8 -0
  5. package/dist/init-template/README.md +7 -0
  6. package/dist/{init-templates → init-template/app}/browser/jest.config.js +11 -11
  7. package/dist/{init-templates → init-template/app}/browser/package.json +16 -12
  8. package/dist/{init-templates → init-template/app}/browser/scripts/esbuild/build-browser-plugin.mjs +110 -110
  9. package/dist/{init-templates → init-template/app}/browser/scripts/esbuild/plugins/importAsGlobals.mjs +38 -38
  10. package/dist/{init-templates → init-template/app}/browser/src/browser.ts +12 -12
  11. package/dist/{init-templates → init-template/app}/browser/src/plugin/index.test.ts +6 -6
  12. package/dist/{init-templates → init-template/app}/browser/src/plugin/index.ts +47 -49
  13. package/dist/{init-templates → init-template/app}/browser/tsconfig.json +34 -34
  14. package/dist/{init-templates/netlify-function → init-template/app/server-azure-function}/.eslintrc.cjs +2 -10
  15. package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/.funcignore +12 -7
  16. package/dist/init-template/app/server-azure-function/.nvmrc +1 -0
  17. package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/README.md +104 -107
  18. package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/host.json +1 -10
  19. package/dist/init-template/app/server-azure-function/package.json +52 -0
  20. package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/src/functions/seekaAppWebhook.ts +235 -236
  21. package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/src/lib/browser/index.ts +54 -54
  22. package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/src/lib/jobs/index.ts +1 -1
  23. package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/src/lib/logging/index.ts +92 -92
  24. package/dist/{init-templates/azure-function/src/lib/browser → init-template/app/server-azure-function/src/lib}/models/index.ts +6 -6
  25. package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/src/lib/state/redis/index.ts +96 -65
  26. package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/src/lib/state/seeka/installations.ts +64 -66
  27. package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/tsconfig.json +1 -1
  28. package/dist/init-template/package.json +28 -0
  29. package/dist/init-template/tsconfig.json +25 -0
  30. package/package.json +5 -4
  31. package/dist/init-templates/aws-lambda/.env.example +0 -15
  32. package/dist/init-templates/aws-lambda/.eslintrc.cjs +0 -19
  33. package/dist/init-templates/aws-lambda/.example.gitignore +0 -49
  34. package/dist/init-templates/aws-lambda/.gitlab-ci.yml +0 -39
  35. package/dist/init-templates/aws-lambda/.nvmrc +0 -1
  36. package/dist/init-templates/aws-lambda/.vscode/extensions.json +0 -5
  37. package/dist/init-templates/aws-lambda/.vscode/launch.json +0 -20
  38. package/dist/init-templates/aws-lambda/.vscode/settings.json +0 -3
  39. package/dist/init-templates/aws-lambda/.vscode/tasks.json +0 -12
  40. package/dist/init-templates/aws-lambda/README.md +0 -77
  41. package/dist/init-templates/aws-lambda/jest.config.js +0 -5
  42. package/dist/init-templates/aws-lambda/package.json +0 -53
  43. package/dist/init-templates/aws-lambda/scripts/ngrok.js +0 -28
  44. package/dist/init-templates/aws-lambda/src/index.test.ts +0 -7
  45. package/dist/init-templates/aws-lambda/src/index.ts +0 -33
  46. package/dist/init-templates/aws-lambda/src/lib/logging/index.ts +0 -88
  47. package/dist/init-templates/aws-lambda/src/lib/services/index.ts +0 -41
  48. package/dist/init-templates/aws-lambda/src/lib/state/redis/index.ts +0 -65
  49. package/dist/init-templates/aws-lambda/src/lib/state/seeka/installations.ts +0 -67
  50. package/dist/init-templates/aws-lambda/src/routes/seekaAppWebhook.ts +0 -194
  51. package/dist/init-templates/aws-lambda/tsconfig.json +0 -31
  52. package/dist/init-templates/aws-lambda/yarn.lock +0 -4392
  53. package/dist/init-templates/azure-function/.eslintrc.cjs +0 -19
  54. package/dist/init-templates/azure-function/.example.gitignore +0 -48
  55. package/dist/init-templates/azure-function/.gitlab-ci.yml +0 -48
  56. package/dist/init-templates/azure-function/.nvmrc +0 -1
  57. package/dist/init-templates/azure-function/.vscode/extensions.json +0 -7
  58. package/dist/init-templates/azure-function/.vscode/launch.json +0 -13
  59. package/dist/init-templates/azure-function/.vscode/settings.json +0 -9
  60. package/dist/init-templates/azure-function/.vscode/tasks.json +0 -39
  61. package/dist/init-templates/azure-function/jest.config.js +0 -5
  62. package/dist/init-templates/azure-function/package.json +0 -47
  63. package/dist/init-templates/azure-function/scripts/dev-queue-setup.js +0 -30
  64. package/dist/init-templates/azure-function/src/index.test.ts +0 -7
  65. package/dist/init-templates/azure-function/yarn.lock +0 -3772
  66. package/dist/init-templates/browser/.editorconfig +0 -14
  67. package/dist/init-templates/browser/.eslintrc.cjs +0 -1
  68. package/dist/init-templates/browser/.yarnrc +0 -1
  69. package/dist/init-templates/browser/yarn.lock +0 -3045
  70. package/dist/init-templates/netlify-function/.env.example +0 -18
  71. package/dist/init-templates/netlify-function/.example.gitignore +0 -36
  72. package/dist/init-templates/netlify-function/.nvmrc +0 -1
  73. package/dist/init-templates/netlify-function/.vscode/launch.json +0 -45
  74. package/dist/init-templates/netlify-function/README.md +0 -62
  75. package/dist/init-templates/netlify-function/jest.config.js +0 -5
  76. package/dist/init-templates/netlify-function/netlify.toml +0 -7
  77. package/dist/init-templates/netlify-function/package.json +0 -39
  78. package/dist/init-templates/netlify-function/src/api/example-job-background/index.ts +0 -52
  79. package/dist/init-templates/netlify-function/src/api/polling-example-job-scheduled/index.ts +0 -46
  80. package/dist/init-templates/netlify-function/src/api/seeka-app-webhook/index.ts +0 -217
  81. package/dist/init-templates/netlify-function/src/index.test.ts +0 -7
  82. package/dist/init-templates/netlify-function/src/lib/jobs/index.ts +0 -68
  83. package/dist/init-templates/netlify-function/src/lib/logging/index.ts +0 -91
  84. package/dist/init-templates/netlify-function/src/lib/services/index.ts +0 -41
  85. package/dist/init-templates/netlify-function/src/lib/state/redis/index.ts +0 -65
  86. package/dist/init-templates/netlify-function/src/lib/state/seeka/installations.ts +0 -67
  87. package/dist/init-templates/netlify-function/tsconfig.json +0 -25
  88. package/dist/init-templates/netlify-function/yarn.lock +0 -9337
  89. /package/dist/{init-templates → init-template/app}/browser/README.md +0 -0
  90. /package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/local.settings.example.json +0 -0
  91. /package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/scripts/ngrok.js +0 -0
  92. /package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/src/functions/healthCheck.ts +0 -0
  93. /package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/src/functions/pollingExample.ts +0 -0
  94. /package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/src/functions/queueExample.ts +0 -0
  95. /package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/src/lib/services/index.ts +0 -0
package/dist/index.js CHANGED
@@ -1,33 +1,33 @@
1
1
  #! /usr/bin/env node
2
- "use strict";var ao=Object.create;var Tt=Object.defineProperty;var mo=Object.getOwnPropertyDescriptor;var uo=Object.getOwnPropertyNames;var lo=Object.getPrototypeOf,fo=Object.prototype.hasOwnProperty;var _=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var co=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of uo(e))!fo.call(r,o)&&o!==t&&Tt(r,o,{get:()=>e[o],enumerable:!(n=mo(e,o))||n.enumerable});return r};var B=(r,e,t)=>(t=r!=null?ao(lo(r)):{},co(e||!r||!r.__esModule?Tt(t,"default",{value:r,enumerable:!0}):t,r));var Mt=_(Oe=>{var Lt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");Oe.encode=function(r){if(0<=r&&r<Lt.length)return Lt[r];throw new TypeError("Must be between 0 and 63: "+r)};Oe.decode=function(r){var e=65,t=90,n=97,o=122,i=48,s=57,a=43,u=47,m=26,l=52;return e<=r&&r<=t?r-e:n<=r&&r<=o?r-n+m:i<=r&&r<=s?r-i+l:r==a?62:r==u?63:-1}});var Te=_(ke=>{var jt=Mt(),Ee=5,It=1<<Ee,Pt=It-1,Nt=It;function po(r){return r<0?(-r<<1)+1:(r<<1)+0}function ho(r){var e=(r&1)===1,t=r>>1;return e?-t:t}ke.encode=function(e){var t="",n,o=po(e);do n=o&Pt,o>>>=Ee,o>0&&(n|=Nt),t+=jt.encode(n);while(o>0);return t};ke.decode=function(e,t,n){var o=e.length,i=0,s=0,a,u;do{if(t>=o)throw new Error("Expected more digits in base 64 VLQ value.");if(u=jt.decode(e.charCodeAt(t++)),u===-1)throw new Error("Invalid base64 digit: "+e.charAt(t-1));a=!!(u&Nt),u&=Pt,i=i+(u<<s),s+=Ee}while(a);n.value=ho(i),n.rest=t}});var K=_(O=>{function go(r,e,t){if(e in r)return r[e];if(arguments.length===3)return t;throw new Error('"'+e+'" is a required argument.')}O.getArg=go;var $t=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,_o=/^data:.+\,.+$/;function ne(r){var e=r.match($t);return e?{scheme:e[1],auth:e[2],host:e[3],port:e[4],path:e[5]}:null}O.urlParse=ne;function U(r){var e="";return r.scheme&&(e+=r.scheme+":"),e+="//",r.auth&&(e+=r.auth+"@"),r.host&&(e+=r.host),r.port&&(e+=":"+r.port),r.path&&(e+=r.path),e}O.urlGenerate=U;function Le(r){var e=r,t=ne(r);if(t){if(!t.path)return r;e=t.path}for(var n=O.isAbsolute(e),o=e.split(/\/+/),i,s=0,a=o.length-1;a>=0;a--)i=o[a],i==="."?o.splice(a,1):i===".."?s++:s>0&&(i===""?(o.splice(a+1,s),s=0):(o.splice(a,2),s--));return e=o.join("/"),e===""&&(e=n?"/":"."),t?(t.path=e,U(t)):e}O.normalize=Le;function Rt(r,e){r===""&&(r="."),e===""&&(e=".");var t=ne(e),n=ne(r);if(n&&(r=n.path||"/"),t&&!t.scheme)return n&&(t.scheme=n.scheme),U(t);if(t||e.match(_o))return e;if(n&&!n.host&&!n.path)return n.host=e,U(n);var o=e.charAt(0)==="/"?e:Le(r.replace(/\/+$/,"")+"/"+e);return n?(n.path=o,U(n)):o}O.join=Rt;O.isAbsolute=function(r){return r.charAt(0)==="/"||$t.test(r)};function vo(r,e){r===""&&(r="."),r=r.replace(/\/$/,"");for(var t=0;e.indexOf(r+"/")!==0;){var n=r.lastIndexOf("/");if(n<0||(r=r.slice(0,n),r.match(/^([^\/]+:\/)?\/*$/)))return e;++t}return Array(t+1).join("../")+e.substr(r.length+1)}O.relative=vo;var Ft=function(){var r=Object.create(null);return!("__proto__"in r)}();function Vt(r){return r}function xo(r){return Dt(r)?"$"+r:r}O.toSetString=Ft?Vt:xo;function yo(r){return Dt(r)?r.slice(1):r}O.fromSetString=Ft?Vt:yo;function Dt(r){if(!r)return!1;var e=r.length;if(e<9||r.charCodeAt(e-1)!==95||r.charCodeAt(e-2)!==95||r.charCodeAt(e-3)!==111||r.charCodeAt(e-4)!==116||r.charCodeAt(e-5)!==111||r.charCodeAt(e-6)!==114||r.charCodeAt(e-7)!==112||r.charCodeAt(e-8)!==95||r.charCodeAt(e-9)!==95)return!1;for(var t=e-10;t>=0;t--)if(r.charCodeAt(t)!==36)return!1;return!0}function bo(r,e,t){var n=z(r.source,e.source);return n!==0||(n=r.originalLine-e.originalLine,n!==0)||(n=r.originalColumn-e.originalColumn,n!==0||t)||(n=r.generatedColumn-e.generatedColumn,n!==0)||(n=r.generatedLine-e.generatedLine,n!==0)?n:z(r.name,e.name)}O.compareByOriginalPositions=bo;function wo(r,e,t){var n=r.generatedLine-e.generatedLine;return n!==0||(n=r.generatedColumn-e.generatedColumn,n!==0||t)||(n=z(r.source,e.source),n!==0)||(n=r.originalLine-e.originalLine,n!==0)||(n=r.originalColumn-e.originalColumn,n!==0)?n:z(r.name,e.name)}O.compareByGeneratedPositionsDeflated=wo;function z(r,e){return r===e?0:r===null?1:e===null?-1:r>e?1:-1}function Co(r,e){var t=r.generatedLine-e.generatedLine;return t!==0||(t=r.generatedColumn-e.generatedColumn,t!==0)||(t=z(r.source,e.source),t!==0)||(t=r.originalLine-e.originalLine,t!==0)||(t=r.originalColumn-e.originalColumn,t!==0)?t:z(r.name,e.name)}O.compareByGeneratedPositionsInflated=Co;function So(r){return JSON.parse(r.replace(/^\)]}'[^\n]*\n/,""))}O.parseSourceMapInput=So;function Ao(r,e,t){if(e=e||"",r&&(r[r.length-1]!=="/"&&e[0]!=="/"&&(r+="/"),e=r+e),t){var n=ne(t);if(!n)throw new Error("sourceMapURL could not be parsed");if(n.path){var o=n.path.lastIndexOf("/");o>=0&&(n.path=n.path.substring(0,o+1))}e=Rt(U(n),e)}return Le(e)}O.computeSourceURL=Ao});var Ie=_(Gt=>{var Me=K(),je=Object.prototype.hasOwnProperty,F=typeof Map<"u";function I(){this._array=[],this._set=F?new Map:Object.create(null)}I.fromArray=function(e,t){for(var n=new I,o=0,i=e.length;o<i;o++)n.add(e[o],t);return n};I.prototype.size=function(){return F?this._set.size:Object.getOwnPropertyNames(this._set).length};I.prototype.add=function(e,t){var n=F?e:Me.toSetString(e),o=F?this.has(e):je.call(this._set,n),i=this._array.length;(!o||t)&&this._array.push(e),o||(F?this._set.set(e,i):this._set[n]=i)};I.prototype.has=function(e){if(F)return this._set.has(e);var t=Me.toSetString(e);return je.call(this._set,t)};I.prototype.indexOf=function(e){if(F){var t=this._set.get(e);if(t>=0)return t}else{var n=Me.toSetString(e);if(je.call(this._set,n))return this._set[n]}throw new Error('"'+e+'" is not in the set.')};I.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)};I.prototype.toArray=function(){return this._array.slice()};Gt.ArraySet=I});var Wt=_(Ht=>{var qt=K();function Oo(r,e){var t=r.generatedLine,n=e.generatedLine,o=r.generatedColumn,i=e.generatedColumn;return n>t||n==t&&i>=o||qt.compareByGeneratedPositionsInflated(r,e)<=0}function ce(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}ce.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)};ce.prototype.add=function(e){Oo(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))};ce.prototype.toArray=function(){return this._sorted||(this._array.sort(qt.compareByGeneratedPositionsInflated),this._sorted=!0),this._array};Ht.MappingList=ce});var Pe=_(Bt=>{var oe=Te(),C=K(),pe=Ie().ArraySet,Eo=Wt().MappingList;function T(r){r||(r={}),this._file=C.getArg(r,"file",null),this._sourceRoot=C.getArg(r,"sourceRoot",null),this._skipValidation=C.getArg(r,"skipValidation",!1),this._sources=new pe,this._names=new pe,this._mappings=new Eo,this._sourcesContents=null}T.prototype._version=3;T.fromSourceMap=function(e){var t=e.sourceRoot,n=new T({file:e.file,sourceRoot:t});return e.eachMapping(function(o){var i={generated:{line:o.generatedLine,column:o.generatedColumn}};o.source!=null&&(i.source=o.source,t!=null&&(i.source=C.relative(t,i.source)),i.original={line:o.originalLine,column:o.originalColumn},o.name!=null&&(i.name=o.name)),n.addMapping(i)}),e.sources.forEach(function(o){var i=o;t!==null&&(i=C.relative(t,o)),n._sources.has(i)||n._sources.add(i);var s=e.sourceContentFor(o);s!=null&&n.setSourceContent(o,s)}),n};T.prototype.addMapping=function(e){var t=C.getArg(e,"generated"),n=C.getArg(e,"original",null),o=C.getArg(e,"source",null),i=C.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,n,o,i),o!=null&&(o=String(o),this._sources.has(o)||this._sources.add(o)),i!=null&&(i=String(i),this._names.has(i)||this._names.add(i)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:n!=null&&n.line,originalColumn:n!=null&&n.column,source:o,name:i})};T.prototype.setSourceContent=function(e,t){var n=e;this._sourceRoot!=null&&(n=C.relative(this._sourceRoot,n)),t!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[C.toSetString(n)]=t):this._sourcesContents&&(delete this._sourcesContents[C.toSetString(n)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))};T.prototype.applySourceMap=function(e,t,n){var o=t;if(t==null){if(e.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);o=e.file}var i=this._sourceRoot;i!=null&&(o=C.relative(i,o));var s=new pe,a=new pe;this._mappings.unsortedForEach(function(u){if(u.source===o&&u.originalLine!=null){var m=e.originalPositionFor({line:u.originalLine,column:u.originalColumn});m.source!=null&&(u.source=m.source,n!=null&&(u.source=C.join(n,u.source)),i!=null&&(u.source=C.relative(i,u.source)),u.originalLine=m.line,u.originalColumn=m.column,m.name!=null&&(u.name=m.name))}var l=u.source;l!=null&&!s.has(l)&&s.add(l);var f=u.name;f!=null&&!a.has(f)&&a.add(f)},this),this._sources=s,this._names=a,e.sources.forEach(function(u){var m=e.sourceContentFor(u);m!=null&&(n!=null&&(u=C.join(n,u)),i!=null&&(u=C.relative(i,u)),this.setSourceContent(u,m))},this)};T.prototype._validateMapping=function(e,t,n,o){if(t&&typeof t.line!="number"&&typeof t.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!n&&!o)){if(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&n)return;throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:n,original:t,name:o}))}};T.prototype._serializeMappings=function(){for(var e=0,t=1,n=0,o=0,i=0,s=0,a="",u,m,l,f,c=this._mappings.toArray(),h=0,x=c.length;h<x;h++){if(m=c[h],u="",m.generatedLine!==t)for(e=0;m.generatedLine!==t;)u+=";",t++;else if(h>0){if(!C.compareByGeneratedPositionsInflated(m,c[h-1]))continue;u+=","}u+=oe.encode(m.generatedColumn-e),e=m.generatedColumn,m.source!=null&&(f=this._sources.indexOf(m.source),u+=oe.encode(f-s),s=f,u+=oe.encode(m.originalLine-1-o),o=m.originalLine-1,u+=oe.encode(m.originalColumn-n),n=m.originalColumn,m.name!=null&&(l=this._names.indexOf(m.name),u+=oe.encode(l-i),i=l)),a+=u}return a};T.prototype._generateSourcesContent=function(e,t){return e.map(function(n){if(!this._sourcesContents)return null;t!=null&&(n=C.relative(t,n));var o=C.toSetString(n);return Object.prototype.hasOwnProperty.call(this._sourcesContents,o)?this._sourcesContents[o]:null},this)};T.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(e.file=this._file),this._sourceRoot!=null&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e};T.prototype.toString=function(){return JSON.stringify(this.toJSON())};Bt.SourceMapGenerator=T});var Ut=_(V=>{V.GREATEST_LOWER_BOUND=1;V.LEAST_UPPER_BOUND=2;function Ne(r,e,t,n,o,i){var s=Math.floor((e-r)/2)+r,a=o(t,n[s],!0);return a===0?s:a>0?e-s>1?Ne(s,e,t,n,o,i):i==V.LEAST_UPPER_BOUND?e<n.length?e:-1:s:s-r>1?Ne(r,s,t,n,o,i):i==V.LEAST_UPPER_BOUND?s:r<0?-1:r}V.search=function(e,t,n,o){if(t.length===0)return-1;var i=Ne(-1,t.length,e,t,n,o||V.GREATEST_LOWER_BOUND);if(i<0)return-1;for(;i-1>=0&&n(t[i],t[i-1],!0)===0;)--i;return i}});var Kt=_(zt=>{function $e(r,e,t){var n=r[e];r[e]=r[t],r[t]=n}function ko(r,e){return Math.round(r+Math.random()*(e-r))}function Re(r,e,t,n){if(t<n){var o=ko(t,n),i=t-1;$e(r,o,n);for(var s=r[n],a=t;a<n;a++)e(r[a],s)<=0&&(i+=1,$e(r,i,a));$e(r,i+1,a);var u=i+1;Re(r,e,t,u-1),Re(r,e,u+1,n)}}zt.quickSort=function(r,e){Re(r,e,0,r.length-1)}});var Qt=_(de=>{var p=K(),Fe=Ut(),J=Ie().ArraySet,To=Te(),ie=Kt().quickSort;function y(r,e){var t=r;return typeof r=="string"&&(t=p.parseSourceMapInput(r)),t.sections!=null?new M(t,e):new S(t,e)}y.fromSourceMap=function(r,e){return S.fromSourceMap(r,e)};y.prototype._version=3;y.prototype.__generatedMappings=null;Object.defineProperty(y.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}});y.prototype.__originalMappings=null;Object.defineProperty(y.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}});y.prototype._charIsMappingSeparator=function(e,t){var n=e.charAt(t);return n===";"||n===","};y.prototype._parseMappings=function(e,t){throw new Error("Subclasses must implement _parseMappings")};y.GENERATED_ORDER=1;y.ORIGINAL_ORDER=2;y.GREATEST_LOWER_BOUND=1;y.LEAST_UPPER_BOUND=2;y.prototype.eachMapping=function(e,t,n){var o=t||null,i=n||y.GENERATED_ORDER,s;switch(i){case y.GENERATED_ORDER:s=this._generatedMappings;break;case y.ORIGINAL_ORDER:s=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var a=this.sourceRoot;s.map(function(u){var m=u.source===null?null:this._sources.at(u.source);return m=p.computeSourceURL(a,m,this._sourceMapURL),{source:m,generatedLine:u.generatedLine,generatedColumn:u.generatedColumn,originalLine:u.originalLine,originalColumn:u.originalColumn,name:u.name===null?null:this._names.at(u.name)}},this).forEach(e,o)};y.prototype.allGeneratedPositionsFor=function(e){var t=p.getArg(e,"line"),n={source:p.getArg(e,"source"),originalLine:t,originalColumn:p.getArg(e,"column",0)};if(n.source=this._findSourceIndex(n.source),n.source<0)return[];var o=[],i=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",p.compareByOriginalPositions,Fe.LEAST_UPPER_BOUND);if(i>=0){var s=this._originalMappings[i];if(e.column===void 0)for(var a=s.originalLine;s&&s.originalLine===a;)o.push({line:p.getArg(s,"generatedLine",null),column:p.getArg(s,"generatedColumn",null),lastColumn:p.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i];else for(var u=s.originalColumn;s&&s.originalLine===t&&s.originalColumn==u;)o.push({line:p.getArg(s,"generatedLine",null),column:p.getArg(s,"generatedColumn",null),lastColumn:p.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i]}return o};de.SourceMapConsumer=y;function S(r,e){var t=r;typeof r=="string"&&(t=p.parseSourceMapInput(r));var n=p.getArg(t,"version"),o=p.getArg(t,"sources"),i=p.getArg(t,"names",[]),s=p.getArg(t,"sourceRoot",null),a=p.getArg(t,"sourcesContent",null),u=p.getArg(t,"mappings"),m=p.getArg(t,"file",null);if(n!=this._version)throw new Error("Unsupported version: "+n);s&&(s=p.normalize(s)),o=o.map(String).map(p.normalize).map(function(l){return s&&p.isAbsolute(s)&&p.isAbsolute(l)?p.relative(s,l):l}),this._names=J.fromArray(i.map(String),!0),this._sources=J.fromArray(o,!0),this._absoluteSources=this._sources.toArray().map(function(l){return p.computeSourceURL(s,l,e)}),this.sourceRoot=s,this.sourcesContent=a,this._mappings=u,this._sourceMapURL=e,this.file=m}S.prototype=Object.create(y.prototype);S.prototype.consumer=y;S.prototype._findSourceIndex=function(r){var e=r;if(this.sourceRoot!=null&&(e=p.relative(this.sourceRoot,e)),this._sources.has(e))return this._sources.indexOf(e);var t;for(t=0;t<this._absoluteSources.length;++t)if(this._absoluteSources[t]==r)return t;return-1};S.fromSourceMap=function(e,t){var n=Object.create(S.prototype),o=n._names=J.fromArray(e._names.toArray(),!0),i=n._sources=J.fromArray(e._sources.toArray(),!0);n.sourceRoot=e._sourceRoot,n.sourcesContent=e._generateSourcesContent(n._sources.toArray(),n.sourceRoot),n.file=e._file,n._sourceMapURL=t,n._absoluteSources=n._sources.toArray().map(function(h){return p.computeSourceURL(n.sourceRoot,h,t)});for(var s=e._mappings.toArray().slice(),a=n.__generatedMappings=[],u=n.__originalMappings=[],m=0,l=s.length;m<l;m++){var f=s[m],c=new Jt;c.generatedLine=f.generatedLine,c.generatedColumn=f.generatedColumn,f.source&&(c.source=i.indexOf(f.source),c.originalLine=f.originalLine,c.originalColumn=f.originalColumn,f.name&&(c.name=o.indexOf(f.name)),u.push(c)),a.push(c)}return ie(n.__originalMappings,p.compareByOriginalPositions),n};S.prototype._version=3;Object.defineProperty(S.prototype,"sources",{get:function(){return this._absoluteSources.slice()}});function Jt(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}S.prototype._parseMappings=function(e,t){for(var n=1,o=0,i=0,s=0,a=0,u=0,m=e.length,l=0,f={},c={},h=[],x=[],w,H,A,W,kt;l<m;)if(e.charAt(l)===";")n++,l++,o=0;else if(e.charAt(l)===",")l++;else{for(w=new Jt,w.generatedLine=n,W=l;W<m&&!this._charIsMappingSeparator(e,W);W++);if(H=e.slice(l,W),A=f[H],A)l+=H.length;else{for(A=[];l<W;)To.decode(e,l,c),kt=c.value,l=c.rest,A.push(kt);if(A.length===2)throw new Error("Found a source, but no line and column");if(A.length===3)throw new Error("Found a source and line, but no column");f[H]=A}w.generatedColumn=o+A[0],o=w.generatedColumn,A.length>1&&(w.source=a+A[1],a+=A[1],w.originalLine=i+A[2],i=w.originalLine,w.originalLine+=1,w.originalColumn=s+A[3],s=w.originalColumn,A.length>4&&(w.name=u+A[4],u+=A[4])),x.push(w),typeof w.originalLine=="number"&&h.push(w)}ie(x,p.compareByGeneratedPositionsDeflated),this.__generatedMappings=x,ie(h,p.compareByOriginalPositions),this.__originalMappings=h};S.prototype._findMapping=function(e,t,n,o,i,s){if(e[n]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[n]);if(e[o]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[o]);return Fe.search(e,t,i,s)};S.prototype.computeColumnSpans=function(){for(var e=0;e<this._generatedMappings.length;++e){var t=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var n=this._generatedMappings[e+1];if(t.generatedLine===n.generatedLine){t.lastGeneratedColumn=n.generatedColumn-1;continue}}t.lastGeneratedColumn=1/0}};S.prototype.originalPositionFor=function(e){var t={generatedLine:p.getArg(e,"line"),generatedColumn:p.getArg(e,"column")},n=this._findMapping(t,this._generatedMappings,"generatedLine","generatedColumn",p.compareByGeneratedPositionsDeflated,p.getArg(e,"bias",y.GREATEST_LOWER_BOUND));if(n>=0){var o=this._generatedMappings[n];if(o.generatedLine===t.generatedLine){var i=p.getArg(o,"source",null);i!==null&&(i=this._sources.at(i),i=p.computeSourceURL(this.sourceRoot,i,this._sourceMapURL));var s=p.getArg(o,"name",null);return s!==null&&(s=this._names.at(s)),{source:i,line:p.getArg(o,"originalLine",null),column:p.getArg(o,"originalColumn",null),name:s}}}return{source:null,line:null,column:null,name:null}};S.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return e==null}):!1};S.prototype.sourceContentFor=function(e,t){if(!this.sourcesContent)return null;var n=this._findSourceIndex(e);if(n>=0)return this.sourcesContent[n];var o=e;this.sourceRoot!=null&&(o=p.relative(this.sourceRoot,o));var i;if(this.sourceRoot!=null&&(i=p.urlParse(this.sourceRoot))){var s=o.replace(/^file:\/\//,"");if(i.scheme=="file"&&this._sources.has(s))return this.sourcesContent[this._sources.indexOf(s)];if((!i.path||i.path=="/")&&this._sources.has("/"+o))return this.sourcesContent[this._sources.indexOf("/"+o)]}if(t)return null;throw new Error('"'+o+'" is not in the SourceMap.')};S.prototype.generatedPositionFor=function(e){var t=p.getArg(e,"source");if(t=this._findSourceIndex(t),t<0)return{line:null,column:null,lastColumn:null};var n={source:t,originalLine:p.getArg(e,"line"),originalColumn:p.getArg(e,"column")},o=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",p.compareByOriginalPositions,p.getArg(e,"bias",y.GREATEST_LOWER_BOUND));if(o>=0){var i=this._originalMappings[o];if(i.source===n.source)return{line:p.getArg(i,"generatedLine",null),column:p.getArg(i,"generatedColumn",null),lastColumn:p.getArg(i,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}};de.BasicSourceMapConsumer=S;function M(r,e){var t=r;typeof r=="string"&&(t=p.parseSourceMapInput(r));var n=p.getArg(t,"version"),o=p.getArg(t,"sections");if(n!=this._version)throw new Error("Unsupported version: "+n);this._sources=new J,this._names=new J;var i={line:-1,column:0};this._sections=o.map(function(s){if(s.url)throw new Error("Support for url field in sections not implemented.");var a=p.getArg(s,"offset"),u=p.getArg(a,"line"),m=p.getArg(a,"column");if(u<i.line||u===i.line&&m<i.column)throw new Error("Section offsets must be ordered and non-overlapping.");return i=a,{generatedOffset:{generatedLine:u+1,generatedColumn:m+1},consumer:new y(p.getArg(s,"map"),e)}})}M.prototype=Object.create(y.prototype);M.prototype.constructor=y;M.prototype._version=3;Object.defineProperty(M.prototype,"sources",{get:function(){for(var r=[],e=0;e<this._sections.length;e++)for(var t=0;t<this._sections[e].consumer.sources.length;t++)r.push(this._sections[e].consumer.sources[t]);return r}});M.prototype.originalPositionFor=function(e){var t={generatedLine:p.getArg(e,"line"),generatedColumn:p.getArg(e,"column")},n=Fe.search(t,this._sections,function(i,s){var a=i.generatedLine-s.generatedOffset.generatedLine;return a||i.generatedColumn-s.generatedOffset.generatedColumn}),o=this._sections[n];return o?o.consumer.originalPositionFor({line:t.generatedLine-(o.generatedOffset.generatedLine-1),column:t.generatedColumn-(o.generatedOffset.generatedLine===t.generatedLine?o.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}};M.prototype.hasContentsOfAllSources=function(){return this._sections.every(function(e){return e.consumer.hasContentsOfAllSources()})};M.prototype.sourceContentFor=function(e,t){for(var n=0;n<this._sections.length;n++){var o=this._sections[n],i=o.consumer.sourceContentFor(e,!0);if(i)return i}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')};M.prototype.generatedPositionFor=function(e){for(var t=0;t<this._sections.length;t++){var n=this._sections[t];if(n.consumer._findSourceIndex(p.getArg(e,"source"))!==-1){var o=n.consumer.generatedPositionFor(e);if(o){var i={line:o.line+(n.generatedOffset.generatedLine-1),column:o.column+(n.generatedOffset.generatedLine===o.line?n.generatedOffset.generatedColumn-1:0)};return i}}}return{line:null,column:null}};M.prototype._parseMappings=function(e,t){this.__generatedMappings=[],this.__originalMappings=[];for(var n=0;n<this._sections.length;n++)for(var o=this._sections[n],i=o.consumer._generatedMappings,s=0;s<i.length;s++){var a=i[s],u=o.consumer._sources.at(a.source);u=p.computeSourceURL(o.consumer.sourceRoot,u,this._sourceMapURL),this._sources.add(u),u=this._sources.indexOf(u);var m=null;a.name&&(m=o.consumer._names.at(a.name),this._names.add(m),m=this._names.indexOf(m));var l={source:u,generatedLine:a.generatedLine+(o.generatedOffset.generatedLine-1),generatedColumn:a.generatedColumn+(o.generatedOffset.generatedLine===a.generatedLine?o.generatedOffset.generatedColumn-1:0),originalLine:a.originalLine,originalColumn:a.originalColumn,name:m};this.__generatedMappings.push(l),typeof l.originalLine=="number"&&this.__originalMappings.push(l)}ie(this.__generatedMappings,p.compareByGeneratedPositionsDeflated),ie(this.__originalMappings,p.compareByOriginalPositions)};de.IndexedSourceMapConsumer=M});var Yt=_(Xt=>{var Lo=Pe().SourceMapGenerator,he=K(),Mo=/(\r?\n)/,jo=10,Q="$$$isSourceNode$$$";function k(r,e,t,n,o){this.children=[],this.sourceContents={},this.line=r??null,this.column=e??null,this.source=t??null,this.name=o??null,this[Q]=!0,n!=null&&this.add(n)}k.fromStringWithSourceMap=function(e,t,n){var o=new k,i=e.split(Mo),s=0,a=function(){var c=x(),h=x()||"";return c+h;function x(){return s<i.length?i[s++]:void 0}},u=1,m=0,l=null;return t.eachMapping(function(c){if(l!==null)if(u<c.generatedLine)f(l,a()),u++,m=0;else{var h=i[s]||"",x=h.substr(0,c.generatedColumn-m);i[s]=h.substr(c.generatedColumn-m),m=c.generatedColumn,f(l,x),l=c;return}for(;u<c.generatedLine;)o.add(a()),u++;if(m<c.generatedColumn){var h=i[s]||"";o.add(h.substr(0,c.generatedColumn)),i[s]=h.substr(c.generatedColumn),m=c.generatedColumn}l=c},this),s<i.length&&(l&&f(l,a()),o.add(i.splice(s).join(""))),t.sources.forEach(function(c){var h=t.sourceContentFor(c);h!=null&&(n!=null&&(c=he.join(n,c)),o.setSourceContent(c,h))}),o;function f(c,h){if(c===null||c.source===void 0)o.add(h);else{var x=n?he.join(n,c.source):c.source;o.add(new k(c.originalLine,c.originalColumn,x,h,c.name))}}};k.prototype.add=function(e){if(Array.isArray(e))e.forEach(function(t){this.add(t)},this);else if(e[Q]||typeof e=="string")e&&this.children.push(e);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);return this};k.prototype.prepend=function(e){if(Array.isArray(e))for(var t=e.length-1;t>=0;t--)this.prepend(e[t]);else if(e[Q]||typeof e=="string")this.children.unshift(e);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);return this};k.prototype.walk=function(e){for(var t,n=0,o=this.children.length;n<o;n++)t=this.children[n],t[Q]?t.walk(e):t!==""&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})};k.prototype.join=function(e){var t,n,o=this.children.length;if(o>0){for(t=[],n=0;n<o-1;n++)t.push(this.children[n]),t.push(e);t.push(this.children[n]),this.children=t}return this};k.prototype.replaceRight=function(e,t){var n=this.children[this.children.length-1];return n[Q]?n.replaceRight(e,t):typeof n=="string"?this.children[this.children.length-1]=n.replace(e,t):this.children.push("".replace(e,t)),this};k.prototype.setSourceContent=function(e,t){this.sourceContents[he.toSetString(e)]=t};k.prototype.walkSourceContents=function(e){for(var t=0,n=this.children.length;t<n;t++)this.children[t][Q]&&this.children[t].walkSourceContents(e);for(var o=Object.keys(this.sourceContents),t=0,n=o.length;t<n;t++)e(he.fromSetString(o[t]),this.sourceContents[o[t]])};k.prototype.toString=function(){var e="";return this.walk(function(t){e+=t}),e};k.prototype.toStringWithSourceMap=function(e){var t={code:"",line:1,column:0},n=new Lo(e),o=!1,i=null,s=null,a=null,u=null;return this.walk(function(m,l){t.code+=m,l.source!==null&&l.line!==null&&l.column!==null?((i!==l.source||s!==l.line||a!==l.column||u!==l.name)&&n.addMapping({source:l.source,original:{line:l.line,column:l.column},generated:{line:t.line,column:t.column},name:l.name}),i=l.source,s=l.line,a=l.column,u=l.name,o=!0):o&&(n.addMapping({generated:{line:t.line,column:t.column}}),i=null,o=!1);for(var f=0,c=m.length;f<c;f++)m.charCodeAt(f)===jo?(t.line++,t.column=0,f+1===c?(i=null,o=!1):o&&n.addMapping({source:l.source,original:{line:l.line,column:l.column},generated:{line:t.line,column:t.column},name:l.name})):t.column++}),this.walkSourceContents(function(m,l){n.setSourceContent(m,l)}),{code:t.code,map:n}};Xt.SourceNode=k});var Zt=_(ge=>{ge.SourceMapGenerator=Pe().SourceMapGenerator;ge.SourceMapConsumer=Qt().SourceMapConsumer;ge.SourceNode=Yt().SourceNode});var tr=_((Da,er)=>{var Io=Object.prototype.toString,Ve=typeof Buffer<"u"&&typeof Buffer.alloc=="function"&&typeof Buffer.allocUnsafe=="function"&&typeof Buffer.from=="function";function Po(r){return Io.call(r).slice(8,-1)==="ArrayBuffer"}function No(r,e,t){e>>>=0;var n=r.byteLength-e;if(n<0)throw new RangeError("'offset' is out of bounds");if(t===void 0)t=n;else if(t>>>=0,t>n)throw new RangeError("'length' is out of bounds");return Ve?Buffer.from(r.slice(e,e+t)):new Buffer(new Uint8Array(r.slice(e,e+t)))}function $o(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!Buffer.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');return Ve?Buffer.from(r,e):new Buffer(r,e)}function Ro(r,e,t){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return Po(r)?No(r,e,t):typeof r=="string"?$o(r,e):Ve?Buffer.from(r):new Buffer(r)}er.exports=Ro});var ur=_((G,He)=>{var Fo=Zt().SourceMapConsumer,De=require("path"),j;try{j=require("fs"),(!j.existsSync||!j.readFileSync)&&(j=null)}catch{}var Vo=tr();function rr(r,e){return r.require(e)}var nr=!1,or=!1,Ge=!1,se="auto",D={},ae={},Do=/^data:application\/json[^,]+base64,/,$=[],R=[];function We(){return se==="browser"?!0:se==="node"?!1:typeof window<"u"&&typeof XMLHttpRequest=="function"&&!(window.require&&window.module&&window.process&&window.process.type==="renderer")}function Go(){return typeof process=="object"&&process!==null&&typeof process.on=="function"}function qo(){return typeof process=="object"&&process!==null?process.version:""}function Ho(){if(typeof process=="object"&&process!==null)return process.stderr}function Wo(r){if(typeof process=="object"&&process!==null&&typeof process.exit=="function")return process.exit(r)}function _e(r){return function(e){for(var t=0;t<r.length;t++){var n=r[t](e);if(n)return n}return null}}var Be=_e($);$.push(function(r){if(r=r.trim(),/^file:/.test(r)&&(r=r.replace(/file:\/\/\/(\w:)?/,function(n,o){return o?"":"/"})),r in D)return D[r];var e="";try{if(j)j.existsSync(r)&&(e=j.readFileSync(r,"utf8"));else{var t=new XMLHttpRequest;t.open("GET",r,!1),t.send(null),t.readyState===4&&t.status===200&&(e=t.responseText)}}catch{}return D[r]=e});function qe(r,e){if(!r)return e;var t=De.dirname(r),n=/^\w+:\/\/[^\/]*/.exec(t),o=n?n[0]:"",i=t.slice(o.length);return o&&/^\/\w\:/.test(i)?(o+="/",o+De.resolve(t.slice(o.length),e).replace(/\\/g,"/")):o+De.resolve(t.slice(o.length),e)}function Bo(r){var e;if(We())try{var t=new XMLHttpRequest;t.open("GET",r,!1),t.send(null),e=t.readyState===4?t.responseText:null;var n=t.getResponseHeader("SourceMap")||t.getResponseHeader("X-SourceMap");if(n)return n}catch{}e=Be(r);for(var o=/(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg,i,s;s=o.exec(e);)i=s;return i?i[1]:null}var Ue=_e(R);R.push(function(r){var e=Bo(r);if(!e)return null;var t;if(Do.test(e)){var n=e.slice(e.indexOf(",")+1);t=Vo(n,"base64").toString(),e=r}else e=qe(r,e),t=Be(e);return t?{url:e,map:t}:null});function ze(r){var e=ae[r.source];if(!e){var t=Ue(r.source);t?(e=ae[r.source]={url:t.url,map:new Fo(t.map)},e.map.sourcesContent&&e.map.sources.forEach(function(o,i){var s=e.map.sourcesContent[i];if(s){var a=qe(e.url,o);D[a]=s}})):e=ae[r.source]={url:null,map:null}}if(e&&e.map&&typeof e.map.originalPositionFor=="function"){var n=e.map.originalPositionFor(r);if(n.source!==null)return n.source=qe(e.url,n.source),n}return r}function sr(r){var e=/^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(r);if(e){var t=ze({source:e[2],line:+e[3],column:e[4]-1});return"eval at "+e[1]+" ("+t.source+":"+t.line+":"+(t.column+1)+")"}return e=/^eval at ([^(]+) \((.+)\)$/.exec(r),e?"eval at "+e[1]+" ("+sr(e[2])+")":r}function Uo(){var r,e="";if(this.isNative())e="native";else{r=this.getScriptNameOrSourceURL(),!r&&this.isEval()&&(e=this.getEvalOrigin(),e+=", "),r?e+=r:e+="<anonymous>";var t=this.getLineNumber();if(t!=null){e+=":"+t;var n=this.getColumnNumber();n&&(e+=":"+n)}}var o="",i=this.getFunctionName(),s=!0,a=this.isConstructor(),u=!(this.isToplevel()||a);if(u){var m=this.getTypeName();m==="[object Object]"&&(m="null");var l=this.getMethodName();i?(m&&i.indexOf(m)!=0&&(o+=m+"."),o+=i,l&&i.indexOf("."+l)!=i.length-l.length-1&&(o+=" [as "+l+"]")):o+=m+"."+(l||"<anonymous>")}else a?o+="new "+(i||"<anonymous>"):i?o+=i:(o+=e,s=!1);return s&&(o+=" ("+e+")"),o}function ir(r){var e={};return Object.getOwnPropertyNames(Object.getPrototypeOf(r)).forEach(function(t){e[t]=/^(?:is|get)/.test(t)?function(){return r[t].call(r)}:r[t]}),e.toString=Uo,e}function ar(r,e){if(e===void 0&&(e={nextPosition:null,curPosition:null}),r.isNative())return e.curPosition=null,r;var t=r.getFileName()||r.getScriptNameOrSourceURL();if(t){var n=r.getLineNumber(),o=r.getColumnNumber()-1,i=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/,s=i.test(qo())?0:62;n===1&&o>s&&!We()&&!r.isEval()&&(o-=s);var a=ze({source:t,line:n,column:o});e.curPosition=a,r=ir(r);var u=r.getFunctionName;return r.getFunctionName=function(){return e.nextPosition==null?u():e.nextPosition.name||u()},r.getFileName=function(){return a.source},r.getLineNumber=function(){return a.line},r.getColumnNumber=function(){return a.column+1},r.getScriptNameOrSourceURL=function(){return a.source},r}var m=r.isEval()&&r.getEvalOrigin();return m&&(m=sr(m),r=ir(r),r.getEvalOrigin=function(){return m}),r}function zo(r,e){Ge&&(D={},ae={});for(var t=r.name||"Error",n=r.message||"",o=t+": "+n,i={nextPosition:null,curPosition:null},s=[],a=e.length-1;a>=0;a--)s.push(`
3
- at `+ar(e[a],i)),i.nextPosition=i.curPosition;return i.curPosition=i.nextPosition=null,o+s.reverse().join("")}function mr(r){var e=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(r.stack);if(e){var t=e[1],n=+e[2],o=+e[3],i=D[t];if(!i&&j&&j.existsSync(t))try{i=j.readFileSync(t,"utf8")}catch{i=""}if(i){var s=i.split(/(?:\r\n|\r|\n)/)[n-1];if(s)return t+":"+n+`
4
- `+s+`
5
- `+new Array(o).join(" ")+"^"}}return null}function Ko(r){var e=mr(r),t=Ho();t&&t._handle&&t._handle.setBlocking&&t._handle.setBlocking(!0),e&&(console.error(),console.error(e)),console.error(r.stack),Wo(1)}function Jo(){var r=process.emit;process.emit=function(e){if(e==="uncaughtException"){var t=arguments[1]&&arguments[1].stack,n=this.listeners(e).length>0;if(t&&!n)return Ko(arguments[1])}return r.apply(this,arguments)}}var Qo=$.slice(0),Xo=R.slice(0);G.wrapCallSite=ar;G.getErrorSource=mr;G.mapSourcePosition=ze;G.retrieveSourceMap=Ue;G.install=function(r){if(r=r||{},r.environment&&(se=r.environment,["node","browser","auto"].indexOf(se)===-1))throw new Error("environment "+se+" was unknown. Available options are {auto, browser, node}");if(r.retrieveFile&&(r.overrideRetrieveFile&&($.length=0),$.unshift(r.retrieveFile)),r.retrieveSourceMap&&(r.overrideRetrieveSourceMap&&(R.length=0),R.unshift(r.retrieveSourceMap)),r.hookRequire&&!We()){var e=rr(He,"module"),t=e.prototype._compile;t.__sourceMapSupport||(e.prototype._compile=function(i,s){return D[s]=i,ae[s]=void 0,t.call(this,i,s)},e.prototype._compile.__sourceMapSupport=!0)}if(Ge||(Ge="emptyCacheBetweenOperations"in r?r.emptyCacheBetweenOperations:!1),nr||(nr=!0,Error.prepareStackTrace=zo),!or){var n="handleUncaughtExceptions"in r?r.handleUncaughtExceptions:!0;try{var o=rr(He,"worker_threads");o.isMainThread===!1&&(n=!1)}catch{}n&&Go()&&(or=!0,Jo())}};G.resetRetrieveHandlers=function(){$.length=0,R.length=0,$=Qo.slice(0),R=Xo.slice(0),Ue=_e(R),Be=_e($)}});var me=_(Je=>{var ve=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Ke=class extends ve{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Je.CommanderError=ve;Je.InvalidArgumentError=Ke});var xe=_(Xe=>{var{InvalidArgumentError:Yo}=me(),Qe=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new Yo(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,n):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Zo(r){let e=r.name()+(r.variadic===!0?"...":"");return r.required?"<"+e+">":"["+e+"]"}Xe.Argument=Qe;Xe.humanReadableArgName=Zo});var et=_(Ze=>{var{humanReadableArgName:ei}=xe(),Ye=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(o=>!o._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((o,i)=>o.name().localeCompare(i.name())),t}compareOptions(e,t){let n=o=>o.short?o.short.replace(/^-/,""):o.long.replace(/^--/,"");return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(o=>!o.hidden),n=e._getHelpOption();if(n&&!n.hidden){let o=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!o&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!o&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let o=n.options.filter(i=>!i.hidden);t.push(...o)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(n=>ei(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((n,o)=>Math.max(n,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(o)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((n,o)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(o)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((n,o)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(o)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((n,o)=>Math.max(n,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(o)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let n="";for(let o=e.parent;o;o=o.parent)n=o.name()+" "+n;return n+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,""]}groupItems(e,t,n){let o=new Map;return e.forEach(i=>{let s=n(i);o.has(s)||o.set(s,[])}),t.forEach(i=>{let s=n(i);o.has(s)||o.set(s,[]),o.get(s).push(i)}),o}formatHelp(e,t){let n=t.padWidth(e,t),o=t.helpWidth??80;function i(f,c){return t.formatItem(f,n,c,t)}let s=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],a=t.commandDescription(e);a.length>0&&(s=s.concat([t.boxWrap(t.styleCommandDescription(a),o),""]));let u=t.visibleArguments(e).map(f=>i(t.styleArgumentTerm(t.argumentTerm(f)),t.styleArgumentDescription(t.argumentDescription(f))));if(s=s.concat(this.formatItemList("Arguments:",u,t)),this.groupItems(e.options,t.visibleOptions(e),f=>f.helpGroupHeading??"Options:").forEach((f,c)=>{let h=f.map(x=>i(t.styleOptionTerm(t.optionTerm(x)),t.styleOptionDescription(t.optionDescription(x))));s=s.concat(this.formatItemList(c,h,t))}),t.showGlobalOptions){let f=t.visibleGlobalOptions(e).map(c=>i(t.styleOptionTerm(t.optionTerm(c)),t.styleOptionDescription(t.optionDescription(c))));s=s.concat(this.formatItemList("Global Options:",f,t))}return this.groupItems(e.commands,t.visibleCommands(e),f=>f.helpGroup()||"Commands:").forEach((f,c)=>{let h=f.map(x=>i(t.styleSubcommandTerm(t.subcommandTerm(x)),t.styleSubcommandDescription(t.subcommandDescription(x))));s=s.concat(this.formatItemList(c,h,t))}),s.join(`
6
- `)}displayWidth(e){return lr(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t==="[command]"?this.styleSubcommandText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleCommandText(t)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleSubcommandText(t)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,o){let s=" ".repeat(2);if(!n)return s+e;let a=e.padEnd(t+e.length-o.displayWidth(e)),u=2,l=(this.helpWidth??80)-t-u-2,f;return l<this.minWidthToWrap||o.preformatted(n)?f=n:f=o.boxWrap(n,l).replace(/\n/g,`
7
- `+" ".repeat(t+u)),s+a+" ".repeat(u)+f.replace(/\n/g,`
8
- ${s}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),o=/[\s]*[^\s]+/g,i=[];return n.forEach(s=>{let a=s.match(o);if(a===null){i.push("");return}let u=[a.shift()],m=this.displayWidth(u[0]);a.forEach(l=>{let f=this.displayWidth(l);if(m+f<=t){u.push(l),m+=f;return}i.push(u.join(""));let c=l.trimStart();u=[c],m=this.displayWidth(c)}),i.push(u.join(""))}),i.join(`
9
- `)}};function lr(r){let e=/\x1b\[\d*(;\d*)*m/g;return r.replace(e,"")}Ze.Help=Ye;Ze.stripColor=lr});var ot=_(nt=>{var{InvalidArgumentError:ti}=me(),tt=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=ri(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new ti(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,n):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?fr(this.name().replace(/^no-/,"")):fr(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},rt=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let o=this.negativeOptions.get(n).presetArg,i=o!==void 0?o:!1;return t.negate===(i===e)}};function fr(r){return r.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function ri(r){let e,t,n=/^-[^-]$/,o=/^--[^-]/,i=r.split(/[ |,]+/).concat("guard");if(n.test(i[0])&&(e=i.shift()),o.test(i[0])&&(t=i.shift()),!e&&n.test(i[0])&&(e=i.shift()),!e&&o.test(i[0])&&(e=t,t=i.shift()),i[0].startsWith("-")){let s=i[0],a=`option creation failed due to '${s}' in option flags '${r}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a}
2
+ "use strict";var cn=Object.create;var gt=Object.defineProperty;var pn=Object.getOwnPropertyDescriptor;var hn=Object.getOwnPropertyNames;var fn=Object.getPrototypeOf,dn=Object.prototype.hasOwnProperty;var g=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var gn=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of hn(e))!dn.call(n,i)&&i!==t&&gt(n,i,{get:()=>e[i],enumerable:!(r=pn(e,i))||r.enumerable});return n};var W=(n,e,t)=>(t=n!=null?cn(fn(n)):{},gn(e||!n||!n.__esModule?gt(t,"default",{value:n,enumerable:!0}):t,n));var vt=g(_e=>{var _t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");_e.encode=function(n){if(0<=n&&n<_t.length)return _t[n];throw new TypeError("Must be between 0 and 63: "+n)};_e.decode=function(n){var e=65,t=90,r=97,i=122,s=48,o=57,a=43,m=47,u=26,l=52;return e<=n&&n<=t?n-e:r<=n&&n<=i?n-r+u:s<=n&&n<=o?n-s+l:n==a?62:n==m?63:-1}});var Ce=g(ye=>{var yt=vt(),ve=5,Ct=1<<ve,St=Ct-1,wt=Ct;function _n(n){return n<0?(-n<<1)+1:(n<<1)+0}function vn(n){var e=(n&1)===1,t=n>>1;return e?-t:t}ye.encode=function(e){var t="",r,i=_n(e);do r=i&St,i>>>=ve,i>0&&(r|=wt),t+=yt.encode(r);while(i>0);return t};ye.decode=function(e,t,r){var i=e.length,s=0,o=0,a,m;do{if(t>=i)throw new Error("Expected more digits in base 64 VLQ value.");if(m=yt.decode(e.charCodeAt(t++)),m===-1)throw new Error("Invalid base64 digit: "+e.charAt(t-1));a=!!(m&wt),m&=St,s=s+(m<<o),o+=ve}while(a);r.value=vn(s),r.rest=t}});var z=g(A=>{function yn(n,e,t){if(e in n)return n[e];if(arguments.length===3)return t;throw new Error('"'+e+'" is a required argument.')}A.getArg=yn;var Ot=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,Cn=/^data:.+\,.+$/;function X(n){var e=n.match(Ot);return e?{scheme:e[1],auth:e[2],host:e[3],port:e[4],path:e[5]}:null}A.urlParse=X;function U(n){var e="";return n.scheme&&(e+=n.scheme+":"),e+="//",n.auth&&(e+=n.auth+"@"),n.host&&(e+=n.host),n.port&&(e+=":"+n.port),n.path&&(e+=n.path),e}A.urlGenerate=U;function Se(n){var e=n,t=X(n);if(t){if(!t.path)return n;e=t.path}for(var r=A.isAbsolute(e),i=e.split(/\/+/),s,o=0,a=i.length-1;a>=0;a--)s=i[a],s==="."?i.splice(a,1):s===".."?o++:o>0&&(s===""?(i.splice(a+1,o),o=0):(i.splice(a,2),o--));return e=i.join("/"),e===""&&(e=r?"/":"."),t?(t.path=e,U(t)):e}A.normalize=Se;function bt(n,e){n===""&&(n="."),e===""&&(e=".");var t=X(e),r=X(n);if(r&&(n=r.path||"/"),t&&!t.scheme)return r&&(t.scheme=r.scheme),U(t);if(t||e.match(Cn))return e;if(r&&!r.host&&!r.path)return r.host=e,U(r);var i=e.charAt(0)==="/"?e:Se(n.replace(/\/+$/,"")+"/"+e);return r?(r.path=i,U(r)):i}A.join=bt;A.isAbsolute=function(n){return n.charAt(0)==="/"||Ot.test(n)};function Sn(n,e){n===""&&(n="."),n=n.replace(/\/$/,"");for(var t=0;e.indexOf(n+"/")!==0;){var r=n.lastIndexOf("/");if(r<0||(n=n.slice(0,r),n.match(/^([^\/]+:\/)?\/*$/)))return e;++t}return Array(t+1).join("../")+e.substr(n.length+1)}A.relative=Sn;var At=function(){var n=Object.create(null);return!("__proto__"in n)}();function Et(n){return n}function wn(n){return xt(n)?"$"+n:n}A.toSetString=At?Et:wn;function On(n){return xt(n)?n.slice(1):n}A.fromSetString=At?Et:On;function xt(n){if(!n)return!1;var e=n.length;if(e<9||n.charCodeAt(e-1)!==95||n.charCodeAt(e-2)!==95||n.charCodeAt(e-3)!==111||n.charCodeAt(e-4)!==116||n.charCodeAt(e-5)!==111||n.charCodeAt(e-6)!==114||n.charCodeAt(e-7)!==112||n.charCodeAt(e-8)!==95||n.charCodeAt(e-9)!==95)return!1;for(var t=e-10;t>=0;t--)if(n.charCodeAt(t)!==36)return!1;return!0}function bn(n,e,t){var r=B(n.source,e.source);return r!==0||(r=n.originalLine-e.originalLine,r!==0)||(r=n.originalColumn-e.originalColumn,r!==0||t)||(r=n.generatedColumn-e.generatedColumn,r!==0)||(r=n.generatedLine-e.generatedLine,r!==0)?r:B(n.name,e.name)}A.compareByOriginalPositions=bn;function An(n,e,t){var r=n.generatedLine-e.generatedLine;return r!==0||(r=n.generatedColumn-e.generatedColumn,r!==0||t)||(r=B(n.source,e.source),r!==0)||(r=n.originalLine-e.originalLine,r!==0)||(r=n.originalColumn-e.originalColumn,r!==0)?r:B(n.name,e.name)}A.compareByGeneratedPositionsDeflated=An;function B(n,e){return n===e?0:n===null?1:e===null?-1:n>e?1:-1}function En(n,e){var t=n.generatedLine-e.generatedLine;return t!==0||(t=n.generatedColumn-e.generatedColumn,t!==0)||(t=B(n.source,e.source),t!==0)||(t=n.originalLine-e.originalLine,t!==0)||(t=n.originalColumn-e.originalColumn,t!==0)?t:B(n.name,e.name)}A.compareByGeneratedPositionsInflated=En;function xn(n){return JSON.parse(n.replace(/^\)]}'[^\n]*\n/,""))}A.parseSourceMapInput=xn;function kn(n,e,t){if(e=e||"",n&&(n[n.length-1]!=="/"&&e[0]!=="/"&&(n+="/"),e=n+e),t){var r=X(t);if(!r)throw new Error("sourceMapURL could not be parsed");if(r.path){var i=r.path.lastIndexOf("/");i>=0&&(r.path=r.path.substring(0,i+1))}e=bt(U(r),e)}return Se(e)}A.computeSourceURL=kn});var be=g(kt=>{var we=z(),Oe=Object.prototype.hasOwnProperty,R=typeof Map<"u";function N(){this._array=[],this._set=R?new Map:Object.create(null)}N.fromArray=function(e,t){for(var r=new N,i=0,s=e.length;i<s;i++)r.add(e[i],t);return r};N.prototype.size=function(){return R?this._set.size:Object.getOwnPropertyNames(this._set).length};N.prototype.add=function(e,t){var r=R?e:we.toSetString(e),i=R?this.has(e):Oe.call(this._set,r),s=this._array.length;(!i||t)&&this._array.push(e),i||(R?this._set.set(e,s):this._set[r]=s)};N.prototype.has=function(e){if(R)return this._set.has(e);var t=we.toSetString(e);return Oe.call(this._set,t)};N.prototype.indexOf=function(e){if(R){var t=this._set.get(e);if(t>=0)return t}else{var r=we.toSetString(e);if(Oe.call(this._set,r))return this._set[r]}throw new Error('"'+e+'" is not in the set.')};N.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)};N.prototype.toArray=function(){return this._array.slice()};kt.ArraySet=N});var $t=g(Lt=>{var Mt=z();function Mn(n,e){var t=n.generatedLine,r=e.generatedLine,i=n.generatedColumn,s=e.generatedColumn;return r>t||r==t&&s>=i||Mt.compareByGeneratedPositionsInflated(n,e)<=0}function oe(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}oe.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)};oe.prototype.add=function(e){Mn(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))};oe.prototype.toArray=function(){return this._sorted||(this._array.sort(Mt.compareByGeneratedPositionsInflated),this._sorted=!0),this._array};Lt.MappingList=oe});var Ae=g(Nt=>{var Z=Ce(),w=z(),ae=be().ArraySet,Ln=$t().MappingList;function x(n){n||(n={}),this._file=w.getArg(n,"file",null),this._sourceRoot=w.getArg(n,"sourceRoot",null),this._skipValidation=w.getArg(n,"skipValidation",!1),this._sources=new ae,this._names=new ae,this._mappings=new Ln,this._sourcesContents=null}x.prototype._version=3;x.fromSourceMap=function(e){var t=e.sourceRoot,r=new x({file:e.file,sourceRoot:t});return e.eachMapping(function(i){var s={generated:{line:i.generatedLine,column:i.generatedColumn}};i.source!=null&&(s.source=i.source,t!=null&&(s.source=w.relative(t,s.source)),s.original={line:i.originalLine,column:i.originalColumn},i.name!=null&&(s.name=i.name)),r.addMapping(s)}),e.sources.forEach(function(i){var s=i;t!==null&&(s=w.relative(t,i)),r._sources.has(s)||r._sources.add(s);var o=e.sourceContentFor(i);o!=null&&r.setSourceContent(i,o)}),r};x.prototype.addMapping=function(e){var t=w.getArg(e,"generated"),r=w.getArg(e,"original",null),i=w.getArg(e,"source",null),s=w.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,i,s),i!=null&&(i=String(i),this._sources.has(i)||this._sources.add(i)),s!=null&&(s=String(s),this._names.has(s)||this._names.add(s)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:r!=null&&r.line,originalColumn:r!=null&&r.column,source:i,name:s})};x.prototype.setSourceContent=function(e,t){var r=e;this._sourceRoot!=null&&(r=w.relative(this._sourceRoot,r)),t!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[w.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[w.toSetString(r)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))};x.prototype.applySourceMap=function(e,t,r){var i=t;if(t==null){if(e.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);i=e.file}var s=this._sourceRoot;s!=null&&(i=w.relative(s,i));var o=new ae,a=new ae;this._mappings.unsortedForEach(function(m){if(m.source===i&&m.originalLine!=null){var u=e.originalPositionFor({line:m.originalLine,column:m.originalColumn});u.source!=null&&(m.source=u.source,r!=null&&(m.source=w.join(r,m.source)),s!=null&&(m.source=w.relative(s,m.source)),m.originalLine=u.line,m.originalColumn=u.column,u.name!=null&&(m.name=u.name))}var l=m.source;l!=null&&!o.has(l)&&o.add(l);var c=m.name;c!=null&&!a.has(c)&&a.add(c)},this),this._sources=o,this._names=a,e.sources.forEach(function(m){var u=e.sourceContentFor(m);u!=null&&(r!=null&&(m=w.join(r,m)),s!=null&&(m=w.relative(s,m)),this.setSourceContent(m,u))},this)};x.prototype._validateMapping=function(e,t,r,i){if(t&&typeof t.line!="number"&&typeof t.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!i)){if(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r)return;throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:i}))}};x.prototype._serializeMappings=function(){for(var e=0,t=1,r=0,i=0,s=0,o=0,a="",m,u,l,c,p=this._mappings.toArray(),f=0,_=p.length;f<_;f++){if(u=p[f],m="",u.generatedLine!==t)for(e=0;u.generatedLine!==t;)m+=";",t++;else if(f>0){if(!w.compareByGeneratedPositionsInflated(u,p[f-1]))continue;m+=","}m+=Z.encode(u.generatedColumn-e),e=u.generatedColumn,u.source!=null&&(c=this._sources.indexOf(u.source),m+=Z.encode(c-o),o=c,m+=Z.encode(u.originalLine-1-i),i=u.originalLine-1,m+=Z.encode(u.originalColumn-r),r=u.originalColumn,u.name!=null&&(l=this._names.indexOf(u.name),m+=Z.encode(l-s),s=l)),a+=m}return a};x.prototype._generateSourcesContent=function(e,t){return e.map(function(r){if(!this._sourcesContents)return null;t!=null&&(r=w.relative(t,r));var i=w.toSetString(r);return Object.prototype.hasOwnProperty.call(this._sourcesContents,i)?this._sourcesContents[i]:null},this)};x.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(e.file=this._file),this._sourceRoot!=null&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e};x.prototype.toString=function(){return JSON.stringify(this.toJSON())};Nt.SourceMapGenerator=x});var Tt=g(V=>{V.GREATEST_LOWER_BOUND=1;V.LEAST_UPPER_BOUND=2;function Ee(n,e,t,r,i,s){var o=Math.floor((e-n)/2)+n,a=i(t,r[o],!0);return a===0?o:a>0?e-o>1?Ee(o,e,t,r,i,s):s==V.LEAST_UPPER_BOUND?e<r.length?e:-1:o:o-n>1?Ee(n,o,t,r,i,s):s==V.LEAST_UPPER_BOUND?o:n<0?-1:n}V.search=function(e,t,r,i){if(t.length===0)return-1;var s=Ee(-1,t.length,e,t,r,i||V.GREATEST_LOWER_BOUND);if(s<0)return-1;for(;s-1>=0&&r(t[s],t[s-1],!0)===0;)--s;return s}});var Dt=g(Pt=>{function xe(n,e,t){var r=n[e];n[e]=n[t],n[t]=r}function $n(n,e){return Math.round(n+Math.random()*(e-n))}function ke(n,e,t,r){if(t<r){var i=$n(t,r),s=t-1;xe(n,i,r);for(var o=n[r],a=t;a<r;a++)e(n[a],o)<=0&&(s+=1,xe(n,s,a));xe(n,s+1,a);var m=s+1;ke(n,e,t,m-1),ke(n,e,m+1,r)}}Pt.quickSort=function(n,e){ke(n,e,0,n.length-1)}});var Rt=g(me=>{var h=z(),Me=Tt(),J=be().ArraySet,Nn=Ce(),ee=Dt().quickSort;function C(n,e){var t=n;return typeof n=="string"&&(t=h.parseSourceMapInput(n)),t.sections!=null?new M(t,e):new O(t,e)}C.fromSourceMap=function(n,e){return O.fromSourceMap(n,e)};C.prototype._version=3;C.prototype.__generatedMappings=null;Object.defineProperty(C.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}});C.prototype.__originalMappings=null;Object.defineProperty(C.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}});C.prototype._charIsMappingSeparator=function(e,t){var r=e.charAt(t);return r===";"||r===","};C.prototype._parseMappings=function(e,t){throw new Error("Subclasses must implement _parseMappings")};C.GENERATED_ORDER=1;C.ORIGINAL_ORDER=2;C.GREATEST_LOWER_BOUND=1;C.LEAST_UPPER_BOUND=2;C.prototype.eachMapping=function(e,t,r){var i=t||null,s=r||C.GENERATED_ORDER,o;switch(s){case C.GENERATED_ORDER:o=this._generatedMappings;break;case C.ORIGINAL_ORDER:o=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var a=this.sourceRoot;o.map(function(m){var u=m.source===null?null:this._sources.at(m.source);return u=h.computeSourceURL(a,u,this._sourceMapURL),{source:u,generatedLine:m.generatedLine,generatedColumn:m.generatedColumn,originalLine:m.originalLine,originalColumn:m.originalColumn,name:m.name===null?null:this._names.at(m.name)}},this).forEach(e,i)};C.prototype.allGeneratedPositionsFor=function(e){var t=h.getArg(e,"line"),r={source:h.getArg(e,"source"),originalLine:t,originalColumn:h.getArg(e,"column",0)};if(r.source=this._findSourceIndex(r.source),r.source<0)return[];var i=[],s=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",h.compareByOriginalPositions,Me.LEAST_UPPER_BOUND);if(s>=0){var o=this._originalMappings[s];if(e.column===void 0)for(var a=o.originalLine;o&&o.originalLine===a;)i.push({line:h.getArg(o,"generatedLine",null),column:h.getArg(o,"generatedColumn",null),lastColumn:h.getArg(o,"lastGeneratedColumn",null)}),o=this._originalMappings[++s];else for(var m=o.originalColumn;o&&o.originalLine===t&&o.originalColumn==m;)i.push({line:h.getArg(o,"generatedLine",null),column:h.getArg(o,"generatedColumn",null),lastColumn:h.getArg(o,"lastGeneratedColumn",null)}),o=this._originalMappings[++s]}return i};me.SourceMapConsumer=C;function O(n,e){var t=n;typeof n=="string"&&(t=h.parseSourceMapInput(n));var r=h.getArg(t,"version"),i=h.getArg(t,"sources"),s=h.getArg(t,"names",[]),o=h.getArg(t,"sourceRoot",null),a=h.getArg(t,"sourcesContent",null),m=h.getArg(t,"mappings"),u=h.getArg(t,"file",null);if(r!=this._version)throw new Error("Unsupported version: "+r);o&&(o=h.normalize(o)),i=i.map(String).map(h.normalize).map(function(l){return o&&h.isAbsolute(o)&&h.isAbsolute(l)?h.relative(o,l):l}),this._names=J.fromArray(s.map(String),!0),this._sources=J.fromArray(i,!0),this._absoluteSources=this._sources.toArray().map(function(l){return h.computeSourceURL(o,l,e)}),this.sourceRoot=o,this.sourcesContent=a,this._mappings=m,this._sourceMapURL=e,this.file=u}O.prototype=Object.create(C.prototype);O.prototype.consumer=C;O.prototype._findSourceIndex=function(n){var e=n;if(this.sourceRoot!=null&&(e=h.relative(this.sourceRoot,e)),this._sources.has(e))return this._sources.indexOf(e);var t;for(t=0;t<this._absoluteSources.length;++t)if(this._absoluteSources[t]==n)return t;return-1};O.fromSourceMap=function(e,t){var r=Object.create(O.prototype),i=r._names=J.fromArray(e._names.toArray(),!0),s=r._sources=J.fromArray(e._sources.toArray(),!0);r.sourceRoot=e._sourceRoot,r.sourcesContent=e._generateSourcesContent(r._sources.toArray(),r.sourceRoot),r.file=e._file,r._sourceMapURL=t,r._absoluteSources=r._sources.toArray().map(function(f){return h.computeSourceURL(r.sourceRoot,f,t)});for(var o=e._mappings.toArray().slice(),a=r.__generatedMappings=[],m=r.__originalMappings=[],u=0,l=o.length;u<l;u++){var c=o[u],p=new It;p.generatedLine=c.generatedLine,p.generatedColumn=c.generatedColumn,c.source&&(p.source=s.indexOf(c.source),p.originalLine=c.originalLine,p.originalColumn=c.originalColumn,c.name&&(p.name=i.indexOf(c.name)),m.push(p)),a.push(p)}return ee(r.__originalMappings,h.compareByOriginalPositions),r};O.prototype._version=3;Object.defineProperty(O.prototype,"sources",{get:function(){return this._absoluteSources.slice()}});function It(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}O.prototype._parseMappings=function(e,t){for(var r=1,i=0,s=0,o=0,a=0,m=0,u=e.length,l=0,c={},p={},f=[],_=[],S,G,b,q,dt;l<u;)if(e.charAt(l)===";")r++,l++,i=0;else if(e.charAt(l)===",")l++;else{for(S=new It,S.generatedLine=r,q=l;q<u&&!this._charIsMappingSeparator(e,q);q++);if(G=e.slice(l,q),b=c[G],b)l+=G.length;else{for(b=[];l<q;)Nn.decode(e,l,p),dt=p.value,l=p.rest,b.push(dt);if(b.length===2)throw new Error("Found a source, but no line and column");if(b.length===3)throw new Error("Found a source and line, but no column");c[G]=b}S.generatedColumn=i+b[0],i=S.generatedColumn,b.length>1&&(S.source=a+b[1],a+=b[1],S.originalLine=s+b[2],s=S.originalLine,S.originalLine+=1,S.originalColumn=o+b[3],o=S.originalColumn,b.length>4&&(S.name=m+b[4],m+=b[4])),_.push(S),typeof S.originalLine=="number"&&f.push(S)}ee(_,h.compareByGeneratedPositionsDeflated),this.__generatedMappings=_,ee(f,h.compareByOriginalPositions),this.__originalMappings=f};O.prototype._findMapping=function(e,t,r,i,s,o){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[i]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[i]);return Me.search(e,t,s,o)};O.prototype.computeColumnSpans=function(){for(var e=0;e<this._generatedMappings.length;++e){var t=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var r=this._generatedMappings[e+1];if(t.generatedLine===r.generatedLine){t.lastGeneratedColumn=r.generatedColumn-1;continue}}t.lastGeneratedColumn=1/0}};O.prototype.originalPositionFor=function(e){var t={generatedLine:h.getArg(e,"line"),generatedColumn:h.getArg(e,"column")},r=this._findMapping(t,this._generatedMappings,"generatedLine","generatedColumn",h.compareByGeneratedPositionsDeflated,h.getArg(e,"bias",C.GREATEST_LOWER_BOUND));if(r>=0){var i=this._generatedMappings[r];if(i.generatedLine===t.generatedLine){var s=h.getArg(i,"source",null);s!==null&&(s=this._sources.at(s),s=h.computeSourceURL(this.sourceRoot,s,this._sourceMapURL));var o=h.getArg(i,"name",null);return o!==null&&(o=this._names.at(o)),{source:s,line:h.getArg(i,"originalLine",null),column:h.getArg(i,"originalColumn",null),name:o}}}return{source:null,line:null,column:null,name:null}};O.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return e==null}):!1};O.prototype.sourceContentFor=function(e,t){if(!this.sourcesContent)return null;var r=this._findSourceIndex(e);if(r>=0)return this.sourcesContent[r];var i=e;this.sourceRoot!=null&&(i=h.relative(this.sourceRoot,i));var s;if(this.sourceRoot!=null&&(s=h.urlParse(this.sourceRoot))){var o=i.replace(/^file:\/\//,"");if(s.scheme=="file"&&this._sources.has(o))return this.sourcesContent[this._sources.indexOf(o)];if((!s.path||s.path=="/")&&this._sources.has("/"+i))return this.sourcesContent[this._sources.indexOf("/"+i)]}if(t)return null;throw new Error('"'+i+'" is not in the SourceMap.')};O.prototype.generatedPositionFor=function(e){var t=h.getArg(e,"source");if(t=this._findSourceIndex(t),t<0)return{line:null,column:null,lastColumn:null};var r={source:t,originalLine:h.getArg(e,"line"),originalColumn:h.getArg(e,"column")},i=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",h.compareByOriginalPositions,h.getArg(e,"bias",C.GREATEST_LOWER_BOUND));if(i>=0){var s=this._originalMappings[i];if(s.source===r.source)return{line:h.getArg(s,"generatedLine",null),column:h.getArg(s,"generatedColumn",null),lastColumn:h.getArg(s,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}};me.BasicSourceMapConsumer=O;function M(n,e){var t=n;typeof n=="string"&&(t=h.parseSourceMapInput(n));var r=h.getArg(t,"version"),i=h.getArg(t,"sections");if(r!=this._version)throw new Error("Unsupported version: "+r);this._sources=new J,this._names=new J;var s={line:-1,column:0};this._sections=i.map(function(o){if(o.url)throw new Error("Support for url field in sections not implemented.");var a=h.getArg(o,"offset"),m=h.getArg(a,"line"),u=h.getArg(a,"column");if(m<s.line||m===s.line&&u<s.column)throw new Error("Section offsets must be ordered and non-overlapping.");return s=a,{generatedOffset:{generatedLine:m+1,generatedColumn:u+1},consumer:new C(h.getArg(o,"map"),e)}})}M.prototype=Object.create(C.prototype);M.prototype.constructor=C;M.prototype._version=3;Object.defineProperty(M.prototype,"sources",{get:function(){for(var n=[],e=0;e<this._sections.length;e++)for(var t=0;t<this._sections[e].consumer.sources.length;t++)n.push(this._sections[e].consumer.sources[t]);return n}});M.prototype.originalPositionFor=function(e){var t={generatedLine:h.getArg(e,"line"),generatedColumn:h.getArg(e,"column")},r=Me.search(t,this._sections,function(s,o){var a=s.generatedLine-o.generatedOffset.generatedLine;return a||s.generatedColumn-o.generatedOffset.generatedColumn}),i=this._sections[r];return i?i.consumer.originalPositionFor({line:t.generatedLine-(i.generatedOffset.generatedLine-1),column:t.generatedColumn-(i.generatedOffset.generatedLine===t.generatedLine?i.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}};M.prototype.hasContentsOfAllSources=function(){return this._sections.every(function(e){return e.consumer.hasContentsOfAllSources()})};M.prototype.sourceContentFor=function(e,t){for(var r=0;r<this._sections.length;r++){var i=this._sections[r],s=i.consumer.sourceContentFor(e,!0);if(s)return s}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')};M.prototype.generatedPositionFor=function(e){for(var t=0;t<this._sections.length;t++){var r=this._sections[t];if(r.consumer._findSourceIndex(h.getArg(e,"source"))!==-1){var i=r.consumer.generatedPositionFor(e);if(i){var s={line:i.line+(r.generatedOffset.generatedLine-1),column:i.column+(r.generatedOffset.generatedLine===i.line?r.generatedOffset.generatedColumn-1:0)};return s}}}return{line:null,column:null}};M.prototype._parseMappings=function(e,t){this.__generatedMappings=[],this.__originalMappings=[];for(var r=0;r<this._sections.length;r++)for(var i=this._sections[r],s=i.consumer._generatedMappings,o=0;o<s.length;o++){var a=s[o],m=i.consumer._sources.at(a.source);m=h.computeSourceURL(i.consumer.sourceRoot,m,this._sourceMapURL),this._sources.add(m),m=this._sources.indexOf(m);var u=null;a.name&&(u=i.consumer._names.at(a.name),this._names.add(u),u=this._names.indexOf(u));var l={source:m,generatedLine:a.generatedLine+(i.generatedOffset.generatedLine-1),generatedColumn:a.generatedColumn+(i.generatedOffset.generatedLine===a.generatedLine?i.generatedOffset.generatedColumn-1:0),originalLine:a.originalLine,originalColumn:a.originalColumn,name:u};this.__generatedMappings.push(l),typeof l.originalLine=="number"&&this.__originalMappings.push(l)}ee(this.__generatedMappings,h.compareByGeneratedPositionsDeflated),ee(this.__originalMappings,h.compareByOriginalPositions)};me.IndexedSourceMapConsumer=M});var jt=g(Vt=>{var Tn=Ae().SourceMapGenerator,ue=z(),Pn=/(\r?\n)/,Dn=10,K="$$$isSourceNode$$$";function E(n,e,t,r,i){this.children=[],this.sourceContents={},this.line=n??null,this.column=e??null,this.source=t??null,this.name=i??null,this[K]=!0,r!=null&&this.add(r)}E.fromStringWithSourceMap=function(e,t,r){var i=new E,s=e.split(Pn),o=0,a=function(){var p=_(),f=_()||"";return p+f;function _(){return o<s.length?s[o++]:void 0}},m=1,u=0,l=null;return t.eachMapping(function(p){if(l!==null)if(m<p.generatedLine)c(l,a()),m++,u=0;else{var f=s[o]||"",_=f.substr(0,p.generatedColumn-u);s[o]=f.substr(p.generatedColumn-u),u=p.generatedColumn,c(l,_),l=p;return}for(;m<p.generatedLine;)i.add(a()),m++;if(u<p.generatedColumn){var f=s[o]||"";i.add(f.substr(0,p.generatedColumn)),s[o]=f.substr(p.generatedColumn),u=p.generatedColumn}l=p},this),o<s.length&&(l&&c(l,a()),i.add(s.splice(o).join(""))),t.sources.forEach(function(p){var f=t.sourceContentFor(p);f!=null&&(r!=null&&(p=ue.join(r,p)),i.setSourceContent(p,f))}),i;function c(p,f){if(p===null||p.source===void 0)i.add(f);else{var _=r?ue.join(r,p.source):p.source;i.add(new E(p.originalLine,p.originalColumn,_,f,p.name))}}};E.prototype.add=function(e){if(Array.isArray(e))e.forEach(function(t){this.add(t)},this);else if(e[K]||typeof e=="string")e&&this.children.push(e);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);return this};E.prototype.prepend=function(e){if(Array.isArray(e))for(var t=e.length-1;t>=0;t--)this.prepend(e[t]);else if(e[K]||typeof e=="string")this.children.unshift(e);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);return this};E.prototype.walk=function(e){for(var t,r=0,i=this.children.length;r<i;r++)t=this.children[r],t[K]?t.walk(e):t!==""&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})};E.prototype.join=function(e){var t,r,i=this.children.length;if(i>0){for(t=[],r=0;r<i-1;r++)t.push(this.children[r]),t.push(e);t.push(this.children[r]),this.children=t}return this};E.prototype.replaceRight=function(e,t){var r=this.children[this.children.length-1];return r[K]?r.replaceRight(e,t):typeof r=="string"?this.children[this.children.length-1]=r.replace(e,t):this.children.push("".replace(e,t)),this};E.prototype.setSourceContent=function(e,t){this.sourceContents[ue.toSetString(e)]=t};E.prototype.walkSourceContents=function(e){for(var t=0,r=this.children.length;t<r;t++)this.children[t][K]&&this.children[t].walkSourceContents(e);for(var i=Object.keys(this.sourceContents),t=0,r=i.length;t<r;t++)e(ue.fromSetString(i[t]),this.sourceContents[i[t]])};E.prototype.toString=function(){var e="";return this.walk(function(t){e+=t}),e};E.prototype.toStringWithSourceMap=function(e){var t={code:"",line:1,column:0},r=new Tn(e),i=!1,s=null,o=null,a=null,m=null;return this.walk(function(u,l){t.code+=u,l.source!==null&&l.line!==null&&l.column!==null?((s!==l.source||o!==l.line||a!==l.column||m!==l.name)&&r.addMapping({source:l.source,original:{line:l.line,column:l.column},generated:{line:t.line,column:t.column},name:l.name}),s=l.source,o=l.line,a=l.column,m=l.name,i=!0):i&&(r.addMapping({generated:{line:t.line,column:t.column}}),s=null,i=!1);for(var c=0,p=u.length;c<p;c++)u.charCodeAt(c)===Dn?(t.line++,t.column=0,c+1===p?(s=null,i=!1):i&&r.addMapping({source:l.source,original:{line:l.line,column:l.column},generated:{line:t.line,column:t.column},name:l.name})):t.column++}),this.walkSourceContents(function(u,l){r.setSourceContent(u,l)}),{code:t.code,map:r}};Vt.SourceNode=E});var Ht=g(le=>{le.SourceMapGenerator=Ae().SourceMapGenerator;le.SourceMapConsumer=Rt().SourceMapConsumer;le.SourceNode=jt().SourceNode});var Gt=g((us,Ft)=>{var In=Object.prototype.toString,Le=typeof Buffer<"u"&&typeof Buffer.alloc=="function"&&typeof Buffer.allocUnsafe=="function"&&typeof Buffer.from=="function";function Rn(n){return In.call(n).slice(8,-1)==="ArrayBuffer"}function Vn(n,e,t){e>>>=0;var r=n.byteLength-e;if(r<0)throw new RangeError("'offset' is out of bounds");if(t===void 0)t=r;else if(t>>>=0,t>r)throw new RangeError("'length' is out of bounds");return Le?Buffer.from(n.slice(e,e+t)):new Buffer(new Uint8Array(n.slice(e,e+t)))}function jn(n,e){if((typeof e!="string"||e==="")&&(e="utf8"),!Buffer.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');return Le?Buffer.from(n,e):new Buffer(n,e)}function Hn(n,e,t){if(typeof n=="number")throw new TypeError('"value" argument must not be a number');return Rn(n)?Vn(n,e,t):typeof n=="string"?jn(n,e):Le?Buffer.from(n):new Buffer(n)}Ft.exports=Hn});var Qt=g((H,Pe)=>{var Fn=Ht().SourceMapConsumer,$e=require("path"),L;try{L=require("fs"),(!L.existsSync||!L.readFileSync)&&(L=null)}catch{}var Gn=Gt();function qt(n,e){return n.require(e)}var Wt=!1,Ut=!1,Ne=!1,te="auto",j={},re={},qn=/^data:application\/json[^,]+base64,/,D=[],I=[];function De(){return te==="browser"?!0:te==="node"?!1:typeof window<"u"&&typeof XMLHttpRequest=="function"&&!(window.require&&window.module&&window.process&&window.process.type==="renderer")}function Wn(){return typeof process=="object"&&process!==null&&typeof process.on=="function"}function Un(){return typeof process=="object"&&process!==null?process.version:""}function Bn(){if(typeof process=="object"&&process!==null)return process.stderr}function zn(n){if(typeof process=="object"&&process!==null&&typeof process.exit=="function")return process.exit(n)}function ce(n){return function(e){for(var t=0;t<n.length;t++){var r=n[t](e);if(r)return r}return null}}var Ie=ce(D);D.push(function(n){if(n=n.trim(),/^file:/.test(n)&&(n=n.replace(/file:\/\/\/(\w:)?/,function(r,i){return i?"":"/"})),n in j)return j[n];var e="";try{if(L)L.existsSync(n)&&(e=L.readFileSync(n,"utf8"));else{var t=new XMLHttpRequest;t.open("GET",n,!1),t.send(null),t.readyState===4&&t.status===200&&(e=t.responseText)}}catch{}return j[n]=e});function Te(n,e){if(!n)return e;var t=$e.dirname(n),r=/^\w+:\/\/[^\/]*/.exec(t),i=r?r[0]:"",s=t.slice(i.length);return i&&/^\/\w\:/.test(s)?(i+="/",i+$e.resolve(t.slice(i.length),e).replace(/\\/g,"/")):i+$e.resolve(t.slice(i.length),e)}function Jn(n){var e;if(De())try{var t=new XMLHttpRequest;t.open("GET",n,!1),t.send(null),e=t.readyState===4?t.responseText:null;var r=t.getResponseHeader("SourceMap")||t.getResponseHeader("X-SourceMap");if(r)return r}catch{}e=Ie(n);for(var i=/(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg,s,o;o=i.exec(e);)s=o;return s?s[1]:null}var Re=ce(I);I.push(function(n){var e=Jn(n);if(!e)return null;var t;if(qn.test(e)){var r=e.slice(e.indexOf(",")+1);t=Gn(r,"base64").toString(),e=n}else e=Te(n,e),t=Ie(e);return t?{url:e,map:t}:null});function Ve(n){var e=re[n.source];if(!e){var t=Re(n.source);t?(e=re[n.source]={url:t.url,map:new Fn(t.map)},e.map.sourcesContent&&e.map.sources.forEach(function(i,s){var o=e.map.sourcesContent[s];if(o){var a=Te(e.url,i);j[a]=o}})):e=re[n.source]={url:null,map:null}}if(e&&e.map&&typeof e.map.originalPositionFor=="function"){var r=e.map.originalPositionFor(n);if(r.source!==null)return r.source=Te(e.url,r.source),r}return n}function zt(n){var e=/^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(n);if(e){var t=Ve({source:e[2],line:+e[3],column:e[4]-1});return"eval at "+e[1]+" ("+t.source+":"+t.line+":"+(t.column+1)+")"}return e=/^eval at ([^(]+) \((.+)\)$/.exec(n),e?"eval at "+e[1]+" ("+zt(e[2])+")":n}function Kn(){var n,e="";if(this.isNative())e="native";else{n=this.getScriptNameOrSourceURL(),!n&&this.isEval()&&(e=this.getEvalOrigin(),e+=", "),n?e+=n:e+="<anonymous>";var t=this.getLineNumber();if(t!=null){e+=":"+t;var r=this.getColumnNumber();r&&(e+=":"+r)}}var i="",s=this.getFunctionName(),o=!0,a=this.isConstructor(),m=!(this.isToplevel()||a);if(m){var u=this.getTypeName();u==="[object Object]"&&(u="null");var l=this.getMethodName();s?(u&&s.indexOf(u)!=0&&(i+=u+"."),i+=s,l&&s.indexOf("."+l)!=s.length-l.length-1&&(i+=" [as "+l+"]")):i+=u+"."+(l||"<anonymous>")}else a?i+="new "+(s||"<anonymous>"):s?i+=s:(i+=e,o=!1);return o&&(i+=" ("+e+")"),i}function Bt(n){var e={};return Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(function(t){e[t]=/^(?:is|get)/.test(t)?function(){return n[t].call(n)}:n[t]}),e.toString=Kn,e}function Jt(n,e){if(e===void 0&&(e={nextPosition:null,curPosition:null}),n.isNative())return e.curPosition=null,n;var t=n.getFileName()||n.getScriptNameOrSourceURL();if(t){var r=n.getLineNumber(),i=n.getColumnNumber()-1,s=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/,o=s.test(Un())?0:62;r===1&&i>o&&!De()&&!n.isEval()&&(i-=o);var a=Ve({source:t,line:r,column:i});e.curPosition=a,n=Bt(n);var m=n.getFunctionName;return n.getFunctionName=function(){return e.nextPosition==null?m():e.nextPosition.name||m()},n.getFileName=function(){return a.source},n.getLineNumber=function(){return a.line},n.getColumnNumber=function(){return a.column+1},n.getScriptNameOrSourceURL=function(){return a.source},n}var u=n.isEval()&&n.getEvalOrigin();return u&&(u=zt(u),n=Bt(n),n.getEvalOrigin=function(){return u}),n}function Qn(n,e){Ne&&(j={},re={});for(var t=n.name||"Error",r=n.message||"",i=t+": "+r,s={nextPosition:null,curPosition:null},o=[],a=e.length-1;a>=0;a--)o.push(`
3
+ at `+Jt(e[a],s)),s.nextPosition=s.curPosition;return s.curPosition=s.nextPosition=null,i+o.reverse().join("")}function Kt(n){var e=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(n.stack);if(e){var t=e[1],r=+e[2],i=+e[3],s=j[t];if(!s&&L&&L.existsSync(t))try{s=L.readFileSync(t,"utf8")}catch{s=""}if(s){var o=s.split(/(?:\r\n|\r|\n)/)[r-1];if(o)return t+":"+r+`
4
+ `+o+`
5
+ `+new Array(i).join(" ")+"^"}}return null}function Yn(n){var e=Kt(n),t=Bn();t&&t._handle&&t._handle.setBlocking&&t._handle.setBlocking(!0),e&&(console.error(),console.error(e)),console.error(n.stack),zn(1)}function Xn(){var n=process.emit;process.emit=function(e){if(e==="uncaughtException"){var t=arguments[1]&&arguments[1].stack,r=this.listeners(e).length>0;if(t&&!r)return Yn(arguments[1])}return n.apply(this,arguments)}}var Zn=D.slice(0),ei=I.slice(0);H.wrapCallSite=Jt;H.getErrorSource=Kt;H.mapSourcePosition=Ve;H.retrieveSourceMap=Re;H.install=function(n){if(n=n||{},n.environment&&(te=n.environment,["node","browser","auto"].indexOf(te)===-1))throw new Error("environment "+te+" was unknown. Available options are {auto, browser, node}");if(n.retrieveFile&&(n.overrideRetrieveFile&&(D.length=0),D.unshift(n.retrieveFile)),n.retrieveSourceMap&&(n.overrideRetrieveSourceMap&&(I.length=0),I.unshift(n.retrieveSourceMap)),n.hookRequire&&!De()){var e=qt(Pe,"module"),t=e.prototype._compile;t.__sourceMapSupport||(e.prototype._compile=function(s,o){return j[o]=s,re[o]=void 0,t.call(this,s,o)},e.prototype._compile.__sourceMapSupport=!0)}if(Ne||(Ne="emptyCacheBetweenOperations"in n?n.emptyCacheBetweenOperations:!1),Wt||(Wt=!0,Error.prepareStackTrace=Qn),!Ut){var r="handleUncaughtExceptions"in n?n.handleUncaughtExceptions:!0;try{var i=qt(Pe,"worker_threads");i.isMainThread===!1&&(r=!1)}catch{}r&&Wn()&&(Ut=!0,Xn())}};H.resetRetrieveHandlers=function(){D.length=0,I.length=0,D=Zn.slice(0),I=ei.slice(0),Re=ce(I),Ie=ce(D)}});var ne=g(He=>{var pe=class extends Error{constructor(e,t,r){super(r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},je=class extends pe{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};He.CommanderError=pe;He.InvalidArgumentError=je});var he=g(Ge=>{var{InvalidArgumentError:ti}=ne(),Fe=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new ti(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,r):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function ri(n){let e=n.name()+(n.variadic===!0?"...":"");return n.required?"<"+e+">":"["+e+"]"}Ge.Argument=Fe;Ge.humanReadableArgName=ri});var Ue=g(We=>{var{humanReadableArgName:ni}=he(),qe=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden),r=e._getHelpCommand();return r&&!r._hidden&&t.push(r),this.sortSubcommands&&t.sort((i,s)=>i.name().localeCompare(s.name())),t}compareOptions(e,t){let r=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return r(e).localeCompare(r(t))}visibleOptions(e){let t=e.options.filter(i=>!i.hidden),r=e._getHelpOption();if(r&&!r.hidden){let i=r.short&&e._findOption(r.short),s=r.long&&e._findOption(r.long);!i&&!s?t.push(r):r.long&&!s?t.push(e.createOption(r.long,r.description)):r.short&&!i&&t.push(e.createOption(r.short,r.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let r=e.parent;r;r=r.parent){let i=r.options.filter(s=>!s.hidden);t.push(...i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(r=>ni(r)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(i)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(i)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let r="";for(let i=e.parent;i;i=i.parent)r=i.name()+" "+r;return r+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}formatItemList(e,t,r){return t.length===0?[]:[r.styleTitle(e),...t,""]}groupItems(e,t,r){let i=new Map;return e.forEach(s=>{let o=r(s);i.has(o)||i.set(o,[])}),t.forEach(s=>{let o=r(s);i.has(o)||i.set(o,[]),i.get(o).push(s)}),i}formatHelp(e,t){let r=t.padWidth(e,t),i=t.helpWidth??80;function s(c,p){return t.formatItem(c,r,p,t)}let o=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],a=t.commandDescription(e);a.length>0&&(o=o.concat([t.boxWrap(t.styleCommandDescription(a),i),""]));let m=t.visibleArguments(e).map(c=>s(t.styleArgumentTerm(t.argumentTerm(c)),t.styleArgumentDescription(t.argumentDescription(c))));if(o=o.concat(this.formatItemList("Arguments:",m,t)),this.groupItems(e.options,t.visibleOptions(e),c=>c.helpGroupHeading??"Options:").forEach((c,p)=>{let f=c.map(_=>s(t.styleOptionTerm(t.optionTerm(_)),t.styleOptionDescription(t.optionDescription(_))));o=o.concat(this.formatItemList(p,f,t))}),t.showGlobalOptions){let c=t.visibleGlobalOptions(e).map(p=>s(t.styleOptionTerm(t.optionTerm(p)),t.styleOptionDescription(t.optionDescription(p))));o=o.concat(this.formatItemList("Global Options:",c,t))}return this.groupItems(e.commands,t.visibleCommands(e),c=>c.helpGroup()||"Commands:").forEach((c,p)=>{let f=c.map(_=>s(t.styleSubcommandTerm(t.subcommandTerm(_)),t.styleSubcommandDescription(t.subcommandDescription(_))));o=o.concat(this.formatItemList(p,f,t))}),o.join(`
6
+ `)}displayWidth(e){return Yt(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t==="[command]"?this.styleSubcommandText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleCommandText(t)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleSubcommandText(t)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,r,i){let o=" ".repeat(2);if(!r)return o+e;let a=e.padEnd(t+e.length-i.displayWidth(e)),m=2,l=(this.helpWidth??80)-t-m-2,c;return l<this.minWidthToWrap||i.preformatted(r)?c=r:c=i.boxWrap(r,l).replace(/\n/g,`
7
+ `+" ".repeat(t+m)),o+a+" ".repeat(m)+c.replace(/\n/g,`
8
+ ${o}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let r=e.split(/\r\n|\n/),i=/[\s]*[^\s]+/g,s=[];return r.forEach(o=>{let a=o.match(i);if(a===null){s.push("");return}let m=[a.shift()],u=this.displayWidth(m[0]);a.forEach(l=>{let c=this.displayWidth(l);if(u+c<=t){m.push(l),u+=c;return}s.push(m.join(""));let p=l.trimStart();m=[p],u=this.displayWidth(p)}),s.push(m.join(""))}),s.join(`
9
+ `)}};function Yt(n){let e=/\x1b\[\d*(;\d*)*m/g;return n.replace(e,"")}We.Help=qe;We.stripColor=Yt});var Ke=g(Je=>{var{InvalidArgumentError:ii}=ne(),Be=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let r=si(e);this.short=r.shortFlag,this.long=r.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new ii(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,r):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?Xt(this.name().replace(/^no-/,"")):Xt(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},ze=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,r)=>{this.positiveOptions.has(r)&&this.dualOptions.add(r)})}valueFromOption(e,t){let r=t.attributeName();if(!this.dualOptions.has(r))return!0;let i=this.negativeOptions.get(r).presetArg,s=i!==void 0?i:!1;return t.negate===(s===e)}};function Xt(n){return n.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function si(n){let e,t,r=/^-[^-]$/,i=/^--[^-]/,s=n.split(/[ |,]+/).concat("guard");if(r.test(s[0])&&(e=s.shift()),i.test(s[0])&&(t=s.shift()),!e&&r.test(s[0])&&(e=s.shift()),!e&&i.test(s[0])&&(e=t,t=s.shift()),s[0].startsWith("-")){let o=s[0],a=`option creation failed due to '${o}' in option flags '${n}'`;throw/^-[^-][^-]/.test(o)?new Error(`${a}
10
10
  - a short flag is a single dash and a single character
11
11
  - either use a single dash and a single character (for a short flag)
12
- - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):n.test(s)?new Error(`${a}
13
- - too many short flags`):o.test(s)?new Error(`${a}
12
+ - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):r.test(o)?new Error(`${a}
13
+ - too many short flags`):i.test(o)?new Error(`${a}
14
14
  - too many long flags`):new Error(`${a}
15
- - unrecognised flag format`)}if(e===void 0&&t===void 0)throw new Error(`option creation failed due to no flags found in '${r}'.`);return{shortFlag:e,longFlag:t}}nt.Option=tt;nt.DualOptions=rt});var pr=_(cr=>{function ni(r,e){if(Math.abs(r.length-e.length)>3)return Math.max(r.length,e.length);let t=[];for(let n=0;n<=r.length;n++)t[n]=[n];for(let n=0;n<=e.length;n++)t[0][n]=n;for(let n=1;n<=e.length;n++)for(let o=1;o<=r.length;o++){let i=1;r[o-1]===e[n-1]?i=0:i=1,t[o][n]=Math.min(t[o-1][n]+1,t[o][n-1]+1,t[o-1][n-1]+i),o>1&&n>1&&r[o-1]===e[n-2]&&r[o-2]===e[n-1]&&(t[o][n]=Math.min(t[o][n],t[o-2][n-2]+1))}return t[r.length][e.length]}function oi(r,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=r.startsWith("--");t&&(r=r.slice(2),e=e.map(s=>s.slice(2)));let n=[],o=3,i=.4;return e.forEach(s=>{if(s.length<=1)return;let a=ni(r,s),u=Math.max(r.length,s.length);(u-a)/u>i&&(a<o?(o=a,n=[s]):a===o&&n.push(s))}),n.sort((s,a)=>s.localeCompare(a)),t&&(n=n.map(s=>`--${s}`)),n.length>1?`
16
- (Did you mean one of ${n.join(", ")}?)`:n.length===1?`
17
- (Did you mean ${n[0]}?)`:""}cr.suggestSimilar=oi});var _r=_(ut=>{var ii=require("node:events").EventEmitter,it=require("node:child_process"),P=require("node:path"),ye=require("node:fs"),v=require("node:process"),{Argument:si,humanReadableArgName:ai}=xe(),{CommanderError:st}=me(),{Help:mi,stripColor:ui}=et(),{Option:dr,DualOptions:li}=ot(),{suggestSimilar:hr}=pr(),at=class r extends ii{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:t=>v.stdout.write(t),writeErr:t=>v.stderr.write(t),outputError:(t,n)=>n(t),getOutHelpWidth:()=>v.stdout.isTTY?v.stdout.columns:void 0,getErrHelpWidth:()=>v.stderr.isTTY?v.stderr.columns:void 0,getOutHasColors:()=>mt()??(v.stdout.isTTY&&v.stdout.hasColors?.()),getErrHasColors:()=>mt()??(v.stderr.isTTY&&v.stderr.hasColors?.()),stripColor:t=>ui(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let o=t,i=n;typeof o=="object"&&o!==null&&(i=o,o=null),i=i||{};let[,s,a]=e.match(/([^ ]+) *(.*)/),u=this.createCommand(s);return o&&(u.description(o),u._executableHandler=!0),i.isDefault&&(this._defaultCommandName=u._name),u._hidden=!!(i.noHelp||i.hidden),u._executableFile=i.executableFile||null,a&&u.arguments(a),this._registerCommand(u),u.parent=this,u.copyInheritedSettings(this),o?this:u}createCommand(e){return new r(e)}createHelp(){return Object.assign(new mi,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration=Object.assign({},this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
18
- - specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new si(e,t)}argument(e,t,n,o){let i=this.createArgument(e,t);return typeof n=="function"?i.default(o).argParser(n):i.default(n),this.addArgument(i),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=e??"help [command]",[,o,i]=n.match(/([^ ]+) *(.*)/),s=t??"display help for command",a=this.createCommand(o);return a.helpOption(!1),i&&a.arguments(i),s&&a.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||t)&&this._initCommandGroup(a),this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
19
- Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new st(e,t,n)),v.exit(e)}action(e){let t=n=>{let o=this.registeredArguments.length,i=n.slice(0,o);return this._storeOptionsAsProperties?i[o]=this:i[o]=this.opts(),i.push(this),e.apply(this,i)};return this._actionHandler=t,this}createOption(e,t){return new dr(e,t)}_callParseArg(e,t,n,o){try{return e.parseArg(t,n)}catch(i){if(i.code==="commander.invalidArgument"){let s=`${o} ${i.message}`;this.error(s,{exitCode:i.exitCode,code:i.code})}throw i}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
20
- - already used by option '${t.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let t=o=>[o.name()].concat(o.aliases()),n=t(e).find(o=>this._findCommand(o));if(n){let o=t(this._findCommand(n)).join("|"),i=t(e).join("|");throw new Error(`cannot add command '${i}' as already have command '${o}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();if(e.negate){let i=e.long.replace(/^--no-/,"--");this._findOption(i)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let o=(i,s,a)=>{i==null&&e.presetArg!==void 0&&(i=e.presetArg);let u=this.getOptionValue(n);i!==null&&e.parseArg?i=this._callParseArg(e,i,u,s):i!==null&&e.variadic&&(i=e._concatValue(i,u)),i==null&&(e.negate?i=!1:e.isBoolean()||e.optional?i=!0:i=""),this.setOptionValueWithSource(n,i,a)};return this.on("option:"+t,i=>{let s=`error: option '${e.flags}' argument '${i}' is invalid.`;o(i,s,"cli")}),e.envVar&&this.on("optionEnv:"+t,i=>{let s=`error: option '${e.flags}' value '${i}' from env '${e.envVar}' is invalid.`;o(i,s,"env")}),this}_optionEx(e,t,n,o,i){if(typeof t=="object"&&t instanceof dr)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(t,n);if(s.makeOptionMandatory(!!e.mandatory),typeof o=="function")s.default(i).argParser(o);else if(o instanceof RegExp){let a=o;o=(u,m)=>{let l=a.exec(u);return l?l[0]:m},s.default(i).argParser(o)}else s.default(o);return this.addOption(s)}option(e,t,n,o){return this._optionEx({},e,t,n,o)}requiredOption(e,t,n,o){return this._optionEx({mandatory:!0},e,t,n,o)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){v.versions?.electron&&(t.from="electron");let o=v.execArgv??[];(o.includes("-e")||o.includes("--eval")||o.includes("-p")||o.includes("--print"))&&(t.from="eval")}e===void 0&&(e=v.argv),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":v.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
21
- - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,t,n){if(ye.existsSync(e))return;let o=t?`searched for local subcommand relative to directory '${t}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",i=`'${e}' does not exist
22
- - if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
15
+ - unrecognised flag format`)}if(e===void 0&&t===void 0)throw new Error(`option creation failed due to no flags found in '${n}'.`);return{shortFlag:e,longFlag:t}}Je.Option=Be;Je.DualOptions=ze});var er=g(Zt=>{function oi(n,e){if(Math.abs(n.length-e.length)>3)return Math.max(n.length,e.length);let t=[];for(let r=0;r<=n.length;r++)t[r]=[r];for(let r=0;r<=e.length;r++)t[0][r]=r;for(let r=1;r<=e.length;r++)for(let i=1;i<=n.length;i++){let s=1;n[i-1]===e[r-1]?s=0:s=1,t[i][r]=Math.min(t[i-1][r]+1,t[i][r-1]+1,t[i-1][r-1]+s),i>1&&r>1&&n[i-1]===e[r-2]&&n[i-2]===e[r-1]&&(t[i][r]=Math.min(t[i][r],t[i-2][r-2]+1))}return t[n.length][e.length]}function ai(n,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=n.startsWith("--");t&&(n=n.slice(2),e=e.map(o=>o.slice(2)));let r=[],i=3,s=.4;return e.forEach(o=>{if(o.length<=1)return;let a=oi(n,o),m=Math.max(n.length,o.length);(m-a)/m>s&&(a<i?(i=a,r=[o]):a===i&&r.push(o))}),r.sort((o,a)=>o.localeCompare(a)),t&&(r=r.map(o=>`--${o}`)),r.length>1?`
16
+ (Did you mean one of ${r.join(", ")}?)`:r.length===1?`
17
+ (Did you mean ${r[0]}?)`:""}Zt.suggestSimilar=ai});var ir=g(et=>{var mi=require("node:events").EventEmitter,Qe=require("node:child_process"),T=require("node:path"),fe=require("node:fs"),v=require("node:process"),{Argument:ui,humanReadableArgName:li}=he(),{CommanderError:Ye}=ne(),{Help:ci,stripColor:pi}=Ue(),{Option:tr,DualOptions:hi}=Ke(),{suggestSimilar:rr}=er(),Xe=class n extends mi{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:t=>v.stdout.write(t),writeErr:t=>v.stderr.write(t),outputError:(t,r)=>r(t),getOutHelpWidth:()=>v.stdout.isTTY?v.stdout.columns:void 0,getErrHelpWidth:()=>v.stderr.isTTY?v.stderr.columns:void 0,getOutHasColors:()=>Ze()??(v.stdout.isTTY&&v.stdout.hasColors?.()),getErrHasColors:()=>Ze()??(v.stderr.isTTY&&v.stderr.hasColors?.()),stripColor:t=>pi(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,r){let i=t,s=r;typeof i=="object"&&i!==null&&(s=i,i=null),s=s||{};let[,o,a]=e.match(/([^ ]+) *(.*)/),m=this.createCommand(o);return i&&(m.description(i),m._executableHandler=!0),s.isDefault&&(this._defaultCommandName=m._name),m._hidden=!!(s.noHelp||s.hidden),m._executableFile=s.executableFile||null,a&&m.arguments(a),this._registerCommand(m),m.parent=this,m.copyInheritedSettings(this),i?this:m}createCommand(e){return new n(e)}createHelp(){return Object.assign(new ci,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration=Object.assign({},this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
18
+ - specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new ui(e,t)}argument(e,t,r,i){let s=this.createArgument(e,t);return typeof r=="function"?s.default(i).argParser(r):s.default(r),this.addArgument(s),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let r=e??"help [command]",[,i,s]=r.match(/([^ ]+) *(.*)/),o=t??"display help for command",a=this.createCommand(i);return a.helpOption(!1),s&&a.arguments(s),o&&a.description(o),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||t)&&this._initCommandGroup(a),this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let r=["preSubcommand","preAction","postAction"];if(!r.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
19
+ Expecting one of '${r.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,r){this._exitCallback&&this._exitCallback(new Ye(e,t,r)),v.exit(e)}action(e){let t=r=>{let i=this.registeredArguments.length,s=r.slice(0,i);return this._storeOptionsAsProperties?s[i]=this:s[i]=this.opts(),s.push(this),e.apply(this,s)};return this._actionHandler=t,this}createOption(e,t){return new tr(e,t)}_callParseArg(e,t,r,i){try{return e.parseArg(t,r)}catch(s){if(s.code==="commander.invalidArgument"){let o=`${i} ${s.message}`;this.error(o,{exitCode:s.exitCode,code:s.code})}throw s}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let r=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${r}'
20
+ - already used by option '${t.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let t=i=>[i.name()].concat(i.aliases()),r=t(e).find(i=>this._findCommand(i));if(r){let i=t(this._findCommand(r)).join("|"),s=t(e).join("|");throw new Error(`cannot add command '${s}' as already have command '${i}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),r=e.attributeName();if(e.negate){let s=e.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(r,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(r,e.defaultValue,"default");let i=(s,o,a)=>{s==null&&e.presetArg!==void 0&&(s=e.presetArg);let m=this.getOptionValue(r);s!==null&&e.parseArg?s=this._callParseArg(e,s,m,o):s!==null&&e.variadic&&(s=e._concatValue(s,m)),s==null&&(e.negate?s=!1:e.isBoolean()||e.optional?s=!0:s=""),this.setOptionValueWithSource(r,s,a)};return this.on("option:"+t,s=>{let o=`error: option '${e.flags}' argument '${s}' is invalid.`;i(s,o,"cli")}),e.envVar&&this.on("optionEnv:"+t,s=>{let o=`error: option '${e.flags}' value '${s}' from env '${e.envVar}' is invalid.`;i(s,o,"env")}),this}_optionEx(e,t,r,i,s){if(typeof t=="object"&&t instanceof tr)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(t,r);if(o.makeOptionMandatory(!!e.mandatory),typeof i=="function")o.default(s).argParser(i);else if(i instanceof RegExp){let a=i;i=(m,u)=>{let l=a.exec(m);return l?l[0]:u},o.default(s).argParser(i)}else o.default(i);return this.addOption(o)}option(e,t,r,i){return this._optionEx({},e,t,r,i)}requiredOption(e,t,r,i){return this._optionEx({mandatory:!0},e,t,r,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,r){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=r,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(r=>{r.getOptionValueSource(e)!==void 0&&(t=r.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){v.versions?.electron&&(t.from="electron");let i=v.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(t.from="eval")}e===void 0&&(e=v.argv),this.rawArgs=e.slice();let r;switch(t.from){case void 0:case"node":this._scriptPath=e[1],r=e.slice(2);break;case"electron":v.defaultApp?(this._scriptPath=e[1],r=e.slice(2)):r=e.slice(1);break;case"user":r=e.slice(0);break;case"eval":r=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",r}parse(e,t){this._prepareForParse();let r=this._prepareUserArgs(e,t);return this._parseCommand([],r),this}async parseAsync(e,t){this._prepareForParse();let r=this._prepareUserArgs(e,t);return await this._parseCommand([],r),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
21
+ - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,t,r){if(fe.existsSync(e))return;let i=t?`searched for local subcommand relative to directory '${t}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",s=`'${e}' does not exist
22
+ - if '${r}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
23
23
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
24
- - ${o}`;throw new Error(i)}_executeSubCommand(e,t){t=t.slice();let n=!1,o=[".js",".ts",".tsx",".mjs",".cjs"];function i(l,f){let c=P.resolve(l,f);if(ye.existsSync(c))return c;if(o.includes(P.extname(f)))return;let h=o.find(x=>ye.existsSync(`${c}${x}`));if(h)return`${c}${h}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let l;try{l=ye.realpathSync(this._scriptPath)}catch{l=this._scriptPath}a=P.resolve(P.dirname(l),a)}if(a){let l=i(a,s);if(!l&&!e._executableFile&&this._scriptPath){let f=P.basename(this._scriptPath,P.extname(this._scriptPath));f!==this._name&&(l=i(a,`${f}-${e._name}`))}s=l||s}n=o.includes(P.extname(s));let u;v.platform!=="win32"?n?(t.unshift(s),t=gr(v.execArgv).concat(t),u=it.spawn(v.argv[0],t,{stdio:"inherit"})):u=it.spawn(s,t,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),t.unshift(s),t=gr(v.execArgv).concat(t),u=it.spawn(v.execPath,t,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(f=>{v.on(f,()=>{u.killed===!1&&u.exitCode===null&&u.kill(f)})});let m=this._exitCallback;u.on("close",l=>{l=l??1,m?m(new st(l,"commander.executeSubCommandAsync","(close)")):v.exit(l)}),u.on("error",l=>{if(l.code==="ENOENT")this._checkForMissingExecutable(s,a,e._name);else if(l.code==="EACCES")throw new Error(`'${s}' not executable`);if(!m)v.exit(1);else{let f=new st(1,"commander.executeSubCommandAsync","(error)");f.nestedError=l,m(f)}}),this.runningCommand=u}_dispatchSubcommand(e,t,n){let o=this._findCommand(e);o||this.help({error:!0}),o._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,o,"preSubcommand"),i=this._chainOrCall(i,()=>{if(o._executableHandler)this._executeSubCommand(o,t.concat(n));else return o._parseCommand(t,n)}),i}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,o,i)=>{let s=o;if(o!==null&&n.parseArg){let a=`error: command-argument value '${o}' is invalid for argument '${n.name()}'.`;s=this._callParseArg(n,o,i,a)}return s};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,o)=>{let i=n.defaultValue;n.variadic?o<this.args.length?(i=this.args.slice(o),n.parseArg&&(i=i.reduce((s,a)=>e(n,a,s),n.defaultValue))):i===void 0&&(i=[]):o<this.args.length&&(i=this.args[o],n.parseArg&&(i=e(n,i,n.defaultValue))),t[o]=i}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,o=[];return this._getCommandAndAncestors().reverse().filter(i=>i._lifeCycleHooks[t]!==void 0).forEach(i=>{i._lifeCycleHooks[t].forEach(s=>{o.push({hookedCommand:i,callback:s})})}),t==="postAction"&&o.reverse(),o.forEach(i=>{n=this._chainOrCall(n,()=>i.callback(i.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let o=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(i=>{o=this._chainOrCall(o,()=>i(this,t))}),o}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){o(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(i,e,t)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent&&this.parent.listenerCount(i))o(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(o(),this._processArguments())}else this.commands.length?(o(),this.help({error:!0})):(o(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let o=n.attributeName();return this.getOptionValue(o)===void 0?!1:this.getOptionValueSource(o)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let o=e.find(i=>n.conflictsWith.includes(i.attributeName()));o&&this._conflictingOption(n,o)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],o=t,i=e.slice();function s(m){return m.length>1&&m[0]==="-"}let a=m=>/^-\d*\.?\d+(e[+-]?\d+)?$/.test(m)?!this._getCommandAndAncestors().some(l=>l.options.map(f=>f.short).some(f=>/^-\d$/.test(f))):!1,u=null;for(;i.length;){let m=i.shift();if(m==="--"){o===n&&o.push(m),o.push(...i);break}if(u&&(!s(m)||a(m))){this.emit(`option:${u.name()}`,m);continue}if(u=null,s(m)){let l=this._findOption(m);if(l){if(l.required){let f=i.shift();f===void 0&&this.optionMissingArgument(l),this.emit(`option:${l.name()}`,f)}else if(l.optional){let f=null;i.length>0&&(!s(i[0])||a(i[0]))&&(f=i.shift()),this.emit(`option:${l.name()}`,f)}else this.emit(`option:${l.name()}`);u=l.variadic?l:null;continue}}if(m.length>2&&m[0]==="-"&&m[1]!=="-"){let l=this._findOption(`-${m[1]}`);if(l){l.required||l.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${l.name()}`,m.slice(2)):(this.emit(`option:${l.name()}`),i.unshift(`-${m.slice(2)}`));continue}}if(/^--[^=]+=/.test(m)){let l=m.indexOf("="),f=this._findOption(m.slice(0,l));if(f&&(f.required||f.optional)){this.emit(`option:${f.name()}`,m.slice(l+1));continue}}if(o===t&&s(m)&&!(this.commands.length===0&&a(m))&&(o=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(m)){t.push(m),i.length>0&&n.push(...i);break}else if(this._getHelpCommand()&&m===this._getHelpCommand().name()){t.push(m),i.length>0&&t.push(...i);break}else if(this._defaultCommandName){n.push(m),i.length>0&&n.push(...i);break}}if(this._passThroughOptions){o.push(m),i.length>0&&o.push(...i);break}o.push(m)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let o=this.options[n].attributeName();e[o]=o===this._versionOptionName?this._version:this[o]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
24
+ - ${i}`;throw new Error(s)}_executeSubCommand(e,t){t=t.slice();let r=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function s(l,c){let p=T.resolve(l,c);if(fe.existsSync(p))return p;if(i.includes(T.extname(c)))return;let f=i.find(_=>fe.existsSync(`${p}${_}`));if(f)return`${p}${f}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let l;try{l=fe.realpathSync(this._scriptPath)}catch{l=this._scriptPath}a=T.resolve(T.dirname(l),a)}if(a){let l=s(a,o);if(!l&&!e._executableFile&&this._scriptPath){let c=T.basename(this._scriptPath,T.extname(this._scriptPath));c!==this._name&&(l=s(a,`${c}-${e._name}`))}o=l||o}r=i.includes(T.extname(o));let m;v.platform!=="win32"?r?(t.unshift(o),t=nr(v.execArgv).concat(t),m=Qe.spawn(v.argv[0],t,{stdio:"inherit"})):m=Qe.spawn(o,t,{stdio:"inherit"}):(this._checkForMissingExecutable(o,a,e._name),t.unshift(o),t=nr(v.execArgv).concat(t),m=Qe.spawn(v.execPath,t,{stdio:"inherit"})),m.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(c=>{v.on(c,()=>{m.killed===!1&&m.exitCode===null&&m.kill(c)})});let u=this._exitCallback;m.on("close",l=>{l=l??1,u?u(new Ye(l,"commander.executeSubCommandAsync","(close)")):v.exit(l)}),m.on("error",l=>{if(l.code==="ENOENT")this._checkForMissingExecutable(o,a,e._name);else if(l.code==="EACCES")throw new Error(`'${o}' not executable`);if(!u)v.exit(1);else{let c=new Ye(1,"commander.executeSubCommandAsync","(error)");c.nestedError=l,u(c)}}),this.runningCommand=m}_dispatchSubcommand(e,t,r){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let s;return s=this._chainOrCallSubCommandHook(s,i,"preSubcommand"),s=this._chainOrCall(s,()=>{if(i._executableHandler)this._executeSubCommand(i,t.concat(r));else return i._parseCommand(t,r)}),s}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(r,i,s)=>{let o=i;if(i!==null&&r.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${r.name()}'.`;o=this._callParseArg(r,i,s,a)}return o};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((r,i)=>{let s=r.defaultValue;r.variadic?i<this.args.length?(s=this.args.slice(i),r.parseArg&&(s=s.reduce((o,a)=>e(r,a,o),r.defaultValue))):s===void 0&&(s=[]):i<this.args.length&&(s=this.args[i],r.parseArg&&(s=e(r,s,r.defaultValue))),t[i]=s}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let r=e,i=[];return this._getCommandAndAncestors().reverse().filter(s=>s._lifeCycleHooks[t]!==void 0).forEach(s=>{s._lifeCycleHooks[t].forEach(o=>{i.push({hookedCommand:s,callback:o})})}),t==="postAction"&&i.reverse(),i.forEach(s=>{r=this._chainOrCall(r,()=>s.callback(s.hookedCommand,this))}),r}_chainOrCallSubCommandHook(e,t,r){let i=e;return this._lifeCycleHooks[r]!==void 0&&this._lifeCycleHooks[r].forEach(s=>{i=this._chainOrCall(i,()=>s(this,t))}),i}_parseCommand(e,t){let r=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(r.operands),t=r.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(r.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{r.unknown.length>0&&this.unknownOption(r.unknown[0])},s=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let o;return o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&(o=this._chainOrCall(o,()=>{this.parent.emit(s,e,t)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent&&this.parent.listenerCount(s))i(),this._processArguments(),this.parent.emit(s,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(r=>{let i=r.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(r=>r.conflictsWith.length>0).forEach(r=>{let i=e.find(s=>r.conflictsWith.includes(s.attributeName()));i&&this._conflictingOption(r,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],r=[],i=t,s=e.slice();function o(u){return u.length>1&&u[0]==="-"}let a=u=>/^-\d*\.?\d+(e[+-]?\d+)?$/.test(u)?!this._getCommandAndAncestors().some(l=>l.options.map(c=>c.short).some(c=>/^-\d$/.test(c))):!1,m=null;for(;s.length;){let u=s.shift();if(u==="--"){i===r&&i.push(u),i.push(...s);break}if(m&&(!o(u)||a(u))){this.emit(`option:${m.name()}`,u);continue}if(m=null,o(u)){let l=this._findOption(u);if(l){if(l.required){let c=s.shift();c===void 0&&this.optionMissingArgument(l),this.emit(`option:${l.name()}`,c)}else if(l.optional){let c=null;s.length>0&&(!o(s[0])||a(s[0]))&&(c=s.shift()),this.emit(`option:${l.name()}`,c)}else this.emit(`option:${l.name()}`);m=l.variadic?l:null;continue}}if(u.length>2&&u[0]==="-"&&u[1]!=="-"){let l=this._findOption(`-${u[1]}`);if(l){l.required||l.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${l.name()}`,u.slice(2)):(this.emit(`option:${l.name()}`),s.unshift(`-${u.slice(2)}`));continue}}if(/^--[^=]+=/.test(u)){let l=u.indexOf("="),c=this._findOption(u.slice(0,l));if(c&&(c.required||c.optional)){this.emit(`option:${c.name()}`,u.slice(l+1));continue}}if(i===t&&o(u)&&!(this.commands.length===0&&a(u))&&(i=r),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&r.length===0){if(this._findCommand(u)){t.push(u),s.length>0&&r.push(...s);break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){t.push(u),s.length>0&&t.push(...s);break}else if(this._defaultCommandName){r.push(u),s.length>0&&r.push(...s);break}}if(this._passThroughOptions){i.push(u),s.length>0&&i.push(...s);break}i.push(u)}return{operands:t,unknown:r}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let r=0;r<t;r++){let i=this.options[r].attributeName();e[i]=i===this._versionOptionName?this._version:this[i]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
25
25
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
26
26
  `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
27
- `),this.outputHelp({error:!0}));let n=t||{},o=n.exitCode||1,i=n.code||"commander.error";this._exit(o,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in v.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,v.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new li(this.options),t=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(o=>!t(o)).forEach(o=>{this.setOptionValueWithSource(o,n.implied[o],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let n=s=>{let a=s.attributeName(),u=this.getOptionValue(a),m=this.options.find(f=>f.negate&&a===f.attributeName()),l=this.options.find(f=>!f.negate&&a===f.attributeName());return m&&(m.presetArg===void 0&&u===!1||m.presetArg!==void 0&&u===m.presetArg)?m:l||s},o=s=>{let a=n(s),u=a.attributeName();return this.getOptionValueSource(u)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},i=`error: ${o(e)} cannot be used with ${o(t)}`;this.error(i,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let o=[],i=this;do{let s=i.createHelp().visibleOptions(i).filter(a=>a.long).map(a=>a.long);o=o.concat(s),i=i.parent}while(i&&!i._enablePositionalOptions);t=hr(e,o)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?"":"s",i=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${n} but got ${e.length}.`;this.error(i,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let o=[];this.createHelp().visibleCommands(this).forEach(i=>{o.push(i.name()),i.alias()&&o.push(i.alias())}),t=hr(e,o)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:"commander.unknownCommand"})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",n=n||"output the version number";let o=this.createOption(t,n);return this._versionOptionName=o.attributeName(),this._registerOption(o),this.on("option:"+o.name(),()=>{this._outputConfiguration.writeOut(`${e}
28
- `),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let o=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${o}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(n=>ai(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=P.basename(e,P.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let o=t.formatHelp(this,t);return n.hasColors?o:this._outputConfiguration.stripColor(o)}_getOutputContext(e){e=e||{};let t=!!e.error,n,o,i;return t?(n=a=>this._outputConfiguration.writeErr(a),o=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=a=>this._outputConfiguration.writeOut(a),o=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:t,write:a=>(o||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:o,helpWidth:i}}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let n=this._getOutputContext(e),o={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",o)),this.emit("beforeHelp",o);let i=this.helpInformation({error:n.error});if(t&&(i=t(i),typeof i!="string"&&!Buffer.isBuffer(i)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",o),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",o))}helpOption(e,t){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",t??"display help for command"),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(v.exitCode??0);t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText.
29
- Expecting one of '${n.join("', '")}'`);let o=`${e}Help`;return this.on(o,i=>{let s;typeof t=="function"?s=t({error:i.error,command:i.command}):s=t,s&&i.write(`${s}
30
- `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(o=>t.is(o))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function gr(r){return r.map(e=>{if(!e.startsWith("--inspect"))return e;let t,n="127.0.0.1",o="9229",i;return(i=e.match(/^(--inspect(-brk)?)$/))!==null?t=i[1]:(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=i[1],/^\d+$/.test(i[3])?o=i[3]:n=i[3]):(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],o=i[4]),t&&o!=="0"?`${t}=${n}:${parseInt(o)+1}`:e})}function mt(){if(v.env.NO_COLOR||v.env.FORCE_COLOR==="0"||v.env.FORCE_COLOR==="false")return!1;if(v.env.FORCE_COLOR||v.env.CLICOLOR_FORCE!==void 0)return!0}ut.Command=at;ut.useColor=mt});var br=_(L=>{var{Argument:vr}=xe(),{Command:lt}=_r(),{CommanderError:fi,InvalidArgumentError:xr}=me(),{Help:ci}=et(),{Option:yr}=ot();L.program=new lt;L.createCommand=r=>new lt(r);L.createOption=(r,e)=>new yr(r,e);L.createArgument=(r,e)=>new vr(r,e);L.Command=lt;L.Option=yr;L.Argument=vr;L.Help=ci;L.CommanderError=fi;L.InvalidArgumentError=xr;L.InvalidOptionArgumentError=xr});var jr=_((im,Mr)=>{Mr.exports=Lr;Lr.sync=yi;var kr=require("fs");function xi(r,e){var t=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!t||(t=t.split(";"),t.indexOf("")!==-1))return!0;for(var n=0;n<t.length;n++){var o=t[n].toLowerCase();if(o&&r.substr(-o.length).toLowerCase()===o)return!0}return!1}function Tr(r,e,t){return!r.isSymbolicLink()&&!r.isFile()?!1:xi(e,t)}function Lr(r,e,t){kr.stat(r,function(n,o){t(n,n?!1:Tr(o,r,e))})}function yi(r,e){return Tr(kr.statSync(r),r,e)}});var Rr=_((sm,$r)=>{$r.exports=Pr;Pr.sync=bi;var Ir=require("fs");function Pr(r,e,t){Ir.stat(r,function(n,o){t(n,n?!1:Nr(o,e))})}function bi(r,e){return Nr(Ir.statSync(r),e)}function Nr(r,e){return r.isFile()&&wi(r,e)}function wi(r,e){var t=r.mode,n=r.uid,o=r.gid,i=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),u=parseInt("010",8),m=parseInt("001",8),l=a|u,f=t&m||t&u&&o===s||t&a&&n===i||t&l&&i===0;return f}});var Vr=_((mm,Fr)=>{var am=require("fs"),be;process.platform==="win32"||global.TESTING_WINDOWS?be=jr():be=Rr();Fr.exports=pt;pt.sync=Ci;function pt(r,e,t){if(typeof e=="function"&&(t=e,e={}),!t){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,o){pt(r,e||{},function(i,s){i?o(i):n(s)})})}be(r,e||{},function(n,o){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,o=!1),t(n,o)})}function Ci(r,e){try{return be.sync(r,e||{})}catch(t){if(e&&e.ignoreErrors||t.code==="EACCES")return!1;throw t}}});var Ur=_((um,Br)=>{var X=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Dr=require("path"),Si=X?";":":",Gr=Vr(),qr=r=>Object.assign(new Error(`not found: ${r}`),{code:"ENOENT"}),Hr=(r,e)=>{let t=e.colon||Si,n=r.match(/\//)||X&&r.match(/\\/)?[""]:[...X?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(t)],o=X?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=X?o.split(t):[""];return X&&r.indexOf(".")!==-1&&i[0]!==""&&i.unshift(""),{pathEnv:n,pathExt:i,pathExtExe:o}},Wr=(r,e,t)=>{typeof e=="function"&&(t=e,e={}),e||(e={});let{pathEnv:n,pathExt:o,pathExtExe:i}=Hr(r,e),s=[],a=m=>new Promise((l,f)=>{if(m===n.length)return e.all&&s.length?l(s):f(qr(r));let c=n[m],h=/^".*"$/.test(c)?c.slice(1,-1):c,x=Dr.join(h,r),w=!h&&/^\.[\\\/]/.test(r)?r.slice(0,2)+x:x;l(u(w,m,0))}),u=(m,l,f)=>new Promise((c,h)=>{if(f===o.length)return c(a(l+1));let x=o[f];Gr(m+x,{pathExt:i},(w,H)=>{if(!w&&H)if(e.all)s.push(m+x);else return c(m+x);return c(u(m,l,f+1))})});return t?a(0).then(m=>t(null,m),t):a(0)},Ai=(r,e)=>{e=e||{};let{pathEnv:t,pathExt:n,pathExtExe:o}=Hr(r,e),i=[];for(let s=0;s<t.length;s++){let a=t[s],u=/^".*"$/.test(a)?a.slice(1,-1):a,m=Dr.join(u,r),l=!u&&/^\.[\\\/]/.test(r)?r.slice(0,2)+m:m;for(let f=0;f<n.length;f++){let c=l+n[f];try{if(Gr.sync(c,{pathExt:o}))if(e.all)i.push(c);else return c}catch{}}}if(e.all&&i.length)return i;if(e.nothrow)return null;throw qr(r)};Br.exports=Wr;Wr.sync=Ai});var Kr=_((lm,dt)=>{"use strict";var zr=(r={})=>{let e=r.env||process.env;return(r.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};dt.exports=zr;dt.exports.default=zr});var Yr=_((fm,Xr)=>{"use strict";var Jr=require("path"),Oi=Ur(),Ei=Kr();function Qr(r,e){let t=r.options.env||process.env,n=process.cwd(),o=r.options.cwd!=null,i=o&&process.chdir!==void 0&&!process.chdir.disabled;if(i)try{process.chdir(r.options.cwd)}catch{}let s;try{s=Oi.sync(r.command,{path:t[Ei({env:t})],pathExt:e?Jr.delimiter:void 0})}catch{}finally{i&&process.chdir(n)}return s&&(s=Jr.resolve(o?r.options.cwd:"",s)),s}function ki(r){return Qr(r)||Qr(r,!0)}Xr.exports=ki});var Zr=_((cm,gt)=>{"use strict";var ht=/([()\][%!^"`<>&|;, *?])/g;function Ti(r){return r=r.replace(ht,"^$1"),r}function Li(r,e){return r=`${r}`,r=r.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),r=r.replace(/(?=(\\+?)?)\1$/,"$1$1"),r=`"${r}"`,r=r.replace(ht,"^$1"),e&&(r=r.replace(ht,"^$1")),r}gt.exports.command=Ti;gt.exports.argument=Li});var tn=_((pm,en)=>{"use strict";en.exports=/^#!(.*)/});var nn=_((dm,rn)=>{"use strict";var Mi=tn();rn.exports=(r="")=>{let e=r.match(Mi);if(!e)return null;let[t,n]=e[0].replace(/#! ?/,"").split(" "),o=t.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var sn=_((hm,on)=>{"use strict";var _t=require("fs"),ji=nn();function Ii(r){let t=Buffer.alloc(150),n;try{n=_t.openSync(r,"r"),_t.readSync(n,t,0,150,0),_t.closeSync(n)}catch{}return ji(t.toString())}on.exports=Ii});var ln=_((gm,un)=>{"use strict";var Pi=require("path"),an=Yr(),mn=Zr(),Ni=sn(),$i=process.platform==="win32",Ri=/\.(?:com|exe)$/i,Fi=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Vi(r){r.file=an(r);let e=r.file&&Ni(r.file);return e?(r.args.unshift(r.file),r.command=e,an(r)):r.file}function Di(r){if(!$i)return r;let e=Vi(r),t=!Ri.test(e);if(r.options.forceShell||t){let n=Fi.test(e);r.command=Pi.normalize(r.command),r.command=mn.command(r.command),r.args=r.args.map(i=>mn.argument(i,n));let o=[r.command].concat(r.args).join(" ");r.args=["/d","/s","/c",`"${o}"`],r.command=process.env.comspec||"cmd.exe",r.options.windowsVerbatimArguments=!0}return r}function Gi(r,e,t){e&&!Array.isArray(e)&&(t=e,e=null),e=e?e.slice(0):[],t=Object.assign({},t);let n={command:r,args:e,options:t,file:void 0,original:{command:r,args:e}};return t.shell?n:Di(n)}un.exports=Gi});var pn=_((_m,cn)=>{"use strict";var vt=process.platform==="win32";function xt(r,e){return Object.assign(new Error(`${e} ${r.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${r.command}`,path:r.command,spawnargs:r.args})}function qi(r,e){if(!vt)return;let t=r.emit;r.emit=function(n,o){if(n==="exit"){let i=fn(o,e);if(i)return t.call(r,"error",i)}return t.apply(r,arguments)}}function fn(r,e){return vt&&r===1&&!e.file?xt(e.original,"spawn"):null}function Hi(r,e){return vt&&r===1&&!e.file?xt(e.original,"spawnSync"):null}cn.exports={hookChildProcess:qi,verifyENOENT:fn,verifyENOENTSync:Hi,notFoundError:xt}});var gn=_((vm,Y)=>{"use strict";var dn=require("child_process"),yt=ln(),bt=pn();function hn(r,e,t){let n=yt(r,e,t),o=dn.spawn(n.command,n.args,n.options);return bt.hookChildProcess(o,n),o}function Wi(r,e,t){let n=yt(r,e,t),o=dn.spawnSync(n.command,n.args,n.options);return o.error=o.error||bt.verifyENOENTSync(o.status,n),o}Y.exports=hn;Y.exports.spawn=hn;Y.exports.sync=Wi;Y.exports._parse=yt;Y.exports._enoent=bt});ur().install();var wr=B(br(),1),{program:Ka,createCommand:Ja,createArgument:Qa,createOption:Xa,CommanderError:Ya,InvalidArgumentError:Za,InvalidOptionArgumentError:em,Command:Cr,Argument:tm,Option:N,Help:rm}=wr.default;var pi=/[\p{Lu}]/u,di=/[\p{Ll}]/u,Sr=/^[\p{Lu}](?![\p{Lu}])/gu,Er=/([\p{Alpha}\p{N}_]|$)/u,ft=/[_.\- ]+/,hi=new RegExp("^"+ft.source),Ar=new RegExp(ft.source+Er.source,"gu"),Or=new RegExp("\\d+"+Er.source,"gu"),gi=(r,e,t,n)=>{let o=!1,i=!1,s=!1,a=!1;for(let u=0;u<r.length;u++){let m=r[u];a=u>2?r[u-3]==="-":!0,o&&pi.test(m)?(r=r.slice(0,u)+"-"+r.slice(u),o=!1,s=i,i=!0,u++):i&&s&&di.test(m)&&(!a||n)?(r=r.slice(0,u-1)+"-"+r.slice(u-1),s=i,i=!1,o=!0):(o=e(m)===m&&t(m)!==m,s=i,i=t(m)===m&&e(m)!==m)}return r},_i=(r,e)=>(Sr.lastIndex=0,r.replaceAll(Sr,t=>e(t))),vi=(r,e)=>(Ar.lastIndex=0,Or.lastIndex=0,r.replaceAll(Or,(t,n,o)=>["_","-"].includes(r.charAt(o+t.length))?t:e(t)).replaceAll(Ar,(t,n)=>e(n)));function ct(r,e){if(!(typeof r=="string"||Array.isArray(r)))throw new TypeError("Expected the input to be `string | string[]`");if(e={pascalCase:!1,preserveConsecutiveUppercase:!1,...e},Array.isArray(r)?r=r.map(i=>i.trim()).filter(i=>i.length).join("-"):r=r.trim(),r.length===0)return"";let t=e.locale===!1?i=>i.toLowerCase():i=>i.toLocaleLowerCase(e.locale),n=e.locale===!1?i=>i.toUpperCase():i=>i.toLocaleUpperCase(e.locale);return r.length===1?ft.test(r)?"":e.pascalCase?n(r):t(r):(r!==t(r)&&(r=gi(r,t,n,e.preserveConsecutiveUppercase)),r=r.replace(hi,""),r=e.preserveConsecutiveUppercase?_i(r,t):t(r),e.pascalCase&&(r=n(r.charAt(0))+r.slice(1)),vi(r,n))}var q=B(gn()),g=B(require("fs"));var Bi=typeof global=="object"&&global&&global.Object===Object&&global,we=Bi;var Ui=typeof self=="object"&&self&&self.Object===Object&&self,zi=we||Ui||Function("return this")(),Ce=zi;var Ki=Ce.Symbol,Z=Ki;var _n=Object.prototype,Ji=_n.hasOwnProperty,Qi=_n.toString,ue=Z?Z.toStringTag:void 0;function Xi(r){var e=Ji.call(r,ue),t=r[ue];try{r[ue]=void 0;var n=!0}catch{}var o=Qi.call(r);return n&&(e?r[ue]=t:delete r[ue]),o}var vn=Xi;var Yi=Object.prototype,Zi=Yi.toString;function es(r){return Zi.call(r)}var xn=es;var ts="[object Null]",rs="[object Undefined]",yn=Z?Z.toStringTag:void 0;function ns(r){return r==null?r===void 0?rs:ts:yn&&yn in Object(r)?vn(r):xn(r)}var ee=ns;function os(r){return r!=null&&typeof r=="object"}var te=os;var is=Array.isArray,bn=is;function ss(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}var wn=ss;function as(r){return r}var Cn=as;var ms="[object AsyncFunction]",us="[object Function]",ls="[object GeneratorFunction]",fs="[object Proxy]";function cs(r){if(!wn(r))return!1;var e=ee(r);return e==us||e==ls||e==ms||e==fs}var Sn=cs;var ps=9007199254740991,ds=/^(?:0|[1-9]\d*)$/;function hs(r,e){var t=typeof r;return e=e??ps,!!e&&(t=="number"||t!="symbol"&&ds.test(r))&&r>-1&&r%1==0&&r<e}var An=hs;var gs=9007199254740991;function _s(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=gs}var Se=_s;function vs(r){return r!=null&&Se(r.length)&&!Sn(r)}var On=vs;var xs=Object.prototype;function ys(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||xs;return r===t}var En=ys;function bs(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}var kn=bs;var ws="[object Arguments]";function Cs(r){return te(r)&&ee(r)==ws}var wt=Cs;var Tn=Object.prototype,Ss=Tn.hasOwnProperty,As=Tn.propertyIsEnumerable,Os=wt(function(){return arguments}())?wt:function(r){return te(r)&&Ss.call(r,"callee")&&!As.call(r,"callee")},Ln=Os;function Es(){return!1}var Mn=Es;var Pn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,jn=Pn&&typeof module=="object"&&module&&!module.nodeType&&module,ks=jn&&jn.exports===Pn,In=ks?Ce.Buffer:void 0,Ts=In?In.isBuffer:void 0,Ls=Ts||Mn,Nn=Ls;var Ms="[object Arguments]",js="[object Array]",Is="[object Boolean]",Ps="[object Date]",Ns="[object Error]",$s="[object Function]",Rs="[object Map]",Fs="[object Number]",Vs="[object Object]",Ds="[object RegExp]",Gs="[object Set]",qs="[object String]",Hs="[object WeakMap]",Ws="[object ArrayBuffer]",Bs="[object DataView]",Us="[object Float32Array]",zs="[object Float64Array]",Ks="[object Int8Array]",Js="[object Int16Array]",Qs="[object Int32Array]",Xs="[object Uint8Array]",Ys="[object Uint8ClampedArray]",Zs="[object Uint16Array]",ea="[object Uint32Array]",b={};b[Us]=b[zs]=b[Ks]=b[Js]=b[Qs]=b[Xs]=b[Ys]=b[Zs]=b[ea]=!0;b[Ms]=b[js]=b[Ws]=b[Is]=b[Bs]=b[Ps]=b[Ns]=b[$s]=b[Rs]=b[Fs]=b[Vs]=b[Ds]=b[Gs]=b[qs]=b[Hs]=!1;function ta(r){return te(r)&&Se(r.length)&&!!b[ee(r)]}var $n=ta;function ra(r){return function(e){return r(e)}}var Rn=ra;var Fn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,le=Fn&&typeof module=="object"&&module&&!module.nodeType&&module,na=le&&le.exports===Fn,Ct=na&&we.process,oa=function(){try{var r=le&&le.require&&le.require("util").types;return r||Ct&&Ct.binding&&Ct.binding("util")}catch{}}(),St=oa;var Vn=St&&St.isTypedArray,ia=Vn?Rn(Vn):$n,Dn=ia;var sa=Object.prototype,aa=sa.hasOwnProperty;function ma(r,e){var t=bn(r),n=!t&&Ln(r),o=!t&&!n&&Nn(r),i=!t&&!n&&!o&&Dn(r),s=t||n||o||i,a=s?kn(r.length,String):[],u=a.length;for(var m in r)(e||aa.call(r,m))&&!(s&&(m=="length"||o&&(m=="offset"||m=="parent")||i&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||An(m,u)))&&a.push(m);return a}var Gn=ma;function ua(r,e){return function(t){return r(e(t))}}var qn=ua;var la=qn(Object.keys,Object),Hn=la;var fa=Object.prototype,ca=fa.hasOwnProperty;function pa(r){if(!En(r))return Hn(r);var e=[];for(var t in Object(r))ca.call(r,t)&&t!="constructor"&&e.push(t);return e}var Wn=pa;function da(r){return On(r)?Gn(r):Wn(r)}var Bn=da;function ha(r){return function(e,t,n){for(var o=-1,i=Object(e),s=n(e),a=s.length;a--;){var u=s[r?a:++o];if(t(i[u],u,i)===!1)break}return e}}var Un=ha;var ga=Un(),zn=ga;function _a(r,e){return r&&zn(r,e,Bn)}var Kn=_a;function va(r){return typeof r=="function"?r:Cn}var Jn=va;function xa(r,e){return r&&Kn(r,Jn(e))}var At=xa;var io=B(require("os")),d=B(require("path"));var Ae="1.1.38";var Xn=()=>{fe(),console.log(`
27
+ `),this.outputHelp({error:!0}));let r=t||{},i=r.exitCode||1,s=r.code||"commander.error";this._exit(i,s,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in v.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,v.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new hi(this.options),t=r=>this.getOptionValue(r)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(r));this.options.filter(r=>r.implied!==void 0&&t(r.attributeName())&&e.valueFromOption(this.getOptionValue(r.attributeName()),r)).forEach(r=>{Object.keys(r.implied).filter(i=>!t(i)).forEach(i=>{this.setOptionValueWithSource(i,r.implied[i],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let r=o=>{let a=o.attributeName(),m=this.getOptionValue(a),u=this.options.find(c=>c.negate&&a===c.attributeName()),l=this.options.find(c=>!c.negate&&a===c.attributeName());return u&&(u.presetArg===void 0&&m===!1||u.presetArg!==void 0&&m===u.presetArg)?u:l||o},i=o=>{let a=r(o),m=a.attributeName();return this.getOptionValueSource(m)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},s=`error: ${i(e)} cannot be used with ${i(t)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],s=this;do{let o=s.createHelp().visibleOptions(s).filter(a=>a.long).map(a=>a.long);i=i.concat(o),s=s.parent}while(s&&!s._enablePositionalOptions);t=rr(e,i)}let r=`error: unknown option '${e}'${t}`;this.error(r,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,r=t===1?"":"s",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${r} but got ${e.length}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(s=>{i.push(s.name()),s.alias()&&i.push(s.alias())}),t=rr(e,i)}let r=`error: unknown command '${e}'${t}`;this.error(r,{code:"commander.unknownCommand"})}version(e,t,r){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",r=r||"output the version number";let i=this.createOption(t,r);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e}
28
+ `),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let r=this.parent?._findCommand(e);if(r){let i=[r.name()].concat(r.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(r=>li(r));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=T.basename(e,T.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),r=this._getOutputContext(e);t.prepareContext({error:r.error,helpWidth:r.helpWidth,outputHasColors:r.hasColors});let i=t.formatHelp(this,t);return r.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let t=!!e.error,r,i,s;return t?(r=a=>this._outputConfiguration.writeErr(a),i=this._outputConfiguration.getErrHasColors(),s=this._outputConfiguration.getErrHelpWidth()):(r=a=>this._outputConfiguration.writeOut(a),i=this._outputConfiguration.getOutHasColors(),s=this._outputConfiguration.getOutHelpWidth()),{error:t,write:a=>(i||(a=this._outputConfiguration.stripColor(a)),r(a)),hasColors:i,helpWidth:s}}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let r=this._getOutputContext(e),i={error:r.error,write:r.write,command:this};this._getCommandAndAncestors().reverse().forEach(o=>o.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let s=this.helpInformation({error:r.error});if(t&&(s=t(s),typeof s!="string"&&!Buffer.isBuffer(s)))throw new Error("outputHelp callback must return a string or a Buffer");r.write(s),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(o=>o.emit("afterAllHelp",i))}helpOption(e,t){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",t??"display help for command"),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(v.exitCode??0);t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let r=["beforeAll","before","after","afterAll"];if(!r.includes(e))throw new Error(`Unexpected value for position to addHelpText.
29
+ Expecting one of '${r.join("', '")}'`);let i=`${e}Help`;return this.on(i,s=>{let o;typeof t=="function"?o=t({error:s.error,command:s.command}):o=t,o&&s.write(`${o}
30
+ `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function nr(n){return n.map(e=>{if(!e.startsWith("--inspect"))return e;let t,r="127.0.0.1",i="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?t=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=s[1],/^\d+$/.test(s[3])?i=s[3]:r=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],r=s[3],i=s[4]),t&&i!=="0"?`${t}=${r}:${parseInt(i)+1}`:e})}function Ze(){if(v.env.NO_COLOR||v.env.FORCE_COLOR==="0"||v.env.FORCE_COLOR==="false")return!1;if(v.env.FORCE_COLOR||v.env.CLICOLOR_FORCE!==void 0)return!0}et.Command=Xe;et.useColor=Ze});var mr=g(k=>{var{Argument:sr}=he(),{Command:tt}=ir(),{CommanderError:fi,InvalidArgumentError:or}=ne(),{Help:di}=Ue(),{Option:ar}=Ke();k.program=new tt;k.createCommand=n=>new tt(n);k.createOption=(n,e)=>new ar(n,e);k.createArgument=(n,e)=>new sr(n,e);k.Command=tt;k.Option=ar;k.Argument=sr;k.Help=di;k.CommanderError=fi;k.InvalidArgumentError=or;k.InvalidOptionArgumentError=or});var yr=g((ks,vr)=>{vr.exports=_r;_r.sync=Oi;var dr=require("fs");function wi(n,e){var t=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!t||(t=t.split(";"),t.indexOf("")!==-1))return!0;for(var r=0;r<t.length;r++){var i=t[r].toLowerCase();if(i&&n.substr(-i.length).toLowerCase()===i)return!0}return!1}function gr(n,e,t){return!n.isSymbolicLink()&&!n.isFile()?!1:wi(e,t)}function _r(n,e,t){dr.stat(n,function(r,i){t(r,r?!1:gr(i,n,e))})}function Oi(n,e){return gr(dr.statSync(n),n,e)}});var br=g((Ms,Or)=>{Or.exports=Sr;Sr.sync=bi;var Cr=require("fs");function Sr(n,e,t){Cr.stat(n,function(r,i){t(r,r?!1:wr(i,e))})}function bi(n,e){return wr(Cr.statSync(n),e)}function wr(n,e){return n.isFile()&&Ai(n,e)}function Ai(n,e){var t=n.mode,r=n.uid,i=n.gid,s=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),m=parseInt("010",8),u=parseInt("001",8),l=a|m,c=t&u||t&m&&i===o||t&a&&r===s||t&l&&s===0;return c}});var Er=g(($s,Ar)=>{var Ls=require("fs"),de;process.platform==="win32"||global.TESTING_WINDOWS?de=yr():de=br();Ar.exports=it;it.sync=Ei;function it(n,e,t){if(typeof e=="function"&&(t=e,e={}),!t){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(r,i){it(n,e||{},function(s,o){s?i(s):r(o)})})}de(n,e||{},function(r,i){r&&(r.code==="EACCES"||e&&e.ignoreErrors)&&(r=null,i=!1),t(r,i)})}function Ei(n,e){try{return de.sync(n,e||{})}catch(t){if(e&&e.ignoreErrors||t.code==="EACCES")return!1;throw t}}});var Tr=g((Ns,Nr)=>{var Q=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",xr=require("path"),xi=Q?";":":",kr=Er(),Mr=n=>Object.assign(new Error(`not found: ${n}`),{code:"ENOENT"}),Lr=(n,e)=>{let t=e.colon||xi,r=n.match(/\//)||Q&&n.match(/\\/)?[""]:[...Q?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(t)],i=Q?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Q?i.split(t):[""];return Q&&n.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:r,pathExt:s,pathExtExe:i}},$r=(n,e,t)=>{typeof e=="function"&&(t=e,e={}),e||(e={});let{pathEnv:r,pathExt:i,pathExtExe:s}=Lr(n,e),o=[],a=u=>new Promise((l,c)=>{if(u===r.length)return e.all&&o.length?l(o):c(Mr(n));let p=r[u],f=/^".*"$/.test(p)?p.slice(1,-1):p,_=xr.join(f,n),S=!f&&/^\.[\\\/]/.test(n)?n.slice(0,2)+_:_;l(m(S,u,0))}),m=(u,l,c)=>new Promise((p,f)=>{if(c===i.length)return p(a(l+1));let _=i[c];kr(u+_,{pathExt:s},(S,G)=>{if(!S&&G)if(e.all)o.push(u+_);else return p(u+_);return p(m(u,l,c+1))})});return t?a(0).then(u=>t(null,u),t):a(0)},ki=(n,e)=>{e=e||{};let{pathEnv:t,pathExt:r,pathExtExe:i}=Lr(n,e),s=[];for(let o=0;o<t.length;o++){let a=t[o],m=/^".*"$/.test(a)?a.slice(1,-1):a,u=xr.join(m,n),l=!m&&/^\.[\\\/]/.test(n)?n.slice(0,2)+u:u;for(let c=0;c<r.length;c++){let p=l+r[c];try{if(kr.sync(p,{pathExt:i}))if(e.all)s.push(p);else return p}catch{}}}if(e.all&&s.length)return s;if(e.nothrow)return null;throw Mr(n)};Nr.exports=$r;$r.sync=ki});var Dr=g((Ts,st)=>{"use strict";var Pr=(n={})=>{let e=n.env||process.env;return(n.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"};st.exports=Pr;st.exports.default=Pr});var jr=g((Ps,Vr)=>{"use strict";var Ir=require("path"),Mi=Tr(),Li=Dr();function Rr(n,e){let t=n.options.env||process.env,r=process.cwd(),i=n.options.cwd!=null,s=i&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(n.options.cwd)}catch{}let o;try{o=Mi.sync(n.command,{path:t[Li({env:t})],pathExt:e?Ir.delimiter:void 0})}catch{}finally{s&&process.chdir(r)}return o&&(o=Ir.resolve(i?n.options.cwd:"",o)),o}function $i(n){return Rr(n)||Rr(n,!0)}Vr.exports=$i});var Hr=g((Ds,at)=>{"use strict";var ot=/([()\][%!^"`<>&|;, *?])/g;function Ni(n){return n=n.replace(ot,"^$1"),n}function Ti(n,e){return n=`${n}`,n=n.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),n=n.replace(/(?=(\\+?)?)\1$/,"$1$1"),n=`"${n}"`,n=n.replace(ot,"^$1"),e&&(n=n.replace(ot,"^$1")),n}at.exports.command=Ni;at.exports.argument=Ti});var Gr=g((Is,Fr)=>{"use strict";Fr.exports=/^#!(.*)/});var Wr=g((Rs,qr)=>{"use strict";var Pi=Gr();qr.exports=(n="")=>{let e=n.match(Pi);if(!e)return null;let[t,r]=e[0].replace(/#! ?/,"").split(" "),i=t.split("/").pop();return i==="env"?r:r?`${i} ${r}`:i}});var Br=g((Vs,Ur)=>{"use strict";var mt=require("fs"),Di=Wr();function Ii(n){let t=Buffer.alloc(150),r;try{r=mt.openSync(n,"r"),mt.readSync(r,t,0,150,0),mt.closeSync(r)}catch{}return Di(t.toString())}Ur.exports=Ii});var Qr=g((js,Kr)=>{"use strict";var Ri=require("path"),zr=jr(),Jr=Hr(),Vi=Br(),ji=process.platform==="win32",Hi=/\.(?:com|exe)$/i,Fi=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Gi(n){n.file=zr(n);let e=n.file&&Vi(n.file);return e?(n.args.unshift(n.file),n.command=e,zr(n)):n.file}function qi(n){if(!ji)return n;let e=Gi(n),t=!Hi.test(e);if(n.options.forceShell||t){let r=Fi.test(e);n.command=Ri.normalize(n.command),n.command=Jr.command(n.command),n.args=n.args.map(s=>Jr.argument(s,r));let i=[n.command].concat(n.args).join(" ");n.args=["/d","/s","/c",`"${i}"`],n.command=process.env.comspec||"cmd.exe",n.options.windowsVerbatimArguments=!0}return n}function Wi(n,e,t){e&&!Array.isArray(e)&&(t=e,e=null),e=e?e.slice(0):[],t=Object.assign({},t);let r={command:n,args:e,options:t,file:void 0,original:{command:n,args:e}};return t.shell?r:qi(r)}Kr.exports=Wi});var Zr=g((Hs,Xr)=>{"use strict";var ut=process.platform==="win32";function lt(n,e){return Object.assign(new Error(`${e} ${n.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${n.command}`,path:n.command,spawnargs:n.args})}function Ui(n,e){if(!ut)return;let t=n.emit;n.emit=function(r,i){if(r==="exit"){let s=Yr(i,e);if(s)return t.call(n,"error",s)}return t.apply(n,arguments)}}function Yr(n,e){return ut&&n===1&&!e.file?lt(e.original,"spawn"):null}function Bi(n,e){return ut&&n===1&&!e.file?lt(e.original,"spawnSync"):null}Xr.exports={hookChildProcess:Ui,verifyENOENT:Yr,verifyENOENTSync:Bi,notFoundError:lt}});var rn=g((Fs,Y)=>{"use strict";var en=require("child_process"),ct=Qr(),pt=Zr();function tn(n,e,t){let r=ct(n,e,t),i=en.spawn(r.command,r.args,r.options);return pt.hookChildProcess(i,r),i}function zi(n,e,t){let r=ct(n,e,t),i=en.spawnSync(r.command,r.args,r.options);return i.error=i.error||pt.verifyENOENTSync(i.status,r),i}Y.exports=tn;Y.exports.spawn=tn;Y.exports.sync=zi;Y.exports._parse=ct;Y.exports._enoent=pt});Qt().install();var ur=W(mr(),1),{program:_s,createCommand:vs,createArgument:ys,createOption:Cs,CommanderError:Ss,InvalidArgumentError:ws,InvalidOptionArgumentError:Os,Command:lr,Argument:bs,Option:P,Help:As}=ur.default;var gi=/[\p{Lu}]/u,_i=/[\p{Ll}]/u,cr=/^[\p{Lu}](?![\p{Lu}])/gu,fr=/([\p{Alpha}\p{N}_]|$)/u,rt=/[_.\- ]+/,vi=new RegExp("^"+rt.source),pr=new RegExp(rt.source+fr.source,"gu"),hr=new RegExp("\\d+"+fr.source,"gu"),yi=(n,e,t,r)=>{let i=!1,s=!1,o=!1,a=!1;for(let m=0;m<n.length;m++){let u=n[m];a=m>2?n[m-3]==="-":!0,i&&gi.test(u)?(n=n.slice(0,m)+"-"+n.slice(m),i=!1,o=s,s=!0,m++):s&&o&&_i.test(u)&&(!a||r)?(n=n.slice(0,m-1)+"-"+n.slice(m-1),o=s,s=!1,i=!0):(i=e(u)===u&&t(u)!==u,o=s,s=t(u)===u&&e(u)!==u)}return n},Ci=(n,e)=>(cr.lastIndex=0,n.replaceAll(cr,t=>e(t))),Si=(n,e)=>(pr.lastIndex=0,hr.lastIndex=0,n.replaceAll(hr,(t,r,i)=>["_","-"].includes(n.charAt(i+t.length))?t:e(t)).replaceAll(pr,(t,r)=>e(r)));function nt(n,e){if(!(typeof n=="string"||Array.isArray(n)))throw new TypeError("Expected the input to be `string | string[]`");if(e={pascalCase:!1,preserveConsecutiveUppercase:!1,...e},Array.isArray(n)?n=n.map(s=>s.trim()).filter(s=>s.length).join("-"):n=n.trim(),n.length===0)return"";let t=e.locale===!1?s=>s.toLowerCase():s=>s.toLocaleLowerCase(e.locale),r=e.locale===!1?s=>s.toUpperCase():s=>s.toLocaleUpperCase(e.locale);return n.length===1?rt.test(n)?"":e.pascalCase?r(n):t(n):(n!==t(n)&&(n=yi(n,t,r,e.preserveConsecutiveUppercase)),n=n.replace(vi,""),n=e.preserveConsecutiveUppercase?Ci(n,t):t(n),e.pascalCase&&(n=r(n.charAt(0))+n.slice(1)),Si(n,r))}var F=W(rn()),y=W(require("fs")),un=W(require("os")),d=W(require("path"));var ie="2.0.7-rc.1";var sn=()=>{se(),console.log(`
31
31
  \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
32
32
  \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
33
33
  \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
@@ -51,17 +51,12 @@ Expecting one of '${n.join("', '")}'`);let o=`${e}Help`;return this.on(o,i=>{let
51
51
  \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
52
52
  \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m/\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
53
53
  \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
54
- \x1B[0m`),console.log(""),console.log("---------------------- Seeka Apps CLI ----------------------"),console.log(`-------------------------- v${Ae} -------------------------`),console.log(""),console.log("https://developers.seeka.co"),console.log("for help: npx @seeka-labs/cli-apps@latest --help"),console.log("for scaffolding help: npx @seeka-labs/cli-apps@latest init --help"),fe()},fe=()=>{console.log(""),console.log("------------------------------------------------------------"),console.log("")};var re=B(require("fs")),Yn=require("os"),Zn=r=>/^[a-zA-Z0-9-]+$/.test(r);function eo(r){try{let e=re.opendirSync(r),t=e.readSync();return e.closeSync(),t===null}catch{return!1}}function to(r){let e={};return!r||r.length===0||r.forEach(t=>{let n=t.indexOf("=");if(n===-1){e[t]="";return}let o=t.substring(0,n),i=t.substring(n+1);e[o]=i}),e}var ba=r=>re.readFileSync(r,"utf-8").split(Yn.EOL);var wa=(r,e,t)=>{let n=ba(r),o=n.find(i=>i.split("=")[0]===e);if(o!==void 0){let i=n.indexOf(o);n.splice(i,1,`${e}="${t}"`)}else n.push(`${e}="${t}"`);re.writeFileSync(r,n.join(Yn.EOL))},Ot=(r,e)=>{e&&Object.keys(e).forEach(t=>{wa(r,t,e[t])})};var so=r=>{if(!Zn(r.appName)){console.error("App name must be alphanumeric and hyphens only");return}if(!r.appName.startsWith("seeka-app-")){console.error("App name must start with seeka-app-");return}let e=r.appName,t=ct(r.appName.replace("seeka-app-",""),{pascalCase:!0}),n=d.resolve(r.outputDirectory,r.skipSubDir?"":r.directoryName||e);console.log(`Creating new ${r.template.replace(/-/g," ")} Seeka app in ${n}`),console.log("");let o=d.resolve(n,".git"),i=g.existsSync(o),s=d.resolve(io.default.tmpdir(),".seeka-app-init-git-"+new Date().getTime());if(g.existsSync(s)||g.mkdirSync(s,{recursive:!0}),!r.skipSubDir&&g.existsSync(n)&&eo(n)===!1)if(r.force)console.log("--force was used and destination directory is not empty. Clearing out the directory"),i&&(console.info(".git directory found in directory, I will preserve it and remove all other files and directories to prepare for the app creation"),g.cpSync(o,s,{recursive:!0})),g.rmSync(n,{recursive:!0,force:!0});else{console.error("Directory is not empty. Use --force to create app in non-empty directory");return}g.existsSync(n)||g.mkdirSync(n,{recursive:!0}),i&&(g.cpSync(s,o,{recursive:!0}),g.rmSync(s,{recursive:!0}),console.info("Restored .git directory"));let a=d.resolve(__dirname,"init-templates"),u=d.resolve(a,r.template);g.cpSync(u,n,{recursive:!0}),g.renameSync(d.join(n,".example.gitignore"),d.join(n,".gitignore"));let m=require(d.join(n,"package.json"));m.name=r.appName,m.version=Ae,m.description=`Seeka app ${r.appName}`,m.author=`${r.developerName} <${r.developerEmail}>`,m.scripts.deploy=m.scripts.deploy.replace(/seeka-app-example-name/i,r.appName),m.scripts.tunnel=m.scripts.tunnel.replace(/seeka-app-example-name/i,r.appName);let l=d.resolve(d.join(n,"README.md")),f=g.readFileSync(l,"utf8");f=f.replace(/seeka-app-example-name/g,r.appName),g.writeFileSync(l,f);let c=d.resolve(d.join(n,".gitlab-ci.yml")),h=g.readFileSync(c,"utf8");switch(h=h.replace(/seeka-app-example-name/g,r.appName),g.writeFileSync(c,h),r.template){case"aws-lambda":Ea(r,n,m,t);break;case"azure-function":Aa(r,n,m,t);break;case"netlify-function":Oa(r,n,m,t);break}if(E(d.join(n,"src","lib","state","seeka","installations.ts"),{SampleApp:t+"App"}),Sa(r,n,a,t),Ca(r,m),g.writeFileSync(d.resolve(d.join(n,"package.json")),JSON.stringify(m,null,2)),console.info("Scaffolded package.json"),console.log(""),r.installDependencies){console.info("Installing dependencies with "+r.packageManager);try{switch(r.packageManager){case"npm":q.sync("npm",["install"],{stdio:"inherit",cwd:n}),r.components.browser&&q.sync("npm",["install"],{stdio:"inherit",cwd:d.join(n,"src","browser")});break;case"pnpm":q.sync("pnpm",["install"],{stdio:"inherit",cwd:n}),r.components.browser&&q.sync("pnpm",["install"],{stdio:"inherit",cwd:d.join(n,"src","browser")});break;case"yarn":q.sync("yarn",["install"],{stdio:"inherit",cwd:n}),r.components.browser&&q.sync("yarn",["install"],{stdio:"inherit",cwd:d.join(n,"src","browser")});break;default:console.error("Invalid package manager");return}}catch(w){console.error("Error installing dependencies with "+r.packageManager,w)}}fe(),console.log(`Created ${e} in ${n}`),console.log("Boom! Your new Seeka app is ready!"),fe();let x=r.skipSubDir?n:d.relative(process.cwd(),n);console.log(`Run "cd ${x}" to change to your apps directory and start creating some magic!`),console.log(""),console.log("")},Ca=(r,e)=>{let t;switch(r.packageManager){case"npm":t="npm run";break;case"pnpm":t="pnpm run";break;case"yarn":t="yarn";break;default:console.error("Invalid package manager");return}for(let n in e.scripts)e.scripts[n]=e.scripts[n].replace(/<packageManagerRunPrefix>/g,t);e.dependencies&&e.dependencies["@seeka-labs/sdk-apps-server"]&&(e.dependencies["@seeka-labs/sdk-apps-server"]="^"+e.version)};function ro(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var no=(r,e,t,n)=>{let o;if(r.endsWith(".ts")||r.endsWith(".js"))o="//";else if(r.endsWith(".yml")||r.endsWith(".yaml"))o="#";else throw new Error("Unsupported file type "+r);if(!o)throw new Error("Unsupported file type for components application");At(e.components,(i,s)=>{let a=ro(`${o} START: component:${s}`),u=ro(`${o} END: component:${s}`);i?E(r,{[a+"\r"]:"",[u+"\r"]:""}):E(r,{[`${a}[\\s\\S]*?${u}\r`]:""})})},Sa=(r,e,t,n)=>{if(!r.components.browser){oo(e);return}if(r.template!=="azure-function"){console.warn("Browser plugin is only supported for Azure function template, skipping browser plugin creation"),oo(e);return}g.mkdirSync(d.resolve(d.join(e,"src","browser")),{recursive:!0}),g.cpSync(d.resolve(d.join(t,"browser")),d.resolve(d.join(e,"src","browser")),{recursive:!0});let o=d.resolve(d.join(e,"src","browser")),i=require(d.join(o,"package.json"));if(i.name=i.name.replace(/seeka-app-example-name/i,r.appName),i.description=i.description.replace(/seeka-app-example-name/i,r.appName),i.scripts.build=i.scripts.build.replace(/seeka-app-example-name/i,r.appName),i.scripts["build:dev"]=i.scripts["build:dev"].replace(/seeka-app-example-name/i,r.appName),i.scripts.watch=i.scripts.watch.replace(/seeka-app-example-name/i,r.appName),g.writeFileSync(d.join(o,"package.json"),JSON.stringify(i,null,2)),!r.npmUsername||!r.npmPassword)console.warn("npmUsername and npmPassword should be provided for browser plugin support.");else{let s=d.join(o,".npmrc");E(s,{"<<npm_registry_token>>":Buffer.from(`${r.npmUsername}:${r.npmPassword}`).toString("base64")})}E(d.join(e,"src","lib","browser","index.ts"),{"seeka-app-example-name":r.appName}),E(d.join(o,"README.md"),{"seeka-app-example-name":r.appName}),E(d.join(o,"src","plugin","index.ts"),{"seeka-app-example-name":r.appName,SampleApp:n+"App"}),E(d.join(o,"src","browser.ts"),{SampleApp:n+"App"}),E(d.join(o,"package.json"),{SampleApp:n+"App"}),console.info("Scaffolded browser plugin"),console.log("")},E=(r,e)=>{let t=g.readFileSync(d.resolve(r),"utf8");for(let n in e)t=t.replace(new RegExp(n,"g"),e[n]);g.writeFileSync(d.resolve(r),t)},oo=r=>{g.rmSync(d.resolve(d.join(r,"src","lib","browser")),{recursive:!0})},Aa=(r,e,t,n)=>{if(g.renameSync(d.join(e,"local.settings.example.json"),d.join(e,"local.settings.json")),r.environmentVariables&&Object.keys(r.environmentVariables).length>0){let o=require(d.join(e,"local.settings.json"));o.Values={...o.Values,...r.environmentVariables},g.writeFileSync(d.join(e,"local.settings.json"),JSON.stringify(o,null,2))}r.components.browser&&(t.scripts.build="tsc && cd src/browser && yarn && yarn build && cd ../",t.scripts.watch="cd src/browser && yarn && yarn build && cd ../ && tsc -w"),E(d.join(e,"src","lib","browser","models","index.ts"),{SampleApp:n+"App"}),E(d.join(e,"src","lib","browser","index.ts"),{SampleApp:n+"App"}),E(d.join(e,"src","functions","seekaAppWebhook.ts"),{SampleApp:n+"App"}),no(d.join(e,"src","functions","seekaAppWebhook.ts"),r,e,n),no(d.join(e,".gitlab-ci.yml"),r,e,n),console.info("Scaffolded Azure function")},Oa=(r,e,t,n)=>{g.renameSync(d.join(e,".env.example"),d.join(e,".env")),r.environmentVariables&&Object.keys(r.environmentVariables).length>0&&Ot(d.join(e,".env"),r.environmentVariables),E(d.join(e,"src","api","seeka-app-webhook","index.ts"),{SampleApp:n+"App"}),console.info("Scaffolded Netlify function")},Ea=(r,e,t,n)=>{g.renameSync(d.join(e,".env.example"),d.join(e,".env")),r.environmentVariables&&Object.keys(r.environmentVariables).length>0&&Ot(d.join(e,".env"),r.environmentVariables),E(d.join(e,"src","routes","seekaAppWebhook.ts"),{SampleApp:n+"App"}),console.info("Scaffolded AWS lambda function")};var Et=new Cr;Xn();Et.command("init").description("initialises a new Seeka app").argument("<name>",'name of your app. alphanumeric and hyphens only and must start with "seeka-app-"').addOption(new N("--template <template>","app template").choices(["azure-function","aws-lambda","netlify-function"]).makeOptionMandatory()).addOption(new N("--developer <developer>","app developer name or company").makeOptionMandatory()).addOption(new N("--email <email>","app developer email").makeOptionMandatory()).addOption(new N("--outName [outName]","directory name of the app. a new directory will be created with this name to contain the app.")).addOption(new N("--outDir [outDir]","output directory to create the app in. a new directory will be created here that contains the app.").default("","current working dir")).addOption(new N("--packageManager [packageManager]","package manager").choices(["yarn","npm","pnpm"]).default("yarn")).addOption(new N("--npmUsername [npmUsername]","Private NPM registry username for browser plugin dependencies.")).addOption(new N("--npmPassword [npmPassword]","Private NPM registry password for browser plugin dependencies.")).option("--noDependencies","skip installing dependencies").option("--skipSubDir","use sub directory for app files instead of root folder").option("--force","force creation of app in non-empty directory").option("--browser","adds support for browser plugin served from the app").option("--env [env...]","sets environment variables for the app. Use format of --env KEY1=VALUE1 KEY2=VALUE2").option("--appSettings [appSettings...]","sets app settings for the app. Use format of --appSettings myAppInstallSetting1=string myAppInstallSetting2=string[]").action((r,e)=>{let t={appName:r,components:{browser:e.browser&&e.template==="azure-function"},template:e.template,skipSubDir:e.skipSubDir,outputDirectory:e.outDir||process.cwd(),directoryName:e.outName||void 0,packageManager:e.packageManager,developerEmail:e.email,developerName:e.developer,installDependencies:!e.noDependencies,force:e.force,environmentVariables:to(e.env),appSettings:[],npmUsername:e.npmUsername,npmPassword:e.npmPassword};so(t)}).showHelpAfterError(!0);Et.showHelpAfterError(!0);Et.parse();
55
- /*! Bundled license information:
54
+ \x1B[0m`),console.log(""),console.log("---------------------- Seeka Apps CLI ----------------------"),console.log(`-------------------------- v${ie} -------------------------`),console.log(""),console.log("https://developers.seeka.co"),console.log("for help: npx @seeka-labs/cli-apps@latest --help"),console.log("for scaffolding help: npx @seeka-labs/cli-apps@latest init --help"),se()},se=()=>{console.log(""),console.log("------------------------------------------------------------"),console.log("")};var ge=W(require("fs")),qs=require("os"),on=n=>/^[a-zA-Z0-9-]+$/.test(n);function an(n){try{let e=ge.opendirSync(n),t=e.readSync();return e.closeSync(),t===null}catch{return!1}}function mn(n){let e={};return!n||n.length===0||n.forEach(t=>{let r=t.indexOf("=");if(r===-1){e[t]="";return}let i=t.substring(0,r),s=t.substring(r+1);e[i]=s}),e}var ln=n=>{if(!on(n.appName)){console.error("App name must be alphanumeric and hyphens only");return}if(!n.appName.startsWith("seeka-app-")){console.error("App name must start with seeka-app-");return}let e=n.appName,t=nt(n.appName.replace("seeka-app-",""),{pascalCase:!0}),r=d.resolve(n.outputDirectory,n.skipSubDir?"":n.directoryName||e);console.log(`Creating new ${n.template.replace(/-/gi," ")} Seeka app in ${r}`),console.log("");let i=d.resolve(r,".git"),s=y.existsSync(i),o=d.resolve(un.default.tmpdir(),".seeka-app-init-git-"+new Date().getTime());if(y.existsSync(o)||y.mkdirSync(o,{recursive:!0}),!n.skipSubDir&&y.existsSync(r)&&an(r)===!1)if(n.force)console.log("--force was used and destination directory is not empty. Clearing out the directory"),s&&(console.info(".git directory found in directory, I will preserve it and remove all other files and directories to prepare for the app creation"),y.cpSync(i,o,{recursive:!0})),y.rmSync(r,{recursive:!0,force:!0});else{console.error("Directory is not empty. Use --force to create app in non-empty directory");return}y.existsSync(r)||y.mkdirSync(r,{recursive:!0}),s&&(y.cpSync(o,i,{recursive:!0}),y.rmSync(o,{recursive:!0}),console.info("Restored .git directory"));let a=d.resolve(__dirname,"init-template"),m=d.resolve(a);y.cpSync(m,r,{recursive:!0});let u=ht(d.join(r,"package.json"),n,ie,"Root",t);$(d.join(r,"README.md"),{"seeka-app-example-name":n.appName}),$(d.join(r,"tsconfig.json"),{"seeka-app-example-name":n.appName});let l=d.resolve(d.join(r,".gitlab-ci.yml")),c=y.readFileSync(l,"utf8");switch(c=c.replace(/seeka-app-example-name/gi,n.appName),y.writeFileSync(l,c),n.template){case"azure-function":Qi(n,r,u,t);break}if(Ki(n,r,a,t),n.installDependencies){console.info("Installing dependencies with "+n.packageManager);try{switch(n.packageManager){case"npm":F.sync("npm",["install"],{stdio:"inherit",cwd:r}),n.components.browser&&F.sync("npm",["install"],{stdio:"inherit",cwd:d.join(r,"src","browser")});break;case"pnpm":F.sync("pnpm",["install"],{stdio:"inherit",cwd:r}),n.components.browser&&F.sync("pnpm",["install"],{stdio:"inherit",cwd:d.join(r,"src","browser")});break;case"yarn":F.sync("yarn",["install"],{stdio:"inherit",cwd:r}),n.components.browser&&F.sync("yarn",["install"],{stdio:"inherit",cwd:d.join(r,"src","browser")});break;default:console.error("Invalid package manager");return}}catch(_){console.error("Error installing dependencies with "+n.packageManager,_)}}if(!n.npmUsername||!n.npmPassword)console.warn("npmUsername and npmPassword should be provided for browser plugin support.");else{let _=d.resolve(r,".yarnrc.yml"),S=Buffer.from(`${n.npmUsername}:${n.npmPassword}`).toString("base64");y.writeFileSync(_,`
55
+ nodeLinker: node-modules
56
+
57
+ nmHoistingLimits: workspaces
56
58
 
57
- lodash-es/lodash.js:
58
- (**
59
- * @license
60
- * Lodash (Custom Build) <https://lodash.com/>
61
- * Build: `lodash modularize exports="es" -o ./`
62
- * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
63
- * Released under MIT license <https://lodash.com/license>
64
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
65
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
66
- *)
67
- */
59
+ npmScopes:
60
+ seeka-labs:
61
+ npmRegistryServer: "https://npm.packages.seeka.services"
62
+ npmAuthToken: "${S}"`)}let p=d.resolve(r,"yarn.lock");y.writeFileSync(p,""),se(),console.log(`Created ${e} in ${r}`),console.log("Boom! Your new Seeka app is ready!"),se();let f=n.skipSubDir?r:d.relative(process.cwd(),r);console.log(`Run "cd ${f}" to change to your apps directory and start creating some magic!`),console.log(""),console.log("")},ht=(n,e,t,r,i)=>{let s=require(n),o;switch(e.packageManager){case"npm":o="npm run";break;case"pnpm":o="pnpm run";break;case"yarn":o="yarn";break;default:console.error("Invalid package manager");return}for(let a in s.scripts)s.scripts[a]=s.scripts[a].replace(/<packageManagerRunPrefix>/gi,o).replace(/seeka-app-example-name/gi,e.appName).replace(/SampleApp/gi,i+"App");return s.dependencies&&s.dependencies["@seeka-labs/sdk-apps-server"]&&(s.dependencies["@seeka-labs/sdk-apps-server"]="^"+s.version),s.name=s.name.replace(/seeka-app-example-name/gi,e.appName),s.version=t,s.description=`Seeka app ${e.appName} - ${r}`,s.author=`${e.developerName} <${e.developerEmail}>`,y.writeFileSync(n,JSON.stringify(s,null,2)),console.info("Scaffolded "+n),console.log(""),s},Ki=(n,e,t,r)=>{let i=d.resolve(d.join(e,"app","browser")),s=ht(d.join(i,"package.json"),n,ie,"Browser plugin",r);$(d.join(i,"README.md"),{"seeka-app-example-name":n.appName}),$(d.join(i,"src","plugin","index.ts"),{"seeka-app-example-name":n.appName,SampleApp:r+"App"}),$(d.join(i,"src","browser.ts"),{SampleApp:r+"App"}),console.info("Scaffolded browser plugin"),console.log("")},$=(n,e)=>{let t=y.readFileSync(d.resolve(n),"utf8");for(let r in e)t=t.replace(new RegExp(r,"gi"),e[r]);y.writeFileSync(d.resolve(n),t)},Qi=(n,e,t,r)=>{let i=d.resolve(d.join(e,"app","server-azure-function")),s=ht(d.join(i,"package.json"),n,t.version,"Azure Function",r);if(y.renameSync(d.join(i,"local.settings.example.json"),d.join(i,"local.settings.json")),n.environmentVariables&&Object.keys(n.environmentVariables).length>0){let o=require(d.join(i,"local.settings.json"));o.Values={...o.Values,...n.environmentVariables},y.writeFileSync(d.join(i,"local.settings.json"),JSON.stringify(o,null,2))}$(d.join(i,"src","lib","state","seeka","installations.ts"),{SampleApp:r+"App"}),$(d.join(i,"README.md"),{"seeka-app-example-name":n.appName}),$(d.join(i,"src","lib","models","index.ts"),{SampleApp:r+"App"}),$(d.join(i,"src","lib","browser","index.ts"),{SampleApp:r+"App","seeka-app-example-name":n.appName}),$(d.join(i,"src","functions","seekaAppWebhook.ts"),{SampleApp:r+"App"}),console.info("Scaffolded Azure function")};var ft=new lr;sn();ft.command("init").description("initialises a new Seeka app").argument("<name>",'name of your app. alphanumeric and hyphens only and must start with "seeka-app-"').addOption(new P("--template <template>","app template").choices(["azure-function","aws-lambda","netlify-function"]).makeOptionMandatory()).addOption(new P("--developer <developer>","app developer name or company").makeOptionMandatory()).addOption(new P("--email <email>","app developer email").makeOptionMandatory()).addOption(new P("--outName [outName]","directory name of the app. a new directory will be created with this name to contain the app.")).addOption(new P("--outDir [outDir]","output directory to create the app in. a new directory will be created here that contains the app.").default("","current working dir")).addOption(new P("--packageManager [packageManager]","package manager").choices(["yarn","npm","pnpm"]).default("yarn")).addOption(new P("--npmUsername [npmUsername]","Private NPM registry username for browser plugin dependencies.")).addOption(new P("--npmPassword [npmPassword]","Private NPM registry password for browser plugin dependencies.")).option("--noDependencies","skip installing dependencies").option("--skipSubDir","use sub directory for app files instead of root folder").option("--force","force creation of app in non-empty directory").option("--browser","adds support for browser plugin served from the app").option("--env [env...]","sets environment variables for the app. Use format of --env KEY1=VALUE1 KEY2=VALUE2").option("--appSettings [appSettings...]","sets app settings for the app. Use format of --appSettings myAppInstallSetting1=string myAppInstallSetting2=string[]").action((n,e)=>{let t={appName:n,components:{browser:e.browser&&e.template==="azure-function"},template:e.template,skipSubDir:e.skipSubDir,outputDirectory:e.outDir||process.cwd(),directoryName:e.outName||void 0,packageManager:e.packageManager,developerEmail:e.email,developerName:e.developer,installDependencies:!e.noDependencies,force:e.force,environmentVariables:mn(e.env),appSettings:[],npmUsername:e.npmUsername,npmPassword:e.npmPassword};ln(t)}).showHelpAfterError(!0);ft.showHelpAfterError(!0);ft.parse();