UNPKG

chromatic

Version:

Automate visual testing across browsers. Gather UI feedback. Versioned documentation.

99 lines • 165 kB
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="bbb2e6df-0839-55a4-b84a-16a67bfa108f")}catch(e){}}();
const e=require("./rolldown-runtime-DMt3xDJx.cjs"),t=require("./icons-Cd4LHEK-.cjs"),n=require("./lib-DxWMkdTe.cjs"),r=require("./strip-ansi-BHN-EOBd.cjs");let i=require("fs");i=e.a(i,1);let a=require("path");a=e.a(a,1);let o=require("os");o=e.a(o,1);let s=require("tty");s=e.a(s,1);let c=require("events");c=e.a(c,1);let l=require("child_process");l=e.a(l,1);let u=require("node:util"),d=require("node:child_process");d=e.a(d,1);let f=require("node:fs");f=e.a(f,1);let p=require("node:os");p=e.a(p,1);let m=require("node:path");m=e.a(m,1);let h=require("node:process");h=e.a(h,1);let g=require("node:fs/promises");g=e.a(g,1);let _=require("node:url");_=e.a(_,1);let v=require("node:buffer"),y=require("node:timers/promises"),ee=require("stream");ee=e.a(ee,1);let b=require("fs/promises");b=e.a(b,1);let te=require("readline");te=e.a(te,1);const ne=e=>e instanceof URL?(0,_.fileURLToPath)(e):e;async function re(e,{cwd:t=h.default.cwd(),type:n=`file`,stopAt:r}={}){let i=m.default.resolve(ne(t)??``),{root:a}=m.default.parse(i);r=m.default.resolve(i,ne(r??a));let o=m.default.isAbsolute(e);for(;i;){let t=o?e:m.default.join(i,e);try{let e=await g.default.stat(t);if(n===`file`&&e.isFile()||n===`directory`&&e.isDirectory())return t}catch{}if(i===r||i===a)break;i=m.default.dirname(i)}}var ie=n.t();const ae=({oneBased:e,oneBasedLine:t=e,oneBasedColumn:n=e}={})=>[+!!t,+!!n];function oe(e,t,n){let r=t===0?-1:e.lastIndexOf(`
`,t-1),[i,a]=ae(n);return{line:r===-1?i:e.slice(0,r+1).match(/\n/g).length+i,column:t-r-1+a}}function se(e,t,n){if(typeof e!=`string`)throw TypeError(`Text parameter should be a string`);if(!Number.isInteger(t))throw TypeError(`Index parameter should be an integer`);if(t<0||t>e.length)throw RangeError(`Index out of bounds`);return oe(e,t,n)}const ce=e=>`\\u{${e.codePointAt(0).toString(16)}}`;var le=class e extends Error{name=`JSONError`;fileName;#e;#t;#n;#r;#i;constructor(t){if(typeof t==`string`)super(),this.#n=t;else{let{jsonParseError:e,fileName:n,input:r}=t;super(void 0,{cause:e}),this.#e=r,this.#t=e,this.fileName=n}Error.captureStackTrace?.(this,e)}get message(){this.#n??=`${de(this.#t.message)}${this.#e===``?` while parsing empty string`:``}`;let{codeFrame:e}=this;return`${this.#n}${this.fileName?` in ${this.fileName}`:``}${e?`\n\n${e}\n`:``}`}set message(e){this.#n=e}#a(e){if(!this.#t)return;let t=this.#e,n=ue(t,this.#t.message);if(n)return(0,ie.codeFrameColumns)(t,{start:n},{highlightCode:e})}get codeFrame(){return this.#r??=this.#a(!0),this.#r}get rawCodeFrame(){return this.#i??=this.#a(!1),this.#i}};const ue=(e,t)=>{let n=t.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!n)return;let{index:r,line:i,column:a}=n.groups;return i&&a?{line:Number(i),column:Number(a)}:se(e,Number(r),{oneBased:!0})},de=e=>e.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,t,n)=>`"${n}"(${ce(n)})`);function fe(e,t,n){typeof t==`string`&&(n=t,t=void 0);try{return JSON.parse(e,t)}catch(t){throw new le({jsonParseError:t,fileName:n,input:e})}}var pe=/* @__PURE__ */ e.t(((e,t)=>{t.exports=/* @__PURE__ */ `0BSD,3D-Slicer-1.0,AAL,ADSL,AFL-1.1,AFL-1.2,AFL-2.0,AFL-2.1,AFL-3.0,AGPL-1.0-only,AGPL-1.0-or-later,AGPL-3.0-only,AGPL-3.0-or-later,ALGLIB-Documentation,AMD-newlib,AMDPLPA,AML,AML-glslang,AMPAS,ANTLR-PD,ANTLR-PD-fallback,APAFML,APL-1.0,APSL-1.0,APSL-1.1,APSL-1.2,APSL-2.0,ASWF-Digital-Assets-1.0,ASWF-Digital-Assets-1.1,Abstyles,AdaCore-doc,Adobe-2006,Adobe-Display-PostScript,Adobe-Glyph,Adobe-Utopia,Advanced-Cryptics-Dictionary,Afmparse,Aladdin,Apache-1.0,Apache-1.1,Apache-2.0,App-s2p,Arphic-1999,Artistic-1.0,Artistic-1.0-Perl,Artistic-1.0-cl8,Artistic-2.0,Artistic-dist,Aspell-RU,BOLA-1.1,BSD-1-Clause,BSD-2-Clause,BSD-2-Clause-Darwin,BSD-2-Clause-Patent,BSD-2-Clause-Views,BSD-2-Clause-first-lines,BSD-2-Clause-pkgconf-disclaimer,BSD-3-Clause,BSD-3-Clause-Attribution,BSD-3-Clause-Clear,BSD-3-Clause-HP,BSD-3-Clause-LBNL,BSD-3-Clause-Modification,BSD-3-Clause-No-Military-License,BSD-3-Clause-No-Nuclear-License,BSD-3-Clause-No-Nuclear-License-2014,BSD-3-Clause-No-Nuclear-Warranty,BSD-3-Clause-Open-MPI,BSD-3-Clause-Sun,BSD-3-Clause-Tso,BSD-3-Clause-acpica,BSD-3-Clause-flex,BSD-4-Clause,BSD-4-Clause-Shortened,BSD-4-Clause-UC,BSD-4.3RENO,BSD-4.3TAHOE,BSD-Advertising-Acknowledgement,BSD-Attribution-HPND-disclaimer,BSD-Inferno-Nettverk,BSD-Mark-Modifications,BSD-Protection,BSD-Source-Code,BSD-Source-beginning-file,BSD-Systemics,BSD-Systemics-W3Works,BSL-1.0,BUSL-1.1,Baekmuk,Bahyph,Barr,Beerware,BitTorrent-1.0,BitTorrent-1.1,Bitstream-Charter,Bitstream-Vera,BlueOak-1.0.0,Boehm-GC,Boehm-GC-without-fee,Borceux,Brian-Gladman-2-Clause,Brian-Gladman-3-Clause,Buddy,C-UDA-1.0,CAL-1.0,CAL-1.0-Combined-Work-Exception,CAPEC-tou,CATOSL-1.1,CC-BY-1.0,CC-BY-2.0,CC-BY-2.5,CC-BY-2.5-AU,CC-BY-3.0,CC-BY-3.0-AT,CC-BY-3.0-AU,CC-BY-3.0-DE,CC-BY-3.0-IGO,CC-BY-3.0-NL,CC-BY-3.0-US,CC-BY-4.0,CC-BY-NC-1.0,CC-BY-NC-2.0,CC-BY-NC-2.5,CC-BY-NC-3.0,CC-BY-NC-3.0-DE,CC-BY-NC-4.0,CC-BY-NC-ND-1.0,CC-BY-NC-ND-2.0,CC-BY-NC-ND-2.5,CC-BY-NC-ND-3.0,CC-BY-NC-ND-3.0-DE,CC-BY-NC-ND-3.0-IGO,CC-BY-NC-ND-4.0,CC-BY-NC-SA-1.0,CC-BY-NC-SA-2.0,CC-BY-NC-SA-2.0-DE,CC-BY-NC-SA-2.0-FR,CC-BY-NC-SA-2.0-UK,CC-BY-NC-SA-2.5,CC-BY-NC-SA-3.0,CC-BY-NC-SA-3.0-DE,CC-BY-NC-SA-3.0-IGO,CC-BY-NC-SA-4.0,CC-BY-ND-1.0,CC-BY-ND-2.0,CC-BY-ND-2.5,CC-BY-ND-3.0,CC-BY-ND-3.0-DE,CC-BY-ND-4.0,CC-BY-SA-1.0,CC-BY-SA-2.0,CC-BY-SA-2.0-UK,CC-BY-SA-2.1-JP,CC-BY-SA-2.5,CC-BY-SA-3.0,CC-BY-SA-3.0-AT,CC-BY-SA-3.0-DE,CC-BY-SA-3.0-IGO,CC-BY-SA-4.0,CC-PDDC,CC-PDM-1.0,CC-SA-1.0,CC0-1.0,CDDL-1.0,CDDL-1.1,CDL-1.0,CDLA-Permissive-1.0,CDLA-Permissive-2.0,CDLA-Sharing-1.0,CECILL-1.0,CECILL-1.1,CECILL-2.0,CECILL-2.1,CECILL-B,CECILL-C,CERN-OHL-1.1,CERN-OHL-1.2,CERN-OHL-P-2.0,CERN-OHL-S-2.0,CERN-OHL-W-2.0,CFITSIO,CMU-Mach,CMU-Mach-nodoc,CNRI-Jython,CNRI-Python,CNRI-Python-GPL-Compatible,COIL-1.0,CPAL-1.0,CPL-1.0,CPOL-1.02,CUA-OPL-1.0,Caldera,Caldera-no-preamble,Catharon,ClArtistic,Clips,Community-Spec-1.0,Condor-1.1,Cornell-Lossless-JPEG,Cronyx,Crossword,CryptoSwift,CrystalStacker,Cube,D-FSL-1.0,DEC-3-Clause,DL-DE-BY-2.0,DL-DE-ZERO-2.0,DOC,DRL-1.0,DRL-1.1,DSDP,DocBook-DTD,DocBook-Schema,DocBook-Stylesheet,DocBook-XML,Dotseqn,ECL-1.0,ECL-2.0,EFL-1.0,EFL-2.0,EPICS,EPL-1.0,EPL-2.0,ESA-PL-permissive-2.4,ESA-PL-strong-copyleft-2.4,ESA-PL-weak-copyleft-2.4,EUDatagrid,EUPL-1.0,EUPL-1.1,EUPL-1.2,Elastic-2.0,Entessa,ErlPL-1.1,Eurosym,FBM,FDK-AAC,FSFAP,FSFAP-no-warranty-disclaimer,FSFUL,FSFULLR,FSFULLRSD,FSFULLRWD,FSL-1.1-ALv2,FSL-1.1-MIT,FTL,Fair,Ferguson-Twofish,Frameworx-1.0,FreeBSD-DOC,FreeImage,Furuseth,GCR-docs,GD,GFDL-1.1-invariants-only,GFDL-1.1-invariants-or-later,GFDL-1.1-no-invariants-only,GFDL-1.1-no-invariants-or-later,GFDL-1.1-only,GFDL-1.1-or-later,GFDL-1.2-invariants-only,GFDL-1.2-invariants-or-later,GFDL-1.2-no-invariants-only,GFDL-1.2-no-invariants-or-later,GFDL-1.2-only,GFDL-1.2-or-later,GFDL-1.3-invariants-only,GFDL-1.3-invariants-or-later,GFDL-1.3-no-invariants-only,GFDL-1.3-no-invariants-or-later,GFDL-1.3-only,GFDL-1.3-or-later,GL2PS,GLWTPL,GPL-1.0-only,GPL-1.0-or-later,GPL-2.0-only,GPL-2.0-or-later,GPL-3.0-only,GPL-3.0-or-later,Game-Programming-Gems,Giftware,Glide,Glulxe,Graphics-Gems,Gutmann,HDF5,HIDAPI,HP-1986,HP-1989,HPND,HPND-DEC,HPND-Fenneberg-Livingston,HPND-INRIA-IMAG,HPND-Intel,HPND-Kevlin-Henney,HPND-MIT-disclaimer,HPND-Markus-Kuhn,HPND-Netrek,HPND-Pbmplus,HPND-SMC,HPND-UC,HPND-UC-export-US,HPND-doc,HPND-doc-sell,HPND-export-US,HPND-export-US-acknowledgement,HPND-export-US-modify,HPND-export2-US,HPND-merchantability-variant,HPND-sell-MIT-disclaimer-xserver,HPND-sell-regexpr,HPND-sell-variant,HPND-sell-variant-MIT-disclaimer,HPND-sell-variant-MIT-disclaimer-rev,HPND-sell-variant-critical-systems,HTMLTIDY,HaskellReport,Hippocratic-2.1,IBM-pibs,ICU,IEC-Code-Components-EULA,IJG,IJG-short,IPA,IPL-1.0,ISC,ISC-Veillard,ISO-permission,ImageMagick,Imlib2,Info-ZIP,Inner-Net-2.0,InnoSetup,Intel,Intel-ACPI,Interbase-1.0,JPL-image,JPNIC,JSON,Jam,JasPer-2.0,Kastrup,Kazlib,Knuth-CTAN,LAL-1.2,LAL-1.3,LGPL-2.0-only,LGPL-2.0-or-later,LGPL-2.1-only,LGPL-2.1-or-later,LGPL-3.0-only,LGPL-3.0-or-later,LGPLLR,LOOP,LPD-document,LPL-1.0,LPL-1.02,LPPL-1.0,LPPL-1.1,LPPL-1.2,LPPL-1.3a,LPPL-1.3c,LZMA-SDK-9.11-to-9.20,LZMA-SDK-9.22,Latex2e,Latex2e-translated-notice,Leptonica,LiLiQ-P-1.1,LiLiQ-R-1.1,LiLiQ-Rplus-1.1,Libpng,Linux-OpenIB,Linux-man-pages-1-para,Linux-man-pages-copyleft,Linux-man-pages-copyleft-2-para,Linux-man-pages-copyleft-var,Lucida-Bitmap-Fonts,MIPS,MIT,MIT-0,MIT-CMU,MIT-Click,MIT-Festival,MIT-Khronos-old,MIT-Modern-Variant,MIT-STK,MIT-Wu,MIT-advertising,MIT-enna,MIT-feh,MIT-open-group,MIT-testregex,MITNFA,MMIXware,MMPL-1.0.1,MPEG-SSG,MPL-1.0,MPL-1.1,MPL-2.0,MPL-2.0-no-copyleft-exception,MS-LPL,MS-PL,MS-RL,MTLL,Mackerras-3-Clause,Mackerras-3-Clause-acknowledgment,MakeIndex,Martin-Birgmeier,McPhee-slideshow,Minpack,MirOS,Motosoto,MulanPSL-1.0,MulanPSL-2.0,Multics,Mup,NAIST-2003,NASA-1.3,NBPL-1.0,NCBI-PD,NCGL-UK-2.0,NCL,NCSA,NGPL,NICTA-1.0,NIST-PD,NIST-PD-TNT,NIST-PD-fallback,NIST-Software,NLOD-1.0,NLOD-2.0,NLPL,NOSL,NPL-1.0,NPL-1.1,NPOSL-3.0,NRL,NTIA-PD,NTP,NTP-0,Naumen,NetCDF,Newsletr,Nokia,Noweb,O-UDA-1.0,OAR,OCCT-PL,OCLC-2.0,ODC-By-1.0,ODbL-1.0,OFFIS,OFL-1.0,OFL-1.0-RFN,OFL-1.0-no-RFN,OFL-1.1,OFL-1.1-RFN,OFL-1.1-no-RFN,OGC-1.0,OGDL-Taiwan-1.0,OGL-Canada-2.0,OGL-UK-1.0,OGL-UK-2.0,OGL-UK-3.0,OGTSL,OLDAP-1.1,OLDAP-1.2,OLDAP-1.3,OLDAP-1.4,OLDAP-2.0,OLDAP-2.0.1,OLDAP-2.1,OLDAP-2.2,OLDAP-2.2.1,OLDAP-2.2.2,OLDAP-2.3,OLDAP-2.4,OLDAP-2.5,OLDAP-2.6,OLDAP-2.7,OLDAP-2.8,OLFL-1.3,OML,OPL-1.0,OPL-UK-3.0,OPUBL-1.0,OSC-1.0,OSET-PL-2.1,OSL-1.0,OSL-1.1,OSL-2.0,OSL-2.1,OSL-3.0,OSSP,OpenMDW-1.0,OpenPBS-2.3,OpenSSL,OpenSSL-standalone,OpenVision,PADL,PDDL-1.0,PHP-3.0,PHP-3.01,PPL,PSF-2.0,ParaType-Free-Font-1.3,Parity-6.0.0,Parity-7.0.0,Pixar,Plexus,PolyForm-Noncommercial-1.0.0,PolyForm-Small-Business-1.0.0,PostgreSQL,Python-2.0,Python-2.0.1,QPL-1.0,QPL-1.0-INRIA-2004,Qhull,RHeCos-1.1,RPL-1.1,RPL-1.5,RPSL-1.0,RSA-MD,RSCPL,Rdisc,Ruby,Ruby-pty,SAX-PD,SAX-PD-2.0,SCEA,SGI-B-1.0,SGI-B-1.1,SGI-B-2.0,SGI-OpenGL,SGMLUG-PM,SGP4,SHL-0.5,SHL-0.51,SISSL,SISSL-1.2,SL,SMAIL-GPL,SMLNJ,SMPPL,SNIA,SOFA,SPL-1.0,SSH-OpenSSH,SSH-short,SSLeay-standalone,SSPL-1.0,SUL-1.0,SWL,Saxpath,SchemeReport,Sendmail,Sendmail-8.23,Sendmail-Open-Source-1.1,SimPL-2.0,Sleepycat,Soundex,Spencer-86,Spencer-94,Spencer-99,SugarCRM-1.1.3,Sun-PPP,Sun-PPP-2000,SunPro,Symlinks,TAPR-OHL-1.0,TCL,TCP-wrappers,TGPPL-1.0,TMate,TORQUE-1.1,TOSL,TPDL,TPL-1.0,TTWL,TTYP0,TU-Berlin-1.0,TU-Berlin-2.0,TekHVC,TermReadKey,ThirdEye,TrustedQSL,UCAR,UCL-1.0,UMich-Merit,UPL-1.0,URT-RLE,Ubuntu-font-1.0,UnRAR,Unicode-3.0,Unicode-DFS-2015,Unicode-DFS-2016,Unicode-TOU,UnixCrypt,Unlicense,Unlicense-libtelnet,Unlicense-libwhirlpool,VOSTROM,VSL-1.0,Vim,Vixie-Cron,W3C,W3C-19980720,W3C-20150513,WTFNMFPL,WTFPL,Watcom-1.0,Widget-Workshop,WordNet,Wsuipa,X11,X11-distribute-modifications-variant,X11-no-permit-persons,X11-swapped,XFree86-1.1,XSkat,Xdebug-1.03,Xerox,Xfig,Xnet,YPL-1.0,YPL-1.1,ZPL-1.1,ZPL-2.0,ZPL-2.1,Zed,Zeeff,Zend-2.0,Zimbra-1.3,Zimbra-1.4,Zlib,any-OSI,any-OSI-perl-modules,bcrypt-Solar-Designer,blessing,bzip2-1.0.6,check-cvs,checkmk,copyleft-next-0.3.0,copyleft-next-0.3.1,curl,cve-tou,diffmark,dtoa,dvipdfm,eGenix,etalab-2.0,fwlw,gSOAP-1.3b,generic-xts,gnuplot,gtkbook,hdparm,hyphen-bulgarian,iMatix,jove,libpng-1.6.35,libpng-2.0,libselinux-1.0,libtiff,libutil-David-Nugent,lsof,magaz,mailprio,man2html,metamail,mpi-permissive,mpich2,mplus,ngrep,pkgconf,pnmstitch,psfrag,psutils,python-ldap,radvd,snprintf,softSurfer,ssh-keyscan,swrule,threeparttable,ulem,w3m,wwl,xinetd,xkeyboard-config-Zinoviev,xlock,xpp,xzoom,zlib-acknowledgement`.split(`,`)})),me=/* @__PURE__ */ e.t(((e,t)=>{t.exports=/* @__PURE__ */ `AGPL-1.0,AGPL-3.0,BSD-2-Clause-FreeBSD,BSD-2-Clause-NetBSD,GFDL-1.1,GFDL-1.2,GFDL-1.3,GPL-1.0,GPL-2.0,GPL-2.0-with-GCC-exception,GPL-2.0-with-autoconf-exception,GPL-2.0-with-bison-exception,GPL-2.0-with-classpath-exception,GPL-2.0-with-font-exception,GPL-3.0,GPL-3.0-with-GCC-exception,GPL-3.0-with-autoconf-exception,LGPL-2.0,LGPL-2.1,LGPL-3.0,Net-SNMP,Nunit,StandardML-NJ,bzip2-1.0.5,eCos-2.0,wxWindows`.split(`,`)})),he=/* @__PURE__ */ e.t(((e,t)=>{t.exports=/* @__PURE__ */ `389-exception,Asterisk-exception,Autoconf-exception-2.0,Autoconf-exception-3.0,Autoconf-exception-generic,Autoconf-exception-generic-3.0,Autoconf-exception-macro,Bison-exception-1.24,Bison-exception-2.2,Bootloader-exception,Classpath-exception-2.0,CLISP-exception-2.0,cryptsetup-OpenSSL-exception,DigiRule-FOSS-exception,eCos-exception-2.0,Fawkes-Runtime-exception,FLTK-exception,fmt-exception,Font-exception-2.0,freertos-exception-2.0,GCC-exception-2.0,GCC-exception-2.0-note,GCC-exception-3.1,Gmsh-exception,GNAT-exception,GNOME-examples-exception,GNU-compiler-exception,gnu-javamail-exception,GPL-3.0-interface-exception,GPL-3.0-linking-exception,GPL-3.0-linking-source-exception,GPL-CC-1.0,GStreamer-exception-2005,GStreamer-exception-2008,i2p-gpl-java-exception,KiCad-libraries-exception,LGPL-3.0-linking-exception,libpri-OpenH323-exception,Libtool-exception,Linux-syscall-note,LLGPL,LLVM-exception,LZMA-exception,mif-exception,OCaml-LGPL-linking-exception,OCCT-exception-1.0,OpenJDK-assembly-exception-1.0,openvpn-openssl-exception,PS-or-PDF-font-exception-20170817,QPL-1.0-INRIA-2004-exception,Qt-GPL-exception-1.0,Qt-LGPL-exception-1.1,Qwt-exception-1.0,SANE-exception,SHL-2.0,SHL-2.1,stunnel-exception,SWI-exception,Swift-exception,Texinfo-exception,u-boot-exception-2.0,UBDL-exception,Universal-FOSS-exception-1.0,vsftpd-openssl-exception,WxWindows-exception-3.1,x11vnc-openssl-exception`.split(`,`)})),ge=/* @__PURE__ */ e.t(((e,t)=>{var n=[].concat(pe(),me()),r=he();t.exports=function(e){var t=0;function i(){return t<e.length}function a(n){if(n instanceof RegExp){var r=e.slice(t).match(n);if(r)return t+=r[0].length,r[0]}else if(e.indexOf(n,t)===t)return t+=n.length,n}function o(){a(/[ ]*/)}function s(){for(var n,r=[`WITH`,`AND`,`OR`,`(`,`)`,`:`,`+`],i=0;i<r.length&&(n=a(r[i]),!n);i++);if(n===`+`&&t>1&&e[t-2]===` `)throw Error("Space before `+`");return n&&{type:`OPERATOR`,string:n}}function c(){return a(/[A-Za-z0-9-.]+/)}function l(){var e=c();if(!e)throw Error(`Expected idstring at offset `+t);return e}function u(){if(a(`DocumentRef-`))return{type:`DOCUMENTREF`,string:l()}}function d(){if(a(`LicenseRef-`))return{type:`LICENSEREF`,string:l()}}function f(){var e=t,i=c();if(n.indexOf(i)!==-1)return{type:`LICENSE`,string:i};if(r.indexOf(i)!==-1)return{type:`EXCEPTION`,string:i};t=e}function p(){return s()||u()||d()||f()}for(var m=[];i()&&(o(),i());){var h=p();if(!h)throw Error("Unexpected `"+e[t]+"` at offset "+t);m.push(h)}return m}})),_e=/* @__PURE__ */ e.t(((e,t)=>{t.exports=function(e){var t=0;function n(){return t<e.length}function r(){return n()?e[t]:null}function i(){if(!n())throw Error();t++}function a(e){var t=r();if(t&&t.type===`OPERATOR`&&e===t.string)return i(),t.string}function o(){if(a(`WITH`)){var e=r();if(e&&e.type===`EXCEPTION`)return i(),e.string;throw Error("Expected exception after `WITH`")}}function s(){var e=t,n=``,o=r();if(o.type===`DOCUMENTREF`&&(i(),n+=`DocumentRef-`+o.string+`:`,!a(`:`)))throw Error("Expected `:` after `DocumentRef-...`");if(o=r(),o.type===`LICENSEREF`)return i(),n+=`LicenseRef-`+o.string,{license:n};t=e}function c(){var e=r();if(e&&e.type===`LICENSE`){i();var t={license:e.string};a(`+`)&&(t.plus=!0);var n=o();return n&&(t.exception=n),t}}function l(){if(a(`(`)){var e=f();if(!a(`)`))throw Error("Expected `)`");return e}}function u(){return l()||s()||c()}function d(e,t){return function n(){var r=t();if(r){if(!a(e))return r;var i=n();if(!i)throw Error(`Expected expression`);return{left:r,conjunction:e.toLowerCase(),right:i}}}}var f=d(`OR`,d(`AND`,u)),p=f();if(!p||n())throw Error(`Syntax error`);return p}})),ve=/* @__PURE__ */ e.t(((e,t)=>{var n=ge(),r=_e();t.exports=function(e){return r(n(e))}})),ye=/* @__PURE__ */ e.t(((e,t)=>{var n=ve(),r=pe();function i(e){try{return n(e),!0}catch{return!1}}function a(e,t){var n=t[0].length-e[0].length;return n===0?e[0].toUpperCase().localeCompare(t[0].toUpperCase()):n}var o=[[`APGL`,`AGPL`],[`Gpl`,`GPL`],[`GLP`,`GPL`],[`APL`,`Apache`],[`ISD`,`ISC`],[`GLP`,`GPL`],[`IST`,`ISC`],[`Claude`,`Clause`],[` or later`,`+`],[` International`,``],[`GNU`,`GPL`],[`GUN`,`GPL`],[`+`,``],[`GNU GPL`,`GPL`],[`GNU LGPL`,`LGPL`],[`GNU/GPL`,`GPL`],[`GNU GLP`,`GPL`],[`GNU LESSER GENERAL PUBLIC LICENSE`,`LGPL`],[`GNU Lesser General Public License`,`LGPL`],[`GNU LESSER GENERAL PUBLIC LICENSE`,`LGPL-2.1`],[`GNU Lesser General Public License`,`LGPL-2.1`],[`LESSER GENERAL PUBLIC LICENSE`,`LGPL`],[`Lesser General Public License`,`LGPL`],[`LESSER GENERAL PUBLIC LICENSE`,`LGPL-2.1`],[`Lesser General Public License`,`LGPL-2.1`],[`GNU General Public License`,`GPL`],[`Gnu public license`,`GPL`],[`GNU Public License`,`GPL`],[`GNU GENERAL PUBLIC LICENSE`,`GPL`],[`MTI`,`MIT`],[`Mozilla Public License`,`MPL`],[`Universal Permissive License`,`UPL`],[`WTH`,`WTF`],[`WTFGPL`,`WTFPL`],[`-License`,``]].sort(a),s=0,c=1,l=[function(e){return e.toUpperCase()},function(e){return e.trim()},function(e){return e.replace(/\./g,``)},function(e){return e.replace(/\s+/g,``)},function(e){return e.replace(/\s+/g,`-`)},function(e){return e.replace(`v`,`-`)},function(e){return e.replace(/,?\s*(\d)/,`-$1`)},function(e){return e.replace(/,?\s*(\d)/,`-$1.0`)},function(e){return e.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,`-$2`)},function(e){return e.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,`-$2.0`)},function(e){return e[0].toUpperCase()+e.slice(1)},function(e){return e.replace(`/`,`-`)},function(e){return e.replace(/\s*V\s*(\d)/,`-$1`).replace(/(\d)$/,`$1.0`)},function(e){return e.indexOf(`3.0`)===-1?e+`-only`:e+`-or-later`},function(e){return e+`only`},function(e){return e.replace(/(\d)$/,`-$1.0`)},function(e){return e.replace(/(-| )?(\d)$/,`-$2-Clause`)},function(e){return e.replace(/(-| )clause(-| )(\d)/,`-$3-Clause`)},function(e){return e.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i,`BSD-3-Clause`)},function(e){return e.replace(/\bSimplified(-| )?BSD((-| )License)?/i,`BSD-2-Clause`)},function(e){return e.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i,`BSD-2-Clause-$1BSD`)},function(e){return e.replace(/\bClear(-| )?BSD((-| )License)?/i,`BSD-3-Clause-Clear`)},function(e){return e.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i,`BSD-4-Clause`)},function(e){return`CC-`+e},function(e){return`CC-`+e+`-4.0`},function(e){return e.replace(`Attribution`,`BY`).replace(`NonCommercial`,`NC`).replace(`NoDerivatives`,`ND`).replace(/ (\d)/,`-$1`).replace(/ ?International/,``)},function(e){return`CC-`+e.replace(`Attribution`,`BY`).replace(`NonCommercial`,`NC`).replace(`NoDerivatives`,`ND`).replace(/ (\d)/,`-$1`).replace(/ ?International/,``)+`-4.0`}],u=r.map(function(e){var t=/^(.*)-\d+\.\d+$/.exec(e);return t?[t[0],t[1]]:[e,null]}).reduce(function(e,t){var n=t[1];return e[n]=e[n]||[],e[n].push(t[0]),e},{}),d=Object.keys(u).map(function(e){return[e,u[e]]}).filter(function(e){return e[1].length===1&&e[0]!==null&&e[0]!==`APL`}).map(function(e){return[e[0],e[1][0]]});u=void 0;var f=[[`UNLI`,`Unlicense`],[`WTF`,`WTFPL`],[`2 CLAUSE`,`BSD-2-Clause`],[`2-CLAUSE`,`BSD-2-Clause`],[`3 CLAUSE`,`BSD-3-Clause`],[`3-CLAUSE`,`BSD-3-Clause`],[`AFFERO`,`AGPL-3.0-or-later`],[`AGPL`,`AGPL-3.0-or-later`],[`APACHE`,`Apache-2.0`],[`ARTISTIC`,`Artistic-2.0`],[`Affero`,`AGPL-3.0-or-later`],[`BEER`,`Beerware`],[`BOOST`,`BSL-1.0`],[`BSD`,`BSD-2-Clause`],[`CDDL`,`CDDL-1.1`],[`ECLIPSE`,`EPL-1.0`],[`FUCK`,`WTFPL`],[`GNU`,`GPL-3.0-or-later`],[`LGPL`,`LGPL-3.0-or-later`],[`GPLV1`,`GPL-1.0-only`],[`GPL-1`,`GPL-1.0-only`],[`GPLV2`,`GPL-2.0-only`],[`GPL-2`,`GPL-2.0-only`],[`GPL`,`GPL-3.0-or-later`],[`MIT +NO-FALSE-ATTRIBS`,`MITNFA`],[`MIT`,`MIT`],[`MPL`,`MPL-2.0`],[`X11`,`X11`],[`ZLIB`,`Zlib`]].concat(d).sort(a),p=0,m=1,h=function(e){for(var t=0;t<l.length;t++){var n=l[t](e).trim();if(n!==e&&i(n))return n}return null},g=function(e){for(var t=e.toUpperCase(),n=0;n<f.length;n++){var r=f[n];if(t.indexOf(r[p])>-1)return r[m]}return null},_=function(e,t){for(var n=0;n<o.length;n++){var r=o[n],i=r[s];if(e.indexOf(i)>-1){var a=t(e.replace(i,r[c]));if(a!==null)return a}}return null};t.exports=function(e,t){t||={};var n=t.upgrade===void 0||!!t.upgrade;function r(e){return n?v(e):e}if(typeof e!=`string`||e.trim().length===0)throw Error(`Invalid argument. Expected non-empty string.`);if(e=e.trim(),i(e))return r(e);var a=e.replace(/\+$/,``).trim();if(i(a))return r(a);var o=h(e);return o!==null||(o=_(e,function(e){return i(e)?e:h(e)}),o!==null)||(o=g(e),o!==null)||(o=_(e,g),o!==null)?r(o):null};function v(e){return[`GPL-1.0`,`LGPL-1.0`,`AGPL-1.0`,`GPL-2.0`,`LGPL-2.0`,`AGPL-2.0`,`LGPL-2.1`].indexOf(e)===-1?[`GPL-1.0+`,`GPL-2.0+`,`GPL-3.0+`,`LGPL-2.0+`,`LGPL-2.1+`,`LGPL-3.0+`,`AGPL-1.0+`,`AGPL-3.0+`].indexOf(e)===-1?[`GPL-3.0`,`LGPL-3.0`,`AGPL-3.0`].indexOf(e)===-1?e:e+`-or-later`:e.replace(/\+$/,`-or-later`):e+`-only`}})),be=/* @__PURE__ */ e.t(((e,t)=>{var n=ve(),r=ye(),i=`license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"`,a=/^SEE LICEN[CS]E IN (.+)$/;function o(e,t){return t.slice(0,e.length)===e}function s(e){if(e.hasOwnProperty(`license`)){var t=e.license;return o(`LicenseRef`,t)||o(`DocumentRef`,t)}return s(e.left)||s(e.right)}t.exports=function(e){var t;try{t=n(e)}catch{var o;if(e===`UNLICENSED`||e===`UNLICENCED`)return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(o=a.exec(e))return{validForOldPackages:!0,validForNewPackages:!0,inFile:o[1]};var c={validForOldPackages:!1,validForNewPackages:!1,warnings:[i]};if(e.trim().length!==0){var l=r(e);l&&c.warnings.push(`license is similar to the valid expression "`+l+`"`)}return c}return s(t)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[i]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}}})),xe=/* @__PURE__ */ e.t((e=>{var t=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),n=t(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tracing=e.metrics=void 0;var t=require("node:diagnostics_channel");e.metrics=(0,t.channel)(`lru-cache:metrics`),e.tracing=(0,t.tracingChannel)(`lru-cache`)}),r=t(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.defaultPerf=void 0,e.defaultPerf=typeof performance==`object`&&performance&&typeof performance.now==`function`?performance:Date});Object.defineProperty(e,"__esModule",{value:!0}),e.LRUCache=void 0;var i=n(),a=r(),o=()=>i.metrics.hasSubscribers||i.tracing.hasSubscribers,s=/* @__PURE__ */ new Set,c=typeof process==`object`&&process?process:{},l=(e,t,n,r)=>{typeof c.emitWarning==`function`?c.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)},u=e=>!s.has(e),d=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),f=e=>d(e)?e<=256?Uint8Array:e<=2**16?Uint16Array:e<=2**32?Uint32Array:e<=2**53-1?p:null:null,p=class extends Array{constructor(e){super(e),this.fill(0)}},m=class e{heap;length;static#e=!1;static create(t){let n=f(t);if(!n)return[];e.#e=!0;let r=new e(t,n);return e.#e=!1,r}constructor(t,n){if(!e.#e)throw TypeError(`instantiate Stack using Stack.create(n)`);this.heap=new n(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}};e.LRUCache=class e{#e;#t;#n;#r;#i;#a;#o;#s;get perf(){return this.#s}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;#x;#S;#C;#w;#T;#E;static unsafeExposeInternals(e){return{starts:e.#b,ttls:e.#x,autopurgeTimers:e.#S,sizes:e.#y,keyMap:e.#u,keyList:e.#d,valList:e.#f,next:e.#p,prev:e.#m,get head(){return e.#h},get tail(){return e.#g},free:e.#_,isBackgroundFetch:t=>e.#W(t),backgroundFetch:(t,n,r,i)=>e.#U(t,n,r,i),moveToTail:t=>e.#X(t),indexes:t=>e.#I(t),rindexes:t=>e.#L(t),isStale:t=>e.#j(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#l}get size(){return this.#c}get fetchMethod(){return this.#a}get memoMethod(){return this.#o}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#i}constructor(t){let{max:n=0,ttl:r,ttlResolution:i=1,ttlAutopurge:o,updateAgeOnGet:c,updateAgeOnHas:p,allowStale:h,dispose:g,onInsert:_,disposeAfter:v,noDisposeOnSet:y,noUpdateTTL:ee,maxSize:b=0,maxEntrySize:te=0,sizeCalculation:ne,fetchMethod:re,memoMethod:ie,noDeleteOnFetchRejection:ae,noDeleteOnStaleGet:oe,allowStaleOnFetchRejection:se,allowStaleOnFetchAbort:ce,ignoreFetchAbort:le,backgroundFetchSize:ue=1,perf:de}=t;if(this.backgroundFetchSize=ue,de!==void 0&&typeof de?.now!=`function`)throw TypeError(`perf option must have a now() method if specified`);if(this.#s=de??a.defaultPerf,n!==0&&!d(n))throw TypeError(`max option must be a nonnegative integer`);let fe=n?f(n):Array;if(!fe)throw Error(`invalid max value: `+n);if(this.#e=n,this.#t=b,this.maxEntrySize=te||this.#t,this.sizeCalculation=ne,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw TypeError(`cannot set sizeCalculation without setting maxSize or maxEntrySize`);if(typeof this.sizeCalculation!=`function`)throw TypeError(`sizeCalculation set to non-function`)}if(ie!==void 0&&typeof ie!=`function`)throw TypeError(`memoMethod must be a function if defined`);if(this.#o=ie,re!==void 0&&typeof re!=`function`)throw TypeError(`fetchMethod must be a function if specified`);if(this.#a=re,this.#w=!!re,this.#u=/* @__PURE__ */ new Map,this.#d=Array.from({length:n}).fill(void 0),this.#f=Array.from({length:n}).fill(void 0),this.#p=new fe(n),this.#m=new fe(n),this.#h=0,this.#g=0,this.#_=m.create(n),this.#c=0,this.#l=0,typeof g==`function`&&(this.#n=g),typeof _==`function`&&(this.#r=_),typeof v==`function`?(this.#i=v,this.#v=[]):(this.#i=void 0,this.#v=void 0),this.#C=!!this.#n,this.#E=!!this.#r,this.#T=!!this.#i,this.noDisposeOnSet=!!y,this.noUpdateTTL=!!ee,this.noDeleteOnFetchRejection=!!ae,this.allowStaleOnFetchRejection=!!se,this.allowStaleOnFetchAbort=!!ce,this.ignoreFetchAbort=!!le,this.maxEntrySize!==0){if(this.#t!==0&&!d(this.#t))throw TypeError(`maxSize must be a positive integer if specified`);if(!d(this.maxEntrySize))throw TypeError(`maxEntrySize must be a positive integer if specified`);this.#M()}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!oe,this.updateAgeOnGet=!!c,this.updateAgeOnHas=!!p,this.ttlResolution=d(i)||i===0?i:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!d(this.ttl))throw TypeError(`ttl must be a positive integer if specified`);this.#D()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw TypeError(`At least one of max, maxSize, or ttl is required`);if(!this.ttlAutopurge&&!this.#e&&!this.#t){let t=`LRU_CACHE_UNBOUNDED`;u(t)&&(s.add(t),l(`TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.`,`UnboundedCacheWarning`,t,e))}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#D(){let e=new p(this.#e),t=new p(this.#e);this.#x=e,this.#b=t;let n=this.ttlAutopurge?Array.from({length:this.#e}):void 0;this.#S=n,this.#A=(n,i,a=this.#s.now())=>{t[n]=i===0?0:a,e[n]=i,r(n,i)},this.#O=n=>{t[n]=e[n]===0?0:this.#s.now(),r(n,e[n])};let r=this.ttlAutopurge?(e,t)=>{if(n?.[e]&&(clearTimeout(n[e]),n[e]=void 0),t&&t!==0&&n){let i=setTimeout(()=>{this.#j(e)?(this.#Z(this.#d[e],`expire`),n[e]=void 0):r(e,o(e))},t+1);i.unref&&i.unref(),n[e]=i}}:()=>{};this.#k=(n,r)=>{if(e[r]){let o=e[r],s=t[r];if(!o||!s)return;n.ttl=o,n.start=s,n.now=i||a(),n.remainingTTL=o-(n.now-s)}};let i=0,a=()=>{let e=this.#s.now();if(this.ttlResolution>0){i=e;let t=setTimeout(()=>i=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=e=>{let t=this.#u.get(e);return t===void 0?0:o(t)};let o=n=>{let r=e[n],o=t[n];return!r||!o?1/0:r-((i||a())-o)};this.#j=n=>{let r=t[n],o=e[n];return!!o&&!!r&&(i||a())-r>o}}#O=()=>{};#k=()=>{};#A=()=>{};#j=()=>!1;#M(){let e=new p(this.#e);this.#l=0,this.#y=e,this.#N=t=>{this.#l-=e[t],e[t]=0},this.#F=(e,t,n,r)=>{if(!d(n)){if(this.#W(t))return this.backgroundFetchSize;if(r){if(typeof r!=`function`)throw TypeError(`sizeCalculation must be a function`);if(n=r(t,e),!d(n))throw TypeError(`sizeCalculation return invalid (expect positive integer)`)}else throw TypeError(`invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.`)}return n},this.#P=(t,n,r)=>{if(e[t]=n,this.#t){let n=this.#t-e[t];for(;this.#l>n;)this.#B(!0)}this.#l+=e[t],r&&(r.entrySize=n,r.totalCalculatedSize=this.#l)}}#N=e=>{};#P=(e,t,n)=>{};#F=(e,t,n,r)=>{if(n||r)throw TypeError(`cannot set size without setting maxSize or maxEntrySize on cache`);return 0};*#I({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#g;this.#R(t)&&((e||!this.#j(t))&&(yield t),t!==this.#h);)t=this.#m[t]}*#L({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#h;this.#R(t)&&((e||!this.#j(t))&&(yield t),t!==this.#g);)t=this.#p[t]}#R(e){return e!==void 0&&this.#u.get(this.#d[e])===e}*entries(){for(let e of this.#I())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#W(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*rentries(){for(let e of this.#L())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#W(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*keys(){for(let e of this.#I()){let t=this.#d[e];t!==void 0&&!this.#W(this.#f[e])&&(yield t)}}*rkeys(){for(let e of this.#L()){let t=this.#d[e];t!==void 0&&!this.#W(this.#f[e])&&(yield t)}}*values(){for(let e of this.#I())this.#f[e]!==void 0&&!this.#W(this.#f[e])&&(yield this.#f[e])}*rvalues(){for(let e of this.#L())this.#f[e]!==void 0&&!this.#W(this.#f[e])&&(yield this.#f[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]=`LRUCache`;find(e,t={}){for(let n of this.#I()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;if(i!==void 0&&e(i,this.#d[n],this))return this.#J(this.#d[n],t)}}forEach(e,t=this){for(let n of this.#I()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}rforEach(e,t=this){for(let n of this.#L()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}purgeStale(){let e=!1;for(let t of this.#L({allowStale:!0}))this.#j(t)&&(this.#Z(this.#d[t],`expire`),e=!0);return e}info(e){let t=this.#u.get(e);if(t===void 0)return;let n=this.#f[t],r=this.#W(n)?n.__staleWhileFetching:n;if(r===void 0)return;let i={value:r};if(this.#x&&this.#b){let e=this.#x[t],n=this.#b[t];e&&n&&(i.ttl=e-(this.#s.now()-n),i.start=Date.now())}return this.#y&&(i.size=this.#y[t]),i}dump(){let e=[];for(let t of this.#I({allowStale:!0})){let n=this.#d[t],r=this.#f[t],i=this.#W(r)?r.__staleWhileFetching:r;if(i===void 0||n===void 0)continue;let a={value:i};if(this.#x&&this.#b){a.ttl=this.#x[t];let e=this.#s.now()-this.#b[t];a.start=Math.floor(Date.now()-e)}this.#y&&(a.size=this.#y[t]),e.unshift([n,a])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let e=Date.now()-n.start;n.start=this.#s.now()-e}this.#z(t,n.value,n)}}set(e,t,n={}){let{status:r=i.metrics.hasSubscribers?{}:void 0}=n;n.status=r,r&&(r.op=`set`,r.key=e,t!==void 0&&(r.value=t),r.cache=this);let a=this.#z(e,t,n);return r&&i.metrics.hasSubscribers&&i.metrics.publish(r),a}#z(e,t,n,r){let{ttl:i=this.ttl,start:a,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:c}=n,l=this.#W(t);if(t===void 0)return c&&(c.set=`deleted`),this.delete(e),this;let{noUpdateTTL:u=this.noUpdateTTL}=n;c&&!l&&(c.value=t);let d=this.#F(e,t,n.size||0,s,c);if(this.maxEntrySize&&d>this.maxEntrySize)return this.#Z(e,`set`),c&&(c.set=`miss`,c.maxEntrySizeExceeded=!0),this;let f=this.#c===0?void 0:this.#u.get(e);if(f===void 0)f=this.#c===0?this.#g:this.#_.length===0?this.#c===this.#e?this.#B(!1):this.#c:this.#_.pop(),this.#d[f]=e,this.#f[f]=t,this.#u.set(e,f),this.#p[this.#g]=f,this.#m[f]=this.#g,this.#g=f,this.#c++,this.#P(f,d,c),c&&(c.set=`add`),u=!1,this.#E&&!l&&this.#r?.(t,e,`add`);else{this.#X(f);let n=this.#f[f];if(t!==n){if(!o){if(this.#W(n)){n!==r&&n.__abortController.abort(/* @__PURE__ */ Error(`replaced`));let{__staleWhileFetching:i}=n;i!==void 0&&i!==t&&(this.#C&&this.#n?.(i,e,`set`),this.#T&&this.#v?.push([i,e,`set`]))}else this.#C&&this.#n?.(n,e,`set`),this.#T&&this.#v?.push([n,e,`set`])}if(this.#N(f),this.#P(f,d,c),this.#f[f]=t,!l){let r=n&&this.#W(n)?n.__staleWhileFetching:n,i=r===void 0?`add`:t===r?`update`:`replace`;c&&(c.set=i,r!==void 0&&(c.oldValue=r)),this.#E&&this.onInsert?.(t,e,i)}}else l||(c&&(c.set=`update`),this.#E&&this.onInsert?.(t,e,`update`))}if(i!==0&&!this.#x&&this.#D(),this.#x&&(u||this.#A(f,i,a),c&&this.#k(c,f)),!o&&this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return this}pop(){try{for(;this.#c;){let e=this.#f[this.#h];if(this.#B(!0),this.#W(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}}#B(e){let t=this.#h,n=this.#d[t],r=this.#f[t],i=this.#W(r);i&&r.__abortController.abort(/* @__PURE__ */ Error(`evicted`));let a=i?r.__staleWhileFetching:r;return(this.#C||this.#T)&&a!==void 0&&(this.#C&&this.#n?.(a,n,`evict`),this.#T&&this.#v?.push([a,n,`evict`])),this.#N(t),this.#S?.[t]&&(clearTimeout(this.#S[t]),this.#S[t]=void 0),e&&(this.#d[t]=void 0,this.#f[t]=void 0,this.#_.push(t)),this.#c===1?(this.#h=this.#g=0,this.#_.length=0):this.#h=this.#p[t],this.#u.delete(n),this.#c--,t}has(e,t={}){let{status:n=i.metrics.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`has`,n.key=e,n.cache=this);let r=this.#V(e,t);return i.metrics.hasSubscribers&&i.metrics.publish(n),r}#V(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,i=this.#u.get(e);if(i!==void 0){let e=this.#f[i];if(this.#W(e)&&e.__staleWhileFetching===void 0)return!1;if(this.#j(i))r&&(r.has=`stale`,this.#k(r,i));else return n&&this.#O(i),r&&(r.has=`hit`,this.#k(r,i)),!0}else r&&(r.has=`miss`);return!1}peek(e,t={}){let{status:n=o()?{}:void 0}=t;n&&(n.op=`peek`,n.key=e,n.cache=this),t.status=n;let r=this.#H(e,t);return i.metrics.hasSubscribers&&i.metrics.publish(n),r}#H(e,t){let{status:n,allowStale:r=this.allowStale}=t,i=this.#u.get(e);if(i===void 0||!r&&this.#j(i)){n&&(n.peek=i===void 0?`miss`:`stale`);return}let a=this.#f[i],o=this.#W(a)?a.__staleWhileFetching:a;return n&&(o===void 0?n.peek=`miss`:(n.peek=`hit`,n.value=o)),o}#U(e,t,n,r){let i=t===void 0?void 0:this.#f[t];if(this.#W(i))return i;let a=new AbortController,{signal:o}=n;o?.addEventListener(`abort`,()=>a.abort(o.reason),{signal:a.signal});let s={signal:a.signal,options:n,context:r},c=(r,i=!1)=>{let{aborted:o}=a.signal,c=n.ignoreFetchAbort&&r!==void 0,l=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&r!==void 0);if(n.status&&(o&&!i?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,c&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),o&&!c&&!i)return u(a.signal.reason,l);let d=f,p=this.#f[t];return(p===f||p===void 0&&c&&i)&&(r===void 0?d.__staleWhileFetching===void 0?this.#Z(e,`fetch`):this.#f[t]=d.__staleWhileFetching:(n.status&&(n.status.fetchUpdated=!0),this.#z(e,r,s.options,d))),r},l=e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),u(e,!1)),u=(r,i)=>{let{aborted:o}=a.signal,s=o&&n.allowStaleOnFetchAbort,c=s||n.allowStaleOnFetchRejection,l=c||n.noDeleteOnFetchRejection,u=f;if(this.#f[t]===f&&(!l||!i&&u.__staleWhileFetching===void 0?this.#Z(e,`fetch`):s||(this.#f[t]=u.__staleWhileFetching)),c)return n.status&&u.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),u.__staleWhileFetching;if(u.__returned===u)throw r},d=(t,r)=>{let o=this.#a?.(e,i,s);a.signal.addEventListener(`abort`,()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>c(e,!0)))}),o&&o instanceof Promise?o.then(e=>t(e===void 0?void 0:e),r):o!==void 0&&t(o)};n.status&&(n.status.fetchDispatched=!0);let f=new Promise(d).then(c,l),p=Object.assign(f,{__abortController:a,__staleWhileFetching:i,__returned:void 0});return t===void 0?(this.#z(e,p,{...s.options,status:void 0}),t=this.#u.get(e)):this.#f[t]=p,p}#W(e){if(!this.#w)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty(`__staleWhileFetching`)&&t.__abortController instanceof AbortController}fetch(e,t={}){let n=i.tracing.hasSubscribers,{status:r=o()?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let a=this.#G(e,t);return r&&n&&(r.trace=!0,i.tracing.tracePromise(()=>a,r).catch(()=>{})),a}async#G(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:s=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:m,forceRefresh:h=!1,status:g,signal:_}=t;if(g&&(g.op=`fetch`,g.key=e,h&&(g.forceRefresh=!0),g.cache=this),!this.#w)return g&&(g.fetch=`get`),this.#J(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:g});let v={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:a,noDisposeOnSet:o,size:s,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:p,ignoreFetchAbort:f,status:g,signal:_},y=this.#u.get(e);if(y===void 0){g&&(g.fetch=`miss`);let t=this.#U(e,y,v,m);return t.__returned=t}{let t=this.#f[y];if(this.#W(t)){let e=n&&t.__staleWhileFetching!==void 0;return g&&(g.fetch=`inflight`,e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let i=this.#j(y);if(!h&&!i)return g&&(g.fetch=`hit`),this.#X(y),r&&this.#O(y),g&&this.#k(g,y),t;let a=this.#U(e,y,v,m),o=a.__staleWhileFetching!==void 0&&n;return g&&(g.fetch=i?`stale`:`refresh`,o&&i&&(g.returnedStale=!0)),o?a.__staleWhileFetching:a.__returned=a}}forceFetch(e,t={}){let n=i.tracing.hasSubscribers,{status:r=o()?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let a=this.#K(e,t);return r&&n&&(r.trace=!0,i.tracing.tracePromise(()=>a,r).catch(()=>{})),a}async#K(e,t={}){let n=await this.#G(e,t);if(n===void 0)throw Error(`fetch() returned undefined`);return n}memo(e,t={}){let{status:n=i.metrics.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`memo`,n.key=e,t.context&&(n.context=t.context),n.cache=this);let r=this.#q(e,t);return n&&(n.value=r),i.metrics.hasSubscribers&&i.metrics.publish(n),r}#q(e,t={}){let n=this.#o;if(!n)throw Error(`no memoMethod provided to constructor`);let{context:r,status:i,forceRefresh:a,...o}=t;i&&a&&(i.forceRefresh=!0);let s=this.#J(e,o),c=a||s===void 0;if(i&&(i.memo=c?`miss`:`hit`,c||(i.value=s)),!c)return s;let l=n(e,s,{options:o,context:r});return i&&(i.value=l),this.#z(e,l,o),l}get(e,t={}){let{status:n=i.metrics.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`get`,n.key=e,n.cache=this);let r=this.#J(e,t);return n&&(r!==void 0&&(n.value=r),i.metrics.hasSubscribers&&i.metrics.publish(n)),r}#J(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:a}=t,o=this.#u.get(e);if(o===void 0){a&&(a.get=`miss`);return}let s=this.#f[o],c=this.#W(s);return a&&this.#k(a,o),this.#j(o)?c?(a&&(a.get=`stale-fetching`),n&&s.__staleWhileFetching!==void 0?(a&&(a.returnedStale=!0),s.__staleWhileFetching):void 0):(i||this.#Z(e,`expire`),a&&(a.get=`stale`),n?(a&&(a.returnedStale=!0),s):void 0):(a&&(a.get=c?`fetching`:`hit`),this.#X(o),r&&this.#O(o),c?s.__staleWhileFetching:s)}#Y(e,t){this.#m[t]=e,this.#p[e]=t}#X(e){e!==this.#g&&(e===this.#h?this.#h=this.#p[e]:this.#Y(this.#m[e],this.#p[e]),this.#Y(this.#g,e),this.#g=e)}delete(e){return this.#Z(e,`delete`)}#Z(e,t){i.metrics.hasSubscribers&&i.metrics.publish({op:`delete`,delete:t,key:e,cache:this});let n=!1;if(this.#c!==0){let r=this.#u.get(e);if(r!==void 0){if(this.#S?.[r]&&(clearTimeout(this.#S[r]),this.#S[r]=void 0),n=!0,this.#c===1)this.#Q(t);else{this.#N(r);let n=this.#f[r];if(this.#W(n)?n.__abortController.abort(/* @__PURE__ */ Error(`deleted`)):(this.#C||this.#T)&&(this.#C&&this.#n?.(n,e,t),this.#T&&this.#v?.push([n,e,t])),this.#u.delete(e),this.#d[r]=void 0,this.#f[r]=void 0,r===this.#g)this.#g=this.#m[r];else if(r===this.#h)this.#h=this.#p[r];else{let e=this.#m[r];this.#p[e]=this.#p[r];let t=this.#p[r];this.#m[t]=this.#m[r]}this.#c--,this.#_.push(r)}}}if(this.#T&&this.#v?.length){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return n}clear(){return this.#Q(`delete`)}#Q(e){for(let t of this.#L({allowStale:!0})){let n=this.#f[t];if(this.#W(n))n.__abortController.abort(/* @__PURE__ */ Error(`deleted`));else{let r=this.#d[t];this.#C&&this.#n?.(n,r,e),this.#T&&this.#v?.push([n,r,e])}}if(this.#u.clear(),this.#f.fill(void 0),this.#d.fill(void 0),this.#x&&this.#b){this.#x.fill(0),this.#b.fill(0);for(let e of this.#S??[])e!==void 0&&clearTimeout(e);this.#S?.fill(void 0)}if(this.#y&&this.#y.fill(0),this.#h=0,this.#g=0,this.#_.length=0,this.#l=0,this.#c=0,this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}}})),Se=/* @__PURE__ */ e.t(((e,t)=>{let n=(...e)=>e.every(e=>e)?e.join(``):``,r=e=>e?encodeURIComponent(e):``,i=e=>e.toLowerCase().replace(/^\W+/g,``).replace(/(?<!\W)\W+$/,``).replace(/\//g,``).replace(/\W+/g,`-`),a={sshtemplate:({domain:e,user:t,project:r,committish:i})=>`git@${e}:${t}/${r}.git${n(`#`,i)}`,sshurltemplate:({domain:e,user:t,project:r,committish:i})=>`git+ssh://git@${e}/${t}/${r}.git${n(`#`,i)}`,edittemplate:({domain:e,user:t,project:i,committish:a,editpath:o,path:s})=>`https://${e}/${t}/${i}${n(`/`,o,`/`,r(a||`HEAD`),`/`,s)}`,browsetemplate:({domain:e,user:t,project:i,committish:a,treepath:o})=>`https://${e}/${t}/${i}${n(`/`,o,`/`,r(a))}`,browsetreetemplate:({domain:e,user:t,project:i,committish:a,treepath:o,path:s,fragment:c,hashformat:l})=>`https://${e}/${t}/${i}/${o}/${r(a||`HEAD`)}/${s}${n(`#`,l(c||``))}`,browseblobtemplate:({domain:e,user:t,project:i,committish:a,blobpath:o,path:s,fragment:c,hashformat:l})=>`https://${e}/${t}/${i}/${o}/${r(a||`HEAD`)}/${s}${n(`#`,l(c||``))}`,docstemplate:({domain:e,user:t,project:i,treepath:a,committish:o})=>`https://${e}/${t}/${i}${n(`/`,a,`/`,r(o))}#readme`,httpstemplate:({auth:e,domain:t,user:r,project:i,committish:a})=>`git+https://${n(e,`@`)}${t}/${r}/${i}.git${n(`#`,a)}`,filetemplate:({domain:e,user:t,project:n,committish:i,path:a})=>`https://${e}/${t}/${n}/raw/${r(i||`HEAD`)}/${a}`,shortcuttemplate:({type:e,user:t,project:r,committish:i})=>`${e}:${t}/${r}${n(`#`,i)}`,pathtemplate:({user:e,project:t,committish:r})=>`${e}/${t}${n(`#`,r)}`,bugstemplate:({domain:e,user:t,project:n})=>`https://${e}/${t}/${n}/issues`,hashformat:i},o={};o.github={protocols:[`git:`,`http:`,`git+ssh:`,`git+https:`,`ssh:`,`https:`],domain:`github.com`,treepath:`tree`,blobpath:`blob`,editpath:`edit`,filetemplate:({auth:e,user:t,project:i,committish:a,path:o})=>`https://${n(e,`@`)}raw.githubusercontent.com/${t}/${i}/${r(a||`HEAD`)}/${o}`,gittemplate:({auth:e,domain:t,user:r,project:i,committish:a})=>`git://${n(e,`@`)}${t}/${r}/${i}.git${n(`#`,a)}`,tarballtemplate:({domain:e,user:t,project:n,committish:i})=>`https://codeload.${e}/${t}/${n}/tar.gz/${r(i||`HEAD`)}`,extract:e=>{let[,t,n,r,i]=e.pathname.split(`/`,5);if(!(r&&r!==`tree`)&&(r||(i=e.hash.slice(1)),n&&n.endsWith(`.git`)&&(n=n.slice(0,-4)),t&&n))return{user:t,project:n,committish:i}}},o.bitbucket={protocols:[`git+ssh:`,`git+https:`,`ssh:`,`https:`],domain:`bitbucket.org`,treepath:`src`,blobpath:`src`,editpath:`?mode=edit`,edittemplate:({domain:e,user:t,project:i,committish:a,treepath:o,path:s,editpath:c})=>`https://${e}/${t}/${i}${n(`/`,o,`/`,r(a||`HEAD`),`/`,s,c)}`,tarballtemplate:({domain:e,user:t,project:n,committish:i})=>`https://${e}/${t}/${n}/get/${r(i||`HEAD`)}.tar.gz`,extract:e=>{let[,t,n,r]=e.pathname.split(`/`,4);if(![`get`].includes(r)&&(n&&n.endsWith(`.git`)&&(n=n.slice(0,-4)),t&&n))return{user:t,project:n,committish:e.hash.slice(1)}}},o.gitlab={protocols:[`git+ssh:`,`git+https:`,`ssh:`,`https:`],domain:`gitlab.com`,treepath:`tree`,blobpath:`tree`,editpath:`-/edit`,tarballtemplate:({domain:e,user:t,project:n,committish:i})=>`https://${e}/api/v4/projects/${r(t+`/`+n)}/repository/archive.tar.gz?sha=${r(i||`HEAD`)}`,extract:e=>{let t=e.pathname.slice(1);if(t.includes(`/-/`)||t.includes(`/archive.tar.gz`))return;let n=t.split(`/`),r=n.pop();r.endsWith(`.git`)&&(r=r.slice(0,-4));let i=n.join(`/`);if(i&&r)return{user:i,project:r,committish:e.hash.slice(1)}}},o.gist={protocols:[`git:`,`git+ssh:`,`git+https:`,`ssh:`,`https:`],domain:`gist.github.com`,editpath:`edit`,sshtemplate:({domain:e,project:t,committish:r})=>`git@${e}:${t}.git${n(`#`,r)}`,sshurltemplate:({domain:e,project:t,committish:r})=>`git+ssh://git@${e}/${t}.git${n(`#`,r)}`,edittemplate:({domain:e,user:t,project:i,committish:a,editpath:o})=>`https://${e}/${t}/${i}${n(`/`,r(a))}/${o}`,browsetemplate:({domain:e,project:t,committish:i})=>`https://${e}/${t}${n(`/`,r(i))}`,browsetreetemplate:({domain:e,project:t,committish:i,path:a,hashformat:o})=>`https://${e}/${t}${n(`/`,r(i))}${n(`#`,o(a))}`,browseblobtemplate:({domain:e,project:t,committish:i,path:a,hashformat:o})=>`https://${e}/${t}${n(`/`,r(i))}${n(`#`,o(a))}`,docstemplate:({domain:e,project:t,committish:i})=>`https://${e}/${t}${n(`/`,r(i))}`,httpstemplate:({domain:e,project:t,committish:r})=>`git+https://${e}/${t}.git${n(`#`,r)}`,filetemplate:({user:e,project:t,committish:i,path:a})=>`https://gist.githubusercontent.com/${e}/${t}/raw${n(`/`,r(i))}/${a}`,shortcuttemplate:({type:e,project:t,committish:r})=>`${e}:${t}${n(`#`,r)}`,pathtemplate:({project:e,committish:t})=>`${e}${n(`#`,t)}`,bugstemplate:({domain:e,project:t})=>`https://${e}/${t}`,gittemplate:({domain:e,project:t,committish:r})=>`git://${e}/${t}.git${n(`#`,r)}`,tarballtemplate:({project:e,committish:t})=>`https://codeload.github.com/gist/${e}/tar.gz/${r(t||`HEAD`)}`,extract:e=>{let[,t,n,r]=e.pathname.split(`/`,4);if(r!==`raw`){if(!n){if(!t)return;n=t,t=null}return n.endsWith(`.git`)&&(n=n.slice(0,-4)),{user:t,project:n,committish:e.hash.slice(1)}}},hashformat:function(e){return e&&`file-`+i(e)}},o.sourcehut={protocols:[`git+ssh:`,`https:`],domain:`git.sr.ht`,treepath:`tree`,blobpath:`tree`,filetemplate:({domain:e,user:t,project:n,committish:i,path:a})=>`https://${e}/${t}/${n}/blob/${r(i)||`HEAD`}/${a}`,httpstemplate:({domain:e,user:t,project:r,committish:i})=>`https://${e}/${t}/${r}${n(`#`,i)}`,tarballtemplate:({domain:e,user:t,project:n,committish:i})=>`https://${e}/${t}/${n}/archive/${r(i)||`HEAD`}.tar.gz`,bugstemplate:()=>null,extract:e=>{let[,t,n,r]=e.pathname.split(`/`,4);if(![`archive`].includes(r)&&(n&&n.endsWith(`.git`)&&(n=n.slice(0,-4)),t&&n))return{user:t,project:n,committish:e.hash.slice(1)}}};for(let[e,t]of Object.entries(o))o[e]=Object.assign({},a,t);t.exports=o})),Ce=/* @__PURE__ */ e.t(((e,t)=>{let n=require("url"),r=(e,t,n)=>{let r=e.indexOf(n);return e.lastIndexOf(t,r>-1?r:1/0)},i=e=>{try{return new n.URL(e)}catch{}},a=(e,t)=>{let n=e.indexOf(`:`),r=e.slice(0,n+1);if(Object.prototype.hasOwnProperty.call(t,r)||e.substr(n,3)===`://`)return e;let i=e.indexOf(`@`);return i>-1?i>n?`git+ssh://${e}`:e:`${e.slice(0,n+1)}//${e.slice(n+1)}`},o=e=>{let t=r(e,`@`,`#`),n=r(e,`:`,`#`);return n>t&&(e=e.slice(0,n)+`/`+e.slice(n+1)),r(e,`:`,`#`)===-1&&e.indexOf(`//`)===-1&&(e=`git+ssh://${e}`),e};t.exports=(e,t)=>{let n=t?a(e,t):e;return i(n)||i(o(n))}})),we=/* @__PURE__ */ e.t(((e,t)=>{let n=Ce(),r=e=>{let t=e.indexOf(`#`),n=e.indexOf(`/`),r=e.indexOf(`/`,n+1),i=e.indexOf(`:`),a=/\s/.exec(e),o=e.indexOf(`@`),s=!a||t>-1&&a.index>t,c=o===-1||t>-1&&o>t,l=i===-1||t>-1&&i>t,u=r===-1||t>-1&&r>t,d=n>0,f=t>-1?e[t-1]!==`/`:!e.endsWith(`/`),p=!e.startsWith(`.`);return s&&d&&f&&p&&c&&l&&u};t.exports=(e,t,{gitHosts:i,protocols:a})=>{if(!e)return;let o=r(e)?`github:${e}`:e,s=n(o,a);if(!s)return;let c=i.byShortcut[s.protocol],l=i.byDomain[s.hostname.startsWith(`www.`)?s.hostname.slice(4):s.hostname],u=c||l;if(!u)return;let d=i[c||l],f=null;a[s.protocol]?.auth&&(s.username||s.password)&&(f=`${s.username}${s.password?`:`+s.password:``}`);let p=null,m=null,h=null,g=null;try{if(c){let e=s.pathname.startsWith(`/`)?s.pathname.slice(1):s.pathname,t=e.indexOf(`@`);t>-1&&(e=e.slice(t+1));let n=e.lastIndexOf(`/`);n>-1?(m=decodeURIComponent(e.slice(0,n)),m||=null,h=decodeURIComponent(e.slice(n+1))):h=decodeURIComponent(e),h.endsWith(`.git`)&&(h=h.slice(0,-4)),s.hash&&(p=decodeURIComponent(s.hash.slice(1))),g=`shortcut`}else{if(!d.protocols.includes(s.protocol))return;let e=d.extract(s);if(!e)return;m=e.user&&decodeURIComponent(e.user),h=decodeURIComponent(e.project),p=decodeURIComponent(e.committish),g=a[s.protocol]?.name||s.protocol.slice(0,-1)}}catch(e){
/* istanbul ignore else */
if(e instanceof URIError)return;throw e}return[u,m,f,h,p,g,t]}})),Te=/* @__PURE__ */ e.t(((e,t)=>{let{LRUCache:n}=xe(),r=Se(),i=we(),a=Ce(),o=new n({max:1e3});function s(e){try{let{protocol:t,hostname:n,pathname:r}=new URL(e);return n?`${/(?:git\+)http:$/.test(t)?`http:`:`https:`}//${n}${r.replace(/\.git$/,``)}`:null}catch{return null}}var c=class e{constructor(t,n,r,i,a,o,s={}){Object.assign(this,e.#e[t],{type:t,user:n,auth:r,project:i,committish:a,default:o,opts:s})}static#e={byShortcut:{},byDomain:{}};static#t={"git+ssh:":{name:`sshurl`},"ssh:":{name:`sshurl`},"git+https:":{name:`https`,auth:!0},"git:":{auth:!0},"http:":{auth:!0},"https:":{auth:!0},"git+http:":{auth:!0}};static addHost(t,n){e.#e[t]=n,e.#e.byDomain[n.domain]=t,e.#e.byShortcut[`${t}:`]=t,e.#t[`${t}:`]={name:t}}static fromUrl(t,n){if(typeof t!=`string`)return;let r=t+JSON.stringify(n||{});if(!o.has(r)){let a=i(t,n,{gitHosts:e.#e,protocols:e.#t});o.set(r,a?new e(...a):void 0)}return o.get(r)}static fromManifest(t,n={}){if(!t||typeof t!=`object`)return;let r=t.repository,i=r&&(typeof r==`string`?r:typeof r==`object`&&typeof r.url==`string`?r.url:null);if(!i)throw Error(`no repository`);let a=i&&e.fromUrl(i.replace(/^git\+/,``),n)||null;if(a)return a;let o=s(i);return e.fromUrl(o,n)||o}static parseUrl(e){return a(e)}#n(e,t){if(typeof e!=`function`)return null;let n={...this,...this.opts,...t};n.path||=``,n.path.startsWith(`/`)&&(n.path=n.path.slice(1)),n.noCommittish&&(n.committish=null);let r=e(n);return n.noGitPlus&&r.startsWith(`git+`)?r.slice(4):r}hash(){return this.committish?`#${this.committish}`:``}ssh(e){return this.#n(this.sshtemplate,e)}sshurl(e){return this.#n(this.sshurltemplate,e)}browse(e,...t){return typeof e==`string`?typeof t[0]==`string`?this.#n(this.browsetreetemplate,{...t[1],fragment:t[0],path:e}):this.#n(this.browsetreetemplate,{...t[0],path:e}):this.#n(this.browsetemplate,e)}browseFile(e,...t){return typeof t[0]==`string`?this.#n(this.browseblobtemplate,{...t[1],fragment:t[0],path:e}):this.#n(this.browseblobtemplate,{...t[0],path:e})}docs(e){return this.#n(this.docstemplate,e)}bugs(e){return this.#n(this.bugstemplate,e)}https(e){return this.#n(this.httpstemplate,e)}git(e){return this.#n(this.gittemplate,e)}shortcut(e){return this.#n(this.shortcuttemplate,e)}path(e){return this.#n(this.pathtemplate,e)}tarball(e){return this.#n(this.tarballtemplate,{...e,noCommittish:!1})}file(e,t){return this.#n(this.filetemplate,{...t,path:e})}edit(e,t){return this.#n(this.edittemplate,{...t,path:e})}getDefaultRepresentation(){return this.default}toString(e){return this.default&&typeof this[this.default]==`function`?this[this.default](e):this.sshurl(e)}};for(let[e,t]of Object.entries(r))c.addHost(e,t);t.exports=c})),Ee=/* @__PURE__ */ e.t(((e,t)=>{t.exports=n;function n(e){if(!e||e===`ERROR: No README data found!`)return;e=e.trim().split(`
`);let t=0;for(;e[t]&&e[t].trim().match(/^(#|$)/);)t++;let n=e.length,r=t+1;for(;r<n&&e[r].trim();)r++;return e.slice(t,r).join(` `).trim()}})),De=/* @__PURE__ */ e.t(((e,t)=>{t.exports={topLevel:{dependancies:`dependencies`,dependecies:`dependencies`,depdenencies:`dependencies`,devEependencies:`devDependencies`,depends:`dependencies`,"dev-dependencies":`devDependencies`,devDependences:`devDependencies`,devDepenencies:`devDependencies`,devdependencies:`devDependencies`,repostitory:`repository`,repo:`repository`,prefereGlobal:`preferGlobal`,hompage:`homepage`,hampage:`homepage`,autohr:`author`,autor:`author`,contributers:`contributors`,publicationConfig:`publishConfig`,script:`scripts`},bugs:{web:`url`,name:`url`},script:{server:`start`,tests:`test`}}})),Oe=/* @__PURE__ */ e.t(((e,t)=>{var{URL:n}=require("node:url"),r=require("semver/functions/valid"),i=require("semver/functions/clean"),a=be(),o=Te(),{isBuiltin:s}=require("node:module"),c=[`dependencies`,`devDependencies`,`optionalDependencies`],l=Ee(),u=De(),d=e=>e.includes(`@`)&&e.indexOf(`@`)<e.lastIndexOf(`.`);t.exports={warn:function(){},fixRepositoryField:function(e){if(e.repositories&&(this.warn(`repositories`),e.repository=e.repositories[0]),!e.repository)return this.warn(`missingRepository`);typeof e.repository==`string`&&(e.repository={type:`git`,url:e.repository});var t=e.repository.url||``;if(t){var n=o.fromUrl(t);n&&(t=e.repository.url=n.getDefaultRepresentation()===`shortcut`?n.https():n.toString())}t.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn(`brokenGitUrl`,t)},fixTypos:function(e){Object.keys(u.topLevel).forEach(function(t){Object.prototype.hasOwnProperty.call(e,t)&&this.warn(`typo`,t,u.topLevel[t])},this)},fixScriptsField:function(e){e.scripts&&(typeof e.scripts==`object`?Object.keys(e.scripts).forEach(function(t){typeof e.scripts[t]==`string`?u.script[t]&&!e.scripts[u.script[t]]&&this.warn(`typo`,t,u.script[t],`scripts`):(this.warn(`nonStringScript`),delete e.scripts[t])},this):(this.warn(`nonObjectScripts`),delete e.scripts))},fixFilesField:function(e){var t=e.files;t&&!Array.isArray(t)?(this.warn(`nonArrayFiles`),delete e.files):e.files&&=e.files.filter(function(e){return!e||typeof e!=`string`?(this.warn(`invalidFilename`,e),!1):!0},this)},fixBinField:function(e){if(e.bin&&typeof e.bin==`string`){var t={},n;(n=e.name.match(/^@[^/]+[/](.*)$/))?t[n[1]]=e.bin:t[e.name]=e.bin,e.bin=t}},fixManField:function(e){e.man&&typeof e.man==`string`&&(e.man=[e.man])},fixBundleDependenciesField:function(e){var t=`bundledDependencies`,n=`bundleDependencies`;e[t]&&!e[n]&&(e[n]=e[t],delete e[t]),e[n]&&!Array.isArray(e[n])?(this.warn(`nonArrayBundleDependencies`),delete e[n]):e[n]&&(e[n]=e[n].filter(function(t){return!t||typeof t!=`string`?(this.warn(`nonStringBundleDependency`,t),!1):(e.dependencies||={},Object.prototype.hasOwnProperty.call(e.dependencies,t)||(this.warn(`nonDependencyBundleDependency`,t),e.dependencies[t]=`*`),!0)},this))},fixDependencies:function(e){ee(e,this.warn),v(e,this.warn),this.fixBundleDependenciesField(e),[`dependencies`,`devDependencies`].forEach(function(t){t in e&&(!e[t]||typeof e[t]!=`object`?(this.warn(`nonObjectDependencies`,t),delete e[t]):Object.keys(e[t]).forEach(function(n){var r=e[t][n];typeof r!=`string`&&(this.warn(`nonStringDependency`,n,JSON.stringify(r)),delete e[t][n]);var i=o.fromUrl(e[t][n]);i&&(e[t][n]=i.toString())},this))},this)},fixModulesField:function(e){e.modules&&(this.warn(`deprecatedModules`),delete e.modules)},fixKeywordsField:function(e){typeof e.keywords==`string`&&(e.keywords=e.keywords.split(/,\s+/)),e.keywords&&!Array.isArray(e.keywords)?(delete e.keywords,this.warn(`nonArrayKeywords`)):e.keywords&&=e.keywords.filter(function(e){return typeof e!=`string`||!e?(this.warn(`nonStringKeyword`),!1):!0},this)},fixVersionField:function(e,t){var n=!t;if(!e.version)return e.version=``,!0;if(!r(e.version,n))throw Error(`Invalid version: "`+e.version+`"`);return e.version=i(e.version,n),!0},fixPeople:function(e){h(e,g),h(e,_)},fixNameField:function(e,t){typeof t==`boolean`?t={strict:t}:t===void 0&&(t={});var n=t.strict;if(!e.name&&!n)e.name=``;else{if(typeof e.name!=`string`)throw Error(`name field must be a string.`);n||(e.name=e.name.trim()),m(e.name,n,t.allowLegacyCase),s(e.name)&&this.warn(`conflictingName`,e.name)}},fixDescriptionField:function(e){e.description&&typeof e.description!=`string`&&(this.warn(`nonStringDescription`),delete e.description),e.readme&&!e.description&&(e.description=l(e.readme)),e.description===void 0&&delete e.description,e.description||this.warn(`missingDescription`)},fixReadmeField:function(e){e.readme||=(this.warn(`missingReadme`),`ERROR: No README data found!`)},fixBugsField:function(e){if(!e.bugs&&e.repository&&e.repository.url){var t=o.fromUrl(e.repository.url);t&&t.bugs()&&(e.bugs={url:t.bugs()})}else if(e.bugs){if(typeof e.bugs==`string`)d(e.bugs)?e.bugs={email:e.bugs}:n.canParse(e.bugs)?e.bugs={url:e.bugs}:this.warn(`nonEmailUrlBugsString`);else{b(e.bugs,this.warn);var r=e.bugs;e.bugs={},r.url&&(n.canParse(r.url)?e.bugs.url=r.url:this.warn(`nonUrlBugsUrlField`)),r.email&&(typeof r.email==`string`&&d(r.email)?e.bugs.email=r.email:this.warn(`nonEmailBugsEmailField`))}!e.bugs.email&&!e.bugs.url&&(delete e.bugs,this.warn(`emptyNormalizedBugs`))}},fixHomepageField:function(e){if(!e.homepage&&e.repository&&e.repository.url){var t=o.fromUrl(e.repository.url);t&&t.docs()&&(e.homepage=t.docs())}if(e.homepage){if(typeof e.homepage!=`string`)return this.warn(`nonUrlHomepage`),delete e.homepage;n.canParse(e.homepage)||(e.homepage=`http://`+e.homepage)}},fixLicenseField:function(e){let t=e.license||e.licence;if(!t)return this.warn(`missingLicense`);if(typeof t!=`string`||t.length<1||t.trim()===``||!a(t).validForNewPackages)return this.warn(`invalidLicense`)}};function f(e){if(e.charAt(0)!==`@`)return!1;var t=e.slice(1).split(`/`);return t.length===2&&t[0]&&t[1]&&t[0]===encodeURIComponent(t[0])&&t[1]===encodeURIComponent(t[1])}function p(e){return!e.match(/[/@\s+%:]/)&&e===encodeURIComponent(e)}function m(e,t,n){if(e.charAt(0)===`.`||!(f(e)||p(e))||t&&!n&&e!==e.toLowerCase()||e.toLowerCase()===`node_modules`||e.toLowerCase()===`favicon.ico`)throw Error(`Invalid name: `+JSON.stringify(e))}function h(e,t){return e.author&&=t(e.author),[`maintainers`,`contributors`].forEach(function(n){Array.isArray(e[n])&&(e[n]=e[n].map(t))}),e}function g(e){if(typeof e==`string`)return e;var t=e.name||``,n=e.url||e.web,r=n?` (`+n+`)`:``,i=e.email||e.mail;return t+(i?` <`+i+`>`:``)+r}function _(e){if(typeof e!=`string`)return e;var t=e.match(/^([^(<]+)/),n=e.match(/\(([^()]+)\)/),r=e.match(/<([^<>]+)>/),i={};return t&&t[0].trim()&&(i.name=t[0].trim()),r&&(i.email=r[1]),n&&(i.url=n[1]),i}function v(e){var t=e.optionalDependencies;if(t){var n=e.dependencies||{};Object.keys(t).forEach(function(e){n[e]=t[e]}),e.dependencies=n}}function y(e,t,n){if(!e)return{};if(typeof e==`string`&&(e=e.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(e))return e;n(`deprecatedArrayDependencies`,t);var r={};return e.filter(function(e){return typeof e==`string`}).forEach(function(e){e=e.trim().split(/(:?[@\s><=])/);var t=e.shift(),n=e.join(``);n=n.trim(),n=n.replace(/^@/,``),r[t]=n}),r}function ee(e,t){c.forEach(function(n){e[n]&&(e[n]=y(e[n],n,t))})}function b(e,t){e&&Object.keys(e).forEach(function(n){u.bugs[n]&&(t(`typo`,n,u.bugs[n],`bugs`),e[u.bugs[n]]=e[n],delete e[n])})}})),ke=/* @__PURE__ */ e.t(((e,t)=>{t.exports={repositories:`'repositories' (plural) Not supported. Please pick one as the 'repository' field`,missingRepository:`No repository field.`,brokenGitUrl:`Probably broken git url: %s`,nonObjectScripts:`scripts must be an object`,nonStringScript:`script values must be string commands`,nonArrayFiles:`Invalid 'files' member`,invalidFilename:`Invalid filename in 'files' list: %s`,nonArrayBundleDependencies:`Invalid 'bundleDependencies' list. Must be array of package names`,nonStringBundleDependency:`Invalid bundleDependencies member: %s`,nonDependencyBundleDependency:`Non-dependency in bundleDependencies: %s`,nonObjectDependencies:`%s field must be an object`,nonStringDependency:`Invalid dependency: %s %s`,deprecatedArrayDependencies:`specifying %s as array is deprecated`,deprecatedModules:`modules field is deprecated`,nonArrayKeywords:`keywords should be an array of strings`,nonStringKeyword:`keywords should be an array of strings`,conflictingName:`%s is also the name of a node core module.`,nonStringDescription:`'description' field should be a string`,missingDescription:`No description`,missingReadme:`No README data`,missingLicense:`No license field.`,nonEmailUrlBugsString:`Bug string field must be url, email, or {email,url}`,nonUrlBugsUrlField:`bugs.url field must be a string url. Deleted.`,nonEmailBugsEmailField:`bugs.email field must be a string email. Deleted.`,emptyNormalizedBugs:`Normalized value of bugs field is an empty object. Deleted.`,nonUrlHomepage:`homepage field must be a string url. Deleted.`,invalidLicense:`license should be a valid SPDX license expression`,typo:`%s should probably be %s.`}})),Ae=/* @__PURE__ */ e.t(((e,t)=>{var n=require("util"),r=ke();t.exports=function(){var e=Array.prototype.slice.call(arguments,0),t=e.shift();if(t===`typo`)return i.apply(null,e);var a=r[t]?r[t]:t+`: '%s'`;return e.unshift(a),n.format.apply(null,e)};function i(e,t,i){return i&&(e=i+`['`+e+`']`,t=i+`['`+t+`']`),n.format(r.typo,e,t)}})),je=/* @__PURE__ */ e.t(((e,t)=>{t.exports=s;var n=Oe();s.fixer=n;var r=Ae(),i=[`name`,`version`,`description`,`repository`,`modules`,`scripts`,`files`,`bin`,`man`,`bugs`,`keywords`,`readme`,`homepage`,`license`],a=[`dependencies`,`people`,`typos`],o=i.map(function(e){return c(e)+`Field`});o=o.concat(a);function s(e,t,i){t===!0&&(t=null,i=!0),i||=!1,(!t||e.private)&&(t=function(){}),e.scripts&&e.scripts.install===`node-gyp rebuild`&&!e.scripts.preinstall&&(e.gypfile=!0),n.warn=function(){t(r.apply(null,arguments))},o.forEach(function(t){n[`fix`+c(t)](e,i)}),e._id=e.name+`@`+e.version}function c(e){return e.charAt(0).toUpperCase()+e.slice(1)}})),Me=/* @__PURE__ */ e.a(je(),1);(0,u.promisify)(d.execFile);function Ne(e){return e instanceof URL?(0,_.fileURLToPath)(e):e}const Pe=e=>m.default.resolve(Ne(e)??`.`,`package.json`),Fe=(e,t)=>{let n=typeof e==`string`?fe(e):e;return t&&(0,Me.default)(n),n};async function Ie({cwd:e,normalize:t=!0}={}){let n=await g.default.readFile(Pe(e),`utf8`);return Fe(n,t)}async function Le(e){let t=await re(`package.json`,e);if(t)return{packageJson:await Ie({...e,cwd:m.default.dirname(t)}),path:t}}var Re=/* @__PURE__ */ e.t(((e,t)=>{let n={to(e,t){return t?`[${t+1};${e+1}H`:`[${e+1}G`},move(e,t){let n=``;return e<0?n+=`[${-e}D`:e>0&&(n+=`[${e}C`),t<0?n+=`[${-t}A`:t>0&&(n+=`[${t}B`),n},up:(e=1)=>`[${e}A`,down:(e=1)=>`[${e}B`,forward:(e=1)=>`[${e}C`,backward:(e=1)=>`[${e}D`,nextLine:(e=1)=>`\x1B[E`.repeat(e),prevLine:(e=1)=>`\x1B[F`.repeat(e),left:`\x1B[G`,hide:`\x1B[?25l`,show:`\x1B[?25h`,save:`\x1B7`,restore:`\x1B8`};t.exports={cursor:n,scroll:{up:(e=1)=>`\x1B[S`.repeat(e),down:(e=1)=>`\x1B[T`.repeat(e)},erase:{screen:`\x1B[2J`,up:(e=1)=>`\x1B[1J`.repeat(e),down:(e=1)=>`\x1B[J`.repeat(e),line:`\x1B[2K`,lineEnd:`\x1B[K`,lineStart:`\x1B[1K`,lines(e){let t=``;for(let r=0;r<e;r++)t+=this.line+(r<e-1?n.up():``);return e&&(t+=n.left),t}},beep:`\x07`}}));const ze=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],Be=[12288,12288,65281,65376,65504,65510],Ve=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],He=(e,t)=>{let n=0,r=Math.floor(e.length/2)-1;for(;n<=r;){let i=Math.floor((n+r)/2),a=i*2;if(t<e[a])r=i-1;else if(t>e[a+1])n=i+1;else return!0}return!1},Ue=19968,[We,Ge]=/* #__PURE__ */ Ke(Ve);function Ke(e){let t=e[0],n=e[1];for(let r=0;r<e.length;r+=2){let i=e[r],a=e[r+1];if(Ue>=i&&Ue<=a)return[i,a];a-i>n-t&&(t=i,n=a)}return[t,n]}const qe=e=>e<161||e>1114109?!1:He(ze,e),Je=e=>e<12288||e>65510?!1:He(Be,e),Ye=e=>e>=We&&e<=Ge?!0:e<4352||e>262141?!1:He(Ve,e);function Xe(e){if(!Number.isSafeInteger(e))throw TypeError(`Expected a code point, got \`${typeof e}\`.`)}function Ze(e,{ambiguousAsWide:t=!1}={}){return Xe(e),Je(e)||Ye(e)||t&&qe(e)?2:1}const Qe=new Intl.Segmenter,$e=/^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{Mark}|\p{Surrogate})+$/v,et=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v,tt=/^\p{RGI_Emoji}$/v,nt=/^[\d#*]\u20E3$/,rt=/\p{Extended_Pictographic}/gu;function it(e){if(e.length>50)return!1;if(nt.test(e))return!0;if(e.includes(`‍`)){let t=e.match(rt);return t!==null&&t.length>=2}return!1}function at(e){return e.replace(et,``)}function ot(e){return $e.test(e)}function st(e){return e>=4352&&e<=4447||e>=43360&&e<=43388}function ct(e){return e>=4448&&e<=4519||e>=55216&&e<=55238}function lt(e){return e>=4520&&e<=4607||e>=55243&&e<=55291}function ut(e){return st(e)||ct(e)||lt(e)}function dt(e,t){let n=[];for(let t of e)$e.test(t)||n.push(t.codePointAt(0));if(n.length===0)return;let r=0;for(let e=0;e<n.length;e++){let i=n[e];if(!ut(i)){if(r===0)return;for(let i=e;i<n.length;i++)r+=Ze(n[i],t);return r}st(i)&&ct(n[e+1])?(r+=2,e+=lt(n[e+2])?2:1):r+=Ze(i,t)}return r}function ft(e,t){let n=0,r=!0;for(let i of e)r?r=!1:i>=`＀`&&i<=`￯`&&(n+=Ze(i.codePointAt(0),t));return n}function pt(e,t={}){if(typeof e!=`string`||e.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:i=!1}=t,a=e;if(!i&&(a.includes(`\x1B`)||a.includes(`›`))&&(a=r.t(a)),a.length===0)return 0;if(/^[\u0020-\u007E]*$/.test(a))return a.length;let o=0,s={ambiguousAsWide:!n};for(let{segment:e}of Qe.segment(a)){if(ot(e))continue;if(tt.test(e)||it(e)){o+=2;continue}let t=at(e),n=dt(t,s);if(n!==void 0){o+=n;continue}let r=t.codePointAt(0);o+=Ze(r,s),o+=ft(t,s)}return o}const mt=(e=0)=>t=>`\u001B[${t+e}m`,ht=(e=0)=>t=>`\u001B[${38+e};5;${t}m`,gt=(e=0)=>(t,n,r)=>`\u001B[${38+e};2;${t};${n};${r}m`,x={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]}};Object.keys(x.modifier);const _t=Object.keys(x.color),vt=Object.keys(x.bgColor);[..._t,...vt];function yt(){let e=/* @__PURE__ */ new Map;for(let[t,n]of Object.entries(x)){for(let[t,r]of Object.entries(n))x[t]={open:`\u001B[${r[0]}m`,close:`\u001B[${r[1]}m`},n[t]=x[t],e.set(r[0],r[1]);Object.defineProperty(x,t,{value:n,enumerable:!1})}return Object.defineProperty(x,"codes",{value:e,enumerable:!1}),x.color.close=`\x1B[39m`,x.bgColor.close=`\x1B[49m`,x.color.ansi=mt(),x.color.ansi256=ht(),x.color.ansi16m=gt(),x.bgColor.ansi=mt(10),x.bgColor.ansi256=ht(10),x.bgColor.ansi16m=gt(10),Object.defineProperties(x,{rgbToAnsi256:{value(e,t,n){return e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(e){let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(e=>e+e).join(``));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:e=>x.rgbToAnsi256(...x.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,r;if(e>=232)t=((e-232)*10+8)/255,n=t,r=t;else{e-=16;let i=e%36;t=Math.floor(e/36)/5,n=Math.floor(i/6)/5,r=i%6/5}let i=Math.max(t,n,r)*2;if(i===0)return 30;let a=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(t));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>x.ansi256ToAnsi(x.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>x.ansi256ToAnsi(x.hexToAnsi256(e)),enumerable:!1}}),x}const bt=yt(),xt=/* @__PURE__ */ new Set([`\x1B`,`›`]),St=[...xt].join(``),Ct=`(?:\x07|\x1B\\\\)`,wt=String.raw`[^\u0000-\u001F\u007F-\u009F]*`,Tt=String.raw`8;(?<parameters>[^;\u0000-\u001F\u007F-\u009F]*);(?<uri>${wt})${Ct}`,Et=`${wt}${Ct}`,Dt=RegExp(`(?:\\[|›)(?:(?<sgr>[0-9;:]*)m|[0-?]*[ -/]*[@-~])|\\](?:${Tt}|${Et})`,`y`),Ot=new Set(bt.codes.values());Ot.delete(0);const kt=new Intl.Segmenter,At=e=>pt(e,{countAnsiEscapeCodes:!0}),jt=RegExp(`[${St}]`,`g`),Mt=RegExp(`[\\n${St}]`,`g`),Nt=/^[ -~]*$/,Pt=e=>`[${e}m`,Ft=(e,t=``)=>`]8;${t};${e}`,It=(e,t)=>{if(xt.has(e[t]))return Dt.lastIndex=t,Dt.exec(e)??void 0},S=(e,t,n=()=>{})=>{let r=0,i=0;for(;i<e.length;){jt.lastIndex=i;let a=jt.exec(e);if(!a)break;let o=It(e,a.index);o?(a.index>r&&t(e.slice(r,a.index)),n(o[0]),i=a.index+o[0].length,r=i):i=a.index+1}r<e.length&&t(e.slice(r))},Lt=e=>{let t=``;return S(e,e=>{t+=e}),At(t)},Rt=e=>{let t=[];return S(e,e=>{if(Nt.test(e))for(let n of e)t.push({value:n,width:1});else for(let{segment:n}of kt.segment(e))t.push({value:n,width:At(n)})},e=>{t.push({value:e,width:0})}),t},zt=e=>{let t={value:``,plainText:``},n=[t];S(e,e=>{let r=e.split(` `);t.value+=r[0],t.plainText+=r[0];for(let e=1;e<r.length;e++)t={value:r[e],plainText:r[e]},n.push(t)},e=>{t.value+=e});for(let e of n)e.width=At(e.plainText);return n},Bt=e=>{let t=e.split(`:`),n=Number.parseInt(t[0],10),r=Number.parseInt(t[1],10);if(![38,48,58].includes(n))return;if(r===5&&t.length===3&&/^\d+$/.test(t[2]))return{code:n,open:e,hasArguments:!0};if(r!==2)return;let i=t.length===6?t.slice(3):t.slice(2),a=t.length===6?t[2]:void 0;if(i.length===3&&i.every(e=>/^\d+$/.test(e))&&(a===void 0||/^\d*$/.test(a)))return{code:n,open:e,hasArguments:!0}},Vt=e=>{let t=e.split(`;`),n=[];for(let e=0;e<t.length;e++){let r=t[e];if(r.includes(`:`)){let e=Bt(r);e&&n.push(e);continue}let i=r===``?0:Number.parseInt(r,10);if(Number.isFinite(i)){if(i===38||i===48||i===58){if(e+1>=t.length)break;let r=Number.parseInt(t[e+1],10),a=Number.parseInt(t[e+2],10);if(r===5&&Number.isFinite(a)){n.push({code:i,open:[i,r,a].join(`;`),hasArguments:!0}),e+=2;continue}let o=Number.parseInt(t[e+2],10),s=Number.parseInt(t[e+3],10),c=Number.parseInt(t[e+4],10);if(r===2&&Number.isFinite(o)&&Number.isFinite(s)&&Number.isFinite(c)){n.push({code:i,open:[i,r,o,s,c].join(`;`),hasArguments:!0}),e+=4;continue}break}n.push({code:i,open:String(i),hasArguments:!1})}}return n},Ht=(e,t)=>{let n=e.findIndex(e=>e.family===t);n!==-1&&e.splice(n,1)},Ut=(e,t)=>{Ht(e,t.family),e.push(t)},Wt=(e,t)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];r.family.startsWith(`modifier-`)&&r.close===t&&e.splice(n,1)}},Gt=e=>{let{code:t,open:n,hasArguments:r}=e;if(t>=30&&t<=37||t>=90&&t<=97||t===38&&r)return{family:`foreground`,open:n,close:39};if(t>=40&&t<=47||t>=100&&t<=107||t===48&&r)return{family:`background`,open:n,close:49};if(t===58&&r)return{family:`underlineColor`,open:n,close:59}},Kt=(e,t)=>e===0?(t.length=0,!0):e===39?(Ht(t,`foreground`),!0):e===49?(Ht(t,`background`),!0):e===59?(Ht(t,`underlineColor`),!0):Ot.has(e)?(Wt(t,e),!0):!1,qt=(e,t)=>{let{code:n}=e;if(Kt(n,t))return;let r=Gt(e);if(r){Ut(t,r);return}let i=bt.codes.get(n);i!==void 0&&i!==0&&Ut(t,{family:`modifier-${n}`,open:e.open,close:i})},Jt=(e,t)=>{for(let n of Vt(e))qt(n,t)},Yt=(e,t)=>{for(let{code:n}of Vt(e))Kt(n,t)},Xt=(e,t,n)=>{let r=t;for(;r<e.length;){let t=It(e,r);if(!t)break;t.groups.sgr!==void 0&&Yt(t.groups.sgr,n),r+=t[0].length}},Zt=e=>[...e].reverse().map(e=>Pt(e.close)).join(``),Qt=e=>e.map(e=>Pt(e.open)).join(``),$t=(e,t,n,r)=>{let i=Rt(t),a=r;for(let t=0;t<i.length;t++){let r=i[t];r.width>0&&a>0&&a+r.width>n&&(e.push(``),a=0),e[e.length-1]+=r.value,a+=r.width,a===n&&t<i.length-1&&(e.push(``),a=0)}return!a&&e.at(-1).length>0&&e.length>1&&(e[e.length-2]+=e.pop()),Lt(e.at(-1))},en=e=>{if(!e.includes(` `))return e;let t=[];S(e,e=>{t.push({value:e,isEscape:!1})},e=>{t.push({value:e,isEscape:!0})});for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.isEscape)continue;let r=n.value.length;for(;r>0&&n.value[r-1]===` `;)r--;if(n.value=n.value.slice(0,r),At(n.value)>0)break}return t.map(e=>e.value).join(``)},tn=e=>{if(!e.includes(`	`))return e;let t=0,n=``,r=``;return S(e,e=>{let i=e.split(`	`);for(let[e,a]of i.entries())if(n+=a,r+=a,e<i.length-1){t+=At(r),r=``;let e=8-t%8;n+=` `.repeat(e),t+=e}},e=>{n+=e}),n},nn=e=>{let t=``,n,r=[],i=0,a=0;for(;i<e.length;){Mt.lastIndex=i;let o=Mt.exec(e);if(!o)break;if(i=o.index,o[0]!==`
`){let t=It(e,i);if(!t){i++;continue}let{groups:a}=t;a.sgr===void 0?a.uri!==void 0&&(n=a.uri.length===0?void 0:{parameters:a.parameters,uri:a.uri}):Jt(a.sgr,r),i+=t[0].length}else if(t+=e.slice(a,i),i>a&&(n&&(t+=Ft(``)),t+=Zt(r)),t+=`
`,i++,a=i,i<e.length&&e[i]!==`
`){let a=[...r];Xt(e,i,a),t+=Qt(a),n&&(t+=Ft(n.uri,n.parameters))}}return t+e.slice(a)},rn=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=zt(e),i=[``],a=0,o=-1,s=!0;for(let e of r){let r=i.length-1;if(n.trim!==!1&&o!==r){let e=i[r],t=e.trimStart();t.length!==e.length&&(i[r]=t,a=Lt(t)),t.length>0&&(o=r)}if(s?s=!1:(a>=t&&(n.wordWrap===!1||n.trim===!1)&&(i.push(``),a=0),(a>0||n.trim===!1)&&(i[i.length-1]+=` `,a++)),n.hard&&n.wordWrap!==!1&&e.width>t){let n=t-a,r=1+Math.floor((e.width-n-1)/t);Math.floor((e.width-1)/t)<r&&(i.push(``),a=0),a=$t(i,e.value,t,a)}else{if(a+e.width>t&&a>0&&e.width>0){if(n.wordWrap===!1&&a<t){a=$t(i,e.value,t,a);continue}i.push(``),a=0}a+e.width>t&&n.wordWrap===!1?a=$t(i,e.value,t,a):(i[i.length-1]+=e.value,a+=e.width)}}return n.trim!==!1&&(i=i.map(e=>en(e))),nn(i.join(`
`))},an=e=>{let t=``;return S(e,e=>{t+=e.normalize()},e=>{t+=e}),t};function on(e,t,n){return an(String(e)).replaceAll(`\r
`,`
`).split(`
`).map(e=>rn(tn(e),t,n)).join(`
`)}function sn(e){return t=>t.length>1?`${e} run ${t[0]} -- ${t.slice(1).join(` `)}`:`${e} run ${t[0]}`}const cn={agent:`yarn {0}`,run:`yarn run {0}`,install:`yarn install {0}`,frozen:`yarn install --frozen-lockfile`,global:`yarn global add {0}`,add:`yarn add {0}`,upgrade:`yarn upgrade {0}`,"upgrade-interactive":`yarn upgrade-interactive {0}`,execute:`npx {0}`,uninstall:`yarn remove {0}`,global_uninstall:`yarn global remove {0}`},ln={agent:`pnpm {0}`,run:`pnpm run {0}`,install:`pnpm i {0}`,frozen:`pnpm i --frozen-lockfile`,global:`pnpm add -g {0}`,add:`pnpm add {0}`,upgrade:`pnpm update {0}`,"upgrade-interactive":`pnpm update -i {0}`,execute:`pnpm dlx {0}`,uninstall:`pnpm remove {0}`,global_uninstall:`pnpm remove --global {0}`},un={agent:`bun {0}`,run:`bun run {0}`,install:`bun install {0}`,frozen:`bun install --no-save`,global:`bun add -g {0}`,add:`bun add {0}`,upgrade:`bun update {0}`,"upgrade-interactive":`bun update {0}`,execute:`bunx {0}`,uninstall:`bun remove {0}`,global_uninstall:`bun remove -g {0}`},dn={npm:{agent:`npm {0}`,run:sn(`npm`),install:`npm i {0}`,frozen:`npm ci`,global:`npm i -g {0}`,add:`npm i {0}`,upgrade:`npm update {0}`,"upgrade-interactive":null,execute:`npx {0}`,uninstall:`npm uninstall {0}`,global_uninstall:`npm uninstall -g {0}`},yarn:cn,"yarn@berry":{...cn,frozen:`yarn install --immutable`,upgrade:`yarn up {0}`,"upgrade-interactive":`yarn up -i {0}`,execute:`yarn dlx {0}`,global:`npm i -g {0}`,global_uninstall:`npm uninstall -g {0}`},pnpm:ln,"pnpm@6":{...ln,run:sn(`pnpm`)},bun:un},fn=Object.keys(dn),pn={"bun.lockb":`bun`,"pnpm-lock.yaml":`pnpm`,"yarn.lock":`yarn`,"package-lock.json":`npm`,"npm-shrinkwrap.json":`npm`},mn={bun:`https://bun.sh`,pnpm:`https://pnpm.io/installation`,"pnpm@6":`https://pnpm.io/6.x/installation`,yarn:`https://classic.yarnpkg.com/en/docs/install`,"yarn@berry":`https://yarnpkg.com/getting-started/install`,npm:`https://docs.npmjs.com/cli/v8/configuring-npm/install`};var C=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};function w(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}const{hasOwnProperty:hn}=Object.prototype,gn=(e,t={})=>{typeof t==`string`&&(t={section:t}),t.align=t.align===!0,t.newline=t.newline===!0,t.sort=t.sort===!0,t.whitespace=t.whitespace===!0||t.align===!0,t.platform=t.platform||typeof process<`u`&&process.platform,t.bracketedArray=t.bracketedArray!==!1;
/* istanbul ignore next */
let n=t.platform===`win32`?`\r
`:`
`,r=t.whitespace?` = `:`=`,i=[],a=t.sort?Object.keys(e).sort():Object.keys(e),o=0;t.align&&(o=T(a.filter(t=>e[t]===null||Array.isArray(e[t])||typeof e[t]!=`object`).map(t=>Array.isArray(e[t])?`${t}[]`:t).concat([``]).reduce((e,t)=>T(e).length>=T(t).length?e:t)).length);let s=``,c=t.bracketedArray?`[]`:``;for(let t of a){let a=e[t];if(a&&Array.isArray(a))for(let e of a)s+=T(`${t}${c}`).padEnd(o,` `)+r+T(e)+n;else a&&typeof a==`object`?i.push(t):s+=T(t).padEnd(o,` `)+r+T(a)+n}t.section&&s.length&&(s=`[`+T(t.section)+`]`+(t.newline?n+n:n)+s);for(let r of i){let i=_n(r,`.`).join(`\\.`),a=(t.section?t.section+`.`:``)+i,o=gn(e[r],{...t,section:a});s.length&&o.length&&(s+=n),s+=o}return s};function _n(e,t){var n=0,r=0,i=0,a=[];do if(i=e.indexOf(t,n),i!==-1){if(n=i+t.length,i>0&&e[i-1]===`\\`)continue;a.push(e.slice(r,i)),r=i+t.length}while(i!==-1);return a.push(e.slice(r)),a}const vn=(e,t={})=>{t.bracketedArray=t.bracketedArray!==!1;let n=Object.create(null),r=n,i=null,a=/^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i,o=e.split(/[\r\n]+/g),s={};for(let e of o){if(!e||e.match(/^\s*[;#]/)||e.match(/^\s*$/))continue;let o=e.match(a);if(!o)continue;if(o[1]!==void 0){if(i=bn(o[1]),i===`__proto__`){r=Object.create(null);continue}r=n[i]=n[i]||Object.create(null);continue}let c=bn(o[2]),l;t.bracketedArray?l=c.length>2&&c.slice(-2)===`[]`:(s[c]=(s?.[c]||0)+1,l=s[c]>1);let u=l?c.slice(0,-2):c;if(u===`__proto__`)continue;let d=!o[3]||bn(o[4]),f=d===`true`||d===`false`||d===`null`?JSON.parse(d):d;l&&(hn.call(r,u)?Array.isArray(r[u])||(r[u]=[r[u]]):r[u]=[]),Array.isArray(r[u])?r[u].push(f):r[u]=f}let c=[];for(let e of Object.keys(n)){if(!hn.call(n,e)||typeof n[e]!=`object`||Array.isArray(n[e]))continue;let t=_n(e,`.`);r=n;let i=t.pop(),a=i.replace(/\\\./g,`.`);for(let e of t)e!==`__proto__`&&(hn.call(r,e)&&typeof r[e]==`object`||(r[e]=Object.create(null)),r=r[e]);(r!==n||a!==i)&&(r[a]=n[e],c.push(e))}for(let e of c)delete n[e];return n},yn=e=>e.startsWith(`"`)&&e.endsWith(`"`)||e.startsWith(`'`)&&e.endsWith(`'`),T=e=>typeof e!=`string`||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&yn(e)||e!==e.trim()?JSON.stringify(e):e.split(`;`).join(`\\;`).split(`#`).join(`\\#`),bn=(e,t)=>{if(e=(e||``).trim(),yn(e)){e.charAt(0)===`'`&&(e=e.slice(1,-1));try{e=JSON.parse(e)}catch{}}else{let t=!1,n=``;for(let r=0,i=e.length;r<i;r++){let i=e.charAt(r);if(t)`\\;#`.indexOf(i)===-1?n+=`\\`+i:n+=i,t=!1;else if(`;#`.indexOf(i)!==-1)break;else i===`\\`?t=!0:n+=i}return t&&(n+=`\\`),n.trim()}return e},xn=/*@__PURE__*/ w({parse:vn,decode:vn,stringify:gn,encode:gn,safe:T,unsafe:bn});var E={exports:{}},Sn,Cn;function wn(){if(Cn)return Sn;Cn=1,Sn=r,r.sync=a;var e=i.default;function t(e,t){var n=t.pathExt===void 0?process.env.PATHEXT:t.pathExt;if(!n||(n=n.split(`;`),n.indexOf(``)!==-1))return!0;for(var r=0;r<n.length;r++){var i=n[r].toLowerCase();if(i&&e.substr(-i.length).toLowerCase()===i)return!0}return!1}function n(e,n,r){return!e.isSymbolicLink()&&!e.isFile()?!1:t(n,r)}function r(t,r,i){e.stat(t,function(e,a){i(e,!e&&n(a,t,r))})}function a(t,r){return n(e.statSync(t),t,r)}return Sn}var Tn,En;function Dn(){if(En)return Tn;En=1,Tn=t,t.sync=n;var e=i.default;function t(t,n,i){e.stat(t,function(e,t){i(e,!e&&r(t,n))})}function n(t,n){return r(e.statSync(t),n)}function r(e,t){return e.isFile()&&a(e,t)}function a(e,t){var n=e.mode,r=e.uid,i=e.gid,a=t.uid===void 0?process.getuid&&process.getuid():t.uid,o=t.gid===void 0?process.getgid&&process.getgid():t.gid,s=64,c=8,l=1,u=s|c;return n&l||n&c&&i===o||n&s&&r===a||n&u&&a===0}return Tn}var On=process.platform===`win32`||C.TESTING_WINDOWS?wn():Dn(),kn=An;An.sync=jn;function An(e,t,n){if(typeof t==`function`&&(n=t,t={}),!n){if(typeof Promise!=`function`)throw TypeError(`callback not provided`);return new Promise(function(n,r){An(e,t||{},function(e,t){e?r(e):n(t)})})}On(e,t||{},function(e,r){e&&(e.code===`EACCES`||t&&t.ignoreErrors)&&(e=null,r=!1),n(e,r)})}function jn(e,t){try{return On.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||e.code===`EACCES`)return!1;throw e}}const D=process.platform===`win32`||process.env.OSTYPE===`cygwin`||process.env.OSTYPE===`msys`,Mn=a.default,Nn=D?`;`:`:`,Pn=kn,Fn=e=>Object.assign(/* @__PURE__ */ Error(`not found: ${e}`),{code:`ENOENT`}),In=(e,t)=>{let n=t.colon||Nn,r=e.match(/\//)||D&&e.match(/\\/)?[``]:[...D?[process.cwd()]:[],...(t.path||process.env.PATH||
/* istanbul ignore next: very unusual */``).split(n)],i=D?t.pathExt||process.env.PATHEXT||`.EXE;.CMD;.BAT;.COM`:``,a=D?i.split(n):[``];return D&&e.indexOf(`.`)!==-1&&a[0]!==``&&a.unshift(``),{pathEnv:r,pathExt:a,pathExtExe:i}},Ln=(e,t,n)=>{typeof t==`function`&&(n=t,t={}),t||={};let{pathEnv:r,pathExt:i,pathExtExe:a}=In(e,t),o=[],s=n=>new Promise((i,a)=>{if(n===r.length)return t.all&&o.length?i(o):a(Fn(e));let s=r[n],l=/^".*"$/.test(s)?s.slice(1,-1):s,u=Mn.join(l,e),d=!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+u:u;i(c(d,n,0))}),c=(e,n,r)=>new Promise((l,u)=>{if(r===i.length)return l(s(n+1));let d=i[r];Pn(e+d,{pathExt:a},(i,a)=>{if(!i&&a){if(t.all)o.push(e+d);else return l(e+d)}return l(c(e,n,r+1))})});return n?s(0).then(e=>n(null,e),n):s(0)},Rn=(e,t)=>{t||={};let{pathEnv:n,pathExt:r,pathExtExe:i}=In(e,t),a=[];for(let o=0;o<n.length;o++){let s=n[o],c=/^".*"$/.test(s)?s.slice(1,-1):s,l=Mn.join(c,e),u=!c&&/^\.[\\\/]/.test(e)?e.slice(0,2)+l:l;for(let e=0;e<r.length;e++){let n=u+r[e];try{if(Pn.sync(n,{pathExt:i})){if(t.all)a.push(n);else return n}}catch{}}}if(t.all&&a.length)return a;if(t.nothrow)return null;throw Fn(e)};var zn=Ln;Ln.sync=Rn;var Bn={exports:{}};const Vn=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)===`win32`?Object.keys(t).reverse().find(e=>e.toUpperCase()===`PATH`)||`Path`:`PATH`};Bn.exports=Vn,Bn.exports.default=Vn;var Hn=Bn.exports;const Un=a.default,Wn=zn,Gn=Hn;function Kn(e,t){let n=e.options.env||process.env,r=process.cwd(),i=e.options.cwd!=null,a=i&&process.chdir!==void 0&&!process.chdir.disabled;if(a)try{process.chdir(e.options.cwd)}catch{}let o;try{o=Wn.sync(e.command,{path:n[Gn({env:n})],pathExt:t?Un.delimiter:void 0})}catch{}finally{a&&process.chdir(r)}return o&&=Un.resolve(i?e.options.cwd:``,o),o}function qn(e){return Kn(e)||Kn(e,!0)}var Jn=qn,Yn={};const Xn=/([()\][%!^"`<>&|;, *?])/g;function Zn(e){return e=e.replace(Xn,`^$1`),e}function Qn(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,`$1$1\\"`),e=e.replace(/(\\*)$/,`$1$1`),e=`"${e}"`,e=e.replace(Xn,`^$1`),t&&(e=e.replace(Xn,`^$1`)),e}Yn.command=Zn,Yn.argument=Qn;const $n=/^#!(.*)/;var er=(e=``)=>{let t=e.match($n);if(!t)return null;let[n,r]=t[0].replace(/#! ?/,``).split(` `),i=n.split(`/`).pop();return i===`env`?r:r?`${i} ${r}`:i};const tr=i.default,nr=er;function rr(e){let t=Buffer.alloc(150),n;try{n=tr.openSync(e,`r`),tr.readSync(n,t,0,150,0),tr.closeSync(n)}catch{}return nr(t.toString())}var ir=rr;const ar=a.default,or=Jn,sr=Yn,cr=ir,lr=process.platform===`win32`,ur=/\.(?:com|exe)$/i,dr=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function fr(e){e.file=or(e);let t=e.file&&cr(e.file);return t?(e.args.unshift(e.file),e.command=t,or(e)):e.file}function pr(e){if(!lr)return e;let t=fr(e),n=!ur.test(t);if(e.options.forceShell||n){let n=dr.test(t);e.command=ar.normalize(e.command),e.command=sr.command(e.command),e.args=e.args.map(e=>sr.argument(e,n)),e.args=[`/d`,`/s`,`/c`,`"${[e.command].concat(e.args).join(` `)}"`],e.command=process.env.comspec||`cmd.exe`,e.options.windowsVerbatimArguments=!0}return e}function mr(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:pr(r)}var hr=mr;const gr=process.platform===`win32`;function _r(e,t){return Object.assign(/* @__PURE__ */ Error(`${t} ${e.command} ENOENT`),{code:`ENOENT`,errno:`ENOENT`,syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function vr(e,t){if(!gr)return;let n=e.emit;e.emit=function(r,i){if(r===`exit`){let r=yr(i,t);if(r)return n.call(e,`error`,r)}return n.apply(e,arguments)}}function yr(e,t){return gr&&e===1&&!t.file?_r(t.original,`spawn`):null}function br(e,t){return gr&&e===1&&!t.file?_r(t.original,`spawnSync`):null}var xr={hookChildProcess:vr,verifyENOENT:yr,verifyENOENTSync:br,notFoundError:_r};const Sr=l.default,Cr=hr,wr=xr;function Tr(e,t,n){let r=Cr(e,t,n),i=Sr.spawn(r.command,r.args,r.options);return wr.hookChildProcess(i,r),i}function Er(e,t,n){let r=Cr(e,t,n),i=Sr.spawnSync(r.command,r.args,r.options);return i.error=i.error||wr.verifyENOENTSync(i.status,r),i}E.exports=Tr,E.exports.spawn=Tr,E.exports.sync=Er,E.exports._parse=Cr,E.exports._enoent=wr;var Dr=E.exports;const Or=/*@__PURE__*/ w(Dr);function kr(e){let t=typeof e==`string`?`
`:10,n=typeof e==`string`?`\r`:13;return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===n&&(e=e.slice(0,-1)),e}function Ar(e={}){let{env:t=process.env,platform:n=process.platform}=e;return n===`win32`?Object.keys(t).reverse().find(e=>e.toUpperCase()===`PATH`)||`Path`:`PATH`}function jr(e={}){let{cwd:t=h.default.cwd(),path:n=h.default.env[Ar()],execPath:r=h.default.execPath}=e,i,a=t instanceof URL?_.default.fileURLToPath(t):t,o=m.default.resolve(a),s=[];for(;i!==o;)s.push(m.default.join(o,`node_modules/.bin`)),i=o,o=m.default.resolve(o,`..`);return s.push(m.default.resolve(a,r,`..`)),[...s,n].join(m.default.delimiter)}function Mr({env:e=h.default.env,...t}={}){e={...e};let n=Ar({env:e});return t.path=e[n],e[n]=jr(t),e}const Nr=(e,t,n,r)=>{if(n===`length`||n===`prototype`||n===`arguments`||n===`caller`)return;let i=Object.getOwnPropertyDescriptor(e,n),a=Object.getOwnPropertyDescriptor(t,n);(Pr(i,a)||!r)&&Object.defineProperty(e,n,a)},Pr=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},Fr=(e,t)=>{let n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},Ir=(e,t)=>`/* Wrapped ${e}*/\n${t}`,Lr=Object.getOwnPropertyDescriptor(Function.prototype,`toString`),Rr=Object.getOwnPropertyDescriptor(Function.prototype.toString,`name`),zr=(e,t,n)=>{let r=n===``?``:`with ${n.trim()}() `,i=Ir.bind(null,r,t.toString());Object.defineProperty(i,"name",Rr),Object.defineProperty(e,"toString",{...Lr,value:i})};function Br(e,t,{ignoreNonConfigurable:n=!1}={}){let{name:r}=e;for(let r of Reflect.ownKeys(t))Nr(e,t,r,n);return Fr(e,t),zr(e,t,r),e}const Vr=/* @__PURE__ */ new WeakMap,Hr=(e,t={})=>{if(typeof e!=`function`)throw TypeError(`Expected a function`);let n,r=0,i=e.displayName||e.name||`<anonymous>`,a=function(...o){if(Vr.set(a,++r),r===1)n=e.apply(this,o),e=null;else if(t.throw===!0)throw Error(`Function \`${i}\` can only be called once`);return n};return Br(a,e),Vr.set(a,r),a};Hr.callCount=e=>{if(!Vr.has(e))throw Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Vr.get(e)};const Ur=()=>{let e=Kr-Gr+1;return Array.from({length:e},Wr)},Wr=(e,t)=>({name:`SIGRT${t+1}`,number:Gr+t,action:`terminate`,description:`Application-specific signal (realtime)`,standard:`posix`}),Gr=34,Kr=64,qr=[{name:`SIGHUP`,number:1,action:`terminate`,description:`Terminal closed`,standard:`posix`},{name:`SIGINT`,number:2,action:`terminate`,description:`User interruption with CTRL-C`,standard:`ansi`},{name:`SIGQUIT`,number:3,action:`core`,description:`User interruption with CTRL-\\`,standard:`posix`},{name:`SIGILL`,number:4,action:`core`,description:`Invalid machine instruction`,standard:`ansi`},{name:`SIGTRAP`,number:5,action:`core`,description:`Debugger breakpoint`,standard:`posix`},{name:`SIGABRT`,number:6,action:`core`,description:`Aborted`,standard:`ansi`},{name:`SIGIOT`,number:6,action:`core`,description:`Aborted`,standard:`bsd`},{name:`SIGBUS`,number:7,action:`core`,description:`Bus error due to misaligned, non-existing address or paging error`,standard:`bsd`},{name:`SIGEMT`,number:7,action:`terminate`,description:`Command should be emulated but is not implemented`,standard:`other`},{name:`SIGFPE`,number:8,action:`core`,description:`Floating point arithmetic error`,standard:`ansi`},{name:`SIGKILL`,number:9,action:`terminate`,description:`Forced termination`,standard:`posix`,forced:!0},{name:`SIGUSR1`,number:10,action:`terminate`,description:`Application-specific signal`,standard:`posix`},{name:`SIGSEGV`,number:11,action:`core`,description:`Segmentation fault`,standard:`ansi`},{name:`SIGUSR2`,number:12,action:`terminate`,description:`Application-specific signal`,standard:`posix`},{name:`SIGPIPE`,number:13,action:`terminate`,description:`Broken pipe or socket`,standard:`posix`},{name:`SIGALRM`,number:14,action:`terminate`,description:`Timeout or timer`,standard:`posix`},{name:`SIGTERM`,number:15,action:`terminate`,description:`Termination`,standard:`ansi`},{name:`SIGSTKFLT`,number:16,action:`terminate`,description:`Stack is empty or overflowed`,standard:`other`},{name:`SIGCHLD`,number:17,action:`ignore`,description:`Child process terminated, paused or unpaused`,standard:`posix`},{name:`SIGCLD`,number:17,action:`ignore`,description:`Child process terminated, paused or unpaused`,standard:`other`},{name:`SIGCONT`,number:18,action:`unpause`,description:`Unpaused`,standard:`posix`,forced:!0},{name:`SIGSTOP`,number:19,action:`pause`,description:`Paused`,standard:`posix`,forced:!0},{name:`SIGTSTP`,number:20,action:`pause`,description:`Paused using CTRL-Z or "suspend"`,standard:`posix`},{name:`SIGTTIN`,number:21,action:`pause`,description:`Background process cannot read terminal input`,standard:`posix`},{name:`SIGBREAK`,number:21,action:`terminate`,description:`User interruption with CTRL-BREAK`,standard:`other`},{name:`SIGTTOU`,number:22,action:`pause`,description:`Background process cannot write to terminal output`,standard:`posix`},{name:`SIGURG`,number:23,action:`ignore`,description:`Socket received out-of-band data`,standard:`bsd`},{name:`SIGXCPU`,number:24,action:`core`,description:`Process timed out`,standard:`bsd`},{name:`SIGXFSZ`,number:25,action:`core`,description:`File too big`,standard:`bsd`},{name:`SIGVTALRM`,number:26,action:`terminate`,description:`Timeout or timer`,standard:`bsd`},{name:`SIGPROF`,number:27,action:`terminate`,description:`Timeout or timer`,standard:`bsd`},{name:`SIGWINCH`,number:28,action:`ignore`,description:`Terminal window size changed`,standard:`bsd`},{name:`SIGIO`,number:29,action:`terminate`,description:`I/O is available`,standard:`other`},{name:`SIGPOLL`,number:29,action:`terminate`,description:`Watched event`,standard:`other`},{name:`SIGINFO`,number:29,action:`ignore`,description:`Request for process information`,standard:`other`},{name:`SIGPWR`,number:30,action:`terminate`,description:`Device running out of power`,standard:`systemv`},{name:`SIGSYS`,number:31,action:`core`,description:`Invalid system call`,standard:`other`},{name:`SIGUNUSED`,number:31,action:`terminate`,description:`Invalid system call`,standard:`other`}],Jr=()=>{let e=Ur();return[...qr,...e].map(Yr)},Yr=({name:e,number:t,description:n,action:r,forced:i=!1,standard:a})=>{let{signals:{[e]:o}}=p.constants,s=o!==void 0;return{name:e,number:s?o:t,description:n,supported:s,action:r,forced:i,standard:a}},Xr=()=>{let e=Jr();return Object.fromEntries(e.map(Zr))},Zr=({name:e,number:t,description:n,supported:r,action:i,forced:a,standard:o})=>[e,{name:e,number:t,description:n,supported:r,action:i,forced:a,standard:o}],Qr=Xr(),$r=()=>{let e=Jr(),t=Array.from({length:65},(t,n)=>ei(n,e));return Object.assign({},...t)},ei=(e,t)=>{let n=ti(e,t);if(n===void 0)return{};let{name:r,description:i,supported:a,action:o,forced:s,standard:c}=n;return{[e]:{name:r,number:e,description:i,supported:a,action:o,forced:s,standard:c}}},ti=(e,t)=>{let n=t.find(({name:t})=>p.constants.signals[t]===e);return n===void 0?t.find(t=>t.number===e):n};$r();const ni=({timedOut:e,timeout:t,errorCode:n,signal:r,signalDescription:i,exitCode:a,isCanceled:o})=>e?`timed out after ${t} milliseconds`:o?`was canceled`:n===void 0?r===void 0?a===void 0?`failed`:`failed with exit code ${a}`:`was killed with ${r} (${i})`:`failed with ${n}`,ri=({stdout:e,stderr:t,all:n,error:r,signal:i,exitCode:a,command:o,escapedCommand:s,timedOut:c,isCanceled:l,killed:u,parsed:{options:{timeout:d,cwd:f=h.default.cwd()}}})=>{a=a===null?void 0:a,i=i===null?void 0:i;let p=i===void 0?void 0:Qr[i].description,m=r&&r.code,g=`Command ${ni({timedOut:c,timeout:d,errorCode:m,signal:i,signalDescription:p,exitCode:a,isCanceled:l})}: ${o}`,_=Object.prototype.toString.call(r)===`[object Error]`,v=_?`${g}\n${r.message}`:g,y=[v,t,e].filter(Boolean).join(`
`);return _?(r.originalMessage=r.message,r.message=y):r=Error(y),r.shortMessage=v,r.command=o,r.escapedCommand=s,r.exitCode=a,r.signal=i,r.signalDescription=p,r.stdout=e,r.stderr=t,r.cwd=f,n!==void 0&&(r.all=n),`bufferedData`in r&&delete r.bufferedData,r.failed=!0,r.timedOut=!!c,r.isCanceled=l,r.killed=u&&!c,r},ii=[`stdin`,`stdout`,`stderr`],ai=e=>ii.some(t=>e[t]!==void 0),oi=e=>{if(!e)return;let{stdio:t}=e;if(t===void 0)return ii.map(t=>e[t]);if(ai(e))throw Error(`It's not possible to provide \`stdio\` in combination with one of ${ii.map(e=>`\`${e}\``).join(`, `)}`);if(typeof t==`string`)return t;if(!Array.isArray(t))throw TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let n=Math.max(t.length,ii.length);return Array.from({length:n},(e,n)=>t[n])},O=[];O.push(`SIGHUP`,`SIGINT`,`SIGTERM`),process.platform!==`win32`&&O.push(`SIGALRM`,`SIGABRT`,`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&O.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`);const si=e=>!!e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`,ci=Symbol.for(`signal-exit emitter`),li=globalThis,ui=Object.defineProperty.bind(Object);var di=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(li[ci])return li[ci];ui(li,ci,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){let n=this.listeners[e],r=n.indexOf(t);
/* c8 ignore start */
r!==-1&&
/* c8 ignore stop */
(r===0&&n.length===1?n.length=0:n.splice(r,1))}emit(e,t,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let r=!1;for(let i of this.listeners[e])r=i(t,n)===!0||r;return e===`exit`&&(r=this.emit(`afterExit`,t,n)||r),r}},fi=class{};const pi=e=>({onExit(t,n){return e.onExit(t,n)},load(){return e.load()},unload(){return e.unload()}});var mi=class extends fi{onExit(){return()=>{}}load(){}unload(){}},hi=class extends fi{
/* c8 ignore start */
#e=gi.platform===`win32`?`SIGINT`:`SIGHUP`;
/* c8 ignore stop */
#t=new di;#n;#r;#i;#a={};#o=!1;constructor(e){super(),this.#n=e,this.#a={};for(let t of O)this.#a[t]=()=>{let n=this.#n.listeners(t),{count:r}=this.#t,i=e;
/* c8 ignore stop */
if(typeof i.__signal_exit_emitter__==`object`&&typeof i.__signal_exit_emitter__.count==`number`&&(r+=i.__signal_exit_emitter__.count),n.length===r){this.unload();let n=this.#t.emit(`exit`,null,t),r=t===`SIGHUP`?this.#e:t;n||e.kill(e.pid,r)}};this.#i=e.reallyExit,this.#r=e.emit}onExit(e,t){
/* c8 ignore start */
if(!si(this.#n))return()=>{};
/* c8 ignore stop */
this.#o===!1&&this.load();let n=t?.alwaysLast?`afterExit`:`exit`;return this.#t.on(n,e),()=>{this.#t.removeListener(n,e),this.#t.listeners.exit.length===0&&this.#t.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#t.count+=1;for(let e of O)try{let t=this.#a[e];t&&this.#n.on(e,t)}catch{}this.#n.emit=(e,...t)=>this.#c(e,...t),this.#n.reallyExit=e=>this.#s(e)}}unload(){this.#o&&(this.#o=!1,O.forEach(e=>{let t=this.#a[e];
/* c8 ignore start */
if(!t)throw Error(`Listener not defined for signal: `+e);
/* c8 ignore stop */
try{this.#n.removeListener(e,t)}catch{}
/* c8 ignore stop */
}),this.#n.emit=this.#r,this.#n.reallyExit=this.#i,--this.#t.count)}#s(e){return si(this.#n)?
/* c8 ignore stop */
(this.#n.exitCode=e||0,this.#t.emit(`exit`,this.#n.exitCode,null),this.#i.call(this.#n,this.#n.exitCode)):0}#c(e,...t){let n=this.#r;if(e===`exit`&&si(this.#n)){typeof t[0]==`number`&&(this.#n.exitCode=t[0]);
/* c8 ignore start */
let r=n.call(this.#n,e,...t);
/* c8 ignore stop */
return this.#t.emit(`exit`,this.#n.exitCode,null),r}return n.call(this.#n,e,...t)}};const gi=globalThis.process,{onExit:_i,load:vi,unload:yi}=pi(si(gi)?new hi(gi):new mi),bi=(e,t=`SIGTERM`,n={})=>{let r=e(t);return xi(e,t,n,r),r},xi=(e,t,n,r)=>{if(!Si(t,n,r))return;let i=wi(n),a=setTimeout(()=>{e(`SIGKILL`)},i);
// istanbul ignore else
a.unref&&a.unref()},Si=(e,{forceKillAfterTimeout:t},n)=>Ci(e)&&t!==!1&&n,Ci=e=>e===p.default.constants.signals.SIGTERM||typeof e==`string`&&e.toUpperCase()===`SIGTERM`,wi=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return 5e3;if(!Number.isFinite(e)||e<0)throw TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Ti=(e,t)=>{e.kill()&&(t.isCanceled=!0)},Ei=(e,t,n)=>{e.kill(t),n(Object.assign(/* @__PURE__ */ Error(`Timed out`),{timedOut:!0,signal:t}))},Di=(e,{timeout:t,killSignal:n=`SIGTERM`},r)=>{if(t===0||t===void 0)return r;let i,a=new Promise((r,a)=>{i=setTimeout(()=>{Ei(e,n,a)},t)}),o=r.finally(()=>{clearTimeout(i)});return Promise.race([a,o])},Oi=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},ki=async(e,{cleanup:t,detached:n},r)=>{if(!t||n)return r;let i=_i(()=>{e.kill()});return r.finally(()=>{i()})};function Ai(e){return typeof e==`object`&&!!e&&typeof e.pipe==`function`}function ji(e){return Ai(e)&&e.writable!==!1&&typeof e._write==`function`&&typeof e._writableState==`object`}const Mi=e=>e instanceof d.ChildProcess&&typeof e.then==`function`,Ni=(e,t,n)=>{if(typeof n==`string`)return e[t].pipe((0,f.createWriteStream)(n)),e;if(ji(n))return e[t].pipe(n),e;if(!Mi(n))throw TypeError(`The second argument must be a string, a stream or an Execa child process.`);if(!ji(n.stdin))throw TypeError(`The target child process's stdin must be available.`);return e[t].pipe(n.stdin),n},Pi=e=>{e.stdout!==null&&(e.pipeStdout=Ni.bind(void 0,e,`stdout`)),e.stderr!==null&&(e.pipeStderr=Ni.bind(void 0,e,`stderr`)),e.all!==void 0&&(e.pipeAll=Ni.bind(void 0,e,`all`))},Fi=async(e,{init:t,convertChunk:n,getSize:r,truncateChunk:i,addChunk:a,getFinalChunk:o,finalize:s},{maxBuffer:c=1/0}={})=>{if(!zi(e))throw Error(`The first argument must be a Readable, a ReadableStream, or an async iterable.`);let l=t();l.length=0;try{for await(let t of e){let e=n[Bi(t)](t,l);Li({convertedChunk:e,state:l,getSize:r,truncateChunk:i,addChunk:a,maxBuffer:c})}return Ii({state:l,convertChunk:n,getSize:r,truncateChunk:i,addChunk:a,getFinalChunk:o,maxBuffer:c}),s(l)}catch(e){throw e.bufferedData=s(l),e}},Ii=({state:e,getSize:t,truncateChunk:n,addChunk:r,getFinalChunk:i,maxBuffer:a})=>{let o=i(e);o!==void 0&&Li({convertedChunk:o,state:e,getSize:t,truncateChunk:n,addChunk:r,maxBuffer:a})},Li=({convertedChunk:e,state:t,getSize:n,truncateChunk:r,addChunk:i,maxBuffer:a})=>{let o=n(e),s=t.length+o;if(s<=a){Ri(e,t,i,s);return}let c=r(e,a-t.length);throw c!==void 0&&Ri(c,t,i,a),new Hi},Ri=(e,t,n,r)=>{t.contents=n(e,t,r),t.length=r},zi=e=>typeof e==`object`&&!!e&&typeof e[Symbol.asyncIterator]==`function`,Bi=e=>{let t=typeof e;if(t===`string`)return`string`;if(t!==`object`||e===null)return`others`;if(globalThis.Buffer?.isBuffer(e))return`buffer`;let n=Vi.call(e);return n===`[object ArrayBuffer]`?`arrayBuffer`:n===`[object DataView]`?`dataView`:Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&Vi.call(e.buffer)===`[object ArrayBuffer]`?`typedArray`:`others`},{toString:Vi}=Object.prototype;var Hi=class extends Error{name=`MaxBufferError`;constructor(){super(`maxBuffer exceeded`)}};const Ui=e=>e,Wi=()=>void 0,Gi=({contents:e})=>e,Ki=e=>{throw Error(`Streams in object mode are not supported: ${String(e)}`)},qi=e=>e.length;async function Ji(e,t){return Fi(e,ca,t)}const Yi=()=>({contents:/* @__PURE__ */ new ArrayBuffer(0)}),Xi=e=>Zi.encode(e),Zi=new TextEncoder,Qi=e=>new Uint8Array(e),$i=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),ea=(e,t)=>e.slice(0,t),ta=(e,{contents:t,length:n},r)=>{let i=sa()?ra(t,r):na(t,r);return new Uint8Array(i).set(e,n),i},na=(e,t)=>{if(t<=e.byteLength)return e;let n=new ArrayBuffer(ia(t));return new Uint8Array(n).set(new Uint8Array(e),0),n},ra=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let n=new ArrayBuffer(t,{maxByteLength:ia(t)});return new Uint8Array(n).set(new Uint8Array(e),0),n},ia=e=>aa**Math.ceil(Math.log(e)/Math.log(aa)),aa=2,oa=({contents:e,length:t})=>sa()?e:e.slice(0,t),sa=()=>`resize`in ArrayBuffer.prototype,ca={init:Yi,convertChunk:{string:Xi,buffer:Qi,arrayBuffer:Qi,dataView:$i,typedArray:$i,others:Ki},getSize:qi,truncateChunk:ea,addChunk:ta,getFinalChunk:Wi,finalize:oa};async function la(e,t){if(!(`Buffer`in globalThis))throw Error(`getStreamAsBuffer() is only supported in Node.js`);try{return ua(await Ji(e,t))}catch(e){throw e.bufferedData!==void 0&&(e.bufferedData=ua(e.bufferedData)),e}}const ua=e=>globalThis.Buffer.from(e);async function da(e,t){return Fi(e,ma,t)}const fa=()=>({contents:``,textDecoder:new TextDecoder}),pa=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),ma={init:fa,convertChunk:{string:Ui,buffer:pa,arrayBuffer:pa,dataView:pa,typedArray:pa,others:Ki},getSize:qi,truncateChunk:(e,t)=>e.slice(0,t),addChunk:(e,{contents:t})=>t+e,getFinalChunk:({textDecoder:e})=>{let t=e.decode();return t===``?void 0:t},finalize:Gi},{PassThrough:ha}=ee.default,ga=/*@__PURE__*/ w(function(){var e=[],t=new ha({objectMode:!0});return t.setMaxListeners(0),t.add=n,t.isEmpty=r,t.on(`unpipe`,i),Array.prototype.slice.call(arguments).forEach(n),t;function n(r){return Array.isArray(r)?(r.forEach(n),this):(e.push(r),r.once(`end`,i.bind(null,r)),r.once(`error`,t.emit.bind(t,`error`)),r.pipe(t,{end:!1}),this)}function r(){return e.length==0}function i(n){e=e.filter(function(e){return e!==n}),!e.length&&t.readable&&t.end()}}),_a=e=>{if(e!==void 0)throw TypeError("The `input` and `inputFile` options cannot be both set.")},va=({input:e,inputFile:t})=>typeof t==`string`?(_a(e),(0,f.createReadStream)(t)):e,ya=(e,t)=>{let n=va(t);n!==void 0&&(Ai(n)?n.pipe(e.stdin):e.stdin.end(n))},ba=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;let n=ga();return e.stdout&&n.add(e.stdout),e.stderr&&n.add(e.stderr),n},xa=async(e,t)=>{if(e&&t!==void 0){await(0,y.setTimeout)(0),e.destroy();try{return await t}catch(e){return e.bufferedData}}},Sa=(e,{encoding:t,buffer:n,maxBuffer:r})=>{if(e&&n)return t===`utf8`||t===`utf-8`?da(e,{maxBuffer:r}):t===null||t===`buffer`?la(e,{maxBuffer:r}):Ca(e,r,t)},Ca=async(e,t,n)=>(await la(e,{maxBuffer:t})).toString(n),wa=async({stdout:e,stderr:t,all:n},{encoding:r,buffer:i,maxBuffer:a},o)=>{let s=Sa(e,{encoding:r,buffer:i,maxBuffer:a}),c=Sa(t,{encoding:r,buffer:i,maxBuffer:a}),l=Sa(n,{encoding:r,buffer:i,maxBuffer:a*2});try{return await Promise.all([o,s,c,l])}catch(r){return Promise.all([{error:r,signal:r.signal,timedOut:r.timedOut},xa(e,s),xa(t,c),xa(n,l)])}},Ta=(async()=>{})().constructor.prototype,Ea=[`then`,`catch`,`finally`].map(e=>[e,Reflect.getOwnPropertyDescriptor(Ta,e)]),Da=(e,t)=>{for(let[n,r]of Ea){let i=typeof t==`function`?(...e)=>Reflect.apply(r.value,t(),e):r.value.bind(t);Reflect.defineProperty(e,n,{...r,value:i})}},Oa=e=>new Promise((t,n)=>{e.on(`exit`,(e,n)=>{t({exitCode:e,signal:n})}),e.on(`error`,e=>{n(e)}),e.stdin&&e.stdin.on(`error`,e=>{n(e)})}),ka=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],Aa=/^[\w.-]+$/,ja=e=>typeof e!=`string`||Aa.test(e)?e:`"${e.replaceAll(`"`,`\\"`)}"`,Ma=(e,t)=>ka(e,t).join(` `),Na=(e,t)=>ka(e,t).map(e=>ja(e)).join(` `),Pa=/ +/g,Fa=e=>{let t=[];for(let n of e.trim().split(Pa)){let e=t.at(-1);e&&e.endsWith(`\\`)?t[t.length-1]=`${e.slice(0,-1)} ${n}`:t.push(n)}return t},Ia=(0,u.debuglog)(`execa`).enabled,La=(e,t)=>String(e).padStart(t,`0`),Ra=()=>{let e=/* @__PURE__ */ new Date;return`${La(e.getHours(),2)}:${La(e.getMinutes(),2)}:${La(e.getSeconds(),2)}.${La(e.getMilliseconds(),3)}`},za=(e,{verbose:t})=>{t&&h.default.stderr.write(`[${Ra()}] ${e}\n`)},Ba=({env:e,extendEnv:t,preferLocal:n,localDir:r,execPath:i})=>{let a=t?{...h.default.env,...e}:e;return n?Mr({env:a,cwd:r,execPath:i}):a},Va=(e,t,n={})=>{let r=Or._parse(e,t,n);return e=r.command,t=r.args,n=r.options,n={maxBuffer:1e8,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:n.cwd||h.default.cwd(),execPath:h.default.execPath,encoding:`utf8`,reject:!0,cleanup:!0,all:!1,windowsHide:!0,verbose:Ia,...n},n.env=Ba(n),n.stdio=oi(n),h.default.platform===`win32`&&m.default.basename(e,`.exe`)===`cmd`&&t.unshift(`/q`),{file:e,args:t,options:n,parsed:r}},Ha=(e,t,n)=>typeof t!=`string`&&!v.Buffer.isBuffer(t)?n===void 0?void 0:``:e.stripFinalNewline?kr(t):t;function Ua(e,t,n){let r=Va(e,t,n),i=Ma(e,t),a=Na(e,t);za(a,r.options),Oi(r.options);let o;try{o=d.default.spawn(r.file,r.args,r.options)}catch(e){let t=new d.default.ChildProcess,n=Promise.reject(ri({error:e,stdout:``,stderr:``,all:``,command:i,escapedCommand:a,parsed:r,timedOut:!1,isCanceled:!1,killed:!1}));return Da(t,n),t}let s=Oa(o),c=Di(o,r.options,s),l=ki(o,r.options,c);o.kill=bi.bind(null,o.kill.bind(o)),o.cancel=Ti.bind(null,o,{isCanceled:!1});let u=Hr(async()=>{let[{error:e,exitCode:t,signal:n,timedOut:s},c,u,d]=await wa(o,r.options,l),f=Ha(r.options,c),p=Ha(r.options,u),m=Ha(r.options,d);if(e||t!==0||n!==null){let c=ri({error:e,exitCode:t,signal:n,stdout:f,stderr:p,all:m,command:i,escapedCommand:a,parsed:r,timedOut:s,isCanceled:r.options.signal?r.options.signal.aborted:!1,killed:o.killed});if(!r.options.reject)return c;throw c}return{command:i,escapedCommand:a,exitCode:0,stdout:f,stderr:p,all:m,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return ya(o,r.options),o.all=ba(o,r.options),Pi(o),Da(o,u),o}function Wa(e,t){let[n,...r]=Fa(e);return Ua(n,r,t)}var Ga=class{value;next;constructor(e){this.value=e}},Ka=class{#e;#t;#n;constructor(){this.clear()}enqueue(e){let t=new Ga(e);this.#e?(this.#t.next=t,this.#t=t):(this.#e=t,this.#t=t),this.#n++}dequeue(){let e=this.#e;if(e)return this.#e=this.#e.next,this.#n--,e.value}clear(){this.#e=void 0,this.#t=void 0,this.#n=0}get size(){return this.#n}*[Symbol.iterator](){let e=this.#e;for(;e;)yield e.value,e=e.next}};function qa(e){if(!((Number.isInteger(e)||e===1/0)&&e>0))throw TypeError("Expected `concurrency` to be a number from 1 and up");let t=new Ka,n=0,r=()=>{n--,t.size>0&&t.dequeue()()},i=async(e,t,i)=>{n++;let a=(async()=>e(...i))();t(a);try{await a}catch{}r()},a=(r,a,o)=>{t.enqueue(i.bind(void 0,r,a,o)),(async()=>{await Promise.resolve(),n<e&&t.size>0&&t.dequeue()()})()},o=(e,...t)=>new Promise(n=>{a(e,n,t)});return Object.defineProperties(o,{activeCount:{get:()=>n},pendingCount:{get:()=>t.size},clearQueue:{value:()=>{t.clear()}}}),o}var Ja=class extends Error{constructor(e){super(),this.value=e}};const Ya=async(e,t)=>t(await e),Xa=async e=>{let t=await Promise.all(e);if(t[1]===!0)throw new Ja(t[0]);return!1};async function Za(e,t,{concurrency:n=1/0,preserveOrder:r=!0}={}){let i=qa(n),a=[...e].map(e=>[e,i(Ya,e,t)]),o=qa(r?1:1/0);try{await Promise.all(a.map(e=>o(Xa,e)))}catch(e){if(e instanceof Ja)return e.value;throw e}}const Qa={directory:`isDirectory`,file:`isFile`};function $a(e){if(!Object.hasOwnProperty.call(Qa,e))throw Error(`Invalid type specified: ${e}`)}const eo=(e,t)=>t[Qa[e]](),to=e=>e instanceof URL?(0,_.fileURLToPath)(e):e;async function no(e,{cwd:t=h.default.cwd(),type:n=`file`,allowSymlinks:r=!0,concurrency:i,preserveOrder:a}={}){$a(n),t=to(t);let o=r?f.promises.stat:f.promises.lstat;return Za(e,async e=>{try{let r=await o(m.default.resolve(t,e));return eo(n,r)}catch{return!1}},{concurrency:i,preserveOrder:a})}const ro=e=>e instanceof URL?(0,_.fileURLToPath)(e):e,io=Symbol(`findUpStop`);async function ao(e,t={}){let n=m.default.resolve(ro(t.cwd)||``),{root:r}=m.default.parse(n),i=m.default.resolve(n,t.stopAt||r),a=t.limit||1/0,o=[e].flat(),s=async t=>{if(typeof e!=`function`)return no(o,t);let n=await e(t.cwd);return typeof n==`string`?no([n],t):n},c=[];for(;;){let e=await s({...t,cwd:n});if(e===io||(e&&c.push(m.default.resolve(n,e)),n===i||c.length>=a))break;n=m.default.dirname(n)}return c}async function oo(e,t={}){return(await ao(e,{...t,limit:1}))[0]}const so=process.env.TERM_PROGRAM===`Apple_Terminal`,k={};k.cursorTo=(e,t)=>{if(typeof e!=`number`)throw TypeError("The `x` argument is required");return typeof t==`number`?`\x1B[`+(t+1)+`;`+(e+1)+`H`:`\x1B[`+(e+1)+`G`},k.cursorMove=(e,t)=>{if(typeof e!=`number`)throw TypeError("The `x` argument is required");let n=``;return e<0?n+=`\x1B[`+-e+`D`:e>0&&(n+=`\x1B[`+e+`C`),t<0?n+=`\x1B[`+-t+`A`:t>0&&(n+=`\x1B[`+t+`B`),n},k.cursorUp=(e=1)=>`\x1B[`+e+`A`,k.cursorDown=(e=1)=>`\x1B[`+e+`B`,k.cursorForward=(e=1)=>`\x1B[`+e+`C`,k.cursorBackward=(e=1)=>`\x1B[`+e+`D`,k.cursorLeft=`\x1B[G`,k.cursorSavePosition=so?`\x1B7`:`\x1B[s`,k.cursorRestorePosition=so?`\x1B8`:`\x1B[u`,k.cursorGetPosition=`\x1B[6n`,k.cursorNextLine=`\x1B[E`,k.cursorPrevLine=`\x1B[F`,k.cursorHide=`\x1B[?25l`,k.cursorShow=`\x1B[?25h`,k.eraseLines=e=>{let t=``;for(let n=0;n<e;n++)t+=k.eraseLine+(n<e-1?k.cursorUp():``);return e&&(t+=k.cursorLeft),t},k.eraseEndLine=`\x1B[K`,k.eraseStartLine=`\x1B[1K`,k.eraseLine=`\x1B[2K`,k.eraseDown=`\x1B[J`,k.eraseUp=`\x1B[1J`,k.eraseScreen=`\x1B[2J`,k.scrollUp=`\x1B[S`,k.scrollDown=`\x1B[T`,k.clearScreen=`\x1Bc`,k.clearTerminal=process.platform===`win32`?`${k.eraseScreen}`:`${k.eraseScreen}`,k.beep=`\x07`,k.link=(e,t)=>[`\x1B]`,`8`,`;`,`;`,t,`\x07`,e,`\x1B]`,`8`,`;`,`;`,`\x07`].join(``),k.image=(e,t={})=>{let n=`\x1B]1337;File=inline=1`;return t.width&&(n+=`;width=${t.width}`),t.height&&(n+=`;height=${t.height}`),t.preserveAspectRatio===!1&&(n+=`;preserveAspectRatio=0`),n+`:`+e.toString(`base64`)+`\x07`},k.iTerm={setCwd:(e=process.cwd())=>`]50;CurrentDir=${e}`,annotation:(e,t={})=>{let n=`\x1B]1337;`,r=t.x!==void 0,i=t.y!==void 0;if((r||i)&&!(r&&i&&t.length!==void 0))throw Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");return e=e.replace(/\|/g,``),n+=t.isHidden?`AddHiddenAnnotation=`:`AddAnnotation=`,t.length>0?n+=(r?[e,t.length,t.x,t.y]:[t.length,e]).join(`|`):n+=e,n+`\x07`}};var co=(e,t=process.argv)=>{let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)};const lo=o.default,uo=s.default,A=co,{env:j}=process;let M;A(`no-color`)||A(`no-colors`)||A(`color=false`)||A(`color=never`)?M=0:(A(`color`)||A(`colors`)||A(`color=true`)||A(`color=always`))&&(M=1),`FORCE_COLOR`in j&&(M=j.FORCE_COLOR===`true`?1:j.FORCE_COLOR===`false`?0:j.FORCE_COLOR.length===0?1:Math.min(parseInt(j.FORCE_COLOR,10),3));function fo(e){return e!==0&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function po(e,t){if(M===0)return 0;if(A(`color=16m`)||A(`color=full`)||A(`color=truecolor`))return 3;if(A(`color=256`))return 2;if(e&&!t&&M===void 0)return 0;let n=M||0;if(j.TERM===`dumb`)return n;if(process.platform===`win32`){let e=lo.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in j)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`].some(e=>e in j)||j.CI_NAME===`codeship`?1:n;if(`TEAMCITY_VERSION`in j)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(j.TEAMCITY_VERSION);if(j.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in j){let e=parseInt((j.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(j.TERM_PROGRAM){case`iTerm.app`:return e>=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:n}function mo(e){return fo(po(e,e&&e.isTTY))}const ho={supportsColor:mo,stdout:fo(po(!0,uo.isatty(1))),stderr:fo(po(!0,uo.isatty(2)))},N=co;function go(e){if(/^\d{3,4}$/.test(e)){let t=/(\d{1,2})(\d{2})/.exec(e);return{major:0,minor:parseInt(t[1],10),patch:parseInt(t[2],10)}}let t=(e||``).split(`.`).map(e=>parseInt(e,10));return{major:t[0],minor:t[1],patch:t[2]}}function _o(e){let{env:t}=process;if(`FORCE_HYPERLINK`in t)return!(t.FORCE_HYPERLINK.length>0&&parseInt(t.FORCE_HYPERLINK,10)===0);if(N(`no-hyperlink`)||N(`no-hyperlinks`)||N(`hyperlink=false`)||N(`hyperlink=never`))return!1;if(N(`hyperlink=true`)||N(`hyperlink=always`))return!0;if(!ho.supportsColor(e)||e&&!e.isTTY||process.platform===`win32`)return!1;if(`NETLIFY`in t)return!0;if(`CI`in t||`TEAMCITY_VERSION`in t)return!1;if(`TERM_PROGRAM`in t){let e=go(t.TERM_PROGRAM_VERSION);if(t.TERM_PROGRAM===`iTerm.app`)return e.major===3?e.minor>=1:e.major>3}if(`VTE_VERSION`in t){if(t.VTE_VERSION===`0.50.0`)return!1;let e=go(t.VTE_VERSION);return e.major>0||e.minor>=50}return!1}const vo=/*@__PURE__*/ w({supportsHyperlink:_o,stdout:_o(process.stdout),stderr:_o(process.stderr)});function yo(e,t,{target:n=`stdout`,...r}={}){return vo[n]?k.link(e,t):r.fallback===!1?e:typeof r.fallback==`function`?r.fallback(e,t):`${e} (\u200B${t}\u200B)`}yo.isSupported=vo.stdout,yo.stderr=(e,t,n={})=>yo(e,t,{target:`stderr`,...n}),yo.stderr.isSupported=vo.stderr;var bo={};let xo,So,Co,wo,To=!0;typeof process<`u`&&({FORCE_COLOR:xo,NODE_DISABLE_COLORS:So,NO_COLOR:Co,TERM:wo}=process.env||{},To=process.stdout&&process.stdout.isTTY);const P={enabled:!So&&Co==null&&wo!==`dumb`&&(xo!=null&&xo!==`0`||To),reset:F(0,0),bold:F(1,22),dim:F(2,22),italic:F(3,23),underline:F(4,24),inverse:F(7,27),hidden:F(8,28),strikethrough:F(9,29),black:F(30,39),red:F(31,39),green:F(32,39),yellow:F(33,39),blue:F(34,39),magenta:F(35,39),cyan:F(36,39),white:F(37,39),gray:F(90,39),grey:F(90,39),bgBlack:F(40,49),bgRed:F(41,49),bgGreen:F(42,49),bgYellow:F(43,49),bgBlue:F(44,49),bgMagenta:F(45,49),bgCyan:F(46,49),bgWhite:F(47,49)};function Eo(e,t){let n=0,r,i=``,a=``;for(;n<e.length;n++)r=e[n],i+=r.open,a+=r.close,~t.indexOf(r.close)&&(t=t.replace(r.rgx,r.close+r.open));return i+t+a}function Do(e,t){let n={has:e,keys:t};return n.reset=P.reset.bind(n),n.bold=P.bold.bind(n),n.dim=P.dim.bind(n),n.italic=P.italic.bind(n),n.underline=P.underline.bind(n),n.inverse=P.inverse.bind(n),n.hidden=P.hidden.bind(n),n.strikethrough=P.strikethrough.bind(n),n.black=P.black.bind(n),n.red=P.red.bind(n),n.green=P.green.bind(n),n.yellow=P.yellow.bind(n),n.blue=P.blue.bind(n),n.magenta=P.magenta.bind(n),n.cyan=P.cyan.bind(n),n.white=P.white.bind(n),n.gray=P.gray.bind(n),n.grey=P.grey.bind(n),n.bgBlack=P.bgBlack.bind(n),n.bgRed=P.bgRed.bind(n),n.bgGreen=P.bgGreen.bind(n),n.bgYellow=P.bgYellow.bind(n),n.bgBlue=P.bgBlue.bind(n),n.bgMagenta=P.bgMagenta.bind(n),n.bgCyan=P.bgCyan.bind(n),n.bgWhite=P.bgWhite.bind(n),n}function F(e,t){let n={open:`\x1b[${e}m`,close:`\x1b[${t}m`,rgx:RegExp(`\\x1b\\[${t}m`,`g`)};return function(t){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(e)||(this.has.push(e),this.keys.push(n)),t===void 0?this:P.enabled?Eo(this.keys,t+``):t+``):t===void 0?Do([e],[n]):P.enabled?Eo([n],t+``):t+``}}var I=P,Oo=(e,t)=>{if(!(e.meta&&e.name!==`escape`)){if(e.ctrl)return e.name===`a`?`first`:e.name===`c`||e.name===`d`?`abort`:e.name===`e`?`last`:e.name===`g`?`reset`:e.name===`n`?`down`:e.name===`p`?`up`:void 0;if(t){if(e.name===`j`)return`down`;if(e.name===`k`)return`up`}return e.name===`return`||e.name===`enter`?`submit`:e.name===`backspace`?`delete`:e.name===`delete`?`deleteForward`:e.name===`abort`?`abort`:e.name===`escape`?`exit`:e.name===`tab`?`next`:e.name===`pagedown`?`nextPage`:e.name===`pageup`?`prevPage`:e.name===`home`?`home`:e.name===`end`?`end`:e.name===`up`?`up`:e.name===`down`?`down`:e.name===`right`?`right`:e.name===`left`&&`left`}},ko=e=>{let t=/* @__PURE__ */ RegExp(`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))`,`g`);return typeof e==`string`?e.replace(t,``):e};const Ao={to(e,t){return t?`[${t+1};${e+1}H`:`[${e+1}G`},move(e,t){let n=``;return e<0?n+=`[${-e}D`:e>0&&(n+=`[${e}C`),t<0?n+=`[${-t}A`:t>0&&(n+=`[${t}B`),n},up:(e=1)=>`[${e}A`,down:(e=1)=>`[${e}B`,forward:(e=1)=>`[${e}C`,backward:(e=1)=>`[${e}D`,nextLine:(e=1)=>`\x1B[E`.repeat(e),prevLine:(e=1)=>`\x1B[F`.repeat(e),left:`\x1B[G`,hide:`\x1B[?25l`,show:`\x1B[?25h`,save:`\x1B7`,restore:`\x1B8`};var L={cursor:Ao,scroll:{up:(e=1)=>`\x1B[S`.repeat(e),down:(e=1)=>`\x1B[T`.repeat(e)},erase:{screen:`\x1B[2J`,up:(e=1)=>`\x1B[1J`.repeat(e),down:(e=1)=>`\x1B[J`.repeat(e),line:`\x1B[2K`,lineEnd:`\x1B[K`,lineStart:`\x1B[1K`,lines(e){let t=``;for(let n=0;n<e;n++)t+=this.line+(n<e-1?Ao.up():``);return e&&(t+=Ao.left),t}},beep:`\x07`};const jo=ko,{erase:Mo,cursor:No}=L,Po=e=>[...jo(e)].length;var Fo=function(e,t){if(!t)return Mo.line+No.to(0);let n=0,r=e.split(/\r?\n/);for(let e of r)n+=1+Math.floor(Math.max(Po(e)-1,0)/t);return Mo.lines(n)};const Io={arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,radioOn:`◉`,radioOff:`◯`,tick:`✔`,cross:`✖`,ellipsis:`…`,pointerSmall:`›`,line:`─`,pointer:`❯`},Lo={arrowUp:Io.arrowUp,arrowDown:Io.arrowDown,arrowLeft:Io.arrowLeft,arrowRight:Io.arrowRight,radioOn:`(*)`,radioOff:`( )`,tick:`√`,cross:`×`,ellipsis:`...`,pointerSmall:`»`,line:`─`,pointer:`>`};var Ro=process.platform===`win32`?Lo:Io;const R=I,z=Ro,zo=Object.freeze({password:{scale:1,render:e=>`*`.repeat(e.length)},emoji:{scale:2,render:e=>`😃`.repeat(e.length)},invisible:{scale:0,render:e=>``},default:{scale:1,render:e=>`${e}`}}),Bo=e=>zo[e]||zo.default,Vo=Object.freeze({aborted:R.red(z.cross),done:R.green(z.tick),exited:R.yellow(z.cross),default:R.cyan(`?`)});var Ho={styles:zo,render:Bo,symbols:Vo,symbol:(e,t,n)=>t?Vo.aborted:n?Vo.exited:e?Vo.done:Vo.default,delimiter:e=>R.gray(e?z.ellipsis:z.pointerSmall),item:(e,t)=>R.gray(e?t?z.pointerSmall:`+`:z.line)};const Uo=ko;var B={action:Oo,clear:Fo,style:Ho,strip:ko,figures:Ro,lines:function(e,t){let n=String(Uo(e)||``).split(/\r?\n/);return t?n.map(e=>Math.ceil(e.length/t)).reduce((e,t)=>e+t):n.length},wrap:(e,t={})=>{let n=Number.isSafeInteger(parseInt(t.margin))?Array(parseInt(t.margin)).fill(` `).join(``):t.margin||``,r=t.width;return(e||``).split(/\r?\n/g).map(e=>e.split(/\s+/g).reduce((e,t)=>(t.length+n.length>=r||e[e.length-1].length+t.length+1<r?e[e.length-1]+=` ${t}`:e.push(`${n}${t}`),e),[n]).join(`
`)).join(`
`)},entriesToDisplay:(e,t,n)=>{n||=t;let r=Math.min(t-n,e-Math.floor(n/2));r<0&&(r=0);let i=Math.min(r+n,t);return{startIndex:r,endIndex:i}}};const Wo=te.default,{action:Go}=B,Ko=c.default,{beep:qo,cursor:Jo}=L,Yo=I;var V=class extends Ko{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>void 0)).bind(this);let t=Wo.createInterface({input:this.in,escapeCodeTimeout:50});Wo.emitKeypressEvents(this.in,t),this.in.isTTY&&this.in.setRawMode(!0);let n=[`SelectPrompt`,`MultiselectPrompt`].indexOf(this.constructor.name)>-1,r=(e,t)=>{let r=Go(t,n);r===!1?this._&&this._(e,t):typeof this[r]==`function`?this[r](t):this.bell()};this.close=()=>{this.out.write(Jo.show),this.in.removeListener(`keypress`,r),this.in.isTTY&&this.in.setRawMode(!1),t.close(),this.emit(this.aborted?`abort`:this.exited?`exit`:`submit`,this.value),this.closed=!0},this.in.on(`keypress`,r)}fire(){this.emit(`state`,{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(qo)}render(){this.onRender(Yo),this.firstRender&&=!1}};const Xo=I,Zo=V,{erase:Qo,cursor:$o}=L,{style:es,clear:ts,lines:ns,figures:rs}=B;var is=class extends Zo{constructor(e={}){super(e),this.transform=es.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||``,this.validator=e.validate||(()=>!0),this.value=``,this.errorMsg=e.error||`Please Enter A Valid Value`,this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=ts(``,this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=Xo.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value=``,this.cursor=Number(!!this.initial),this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}async validate(){let e=await this.validator(this.value);typeof e==`string`&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error?(this.red=!0,this.fire(),this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close())}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor+=e,this.cursorOffset+=e)}_(e,t){let n=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${n}${e}${r}`,this.red=!1,this.cursor=this.placeholder?0:n.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write($o.down(ns(this.outputError,this.out.columns)-1)+ts(this.outputError,this.out.columns)),this.out.write(ts(this.outputText,this.out.columns))),super.render(),this.outputError=``,this.outputText=[es.symbol(this.done,this.aborted),Xo.bold(this.msg),es.delimiter(this.done),this.red?Xo.red(this.rendered):this.rendered].join(` `),this.error&&(this.outputError+=this.errorMsg.split(`
`).reduce((e,t,n)=>e+`\n${n?` `:rs.pointerSmall} ${Xo.red().italic(t)}`,``)),this.out.write(Qo.line+$o.to(0)+this.outputText+$o.save+this.outputError+$o.restore+$o.move(this.cursorOffset,0)))}};const H=I,as=V,{style:os,clear:ss,figures:cs,wrap:ls,entriesToDisplay:us}=B,{cursor:ds}=L;var fs=class extends as{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||`- Use arrow-keys. Return to submit.`,this.warn=e.warn||`- This option is disabled`,this.cursor=e.initial||0,this.choices=e.choices.map((e,t)=>(typeof e==`string`&&(e={title:e,value:t}),{title:e&&(e.title||e.value||e),value:e&&(e.value===void 0?t:e.value),description:e&&e.description,selected:e&&e.selected,disabled:e&&e.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=ss(``,this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(e===` `)return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(ds.hide):this.out.write(ss(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=us(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[os.symbol(this.done,this.aborted),H.bold(this.msg),os.delimiter(!1),this.done?this.selection.title:this.selection.disabled?H.yellow(this.warn):H.gray(this.hint)].join(` `),!this.done){this.outputText+=`
`;for(let n=e;n<t;n++){let r,i,a=``,o=this.choices[n];i=n===e&&e>0?cs.arrowUp:n===t-1&&t<this.choices.length?cs.arrowDown:` `,o.disabled?(r=this.cursor===n?H.gray().underline(o.title):H.strikethrough().gray(o.title),i=(this.cursor===n?H.bold().gray(cs.pointer)+` `:`  `)+i):(r=this.cursor===n?H.cyan().underline(o.title):o.title,i=(this.cursor===n?H.cyan(cs.pointer)+` `:`  `)+i,o.description&&this.cursor===n&&(a=` - ${o.description}`,(i.length+r.length+a.length>=this.out.columns||o.description.split(/\r?\n/).length>1)&&(a=`
`+ls(o.description,{margin:3,width:this.out.columns})))),this.outputText+=`${i} ${r}${H.gray(a)}\n`}}this.out.write(this.outputText)}};const ps=I,ms=V,{style:hs,clear:gs}=B,{cursor:_s,erase:vs}=L;var ys=class extends ms{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||`on`,this.inactive=e.inactive||`off`,this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,t){if(e===` `)this.value=!this.value;else if(e===`1`)this.value=!0;else if(e===`0`)this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(_s.hide):this.out.write(gs(this.outputText,this.out.columns)),super.render(),this.outputText=[hs.symbol(this.done,this.aborted),ps.bold(this.msg),hs.delimiter(this.done),this.value?this.inactive:ps.cyan().underline(this.inactive),ps.gray(`/`),this.value?ps.cyan().underline(this.active):this.active].join(` `),this.out.write(vs.line+_s.to(0)+this.outputText))}},U=class e{constructor({token:e,date:t,parts:n,locales:r}){this.token=e,this.date=t||/* @__PURE__ */ new Date,this.parts=n||[this],this.locales=r||{}}up(){}down(){}next(){let t=this.parts.indexOf(this);return this.parts.find((n,r)=>r>t&&n instanceof e)}setTo(e){}prev(){let t=[].concat(this.parts).reverse(),n=t.indexOf(this);return t.find((t,r)=>r>n&&t instanceof e)}toString(){return String(this.date)}};const bs=U;var xs=class extends bs{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?`pm`:`am`;return/\A/.test(this.token)?e.toUpperCase():e}};const Ss=U,Cs=e=>(e%=10,e===1?`st`:e===2?`nd`:e===3?`rd`:`th`);var ws=class extends Ss{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();return this.token===`DD`?String(e).padStart(2,`0`):this.token===`Do`?e+Cs(e):this.token===`d`?t+1:this.token===`ddd`?this.locales.weekdaysShort[t]:this.token===`dddd`?this.locales.weekdays[t]:e}};const Ts=U;var Es=class extends Ts{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,`0`):e}};const Ds=U;var Os=class extends Ds{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,`0`).substr(0,this.token.length)}};const ks=U;var As=class extends ks{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,`0`):e}};const js=U;var Ms=class extends js{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),t=this.token.length;return t===2?String(e+1).padStart(2,`0`):t===3?this.locales.monthsShort[e]:t===4?this.locales.months[e]:String(e+1)}};const Ns=U;var Ps=class extends Ns{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,`0`):e}};const Fs=U;var Is={DatePart:U,Meridiem:xs,Day:ws,Hours:Es,Milliseconds:Os,Minutes:As,Month:Ms,Seconds:Ps,Year:class extends Fs{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,`0`);return this.token.length===2?e.substr(-2):e}}};const Ls=I,Rs=V,{style:zs,clear:Bs,figures:Vs}=B,{erase:Hs,cursor:Us}=L,{DatePart:Ws,Meridiem:Gs,Day:Ks,Hours:qs,Milliseconds:Js,Minutes:Ys,Month:Xs,Seconds:Zs,Year:Qs}=Is,$s=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,ec={1:({token:e})=>e.replace(/\\(.)/g,`$1`),2:e=>new Ks(e),3:e=>new Xs(e),4:e=>new Qs(e),5:e=>new Gs(e),6:e=>new qs(e),7:e=>new Ys(e),8:e=>new Zs(e),9:e=>new Js(e)},tc={months:`January,February,March,April,May,June,July,August,September,October,November,December`.split(`,`),monthsShort:`Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec`.split(`,`),weekdays:`Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday`.split(`,`),weekdaysShort:`Sun,Mon,Tue,Wed,Thu,Fri,Sat`.split(`,`)};var nc=class extends Rs{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed=``,this.locales=Object.assign(tc,e.locales),this._date=e.initial||/* @__PURE__ */ new Date,this.errorMsg=e.error||`Please Enter A Valid Value`,this.validator=e.validate||(()=>!0),this.mask=e.mask||`YYYY-MM-DD HH:mm:ss`,this.clear=Bs(``,this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let t;for(this.parts=[];t=$s.exec(e);){let e=t.shift(),n=t.findIndex(e=>e!=null);this.parts.push(n in ec?ec[n]({token:t[n]||e,date:this.date,parts:this.parts,locales:this.locales}):t[n]||e)}let n=this.parts.reduce((e,t)=>(typeof t==`string`&&typeof e[e.length-1]==`string`?e[e.length-1]+=t:e.push(t),e),[]);this.parts.splice(0),this.parts.push(...n),this.reset()}moveCursor(e){this.typed=``,this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof Ws)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}async validate(){let e=await this.validator(this.value);typeof e==`string`&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){await this.validate(),this.error?(this.color=`red`,this.fire(),this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close())}up(){this.typed=``,this.parts[this.cursor].up(),this.render()}down(){this.typed=``,this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(e=>e instanceof Ws)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(Us.hide):this.out.write(Bs(this.outputText,this.out.columns)),super.render(),this.outputText=[zs.symbol(this.done,this.aborted),Ls.bold(this.msg),zs.delimiter(!1),this.parts.reduce((e,t,n)=>e.concat(n===this.cursor&&!this.done?Ls.cyan().underline(t.toString()):t),[]).join(``)].join(` `),this.error&&(this.outputText+=this.errorMsg.split(`
`).reduce((e,t,n)=>e+`\n${n?` `:Vs.pointerSmall} ${Ls.red().italic(t)}`,``)),this.out.write(Hs.line+Us.to(0)+this.outputText))}};const rc=I,ic=V,{cursor:ac,erase:oc}=L,{style:sc,figures:cc,clear:lc,lines:uc}=B,dc=/[0-9]/,fc=e=>e!==void 0,pc=(e,t)=>{let n=10**t;return Math.round(e*n)/n};var mc=class extends ic{constructor(e={}){super(e),this.transform=sc.render(e.style),this.msg=e.message,this.initial=fc(e.initial)?e.initial:``,this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=fc(e.min)?e.min:-1/0,this.max=fc(e.max)?e.max:1/0,this.errorMsg=e.error||`Please Enter A Valid Value`,this.validator=e.validate||(()=>!0),this.color=`cyan`,this.value=``,this.typed=``,this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=rc.gray(this.transform.render(`${this.initial}`)),this._value=``):(this.placeholder=!1,this.rendered=this.transform.render(`${pc(e,this.round)}`),this._value=pc(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e===`-`||e===`.`&&this.float||dc.test(e)}reset(){this.typed=``,this.value=``,this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e===``?this.initial:e,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}async validate(){let e=await this.validator(this.value);typeof e==`string`&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(await this.validate(),this.error){this.color=`red`,this.fire(),this.render();return}let e=this.value;this.value=e===``?this.initial:e,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}up(){if(this.typed=``,this.value===``&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color=`cyan`,this.fire(),this.render()}down(){if(this.typed=``,this.value===``&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color=`cyan`,this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||``,this.value!==``&&this.value<this.min&&(this.value=this.min),this.color=`cyan`,this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,t){if(!this.valid(e))return this.bell();let n=Date.now();if(n-this.lastHit>1e3&&(this.typed=``),this.typed+=e,this.lastHit=n,this.color=`cyan`,e===`.`)return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(ac.down(uc(this.outputError,this.out.columns)-1)+lc(this.outputError,this.out.columns)),this.out.write(lc(this.outputText,this.out.columns))),super.render(),this.outputError=``,this.outputText=[sc.symbol(this.done,this.aborted),rc.bold(this.msg),sc.delimiter(this.done),!this.done||!this.done&&!this.placeholder?rc[this.color]().underline(this.rendered):this.rendered].join(` `),this.error&&(this.outputError+=this.errorMsg.split(`
`).reduce((e,t,n)=>e+`\n${n?` `:cc.pointerSmall} ${rc.red().italic(t)}`,``)),this.out.write(oc.line+ac.to(0)+this.outputText+ac.save+this.outputError+ac.restore))}};const W=I,{cursor:hc}=L,gc=V,{clear:_c,figures:G,style:vc,wrap:yc,entriesToDisplay:bc}=B;var xc=class extends gc{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||``,this.warn=e.warn||`- This option is disabled -`,this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((e,t)=>(typeof e==`string`&&(e={title:e,value:t}),{title:e&&(e.title||e.value||e),description:e&&e.description,value:e&&(e.value===void 0?t:e.value),selected:e&&e.selected,disabled:e&&e.disabled})),this.clear=_c(``,this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
`),this.close()}submit(){let e=this.value.filter(e=>e.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else if(e.disabled||this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();else e.selected=!0,this.render()}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(e=>!e.disabled).forEach(t=>t.selected=e),this.render()}_(e,t){if(e===` `)this.handleSpaceToggle();else if(e===`a`)this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions==`string`?this.instructions:`
Instructions:
    ${G.arrowUp}/${G.arrowDown}: Highlight option\n    ${G.arrowLeft}/${G.arrowRight}/[space]: Toggle selection\n`+(this.maxChoices===void 0?`    a: Toggle all
`:``)+`    enter/return: Complete answer`:``}renderOption(e,t,n,r){let i=(t.selected?W.green(G.radioOn):G.radioOff)+` `+r+` `,a,o;return t.disabled?a=e===n?W.gray().underline(t.title):W.strikethrough().gray(t.title):(a=e===n?W.cyan().underline(t.title):t.title,e===n&&t.description&&(o=` - ${t.description}`,(i.length+a.length+o.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(o=`
`+yc(t.description,{margin:i.length,width:this.out.columns})))),i+a+W.gray(o||``)}paginateOptions(e){if(e.length===0)return W.red(`No matches for this query.`);let{startIndex:t,endIndex:n}=bc(this.cursor,e.length,this.optionsPerPage),r,i=[];for(let a=t;a<n;a++)r=a===t&&t>0?G.arrowUp:a===n-1&&n<e.length?G.arrowDown:` `,i.push(this.renderOption(this.cursor,e[a],a,r));return`
`+i.join(`
`)}renderOptions(e){return this.done?``:this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(`, `);let e=[W.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(W.yellow(this.warn)),e.join(` `)}render(){if(this.closed)return;this.firstRender&&this.out.write(hc.hide),super.render();let e=[vc.symbol(this.done,this.aborted),W.bold(this.msg),vc.delimiter(!1),this.renderDoneOrInstructions()].join(` `);this.showMinError&&=(e+=W.red(`You must select a minimum of ${this.minSelected} choices.`),!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=_c(e,this.out.columns)}};const Sc=I,Cc=V,{erase:wc,cursor:Tc}=L,{style:Ec,clear:Dc,figures:Oc,wrap:kc,entriesToDisplay:Ac}=B,jc=(e,t)=>e[t]&&(e[t].value||e[t].title||e[t]),Mc=(e,t)=>e[t]&&(e[t].title||e[t].value||e[t]),Nc=(e,t)=>{let n=e.findIndex(e=>e.value===t||e.title===t);return n>-1?n:void 0};var Pc=class extends Cc{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial==`number`?e.initial:Nc(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||`no matches found`},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input=``,this.limit=e.limit||10,this.cursor=0,this.transform=Ec.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=Dc(``,this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb==`number`?e=this.choices[this._fb]:typeof this._fb==`string`&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.value=this.suggestions.length>0?jc(this.suggestions,e):this.fallback.value,this.fire()}async complete(e){let t=this.completing=this.suggest(this.input,this.choices),n=await t;if(this.completing!==t)return;this.suggestions=n.map((e,t,n)=>({title:Mc(n,t),value:jc(n,t),description:e.description})),this.completing=!1;let r=Math.max(n.length-1,0);this.moveSelect(Math.min(r,this.select)),e&&e()}reset(){this.input=``,this.complete(()=>{this.moveSelect(this.initial===void 0?0:this.initial),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}_(e,t){let n=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${n}${e}${r}`,this.cursor=n.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),--this.cursor,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();--this.cursor,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor+=1,this.render()}renderOption(e,t,n,r){let i,a=n?Oc.arrowUp:r?Oc.arrowDown:` `,o=t?Sc.cyan().underline(e.title):e.title;return a=(t?Sc.cyan(Oc.pointer)+` `:`  `)+a,e.description&&(i=` - ${e.description}`,(a.length+o.length+i.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(i=`
`+kc(e.description,{margin:3,width:this.out.columns}))),a+` `+o+Sc.gray(i||``)}render(){if(this.closed)return;this.firstRender?this.out.write(Tc.hide):this.out.write(Dc(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=Ac(this.select,this.choices.length,this.limit);if(this.outputText=[Ec.symbol(this.done,this.aborted,this.exited),Sc.bold(this.msg),Ec.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(` `),!this.done){let n=this.suggestions.slice(e,t).map((n,r)=>this.renderOption(n,this.select===r+e,r===0&&e>0,r+e===t-1&&t<this.choices.length)).join(`
`);this.outputText+=`
`+(n||Sc.gray(this.fallback.title))}this.out.write(wc.line+Tc.to(0)+this.outputText)}};const K=I,{cursor:Fc}=L,Ic=xc,{clear:Lc,style:Rc,figures:q}=B;var zc=class extends Ic{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue=``,this.clear=Lc(``,this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(e=>!this.inputValue||!!(typeof e.title==`string`&&e.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof e.value==`string`&&e.value.toLowerCase().includes(this.inputValue.toLowerCase())));let t=this.filteredOptions.findIndex(t=>t===e);this.cursor=t<0?0:t,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else if(e.disabled||this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();else e.selected=!0,this.render()}handleInputChange(e){this.inputValue+=e,this.updateFilteredOptions()}_(e,t){e===` `?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions==`string`?this.instructions:`
Instructions:
    ${q.arrowUp}/${q.arrowDown}: Highlight option
    ${q.arrowLeft}/${q.arrowRight}/[space]: Toggle selection
    [a,b,c]/delete: Filter choices
    enter/return: Complete answer
`:``}renderCurrentInput(){return`
Filtered results for: ${this.inputValue?this.inputValue:K.gray(`Enter something to filter`)}\n`}renderOption(e,t,n,r){let i=(t.selected?K.green(q.radioOn):q.radioOff)+` `+r+` `,a;return a=t.disabled?e===n?K.gray().underline(t.title):K.strikethrough().gray(t.title):e===n?K.cyan().underline(t.title):t.title,i+a}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(`, `);let e=[K.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(K.yellow(this.warn)),e.join(` `)}render(){if(this.closed)return;this.firstRender&&this.out.write(Fc.hide),super.render();let e=[Rc.symbol(this.done,this.aborted),K.bold(this.msg),Rc.delimiter(!1),this.renderDoneOrInstructions()].join(` `);this.showMinError&&=(e+=K.red(`You must select a minimum of ${this.minSelected} choices.`),!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=Lc(e,this.out.columns)}};const Bc=I,Vc=V,{style:Hc,clear:Uc}=B,{erase:Wc,cursor:Gc}=L;var Kc={TextPrompt:is,SelectPrompt:fs,TogglePrompt:ys,DatePrompt:nc,NumberPrompt:mc,MultiselectPrompt:xc,AutocompletePrompt:Pc,AutocompleteMultiselectPrompt:zc,ConfirmPrompt:class extends Vc{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||`yes`,this.yesOption=e.yesOption||`(Y/n)`,this.noMsg=e.no||`no`,this.noOption=e.noOption||`(y/N)`,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}_(e,t){return e.toLowerCase()===`y`?(this.value=!0,this.submit()):e.toLowerCase()===`n`?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(Gc.hide):this.out.write(Uc(this.outputText,this.out.columns)),super.render(),this.outputText=[Hc.symbol(this.done,this.aborted),Bc.bold(this.msg),Hc.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Bc.gray(this.initialValue?this.yesOption:this.noOption)].join(` `),this.out.write(Wc.line+Gc.to(0)+this.outputText))}}};(function(e){let t=e,n=Kc,r=e=>e;function i(e,t,i={}){return new Promise((a,o)=>{let s=new n[e](t),c=i.onAbort||r,l=i.onSubmit||r,u=i.onExit||r;s.on(`state`,t.onState||r),s.on(`submit`,e=>a(l(e))),s.on(`exit`,e=>a(u(e))),s.on(`abort`,e=>o(c(e)))})}t.text=e=>i(`TextPrompt`,e),t.password=e=>(e.style=`password`,t.text(e)),t.invisible=e=>(e.style=`invisible`,t.text(e)),t.number=e=>i(`NumberPrompt`,e),t.date=e=>i(`DatePrompt`,e),t.confirm=e=>i(`ConfirmPrompt`,e),t.list=e=>{let t=e.separator||`,`;return i(`TextPrompt`,e,{onSubmit:e=>e.split(t).map(e=>e.trim())})},t.toggle=e=>i(`TogglePrompt`,e),t.select=e=>i(`SelectPrompt`,e),t.multiselect=e=>{e.choices=[].concat(e.choices||[]);let t=e=>e.filter(e=>e.selected).map(e=>e.value);return i(`MultiselectPrompt`,e,{onAbort:t,onSubmit:t})},t.autocompleteMultiselect=e=>{e.choices=[].concat(e.choices||[]);let t=e=>e.filter(e=>e.selected).map(e=>e.value);return i(`AutocompleteMultiselectPrompt`,e,{onAbort:t,onSubmit:t})};let a=(e,t)=>Promise.resolve(t.filter(t=>t.title.slice(0,e.length).toLowerCase()===e.toLowerCase()));t.autocomplete=e=>(e.suggest=e.suggest||a,e.choices=[].concat(e.choices||[]),i(`AutocompletePrompt`,e))})(bo);const qc=bo,Jc=[`suggest`,`format`,`onState`,`validate`,`onRender`,`type`],Yc=()=>{};async function J(e=[],{onSubmit:t=Yc,onCancel:n=Yc}={}){let r={},i=J._override||{};e=[].concat(e);let a,o,s,c,l,u,d=async(e,t,n=!1)=>{if(n||!e.validate||e.validate(t)===!0)return e.format?await e.format(t,r):t};for(o of e)if({name:c,type:l}=o,typeof l==`function`&&(l=await l(a,{...r},o),o.type=l),l){for(let e in o){if(Jc.includes(e))continue;let t=o[e];o[e]=typeof t==`function`?await t(a,{...r},u):t}if(u=o,typeof o.message!=`string`)throw Error(`prompt message is required`);if({name:c,type:l}=o,qc[l]===void 0)throw Error(`prompt type (${l}) is not defined`);if(i[o.name]!==void 0&&(a=await d(o,i[o.name]),a!==void 0))r[c]=a;else{try{a=J._injected?Xc(J._injected,o.initial):await qc[l](o),r[c]=a=await d(o,a,!0),s=await t(o,a,r)}catch{s=!await n(o,r)}if(s)return r}}return r}function Xc(e,t){let n=e.shift();if(n instanceof Error)throw n;return n===void 0?t:n}function Zc(e){J._injected=(J._injected||[]).concat(e)}function Qc(e){J._override=Object.assign({},e)}const $c=/*@__PURE__*/ w(Object.assign(J,{prompt:J,prompts:qc,inject:Zc,override:Qc}));var el={},Y={};Object.defineProperty(Y,"__esModule",{value:!0}),Y.sync=Y.isexe=void 0;const tl=i.default,nl=b.default;Y.isexe=async(e,t={})=>{let{ignoreErrors:n=!1}=t;try{return rl(await(0,nl.stat)(e),t)}catch(e){let t=e;if(n||t.code===`EACCES`)return!1;throw t}},Y.sync=(e,t={})=>{let{ignoreErrors:n=!1}=t;try{return rl((0,tl.statSync)(e),t)}catch(e){let t=e;if(n||t.code===`EACCES`)return!1;throw t}};const rl=(e,t)=>e.isFile()&&il(e,t),il=(e,t)=>{let n=t.uid??process.getuid?.(),r=t.groups??process.getgroups?.()??[],i=t.gid??process.getgid?.()??r[0];if(n===void 0||i===void 0)throw Error(`cannot get uid or gid`);let a=/* @__PURE__ */ new Set([i,...r]),o=e.mode,s=e.uid,c=e.gid;return!!(o&1||o&8&&a.has(c)||o&64&&s===n||o&72&&n===0)};var X={};Object.defineProperty(X,"__esModule",{value:!0}),X.sync=X.isexe=void 0;const al=i.default,ol=b.default;X.isexe=async(e,t={})=>{let{ignoreErrors:n=!1}=t;try{return cl(await(0,ol.stat)(e),e,t)}catch(e){let t=e;if(n||t.code===`EACCES`)return!1;throw t}},X.sync=(e,t={})=>{let{ignoreErrors:n=!1}=t;try{return cl((0,al.statSync)(e),e,t)}catch(e){let t=e;if(n||t.code===`EACCES`)return!1;throw t}};const sl=(e,t)=>{let{pathExt:n=process.env.PATHEXT||``}=t,r=n.split(`;`);if(r.indexOf(``)!==-1)return!0;for(let t=0;t<r.length;t++){let n=r[t].toLowerCase(),i=e.substring(e.length-n.length).toLowerCase();if(n&&i===n)return!0}return!1},cl=(e,t,n)=>e.isFile()&&sl(t,n);var ll={};Object.defineProperty(ll,"__esModule",{value:!0}),(function(e){var t=C&&C.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=C&&C.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),r=C&&C.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var i in e)i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)&&t(r,e,i);return n(r,e),r},i=C&&C.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.sync=e.isexe=e.posix=e.win32=void 0;let a=r(Y);e.posix=a;let o=r(X);e.win32=o,i(ll,e);let s=(process.env._ISEXE_TEST_PLATFORM_||process.platform)===`win32`?o:a;e.isexe=s.isexe,e.sync=s.sync})(el);const{isexe:ul,sync:dl}=el,{join:fl,delimiter:pl,sep:ml,posix:hl}=a.default,gl=process.platform===`win32`,_l=new RegExp(`[${hl.sep}${ml===hl.sep?``:ml}]`.replace(/(\\)/g,`\\$1`)),vl=RegExp(`^\\.${_l.source}`),yl=e=>Object.assign(/* @__PURE__ */ Error(`not found: ${e}`),{code:`ENOENT`}),bl=(e,{path:t=process.env.PATH,pathExt:n=process.env.PATHEXT,delimiter:r=pl})=>{let i=e.match(_l)?[``]:[...gl?[process.cwd()]:[],...(t||/* istanbul ignore next: very unusual */``).split(r)];if(gl){let t=n||[`.EXE`,`.CMD`,`.BAT`,`.COM`].join(r),a=t.split(r).flatMap(e=>[e,e.toLowerCase()]);return e.includes(`.`)&&a[0]!==``&&a.unshift(``),{pathEnv:i,pathExt:a,pathExtExe:t}}return{pathEnv:i,pathExt:[``]}},xl=(e,t)=>{let n=/^".*"$/.test(e)?e.slice(1,-1):e;return(!n&&vl.test(t)?t.slice(0,2):``)+fl(n,t)},Sl=async(e,t={})=>{let{pathEnv:n,pathExt:r,pathExtExe:i}=bl(e,t),a=[];for(let o of n){let n=xl(o,e);for(let e of r){let r=n+e;if(await ul(r,{pathExt:i,ignoreErrors:!0})){if(!t.all)return r;a.push(r)}}}if(t.all&&a.length)return a;if(t.nothrow)return null;throw yl(e)},Cl=(e,t={})=>{let{pathEnv:n,pathExt:r,pathExtExe:i}=bl(e,t),a=[];for(let o of n){let n=xl(o,e);for(let e of r){let r=n+e;if(dl(r,{pathExt:i,ignoreErrors:!0})){if(!t.all)return r;a.push(r)}}}if(t.all&&a.length)return a;if(t.nothrow)return null;throw yl(e)};var wl=Sl;Sl.sync=Cl;const Tl=/*@__PURE__*/ w(wl);(0,m.join)(p.default.tmpdir(),`antfu-ni`);function El(e,t){return e.slice().filter(e=>e!==t)}function Dl(e){return Tl.sync(e,{nothrow:!0})!==null}async function Ol({autoInstall:e,programmatic:t,cwd:n}={}){let r=null,i=null,a=await oo(Object.keys(pn),{cwd:n}),o;if(o=a?m.default.resolve(a,`../package.json`):await oo(`package.json`,{cwd:n}),o&&f.default.existsSync(o))try{let e=JSON.parse(f.default.readFileSync(o,`utf8`));if(typeof e.packageManager==`string`){let[n,a]=e.packageManager.replace(/^\^/,``).split(`@`);i=a,n===`yarn`&&Number.parseInt(a)>1?(r=`yarn@berry`,i=`berry`):n===`pnpm`&&Number.parseInt(a)<7?r=`pnpm@6`:n in dn?r=n:t||console.warn(`[ni] Unknown packageManager:`,e.packageManager)}}catch{}if(!r&&a&&(r=pn[m.default.basename(a)]),r&&!Dl(r.split(`@`)[0])&&!t){if(!e){console.warn(`[ni] Detected ${r} but it doesn't seem to be installed.
`),h.default.env.CI&&h.default.exit(1);let e=yo(r,mn[r]),{tryInstall:t}=await $c({name:`tryInstall`,type:`confirm`,message:`Would you like to globally install ${e}?`});t||h.default.exit(1)}await Wa(`npm i -g ${r.split(`@`)[0]}${i?`@${i}`:``}`,{stdio:`inherit`,cwd:n})}return r}const kl=h.default.env.NI_CONFIG_FILE,Al=h.default.platform===`win32`?h.default.env.USERPROFILE:h.default.env.HOME,jl=m.default.join(Al||`~/`,`.nirc`),Ml=kl||jl,Nl={defaultAgent:`prompt`,globalAgent:`npm`};let Pl;async function Fl(){if(!Pl){Pl=Object.assign({},Nl,f.default.existsSync(Ml)?xn.parse(f.default.readFileSync(Ml,`utf-8`)):null);let e=await Ol({programmatic:!0});e&&(Pl.defaultAgent=e)}return Pl}async function Il(e){let{defaultAgent:t}=await Fl();return t===`prompt`&&(e||h.default.env.CI)?`npm`:t}async function Ll(){let{globalAgent:e}=await Fl();return e}var Rl=class extends Error{constructor({agent:e,command:t}){super(`Command "${t}" is not support by agent "${e}"`)}};function Z(e,t,n=[]){if(!(e in dn))throw Error(`Unsupported agent "${e}"`);let r=dn[e][t];if(typeof r==`function`)return r(n);if(!r)throw new Rl({agent:e,command:t});return r.replace(`{0}`,n.map(e=>!e.startsWith(`--`)&&e.includes(` `)?JSON.stringify(e):e).join(` `)).trim()}const zl=(e,t,n)=>(e===`bun`&&(t=t.map(e=>e===`-D`?`-d`:e)),t.includes(`-g`)?Z(e,`global`,El(t,`-g`)):t.includes(`--frozen-if-present`)?(t=El(t,`--frozen-if-present`),Z(e,n?.hasLock?`frozen`:`install`,t)):t.includes(`--frozen`)?Z(e,`frozen`,El(t,`--frozen`)):t.length===0||t.every(e=>e.startsWith(`-`))?Z(e,`install`,t):Z(e,`add`,t)),Bl=(e,t)=>(t.length===0&&t.push(`start`),t.includes(`--if-present`)&&(t=El(t,`--if-present`),t[0]=`--if-present ${t[0]}`),Z(e,`run`,t)),Vl=(e,t)=>Z(e,`agent`,t);let Hl,Ul,Wl,Gl,Kl=!0;typeof process<`u`&&({FORCE_COLOR:Hl,NODE_DISABLE_COLORS:Ul,NO_COLOR:Wl,TERM:Gl}=process.env||{},Kl=process.stdout&&process.stdout.isTTY);const Q={enabled:!Ul&&Wl==null&&Gl!==`dumb`&&(Hl!=null&&Hl!==`0`||Kl),reset:$(0,0),bold:$(1,22),dim:$(2,22),italic:$(3,23),underline:$(4,24),inverse:$(7,27),hidden:$(8,28),strikethrough:$(9,29),black:$(30,39),red:$(31,39),green:$(32,39),yellow:$(33,39),blue:$(34,39),magenta:$(35,39),cyan:$(36,39),white:$(37,39),gray:$(90,39),grey:$(90,39),bgBlack:$(40,49),bgRed:$(41,49),bgGreen:$(42,49),bgYellow:$(43,49),bgBlue:$(44,49),bgMagenta:$(45,49),bgCyan:$(46,49),bgWhite:$(47,49)};function ql(e,t){let n=0,r,i=``,a=``;for(;n<e.length;n++)r=e[n],i+=r.open,a+=r.close,~t.indexOf(r.close)&&(t=t.replace(r.rgx,r.close+r.open));return i+t+a}function Jl(e,t){let n={has:e,keys:t};return n.reset=Q.reset.bind(n),n.bold=Q.bold.bind(n),n.dim=Q.dim.bind(n),n.italic=Q.italic.bind(n),n.underline=Q.underline.bind(n),n.inverse=Q.inverse.bind(n),n.hidden=Q.hidden.bind(n),n.strikethrough=Q.strikethrough.bind(n),n.black=Q.black.bind(n),n.red=Q.red.bind(n),n.green=Q.green.bind(n),n.yellow=Q.yellow.bind(n),n.blue=Q.blue.bind(n),n.magenta=Q.magenta.bind(n),n.cyan=Q.cyan.bind(n),n.white=Q.white.bind(n),n.gray=Q.gray.bind(n),n.grey=Q.grey.bind(n),n.bgBlack=Q.bgBlack.bind(n),n.bgRed=Q.bgRed.bind(n),n.bgGreen=Q.bgGreen.bind(n),n.bgYellow=Q.bgYellow.bind(n),n.bgBlue=Q.bgBlue.bind(n),n.bgMagenta=Q.bgMagenta.bind(n),n.bgCyan=Q.bgCyan.bind(n),n.bgWhite=Q.bgWhite.bind(n),n}function $(e,t){let n={open:`\x1b[${e}m`,close:`\x1b[${t}m`,rgx:RegExp(`\\x1b\\[${t}m`,`g`)};return function(t){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(e)||(this.has.push(e),this.keys.push(n)),t===void 0?this:Q.enabled?ql(this.keys,t+``):t+``):t===void 0?Jl([e],[n]):Q.enabled?ql([n],t+``):t+``}}async function Yl(e,t,n={},r=n.cwd??h.default.cwd()){if(t.includes(`-g`))return await e(await Ll(),t);let i=await Ol({...n,cwd:r})||await Il(n.programmatic);if(!(i===`prompt`&&(i=(await $c({name:`agent`,type:`select`,message:`Choose the agent`,choices:fn.filter(e=>!e.includes(`@`)).map(e=>({title:e,value:e}))})).agent,!i)))return await e(i,t,{programmatic:n.programmatic,hasLock:!!i,cwd:r})}var Xl=/* @__PURE__ */ e.a(t.o()),Zl=t.a(),Ql=()=>(0,Zl.dedent)(Xl.default`
    ${t.t} {bold No package.json found}
    Chromatic only works from inside a JavaScript project.
    We expected to find a package.json somewhere up the directory tree.
    Are you sure you're running from your project directory?
  `);Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Bl}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return zl}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Yl}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return on}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Vl}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Ql}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return Le}});
//# sourceMappingURL=noPackageJson-DJz3Fwwy.cjs.map
//# debugId=bbb2e6df-0839-55a4-b84a-16a67bfa108f