tshy
Version:
TypeScript HYbridizer - Hybrid (CommonJS/ESM) TypeScript node package builder
10 lines • 246 kB
JavaScript
#!/usr/bin/env node
var Ln=(e=0)=>t=>`\x1B[${t+e}m`,Wn=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,In=(e=0)=>(t,s,i)=>`\x1B[${38+e};2;${t};${s};${i}m`,A={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},J0=Object.keys(A.modifier),Lf=Object.keys(A.color),Wf=Object.keys(A.bgColor),K0=[...Lf,...Wf];function If(){let e=new Map;for(let[t,s]of Object.entries(A)){for(let[i,r]of Object.entries(s))A[i]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},s[i]=A[i],e.set(r[0],r[1]);Object.defineProperty(A,t,{value:s,enumerable:!1})}return Object.defineProperty(A,"codes",{value:e,enumerable:!1}),A.color.close="\x1B[39m",A.bgColor.close="\x1B[49m",A.color.ansi=Ln(),A.color.ansi256=Wn(),A.color.ansi16m=In(),A.bgColor.ansi=Ln(10),A.bgColor.ansi256=Wn(10),A.bgColor.ansi16m=In(10),Object.defineProperties(A,{rgbToAnsi256:{value(t,s,i){return t===s&&s===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(s/255*5)+Math.round(i/255*5)},enumerable:!1},hexToRgb:{value(t){let s=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!s)return[0,0,0];let[i]=s;i.length===3&&(i=[...i].map(o=>o+o).join(""));let r=Number.parseInt(i,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:t=>A.rgbToAnsi256(...A.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let s,i,r;if(t>=232)s=((t-232)*10+8)/255,i=s,r=s;else{t-=16;let a=t%36;s=Math.floor(t/36)/5,i=Math.floor(a/6)/5,r=a%6/5}let o=Math.max(s,i,r)*2;if(o===0)return 30;let n=30+(Math.round(r)<<2|Math.round(i)<<1|Math.round(s));return o===2&&(n+=60),n},enumerable:!1},rgbToAnsi:{value:(t,s,i)=>A.ansi256ToAnsi(A.rgbToAnsi256(t,s,i)),enumerable:!1},hexToAnsi:{value:t=>A.ansi256ToAnsi(A.hexToAnsi256(t)),enumerable:!1}}),A}var zf=If(),Ft=zf;import Ir from"node:process";import Uf from"node:os";import zn from"node:tty";function Et(e,t=globalThis.Deno?globalThis.Deno.args:Ir.argv){let s=e.startsWith("-")?"":e.length===1?"-":"--",i=t.indexOf(s+e),r=t.indexOf("--");return i!==-1&&(r===-1||i<r)}var{env:j}=Ir,ci;Et("no-color")||Et("no-colors")||Et("color=false")||Et("color=never")?ci=0:(Et("color")||Et("colors")||Et("color=true")||Et("color=always"))&&(ci=1);function Bf(){if("FORCE_COLOR"in j)return j.FORCE_COLOR==="true"?1:j.FORCE_COLOR==="false"?0:j.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(j.FORCE_COLOR,10),3)}function Gf(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function Hf(e,{streamIsTTY:t,sniffFlags:s=!0}={}){let i=Bf();i!==void 0&&(ci=i);let r=s?ci:i;if(r===0)return 0;if(s){if(Et("color=16m")||Et("color=full")||Et("color=truecolor"))return 3;if(Et("color=256"))return 2}if("TF_BUILD"in j&&"AGENT_NAME"in j)return 1;if(e&&!t&&r===void 0)return 0;let o=r||0;if(j.TERM==="dumb")return o;if(Ir.platform==="win32"){let n=Uf.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in j)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(n=>n in j)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(n=>n in j)||j.CI_NAME==="codeship"?1:o;if("TEAMCITY_VERSION"in j)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(j.TEAMCITY_VERSION)?1:0;if(j.COLORTERM==="truecolor"||j.TERM==="xterm-kitty"||j.TERM==="xterm-ghostty"||j.TERM==="wezterm")return 3;if("TERM_PROGRAM"in j){let n=Number.parseInt((j.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(j.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(j.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(j.TERM)||"COLORTERM"in j?1:o}function Un(e,t={}){let s=Hf(e,{streamIsTTY:e&&e.isTTY,...t});return Gf(s)}var qf={stdout:Un({isTTY:zn.isatty(1)}),stderr:Un({isTTY:zn.isatty(2)})},Bn=qf;function Gn(e,t,s){let i=e.indexOf(t);if(i===-1)return e;let r=t.length,o=0,n="";do n+=e.slice(o,i)+t+s,o=i+r,i=e.indexOf(t,o);while(i!==-1);return n+=e.slice(o),n}function Hn(e,t,s,i){let r=0,o="";do{let n=e[i-1]==="\r";o+=e.slice(r,n?i-1:i)+t+(n?`\r
`:`
`)+s,r=i+1,i=e.indexOf(`
`,r)}while(i!==-1);return o+=e.slice(r),o}var{stdout:qn,stderr:Yn}=Bn,zr=Symbol("GENERATOR"),De=Symbol("STYLER"),ds=Symbol("IS_EMPTY"),Vn=["ansi","ansi","ansi256","ansi16m"],$e=Object.create(null),Yf=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let s=qn?qn.level:0;e.level=t.level===void 0?s:t.level};var Vf=e=>{let t=(...s)=>s.join(" ");return Yf(t,e),Object.setPrototypeOf(t,ms.prototype),t};function ms(e){return Vf(e)}Object.setPrototypeOf(ms.prototype,Function.prototype);for(let[e,t]of Object.entries(Ft))$e[e]={get(){let s=fi(this,Br(t.open,t.close,this[De]),this[ds]);return Object.defineProperty(this,e,{value:s}),s}};$e.visible={get(){let e=fi(this,this[De],!0);return Object.defineProperty(this,"visible",{value:e}),e}};var Ur=(e,t,s,...i)=>e==="rgb"?t==="ansi16m"?Ft[s].ansi16m(...i):t==="ansi256"?Ft[s].ansi256(Ft.rgbToAnsi256(...i)):Ft[s].ansi(Ft.rgbToAnsi(...i)):e==="hex"?Ur("rgb",t,s,...Ft.hexToRgb(...i)):Ft[s][e](...i),Jf=["rgb","hex","ansi256"];for(let e of Jf){$e[e]={get(){let{level:s}=this;return function(...i){let r=Br(Ur(e,Vn[s],"color",...i),Ft.color.close,this[De]);return fi(this,r,this[ds])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);$e[t]={get(){let{level:s}=this;return function(...i){let r=Br(Ur(e,Vn[s],"bgColor",...i),Ft.bgColor.close,this[De]);return fi(this,r,this[ds])}}}}var Kf=Object.defineProperties(()=>{},{...$e,level:{enumerable:!0,get(){return this[zr].level},set(e){this[zr].level=e}}}),Br=(e,t,s)=>{let i,r;return s===void 0?(i=e,r=t):(i=s.openAll+e,r=t+s.closeAll),{open:e,close:t,openAll:i,closeAll:r,parent:s}},fi=(e,t,s)=>{let i=(...r)=>Xf(i,r.length===1?""+r[0]:r.join(" "));return Object.setPrototypeOf(i,Kf),i[zr]=e,i[De]=t,i[ds]=s,i},Xf=(e,t)=>{if(e.level<=0||!t)return e[ds]?"":t;let s=e[De];if(s===void 0)return t;let{openAll:i,closeAll:r}=s;if(t.includes("\x1B"))for(;s!==void 0;)t=Gn(t,s.close,s.open),s=s.parent;let o=t.indexOf(`
`);return o!==-1&&(t=Hn(t,r,i,o)),i+t+r};Object.defineProperties(ms.prototype,$e);var Zf=ms(),nS=ms({level:Yn?Yn.level:0});var E=Zf;var Gr=(e,t,s)=>{let i=e instanceof RegExp?Jn(e,s):e,r=t instanceof RegExp?Jn(t,s):t,o=i!==null&&r!=null&&Qf(i,r,s);return o&&{start:o[0],end:o[1],pre:s.slice(0,o[0]),body:s.slice(o[0]+i.length,o[1]),post:s.slice(o[1]+r.length)}},Jn=(e,t)=>{let s=t.match(e);return s?s[0]:null},Qf=(e,t,s)=>{let i,r,o,n,a,l=s.indexOf(e),h=s.indexOf(t,l+1),f=l;if(l>=0&&h>0){if(e===t)return[l,h];for(i=[],o=s.length;f>=0&&!a;){if(f===l)i.push(f),l=s.indexOf(e,f+1);else if(i.length===1){let c=i.pop();c!==void 0&&(a=[c,h])}else r=i.pop(),r!==void 0&&r<o&&(o=r,n=h),h=s.indexOf(t,f+1);f=l<h&&l>=0?l:h}i.length&&n!==void 0&&(a=[o,n])}return a};var Kn="\0SLASH"+Math.random()+"\0",Xn="\0OPEN"+Math.random()+"\0",qr="\0CLOSE"+Math.random()+"\0",Zn="\0COMMA"+Math.random()+"\0",Qn="\0PERIOD"+Math.random()+"\0",tu=new RegExp(Kn,"g"),eu=new RegExp(Xn,"g"),su=new RegExp(qr,"g"),iu=new RegExp(Zn,"g"),ru=new RegExp(Qn,"g"),ou=/\\\\/g,nu=/\\{/g,au=/\\}/g,lu=/\\,/g,hu=/\\\./g,cu=1e5;function Hr(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function fu(e){return e.replace(ou,Kn).replace(nu,Xn).replace(au,qr).replace(lu,Zn).replace(hu,Qn)}function uu(e){return e.replace(tu,"\\").replace(eu,"{").replace(su,"}").replace(iu,",").replace(ru,".")}function ta(e){if(!e)return[""];let t=[],s=Gr("{","}",e);if(!s)return e.split(",");let{pre:i,body:r,post:o}=s,n=i.split(",");n[n.length-1]+="{"+r+"}";let a=ta(o);return o.length&&(n[n.length-1]+=a.shift(),n.push.apply(n,a)),t.push.apply(t,n),t}function ea(e,t={}){if(!e)return[];let{max:s=cu}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),gs(fu(e),s,!0).map(uu)}function pu(e){return"{"+e+"}"}function du(e){return/^-?0\d/.test(e)}function mu(e,t){return e<=t}function gu(e,t){return e>=t}function gs(e,t,s){let i=[],r=Gr("{","}",e);if(!r)return[e];let o=r.pre,n=r.post.length?gs(r.post,t,!1):[""];if(/\$$/.test(r.pre))for(let a=0;a<n.length&&a<t;a++){let l=o+"{"+r.body+"}"+n[a];i.push(l)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(r.body),l=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(r.body),h=a||l,f=r.body.indexOf(",")>=0;if(!h&&!f)return r.post.match(/,(?!,).*\}/)?(e=r.pre+"{"+r.body+qr+r.post,gs(e,t,!0)):[e];let c;if(h)c=r.body.split(/\.\./);else if(c=ta(r.body),c.length===1&&c[0]!==void 0&&(c=gs(c[0],t,!1).map(pu),c.length===1))return n.map(p=>r.pre+c[0]+p);let u;if(h&&c[0]!==void 0&&c[1]!==void 0){let p=Hr(c[0]),d=Hr(c[1]),m=Math.max(c[0].length,c[1].length),y=c.length===3&&c[2]!==void 0?Math.max(Math.abs(Hr(c[2])),1):1,g=mu;d<p&&(y*=-1,g=gu);let S=c.some(du);u=[];for(let b=p;g(b,d)&&u.length<t;b+=y){let v;if(l)v=String.fromCharCode(b),v==="\\"&&(v="");else if(v=String(b),S){let R=m-v.length;if(R>0){let L=new Array(R+1).join("0");b<0?v="-"+L+v.slice(1):v=L+v}}u.push(v)}}else{u=[];for(let p=0;p<c.length;p++)u.push.apply(u,gs(c[p],t,!1))}for(let p=0;p<u.length;p++)for(let d=0;d<n.length&&i.length<t;d++){let m=o+u[p]+n[d];(!s||h||m)&&i.push(m)}}return i}var ys=e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")};var yu={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},ws=e=>e.replace(/[[\]\\-]/g,"\\$&"),wu=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),sa=e=>e.join(""),ia=(e,t)=>{let s=t;if(e.charAt(s)!=="[")throw new Error("not in a brace expression");let i=[],r=[],o=s+1,n=!1,a=!1,l=!1,h=!1,f=s,c="";t:for(;o<e.length;){let m=e.charAt(o);if((m==="!"||m==="^")&&o===s+1){h=!0,o++;continue}if(m==="]"&&n&&!l){f=o+1;break}if(n=!0,m==="\\"&&!l){l=!0,o++;continue}if(m==="["&&!l){for(let[y,[g,w,S]]of Object.entries(yu))if(e.startsWith(y,o)){if(c)return["$.",!1,e.length-s,!0];o+=y.length,S?r.push(g):i.push(g),a=a||w;continue t}}if(l=!1,c){m>c?i.push(ws(c)+"-"+ws(m)):m===c&&i.push(ws(m)),c="",o++;continue}if(e.startsWith("-]",o+1)){i.push(ws(m+"-")),o+=2;continue}if(e.startsWith("-",o+1)){c=m,o+=2;continue}i.push(ws(m)),o++}if(f<o)return["",!1,0,!1];if(!i.length&&!r.length)return["$.",!1,e.length-s,!0];if(r.length===0&&i.length===1&&/^\\?.$/.test(i[0])&&!h){let m=i[0].length===2?i[0].slice(-1):i[0];return[wu(m),!1,f-s,!1]}let u="["+(h?"^":"")+sa(i)+"]",p="["+(h?"":"^")+sa(r)+"]";return[i.length&&r.length?"("+u+"|"+p+")":i.length?u:p,a,f-s,!0]};var ne=(e,{windowsPathsNoEscape:t=!1,magicalBraces:s=!0}={})=>s?t?e.replace(/\[([^/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):t?e.replace(/\[([^/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1");var ft,bu=new Set(["!","?","+","*","@"]),Yr=e=>bu.has(e),ra=e=>Yr(e.type),Su=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),vu=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),Eu=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),oa=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),xu="(?!(?:^|/)\\.\\.?(?:$|/))",ui="(?!\\.)",Tu=new Set(["[","."]),ku=new Set(["..","."]),_u=new Set("().*{}+?[]^$\\!"),Ou=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Vr="[^/]",na=Vr+"*?",aa=Vr+"+?",Ru=0,Se=class{type;#t;#r;#n=!1;#s=[];#o;#_;#T;#c=!1;#a;#p;#h=!1;id=++Ru;get depth(){return(this.#o?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#t.id,parent:this.#o?.id,depth:this.depth,partsLength:this.#s.length,parts:this.#s}}constructor(t,s,i={}){this.type=t,t&&(this.#r=!0),this.#o=s,this.#t=this.#o?this.#o.#t:this,this.#a=this.#t===this?i:this.#t.#a,this.#T=this.#t===this?[]:this.#t.#T,t==="!"&&!this.#t.#c&&this.#T.push(this),this.#_=this.#o?this.#o.#s.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let t of this.#s)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#p!==void 0?this.#p:this.type?this.#p=this.type+"("+this.#s.map(t=>String(t)).join("|")+")":this.#p=this.#s.map(t=>String(t)).join("")}#l(){if(this!==this.#t)throw new Error("should only call on root");if(this.#c)return this;this.toString(),this.#c=!0;let t;for(;t=this.#T.pop();){if(t.type!=="!")continue;let s=t,i=s.#o;for(;i;){for(let r=s.#_+1;!i.type&&r<i.#s.length;r++)for(let o of t.#s){if(typeof o=="string")throw new Error("string part in extglob AST??");o.copyIn(i.#s[r])}s=i,i=s.#o}}return this}push(...t){for(let s of t)if(s!==""){if(typeof s!="string"&&!(s instanceof ft&&s.#o===this))throw new Error("invalid part: "+s);this.#s.push(s)}}toJSON(){let t=this.type===null?this.#s.slice().map(s=>typeof s=="string"?s:s.toJSON()):[this.type,...this.#s.map(s=>s.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#c&&this.#o?.type==="!")&&t.push({}),t}isStart(){if(this.#t===this)return!0;if(!this.#o?.isStart())return!1;if(this.#_===0)return!0;let t=this.#o;for(let s=0;s<this.#_;s++){let i=t.#s[s];if(!(i instanceof ft&&i.type==="!"))return!1}return!0}isEnd(){if(this.#t===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let t=this.#o?this.#o.#s.length:0;return this.#_===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let s=new ft(this.type,t);for(let i of this.#s)s.copyIn(i);return s}static#i(t,s,i,r,o){let n=r.maxExtglobRecursion??2,a=!1,l=!1,h=-1,f=!1;if(s.type===null){let m=i,y="";for(;m<t.length;){let g=t.charAt(m++);if(a||g==="\\"){a=!a,y+=g;continue}if(l){m===h+1?(g==="^"||g==="!")&&(f=!0):g==="]"&&!(m===h+2&&f)&&(l=!1),y+=g;continue}else if(g==="["){l=!0,h=m,f=!1,y+=g;continue}if(!r.noext&&Yr(g)&&t.charAt(m)==="("&&o<=n){s.push(y),y="";let S=new ft(g,s);m=ft.#i(t,S,m,r,o+1),s.push(S);continue}y+=g}return s.push(y),m}let c=i+1,u=new ft(null,s),p=[],d="";for(;c<t.length;){let m=t.charAt(c++);if(a||m==="\\"){a=!a,d+=m;continue}if(l){c===h+1?(m==="^"||m==="!")&&(f=!0):m==="]"&&!(c===h+2&&f)&&(l=!1),d+=m;continue}else if(m==="["){l=!0,h=c,f=!1,d+=m;continue}if(!r.noext&&Yr(m)&&t.charAt(c)==="("&&(o<=n||s&&s.#y(m))){let g=s&&s.#y(m)?0:1;u.push(d),d="";let w=new ft(m,u);u.push(w),c=ft.#i(t,w,c,r,o+g);continue}if(m==="|"){u.push(d),d="",p.push(u),u=new ft(null,s);continue}if(m===")")return d===""&&s.#s.length===0&&(s.#h=!0),u.push(d),d="",s.push(...p,u),c;d+=m}return s.type=null,s.#r=void 0,s.#s=[t.substring(i-1)],c}#w(t){return this.#S(t,vu)}#S(t,s=Su){if(!t||typeof t!="object"||t.type!==null||t.#s.length!==1||this.type===null)return!1;let i=t.#s[0];return!i||typeof i!="object"||i.type===null?!1:this.#y(i.type,s)}#y(t,s=Eu){return!!s.get(this.type)?.includes(t)}#d(t,s){let i=t.#s[0],r=new ft(null,i,this.options);r.#s.push(""),i.push(r),this.#O(t,s)}#O(t,s){let i=t.#s[0];this.#s.splice(s,1,...i.#s);for(let r of i.#s)typeof r=="object"&&(r.#o=this);this.#p=void 0}#m(t){return!!oa.get(this.type)?.has(t)}#v(t){if(!t||typeof t!="object"||t.type!==null||t.#s.length!==1||this.type===null||this.#s.length!==1)return!1;let s=t.#s[0];return!s||typeof s!="object"||s.type===null?!1:this.#m(s.type)}#k(t){let s=oa.get(this.type),i=t.#s[0],r=s?.get(i.type);if(!r)return!1;this.#s=i.#s;for(let o of this.#s)typeof o=="object"&&(o.#o=this);this.type=r,this.#p=void 0,this.#h=!1}static fromGlob(t,s={}){let i=new ft(null,void 0,s);return ft.#i(t,i,0,s,0),i}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let t=this.toString(),[s,i,r,o]=this.toRegExpSource();if(!(r||this.#r||this.#a.nocase&&!this.#a.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return i;let a=(this.#a.nocase?"i":"")+(o?"u":"");return Object.assign(new RegExp(`^${s}$`,a),{_src:s,_glob:t})}get options(){return this.#a}toRegExpSource(t){let s=t??!!this.#a.dot;if(this.#t===this&&(this.#f(),this.#l()),!ra(this)){let l=this.isStart()&&this.isEnd()&&!this.#s.some(p=>typeof p!="string"),h=this.#s.map(p=>{let[d,m,y,g]=typeof p=="string"?ft.#b(p,this.#r,l):p.toRegExpSource(t);return this.#r=this.#r||y,this.#n=this.#n||g,d}).join(""),f="";if(this.isStart()&&typeof this.#s[0]=="string"&&!(this.#s.length===1&&ku.has(this.#s[0]))){let d=Tu,m=s&&d.has(h.charAt(0))||h.startsWith("\\.")&&d.has(h.charAt(2))||h.startsWith("\\.\\.")&&d.has(h.charAt(4)),y=!s&&!t&&d.has(h.charAt(0));f=m?xu:y?ui:""}let c="";return this.isEnd()&&this.#t.#c&&this.#o?.type==="!"&&(c="(?:$|\\/)"),[f+h+c,ne(h),this.#r=!!this.#r,this.#n]}let i=this.type==="*"||this.type==="+",r=this.type==="!"?"(?:(?!(?:":"(?:",o=this.#g(s);if(this.isStart()&&this.isEnd()&&!o&&this.type!=="!"){let l=this.toString(),h=this;return h.#s=[l],h.type=null,h.#r=void 0,[l,ne(this.toString()),!1,!1]}let n=!i||t||s||!ui?"":this.#g(!0);n===o&&(n=""),n&&(o=`(?:${o})(?:${n})*?`);let a="";if(this.type==="!"&&this.#h)a=(this.isStart()&&!s?ui:"")+aa;else{let l=this.type==="!"?"))"+(this.isStart()&&!s&&!t?ui:"")+na+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&n?")":this.type==="*"&&n?")?":`)${this.type}`;a=r+o+l}return[a,ne(o),this.#r=!!this.#r,this.#n]}#f(){if(ra(this)){let t=0,s=!1;do{s=!0;for(let i=0;i<this.#s.length;i++){let r=this.#s[i];typeof r=="object"&&(r.#f(),this.#S(r)?(s=!1,this.#O(r,i)):this.#w(r)?(s=!1,this.#d(r,i)):this.#v(r)&&(s=!1,this.#k(r)))}}while(!s&&++t<10)}else for(let t of this.#s)typeof t=="object"&&t.#f();this.#p=void 0}#g(t){return this.#s.map(s=>{if(typeof s=="string")throw new Error("string type in extglob ast??");let[i,r,o,n]=s.toRegExpSource(t);return this.#n=this.#n||n,i}).filter(s=>!(this.isStart()&&this.isEnd())||!!s).join("|")}static#b(t,s,i=!1){let r=!1,o="",n=!1,a=!1;for(let l=0;l<t.length;l++){let h=t.charAt(l);if(r){r=!1,o+=(_u.has(h)?"\\":"")+h;continue}if(h==="*"){if(a)continue;a=!0,o+=i&&/^[*]+$/.test(t)?aa:na,s=!0;continue}else a=!1;if(h==="\\"){l===t.length-1?o+="\\\\":r=!0;continue}if(h==="["){let[f,c,u,p]=ia(t,l);if(u){o+=f,n=n||c,l+=u-1,s=s||p;continue}}if(h==="?"){o+=Vr,s=!0;continue}o+=Ou(h)}return[o,ne(t),!!s,n]}};ft=Se;var Jr=(e,{windowsPathsNoEscape:t=!1,magicalBraces:s=!1}={})=>s?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&");var it=(e,t,s={})=>(ys(t),!s.nocomment&&t.charAt(0)==="#"?!1:new ae(t,s).match(e)),Au=/^\*+([^+@!?*[(]*)$/,ju=e=>t=>!t.startsWith(".")&&t.endsWith(e),Cu=e=>t=>t.endsWith(e),Pu=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),Fu=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Nu=/^\*+\.\*+$/,Du=e=>!e.startsWith(".")&&e.includes("."),$u=e=>e!=="."&&e!==".."&&e.includes("."),Mu=/^\.\*+$/,Lu=e=>e!=="."&&e!==".."&&e.startsWith("."),Wu=/^\*+$/,Iu=e=>e.length!==0&&!e.startsWith("."),zu=e=>e.length!==0&&e!=="."&&e!=="..",Uu=/^\?+([^+@!?*[(]*)?$/,Bu=([e,t=""])=>{let s=ca([e]);return t?(t=t.toLowerCase(),i=>s(i)&&i.toLowerCase().endsWith(t)):s},Gu=([e,t=""])=>{let s=fa([e]);return t?(t=t.toLowerCase(),i=>s(i)&&i.toLowerCase().endsWith(t)):s},Hu=([e,t=""])=>{let s=fa([e]);return t?i=>s(i)&&i.endsWith(t):s},qu=([e,t=""])=>{let s=ca([e]);return t?i=>s(i)&&i.endsWith(t):s},ca=([e])=>{let t=e.length;return s=>s.length===t&&!s.startsWith(".")},fa=([e])=>{let t=e.length;return s=>s.length===t&&s!=="."&&s!==".."},ua=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",la={win32:{sep:"\\"},posix:{sep:"/"}},Yu=ua==="win32"?la.win32.sep:la.posix.sep;it.sep=Yu;var V=Symbol("globstar **");it.GLOBSTAR=V;var Vu="[^/]",Ju=Vu+"*?",Ku="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Xu="(?:(?!(?:\\/|^)\\.).)*?",Zu=(e,t={})=>s=>it(s,e,t);it.filter=Zu;var xt=(e,t={})=>Object.assign({},e,t),Qu=e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return it;let t=it;return Object.assign((i,r,o={})=>t(i,r,xt(e,o)),{Minimatch:class extends t.Minimatch{constructor(r,o={}){super(r,xt(e,o))}static defaults(r){return t.defaults(xt(e,r)).Minimatch}},AST:class extends t.AST{constructor(r,o,n={}){super(r,o,xt(e,n))}static fromGlob(r,o={}){return t.AST.fromGlob(r,xt(e,o))}},unescape:(i,r={})=>t.unescape(i,xt(e,r)),escape:(i,r={})=>t.escape(i,xt(e,r)),filter:(i,r={})=>t.filter(i,xt(e,r)),defaults:i=>t.defaults(xt(e,i)),makeRe:(i,r={})=>t.makeRe(i,xt(e,r)),braceExpand:(i,r={})=>t.braceExpand(i,xt(e,r)),match:(i,r,o={})=>t.match(i,r,xt(e,o)),sep:t.sep,GLOBSTAR:V})};it.defaults=Qu;var pa=(e,t={})=>(ys(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:ea(e,{max:t.braceExpandMax}));it.braceExpand=pa;var tp=(e,t={})=>new ae(e,t).makeRe();it.makeRe=tp;var ep=(e,t,s={})=>{let i=new ae(t,s);return e=e.filter(r=>i.match(r)),i.options.nonull&&!e.length&&e.push(t),e};it.match=ep;var ha=/[?*]|[+@!]\(.*?\)|\[|\]/,sp=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ae=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(t,s={}){ys(t),s=s||{},this.options=s,this.maxGlobstarRecursion=s.maxGlobstarRecursion??200,this.pattern=t,this.platform=s.platform||ua,this.isWindows=this.platform==="win32";let i="allowWindowsEscape";this.windowsPathsNoEscape=!!s.windowsPathsNoEscape||s[i]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!s.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!s.nonegate,this.comment=!1,this.empty=!1,this.partial=!!s.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=s.windowsNoMagicRoot!==void 0?s.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let s of t)if(typeof s!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,s=this.options;if(!s.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],s.debug&&(this.debug=(...o)=>console.error(...o)),this.debug(this.pattern,this.globSet);let i=this.globSet.map(o=>this.slashSplit(o));this.globParts=this.preprocess(i),this.debug(this.pattern,this.globParts);let r=this.globParts.map((o,n,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=o[0]===""&&o[1]===""&&(o[2]==="?"||!ha.test(o[2]))&&!ha.test(o[3]),h=/^[a-z]:/i.test(o[0]);if(l)return[...o.slice(0,4),...o.slice(4).map(f=>this.parse(f))];if(h)return[o[0],...o.slice(1).map(f=>this.parse(f))]}return o.map(l=>this.parse(l))});if(this.debug(this.pattern,r),this.set=r.filter(o=>o.indexOf(!1)===-1),this.isWindows)for(let o=0;o<this.set.length;o++){let n=this.set[o];n[0]===""&&n[1]===""&&this.globParts[o][2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3])&&(n[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let i of t)for(let r=0;r<i.length;r++)i[r]==="**"&&(i[r]="*");let{optimizationLevel:s=1}=this.options;return s>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):s>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(s=>{let i=-1;for(;(i=s.indexOf("**",i+1))!==-1;){let r=i;for(;s[r+1]==="**";)r++;r!==i&&s.splice(i,r-i)}return s})}levelOneOptimize(t){return t.map(s=>(s=s.reduce((i,r)=>{let o=i[i.length-1];return r==="**"&&o==="**"?i:r===".."&&o&&o!==".."&&o!=="."&&o!=="**"?(i.pop(),i):(i.push(r),i)},[]),s.length===0?[""]:s))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let s=!1;do{if(s=!1,!this.preserveMultipleSlashes){for(let r=1;r<t.length-1;r++){let o=t[r];r===1&&o===""&&t[0]===""||(o==="."||o==="")&&(s=!0,t.splice(r,1),r--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(s=!0,t.pop())}let i=0;for(;(i=t.indexOf("..",i+1))!==-1;){let r=t[i-1];r&&r!=="."&&r!==".."&&r!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(r))&&(s=!0,t.splice(i-1,2),i-=2)}}while(s);return t.length===0?[""]:t}firstPhasePreProcess(t){let s=!1;do{s=!1;for(let i of t){let r=-1;for(;(r=i.indexOf("**",r+1))!==-1;){let n=r;for(;i[n+1]==="**";)n++;n>r&&i.splice(r+1,n-r);let a=i[r+1],l=i[r+2],h=i[r+3];if(a!==".."||!l||l==="."||l===".."||!h||h==="."||h==="..")continue;s=!0,i.splice(r,1);let f=i.slice(0);f[r]="**",t.push(f),r--}if(!this.preserveMultipleSlashes){for(let n=1;n<i.length-1;n++){let a=i[n];n===1&&a===""&&i[0]===""||(a==="."||a==="")&&(s=!0,i.splice(n,1),n--)}i[0]==="."&&i.length===2&&(i[1]==="."||i[1]==="")&&(s=!0,i.pop())}let o=0;for(;(o=i.indexOf("..",o+1))!==-1;){let n=i[o-1];if(n&&n!=="."&&n!==".."&&n!=="**"){s=!0;let l=o===1&&i[o+1]==="**"?["."]:[];i.splice(o-1,2,...l),i.length===0&&i.push(""),o-=2}}}}while(s);return t}secondPhasePreProcess(t){for(let s=0;s<t.length-1;s++)for(let i=s+1;i<t.length;i++){let r=this.partsMatch(t[s],t[i],!this.preserveMultipleSlashes);if(r){t[s]=[],t[i]=r;break}}return t.filter(s=>s.length)}partsMatch(t,s,i=!1){let r=0,o=0,n=[],a="";for(;r<t.length&&o<s.length;)if(t[r]===s[o])n.push(a==="b"?s[o]:t[r]),r++,o++;else if(i&&t[r]==="**"&&s[o]===t[r+1])n.push(t[r]),r++;else if(i&&s[o]==="**"&&t[r]===s[o+1])n.push(s[o]),o++;else if(t[r]==="*"&&s[o]&&(this.options.dot||!s[o].startsWith("."))&&s[o]!=="**"){if(a==="b")return!1;a="a",n.push(t[r]),r++,o++}else if(s[o]==="*"&&t[r]&&(this.options.dot||!t[r].startsWith("."))&&t[r]!=="**"){if(a==="a")return!1;a="b",n.push(s[o]),r++,o++}else return!1;return t.length===s.length&&n}parseNegate(){if(this.nonegate)return;let t=this.pattern,s=!1,i=0;for(let r=0;r<t.length&&t.charAt(r)==="!";r++)s=!s,i++;i&&(this.pattern=t.slice(i)),this.negate=s}matchOne(t,s,i=!1){let r=0,o=0;if(this.isWindows){let a=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),l=!a&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),h=typeof s[0]=="string"&&/^[a-z]:$/i.test(s[0]),f=!h&&s[0]===""&&s[1]===""&&s[2]==="?"&&typeof s[3]=="string"&&/^[a-z]:$/i.test(s[3]),c=l?3:a?0:void 0,u=f?3:h?0:void 0;if(typeof c=="number"&&typeof u=="number"){let[p,d]=[t[c],s[u]];p.toLowerCase()===d.toLowerCase()&&(s[u]=p,o=u,r=c)}}let{optimizationLevel:n=1}=this.options;return n>=2&&(t=this.levelTwoFileOptimize(t)),s.includes(V)?this.#t(t,s,i,r,o):this.#n(t,s,i,r,o)}#t(t,s,i,r,o){let n=s.indexOf(V,o),a=s.lastIndexOf(V),[l,h,f]=i?[s.slice(o,n),s.slice(n+1),[]]:[s.slice(o,n),s.slice(n+1,a),s.slice(a+1)];if(l.length){let w=t.slice(r,r+l.length);if(!this.#n(w,l,i,0,0))return!1;r+=l.length,o+=l.length}let c=0;if(f.length){if(f.length+r>t.length)return!1;let w=t.length-f.length;if(this.#n(t,f,i,w,0))c=f.length;else{if(t[t.length-1]!==""||r+f.length===t.length||(w--,!this.#n(t,f,i,w,0)))return!1;c=f.length+1}}if(!h.length){let w=!!c;for(let S=r;S<t.length-c;S++){let b=String(t[S]);if(w=!0,b==="."||b===".."||!this.options.dot&&b.startsWith("."))return!1}return i||w}let u=[[[],0]],p=u[0],d=0,m=[0];for(let w of h)w===V?(m.push(d),p=[[],0],u.push(p)):(p[0].push(w),d++);let y=u.length-1,g=t.length-c;for(let w of u)w[1]=g-(m[y--]+w[0].length);return!!this.#r(t,u,r,0,i,0,!!c)}#r(t,s,i,r,o,n,a){let l=s[r];if(!l){for(let c=i;c<t.length;c++){a=!0;let u=t[c];if(u==="."||u===".."||!this.options.dot&&u.startsWith("."))return!1}return a}let[h,f]=l;for(;i<=f;){if(this.#n(t.slice(0,i+h.length),h,o,i,0)&&n<this.maxGlobstarRecursion){let p=this.#r(t,s,i+h.length,r+1,o,n+1,a);if(p!==!1)return p}let u=t[i];if(u==="."||u===".."||!this.options.dot&&u.startsWith("."))return!1;i++}return o||null}#n(t,s,i,r,o){let n,a,l,h;for(n=r,a=o,h=t.length,l=s.length;n<h&&a<l;n++,a++){this.debug("matchOne loop");let f=s[a],c=t[n];if(this.debug(s,f,c),f===!1||f===V)return!1;let u;if(typeof f=="string"?(u=c===f,this.debug("string match",f,c,u)):(u=f.test(c),this.debug("pattern match",f,c,u)),!u)return!1}if(n===h&&a===l)return!0;if(n===h)return i;if(a===l)return n===h-1&&t[n]==="";throw new Error("wtf?")}braceExpand(){return pa(this.pattern,this.options)}parse(t){ys(t);let s=this.options;if(t==="**")return V;if(t==="")return"";let i,r=null;(i=t.match(Wu))?r=s.dot?zu:Iu:(i=t.match(Au))?r=(s.nocase?s.dot?Fu:Pu:s.dot?Cu:ju)(i[1]):(i=t.match(Uu))?r=(s.nocase?s.dot?Gu:Bu:s.dot?Hu:qu)(i):(i=t.match(Nu))?r=s.dot?$u:Du:(i=t.match(Mu))&&(r=Lu);let o=Se.fromGlob(t,this.options).toMMPattern();return r&&typeof o=="object"&&Reflect.defineProperty(o,"test",{value:r}),o}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let s=this.options,i=s.noglobstar?Ju:s.dot?Ku:Xu,r=new Set(s.nocase?["i"]:[]),o=t.map(l=>{let h=l.map(c=>{if(c instanceof RegExp)for(let u of c.flags.split(""))r.add(u);return typeof c=="string"?sp(c):c===V?V:c._src});h.forEach((c,u)=>{let p=h[u+1],d=h[u-1];c!==V||d===V||(d===void 0?p!==void 0&&p!==V?h[u+1]="(?:\\/|"+i+"\\/)?"+p:h[u]=i:p===void 0?h[u-1]=d+"(?:\\/|\\/"+i+")?":p!==V&&(h[u-1]=d+"(?:\\/|\\/"+i+"\\/)"+p,h[u+1]=V))});let f=h.filter(c=>c!==V);if(this.partial&&f.length>=1){let c=[];for(let u=1;u<=f.length;u++)c.push(f.slice(0,u).join("/"));return"(?:"+c.join("|")+")"}return f.join("/")}).join("|"),[n,a]=t.length>1?["(?:",")"]:["",""];o="^"+n+o+a+"$",this.partial&&(o="^(?:\\/|"+n+o.slice(1,-1)+a+")$"),this.negate&&(o="^(?!"+o+").+$");try{this.regexp=new RegExp(o,[...r].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,s=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&s)return!0;let i=this.options;this.isWindows&&(t=t.split("\\").join("/"));let r=this.slashSplit(t);this.debug(this.pattern,"split",r);let o=this.set;this.debug(this.pattern,"set",o);let n=r[r.length-1];if(!n)for(let a=r.length-2;!n&&a>=0;a--)n=r[a];for(let a of o){let l=r;if(i.matchBase&&a.length===1&&(l=[n]),this.matchOne(l,a,s))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(t){return it.defaults(t).Minimatch}};it.AST=Se;it.Minimatch=ae;it.escape=Jr;it.unescape=ne;var Kr=parseInt(process.env.TSHY_VERBOSE||"0"),pi=[],D=(...e)=>{Kr>=1?console.error(...e):pi.push(e)},T=(...e)=>{Kr>=2?console.error(...e):pi.push(e)},da=(...e)=>{Kr>=1&&console.log(...e)},Me=()=>{for(let e of pi)console.error(...e);pi.length=0};var k=(e,t)=>{D(E.red.bold(e)),t&&D(t.message),Me()};import{readFileSync as lp}from"fs";var ip=e=>Array.from(e).map(t=>"0x"+t.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")).join(""),rp=(e,t,s)=>{if(!t)return{message:e.message+" while parsing empty string",position:0};let i=e.message.match(/^Unexpected (?:token (.*?))?/i),r=e.message.match(/at positions? (\d+)/),o=/^Unexpected end of JSON|Unterminated string in JSON/i.test(e.message)?t.length-1:r&&r[1]?+r[1]:/is not valid JSON$/.test(e.message)?0:null,n=i&&i[1]?e.message.replace(/^Unexpected token ./,`Unexpected token ${JSON.stringify(i[1])} (${ip(i[1])})`):e.message;if(o!=null){let a=o<=s?0:o-s,l=o+s>=t.length?t.length:o+s,h=(a===0?"":"...")+t.slice(a,l)+(l===t.length?"":"...");return{message:n+` while parsing ${t===h?"":"near "}${JSON.stringify(h)}`,position:o}}else return{message:n+` while parsing '${t.slice(0,s*2)}'`,position:0}},Xr=class extends SyntaxError{code;cause;position;constructor(t,s,i=20,r){let{message:o,position:n}=rp(t,s,i);super(o),this.cause=t,this.position=n,this.code="EJSONPARSE",Error.captureStackTrace(this,r||this.constructor)}get name(){return this.constructor.name}set name(t){}get[Symbol.toStringTag](){return this.constructor.name}},ma=Symbol.for("indent"),ga=Symbol.for("newline"),op=/^\s*[{\[]((?:\r?\n)+)([\s\t]*)/,np=/^(?:\{\}|\[\])((?:\r?\n)+)?$/,Zr=(e,t,s)=>{let i=ap(String(e));t||(t=void 0),s=s||20;try{let[,r=`
`,o=" "]=i.match(np)||i.match(op)||[,"",""],n=JSON.parse(i,t);return n&&typeof n=="object"&&(n[ga]=r,n[ma]=o),n}catch(r){if(typeof e!="string"&&!Buffer.isBuffer(e)){let o=Array.isArray(e)&&e.length===0;throw Object.assign(new TypeError(`Cannot parse ${o?"an empty array":String(e)}`),{code:"EJSONPARSE",systemError:r})}throw new Xr(r,i,s,Zr)}};var ap=e=>String(e).replace(/^\uFEFF/,""),di=(e,t,s)=>{let i=s===void 0?e[ma]:s,r=JSON.stringify(e,t,i),o=e[ga]||`
`;return i?(o===`
`?r:r.split(`
`).join(o))+o:r};var hp=e=>!!e&&typeof e=="object"&&!Array.isArray(e),cp=()=>{try{let e=Zr(lp("package.json","utf8"));if(hp(e))return Object.assign(e,{type:e.type==="commonjs"?"commonjs":"module"});throw new Error("Invalid package.json contents: "+di(e))}catch(e){k("failed to read package.json",e),process.exit(1)}},_=cp();import{readdirSync as fp}from"fs";import{join as up}from"path/posix";var ya=(e="src")=>{let t=[],s=fp(e,{withFileTypes:!0});for(let i of s){let r=`./${up(e,i.name)}`;i.isFile()?t.push(r):i.isDirectory()&&t.push(...ya(r))}return t},pp=new Set(ya()),Kt=pp;var dp=e=>e==="commonjs"||e==="esm",wa=e=>e&&Array.isArray(e)&&e.length&&!e.some(t=>!dp(t))?!0:(k(`tshy.dialects must be an array including "esm" and/or "commonjs", got: ${JSON.stringify(e)}`),process.exit(1));var ba=e=>e&&Array.isArray(e)&&e.length&&!e.some(t=>typeof t!="string")?!0:(k(`tshy.exclude must be an array of string glob patterns if defined, got: ${JSON.stringify(e)}`),process.exit(1));import{join as mp}from"node:path/posix";var Sa=e=>`./${mp(e)}`;import{join as va}from"path/posix";var Bt=(e,t)=>{if(typeof e=="string")return e;if(typeof e!="object")return;if(e===null)return e;if(Array.isArray(e)){for(let i of e){let r=Bt(i,t);if(r||r===null)return r}return}let s=[...t,"default"];for(let[i,r]of Object.entries(e))if(s.includes(i)){let o=Bt(r,t);if(o||o===null)return o}};var mi=e=>{let t=Bt(e,["import"]),s=Bt(e,["require"]);return!(t&&va(t).startsWith("src/")||s&&va(s).startsWith("src/"))};var gp=e=>!!e&&typeof e=="object"&&!Array.isArray(e),Qr=e=>{if(!gp(e))return!1;for(let[t,s]of Object.entries(e)){if(t!=="."&&!t.startsWith("./"))return k(`tshy.exports key must be "." or start with "./", got: ${t}`),process.exit(1);if(typeof s=="string"){e[t]=Sa(s);continue}if(typeof s!="object")return k(`tshy.exports ${t} value must be valid package.json exports value, got: ${JSON.stringify(s)}`),process.exit(1);if(!mi(s))return k(`tshy.exports ${t} unbuilt exports must not be in ./src, and exports in src must be string values. got: ${JSON.stringify(s)}`),process.exit(1);e[t]=s}return!0};import{readdirSync as yp}from"node:fs";var Ea=(e,t)=>{if(!e||!t)return!1;for(let s of e)if(t.includes(s))return s;return!1},to=(e,t)=>{let s=yp("src");for(let i of e){if(typeof i!="string")return k(`tshy.${t}Dialects must be an array of strings, got: ${i}`),process.exit(1);if(s.includes(i))return k(`tshy.${t}Dialects contains a src entry, not allowed: '${i}'`),process.exit(1);if((i.includes("/")||i.includes("\\"))&&t!=="source")return k(`tshy.${t}Dialects entries may not contain slashes: '${i}'`),process.exit(1);if(i==="commonjs"||i==="cjs"||i==="esm"||i==="require"||i==="import"||i==="source"||i==="types"||i==="default")return k(`tshy.${t}Dialects must not contain '${i}'`),process.exit(1)}return!0},xa=({commonjsDialects:e,esmDialects:t,sourceDialects:s})=>{if(e===void 0&&t===void 0&&s===void 0)return!0;if(e&&!to(e,"commonjs")||t&&!to(t,"esm")||s&&!to(s,"source"))return!1;let i=Ea(s,e);if(i)return k(`tshy.commonjsDialects overlap with tshy.sourceDialects: ${i}`),process.exit(1);let r=Ea(s,t);return r?(k(`tshy.esmDialects overlap with tshy.sourceDialects: ${r}`),process.exit(1)):!0};var Ta=e=>{let{imports:t}=e;if(t===void 0)return!0;if(Array.isArray(t)||typeof t!="object")return k(`invalid imports object, must be Record<string, Import>, got: ${JSON.stringify(t)}`),process.exit(1);for(let[s,i]of Object.entries(t)){if(!s.startsWith("#")||s==="#"||s.startsWith("#/"))return k("invalid imports module specifier: "+s),process.exit(1);if(typeof i!="string"&&!mi(i))return k(`unbuilt package.imports ${s} must not be in ./src, and imports in ./src must be string values. got: `+JSON.stringify(i)),process.exit(1)}return!0};import{resolve as wp}from"path";import{readFileSync as bp}from"node:fs";var ka=e=>{if(typeof e=="string")try{return bp(wp(e),"utf8"),!0}catch{}return k(`tshy.project must point to a tsconfig file on disk, got: ${JSON.stringify(e)}`),process.exit(1)};var _a=e=>e===void 0||e==="tsc"||e==="tsgo";var eo=(e,t)=>{let s=e[t];return s===void 0||typeof s=="boolean"?!0:(k(`tshy.${t} must be a boolean value if specified, got: `+s),process.exit(1))},Sp=e=>!!e&&Array.isArray(e)&&!e.some(t=>typeof t!="string"),vp=e=>!!e&&typeof e=="object"&&!Array.isArray(e),Ep=e=>vp(e)&&(e.exports===void 0||typeof e.exports=="string"||Sp(e.exports)||Qr(e.exports))&&(e.dialects===void 0||wa(e.dialects))&&(e.project===void 0||ka(e.project))&&(e.exclude===void 0||ba(e.exclude))&&xa(e)&&_a(e.compiler)&&eo(e,"selfLink")&&eo(e,"main")&&eo(e,"liveDev"),xp=(e,t)=>t.some(s=>s.match(e)),Oa=e=>Array.isArray(e)?e.map(t=>new ae(t.replace(/^\.\//,""))):Oa([e]),Tp=(e,t)=>{let s=Ep(e.tshy)?e.tshy:{},i=s.exports;if(typeof i=="string"||Array.isArray(i)){let n={},l=Oa(i);for(let h of t){if(!xp(h.replace(/^\.\//,""),l))continue;let f=/^\.\/src\/index.([mc]?[jt]s|[jt]sx)$/.test(h)?".":"./"+h.replace(/^\.\/src\//,"").replace(/\.([mc]?[tj]s|[jt]sx)$/,"");n[f]=`./${h}`}Qr(n)?(n["./package.json"]="./package.json",s.exports=n):(D("invalid exports pattern, using default exports"),delete s.exports,i=void 0)}let r={...s},o=r;if(o.imports&&(T(E.cyan.dim("imports")+" moving from tshy config to top level"),e.imports={...e.imports,...o.imports},delete o.imports),Ta(e),!i){let n={"./package.json":"./package.json"};for(let a of t)if(/^\.\/src\/index\.[^.]+$/.test(a)){n["."]=a;break}r.exports=n,s.exports=n,i=n}return e.tshy={...s,exports:i},r},kp=Tp(_,Kt),O=kp;import{fileURLToPath as Rd}from"node:url";import{posix as Pd,win32 as fo}from"node:path";import{fileURLToPath as Fd}from"node:url";import{lstatSync as Nd,readdir as Dd,readdirSync as $d,readlinkSync as Md,realpathSync as Ld}from"fs";import*as Wd from"node:fs";import{lstat as Id,readdir as zd,readlink as Ud,realpath as Bd}from"node:fs/promises";import{EventEmitter as mo}from"node:events";import fl from"node:stream";import{StringDecoder as Gd}from"node:string_decoder";var Ka=(e,t,s)=>{let i=e instanceof RegExp?Ra(e,s):e,r=t instanceof RegExp?Ra(t,s):t,o=i!==null&&r!=null&&_p(i,r,s);return o&&{start:o[0],end:o[1],pre:s.slice(0,o[0]),body:s.slice(o[0]+i.length,o[1]),post:s.slice(o[1]+r.length)}},Ra=(e,t)=>{let s=t.match(e);return s?s[0]:null},_p=(e,t,s)=>{let i,r,o,n,a,l=s.indexOf(e),h=s.indexOf(t,l+1),f=l;if(l>=0&&h>0){if(e===t)return[l,h];for(i=[],o=s.length;f>=0&&!a;){if(f===l)i.push(f),l=s.indexOf(e,f+1);else if(i.length===1){let c=i.pop();c!==void 0&&(a=[c,h])}else r=i.pop(),r!==void 0&&r<o&&(o=r,n=h),h=s.indexOf(t,f+1);f=l<h&&l>=0?l:h}i.length&&n!==void 0&&(a=[o,n])}return a},Xa="\0SLASH"+Math.random()+"\0",Za="\0OPEN"+Math.random()+"\0",uo="\0CLOSE"+Math.random()+"\0",Qa="\0COMMA"+Math.random()+"\0",tl="\0PERIOD"+Math.random()+"\0",Op=new RegExp(Xa,"g"),Rp=new RegExp(Za,"g"),Ap=new RegExp(uo,"g"),jp=new RegExp(Qa,"g"),Cp=new RegExp(tl,"g"),Pp=/\\\\/g,Fp=/\\{/g,Np=/\\}/g,Dp=/\\,/g,$p=/\\./g,Mp=1e5;function so(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function Lp(e){return e.replace(Pp,Xa).replace(Fp,Za).replace(Np,uo).replace(Dp,Qa).replace($p,tl)}function Wp(e){return e.replace(Op,"\\").replace(Rp,"{").replace(Ap,"}").replace(jp,",").replace(Cp,".")}function el(e){if(!e)return[""];let t=[],s=Ka("{","}",e);if(!s)return e.split(",");let{pre:i,body:r,post:o}=s,n=i.split(",");n[n.length-1]+="{"+r+"}";let a=el(o);return o.length&&(n[n.length-1]+=a.shift(),n.push.apply(n,a)),t.push.apply(t,n),t}function Ip(e,t={}){if(!e)return[];let{max:s=Mp}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),ks(Lp(e),s,!0).map(Wp)}function zp(e){return"{"+e+"}"}function Up(e){return/^-?0\d/.test(e)}function Bp(e,t){return e<=t}function Gp(e,t){return e>=t}function ks(e,t,s){let i=[],r=Ka("{","}",e);if(!r)return[e];let o=r.pre,n=r.post.length?ks(r.post,t,!1):[""];if(/\$$/.test(r.pre))for(let a=0;a<n.length&&a<t;a++){let l=o+"{"+r.body+"}"+n[a];i.push(l)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(r.body),l=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(r.body),h=a||l,f=r.body.indexOf(",")>=0;if(!h&&!f)return r.post.match(/,(?!,).*\}/)?(e=r.pre+"{"+r.body+uo+r.post,ks(e,t,!0)):[e];let c;if(h)c=r.body.split(/\.\./);else if(c=el(r.body),c.length===1&&c[0]!==void 0&&(c=ks(c[0],t,!1).map(zp),c.length===1))return n.map(p=>r.pre+c[0]+p);let u;if(h&&c[0]!==void 0&&c[1]!==void 0){let p=so(c[0]),d=so(c[1]),m=Math.max(c[0].length,c[1].length),y=c.length===3&&c[2]!==void 0?Math.abs(so(c[2])):1,g=Bp;d<p&&(y*=-1,g=Gp);let w=c.some(Up);u=[];for(let S=p;g(S,d);S+=y){let b;if(l)b=String.fromCharCode(S),b==="\\"&&(b="");else if(b=String(S),w){let v=m-b.length;if(v>0){let R=new Array(v+1).join("0");S<0?b="-"+R+b.slice(1):b=R+b}}u.push(b)}}else{u=[];for(let p=0;p<c.length;p++)u.push.apply(u,ks(c[p],t,!1))}for(let p=0;p<u.length;p++)for(let d=0;d<n.length&&i.length<t;d++){let m=o+u[p]+n[d];(!s||h||m)&&i.push(m)}}return i}var _i=e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},Hp={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},bs=e=>e.replace(/[[\]\\-]/g,"\\$&"),qp=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Aa=e=>e.join(""),Yp=(e,t)=>{let s=t;if(e.charAt(s)!=="[")throw new Error("not in a brace expression");let i=[],r=[],o=s+1,n=!1,a=!1,l=!1,h=!1,f=s,c="";t:for(;o<e.length;){let d=e.charAt(o);if((d==="!"||d==="^")&&o===s+1){h=!0,o++;continue}if(d==="]"&&n&&!l){f=o+1;break}if(n=!0,d==="\\"&&!l){l=!0,o++;continue}if(d==="["&&!l){for(let[m,[y,g,w]]of Object.entries(Hp))if(e.startsWith(m,o)){if(c)return["$.",!1,e.length-s,!0];o+=m.length,w?r.push(y):i.push(y),a=a||g;continue t}}if(l=!1,c){d>c?i.push(bs(c)+"-"+bs(d)):d===c&&i.push(bs(d)),c="",o++;continue}if(e.startsWith("-]",o+1)){i.push(bs(d+"-")),o+=2;continue}if(e.startsWith("-",o+1)){c=d,o+=2;continue}i.push(bs(d)),o++}if(f<o)return["",!1,0,!1];if(!i.length&&!r.length)return["$.",!1,e.length-s,!0];if(r.length===0&&i.length===1&&/^\\?.$/.test(i[0])&&!h){let d=i[0].length===2?i[0].slice(-1):i[0];return[qp(d),!1,f-s,!1]}let u="["+(h?"^":"")+Aa(i)+"]",p="["+(h?"":"^")+Aa(r)+"]";return[i.length&&r.length?"("+u+"|"+p+")":i.length?u:p,a,f-s,!0]},Ie=(e,{windowsPathsNoEscape:t=!1,magicalBraces:s=!0}={})=>s?t?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):t?e.replace(/\[([^\/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1"),Vp=new Set(["!","?","+","*","@"]),ja=e=>Vp.has(e),Jp="(?!(?:^|/)\\.\\.?(?:$|/))",gi="(?!\\.)",Kp=new Set(["[","."]),Xp=new Set(["..","."]),Zp=new Set("().*{}+?[]^$\\!"),Qp=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),po="[^/]",Ca=po+"*?",Pa=po+"+?",sl=class wt{type;#t;#r;#n=!1;#s=[];#o;#_;#T;#c=!1;#a;#p;#h=!1;constructor(t,s,i={}){this.type=t,t&&(this.#r=!0),this.#o=s,this.#t=this.#o?this.#o.#t:this,this.#a=this.#t===this?i:this.#t.#a,this.#T=this.#t===this?[]:this.#t.#T,t==="!"&&!this.#t.#c&&this.#T.push(this),this.#_=this.#o?this.#o.#s.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let t of this.#s)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#p!==void 0?this.#p:this.type?this.#p=this.type+"("+this.#s.map(t=>String(t)).join("|")+")":this.#p=this.#s.map(t=>String(t)).join("")}#l(){if(this!==this.#t)throw new Error("should only call on root");if(this.#c)return this;this.toString(),this.#c=!0;let t;for(;t=this.#T.pop();){if(t.type!=="!")continue;let s=t,i=s.#o;for(;i;){for(let r=s.#_+1;!i.type&&r<i.#s.length;r++)for(let o of t.#s){if(typeof o=="string")throw new Error("string part in extglob AST??");o.copyIn(i.#s[r])}s=i,i=s.#o}}return this}push(...t){for(let s of t)if(s!==""){if(typeof s!="string"&&!(s instanceof wt&&s.#o===this))throw new Error("invalid part: "+s);this.#s.push(s)}}toJSON(){let t=this.type===null?this.#s.slice().map(s=>typeof s=="string"?s:s.toJSON()):[this.type,...this.#s.map(s=>s.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#c&&this.#o?.type==="!")&&t.push({}),t}isStart(){if(this.#t===this)return!0;if(!this.#o?.isStart())return!1;if(this.#_===0)return!0;let t=this.#o;for(let s=0;s<this.#_;s++){let i=t.#s[s];if(!(i instanceof wt&&i.type==="!"))return!1}return!0}isEnd(){if(this.#t===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let t=this.#o?this.#o.#s.length:0;return this.#_===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let s=new wt(this.type,t);for(let i of this.#s)s.copyIn(i);return s}static#i(t,s,i,r){let o=!1,n=!1,a=-1,l=!1;if(s.type===null){let p=i,d="";for(;p<t.length;){let m=t.charAt(p++);if(o||m==="\\"){o=!o,d+=m;continue}if(n){p===a+1?(m==="^"||m==="!")&&(l=!0):m==="]"&&!(p===a+2&&l)&&(n=!1),d+=m;continue}else if(m==="["){n=!0,a=p,l=!1,d+=m;continue}if(!r.noext&&ja(m)&&t.charAt(p)==="("){s.push(d),d="";let y=new wt(m,s);p=wt.#i(t,y,p,r),s.push(y);continue}d+=m}return s.push(d),p}let h=i+1,f=new wt(null,s),c=[],u="";for(;h<t.length;){let p=t.charAt(h++);if(o||p==="\\"){o=!o,u+=p;continue}if(n){h===a+1?(p==="^"||p==="!")&&(l=!0):p==="]"&&!(h===a+2&&l)&&(n=!1),u+=p;continue}else if(p==="["){n=!0,a=h,l=!1,u+=p;continue}if(ja(p)&&t.charAt(h)==="("){f.push(u),u="";let d=new wt(p,f);f.push(d),h=wt.#i(t,d,h,r);continue}if(p==="|"){f.push(u),u="",c.push(f),f=new wt(null,s);continue}if(p===")")return u===""&&s.#s.length===0&&(s.#h=!0),f.push(u),u="",s.push(...c,f),h;u+=p}return s.type=null,s.#r=void 0,s.#s=[t.substring(i-1)],h}static fromGlob(t,s={}){let i=new wt(null,void 0,s);return wt.#i(t,i,0,s),i}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let t=this.toString(),[s,i,r,o]=this.toRegExpSource();if(!(r||this.#r||this.#a.nocase&&!this.#a.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return i;let n=(this.#a.nocase?"i":"")+(o?"u":"");return Object.assign(new RegExp(`^${s}$`,n),{_src:s,_glob:t})}get options(){return this.#a}toRegExpSource(t){let s=t??!!this.#a.dot;if(this.#t===this&&this.#l(),!this.type){let l=this.isStart()&&this.isEnd()&&!this.#s.some(u=>typeof u!="string"),h=this.#s.map(u=>{let[p,d,m,y]=typeof u=="string"?wt.#S(u,this.#r,l):u.toRegExpSource(t);return this.#r=this.#r||m,this.#n=this.#n||y,p}).join(""),f="";if(this.isStart()&&typeof this.#s[0]=="string"&&!(this.#s.length===1&&Xp.has(this.#s[0]))){let u=Kp,p=s&&u.has(h.charAt(0))||h.startsWith("\\.")&&u.has(h.charAt(2))||h.startsWith("\\.\\.")&&u.has(h.charAt(4)),d=!s&&!t&&u.has(h.charAt(0));f=p?Jp:d?gi:""}let c="";return this.isEnd()&&this.#t.#c&&this.#o?.type==="!"&&(c="(?:$|\\/)"),[f+h+c,Ie(h),this.#r=!!this.#r,this.#n]}let i=this.type==="*"||this.type==="+",r=this.type==="!"?"(?:(?!(?:":"(?:",o=this.#w(s);if(this.isStart()&&this.isEnd()&&!o&&this.type!=="!"){let l=this.toString();return this.#s=[l],this.type=null,this.#r=void 0,[l,Ie(this.toString()),!1,!1]}let n=!i||t||s||!gi?"":this.#w(!0);n===o&&(n=""),n&&(o=`(?:${o})(?:${n})*?`);let a="";if(this.type==="!"&&this.#h)a=(this.isStart()&&!s?gi:"")+Pa;else{let l=this.type==="!"?"))"+(this.isStart()&&!s&&!t?gi:"")+Ca+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&n?")":this.type==="*"&&n?")?":`)${this.type}`;a=r+o+l}return[a,Ie(o),this.#r=!!this.#r,this.#n]}#w(t){return this.#s.map(s=>{if(typeof s=="string")throw new Error("string type in extglob ast??");let[i,r,o,n]=s.toRegExpSource(t);return this.#n=this.#n||n,i}).filter(s=>!(this.isStart()&&this.isEnd())||!!s).join("|")}static#S(t,s,i=!1){let r=!1,o="",n=!1,a=!1;for(let l=0;l<t.length;l++){let h=t.charAt(l);if(r){r=!1,o+=(Zp.has(h)?"\\":"")+h;continue}if(h==="*"){if(a)continue;a=!0,o+=i&&/^[*]+$/.test(t)?Pa:Ca,s=!0;continue}else a=!1;if(h==="\\"){l===t.length-1?o+="\\\\":r=!0;continue}if(h==="["){let[f,c,u,p]=Yp(t,l);if(u){o+=f,n=n||c,l+=u-1,s=s||p;continue}}if(h==="?"){o+=po,s=!0;continue}o+=Qp(h)}return[o,Ie(t),!!s,n]}},js=(e,{windowsPathsNoEscape:t=!1,magicalBraces:s=!1}={})=>s?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),nt=(e,t,s={})=>(_i(t),!s.nocomment&&t.charAt(0)==="#"?!1:new ce(t,s).match(e)),td=/^\*+([^+@!?\*\[\(]*)$/,ed=e=>t=>!t.startsWith(".")&&t.endsWith(e),sd=e=>t=>t.endsWith(e),id=e=>(e=e.toLowerCase(),t=>!t.starts