xl1 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,6 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var O=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(r,e)=>(typeof require<"u"?require:r)[e]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var S=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports);var Pt=S(ct=>{var C=O("path"),L=process.platform==="win32",N=O("fs"),Rr=process.env.NODE_DEBUG&&/fs/.test(process.env.NODE_DEBUG);function Dr(){var t;if(Rr){var r=new Error;t=e}else t=i;return t;function e(n){n&&(r.message=n.message,n=r,i(n))}function i(n){if(n){if(process.throwDeprecation)throw n;if(!process.noDeprecation){var s="fs: missing callback "+(n.stack||n.message);process.traceDeprecation?console.trace(s):console.error(s)}}}}function Tr(t){return typeof t=="function"?t:Dr()}var Te=C.normalize;L?q=/(.*?)(?:[\/\\]+|$)/g:q=/(.*?)(?:[\/]+|$)/g;var q;L?x=/^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/:x=/^[\/]*/;var x;ct.realpathSync=function(r,e){if(r=C.resolve(r),e&&Object.prototype.hasOwnProperty.call(e,r))return e[r];var i=r,n={},s={},a,u,o,c;f();function f(){var m=x.exec(r);a=m[0].length,u=m[0],o=m[0],c="",L&&!s[o]&&(N.lstatSync(o),s[o]=!0)}for(;a<r.length;){q.lastIndex=a;var p=q.exec(r);if(c=u,u+=p[0],o=c+p[1],a=q.lastIndex,!(s[o]||e&&e[o]===o)){var l;if(e&&Object.prototype.hasOwnProperty.call(e,o))l=e[o];else{var h=N.lstatSync(o);if(!h.isSymbolicLink()){s[o]=!0,e&&(e[o]=o);continue}var v=null;if(!L){var d=h.dev.toString(32)+":"+h.ino.toString(32);n.hasOwnProperty(d)&&(v=n[d])}v===null&&(N.statSync(o),v=N.readlinkSync(o)),l=C.resolve(c,v),e&&(e[o]=l),L||(n[d]=v)}r=C.resolve(l,r.slice(a)),f()}}return e&&(e[i]=r),r};ct.realpath=function(r,e,i){if(typeof i!="function"&&(i=Tr(e),e=null),r=C.resolve(r),e&&Object.prototype.hasOwnProperty.call(e,r))return process.nextTick(i.bind(null,null,e[r]));var n=r,s={},a={},u,o,c,f;p();function p(){var m=x.exec(r);u=m[0].length,o=m[0],c=m[0],f="",L&&!a[c]?N.lstat(c,function(y){if(y)return i(y);a[c]=!0,l()}):process.nextTick(l)}function l(){if(u>=r.length)return e&&(e[n]=r),i(null,r);q.lastIndex=u;var m=q.exec(r);return f=o,o+=m[0],c=f+m[1],u=q.lastIndex,a[c]||e&&e[c]===c?process.nextTick(l):e&&Object.prototype.hasOwnProperty.call(e,c)?d(e[c]):N.lstat(c,h)}function h(m,y){if(m)return i(m);if(!y.isSymbolicLink())return a[c]=!0,e&&(e[c]=c),process.nextTick(l);if(!L){var b=y.dev.toString(32)+":"+y.ino.toString(32);if(s.hasOwnProperty(b))return v(null,s[b],c)}N.stat(c,function(k){if(k)return i(k);N.readlink(c,function(_,j){L||(s[b]=j),v(_,j)})})}function v(m,y,b){if(m)return i(m);var k=C.resolve(f,y);e&&(e[b]=k),d(k)}function d(m){r=C.resolve(m,r.slice(u)),p()}}});var vt=S((Ge,Qt)=>{Qt.exports=M;M.realpath=M;M.sync=lt;M.realpathSync=lt;M.monkeypatch=Gr;M.unmonkeypatch=Pr;var B=O("fs"),ht=B.realpath,ft=B.realpathSync,Cr=process.version,$t=/^v[0-5]\./.test(Cr),Ft=Pt();function Bt(t){return t&&t.syscall==="realpath"&&(t.code==="ELOOP"||t.code==="ENOMEM"||t.code==="ENAMETOOLONG")}function M(t,r,e){if($t)return ht(t,r,e);typeof r=="function"&&(e=r,r=null),ht(t,r,function(i,n){Bt(i)?Ft.realpath(t,r,e):e(i,n)})}function lt(t,r){if($t)return ft(t,r);try{return ft(t,r)}catch(e){if(Bt(e))return Ft.realpathSync(t,r);throw e}}function Gr(){B.realpath=M,B.realpathSync=lt}function Pr(){B.realpath=ht,B.realpathSync=ft}});var Wt=S((Pe,Ut)=>{Ut.exports=function(t,r){for(var e=[],i=0;i<t.length;i++){var n=r(t[i],i);$r(n)?e.push.apply(e,n):e.push(n)}return e};var $r=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"}});var Kt=S(($e,Zt)=>{"use strict";Zt.exports=zt;function zt(t,r,e){t instanceof RegExp&&(t=xt(t,e)),r instanceof RegExp&&(r=xt(r,e));var i=Ht(t,r,e);return i&&{start:i[0],end:i[1],pre:e.slice(0,i[0]),body:e.slice(i[0]+t.length,i[1]),post:e.slice(i[1]+r.length)}}function xt(t,r){var e=r.match(t);return e?e[0]:null}zt.range=Ht;function Ht(t,r,e){var i,n,s,a,u,o=e.indexOf(t),c=e.indexOf(r,o+1),f=o;if(o>=0&&c>0){if(t===r)return[o,c];for(i=[],s=e.length;f>=0&&!u;)f==o?(i.push(f),o=e.indexOf(t,f+1)):i.length==1?u=[i.pop(),c]:(n=i.pop(),n<s&&(s=n,a=c),c=e.indexOf(r,f+1)),f=o<c&&o>=0?o:c;i.length&&(u=[s,a])}return u}});var ir=S((Fe,er)=>{var Fr=Wt(),Vt=Kt();er.exports=Ur;var Xt="\0SLASH"+Math.random()+"\0",Jt="\0OPEN"+Math.random()+"\0",dt="\0CLOSE"+Math.random()+"\0",Yt="\0COMMA"+Math.random()+"\0",tr="\0PERIOD"+Math.random()+"\0";function pt(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function Br(t){return t.split("\\\\").join(Xt).split("\\{").join(Jt).split("\\}").join(dt).split("\\,").join(Yt).split("\\.").join(tr)}function Qr(t){return t.split(Xt).join("\\").split(Jt).join("{").split(dt).join("}").split(Yt).join(",").split(tr).join(".")}function rr(t){if(!t)return[""];var r=[],e=Vt("{","}",t);if(!e)return t.split(",");var i=e.pre,n=e.body,s=e.post,a=i.split(",");a[a.length-1]+="{"+n+"}";var u=rr(s);return s.length&&(a[a.length-1]+=u.shift(),a.push.apply(a,u)),r.push.apply(r,a),r}function Ur(t){return t?(t.substr(0,2)==="{}"&&(t="\\{\\}"+t.substr(2)),Q(Br(t),!0).map(Qr)):[]}function Wr(t){return"{"+t+"}"}function xr(t){return/^-?0\d/.test(t)}function zr(t,r){return t<=r}function Hr(t,r){return t>=r}function Q(t,r){var e=[],i=Vt("{","}",t);if(!i||/\$$/.test(i.pre))return[t];var n=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),s=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),a=n||s,u=i.body.indexOf(",")>=0;if(!a&&!u)return i.post.match(/,.*\}/)?(t=i.pre+"{"+i.body+dt+i.post,Q(t)):[t];var o;if(a)o=i.body.split(/\.\./);else if(o=rr(i.body),o.length===1&&(o=Q(o[0],!1).map(Wr),o.length===1)){var f=i.post.length?Q(i.post,!1):[""];return f.map(function(at){return i.pre+o[0]+at})}var c=i.pre,f=i.post.length?Q(i.post,!1):[""],p;if(a){var l=pt(o[0]),h=pt(o[1]),v=Math.max(o[0].length,o[1].length),d=o.length==3?Math.abs(pt(o[2])):1,m=zr,y=h<l;y&&(d*=-1,m=Hr);var b=o.some(xr);p=[];for(var k=l;m(k,h);k+=d){var _;if(s)_=String.fromCharCode(k),_==="\\"&&(_="");else if(_=String(k),b){var j=v-_.length;if(j>0){var V=new Array(j+1).join("0");k<0?_="-"+V+_.slice(1):_=V+_}}p.push(_)}}else p=Fr(o,function(X){return Q(X,!1)});for(var F=0;F<p.length;F++)for(var T=0;T<f.length;T++){var I=c+p[F]+f[T];(!r||a||I)&&e.push(I)}return e}});var tt=S((Be,ur)=>{ur.exports=A;A.Minimatch=E;var z=function(){try{return O("path")}catch (e2){}}()||{sep:"/"};A.sep=z.sep;var yt=A.GLOBSTAR=E.GLOBSTAR={},Zr=ir(),nr={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},mt="[^/]",gt=mt+"*?",Kr="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Vr="(?:(?!(?:\\/|^)\\.).)*?",ar=Xr("().*{}+?[]^$\\!");function Xr(t){return t.split("").reduce(function(r,e){return r[e]=!0,r},{})}var sr=/\/+/;A.filter=Jr;function Jr(t,r){return r=r||{},function(e,i,n){return A(e,t,r)}}function R(t,r){r=r||{};var e={};return Object.keys(t).forEach(function(i){e[i]=t[i]}),Object.keys(r).forEach(function(i){e[i]=r[i]}),e}A.defaults=function(t){if(!t||typeof t!="object"||!Object.keys(t).length)return A;var r=A,e=function(n,s,a){return r(n,s,R(t,a))};return e.Minimatch=function(n,s){return new r.Minimatch(n,R(t,s))},e.Minimatch.defaults=function(n){return r.defaults(R(t,n)).Minimatch},e.filter=function(n,s){return r.filter(n,R(t,s))},e.defaults=function(n){return r.defaults(R(t,n))},e.makeRe=function(n,s){return r.makeRe(n,R(t,s))},e.braceExpand=function(n,s){return r.braceExpand(n,R(t,s))},e.match=function(i,n,s){return r.match(i,n,R(t,s))},e};E.defaults=function(t){return A.defaults(t).Minimatch};function A(t,r,e){return Y(r),e||(e={}),!e.nocomment&&r.charAt(0)==="#"?!1:new E(r,e).match(t)}function E(t,r){if(!(this instanceof E))return new E(t,r);Y(t),r||(r={}),t=t.trim(),!r.allowWindowsEscape&&z.sep!=="/"&&(t=t.split(z.sep).join("/")),this.options=r,this.set=[],this.pattern=t,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.make()}E.prototype.debug=function(){};E.prototype.make=Yr;function Yr(){var t=this.pattern,r=this.options;if(!r.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate();var e=this.globSet=this.braceExpand();r.debug&&(this.debug=function(){console.error.apply(console,arguments)}),this.debug(this.pattern,e),e=this.globParts=e.map(function(i){return i.split(sr)}),this.debug(this.pattern,e),e=e.map(function(i,n,s){return i.map(this.parse,this)},this),this.debug(this.pattern,e),e=e.filter(function(i){return i.indexOf(!1)===-1}),this.debug(this.pattern,e),this.set=e}E.prototype.parseNegate=te;function te(){var t=this.pattern,r=!1,e=this.options,i=0;if(!e.nonegate){for(var n=0,s=t.length;n<s&&t.charAt(n)==="!";n++)r=!r,i++;i&&(this.pattern=t.substr(i)),this.negate=r}}A.braceExpand=function(t,r){return or(t,r)};E.prototype.braceExpand=or;function or(t,r){return r||(this instanceof E?r=this.options:r={}),t=typeof t>"u"?this.pattern:t,Y(t),r.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:Zr(t)}var re=1024*64,Y=function(t){if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>re)throw new TypeError("pattern is too long")};E.prototype.parse=ee;var J={};function ee(t,r){Y(t);var e=this.options;if(t==="**")if(e.noglobstar)t="*";else return yt;if(t==="")return"";var i="",n=!!e.nocase,s=!1,a=[],u=[],o,c=!1,f=-1,p=-1,l=t.charAt(0)==="."?"":e.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",h=this;function v(){if(o){switch(o){case"*":i+=gt,n=!0;break;case"?":i+=mt,n=!0;break;default:i+="\\"+o;break}h.debug("clearStateChar %j %j",o,i),o=!1}}for(var d=0,m=t.length,y;d<m&&(y=t.charAt(d));d++){if(this.debug("%s %s %s %j",t,d,i,y),s&&ar[y]){i+="\\"+y,s=!1;continue}switch(y){case"/":return!1;case"\\":v(),s=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",t,d,i,y),c){this.debug(" in class"),y==="!"&&d===p+1&&(y="^"),i+=y;continue}h.debug("call clearStateChar %j",o),v(),o=y,e.noext&&v();continue;case"(":if(c){i+="(";continue}if(!o){i+="\\(";continue}a.push({type:o,start:d-1,reStart:i.length,open:nr[o].open,close:nr[o].close}),i+=o==="!"?"(?:(?!(?:":"(?:",this.debug("plType %j %j",o,i),o=!1;continue;case")":if(c||!a.length){i+="\\)";continue}v(),n=!0;var b=a.pop();i+=b.close,b.type==="!"&&u.push(b),b.reEnd=i.length;continue;case"|":if(c||!a.length||s){i+="\\|",s=!1;continue}v(),i+="|";continue;case"[":if(v(),c){i+="\\"+y;continue}c=!0,p=d,f=i.length,i+=y;continue;case"]":if(d===p+1||!c){i+="\\"+y,s=!1;continue}var k=t.substring(p+1,d);try{RegExp("["+k+"]")}catch (e3){var _=this.parse(k,J);i=i.substr(0,f)+"\\["+_[0]+"\\]",n=n||_[1],c=!1;continue}n=!0,c=!1,i+=y;continue;default:v(),s?s=!1:ar[y]&&!(y==="^"&&c)&&(i+="\\"),i+=y}}for(c&&(k=t.substr(p+1),_=this.parse(k,J),i=i.substr(0,f)+"\\["+_[0],n=n||_[1]),b=a.pop();b;b=a.pop()){var j=i.slice(b.reStart+b.open.length);this.debug("setting tail",i,b),j=j.replace(/((?:\\{2}){0,64})(\\?)\|/g,function(Ct,Gt,ut){return ut||(ut="\\"),Gt+Gt+ut+"|"}),this.debug(`tail=%j
2
+ %s`,j,j,b,i);var V=b.type==="*"?gt:b.type==="?"?mt:"\\"+b.type;n=!0,i=i.slice(0,b.reStart)+V+"\\("+j}v(),s&&(i+="\\\\");var F=!1;switch(i.charAt(0)){case"[":case".":case"(":F=!0}for(var T=u.length-1;T>-1;T--){var I=u[T],X=i.slice(0,I.reStart),at=i.slice(I.reStart,I.reEnd-8),Dt=i.slice(I.reEnd-8,I.reEnd),W=i.slice(I.reEnd);Dt+=W;var Nr=X.split("(").length-1,st=W;for(d=0;d<Nr;d++)st=st.replace(/\)[+*?]?/,"");W=st;var Tt="";W===""&&r!==J&&(Tt="$");var Lr=X+at+W+Tt+Dt;i=Lr}if(i!==""&&n&&(i="(?=.)"+i),F&&(i=l+i),r===J)return[i,n];if(!n)return ne(t);var Mr=e.nocase?"i":"";try{var ot=new RegExp("^"+i+"$",Mr)}catch (e4){return new RegExp("$.")}return ot._glob=t,ot._src=i,ot}A.makeRe=function(t,r){return new E(t,r||{}).makeRe()};E.prototype.makeRe=ie;function ie(){if(this.regexp||this.regexp===!1)return this.regexp;var t=this.set;if(!t.length)return this.regexp=!1,this.regexp;var r=this.options,e=r.noglobstar?gt:r.dot?Kr:Vr,i=r.nocase?"i":"",n=t.map(function(s){return s.map(function(a){return a===yt?e:typeof a=="string"?ae(a):a._src}).join("\\/")}).join("|");n="^(?:"+n+")$",this.negate&&(n="^(?!"+n+").*$");try{this.regexp=new RegExp(n,i)}catch (e5){this.regexp=!1}return this.regexp}A.match=function(t,r,e){e=e||{};var i=new E(r,e);return t=t.filter(function(n){return i.match(n)}),i.options.nonull&&!t.length&&t.push(r),t};E.prototype.match=function(r,e){if(typeof e>"u"&&(e=this.partial),this.debug("match",r,this.pattern),this.comment)return!1;if(this.empty)return r==="";if(r==="/"&&e)return!0;var i=this.options;z.sep!=="/"&&(r=r.split(z.sep).join("/")),r=r.split(sr),this.debug(this.pattern,"split",r);var n=this.set;this.debug(this.pattern,"set",n);var s,a;for(a=r.length-1;a>=0&&(s=r[a],!s);a--);for(a=0;a<n.length;a++){var u=n[a],o=r;i.matchBase&&u.length===1&&(o=[s]);var c=this.matchOne(o,u,e);if(c)return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate};E.prototype.matchOne=function(t,r,e){var i=this.options;this.debug("matchOne",{this:this,file:t,pattern:r}),this.debug("matchOne",t.length,r.length);for(var n=0,s=0,a=t.length,u=r.length;n<a&&s<u;n++,s++){this.debug("matchOne loop");var o=r[s],c=t[n];if(this.debug(r,o,c),o===!1)return!1;if(o===yt){this.debug("GLOBSTAR",[r,o,c]);var f=n,p=s+1;if(p===u){for(this.debug("** at the end");n<a;n++)if(t[n]==="."||t[n]===".."||!i.dot&&t[n].charAt(0)===".")return!1;return!0}for(;f<a;){var l=t[f];if(this.debug(`
3
+ globstar while`,t,f,r,p,l),this.matchOne(t.slice(f),r.slice(p),e))return this.debug("globstar found match!",f,a,l),!0;if(l==="."||l===".."||!i.dot&&l.charAt(0)==="."){this.debug("dot detected!",t,f,r,p);break}this.debug("globstar swallow a segment, and continue"),f++}return!!(e&&(this.debug(`
4
+ >>> no match, partial?`,t,f,r,p),f===a))}var h;if(typeof o=="string"?(h=c===o,this.debug("string match",o,c,h)):(h=c.match(o),this.debug("pattern match",o,c,h)),!h)return!1}if(n===a&&s===u)return!0;if(n===a)return e;if(s===u)return n===a-1&&t[n]==="";throw new Error("wtf?")};function ne(t){return t.replace(/\\(.)/g,"$1")}function ae(t){return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var cr=S((Qe,bt)=>{typeof Object.create=="function"?bt.exports=function(r,e){e&&(r.super_=e,r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:bt.exports=function(r,e){if(e){r.super_=e;var i=function(){};i.prototype=e.prototype,r.prototype=new i,r.prototype.constructor=r}}});var hr=S((Ue,_t)=>{try{if(wt=O("util"),typeof wt.inherits!="function")throw"";_t.exports=wt.inherits}catch (e6){_t.exports=cr()}var wt});var et=S((We,rt)=>{"use strict";function fr(t){return t.charAt(0)==="/"}function lr(t){var r=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,e=r.exec(t),i=e[1]||"",n=!!(i&&i.charAt(1)!==":");return!!(e[2]||n)}rt.exports=process.platform==="win32"?lr:fr;rt.exports.posix=fr;rt.exports.win32=lr});var kt=S(D=>{D.setopts=fe;D.ownProp=vr;D.makeAbs=H;D.finish=le;D.mark=ve;D.isIgnored=dr;D.childrenIgnored=pe;function vr(t,r){return Object.prototype.hasOwnProperty.call(t,r)}var se=O("fs"),U=O("path"),oe=tt(),pr=et(),Et=oe.Minimatch;function ue(t,r){return t.localeCompare(r,"en")}function ce(t,r){t.ignore=r.ignore||[],Array.isArray(t.ignore)||(t.ignore=[t.ignore]),t.ignore.length&&(t.ignore=t.ignore.map(he))}function he(t){var r=null;if(t.slice(-3)==="/**"){var e=t.replace(/(\/\*\*)+$/,"");r=new Et(e,{dot:!0})}return{matcher:new Et(t,{dot:!0}),gmatcher:r}}function fe(t,r,e){if(e||(e={}),e.matchBase&&r.indexOf("/")===-1){if(e.noglobstar)throw new Error("base matching requires globstar");r="**/"+r}t.silent=!!e.silent,t.pattern=r,t.strict=e.strict!==!1,t.realpath=!!e.realpath,t.realpathCache=e.realpathCache||Object.create(null),t.follow=!!e.follow,t.dot=!!e.dot,t.mark=!!e.mark,t.nodir=!!e.nodir,t.nodir&&(t.mark=!0),t.sync=!!e.sync,t.nounique=!!e.nounique,t.nonull=!!e.nonull,t.nosort=!!e.nosort,t.nocase=!!e.nocase,t.stat=!!e.stat,t.noprocess=!!e.noprocess,t.absolute=!!e.absolute,t.fs=e.fs||se,t.maxLength=e.maxLength||1/0,t.cache=e.cache||Object.create(null),t.statCache=e.statCache||Object.create(null),t.symlinks=e.symlinks||Object.create(null),ce(t,e),t.changedCwd=!1;var i=process.cwd();vr(e,"cwd")?(t.cwd=U.resolve(e.cwd),t.changedCwd=t.cwd!==i):t.cwd=i,t.root=e.root||U.resolve(t.cwd,"/"),t.root=U.resolve(t.root),process.platform==="win32"&&(t.root=t.root.replace(/\\/g,"/")),t.cwdAbs=pr(t.cwd)?t.cwd:H(t,t.cwd),process.platform==="win32"&&(t.cwdAbs=t.cwdAbs.replace(/\\/g,"/")),t.nomount=!!e.nomount,e.nonegate=!0,e.nocomment=!0,e.allowWindowsEscape=!1,t.minimatch=new Et(r,e),t.options=t.minimatch.options}function le(t){for(var r=t.nounique,e=r?[]:Object.create(null),i=0,n=t.matches.length;i<n;i++){var s=t.matches[i];if(!s||Object.keys(s).length===0){if(t.nonull){var a=t.minimatch.globSet[i];r?e.push(a):e[a]=!0}}else{var u=Object.keys(s);r?e.push.apply(e,u):u.forEach(function(o){e[o]=!0})}}if(r||(e=Object.keys(e)),t.nosort||(e=e.sort(ue)),t.mark){for(var i=0;i<e.length;i++)e[i]=t._mark(e[i]);t.nodir&&(e=e.filter(function(o){var c=!/\/$/.test(o),f=t.cache[o]||t.cache[H(t,o)];return c&&f&&(c=f!=="DIR"&&!Array.isArray(f)),c}))}t.ignore.length&&(e=e.filter(function(o){return!dr(t,o)})),t.found=e}function ve(t,r){var e=H(t,r),i=t.cache[e],n=r;if(i){var s=i==="DIR"||Array.isArray(i),a=r.slice(-1)==="/";if(s&&!a?n+="/":!s&&a&&(n=n.slice(0,-1)),n!==r){var u=H(t,n);t.statCache[u]=t.statCache[e],t.cache[u]=t.cache[e]}}return n}function H(t,r){var e=r;return r.charAt(0)==="/"?e=U.join(t.root,r):pr(r)||r===""?e=r:t.changedCwd?e=U.resolve(t.cwd,r):e=U.resolve(r),process.platform==="win32"&&(e=e.replace(/\\/g,"/")),e}function dr(t,r){return t.ignore.length?t.ignore.some(function(e){return e.matcher.match(r)||!!(e.gmatcher&&e.gmatcher.match(r))}):!1}function pe(t,r){return t.ignore.length?t.ignore.some(function(e){return!!(e.gmatcher&&e.gmatcher.match(r))}):!1}});var wr=S((Ke,br)=>{br.exports=yr;yr.GlobSync=w;var de=vt(),mr=tt(),ze=mr.Minimatch,He=_r().Glob,Ze=O("util"),St=O("path"),gr=O("assert"),it=et(),G=kt(),me=G.setopts,Ot=G.ownProp,ge=G.childrenIgnored,ye=G.isIgnored;function yr(t,r){if(typeof r=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
5
+ See: https://github.com/isaacs/node-glob/issues/167`);return new w(t,r).found}function w(t,r){if(!t)throw new Error("must provide pattern");if(typeof r=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
6
+ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof w))return new w(t,r);if(me(this,t,r),this.noprocess)return this;var e=this.minimatch.set.length;this.matches=new Array(e);for(var i=0;i<e;i++)this._process(this.minimatch.set[i],i,!1);this._finish()}w.prototype._finish=function(){if(gr.ok(this instanceof w),this.realpath){var t=this;this.matches.forEach(function(r,e){var i=t.matches[e]=Object.create(null);for(var n in r)try{n=t._makeAbs(n);var s=de.realpathSync(n,t.realpathCache);i[s]=!0}catch(a){if(a.syscall==="stat")i[t._makeAbs(n)]=!0;else throw a}})}G.finish(this)};w.prototype._process=function(t,r,e){gr.ok(this instanceof w);for(var i=0;typeof t[i]=="string";)i++;var n;switch(i){case t.length:this._processSimple(t.join("/"),r);return;case 0:n=null;break;default:n=t.slice(0,i).join("/");break}var s=t.slice(i),a;n===null?a=".":((it(n)||it(t.map(function(c){return typeof c=="string"?c:"[*]"}).join("/")))&&(!n||!it(n))&&(n="/"+n),a=n);var u=this._makeAbs(a);if(!ge(this,a)){var o=s[0]===mr.GLOBSTAR;o?this._processGlobStar(n,a,u,s,r,e):this._processReaddir(n,a,u,s,r,e)}};w.prototype._processReaddir=function(t,r,e,i,n,s){var a=this._readdir(e,s);if(a){for(var u=i[0],o=!!this.minimatch.negate,c=u._glob,f=this.dot||c.charAt(0)===".",p=[],l=0;l<a.length;l++){var h=a[l];if(h.charAt(0)!=="."||f){var v;o&&!t?v=!h.match(u):v=h.match(u),v&&p.push(h)}}var d=p.length;if(d!==0){if(i.length===1&&!this.mark&&!this.stat){this.matches[n]||(this.matches[n]=Object.create(null));for(var l=0;l<d;l++){var h=p[l];t&&(t.slice(-1)!=="/"?h=t+"/"+h:h=t+h),h.charAt(0)==="/"&&!this.nomount&&(h=St.join(this.root,h)),this._emitMatch(n,h)}return}i.shift();for(var l=0;l<d;l++){var h=p[l],m;t?m=[t,h]:m=[h],this._process(m.concat(i),n,s)}}}};w.prototype._emitMatch=function(t,r){if(!ye(this,r)){var e=this._makeAbs(r);if(this.mark&&(r=this._mark(r)),this.absolute&&(r=e),!this.matches[t][r]){if(this.nodir){var i=this.cache[e];if(i==="DIR"||Array.isArray(i))return}this.matches[t][r]=!0,this.stat&&this._stat(r)}}};w.prototype._readdirInGlobStar=function(t){if(this.follow)return this._readdir(t,!1);var r,e,i;try{e=this.fs.lstatSync(t)}catch(s){if(s.code==="ENOENT")return null}var n=e&&e.isSymbolicLink();return this.symlinks[t]=n,!n&&e&&!e.isDirectory()?this.cache[t]="FILE":r=this._readdir(t,!1),r};w.prototype._readdir=function(t,r){var e;if(r&&!Ot(this.symlinks,t))return this._readdirInGlobStar(t);if(Ot(this.cache,t)){var i=this.cache[t];if(!i||i==="FILE")return null;if(Array.isArray(i))return i}try{return this._readdirEntries(t,this.fs.readdirSync(t))}catch(n){return this._readdirError(t,n),null}};w.prototype._readdirEntries=function(t,r){if(!this.mark&&!this.stat)for(var e=0;e<r.length;e++){var i=r[e];t==="/"?i=t+i:i=t+"/"+i,this.cache[i]=!0}return this.cache[t]=r,r};w.prototype._readdirError=function(t,r){switch(r.code){case"ENOTSUP":case"ENOTDIR":var e=this._makeAbs(t);if(this.cache[e]="FILE",e===this.cwdAbs){var i=new Error(r.code+" invalid cwd "+this.cwd);throw i.path=this.cwd,i.code=r.code,i}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(t)]=!1;break;default:if(this.cache[this._makeAbs(t)]=!1,this.strict)throw r;this.silent||console.error("glob error",r);break}};w.prototype._processGlobStar=function(t,r,e,i,n,s){var a=this._readdir(e,s);if(a){var u=i.slice(1),o=t?[t]:[],c=o.concat(u);this._process(c,n,!1);var f=a.length,p=this.symlinks[e];if(!(p&&s))for(var l=0;l<f;l++){var h=a[l];if(!(h.charAt(0)==="."&&!this.dot)){var v=o.concat(a[l],u);this._process(v,n,!0);var d=o.concat(a[l],i);this._process(d,n,!0)}}}};w.prototype._processSimple=function(t,r){var e=this._stat(t);if(this.matches[r]||(this.matches[r]=Object.create(null)),!!e){if(t&&it(t)&&!this.nomount){var i=/[\/\\]$/.test(t);t.charAt(0)==="/"?t=St.join(this.root,t):(t=St.resolve(this.root,t),i&&(t+="/"))}process.platform==="win32"&&(t=t.replace(/\\/g,"/")),this._emitMatch(r,t)}};w.prototype._stat=function(t){var r=this._makeAbs(t),e=t.slice(-1)==="/";if(t.length>this.maxLength)return!1;if(!this.stat&&Ot(this.cache,r)){var a=this.cache[r];if(Array.isArray(a)&&(a="DIR"),!e||a==="DIR")return a;if(e&&a==="FILE")return!1}var i,n=this.statCache[r];if(!n){var s;try{s=this.fs.lstatSync(r)}catch(u){if(u&&(u.code==="ENOENT"||u.code==="ENOTDIR"))return this.statCache[r]=!1,!1}if(s&&s.isSymbolicLink())try{n=this.fs.statSync(r)}catch (e7){n=s}else n=s}this.statCache[r]=n;var a=!0;return n&&(a=n.isDirectory()?"DIR":"FILE"),this.cache[r]=this.cache[r]||a,e&&a==="FILE"?!1:a};w.prototype._mark=function(t){return G.mark(this,t)};w.prototype._makeAbs=function(t){return G.makeAbs(this,t)}});var At=S((Ve,kr)=>{kr.exports=Er;function Er(t,r){if(t&&r)return Er(t)(r);if(typeof t!="function")throw new TypeError("need wrapper function");return Object.keys(t).forEach(function(i){e[i]=t[i]}),e;function e(){for(var i=new Array(arguments.length),n=0;n<i.length;n++)i[n]=arguments[n];var s=t.apply(this,i),a=i[i.length-1];return typeof s=="function"&&s!==a&&Object.keys(a).forEach(function(u){s[u]=a[u]}),s}}});var It=S((Xe,jt)=>{var Sr=At();jt.exports=Sr(nt);jt.exports.strict=Sr(Or);nt.proto=nt(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return nt(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return Or(this)},configurable:!0})});function nt(t){var r=function(){return r.called?r.value:(r.called=!0,r.value=t.apply(this,arguments))};return r.called=!1,r}function Or(t){var r=function(){if(r.called)throw new Error(r.onceError);return r.called=!0,r.value=t.apply(this,arguments)},e=t.name||"Function wrapped with `once`";return r.onceError=e+" shouldn't be called more than once",r.called=!1,r}});var jr=S((Je,Ar)=>{var be=At(),Z=Object.create(null),we=It();Ar.exports=be(_e);function _e(t,r){return Z[t]?(Z[t].push(r),null):(Z[t]=[r],Ee(t))}function Ee(t){return we(function r(){var e=Z[t],i=e.length,n=ke(arguments);try{for(var s=0;s<i;s++)e[s].apply(null,n)}finally{e.length>i?(e.splice(0,i),process.nextTick(function(){r.apply(null,n)})):delete Z[t]}})}function ke(t){for(var r=t.length,e=[],i=0;i<r;i++)e[i]=t[i];return e}});var _r=S((ri,qr)=>{qr.exports=P;var Se=vt(),Ir=tt(),Ye=Ir.Minimatch,Oe=hr(),Ae=O("events").EventEmitter,qt=O("path"),Nt=O("assert"),K=et(),Mt=wr(),$=kt(),je=$.setopts,Lt=$.ownProp,Rt=jr(),ti=O("util"),Ie=$.childrenIgnored,qe=$.isIgnored,Ne=It();function P(t,r,e){if(typeof r=="function"&&(e=r,r={}),r||(r={}),r.sync){if(e)throw new TypeError("callback provided to sync glob");return Mt(t,r)}return new g(t,r,e)}P.sync=Mt;var Le=P.GlobSync=Mt.GlobSync;P.glob=P;function Me(t,r){if(r===null||typeof r!="object")return t;for(var e=Object.keys(r),i=e.length;i--;)t[e[i]]=r[e[i]];return t}P.hasMagic=function(t,r){var e=Me({},r);e.noprocess=!0;var i=new g(t,e),n=i.minimatch.set;if(!t)return!1;if(n.length>1)return!0;for(var s=0;s<n[0].length;s++)if(typeof n[0][s]!="string")return!0;return!1};P.Glob=g;Oe(g,Ae);function g(t,r,e){if(typeof r=="function"&&(e=r,r=null),r&&r.sync){if(e)throw new TypeError("callback provided to sync glob");return new Le(t,r)}if(!(this instanceof g))return new g(t,r,e);je(this,t,r),this._didRealPath=!1;var i=this.minimatch.set.length;this.matches=new Array(i),typeof e=="function"&&(e=Ne(e),this.on("error",e),this.on("end",function(o){e(null,o)}));var n=this;if(this._processing=0,this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(i===0)return u();for(var s=!0,a=0;a<i;a++)this._process(this.minimatch.set[a],a,!1,u);s=!1;function u(){--n._processing,n._processing<=0&&(s?process.nextTick(function(){n._finish()}):n._finish())}}g.prototype._finish=function(){if(Nt(this instanceof g),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();$.finish(this),this.emit("end",this.found)}};g.prototype._realpath=function(){if(this._didRealpath)return;this._didRealpath=!0;var t=this.matches.length;if(t===0)return this._finish();for(var r=this,e=0;e<this.matches.length;e++)this._realpathSet(e,i);function i(){--t===0&&r._finish()}};g.prototype._realpathSet=function(t,r){var e=this.matches[t];if(!e)return r();var i=Object.keys(e),n=this,s=i.length;if(s===0)return r();var a=this.matches[t]=Object.create(null);i.forEach(function(u,o){u=n._makeAbs(u),Se.realpath(u,n.realpathCache,function(c,f){c?c.syscall==="stat"?a[u]=!0:n.emit("error",c):a[f]=!0,--s===0&&(n.matches[t]=a,r())})})};g.prototype._mark=function(t){return $.mark(this,t)};g.prototype._makeAbs=function(t){return $.makeAbs(this,t)};g.prototype.abort=function(){this.aborted=!0,this.emit("abort")};g.prototype.pause=function(){this.paused||(this.paused=!0,this.emit("pause"))};g.prototype.resume=function(){if(this.paused){if(this.emit("resume"),this.paused=!1,this._emitQueue.length){var t=this._emitQueue.slice(0);this._emitQueue.length=0;for(var r=0;r<t.length;r++){var e=t[r];this._emitMatch(e[0],e[1])}}if(this._processQueue.length){var i=this._processQueue.slice(0);this._processQueue.length=0;for(var r=0;r<i.length;r++){var n=i[r];this._processing--,this._process(n[0],n[1],n[2],n[3])}}}};g.prototype._process=function(t,r,e,i){if(Nt(this instanceof g),Nt(typeof i=="function"),!this.aborted){if(this._processing++,this.paused){this._processQueue.push([t,r,e,i]);return}for(var n=0;typeof t[n]=="string";)n++;var s;switch(n){case t.length:this._processSimple(t.join("/"),r,i);return;case 0:s=null;break;default:s=t.slice(0,n).join("/");break}var a=t.slice(n),u;s===null?u=".":((K(s)||K(t.map(function(f){return typeof f=="string"?f:"[*]"}).join("/")))&&(!s||!K(s))&&(s="/"+s),u=s);var o=this._makeAbs(u);if(Ie(this,u))return i();var c=a[0]===Ir.GLOBSTAR;c?this._processGlobStar(s,u,o,a,r,e,i):this._processReaddir(s,u,o,a,r,e,i)}};g.prototype._processReaddir=function(t,r,e,i,n,s,a){var u=this;this._readdir(e,s,function(o,c){return u._processReaddir2(t,r,e,i,n,s,c,a)})};g.prototype._processReaddir2=function(t,r,e,i,n,s,a,u){if(!a)return u();for(var o=i[0],c=!!this.minimatch.negate,f=o._glob,p=this.dot||f.charAt(0)===".",l=[],h=0;h<a.length;h++){var v=a[h];if(v.charAt(0)!=="."||p){var d;c&&!t?d=!v.match(o):d=v.match(o),d&&l.push(v)}}var m=l.length;if(m===0)return u();if(i.length===1&&!this.mark&&!this.stat){this.matches[n]||(this.matches[n]=Object.create(null));for(var h=0;h<m;h++){var v=l[h];t&&(t!=="/"?v=t+"/"+v:v=t+v),v.charAt(0)==="/"&&!this.nomount&&(v=qt.join(this.root,v)),this._emitMatch(n,v)}return u()}i.shift();for(var h=0;h<m;h++){var v=l[h],y;t&&(t!=="/"?v=t+"/"+v:v=t+v),this._process([v].concat(i),n,s,u)}u()};g.prototype._emitMatch=function(t,r){if(!this.aborted&&!qe(this,r)){if(this.paused){this._emitQueue.push([t,r]);return}var e=K(r)?r:this._makeAbs(r);if(this.mark&&(r=this._mark(r)),this.absolute&&(r=e),!this.matches[t][r]){if(this.nodir){var i=this.cache[e];if(i==="DIR"||Array.isArray(i))return}this.matches[t][r]=!0;var n=this.statCache[e];n&&this.emit("stat",r,n),this.emit("match",r)}}};g.prototype._readdirInGlobStar=function(t,r){if(this.aborted)return;if(this.follow)return this._readdir(t,!1,r);var e="lstat\0"+t,i=this,n=Rt(e,s);n&&i.fs.lstat(t,n);function s(a,u){if(a&&a.code==="ENOENT")return r();var o=u&&u.isSymbolicLink();i.symlinks[t]=o,!o&&u&&!u.isDirectory()?(i.cache[t]="FILE",r()):i._readdir(t,!1,r)}};g.prototype._readdir=function(t,r,e){if(!this.aborted&&(e=Rt("readdir\0"+t+"\0"+r,e),!!e)){if(r&&!Lt(this.symlinks,t))return this._readdirInGlobStar(t,e);if(Lt(this.cache,t)){var i=this.cache[t];if(!i||i==="FILE")return e();if(Array.isArray(i))return e(null,i)}var n=this;n.fs.readdir(t,Re(this,t,e))}};function Re(t,r,e){return function(i,n){i?t._readdirError(r,i,e):t._readdirEntries(r,n,e)}}g.prototype._readdirEntries=function(t,r,e){if(!this.aborted){if(!this.mark&&!this.stat)for(var i=0;i<r.length;i++){var n=r[i];t==="/"?n=t+n:n=t+"/"+n,this.cache[n]=!0}return this.cache[t]=r,e(null,r)}};g.prototype._readdirError=function(t,r,e){if(!this.aborted){switch(r.code){case"ENOTSUP":case"ENOTDIR":var i=this._makeAbs(t);if(this.cache[i]="FILE",i===this.cwdAbs){var n=new Error(r.code+" invalid cwd "+this.cwd);n.path=this.cwd,n.code=r.code,this.emit("error",n),this.abort()}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(t)]=!1;break;default:this.cache[this._makeAbs(t)]=!1,this.strict&&(this.emit("error",r),this.abort()),this.silent||console.error("glob error",r);break}return e()}};g.prototype._processGlobStar=function(t,r,e,i,n,s,a){var u=this;this._readdir(e,s,function(o,c){u._processGlobStar2(t,r,e,i,n,s,c,a)})};g.prototype._processGlobStar2=function(t,r,e,i,n,s,a,u){if(!a)return u();var o=i.slice(1),c=t?[t]:[],f=c.concat(o);this._process(f,n,!1,u);var p=this.symlinks[e],l=a.length;if(p&&s)return u();for(var h=0;h<l;h++){var v=a[h];if(!(v.charAt(0)==="."&&!this.dot)){var d=c.concat(a[h],o);this._process(d,n,!0,u);var m=c.concat(a[h],i);this._process(m,n,!0,u)}}u()};g.prototype._processSimple=function(t,r,e){var i=this;this._stat(t,function(n,s){i._processSimple2(t,r,n,s,e)})};g.prototype._processSimple2=function(t,r,e,i,n){if(this.matches[r]||(this.matches[r]=Object.create(null)),!i)return n();if(t&&K(t)&&!this.nomount){var s=/[\/\\]$/.test(t);t.charAt(0)==="/"?t=qt.join(this.root,t):(t=qt.resolve(this.root,t),s&&(t+="/"))}process.platform==="win32"&&(t=t.replace(/\\/g,"/")),this._emitMatch(r,t),n()};g.prototype._stat=function(t,r){var e=this._makeAbs(t),i=t.slice(-1)==="/";if(t.length>this.maxLength)return r();if(!this.stat&&Lt(this.cache,e)){var n=this.cache[e];if(Array.isArray(n)&&(n="DIR"),!i||n==="DIR")return r(null,n);if(i&&n==="FILE")return r()}var s,a=this.statCache[e];if(a!==void 0){if(a===!1)return r(null,a);var u=a.isDirectory()?"DIR":"FILE";return i&&u==="FILE"?r():r(null,u,a)}var o=this,c=Rt("stat\0"+e,f);c&&o.fs.lstat(e,c);function f(p,l){if(l&&l.isSymbolicLink())return o.fs.stat(e,function(h,v){h?o._stat2(t,e,null,l,r):o._stat2(t,e,h,v,r)});o._stat2(t,e,p,l,r)}};g.prototype._stat2=function(t,r,e,i,n){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR"))return this.statCache[r]=!1,n();var s=t.slice(-1)==="/";if(this.statCache[r]=i,r.slice(-1)==="/"&&i&&!i.isDirectory())return n(null,!1,i);var a=!0;return i&&(a=i.isDirectory()?"DIR":"FILE"),this.cache[r]=this.cache[r]||a,s&&a==="FILE"?n():n(null,a,i)}});exports.a = O; exports.b = S; exports.c = _r;
@@ -0,0 +1,6 @@
1
+ #! /usr/bin/env node
2
+ "use strict";var _chunk5KSN6VOAjs = require('../chunk-5KSN6VOA.js');var d=_chunk5KSN6VOAjs.b.call(void 0, (X,u)=>{var r=_chunk5KSN6VOAjs.a.call(void 0, "handlebars"),t=_chunk5KSN6VOAjs.a.call(void 0, "fs"),S=_chunk5KSN6VOAjs.a.call(void 0, "js-yaml"),{camelCase:b,capitalCase:F,constantCase:O,dotCase:j,headerCase:E,noCase:w,paramCase:_,pascalCase:I,pathCase:N,sentenceCase:v,snakeCase:D}=_chunk5KSN6VOAjs.a.call(void 0, "change-case");r.registerHelper("camelCase",b);r.registerHelper("capitalCase",F);r.registerHelper("constantCase",O);r.registerHelper("dotCase",j);r.registerHelper("headerCase",E);r.registerHelper("noCase",w);r.registerHelper("paramCase",_);r.registerHelper("pascalCase",I);r.registerHelper("pathCase",N);r.registerHelper("sentenceCase",v);r.registerHelper("snakeCase",D);r.registerHelper("isdefined",function(e){return e!==void 0});r.registerHelper("upper",function(e){return e.toUpperCase()});r.registerHelper("base64",function(e){return t.existsSync(e)?t.readFileSync(e,{encoding:"base64"}):""});r.registerHelper("read",function(e){return t.existsSync(e)?t.readFileSync(e,"utf8"):""});r.registerHelper("readOneLine",function(e){var n;return t.existsSync(e)?(n=t.readFileSync(e,"utf8"))==null?void 0:n.replace(/\n|\r/g," "):""});r.registerHelper("readEscape",function(e){var n;return t.existsSync(e)?(n=t.readFileSync(e,"utf8"))==null?void 0:n.replace(/\n|\r/g," ").replace(/\"/g,'\\"'):""});r.registerHelper("readJson",function(e){return t.existsSync(e)?JSON.parse(t.readFileSync(e,"utf8")):""});r.registerHelper("readYaml",function(e){return t.existsSync(e)?S.load(t.readFileSync(ymlFile,"utf8")):""});var G=(e,n={noEscape:!0})=>r.compile(e,n);u.exports={getEngine:G}});var m=_chunk5KSN6VOAjs.b.call(void 0, (Z,g)=>{var J=_chunk5KSN6VOAjs.a.call(void 0, "path");g.exports={CONFIG_DIR:J.join(__dirname,"config")}});var y=_chunk5KSN6VOAjs.b.call(void 0, (ee,C)=>{var f=_chunk5KSN6VOAjs.a.call(void 0, "path"),R=_chunk5KSN6VOAjs.c.call(void 0, ),k=_chunk5KSN6VOAjs.a.call(void 0, "js-yaml"),A=_chunk5KSN6VOAjs.a.call(void 0, "fs"),{CONFIG_DIR:L}=m(),P=e=>k.load(A.readFileSync(e,"utf8")),T=e=>R.sync(f.join(e)).map(P).reduce((n,o)=>({...n,...o}),{}),U=f.join(L,"*.yml"),Y=()=>T(U);C.exports={getConfig:Y}});var x=_chunk5KSN6VOAjs.b.call(void 0, (re,H)=>{var{getEngine:$}=d(),z=_chunk5KSN6VOAjs.a.call(void 0, "os"),p=y().getConfig(),{execSync:B,spawn:K}=_chunk5KSN6VOAjs.a.call(void 0, "child_process"),M=e=>e in p?p[e]:e;function Q(e,n,o=!1){if(o){let[a,...i]=e.split(" ");K(a,i,{stdio:"inherit",shell:n||!0,cwd:process.cwd()}).on("error",h=>{console.error("Error executing command:",h.message)})}else try{return B(e,{encoding:"utf-8"}).trim()}catch(a){throw console.error("Error executing command:",a.message),a}}var V={command:"*",describe:"convert json to yaml, csv, tsv, xlsx",builder:{template:{alias:"t",describe:"template string",demandOption:!1,default:void 0,type:"string"},exec:{alias:"e",describe:"execute command",demandOption:!1,type:"boolean"},print:{alias:"p",describe:"print command",demandOption:!1,type:"boolean"},shell:{alias:"s",describe:"shell",demandOption:!1,type:"string"}},handler(e){(async()=>{let{template:n,exec:o,print:a}=e;if(!n){console.log(`jsh1 -t {template} [options]
3
+
4
+ template:
5
+ `,Object.keys(p).map(c=>` ${c}
6
+ `).join(""));return}let i=$(M(n),{noEscape:!0})(e);if(o){let c=i;z.platform()==="win32"&&(c="chcp 65001 && "+i),Q(c,e.shell,!0),a&&console.log(i)}else console.log(i)})()}};H.exports=V});var W=()=>{let e=_chunk5KSN6VOAjs.a.call(void 0, "yargs").scriptName("fmt1");e.command(x());let n=e.parse()};W();
@@ -0,0 +1,2 @@
1
+ #! /usr/bin/env node
2
+ "use strict";var _chunk5KSN6VOAjs = require('../chunk-5KSN6VOA.js');var E=_chunk5KSN6VOAjs.b.call(void 0, (Ye,Q)=>{var T=_chunk5KSN6VOAjs.a.call(void 0, "fs"),W=_chunk5KSN6VOAjs.a.call(void 0, "xlsx"),me=e=>{let{file:t,sheet:s,range:n,defval:o,noNullRow:r}=e;if(!T.existsSync(t)){console.log("file not found, ",t);return}if(![".xlsx",".xlsm"].find(u=>t.endsWith(u))){console.log("file type error, ",t);return}let l=W.readFile(t,{bookSheets:!1});if(!l)return null;let h=l.Sheets[s||l.SheetNames[0]],i={range:n,blankrows:!1,defval:o},d=W.utils.sheet_to_json(h,i);return r?d.filter(u=>Object.values(u).some(p=>!!p)):d},ye=e=>{let{file:t,data:s,sheet:n}=e;if(!(t&&s&&Array.isArray(s)&&s.length>0))return;let o=Array.isArray(s[0])?W.utils.aoa_to_sheet(s):W.utils.json_to_sheet(s),r=T.existsSync(t)?W.readFile(t,{cellDates:!0}):W.utils.book_new();W.utils.book_append_sheet(r,o,n?n.substring(0,31):"Sheet1",!0),W.writeFile(r,t,{compression:!0})},N=e=>{let[t,s]=e.split(":"),n=t.replace(/\D/g,""),o=s.replace(/\D/g,""),r=t.replace(/\d/g,""),l=s.replace(/\d/g,"");return{startRow:parseInt(n),endRow:parseInt(o),startCol:r,endCol:l,firstRow:`${t}:${l}${n}`,firstCol:`${t}:${r}${o}`}},z=(e,t,s,n,o)=>{let r=[];for(let l=t;l<=s;l++){let c=[];for(let h=n;h<=o;h++){let d=e[""];c.push(d?d.v:null)}r.push(c)}return r},Z=(e,t)=>{let s=N(t);return z(e,s.startRow,s.endRow,s.startCol,s.endCol)},be=(e,t)=>{let s=N(t);return Z(e,s.firstRow)[0]},Se=(e,t)=>{let s=N(t);return Z(e,s.firstCol)[0]};Q.exports={readXlsx:me,writeXlsx:ye,getSheetData:Z,getSheetData2:z,parseRange:N,getFirstRow:be,getFirstCol:Se}});var G=_chunk5KSN6VOAjs.b.call(void 0, (Ge,le)=>{var L=_chunk5KSN6VOAjs.a.call(void 0, "path"),y=_chunk5KSN6VOAjs.a.call(void 0, "fs"),Y=_chunk5KSN6VOAjs.c.call(void 0, ),U=_chunk5KSN6VOAjs.a.call(void 0, "js-yaml"),J=_chunk5KSN6VOAjs.a.call(void 0, "xlsx"),{readXlsx:V,writeXlsx:ee}=E(),ke=_chunk5KSN6VOAjs.a.call(void 0, "json2xml"),H=(e,t="",s={})=>{for(let n in e)if(e.hasOwnProperty(n)){let o=t?`${t}.${n}`:n;typeof e[n]=="object"&&e[n]!==null&&!Array.isArray(e[n])?H(e[n],o,s):s[o]=e[n]}return s},M=(e,t)=>{let s=L.dirname(t);y.existsSync(s)||y.mkdirSync(s,{recursive:!0}),y.writeFileSync(t,e,{encoding:"utf8"})},Re=e=>Y.sync(L.join(e)),Fe=e=>Y.sync(L.join(e)).find(t=>t!==void 0),Ce=e=>{let t=Y.sync(e,{cwd:".",nocase:!0,nodir:!1});return t&&t.length>0},te=e=>y.existsSync(e)?JSON.parse(y.readFileSync(e,"utf8")):null,se=e=>y.existsSync(e)?U.load(y.readFileSync(e,"utf8")):null,ne=e=>{let{file:t,data:s}=e;if(Array.isArray(s)){let n=y.createWriteStream(t);n.write("[","utf-8"),s.map((o,r)=>n.write(JSON.stringify(o)+(r===s.length-1?"":","),"utf-8")),n.write("]","utf-8"),n.end(),n.on("finish",()=>{}),n.on("error",o=>{console.error(o)})}else y.writeFileSync(t,JSON.stringify(s,null,2),{encoding:"utf8"})},oe=e=>{let{file:t,data:s}=e,n=U.dump(s);y.writeFileSync(t,n,"utf8")},_e=e=>{let{file:t}=e;if(!y.existsSync(t))return null;if(t.endsWith(".json"))return te(t);if(t.endsWith(".yaml")||t.endsWith(".yml"))return se(t);if(t.endsWith(".xlsx"))return V(e)},We=e=>!![".json",".yaml",".xlsx",".yml"].find(s=>e.endsWith(s)),re=(e,t,s)=>{if(e.endsWith(".json"))return ne({file:e,data:t});if(e.endsWith(".yaml")||e.endsWith(".yml"))return oe({file:e,data:t});if(e.endsWith(".xlsx"))return ee({file:e,data:t.map(H),sheet:s&&s.sheet?s.sheet:"Sheet1"});if(e.endsWith(".csv")){let n=J.utils.json_to_sheet(t.map(H)),o=J.utils.sheet_to_csv(n);return M(o,e)}if(e.endsWith(".tsv")){let n=J.utils.json_to_sheet(t.map(H)),o=J.utils.sheet_to_csv(n,{FS:" "});return M(o,e)}if(e.endsWith(".xml")){let n=ke(t,{header:!0});return M(n,e)}console.error("not support type")},Ae=e=>{let{files:t,data:s,sheet:n}=e;t&&t.length>0&&t.map(o=>{re(o,s,{sheet:n})})};le.exports={save:M,find:Re,findOne:Fe,isExsit:Ce,readJson:te,writeJson:ne,readYaml:se,writeYaml:oe,readXlsx:V,writeXlsx:ee,readFile:_e,canReadFile:We,writeFile:re,writeFiles:Ae}});var ce=_chunk5KSN6VOAjs.b.call(void 0, (Ke,ae)=>{var{readXlsx:Oe}=E(),{writeFile:ve}=G(),je={command:"read",describe:"load excel file",builder:{file:{alias:"f",describe:"load xlsx file ",demandOption:!0,type:"string"},sheet:{alias:"s",describe:"xlsx sheet name",demandOption:!1,type:"string"},range:{alias:"r",describe:"range of excel",default:"A1:Z2000",demandOption:!1,type:"string"},defval:{describe:"defval of cell",demandOption:!1,default:void 0,type:"string"},output:{alias:"o",describe:"output file: json, yaml, csv, tsv, xlsx",demandOption:!1,default:void 0,type:"string"}},handler(e){(async()=>{let t=Oe(e);e.output?ve(e.output,t):console.log(JSON.stringify(t,null,2))})()}};ae.exports=je});var ue=_chunk5KSN6VOAjs.b.call(void 0, (Be,de)=>{var qe=_chunk5KSN6VOAjs.a.call(void 0, "fs"),ie=_chunk5KSN6VOAjs.a.call(void 0, "exceljs"),Ie=async e=>{let{file:t,sheet:s,range:n,defval:o,noNullRow:r}=e;if(!qe.existsSync(t)){console.log("file not found, ",t);return}if(![".xlsx",".xlsm"].find(b=>t.endsWith(b))){console.log("file type error, ",t);return}let l=new ie.Workbook;await l.xlsx.readFile(t);let c=s?l.getWorksheet(s):l.worksheets[0];if(!c)return null;let{startRow:h,endRow:i,startCol:d,endCol:u}=D(n||"A1:Z2000"),p=[];return c.eachRow({includeEmpty:!1},(b,F)=>{if(F>=h&&F<=i){let S={};b.eachCell({includeEmpty:!0},(w,m)=>{if(m>=d&&m<=u){let f=c.getRow(h).getCell(m).value||`__EMPTY_${m-1}`;S[f]=w.value!==null?w.value:o}}),(!r||Object.values(S).some(w=>w!==null))&&p.push(S)}}),p},$e=async e=>{let{file:t,data:s,sheet:n}=e;if(!(t&&s&&Array.isArray(s)&&s.length>0))return;let o=new ie.Workbook,r=o.addWorksheet(n?n.substring(0,31):"Sheet1");if(Array.isArray(s[0]))r.addRows(s);else{let l=Object.keys(s[0]);r.addRow(l),s.forEach(c=>{r.addRow(l.map(h=>c[h]))})}await o.xlsx.writeFile(t)},D=e=>{let[t,s]=e.split(":"),n=t.replace(/\D/g,""),o=s.replace(/\D/g,""),r=t.replace(/\d/g,""),l=s.replace(/\d/g,"");return{startRow:parseInt(n),endRow:parseInt(o),startCol:r,endCol:l,firstRow:`${t}:${l}${t.replace(/\D/g,"")}`,firstCol:`${t}:${r}${s.replace(/\D/g,"")}`}},De=async(e,t)=>{let{startRow:s,endRow:n,startCol:o,endCol:r}=D(t),l=[];for(let c=s;c<=n;c++){let h=[];for(let i=o;i<=r;i++){let d=e.getCell(c,i);h.push(d.value)}l.push(h)}return l},Xe=async(e,t)=>{let{startRow:s,startCol:n,endCol:o}=D(t),r=[];for(let l=n;l<=o;l++){let c=e.getCell(s,l);r.push(c.value)}return r},Ne=async(e,t)=>{let{startRow:s,endRow:n,startCol:o}=D(t),r=[];for(let l=s;l<=n;l++){let c=e.getCell(l,o);r.push(c.value)}return r};de.exports={readXlsx:Ie,writeXlsx:$e,getSheetData:De,parseRange:D,getFirstRow:Xe,getFirstCol:Ne}});var pe=_chunk5KSN6VOAjs.b.call(void 0, (Te,he)=>{var fe=_chunk5KSN6VOAjs.a.call(void 0, "fs"),Ee=async e=>{let{readXlsx:t,parseRange:s}=E(),n=_chunk5KSN6VOAjs.a.call(void 0, "xlsx"),o=(...a)=>{e.debug&&console.log(...a)},r=a=>{let[x,C,j]=a.split("|");return{file:x,sheet:C,range:j||"A1:Z2000",defval:null,noNullRow:!0,debug:e.debug}},l=a=>{let x=Object.values(a);return x&&x.length>0?x[0]:""},[c,...h]=e.files,i=r(c),d=n.readFile(i.file,{bookSheets:!1}),u=d.Sheets[i.sheet||d.SheetNames[0]],p=s(i.range),b=n.utils.sheet_to_json(u,{header:1,range:p.firstRow,blankrows:!0,defval:null})[0],F=n.utils.sheet_to_json(u,{header:1,range:p.firstCol,blankrows:!0,defval:null}).map(a=>a[0]);o(s(i.range)),o("Header",b),o("RowIds",F);let S=h.map(r);S.forEach((a,x)=>{let C=t(a),j=C.map(l);console.log(`================${a.sheet}=================`),j.forEach((k,q)=>{let R=F.findIndex(_=>k&&k===_);if(o(a.sheet,k,R>-1?"OK":"NG",`SheetProcess:${x+1}/${S.length}`),R>-1){let _=C[q],X=Object.keys(_).slice(1);X.forEach((A,P)=>{let I=b.findIndex(B=>B&&A===B),O=R,$=I,K=n.utils.encode_cell({r:O,c:$});u[K]={t:"s",v:_[A]},e.debug&&console.log(a.sheet,k,`RowProcess:${(P+1)/X.length*100}%`,[K,O,$,_[A]])})}})}),console.log("Merge completed successfully.");let w=e.output,m=fe.existsSync(w)?n.readFile(w,{cellDates:!0}):n.utils.book_new(),f=(e.sheet||"MergedSheet").substring(0,31);n.utils.book_append_sheet(m,u,f,!0),n.writeFile(m,w,{compression:!0})},Je=async e=>{let{readXlsx:t,parseRange:s}=ue(),n=_chunk5KSN6VOAjs.a.call(void 0, "exceljs"),o=(...f)=>{e.debug&&console.log(...f)},r=f=>{let[a,x,C]=f.split("|");return{file:a,sheet:x,range:C||"A1:Z2000",defval:null,noNullRow:!0,debug:e.debug}},l=f=>{let a=Object.values(f);return a&&a.length>0?a[0]:""},[c,...h]=e.files,i=r(c),d=new n.Workbook;await d.xlsx.readFile(i.file);let u=d.getWorksheet(i.sheet||d.worksheets[0].name),p=s(i.range),b=u.getRow(p.startRow).values.slice(p.startCol,p.endCol+1),F=u.getColumn(p.startCol).values.slice(p.startRow,p.endRow+1);o(s(i.range)),o("Header",b),o("RowIds",F);let S=h.map(r);for(let[f,a]of S.entries()){let x=await t(a),C=x.map(l);console.log(`================${a.sheet}=================`);for(let[j,k]of C.entries()){let q=F.findIndex(R=>k&&k===R);if(o(a.sheet,k,q>-1?"OK":"NG",`SheetProcess:${f+1}/${S.length}`),q>-1){let R=x[j],_=Object.keys(R).slice(1);for(let[X,A]of _.entries()){let P=b.findIndex($=>$&&A===$),I=q+p.startRow,O=P+p.startCol;u.getCell(I,O).value=R[A],e.debug&&console.log(a.sheet,k,`RowProcess:${(X+1)/_.length*100}%`,[u.getCell(I,O).address,I,O,R[A]])}}}}console.log("Merge completed successfully.");let w=e.output,m=(e.sheet||"MergedSheet").substring(0,31);if(fe.existsSync(w)){let f=new n.Workbook;await f.xlsx.readFile(w);let a=f.getWorksheet(m);a&&f.removeWorksheet(a.id),f.addWorksheet(m,u),await f.xlsx.writeFile(w)}else u.name=m,await d.xlsx.writeFile(w)},He={command:"merge <files..>",describe:"merge multiple excel sheets into the first sheet. (format: file|sheet|range, file|Sheet1|A1:Z2000)",builder:{output:{alias:"o",describe:"output file name",default:"MergedBook.xlsx",type:"string"},sheet:{alias:"s",describe:"xlsx sheet name",demandOption:!1,type:"string"},engine:{alias:"e",describe:"excel engine, sheetjs|exceljs",default:"sheetjs",demandOption:!1,type:"string"},debug:{alias:"d",describe:"print debug log",demandOption:!1,type:"boolean"}},handler(e){e.engine==="exceljs"?Je(e):Ee(e)}};he.exports=He});var we=_chunk5KSN6VOAjs.b.call(void 0, (ze,ge)=>{var{writeFiles:Me}=G(),{getStdin:Pe}=_chunk5KSN6VOAjs.a.call(void 0, "ts-stdin"),Ze={command:"json2",describe:"convert json to yaml, csv, tsv, xlsx",builder:{data:{alias:"d",describe:"json data",demandOption:!1,default:void 0,type:"string"},output:{alias:"o",describe:"output the request data, type: yaml, csv, tsv, xlsx",demandOption:!0,type:"array"}},handler(e){(async()=>{let t=e.data?JSON.parse(e.data):JSON.parse(await Pe());e.output&&Me({files:e.output,data:t})})()}};ge.exports=Ze});var Le=()=>{let e=_chunk5KSN6VOAjs.a.call(void 0, "yargs").scriptName("xl1");e.command(ce()),e.command(pe()),e.command(we());let t=e.parse();(!t._||t._.length===0)&&e.showHelp()};Le();
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "xl1",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "just some xlsx script.",
5
5
  "bin": {
6
- "xl1": "bin/cli.js"
6
+ "xl1": "dist/xl1/index.js",
7
+ "jsh1": "dist/jsh1/index.js"
7
8
  },
8
9
  "files": [
9
10
  "dist",
@@ -16,7 +17,9 @@
16
17
  "keywords": [],
17
18
  "author": "exia.huang",
18
19
  "dependencies": {
20
+ "change-case": "4.1.2",
19
21
  "exceljs": "^4.4.0",
22
+ "handlebars": "^4.7.8",
20
23
  "js-yaml": "^4.1.0",
21
24
  "json2xml": "^0.1.3",
22
25
  "ts-stdin": "^1.0.1",
package/bin/cli.js DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- require('../dist/')
package/dist/index.js DELETED
@@ -1,6 +0,0 @@
1
- "use strict";var k=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var S=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ue=S((Ps,tt)=>{var Ve=k("fs"),W=k("xlsx"),pr=e=>{let{file:t,sheet:r,range:s,defval:n,noNullRow:a}=e;if(!Ve.existsSync(t)){console.log("file not found, ",t);return}if(![".xlsx",".xlsm"].find(p=>t.endsWith(p))){console.log("file type error, ",t);return}let i=W.readFile(t,{bookSheets:!1});if(!i)return null;let o=i.Sheets[r||i.SheetNames[0]],u={range:s,blankrows:!1,defval:n},l=W.utils.sheet_to_json(o,u);return a?l.filter(p=>Object.values(p).some(h=>!!h)):l},vr=e=>{let{file:t,data:r,sheet:s}=e;if(!(t&&r&&Array.isArray(r)&&r.length>0))return;let n=Array.isArray(r[0])?W.utils.aoa_to_sheet(r):W.utils.json_to_sheet(r),a=Ve.existsSync(t)?W.readFile(t,{cellDates:!0}):W.utils.book_new();W.utils.book_append_sheet(a,n,s?s.substring(0,31):"Sheet1",!0),W.writeFile(a,t,{compression:!0})},ce=e=>{let[t,r]=e.split(":"),s=t.replace(/\D/g,""),n=r.replace(/\D/g,""),a=t.replace(/\d/g,""),i=r.replace(/\d/g,"");return{startRow:parseInt(s),endRow:parseInt(n),startCol:a,endCol:i,firstRow:`${t}:${i}${s}`,firstCol:`${t}:${a}${n}`}},et=(e,t,r,s,n)=>{let a=[];for(let i=t;i<=r;i++){let c=[];for(let o=s;o<=n;o++){let l=e[""];c.push(l?l.v:null)}a.push(c)}return a},_e=(e,t)=>{let r=ce(t);return et(e,r.startRow,r.endRow,r.startCol,r.endCol)},gr=(e,t)=>{let r=ce(t);return _e(e,r.firstRow)[0]},mr=(e,t)=>{let r=ce(t);return _e(e,r.firstCol)[0]};tt.exports={readXlsx:pr,writeXlsx:vr,getSheetData:_e,getSheetData2:et,parseRange:ce,getFirstRow:gr,getFirstCol:mr}});var rt=S(ke=>{var Q=k("path"),P=process.platform==="win32",G=k("fs"),yr=process.env.NODE_DEBUG&&/fs/.test(process.env.NODE_DEBUG);function wr(){var e;if(yr){var t=new Error;e=r}else e=s;return e;function r(n){n&&(t.message=n.message,n=t,s(n))}function s(n){if(n){if(process.throwDeprecation)throw n;if(!process.noDeprecation){var a="fs: missing callback "+(n.stack||n.message);process.traceDeprecation?console.trace(a):console.error(a)}}}}function br(e){return typeof e=="function"?e:wr()}var Bs=Q.normalize;P?L=/(.*?)(?:[\/\\]+|$)/g:L=/(.*?)(?:[\/]+|$)/g;var L;P?ee=/^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/:ee=/^[\/]*/;var ee;ke.realpathSync=function(t,r){if(t=Q.resolve(t),r&&Object.prototype.hasOwnProperty.call(r,t))return r[t];var s=t,n={},a={},i,c,o,u;l();function l(){var v=ee.exec(t);i=v[0].length,c=v[0],o=v[0],u="",P&&!a[o]&&(G.lstatSync(o),a[o]=!0)}for(;i<t.length;){L.lastIndex=i;var p=L.exec(t);if(u=c,c+=p[0],o=u+p[1],i=L.lastIndex,!(a[o]||r&&r[o]===o)){var h;if(r&&Object.prototype.hasOwnProperty.call(r,o))h=r[o];else{var f=G.lstatSync(o);if(!f.isSymbolicLink()){a[o]=!0,r&&(r[o]=o);continue}var d=null;if(!P){var g=f.dev.toString(32)+":"+f.ino.toString(32);n.hasOwnProperty(g)&&(d=n[g])}d===null&&(G.statSync(o),d=G.readlinkSync(o)),h=Q.resolve(u,d),r&&(r[o]=h),P||(n[g]=d)}t=Q.resolve(h,t.slice(i)),l()}}return r&&(r[s]=t),t};ke.realpath=function(t,r,s){if(typeof s!="function"&&(s=br(r),r=null),t=Q.resolve(t),r&&Object.prototype.hasOwnProperty.call(r,t))return process.nextTick(s.bind(null,null,r[t]));var n=t,a={},i={},c,o,u,l;p();function p(){var v=ee.exec(t);c=v[0].length,o=v[0],u=v[0],l="",P&&!i[u]?G.lstat(u,function(y){if(y)return s(y);i[u]=!0,h()}):process.nextTick(h)}function h(){if(c>=t.length)return r&&(r[n]=t),s(null,t);L.lastIndex=c;var v=L.exec(t);return l=o,o+=v[0],u=l+v[1],c=L.lastIndex,i[u]||r&&r[u]===u?process.nextTick(h):r&&Object.prototype.hasOwnProperty.call(r,u)?g(r[u]):G.lstat(u,f)}function f(v,y){if(v)return s(v);if(!y.isSymbolicLink())return i[u]=!0,r&&(r[u]=u),process.nextTick(h);if(!P){var w=y.dev.toString(32)+":"+y.ino.toString(32);if(a.hasOwnProperty(w))return d(null,a[w],u)}G.stat(u,function(m){if(m)return s(m);G.readlink(u,function(b,O){P||(a[w]=O),d(b,O)})})}function d(v,y,w){if(v)return s(v);var m=Q.resolve(l,y);r&&(r[w]=m),g(m)}function g(v){t=Q.resolve(v,t.slice(c)),p()}}});var Ae=S((Hs,at)=>{at.exports=B;B.realpath=B;B.sync=Ee;B.realpathSync=Ee;B.monkeypatch=kr;B.unmonkeypatch=Sr;var K=k("fs"),Se=K.realpath,Oe=K.realpathSync,_r=process.version,st=/^v[0-5]\./.test(_r),nt=rt();function it(e){return e&&e.syscall==="realpath"&&(e.code==="ELOOP"||e.code==="ENOMEM"||e.code==="ENAMETOOLONG")}function B(e,t,r){if(st)return Se(e,t,r);typeof t=="function"&&(r=t,t=null),Se(e,t,function(s,n){it(s)?nt.realpath(e,t,r):r(s,n)})}function Ee(e,t){if(st)return Oe(e,t);try{return Oe(e,t)}catch(r){if(it(r))return nt.realpathSync(e,t);throw r}}function kr(){K.realpath=B,K.realpathSync=Ee}function Sr(){K.realpath=Se,K.realpathSync=Oe}});var ct=S((Js,ot)=>{ot.exports=function(e,t){for(var r=[],s=0;s<e.length;s++){var n=t(e[s],s);Or(n)?r.push.apply(r,n):r.push(n)}return r};var Or=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"}});var dt=S((Qs,ft)=>{"use strict";ft.exports=lt;function lt(e,t,r){e instanceof RegExp&&(e=ut(e,r)),t instanceof RegExp&&(t=ut(t,r));var s=ht(e,t,r);return s&&{start:s[0],end:s[1],pre:r.slice(0,s[0]),body:r.slice(s[0]+e.length,s[1]),post:r.slice(s[1]+t.length)}}function ut(e,t){var r=t.match(e);return r?r[0]:null}lt.range=ht;function ht(e,t,r){var s,n,a,i,c,o=r.indexOf(e),u=r.indexOf(t,o+1),l=o;if(o>=0&&u>0){if(e===t)return[o,u];for(s=[],a=r.length;l>=0&&!c;)l==o?(s.push(l),o=r.indexOf(e,l+1)):s.length==1?c=[s.pop(),u]:(n=s.pop(),n<a&&(a=n,i=u),u=r.indexOf(t,l+1)),l=o<u&&o>=0?o:u;s.length&&(c=[a,i])}return c}});var _t=S((Us,bt)=>{var Er=ct(),pt=dt();bt.exports=jr;var vt="\0SLASH"+Math.random()+"\0",gt="\0OPEN"+Math.random()+"\0",je="\0CLOSE"+Math.random()+"\0",mt="\0COMMA"+Math.random()+"\0",yt="\0PERIOD"+Math.random()+"\0";function xe(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function Ar(e){return e.split("\\\\").join(vt).split("\\{").join(gt).split("\\}").join(je).split("\\,").join(mt).split("\\.").join(yt)}function xr(e){return e.split(vt).join("\\").split(gt).join("{").split(je).join("}").split(mt).join(",").split(yt).join(".")}function wt(e){if(!e)return[""];var t=[],r=pt("{","}",e);if(!r)return e.split(",");var s=r.pre,n=r.body,a=r.post,i=s.split(",");i[i.length-1]+="{"+n+"}";var c=wt(a);return a.length&&(i[i.length-1]+=c.shift(),i.push.apply(i,c)),t.push.apply(t,i),t}function jr(e){return e?(e.substr(0,2)==="{}"&&(e="\\{\\}"+e.substr(2)),Y(Ar(e),!0).map(xr)):[]}function Rr(e){return"{"+e+"}"}function Ir(e){return/^-?0\d/.test(e)}function qr(e,t){return e<=t}function Cr(e,t){return e>=t}function Y(e,t){var r=[],s=pt("{","}",e);if(!s||/\$$/.test(s.pre))return[e];var n=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),a=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),i=n||a,c=s.body.indexOf(",")>=0;if(!i&&!c)return s.post.match(/,.*\}/)?(e=s.pre+"{"+s.body+je+s.post,Y(e)):[e];var o;if(i)o=s.body.split(/\.\./);else if(o=wt(s.body),o.length===1&&(o=Y(o[0],!1).map(Rr),o.length===1)){var l=s.post.length?Y(s.post,!1):[""];return l.map(function($){return s.pre+o[0]+$})}var u=s.pre,l=s.post.length?Y(s.post,!1):[""],p;if(i){var h=xe(o[0]),f=xe(o[1]),d=Math.max(o[0].length,o[1].length),g=o.length==3?Math.abs(xe(o[2])):1,v=qr,y=f<h;y&&(g*=-1,v=Cr);var w=o.some(Ir);p=[];for(var m=h;v(m,f);m+=g){var b;if(a)b=String.fromCharCode(m),b==="\\"&&(b="");else if(b=String(m),w){var O=d-b.length;if(O>0){var N=new Array(O+1).join("0");m<0?b="-"+N+b.slice(1):b=N+b}}p.push(b)}}else p=Er(o,function(I){return Y(I,!1)});for(var j=0;j<p.length;j++)for(var R=0;R<l.length;R++){var E=u+p[j]+l[R];(!t||i||E)&&r.push(E)}return r}});var fe=S((Zs,At)=>{At.exports=q;q.Minimatch=x;var te=function(){try{return k("path")}catch (e2){}}()||{sep:"/"};q.sep=te.sep;var qe=q.GLOBSTAR=x.GLOBSTAR={},Nr=_t(),kt={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},Re="[^/]",Ie=Re+"*?",Dr="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Fr="(?:(?!(?:\\/|^)\\.).)*?",St=Mr("().*{}+?[]^$\\!");function Mr(e){return e.split("").reduce(function(t,r){return t[r]=!0,t},{})}var Ot=/\/+/;q.filter=Lr;function Lr(e,t){return t=t||{},function(r,s,n){return q(r,e,t)}}function X(e,t){t=t||{};var r={};return Object.keys(e).forEach(function(s){r[s]=e[s]}),Object.keys(t).forEach(function(s){r[s]=t[s]}),r}q.defaults=function(e){if(!e||typeof e!="object"||!Object.keys(e).length)return q;var t=q,r=function(n,a,i){return t(n,a,X(e,i))};return r.Minimatch=function(n,a){return new t.Minimatch(n,X(e,a))},r.Minimatch.defaults=function(n){return t.defaults(X(e,n)).Minimatch},r.filter=function(n,a){return t.filter(n,X(e,a))},r.defaults=function(n){return t.defaults(X(e,n))},r.makeRe=function(n,a){return t.makeRe(n,X(e,a))},r.braceExpand=function(n,a){return t.braceExpand(n,X(e,a))},r.match=function(s,n,a){return t.match(s,n,X(e,a))},r};x.defaults=function(e){return q.defaults(e).Minimatch};function q(e,t,r){return he(t),r||(r={}),!r.nocomment&&t.charAt(0)==="#"?!1:new x(t,r).match(e)}function x(e,t){if(!(this instanceof x))return new x(e,t);he(e),t||(t={}),e=e.trim(),!t.allowWindowsEscape&&te.sep!=="/"&&(e=e.split(te.sep).join("/")),this.options=t,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.make()}x.prototype.debug=function(){};x.prototype.make=$r;function $r(){var e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate();var r=this.globSet=this.braceExpand();t.debug&&(this.debug=function(){console.error.apply(console,arguments)}),this.debug(this.pattern,r),r=this.globParts=r.map(function(s){return s.split(Ot)}),this.debug(this.pattern,r),r=r.map(function(s,n,a){return s.map(this.parse,this)},this),this.debug(this.pattern,r),r=r.filter(function(s){return s.indexOf(!1)===-1}),this.debug(this.pattern,r),this.set=r}x.prototype.parseNegate=Tr;function Tr(){var e=this.pattern,t=!1,r=this.options,s=0;if(!r.nonegate){for(var n=0,a=e.length;n<a&&e.charAt(n)==="!";n++)t=!t,s++;s&&(this.pattern=e.substr(s)),this.negate=t}}q.braceExpand=function(e,t){return Et(e,t)};x.prototype.braceExpand=Et;function Et(e,t){return t||(this instanceof x?t=this.options:t={}),e=typeof e>"u"?this.pattern:e,he(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:Nr(e)}var Wr=1024*64,he=function(e){if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>Wr)throw new TypeError("pattern is too long")};x.prototype.parse=Gr;var le={};function Gr(e,t){he(e);var r=this.options;if(e==="**")if(r.noglobstar)e="*";else return qe;if(e==="")return"";var s="",n=!!r.nocase,a=!1,i=[],c=[],o,u=!1,l=-1,p=-1,h=e.charAt(0)==="."?"":r.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",f=this;function d(){if(o){switch(o){case"*":s+=Ie,n=!0;break;case"?":s+=Re,n=!0;break;default:s+="\\"+o;break}f.debug("clearStateChar %j %j",o,s),o=!1}}for(var g=0,v=e.length,y;g<v&&(y=e.charAt(g));g++){if(this.debug("%s %s %s %j",e,g,s,y),a&&St[y]){s+="\\"+y,a=!1;continue}switch(y){case"/":return!1;case"\\":d(),a=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",e,g,s,y),u){this.debug(" in class"),y==="!"&&g===p+1&&(y="^"),s+=y;continue}f.debug("call clearStateChar %j",o),d(),o=y,r.noext&&d();continue;case"(":if(u){s+="(";continue}if(!o){s+="\\(";continue}i.push({type:o,start:g-1,reStart:s.length,open:kt[o].open,close:kt[o].close}),s+=o==="!"?"(?:(?!(?:":"(?:",this.debug("plType %j %j",o,s),o=!1;continue;case")":if(u||!i.length){s+="\\)";continue}d(),n=!0;var w=i.pop();s+=w.close,w.type==="!"&&c.push(w),w.reEnd=s.length;continue;case"|":if(u||!i.length||a){s+="\\|",a=!1;continue}d(),s+="|";continue;case"[":if(d(),u){s+="\\"+y;continue}u=!0,p=g,l=s.length,s+=y;continue;case"]":if(g===p+1||!u){s+="\\"+y,a=!1;continue}var m=e.substring(p+1,g);try{RegExp("["+m+"]")}catch (e3){var b=this.parse(m,le);s=s.substr(0,l)+"\\["+b[0]+"\\]",n=n||b[1],u=!1;continue}n=!0,u=!1,s+=y;continue;default:d(),a?a=!1:St[y]&&!(y==="^"&&u)&&(s+="\\"),s+=y}}for(u&&(m=e.substr(p+1),b=this.parse(m,le),s=s.substr(0,l)+"\\["+b[0],n=n||b[1]),w=i.pop();w;w=i.pop()){var O=s.slice(w.reStart+w.open.length);this.debug("setting tail",s,w),O=O.replace(/((?:\\{2}){0,64})(\\?)\|/g,function(Ke,Ye,be){return be||(be="\\"),Ye+Ye+be+"|"}),this.debug(`tail=%j
2
- %s`,O,O,w,s);var N=w.type==="*"?Ie:w.type==="?"?Re:"\\"+w.type;n=!0,s=s.slice(0,w.reStart)+N+"\\("+O}d(),a&&(s+="\\\\");var j=!1;switch(s.charAt(0)){case"[":case".":case"(":j=!0}for(var R=c.length-1;R>-1;R--){var E=c[R],I=s.slice(0,E.reStart),$=s.slice(E.reStart,E.reEnd-8),D=s.slice(E.reEnd-8,E.reEnd),M=s.slice(E.reEnd);D+=M;var J=I.split("(").length-1,F=M;for(g=0;g<J;g++)F=F.replace(/\)[+*?]?/,"");M=F;var T="";M===""&&t!==le&&(T="$");var ae=I+$+M+T+D;s=ae}if(s!==""&&n&&(s="(?=.)"+s),j&&(s=h+s),t===le)return[s,n];if(!n)return Br(e);var oe=r.nocase?"i":"";try{var we=new RegExp("^"+s+"$",oe)}catch (e4){return new RegExp("$.")}return we._glob=e,we._src=s,we}q.makeRe=function(e,t){return new x(e,t||{}).makeRe()};x.prototype.makeRe=Pr;function Pr(){if(this.regexp||this.regexp===!1)return this.regexp;var e=this.set;if(!e.length)return this.regexp=!1,this.regexp;var t=this.options,r=t.noglobstar?Ie:t.dot?Dr:Fr,s=t.nocase?"i":"",n=e.map(function(a){return a.map(function(i){return i===qe?r:typeof i=="string"?Xr(i):i._src}).join("\\/")}).join("|");n="^(?:"+n+")$",this.negate&&(n="^(?!"+n+").*$");try{this.regexp=new RegExp(n,s)}catch (e5){this.regexp=!1}return this.regexp}q.match=function(e,t,r){r=r||{};var s=new x(t,r);return e=e.filter(function(n){return s.match(n)}),s.options.nonull&&!e.length&&e.push(t),e};x.prototype.match=function(t,r){if(typeof r>"u"&&(r=this.partial),this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&r)return!0;var s=this.options;te.sep!=="/"&&(t=t.split(te.sep).join("/")),t=t.split(Ot),this.debug(this.pattern,"split",t);var n=this.set;this.debug(this.pattern,"set",n);var a,i;for(i=t.length-1;i>=0&&(a=t[i],!a);i--);for(i=0;i<n.length;i++){var c=n[i],o=t;s.matchBase&&c.length===1&&(o=[a]);var u=this.matchOne(o,c,r);if(u)return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate};x.prototype.matchOne=function(e,t,r){var s=this.options;this.debug("matchOne",{this:this,file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var n=0,a=0,i=e.length,c=t.length;n<i&&a<c;n++,a++){this.debug("matchOne loop");var o=t[a],u=e[n];if(this.debug(t,o,u),o===!1)return!1;if(o===qe){this.debug("GLOBSTAR",[t,o,u]);var l=n,p=a+1;if(p===c){for(this.debug("** at the end");n<i;n++)if(e[n]==="."||e[n]===".."||!s.dot&&e[n].charAt(0)===".")return!1;return!0}for(;l<i;){var h=e[l];if(this.debug(`
3
- globstar while`,e,l,t,p,h),this.matchOne(e.slice(l),t.slice(p),r))return this.debug("globstar found match!",l,i,h),!0;if(h==="."||h===".."||!s.dot&&h.charAt(0)==="."){this.debug("dot detected!",e,l,t,p);break}this.debug("globstar swallow a segment, and continue"),l++}return!!(r&&(this.debug(`
4
- >>> no match, partial?`,e,l,t,p),l===i))}var f;if(typeof o=="string"?(f=u===o,this.debug("string match",o,u,f)):(f=u.match(o),this.debug("pattern match",o,u,f)),!f)return!1}if(n===i&&a===c)return!0;if(n===i)return r;if(a===c)return n===i-1&&e[n]==="";throw new Error("wtf?")};function Br(e){return e.replace(/\\(.)/g,"$1")}function Xr(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var xt=S((zs,Ce)=>{typeof Object.create=="function"?Ce.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Ce.exports=function(t,r){if(r){t.super_=r;var s=function(){};s.prototype=r.prototype,t.prototype=new s,t.prototype.constructor=t}}});var jt=S((Ks,De)=>{try{if(Ne=k("util"),typeof Ne.inherits!="function")throw"";De.exports=Ne.inherits}catch (e6){De.exports=xt()}var Ne});var pe=S((Ys,de)=>{"use strict";function Rt(e){return e.charAt(0)==="/"}function It(e){var t=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,r=t.exec(e),s=r[1]||"",n=!!(s&&s.charAt(1)!==":");return!!(r[2]||n)}de.exports=process.platform==="win32"?It:Rt;de.exports.posix=Rt;de.exports.win32=It});var Me=S(H=>{H.setopts=zr;H.ownProp=qt;H.makeAbs=re;H.finish=Kr;H.mark=Yr;H.isIgnored=Nt;H.childrenIgnored=Vr;function qt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Hr=k("fs"),V=k("path"),Jr=fe(),Ct=pe(),Fe=Jr.Minimatch;function Qr(e,t){return e.localeCompare(t,"en")}function Ur(e,t){e.ignore=t.ignore||[],Array.isArray(e.ignore)||(e.ignore=[e.ignore]),e.ignore.length&&(e.ignore=e.ignore.map(Zr))}function Zr(e){var t=null;if(e.slice(-3)==="/**"){var r=e.replace(/(\/\*\*)+$/,"");t=new Fe(r,{dot:!0})}return{matcher:new Fe(e,{dot:!0}),gmatcher:t}}function zr(e,t,r){if(r||(r={}),r.matchBase&&t.indexOf("/")===-1){if(r.noglobstar)throw new Error("base matching requires globstar");t="**/"+t}e.silent=!!r.silent,e.pattern=t,e.strict=r.strict!==!1,e.realpath=!!r.realpath,e.realpathCache=r.realpathCache||Object.create(null),e.follow=!!r.follow,e.dot=!!r.dot,e.mark=!!r.mark,e.nodir=!!r.nodir,e.nodir&&(e.mark=!0),e.sync=!!r.sync,e.nounique=!!r.nounique,e.nonull=!!r.nonull,e.nosort=!!r.nosort,e.nocase=!!r.nocase,e.stat=!!r.stat,e.noprocess=!!r.noprocess,e.absolute=!!r.absolute,e.fs=r.fs||Hr,e.maxLength=r.maxLength||1/0,e.cache=r.cache||Object.create(null),e.statCache=r.statCache||Object.create(null),e.symlinks=r.symlinks||Object.create(null),Ur(e,r),e.changedCwd=!1;var s=process.cwd();qt(r,"cwd")?(e.cwd=V.resolve(r.cwd),e.changedCwd=e.cwd!==s):e.cwd=s,e.root=r.root||V.resolve(e.cwd,"/"),e.root=V.resolve(e.root),process.platform==="win32"&&(e.root=e.root.replace(/\\/g,"/")),e.cwdAbs=Ct(e.cwd)?e.cwd:re(e,e.cwd),process.platform==="win32"&&(e.cwdAbs=e.cwdAbs.replace(/\\/g,"/")),e.nomount=!!r.nomount,r.nonegate=!0,r.nocomment=!0,r.allowWindowsEscape=!1,e.minimatch=new Fe(t,r),e.options=e.minimatch.options}function Kr(e){for(var t=e.nounique,r=t?[]:Object.create(null),s=0,n=e.matches.length;s<n;s++){var a=e.matches[s];if(!a||Object.keys(a).length===0){if(e.nonull){var i=e.minimatch.globSet[s];t?r.push(i):r[i]=!0}}else{var c=Object.keys(a);t?r.push.apply(r,c):c.forEach(function(o){r[o]=!0})}}if(t||(r=Object.keys(r)),e.nosort||(r=r.sort(Qr)),e.mark){for(var s=0;s<r.length;s++)r[s]=e._mark(r[s]);e.nodir&&(r=r.filter(function(o){var u=!/\/$/.test(o),l=e.cache[o]||e.cache[re(e,o)];return u&&l&&(u=l!=="DIR"&&!Array.isArray(l)),u}))}e.ignore.length&&(r=r.filter(function(o){return!Nt(e,o)})),e.found=r}function Yr(e,t){var r=re(e,t),s=e.cache[r],n=t;if(s){var a=s==="DIR"||Array.isArray(s),i=t.slice(-1)==="/";if(a&&!i?n+="/":!a&&i&&(n=n.slice(0,-1)),n!==t){var c=re(e,n);e.statCache[c]=e.statCache[r],e.cache[c]=e.cache[r]}}return n}function re(e,t){var r=t;return t.charAt(0)==="/"?r=V.join(e.root,t):Ct(t)||t===""?r=t:e.changedCwd?r=V.resolve(e.cwd,t):r=V.resolve(t),process.platform==="win32"&&(r=r.replace(/\\/g,"/")),r}function Nt(e,t){return e.ignore.length?e.ignore.some(function(r){return r.matcher.match(t)||!!(r.gmatcher&&r.gmatcher.match(t))}):!1}function Vr(e,t){return e.ignore.length?e.ignore.some(function(r){return!!(r.gmatcher&&r.gmatcher.match(t))}):!1}});var $t=S((sn,Lt)=>{Lt.exports=Mt;Mt.GlobSync=A;var es=Ae(),Dt=fe(),en=Dt.Minimatch,tn=Te().Glob,rn=k("util"),Le=k("path"),Ft=k("assert"),ve=pe(),U=Me(),ts=U.setopts,$e=U.ownProp,rs=U.childrenIgnored,ss=U.isIgnored;function Mt(e,t){if(typeof t=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
5
- See: https://github.com/isaacs/node-glob/issues/167`);return new A(e,t).found}function A(e,t){if(!e)throw new Error("must provide pattern");if(typeof t=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
6
- See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof A))return new A(e,t);if(ts(this,e,t),this.noprocess)return this;var r=this.minimatch.set.length;this.matches=new Array(r);for(var s=0;s<r;s++)this._process(this.minimatch.set[s],s,!1);this._finish()}A.prototype._finish=function(){if(Ft.ok(this instanceof A),this.realpath){var e=this;this.matches.forEach(function(t,r){var s=e.matches[r]=Object.create(null);for(var n in t)try{n=e._makeAbs(n);var a=es.realpathSync(n,e.realpathCache);s[a]=!0}catch(i){if(i.syscall==="stat")s[e._makeAbs(n)]=!0;else throw i}})}U.finish(this)};A.prototype._process=function(e,t,r){Ft.ok(this instanceof A);for(var s=0;typeof e[s]=="string";)s++;var n;switch(s){case e.length:this._processSimple(e.join("/"),t);return;case 0:n=null;break;default:n=e.slice(0,s).join("/");break}var a=e.slice(s),i;n===null?i=".":((ve(n)||ve(e.map(function(u){return typeof u=="string"?u:"[*]"}).join("/")))&&(!n||!ve(n))&&(n="/"+n),i=n);var c=this._makeAbs(i);if(!rs(this,i)){var o=a[0]===Dt.GLOBSTAR;o?this._processGlobStar(n,i,c,a,t,r):this._processReaddir(n,i,c,a,t,r)}};A.prototype._processReaddir=function(e,t,r,s,n,a){var i=this._readdir(r,a);if(i){for(var c=s[0],o=!!this.minimatch.negate,u=c._glob,l=this.dot||u.charAt(0)===".",p=[],h=0;h<i.length;h++){var f=i[h];if(f.charAt(0)!=="."||l){var d;o&&!e?d=!f.match(c):d=f.match(c),d&&p.push(f)}}var g=p.length;if(g!==0){if(s.length===1&&!this.mark&&!this.stat){this.matches[n]||(this.matches[n]=Object.create(null));for(var h=0;h<g;h++){var f=p[h];e&&(e.slice(-1)!=="/"?f=e+"/"+f:f=e+f),f.charAt(0)==="/"&&!this.nomount&&(f=Le.join(this.root,f)),this._emitMatch(n,f)}return}s.shift();for(var h=0;h<g;h++){var f=p[h],v;e?v=[e,f]:v=[f],this._process(v.concat(s),n,a)}}}};A.prototype._emitMatch=function(e,t){if(!ss(this,t)){var r=this._makeAbs(t);if(this.mark&&(t=this._mark(t)),this.absolute&&(t=r),!this.matches[e][t]){if(this.nodir){var s=this.cache[r];if(s==="DIR"||Array.isArray(s))return}this.matches[e][t]=!0,this.stat&&this._stat(t)}}};A.prototype._readdirInGlobStar=function(e){if(this.follow)return this._readdir(e,!1);var t,r,s;try{r=this.fs.lstatSync(e)}catch(a){if(a.code==="ENOENT")return null}var n=r&&r.isSymbolicLink();return this.symlinks[e]=n,!n&&r&&!r.isDirectory()?this.cache[e]="FILE":t=this._readdir(e,!1),t};A.prototype._readdir=function(e,t){var r;if(t&&!$e(this.symlinks,e))return this._readdirInGlobStar(e);if($e(this.cache,e)){var s=this.cache[e];if(!s||s==="FILE")return null;if(Array.isArray(s))return s}try{return this._readdirEntries(e,this.fs.readdirSync(e))}catch(n){return this._readdirError(e,n),null}};A.prototype._readdirEntries=function(e,t){if(!this.mark&&!this.stat)for(var r=0;r<t.length;r++){var s=t[r];e==="/"?s=e+s:s=e+"/"+s,this.cache[s]=!0}return this.cache[e]=t,t};A.prototype._readdirError=function(e,t){switch(t.code){case"ENOTSUP":case"ENOTDIR":var r=this._makeAbs(e);if(this.cache[r]="FILE",r===this.cwdAbs){var s=new Error(t.code+" invalid cwd "+this.cwd);throw s.path=this.cwd,s.code=t.code,s}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(e)]=!1;break;default:if(this.cache[this._makeAbs(e)]=!1,this.strict)throw t;this.silent||console.error("glob error",t);break}};A.prototype._processGlobStar=function(e,t,r,s,n,a){var i=this._readdir(r,a);if(i){var c=s.slice(1),o=e?[e]:[],u=o.concat(c);this._process(u,n,!1);var l=i.length,p=this.symlinks[r];if(!(p&&a))for(var h=0;h<l;h++){var f=i[h];if(!(f.charAt(0)==="."&&!this.dot)){var d=o.concat(i[h],c);this._process(d,n,!0);var g=o.concat(i[h],s);this._process(g,n,!0)}}}};A.prototype._processSimple=function(e,t){var r=this._stat(e);if(this.matches[t]||(this.matches[t]=Object.create(null)),!!r){if(e&&ve(e)&&!this.nomount){var s=/[\/\\]$/.test(e);e.charAt(0)==="/"?e=Le.join(this.root,e):(e=Le.resolve(this.root,e),s&&(e+="/"))}process.platform==="win32"&&(e=e.replace(/\\/g,"/")),this._emitMatch(t,e)}};A.prototype._stat=function(e){var t=this._makeAbs(e),r=e.slice(-1)==="/";if(e.length>this.maxLength)return!1;if(!this.stat&&$e(this.cache,t)){var i=this.cache[t];if(Array.isArray(i)&&(i="DIR"),!r||i==="DIR")return i;if(r&&i==="FILE")return!1}var s,n=this.statCache[t];if(!n){var a;try{a=this.fs.lstatSync(t)}catch(c){if(c&&(c.code==="ENOENT"||c.code==="ENOTDIR"))return this.statCache[t]=!1,!1}if(a&&a.isSymbolicLink())try{n=this.fs.statSync(t)}catch (e7){n=a}else n=a}this.statCache[t]=n;var i=!0;return n&&(i=n.isDirectory()?"DIR":"FILE"),this.cache[t]=this.cache[t]||i,r&&i==="FILE"?!1:i};A.prototype._mark=function(e){return U.mark(this,e)};A.prototype._makeAbs=function(e){return U.makeAbs(this,e)}});var We=S((nn,Wt)=>{Wt.exports=Tt;function Tt(e,t){if(e&&t)return Tt(e)(t);if(typeof e!="function")throw new TypeError("need wrapper function");return Object.keys(e).forEach(function(s){r[s]=e[s]}),r;function r(){for(var s=new Array(arguments.length),n=0;n<s.length;n++)s[n]=arguments[n];var a=e.apply(this,s),i=s[s.length-1];return typeof a=="function"&&a!==i&&Object.keys(i).forEach(function(c){a[c]=i[c]}),a}}});var Pe=S((an,Ge)=>{var Gt=We();Ge.exports=Gt(ge);Ge.exports.strict=Gt(Pt);ge.proto=ge(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return ge(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return Pt(this)},configurable:!0})});function ge(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function Pt(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},r=e.name||"Function wrapped with `once`";return t.onceError=r+" shouldn't be called more than once",t.called=!1,t}});var Xt=S((on,Bt)=>{var ns=We(),se=Object.create(null),is=Pe();Bt.exports=ns(as);function as(e,t){return se[e]?(se[e].push(t),null):(se[e]=[t],os(e))}function os(e){return is(function t(){var r=se[e],s=r.length,n=cs(arguments);try{for(var a=0;a<s;a++)r[a].apply(null,n)}finally{r.length>s?(r.splice(0,s),process.nextTick(function(){t.apply(null,n)})):delete se[e]}})}function cs(e){for(var t=e.length,r=[],s=0;s<t;s++)r[s]=e[s];return r}});var Te=S((ln,Jt)=>{Jt.exports=Z;var us=Ae(),Ht=fe(),cn=Ht.Minimatch,ls=jt(),hs=k("events").EventEmitter,Be=k("path"),Xe=k("assert"),ne=pe(),Je=$t(),z=Me(),fs=z.setopts,He=z.ownProp,Qe=Xt(),un=k("util"),ds=z.childrenIgnored,ps=z.isIgnored,vs=Pe();function Z(e,t,r){if(typeof t=="function"&&(r=t,t={}),t||(t={}),t.sync){if(r)throw new TypeError("callback provided to sync glob");return Je(e,t)}return new _(e,t,r)}Z.sync=Je;var gs=Z.GlobSync=Je.GlobSync;Z.glob=Z;function ms(e,t){if(t===null||typeof t!="object")return e;for(var r=Object.keys(t),s=r.length;s--;)e[r[s]]=t[r[s]];return e}Z.hasMagic=function(e,t){var r=ms({},t);r.noprocess=!0;var s=new _(e,r),n=s.minimatch.set;if(!e)return!1;if(n.length>1)return!0;for(var a=0;a<n[0].length;a++)if(typeof n[0][a]!="string")return!0;return!1};Z.Glob=_;ls(_,hs);function _(e,t,r){if(typeof t=="function"&&(r=t,t=null),t&&t.sync){if(r)throw new TypeError("callback provided to sync glob");return new gs(e,t)}if(!(this instanceof _))return new _(e,t,r);fs(this,e,t),this._didRealPath=!1;var s=this.minimatch.set.length;this.matches=new Array(s),typeof r=="function"&&(r=vs(r),this.on("error",r),this.on("end",function(o){r(null,o)}));var n=this;if(this._processing=0,this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(s===0)return c();for(var a=!0,i=0;i<s;i++)this._process(this.minimatch.set[i],i,!1,c);a=!1;function c(){--n._processing,n._processing<=0&&(a?process.nextTick(function(){n._finish()}):n._finish())}}_.prototype._finish=function(){if(Xe(this instanceof _),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();z.finish(this),this.emit("end",this.found)}};_.prototype._realpath=function(){if(this._didRealpath)return;this._didRealpath=!0;var e=this.matches.length;if(e===0)return this._finish();for(var t=this,r=0;r<this.matches.length;r++)this._realpathSet(r,s);function s(){--e===0&&t._finish()}};_.prototype._realpathSet=function(e,t){var r=this.matches[e];if(!r)return t();var s=Object.keys(r),n=this,a=s.length;if(a===0)return t();var i=this.matches[e]=Object.create(null);s.forEach(function(c,o){c=n._makeAbs(c),us.realpath(c,n.realpathCache,function(u,l){u?u.syscall==="stat"?i[c]=!0:n.emit("error",u):i[l]=!0,--a===0&&(n.matches[e]=i,t())})})};_.prototype._mark=function(e){return z.mark(this,e)};_.prototype._makeAbs=function(e){return z.makeAbs(this,e)};_.prototype.abort=function(){this.aborted=!0,this.emit("abort")};_.prototype.pause=function(){this.paused||(this.paused=!0,this.emit("pause"))};_.prototype.resume=function(){if(this.paused){if(this.emit("resume"),this.paused=!1,this._emitQueue.length){var e=this._emitQueue.slice(0);this._emitQueue.length=0;for(var t=0;t<e.length;t++){var r=e[t];this._emitMatch(r[0],r[1])}}if(this._processQueue.length){var s=this._processQueue.slice(0);this._processQueue.length=0;for(var t=0;t<s.length;t++){var n=s[t];this._processing--,this._process(n[0],n[1],n[2],n[3])}}}};_.prototype._process=function(e,t,r,s){if(Xe(this instanceof _),Xe(typeof s=="function"),!this.aborted){if(this._processing++,this.paused){this._processQueue.push([e,t,r,s]);return}for(var n=0;typeof e[n]=="string";)n++;var a;switch(n){case e.length:this._processSimple(e.join("/"),t,s);return;case 0:a=null;break;default:a=e.slice(0,n).join("/");break}var i=e.slice(n),c;a===null?c=".":((ne(a)||ne(e.map(function(l){return typeof l=="string"?l:"[*]"}).join("/")))&&(!a||!ne(a))&&(a="/"+a),c=a);var o=this._makeAbs(c);if(ds(this,c))return s();var u=i[0]===Ht.GLOBSTAR;u?this._processGlobStar(a,c,o,i,t,r,s):this._processReaddir(a,c,o,i,t,r,s)}};_.prototype._processReaddir=function(e,t,r,s,n,a,i){var c=this;this._readdir(r,a,function(o,u){return c._processReaddir2(e,t,r,s,n,a,u,i)})};_.prototype._processReaddir2=function(e,t,r,s,n,a,i,c){if(!i)return c();for(var o=s[0],u=!!this.minimatch.negate,l=o._glob,p=this.dot||l.charAt(0)===".",h=[],f=0;f<i.length;f++){var d=i[f];if(d.charAt(0)!=="."||p){var g;u&&!e?g=!d.match(o):g=d.match(o),g&&h.push(d)}}var v=h.length;if(v===0)return c();if(s.length===1&&!this.mark&&!this.stat){this.matches[n]||(this.matches[n]=Object.create(null));for(var f=0;f<v;f++){var d=h[f];e&&(e!=="/"?d=e+"/"+d:d=e+d),d.charAt(0)==="/"&&!this.nomount&&(d=Be.join(this.root,d)),this._emitMatch(n,d)}return c()}s.shift();for(var f=0;f<v;f++){var d=h[f],y;e&&(e!=="/"?d=e+"/"+d:d=e+d),this._process([d].concat(s),n,a,c)}c()};_.prototype._emitMatch=function(e,t){if(!this.aborted&&!ps(this,t)){if(this.paused){this._emitQueue.push([e,t]);return}var r=ne(t)?t:this._makeAbs(t);if(this.mark&&(t=this._mark(t)),this.absolute&&(t=r),!this.matches[e][t]){if(this.nodir){var s=this.cache[r];if(s==="DIR"||Array.isArray(s))return}this.matches[e][t]=!0;var n=this.statCache[r];n&&this.emit("stat",t,n),this.emit("match",t)}}};_.prototype._readdirInGlobStar=function(e,t){if(this.aborted)return;if(this.follow)return this._readdir(e,!1,t);var r="lstat\0"+e,s=this,n=Qe(r,a);n&&s.fs.lstat(e,n);function a(i,c){if(i&&i.code==="ENOENT")return t();var o=c&&c.isSymbolicLink();s.symlinks[e]=o,!o&&c&&!c.isDirectory()?(s.cache[e]="FILE",t()):s._readdir(e,!1,t)}};_.prototype._readdir=function(e,t,r){if(!this.aborted&&(r=Qe("readdir\0"+e+"\0"+t,r),!!r)){if(t&&!He(this.symlinks,e))return this._readdirInGlobStar(e,r);if(He(this.cache,e)){var s=this.cache[e];if(!s||s==="FILE")return r();if(Array.isArray(s))return r(null,s)}var n=this;n.fs.readdir(e,ys(this,e,r))}};function ys(e,t,r){return function(s,n){s?e._readdirError(t,s,r):e._readdirEntries(t,n,r)}}_.prototype._readdirEntries=function(e,t,r){if(!this.aborted){if(!this.mark&&!this.stat)for(var s=0;s<t.length;s++){var n=t[s];e==="/"?n=e+n:n=e+"/"+n,this.cache[n]=!0}return this.cache[e]=t,r(null,t)}};_.prototype._readdirError=function(e,t,r){if(!this.aborted){switch(t.code){case"ENOTSUP":case"ENOTDIR":var s=this._makeAbs(e);if(this.cache[s]="FILE",s===this.cwdAbs){var n=new Error(t.code+" invalid cwd "+this.cwd);n.path=this.cwd,n.code=t.code,this.emit("error",n),this.abort()}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(e)]=!1;break;default:this.cache[this._makeAbs(e)]=!1,this.strict&&(this.emit("error",t),this.abort()),this.silent||console.error("glob error",t);break}return r()}};_.prototype._processGlobStar=function(e,t,r,s,n,a,i){var c=this;this._readdir(r,a,function(o,u){c._processGlobStar2(e,t,r,s,n,a,u,i)})};_.prototype._processGlobStar2=function(e,t,r,s,n,a,i,c){if(!i)return c();var o=s.slice(1),u=e?[e]:[],l=u.concat(o);this._process(l,n,!1,c);var p=this.symlinks[r],h=i.length;if(p&&a)return c();for(var f=0;f<h;f++){var d=i[f];if(!(d.charAt(0)==="."&&!this.dot)){var g=u.concat(i[f],o);this._process(g,n,!0,c);var v=u.concat(i[f],s);this._process(v,n,!0,c)}}c()};_.prototype._processSimple=function(e,t,r){var s=this;this._stat(e,function(n,a){s._processSimple2(e,t,n,a,r)})};_.prototype._processSimple2=function(e,t,r,s,n){if(this.matches[t]||(this.matches[t]=Object.create(null)),!s)return n();if(e&&ne(e)&&!this.nomount){var a=/[\/\\]$/.test(e);e.charAt(0)==="/"?e=Be.join(this.root,e):(e=Be.resolve(this.root,e),a&&(e+="/"))}process.platform==="win32"&&(e=e.replace(/\\/g,"/")),this._emitMatch(t,e),n()};_.prototype._stat=function(e,t){var r=this._makeAbs(e),s=e.slice(-1)==="/";if(e.length>this.maxLength)return t();if(!this.stat&&He(this.cache,r)){var n=this.cache[r];if(Array.isArray(n)&&(n="DIR"),!s||n==="DIR")return t(null,n);if(s&&n==="FILE")return t()}var a,i=this.statCache[r];if(i!==void 0){if(i===!1)return t(null,i);var c=i.isDirectory()?"DIR":"FILE";return s&&c==="FILE"?t():t(null,c,i)}var o=this,u=Qe("stat\0"+r,l);u&&o.fs.lstat(r,u);function l(p,h){if(h&&h.isSymbolicLink())return o.fs.stat(r,function(f,d){f?o._stat2(e,r,null,h,t):o._stat2(e,r,f,d,t)});o._stat2(e,r,p,h,t)}};_.prototype._stat2=function(e,t,r,s,n){if(r&&(r.code==="ENOENT"||r.code==="ENOTDIR"))return this.statCache[t]=!1,n();var a=e.slice(-1)==="/";if(this.statCache[t]=s,t.slice(-1)==="/"&&s&&!s.isDirectory())return n(null,!1,s);var i=!0;return s&&(i=s.isDirectory()?"DIR":"FILE"),this.cache[t]=this.cache[t]||i,a&&i==="FILE"?n():n(null,i,s)}});var ze=S((hn,tr)=>{var Ue=k("path"),C=k("fs"),Ze=Te(),Qt=k("js-yaml"),me=k("xlsx"),{readXlsx:Ut,writeXlsx:Zt}=ue(),ws=k("json2xml"),ye=(e,t)=>{let r=Ue.dirname(t);C.existsSync(r)||C.mkdirSync(r,{recursive:!0}),C.writeFileSync(t,e,{encoding:"utf8"})},bs=e=>Ze.sync(Ue.join(e)),_s=e=>Ze.sync(Ue.join(e)).find(t=>t!==void 0),ks=e=>{let t=Ze.sync(e,{cwd:".",nocase:!0,nodir:!1});return t&&t.length>0},zt=e=>C.existsSync(e)?JSON.parse(C.readFileSync(e,"utf8")):null,Kt=e=>C.existsSync(e)?Qt.load(C.readFileSync(e,"utf8")):null,Yt=e=>{let{file:t,data:r}=e;if(Array.isArray(r)){let s=C.createWriteStream(t);s.write("[","utf-8"),r.map((n,a)=>s.write(JSON.stringify(n)+(a===r.length-1?"":","),"utf-8")),s.write("]","utf-8"),s.end(),s.on("finish",()=>{}),s.on("error",n=>{console.error(n)})}else C.writeFileSync(t,JSON.stringify(r,null,2),{encoding:"utf8"})},Vt=e=>{let{file:t,data:r}=e,s=Qt.dump(r);C.writeFileSync(t,s,"utf8")},Ss=e=>{let{file:t}=e;if(!C.existsSync(t))return null;if(t.endsWith(".json"))return zt(t);if(t.endsWith(".yaml")||t.endsWith(".yml"))return Kt(t);if(t.endsWith(".xlsx"))return Ut(e)},Os=e=>!![".json",".yaml",".xlsx",".yml"].find(r=>e.endsWith(r)),er=(e,t,r)=>{if(e.endsWith(".json"))return Yt({file:e,data:t});if(e.endsWith(".yaml")||e.endsWith(".yml"))return Vt({file:e,data:t});if(e.endsWith(".xlsx"))return Zt({file:e,data:t,sheet:r&&r.sheet?r.sheet:"Sheet1"});if(e.endsWith(".csv")){let s=me.utils.json_to_sheet(t),n=me.utils.sheet_to_csv(s);return ye(n,e)}if(e.endsWith(".tsv")){let s=me.utils.json_to_sheet(t),n=me.utils.sheet_to_csv(s,{FS:" "});return ye(n,e)}if(e.endsWith(".xml")){let s=ws(t,{header:!0});return ye(s,e)}console.error("not support type")},Es=e=>{let{files:t,data:r,sheet:s}=e;t&&t.length>0&&t.map(n=>{er(n,r,{sheet:s})})};tr.exports={save:ye,find:bs,findOne:_s,isExsit:ks,readJson:zt,writeJson:Yt,readYaml:Kt,writeYaml:Vt,readXlsx:Ut,writeXlsx:Zt,readFile:Ss,canReadFile:Os,writeFile:er,writeFiles:Es}});var sr=S((fn,rr)=>{var{readXlsx:As}=ue(),{writeFile:xs}=ze(),js={command:"read",describe:"load excel file",builder:{file:{alias:"f",describe:"load xlsx file ",demandOption:!0,type:"string"},sheet:{alias:"s",describe:"xlsx sheet name",demandOption:!1,type:"string"},range:{alias:"r",describe:"range of excel",default:"A1:Z2000",demandOption:!1,type:"string"},defval:{describe:"defval of cell",demandOption:!1,default:void 0,type:"string"},output:{alias:"o",describe:"output file: json, yaml, csv, tsv, xlsx",demandOption:!1,default:void 0,type:"string"}},handler(e){(async()=>{let t=As(e);e.output?xs(e.output,t):console.log(JSON.stringify(t,null,2))})()}};rr.exports=js});var ar=S((dn,ir)=>{var Rs=k("fs"),nr=k("exceljs"),Is=async e=>{let{file:t,sheet:r,range:s,defval:n,noNullRow:a}=e;if(!Rs.existsSync(t)){console.log("file not found, ",t);return}if(![".xlsx",".xlsm"].find(f=>t.endsWith(f))){console.log("file type error, ",t);return}let i=new nr.Workbook;await i.xlsx.readFile(t);let c=r?i.getWorksheet(r):i.worksheets[0];if(!c)return null;let{startRow:o,endRow:u,startCol:l,endCol:p}=ie(s||"A1:Z2000"),h=[];return c.eachRow({includeEmpty:!1},(f,d)=>{if(d>=o&&d<=u){let g={};f.eachCell({includeEmpty:!0},(v,y)=>{if(y>=l&&y<=p){let w=c.getRow(o).getCell(y).value||`__EMPTY_${y-1}`;g[w]=v.value!==null?v.value:n}}),(!a||Object.values(g).some(v=>v!==null))&&h.push(g)}}),h},qs=async e=>{let{file:t,data:r,sheet:s}=e;if(!(t&&r&&Array.isArray(r)&&r.length>0))return;let n=new nr.Workbook,a=n.addWorksheet(s?s.substring(0,31):"Sheet1");if(Array.isArray(r[0]))a.addRows(r);else{let i=Object.keys(r[0]);a.addRow(i),r.forEach(c=>{a.addRow(i.map(o=>c[o]))})}await n.xlsx.writeFile(t)},ie=e=>{let[t,r]=e.split(":"),s=t.replace(/\D/g,""),n=r.replace(/\D/g,""),a=t.replace(/\d/g,""),i=r.replace(/\d/g,"");return{startRow:parseInt(s),endRow:parseInt(n),startCol:a,endCol:i,firstRow:`${t}:${i}${t.replace(/\D/g,"")}`,firstCol:`${t}:${a}${r.replace(/\D/g,"")}`}},Cs=async(e,t)=>{let{startRow:r,endRow:s,startCol:n,endCol:a}=ie(t),i=[];for(let c=r;c<=s;c++){let o=[];for(let u=n;u<=a;u++){let l=e.getCell(c,u);o.push(l.value)}i.push(o)}return i},Ns=async(e,t)=>{let{startRow:r,startCol:s,endCol:n}=ie(t),a=[];for(let i=s;i<=n;i++){let c=e.getCell(r,i);a.push(c.value)}return a},Ds=async(e,t)=>{let{startRow:r,endRow:s,startCol:n}=ie(t),a=[];for(let i=r;i<=s;i++){let c=e.getCell(i,n);a.push(c.value)}return a};ir.exports={readXlsx:Is,writeXlsx:qs,getSheetData:Cs,parseRange:ie,getFirstRow:Ns,getFirstCol:Ds}});var ur=S((pn,cr)=>{var or=k("fs"),Fs=async e=>{let{readXlsx:t,parseRange:r}=ue(),s=k("xlsx"),n=(...m)=>{e.debug&&console.log(...m)},a=m=>{let[b,O,N]=m.split("|");return{file:b,sheet:O,range:N||"A1:Z2000",defval:null,noNullRow:!0,debug:e.debug}},i=m=>{let b=Object.values(m);return b&&b.length>0?b[0]:""},[c,...o]=e.files,u=a(c),l=s.readFile(u.file,{bookSheets:!1}),p=l.Sheets[u.sheet||l.SheetNames[0]],h=r(u.range),f=s.utils.sheet_to_json(p,{header:1,range:h.firstRow,blankrows:!0,defval:null})[0],d=s.utils.sheet_to_json(p,{header:1,range:h.firstCol,blankrows:!0,defval:null}).map(m=>m[0]);n(r(u.range)),n("Header",f),n("RowIds",d);let g=o.map(a);g.forEach((m,b)=>{let O=t(m),N=O.map(i);console.log(`================${m.sheet}=================`),N.forEach((j,R)=>{let E=d.findIndex(I=>j&&j===I);if(n(m.sheet,j,E>-1?"OK":"NG",`SheetProcess:${b+1}/${g.length}`),E>-1){let I=O[R],$=Object.keys(I).slice(1);$.forEach((D,M)=>{let J=f.findIndex(oe=>oe&&D===oe),F=E,T=J,ae=s.utils.encode_cell({r:F,c:T});p[ae]={t:"s",v:I[D]},e.debug&&console.log(m.sheet,j,`RowProcess:${(M+1)/$.length*100}%`,[ae,F,T,I[D]])})}})}),console.log("Merge completed successfully.");let v=e.output,y=or.existsSync(v)?s.readFile(v,{cellDates:!0}):s.utils.book_new(),w=(e.sheet||"MergedSheet").substring(0,31);s.utils.book_append_sheet(y,p,w,!0),s.writeFile(y,v,{compression:!0})},Ms=async e=>{let{readXlsx:t,parseRange:r}=ar(),s=k("exceljs"),n=(...w)=>{e.debug&&console.log(...w)},a=w=>{let[m,b,O]=w.split("|");return{file:m,sheet:b,range:O||"A1:Z2000",defval:null,noNullRow:!0,debug:e.debug}},i=w=>{let m=Object.values(w);return m&&m.length>0?m[0]:""},[c,...o]=e.files,u=a(c),l=new s.Workbook;await l.xlsx.readFile(u.file);let p=l.getWorksheet(u.sheet||l.worksheets[0].name),h=r(u.range),f=p.getRow(h.startRow).values.slice(h.startCol,h.endCol+1),d=p.getColumn(h.startCol).values.slice(h.startRow,h.endRow+1);n(r(u.range)),n("Header",f),n("RowIds",d);let g=o.map(a);for(let[w,m]of g.entries()){let b=await t(m),O=b.map(i);console.log(`================${m.sheet}=================`);for(let[N,j]of O.entries()){let R=d.findIndex(E=>j&&j===E);if(n(m.sheet,j,R>-1?"OK":"NG",`SheetProcess:${w+1}/${g.length}`),R>-1){let E=b[N],I=Object.keys(E).slice(1);for(let[$,D]of I.entries()){let M=f.findIndex(T=>T&&D===T),J=R+h.startRow,F=M+h.startCol;p.getCell(J,F).value=E[D],e.debug&&console.log(m.sheet,j,`RowProcess:${($+1)/I.length*100}%`,[p.getCell(J,F).address,J,F,E[D]])}}}}console.log("Merge completed successfully.");let v=e.output,y=(e.sheet||"MergedSheet").substring(0,31);if(or.existsSync(v)){let w=new s.Workbook;await w.xlsx.readFile(v);let m=w.getWorksheet(y);m&&w.removeWorksheet(m.id),w.addWorksheet(y,p),await w.xlsx.writeFile(v)}else p.name=y,await l.xlsx.writeFile(v)},Ls={command:"merge <files..>",describe:"merge multiple excel sheets into the first sheet. (format: file|sheet|range, file|Sheet1|A1:Z2000)",builder:{output:{alias:"o",describe:"output file name",default:"MergedBook.xlsx",type:"string"},sheet:{alias:"s",describe:"xlsx sheet name",demandOption:!1,type:"string"},engine:{alias:"e",describe:"excel engine, sheetjs|exceljs",default:"sheetjs",demandOption:!1,type:"string"},debug:{alias:"d",describe:"print debug log",demandOption:!1,type:"boolean"}},handler(e){e.engine==="exceljs"?Ms(e):Fs(e)}};cr.exports=Ls});var hr=S((vn,lr)=>{var{writeFiles:$s}=ze(),{getStdin:Ts}=k("ts-stdin"),Ws={command:"json2",describe:"convert json to yaml, csv, tsv, xlsx",builder:{data:{alias:"d",describe:"json data",demandOption:!1,default:void 0,type:"string"},output:{alias:"o",describe:"output the request data, type: yaml, csv, tsv, xlsx",demandOption:!0,type:"array"}},handler(e){(async()=>{let t=e.data?JSON.parse(e.data):JSON.parse(await Ts());e.output&&$s({files:e.output,data:t})})()}};lr.exports=Ws});var dr=S((gn,fr)=>{fr.exports=()=>{let e=k("yargs").scriptName("xl1");e.command(sr()),e.command(ur()),e.command(hr());let t=e.parse();(!t._||t._.length===0)&&e.showHelp()}});dr()();