@junobuild/cli-tools 0.0.10-next-2024-06-15.7 → 0.0.10-next-2024-06-19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -440,8 +440,8 @@ can workaround this problem by explicitly adding the missing package
440
440
  to your top-level package.json.
441
441
  `,n}function x7e(e,t){try{return t?{error:null,value:(((r,n)=>(r=r.split("."),n=n.split("."),+r[0]>+n[0]||r[0]==n[0]&&+r[1]>=+n[1]))(process.versions.node,"8.9")?ne.resolve:(r,{paths:[n]},i=ne("module"))=>{let s=i._findPath(r,i._nodeModulePaths(n).concat(n));if(s)return s;throw s=new Error(`Cannot resolve module '${r}'`),s.code="MODULE_NOT_FOUND",s})(e,{paths:[t]})}:{error:null,value:ne.resolve(e)}}catch(r){return{error:r,value:null}}}function E7e(e,t){try{return{error:null,value:(0,o7e.resolve)(e,t)}}catch(r){return{error:r,value:null}}}function q7(e,t,r){let n=G7(e,t),i=n.next();for(;!i.done;)i=n.next(x7e(i.value,r));return i.value}function S7e(e,t,r){let n=(0,i2().pathToFileURL)(s2().join(r,"./babel-virtual-resolve-base.js")).href,i=G7(e,t),s=i.next();for(;!s.done;)s=i.next(E7e(s.value,n));return(0,i2().fileURLToPath)(s.value)}function K7(e,t,r,n){if(!V7.supportsESM||!n)return q7(e,t,r);try{let i=S7e(e,t,r);if(!(0,$7().existsSync)(i))throw Object.assign(new Error(`Could not resolve "${t}" in file ${r}.`),{type:"MODULE_NOT_FOUND"});return i}catch(i){try{return q7(e,t,r)}catch(s){throw i.type==="MODULE_NOT_FOUND"?i:s.type==="MODULE_NOT_FOUND"?s:i}}}hy=new Set;var hy;function*z7(e,t){if(!(yield*(0,a2.isAsync)())&&hy.has(t))throw new Error(`Reentrant ${e} detected trying to load "${t}". This module is not ignored and is trying to load itself while compiling itself, leading to a dependency cycle. We recommend adding it to your "ignore" list in your babelrc, or to a .babelignore.`);try{return hy.add(t),yield*(0,V7.default)(t,`You appear to be using a native ECMAScript module ${e}, which is only supported when running Babel asynchronously.`,!0)}catch(r){throw r.message=`[BABEL]: ${r.message} (While processing: ${t})`,r}finally{hy.delete(t)}}});var Yc=h(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});Object.defineProperty(pn,"ROOT_CONFIG_FILENAMES",{enumerable:!0,get:function(){return Il.ROOT_CONFIG_FILENAMES}});Object.defineProperty(pn,"findConfigUpwards",{enumerable:!0,get:function(){return Il.findConfigUpwards}});Object.defineProperty(pn,"findPackageData",{enumerable:!0,get:function(){return T7e.findPackageData}});Object.defineProperty(pn,"findRelativeConfig",{enumerable:!0,get:function(){return Il.findRelativeConfig}});Object.defineProperty(pn,"findRootConfig",{enumerable:!0,get:function(){return Il.findRootConfig}});Object.defineProperty(pn,"loadConfig",{enumerable:!0,get:function(){return Il.loadConfig}});Object.defineProperty(pn,"loadPlugin",{enumerable:!0,get:function(){return my.loadPlugin}});Object.defineProperty(pn,"loadPreset",{enumerable:!0,get:function(){return my.loadPreset}});Object.defineProperty(pn,"resolvePlugin",{enumerable:!0,get:function(){return my.resolvePlugin}});Object.defineProperty(pn,"resolvePreset",{enumerable:!0,get:function(){return my.resolvePreset}});Object.defineProperty(pn,"resolveShowConfigPath",{enumerable:!0,get:function(){return Il.resolveShowConfigPath}});var T7e=QR(),Il=h7(),my=H7()});var X7=h(Dl=>{"use strict";Object.defineProperty(Dl,"__esModule",{value:!0});Dl.transform=void 0;Dl.transformAsync=C7e;Dl.transformSync=w7e;function Y7(){let e=an();return Y7=function(){return e},e}var P7e=gl(),A7e=Lm(),yy=Li(),by=Y7()(function*(t,r){let n=yield*(0,P7e.default)(r);return n===null?null:yield*(0,A7e.run)(n,t)}),CZe=Dl.transform=function(t,r,n){let i,s;if(typeof r=="function"?(s=r,i=void 0):(i=r,s=n),s===void 0)return(0,yy.beginHiddenCallStack)(by.sync)(t,i);(0,yy.beginHiddenCallStack)(by.errback)(t,i,s)};function w7e(...e){return(0,yy.beginHiddenCallStack)(by.sync)(...e)}function C7e(...e){return(0,yy.beginHiddenCallStack)(by.async)(...e)}});var Q7=h(Nl=>{"use strict";Object.defineProperty(Nl,"__esModule",{value:!0});Nl.transformFromAst=void 0;Nl.transformFromAstAsync=D7e;Nl.transformFromAstSync=I7e;function J7(){let e=an();return J7=function(){return e},e}var _7e=gl(),O7e=Lm(),gy=Li(),vy=J7()(function*(e,t,r){let n=yield*(0,_7e.default)(r);if(n===null)return null;if(!e)throw new Error("No AST given");return yield*(0,O7e.run)(n,t,e)}),OZe=Nl.transformFromAst=function(t,r,n,i){let s,a;if(typeof n=="function"?(a=n,s=void 0):(s=n,a=i),a===void 0)return(0,gy.beginHiddenCallStack)(vy.sync)(t,r,s);(0,gy.beginHiddenCallStack)(vy.errback)(t,r,s,a)};function I7e(...e){return(0,gy.beginHiddenCallStack)(vy.sync)(...e)}function D7e(...e){return(0,gy.beginHiddenCallStack)(vy.async)(...e)}});var eq=h(kl=>{"use strict";Object.defineProperty(kl,"__esModule",{value:!0});kl.parse=void 0;kl.parseAsync=j7e;kl.parseSync=B7e;function Z7(){let e=an();return Z7=function(){return e},e}var N7e=gl(),k7e=gP(),F7e=dP(),xy=Li(),Ey=Z7()(function*(t,r){let n=yield*(0,N7e.default)(r);return n===null?null:yield*(0,k7e.default)(n.passes,(0,F7e.default)(n),t)}),DZe=kl.parse=function(t,r,n){if(typeof r=="function"&&(n=r,r=void 0),n===void 0)return(0,xy.beginHiddenCallStack)(Ey.sync)(t,r);(0,xy.beginHiddenCallStack)(Ey.errback)(t,r,n)};function B7e(...e){return(0,xy.beginHiddenCallStack)(Ey.sync)(...e)}function j7e(...e){return(0,xy.beginHiddenCallStack)(Ey.async)(...e)}});var Zt=h(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.DEFAULT_EXTENSIONS=void 0;Object.defineProperty(ze,"File",{enumerable:!0,get:function(){return L7e.default}});Object.defineProperty(ze,"buildExternalHelpers",{enumerable:!0,get:function(){return R7e.default}});Object.defineProperty(ze,"createConfigItem",{enumerable:!0,get:function(){return hi.createConfigItem}});Object.defineProperty(ze,"createConfigItemAsync",{enumerable:!0,get:function(){return hi.createConfigItemAsync}});Object.defineProperty(ze,"createConfigItemSync",{enumerable:!0,get:function(){return hi.createConfigItemSync}});Object.defineProperty(ze,"getEnv",{enumerable:!0,get:function(){return M7e.getEnv}});Object.defineProperty(ze,"loadOptions",{enumerable:!0,get:function(){return hi.loadOptions}});Object.defineProperty(ze,"loadOptionsAsync",{enumerable:!0,get:function(){return hi.loadOptionsAsync}});Object.defineProperty(ze,"loadOptionsSync",{enumerable:!0,get:function(){return hi.loadOptionsSync}});Object.defineProperty(ze,"loadPartialConfig",{enumerable:!0,get:function(){return hi.loadPartialConfig}});Object.defineProperty(ze,"loadPartialConfigAsync",{enumerable:!0,get:function(){return hi.loadPartialConfigAsync}});Object.defineProperty(ze,"loadPartialConfigSync",{enumerable:!0,get:function(){return hi.loadPartialConfigSync}});Object.defineProperty(ze,"parse",{enumerable:!0,get:function(){return c2.parse}});Object.defineProperty(ze,"parseAsync",{enumerable:!0,get:function(){return c2.parseAsync}});Object.defineProperty(ze,"parseSync",{enumerable:!0,get:function(){return c2.parseSync}});Object.defineProperty(ze,"resolvePlugin",{enumerable:!0,get:function(){return tq.resolvePlugin}});Object.defineProperty(ze,"resolvePreset",{enumerable:!0,get:function(){return tq.resolvePreset}});Object.defineProperty(ze,"template",{enumerable:!0,get:function(){return sq().default}});Object.defineProperty(ze,"tokTypes",{enumerable:!0,get:function(){return nq().tokTypes}});Object.defineProperty(ze,"transform",{enumerable:!0,get:function(){return o2.transform}});Object.defineProperty(ze,"transformAsync",{enumerable:!0,get:function(){return o2.transformAsync}});Object.defineProperty(ze,"transformFile",{enumerable:!0,get:function(){return l2.transformFile}});Object.defineProperty(ze,"transformFileAsync",{enumerable:!0,get:function(){return l2.transformFileAsync}});Object.defineProperty(ze,"transformFileSync",{enumerable:!0,get:function(){return l2.transformFileSync}});Object.defineProperty(ze,"transformFromAst",{enumerable:!0,get:function(){return u2.transformFromAst}});Object.defineProperty(ze,"transformFromAstAsync",{enumerable:!0,get:function(){return u2.transformFromAstAsync}});Object.defineProperty(ze,"transformFromAstSync",{enumerable:!0,get:function(){return u2.transformFromAstSync}});Object.defineProperty(ze,"transformSync",{enumerable:!0,get:function(){return o2.transformSync}});Object.defineProperty(ze,"traverse",{enumerable:!0,get:function(){return iq().default}});ze.version=ze.types=void 0;var L7e=vS(),R7e=AR(),tq=Yc(),M7e=tP();function rq(){let e=Pe();return rq=function(){return e},e}Object.defineProperty(ze,"types",{enumerable:!0,get:function(){return rq()}});function nq(){let e=Xu();return nq=function(){return e},e}function iq(){let e=Di();return iq=function(){return e},e}function sq(){let e=nc();return sq=function(){return e},e}var hi=gl(),o2=X7(),l2=kP(),u2=Q7(),c2=eq(),kZe=Zt(),FZe=ze.version="7.24.6",BZe=ze.DEFAULT_EXTENSIONS=Object.freeze([".js",".jsx",".es6",".es",".mjs",".cjs"]);ze.OptionManager=class{init(t){return(0,hi.loadOptionsSync)(t)}},ze.Plugin=function(t){throw new Error(`The (${t}) Babel 5 plugin is being run with an unsupported Babel version.`)}});import{isNullish as xw,nonNullish as FU}from"@junobuild/utils";import BU from"crypto";import Ha from"node:fs";var J7e=Ha.existsSync,Q7e=Ha.createReadStream;async function Ty(e){return new Promise((t,r)=>{Ha.stat(e,(n,i)=>{n?r(n):t(i)})})}async function y2(e){return new Promise((t,r)=>{Ha.close(e,n=>{n?r(n):t()})})}async function b2(e,t){return new Promise((r,n)=>{Ha.open(e,t,(i,s)=>{i?n(i):r(s)})})}async function Py(e,t,r,n,i){return new Promise((s,a)=>{Ha.read(e,t,r,n,i,(o,l,u)=>{o?a(o):s({bytesRead:l,buffer:u})})})}var xq="End-Of-Stream",Nt=class extends Error{constructor(){super(xq)}};var Cp=class{constructor(){this.resolve=()=>null,this.reject=()=>null,this.promise=new Promise((t,r)=>{this.reject=r,this.resolve=t})}};var Eq=1*1024*1024,Ll=class{constructor(t){if(this.s=t,this.deferred=null,this.endOfStream=!1,this.peekQueue=[],!t.read||!t.once)throw new Error("Expected an instance of stream.Readable");this.s.once("end",()=>this.reject(new Nt)),this.s.once("error",r=>this.reject(r)),this.s.once("close",()=>this.reject(new Error("Stream closed")))}async peek(t,r,n){let i=await this.read(t,r,n);return this.peekQueue.push(t.subarray(r,r+i)),i}async read(t,r,n){if(n===0)return 0;if(this.peekQueue.length===0&&this.endOfStream)throw new Nt;let i=n,s=0;for(;this.peekQueue.length>0&&i>0;){let a=this.peekQueue.pop();if(!a)throw new Error("peekData should be defined");let o=Math.min(a.length,i);t.set(a.subarray(0,o),r+s),s+=o,i-=o,o<a.length&&this.peekQueue.push(a.subarray(o))}for(;i>0&&!this.endOfStream;){let a=Math.min(i,Eq),o=await this.readFromStream(t,r+s,a);if(s+=o,o<a)break;i-=o}return s}async readFromStream(t,r,n){let i=this.s.read(n);if(i)return t.set(i,r),i.length;{let s={buffer:t,offset:r,length:n,deferred:new Cp};return this.deferred=s.deferred,this.s.once("readable",()=>{this.readDeferred(s)}),s.deferred.promise}}readDeferred(t){let r=this.s.read(t.length);r?(t.buffer.set(r,t.offset),t.deferred.resolve(r.length),this.deferred=null):this.s.once("readable",()=>{this.readDeferred(t)})}reject(t){this.endOfStream=!0,this.deferred&&(this.deferred.reject(t),this.deferred=null)}};import{Buffer as v2}from"node:buffer";var es=class{constructor(t){this.position=0,this.numBuffer=new Uint8Array(8),this.fileInfo=t||{}}async readToken(t,r=this.position){let n=v2.alloc(t.len);if(await this.readBuffer(n,{position:r})<t.len)throw new Nt;return t.get(n,0)}async peekToken(t,r=this.position){let n=v2.alloc(t.len);if(await this.peekBuffer(n,{position:r})<t.len)throw new Nt;return t.get(n,0)}async readNumber(t){if(await this.readBuffer(this.numBuffer,{length:t.len})<t.len)throw new Nt;return t.get(this.numBuffer,0)}async peekNumber(t){if(await this.peekBuffer(this.numBuffer,{length:t.len})<t.len)throw new Nt;return t.get(this.numBuffer,0)}async ignore(t){if(this.fileInfo.size!==void 0){let r=this.fileInfo.size-this.position;if(t>r)return this.position+=r,r}return this.position+=t,t}async close(){}normalizeOptions(t,r){if(r&&r.position!==void 0&&r.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return r?{mayBeLess:r.mayBeLess===!0,offset:r.offset?r.offset:0,length:r.length?r.length:t.length-(r.offset?r.offset:0),position:r.position?r.position:this.position}:{mayBeLess:!1,offset:0,length:t.length,position:this.position}}};var Sq=256e3,_p=class extends es{constructor(t,r){super(r),this.streamReader=new Ll(t)}async getFileInfo(){return this.fileInfo}async readBuffer(t,r){let n=this.normalizeOptions(t,r),i=n.position-this.position;if(i>0)return await this.ignore(i),this.readBuffer(t,r);if(i<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(n.length===0)return 0;let s=await this.streamReader.read(t,n.offset,n.length);if(this.position+=s,(!r||!r.mayBeLess)&&s<n.length)throw new Nt;return s}async peekBuffer(t,r){let n=this.normalizeOptions(t,r),i=0;if(n.position){let s=n.position-this.position;if(s>0){let a=new Uint8Array(n.length+s);return i=await this.peekBuffer(a,{mayBeLess:n.mayBeLess}),t.set(a.subarray(s),n.offset),i-s}else if(s<0)throw new Error("Cannot peek from a negative offset in a stream")}if(n.length>0){try{i=await this.streamReader.peek(t,n.offset,n.length)}catch(s){if(r&&r.mayBeLess&&s instanceof Nt)return 0;throw s}if(!n.mayBeLess&&i<n.length)throw new Nt}return i}async ignore(t){let r=Math.min(Sq,t),n=new Uint8Array(r),i=0;for(;i<t;){let s=t-i,a=await this.readBuffer(n,{length:Math.min(r,s)});if(a<0)return a;i+=a}return i}};var Op=class extends es{constructor(t,r){super(r),this.uint8Array=t,this.fileInfo.size=this.fileInfo.size?this.fileInfo.size:t.length}async readBuffer(t,r){if(r&&r.position){if(r.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");this.position=r.position}let n=await this.peekBuffer(t,r);return this.position+=n,n}async peekBuffer(t,r){let n=this.normalizeOptions(t,r),i=Math.min(this.uint8Array.length-n.position,n.length);if(!n.mayBeLess&&i<n.length)throw new Nt;return t.set(this.uint8Array.subarray(n.position,n.position+i),n.offset),i}async close(){}};function Ay(e,t){return t=t||{},new _p(e,t)}function wy(e,t){return new Op(e,t)}var Cy=class extends es{constructor(t,r){super(r),this.fd=t}async readBuffer(t,r){let n=this.normalizeOptions(t,r);this.position=n.position;let i=await Py(this.fd,t,n.offset,n.length,n.position);if(this.position+=i.bytesRead,i.bytesRead<n.length&&(!r||!r.mayBeLess))throw new Nt;return i.bytesRead}async peekBuffer(t,r){let n=this.normalizeOptions(t,r),i=await Py(this.fd,t,n.offset,n.length,n.position);if(!n.mayBeLess&&i.bytesRead<n.length)throw new Nt;return i.bytesRead}async close(){return y2(this.fd)}};async function _y(e){let t=await Ty(e);if(!t.isFile)throw new Error(`File not a file: ${e}`);let r=await b2(e,"r");return new Cy(r,{path:e,size:t.size})}import{Buffer as ts}from"node:buffer";var S2=Gs(E2(),1);import{Buffer as Pq}from"node:buffer";function zr(e){return new DataView(e.buffer,e.byteOffset)}var T2={len:1,get(e,t){return zr(e).getUint8(t)},put(e,t,r){return zr(e).setUint8(t,r),t+1}},Ip={len:2,get(e,t){return zr(e).getUint16(t,!0)},put(e,t,r){return zr(e).setUint16(t,r,!0),t+2}},Dp={len:2,get(e,t){return zr(e).getUint16(t)},put(e,t,r){return zr(e).setUint16(t,r),t+2}};var P2={len:4,get(e,t){return zr(e).getUint32(t,!0)},put(e,t,r){return zr(e).setUint32(t,r,!0),t+4}},A2={len:4,get(e,t){return zr(e).getUint32(t)},put(e,t,r){return zr(e).setUint32(t,r),t+4}};var w2={len:4,get(e,t){return zr(e).getInt32(t)},put(e,t,r){return zr(e).setInt32(t,r),t+4}};var C2={len:8,get(e,t){return zr(e).getBigUint64(t,!0)},put(e,t,r){return zr(e).setBigUint64(t,r,!0),t+8}};var bi=class{constructor(t,r){this.len=t,this.encoding=r}get(t,r){return Pq.from(t).toString(this.encoding,r,r+this.len)}},Iy=class e{constructor(t){this.len=t}static decode(t,r,n){let i="";for(let s=r;s<n;++s)i+=e.codePointToString(e.singleByteDecoder(t[s]));return i}static inRange(t,r,n){return r<=t&&t<=n}static codePointToString(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}static singleByteDecoder(t){if(e.inRange(t,0,127))return t;let r=e.windows1252[t-128];if(r===null)throw Error("invaliding encoding");return r}get(t,r=0){return e.decode(t,r,r+this.len)}};Iy.windows1252=[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255];function _2(e){return[...e].map(t=>t.charCodeAt(0))}function O2(e,t=0){let r=Number.parseInt(e.toString("utf8",148,154).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(r))return!1;let n=8*32;for(let i=t;i<t+148;i++)n+=e[i];for(let i=t+156;i<t+512;i++)n+=e[i];return r===n}var I2={get:(e,t)=>e[t+3]&127|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4};var D2=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","ai","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx"],N2=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/x-apache-arrow","video/mp4","audio/midi","video/x-matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","audio/opus","video/ogg","audio/ogg","application/ogg","audio/x-flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/x-parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx"];var k2=4100;function Qn(e,t,r){r={offset:0,...r};for(let[n,i]of t.entries())if(r.mask){if(i!==(r.mask[n]&e[n+r.offset]))return!1}else if(i!==e[n+r.offset])return!1;return!0}var Np=class{constructor(t){this.detectors=t?.customDetectors,this.fromTokenizer=this.fromTokenizer.bind(this),this.fromBuffer=this.fromBuffer.bind(this),this.parse=this.parse.bind(this)}async fromTokenizer(t){let r=t.position;for(let n of this.detectors||[]){let i=await n(t);if(i)return i;if(r!==t.position)return}return this.parse(t)}async fromBuffer(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`Buffer\` or \`ArrayBuffer\`, got \`${typeof t}\``);let r=t instanceof Uint8Array?t:new Uint8Array(t);if(r?.length>1)return this.fromTokenizer(wy(r))}async fromBlob(t){let r=await t.arrayBuffer();return this.fromBuffer(new Uint8Array(r))}async fromStream(t){let r=await Ay(t);try{return await this.fromTokenizer(r)}finally{await r.close()}}async toDetectionStream(t,r={}){let{default:n}=await import("node:stream"),{sampleSize:i=k2}=r;return new Promise((s,a)=>{t.on("error",a),t.once("readable",()=>{(async()=>{try{let o=new n.PassThrough,l=n.pipeline?n.pipeline(t,o,()=>{}):t.pipe(o),u=t.read(i)??t.read()??ts.alloc(0);try{o.fileType=await this.fromBuffer(u)}catch(c){c instanceof Nt?o.fileType=void 0:a(c)}s(l)}catch(o){a(o)}})()})})}check(t,r){return Qn(this.buffer,t,r)}checkString(t,r){return this.check(_2(t),r)}async parse(t){if(this.buffer=ts.alloc(k2),t.fileInfo.size===void 0&&(t.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=t,await t.peekBuffer(this.buffer,{length:12,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await t.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.tokenizer.ignore(3),this.parse(t);if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await t.ignore(6);let r=await t.readToken(I2);return t.position+r>t.fileInfo.size?{ext:"mp3",mime:"audio/mpeg"}:(await t.ignore(r),this.fromTokenizer(t))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){try{for(;t.position+30<t.fileInfo.size;){await t.readBuffer(this.buffer,{length:30});let r={compressedSize:this.buffer.readUInt32LE(18),uncompressedSize:this.buffer.readUInt32LE(22),filenameLength:this.buffer.readUInt16LE(26),extraFieldLength:this.buffer.readUInt16LE(28)};if(r.filename=await t.readToken(new bi(r.filenameLength,"utf-8")),await t.ignore(r.extraFieldLength),r.filename==="META-INF/mozilla.rsa")return{ext:"xpi",mime:"application/x-xpinstall"};if(r.filename.endsWith(".rels")||r.filename.endsWith(".xml"))switch(r.filename.split("/")[0]){case"_rels":break;case"word":return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};case"ppt":return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};case"xl":return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};default:break}if(r.filename.startsWith("xl/"))return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(r.filename.startsWith("3D/")&&r.filename.endsWith(".model"))return{ext:"3mf",mime:"model/3mf"};if(r.filename==="mimetype"&&r.compressedSize===r.uncompressedSize){let n=await t.readToken(new bi(r.compressedSize,"utf-8"));switch(n=n.trim(),n){case"application/epub+zip":return{ext:"epub",mime:"application/epub+zip"};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:"application/vnd.oasis.opendocument.text"};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:"application/vnd.oasis.opendocument.spreadsheet"};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:"application/vnd.oasis.opendocument.presentation"};default:}}if(r.compressedSize===0){let n=-1;for(;n<0&&t.position<t.fileInfo.size;)await t.peekBuffer(this.buffer,{mayBeLess:!0}),n=this.buffer.indexOf("504B0304",0,"hex"),await t.ignore(n>=0?n:this.buffer.length)}else await t.ignore(r.compressedSize)}}catch(r){if(!(r instanceof Nt))throw r}return{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await t.ignore(28);let r=ts.alloc(8);return await t.readBuffer(r),Qn(r,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/opus"}:Qn(r,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:Qn(r,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:Qn(r,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:Qn(r,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:Qn(r,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("ftyp",{offset:4})&&this.buffer[8]&96){let r=this.buffer.toString("binary",8,12).replace("\0"," ").trim();switch(r){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return r.startsWith("3g")?r.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/x-flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF")){try{await t.ignore(1350);let r=10*1024*1024,n=ts.alloc(Math.min(r,t.fileInfo.size));if(await t.readBuffer(n,{mayBeLess:!0}),n.includes(ts.from("AIPrivateData")))return{ext:"ai",mime:"application/postscript"}}catch(r){if(!(r instanceof Nt))throw r}return{ext:"pdf",mime:"application/pdf"}}if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){let r=await this.readTiffHeader(!1);if(r)return r}if(this.check([77,77])){let r=await this.readTiffHeader(!0);if(r)return r}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function r(){let o=await t.peekNumber(T2),l=128,u=0;for(;!(o&l)&&l!==0;)++u,l>>=1;let c=ts.alloc(u+1);return await t.readBuffer(c),c}async function n(){let o=await r(),l=await r();l[0]^=128>>l.length-1;let u=Math.min(6,l.length);return{id:o.readUIntBE(0,o.length),len:l.readUIntBE(l.length-u,u)}}async function i(o){for(;o>0;){let l=await n();if(l.id===17026)return(await t.readToken(new bi(l.len,"utf-8"))).replaceAll(/\00.*$/g,"");await t.ignore(l.len),--o}}let s=await n();switch(await i(s.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/x-matroska"};default:return}}if(this.check([82,73,70,70])){if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1"))return{ext:"parquet",mime:"application/x-parquet"};if(this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190]))return{ext:"class",mime:"application/java-vm"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){let r=this.buffer.toString("binary",2,6);if(r.match("^d*")&&r>=1e3&&r<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await t.ignore(8),await t.readToken(new bi(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("**ACE",{offset:7})&&(await t.peekBuffer(this.buffer,{length:14,mayBeLess:!0}),this.checkString("**",{offset:12})))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.check([137,80,78,71,13,10,26,10])){await t.ignore(8);async function r(){return{length:await t.readToken(w2),type:await t.readToken(new bi(4,"binary"))}}do{let n=await r();if(n.length<0)return;switch(n.type){case"IDAT":return{ext:"png",mime:"image/png"};case"acTL":return{ext:"apng",mime:"image/apng"};default:await t.ignore(n.length+4)}}while(t.position+8<t.fileInfo.size);return{ext:"png",mime:"image/png"}}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/x-apache-arrow"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){async function r(){let n=ts.alloc(16);return await t.readBuffer(n),{id:n,size:Number(await t.readToken(C2))}}for(await t.ignore(30);t.position+24<t.fileInfo.size;){let n=await r(),i=n.size-24;if(Qn(n.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){let s=ts.alloc(16);if(i-=await t.readBuffer(s),Qn(s,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(Qn(s,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}await t.ignore(i)}return{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await t.ignore(20),await t.readToken(new bi(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.check([0,60,0,63,0,120,0,109,0,108],{offset:2})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await t.peekBuffer(this.buffer,{length:Math.min(256,t.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){let r=this.buffer.readUInt32LE(12);if(r>12&&this.buffer.length>=r+16)try{let n=this.buffer.slice(16,r+16).toString();if(JSON.parse(n).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(await t.peekBuffer(this.buffer,{length:Math.min(512,t.fileInfo.size),mayBeLess:!0}),O2(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254]))return this.check([60,0,63,0,120,0,109,0,108,0],{offset:2})?{ext:"xml",mime:"application/xml"}:this.check([255,14,83,0,107,0,101,0,116,0,99,0,104,0,85,0,112,0,32,0,77,0,111,0,100,0,101,0,108,0],{offset:2})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:void 0;if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"};if(this.buffer.length>=2&&this.check([255,224],{offset:0,mask:[255,224]})){if(this.check([16],{offset:1,mask:[22]}))return this.check([8],{offset:1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}async readTiffTag(t){let r=await this.tokenizer.readToken(t?Dp:Ip);switch(this.tokenizer.ignore(10),r){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"};default:}}async readTiffIFD(t){let r=await this.tokenizer.readToken(t?Dp:Ip);for(let n=0;n<r;++n){let i=await this.readTiffTag(t);if(i)return i}}async readTiffHeader(t){let r=(t?Dp:Ip).get(this.buffer,2),n=(t?A2:P2).get(this.buffer,4);if(r===42){if(n>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(n>=8&&(this.check([28,0,254,0],{offset:8})||this.check([31,0,11,0],{offset:8})))return{ext:"nef",mime:"image/x-nikon-nef"}}return await this.tokenizer.ignore(n),await this.readTiffIFD(t)??{ext:"tif",mime:"image/tiff"}}if(r===43)return{ext:"tif",mime:"image/tiff"}}};var Nqe=new Set(D2),kqe=new Set(N2);async function F2(e,t){let r=await _y(e);try{return await new Np(t).fromTokenizer(r)}finally{await r.close()}}var Ew=Gs(q2(),1);var ow=Gs(Z2(),1);var Ml=e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")};var qq={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},ql=e=>e.replace(/[[\]\\-]/g,"\\$&"),Uq=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ew=e=>e.join(""),tw=(e,t)=>{let r=t;if(e.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],i=[],s=r+1,a=!1,o=!1,l=!1,u=!1,c=r,p="";e:for(;s<e.length;){let d=e.charAt(s);if((d==="!"||d==="^")&&s===r+1){u=!0,s++;continue}if(d==="]"&&a&&!l){c=s+1;break}if(a=!0,d==="\\"&&!l){l=!0,s++;continue}if(d==="["&&!l){for(let[y,[x,_,O]]of Object.entries(qq))if(e.startsWith(y,s)){if(p)return["$.",!1,e.length-r,!0];s+=y.length,O?i.push(x):n.push(x),o=o||_;continue e}}if(l=!1,p){d>p?n.push(ql(p)+"-"+ql(d)):d===p&&n.push(ql(d)),p="",s++;continue}if(e.startsWith("-]",s+1)){n.push(ql(d+"-")),s+=2;continue}if(e.startsWith("-",s+1)){p=d,s+=2;continue}n.push(ql(d)),s++}if(c<s)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,e.length-r,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!u){let d=n[0].length===2?n[0].slice(-1):n[0];return[Uq(d),!1,c-r,!1]}let f="["+(u?"^":"")+ew(n)+"]",m="["+(u?"":"^")+ew(i)+"]";return[n.length&&i.length?"("+f+"|"+m+")":n.length?f:m,o,c-r,!0]};var rs=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");var Vq=new Set(["!","?","+","*","@"]),rw=e=>Vq.has(e),$q="(?!(?:^|/)\\.\\.?(?:$|/))",Fp="(?!\\.)",Wq=new Set(["[","."]),Gq=new Set(["..","."]),Kq=new Set("().*{}+?[]^$\\!"),zq=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ky="[^/]",nw=ky+"*?",iw=ky+"+?",Ya=class e{type;#r;#n;#s=!1;#e=[];#t;#a;#l;#o=!1;#i;#u;#p=!1;constructor(t,r,n={}){this.type=t,t&&(this.#n=!0),this.#t=r,this.#r=this.#t?this.#t.#r:this,this.#i=this.#r===this?n:this.#r.#i,this.#l=this.#r===this?[]:this.#r.#l,t==="!"&&!this.#r.#o&&this.#l.push(this),this.#a=this.#t?this.#t.#e.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let t of this.#e)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#u!==void 0?this.#u:this.type?this.#u=this.type+"("+this.#e.map(t=>String(t)).join("|")+")":this.#u=this.#e.map(t=>String(t)).join("")}#d(){if(this!==this.#r)throw new Error("should only call on root");if(this.#o)return this;this.toString(),this.#o=!0;let t;for(;t=this.#l.pop();){if(t.type!=="!")continue;let r=t,n=r.#t;for(;n;){for(let i=r.#a+1;!n.type&&i<n.#e.length;i++)for(let s of t.#e){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(n.#e[i])}r=n,n=r.#t}}return this}push(...t){for(let r of t)if(r!==""){if(typeof r!="string"&&!(r instanceof e&&r.#t===this))throw new Error("invalid part: "+r);this.#e.push(r)}}toJSON(){let t=this.type===null?this.#e.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#e.map(r=>r.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#r||this.#r.#o&&this.#t?.type==="!")&&t.push({}),t}isStart(){if(this.#r===this)return!0;if(!this.#t?.isStart())return!1;if(this.#a===0)return!0;let t=this.#t;for(let r=0;r<this.#a;r++){let n=t.#e[r];if(!(n instanceof e&&n.type==="!"))return!1}return!0}isEnd(){if(this.#r===this||this.#t?.type==="!")return!0;if(!this.#t?.isEnd())return!1;if(!this.type)return this.#t?.isEnd();let t=this.#t?this.#t.#e.length:0;return this.#a===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let r=new e(this.type,t);for(let n of this.#e)r.copyIn(n);return r}static#c(t,r,n,i){let s=!1,a=!1,o=-1,l=!1;if(r.type===null){let m=n,g="";for(;m<t.length;){let d=t.charAt(m++);if(s||d==="\\"){s=!s,g+=d;continue}if(a){m===o+1?(d==="^"||d==="!")&&(l=!0):d==="]"&&!(m===o+2&&l)&&(a=!1),g+=d;continue}else if(d==="["){a=!0,o=m,l=!1,g+=d;continue}if(!i.noext&&rw(d)&&t.charAt(m)==="("){r.push(g),g="";let y=new e(d,r);m=e.#c(t,y,m,i),r.push(y);continue}g+=d}return r.push(g),m}let u=n+1,c=new e(null,r),p=[],f="";for(;u<t.length;){let m=t.charAt(u++);if(s||m==="\\"){s=!s,f+=m;continue}if(a){u===o+1?(m==="^"||m==="!")&&(l=!0):m==="]"&&!(u===o+2&&l)&&(a=!1),f+=m;continue}else if(m==="["){a=!0,o=u,l=!1,f+=m;continue}if(rw(m)&&t.charAt(u)==="("){c.push(f),f="";let g=new e(m,c);c.push(g),u=e.#c(t,g,u,i);continue}if(m==="|"){c.push(f),f="",p.push(c),c=new e(null,r);continue}if(m===")")return f===""&&r.#e.length===0&&(r.#p=!0),c.push(f),f="",r.push(...p,c),u;f+=m}return r.type=null,r.#n=void 0,r.#e=[t.substring(n-1)],u}static fromGlob(t,r={}){let n=new e(null,void 0,r);return e.#c(t,n,0,r),n}toMMPattern(){if(this!==this.#r)return this.#r.toMMPattern();let t=this.toString(),[r,n,i,s]=this.toRegExpSource();if(!(i||this.#n||this.#i.nocase&&!this.#i.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return n;let o=(this.#i.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${r}$`,o),{_src:r,_glob:t})}get options(){return this.#i}toRegExpSource(t){let r=t??!!this.#i.dot;if(this.#r===this&&this.#d(),!this.type){let l=this.isStart()&&this.isEnd(),u=this.#e.map(m=>{let[g,d,y,x]=typeof m=="string"?e.#h(m,this.#n,l):m.toRegExpSource(t);return this.#n=this.#n||y,this.#s=this.#s||x,g}).join(""),c="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&Gq.has(this.#e[0]))){let g=Wq,d=r&&g.has(u.charAt(0))||u.startsWith("\\.")&&g.has(u.charAt(2))||u.startsWith("\\.\\.")&&g.has(u.charAt(4)),y=!r&&!t&&g.has(u.charAt(0));c=d?$q:y?Fp:""}let p="";return this.isEnd()&&this.#r.#o&&this.#t?.type==="!"&&(p="(?:$|\\/)"),[c+u+p,rs(u),this.#n=!!this.#n,this.#s]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#f(r);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let l=this.toString();return this.#e=[l],this.type=null,this.#n=void 0,[l,rs(this.toString()),!1,!1]}let a=!n||t||r||!Fp?"":this.#f(!0);a===s&&(a=""),a&&(s=`(?:${s})(?:${a})*?`);let o="";if(this.type==="!"&&this.#p)o=(this.isStart()&&!r?Fp:"")+iw;else{let l=this.type==="!"?"))"+(this.isStart()&&!r&&!t?Fp:"")+nw+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;o=i+s+l}return[o,rs(s),this.#n=!!this.#n,this.#s]}#f(t){return this.#e.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,i,s,a]=r.toRegExpSource(t);return this.#s=this.#s||a,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#h(t,r,n=!1){let i=!1,s="",a=!1;for(let o=0;o<t.length;o++){let l=t.charAt(o);if(i){i=!1,s+=(Kq.has(l)?"\\":"")+l;continue}if(l==="\\"){o===t.length-1?s+="\\\\":i=!0;continue}if(l==="["){let[u,c,p,f]=tw(t,o);if(p){s+=u,a=a||c,o+=p-1,r=r||f;continue}}if(l==="*"){n&&t==="*"?s+=iw:s+=nw,r=!0;continue}if(l==="?"){s+=ky,r=!0;continue}s+=zq(l)}return[s,rs(t),!!r,a]}};var Fy=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&");var Xt=(e,t,r={})=>(Ml(t),!r.nocomment&&t.charAt(0)==="#"?!1:new Xa(t,r).match(e)),Hq=/^\*+([^+@!?\*\[\(]*)$/,Yq=e=>t=>!t.startsWith(".")&&t.endsWith(e),Xq=e=>t=>t.endsWith(e),Jq=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),Qq=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Zq=/^\*+\.\*+$/,eU=e=>!e.startsWith(".")&&e.includes("."),tU=e=>e!=="."&&e!==".."&&e.includes("."),rU=/^\.\*+$/,nU=e=>e!=="."&&e!==".."&&e.startsWith("."),iU=/^\*+$/,sU=e=>e.length!==0&&!e.startsWith("."),aU=e=>e.length!==0&&e!=="."&&e!=="..",oU=/^\?+([^+@!?\*\[\(]*)?$/,lU=([e,t=""])=>{let r=lw([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},uU=([e,t=""])=>{let r=uw([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},cU=([e,t=""])=>{let r=uw([e]);return t?n=>r(n)&&n.endsWith(t):r},pU=([e,t=""])=>{let r=lw([e]);return t?n=>r(n)&&n.endsWith(t):r},lw=([e])=>{let t=e.length;return r=>r.length===t&&!r.startsWith(".")},uw=([e])=>{let t=e.length;return r=>r.length===t&&r!=="."&&r!==".."},cw=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",sw={win32:{sep:"\\"},posix:{sep:"/"}},fU=cw==="win32"?sw.win32.sep:sw.posix.sep;Xt.sep=fU;var dn=Symbol("globstar **");Xt.GLOBSTAR=dn;var dU="[^/]",hU=dU+"*?",mU="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",yU="(?:(?!(?:\\/|^)\\.).)*?",bU=(e,t={})=>r=>Xt(r,e,t);Xt.filter=bU;var fn=(e,t={})=>Object.assign({},e,t),gU=e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return Xt;let t=Xt;return Object.assign((n,i,s={})=>t(n,i,fn(e,s)),{Minimatch:class extends t.Minimatch{constructor(i,s={}){super(i,fn(e,s))}static defaults(i){return t.defaults(fn(e,i)).Minimatch}},AST:class extends t.AST{constructor(i,s,a={}){super(i,s,fn(e,a))}static fromGlob(i,s={}){return t.AST.fromGlob(i,fn(e,s))}},unescape:(n,i={})=>t.unescape(n,fn(e,i)),escape:(n,i={})=>t.escape(n,fn(e,i)),filter:(n,i={})=>t.filter(n,fn(e,i)),defaults:n=>t.defaults(fn(e,n)),makeRe:(n,i={})=>t.makeRe(n,fn(e,i)),braceExpand:(n,i={})=>t.braceExpand(n,fn(e,i)),match:(n,i,s={})=>t.match(n,i,fn(e,s)),sep:t.sep,GLOBSTAR:dn})};Xt.defaults=gU;var pw=(e,t={})=>(Ml(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:(0,ow.default)(e));Xt.braceExpand=pw;var vU=(e,t={})=>new Xa(e,t).makeRe();Xt.makeRe=vU;var xU=(e,t,r={})=>{let n=new Xa(t,r);return e=e.filter(i=>n.match(i)),n.options.nonull&&!e.length&&e.push(t),e};Xt.match=xU;var aw=/[?*]|[+@!]\(.*?\)|\[|\]/,EU=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Xa=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,r={}){Ml(t),r=r||{},this.options=r,this.pattern=t,this.platform=r.platform||cw,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let r of t)if(typeof r!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,r=this.options;if(!r.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,a,o)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=s[0]===""&&s[1]===""&&(s[2]==="?"||!aw.test(s[2]))&&!aw.test(s[3]),u=/^[a-z]:/i.test(s[0]);if(l)return[...s.slice(0,4),...s.slice(4).map(c=>this.parse(c))];if(u)return[s[0],...s.slice(1).map(c=>this.parse(c))]}return s.map(l=>this.parse(l))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let a=this.set[s];a[0]===""&&a[1]===""&&this.globParts[s][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let n=0;n<t.length;n++)for(let i=0;i<t[n].length;i++)t[n][i]==="**"&&(t[n][i]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):r>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let i=n;for(;r[i+1]==="**";)i++;i!==n&&r.splice(n,i-n)}return r})}levelOneOptimize(t){return t.map(r=>(r=r.reduce((n,i)=>{let s=n[n.length-1];return i==="**"&&s==="**"?n:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(n.pop(),n):(n.push(i),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let i=1;i<t.length-1;i++){let s=t[i];i===1&&s===""&&t[0]===""||(s==="."||s==="")&&(r=!0,t.splice(i,1),i--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(r=!0,t.pop())}let n=0;for(;(n=t.indexOf("..",n+1))!==-1;){let i=t[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&(r=!0,t.splice(n-1,2),n-=2)}}while(r);return t.length===0?[""]:t}firstPhasePreProcess(t){let r=!1;do{r=!1;for(let n of t){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let a=i;for(;n[a+1]==="**";)a++;a>i&&n.splice(i+1,a-i);let o=n[i+1],l=n[i+2],u=n[i+3];if(o!==".."||!l||l==="."||l===".."||!u||u==="."||u==="..")continue;r=!0,n.splice(i,1);let c=n.slice(0);c[i]="**",t.push(c),i--}if(!this.preserveMultipleSlashes){for(let a=1;a<n.length-1;a++){let o=n[a];a===1&&o===""&&n[0]===""||(o==="."||o==="")&&(r=!0,n.splice(a,1),a--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let s=0;for(;(s=n.indexOf("..",s+1))!==-1;){let a=n[s-1];if(a&&a!=="."&&a!==".."&&a!=="**"){r=!0;let l=s===1&&n[s+1]==="**"?["."]:[];n.splice(s-1,2,...l),n.length===0&&n.push(""),s-=2}}}}while(r);return t}secondPhasePreProcess(t){for(let r=0;r<t.length-1;r++)for(let n=r+1;n<t.length;n++){let i=this.partsMatch(t[r],t[n],!this.preserveMultipleSlashes);i&&(t[r]=i,t[n]=[])}return t.filter(r=>r.length)}partsMatch(t,r,n=!1){let i=0,s=0,a=[],o="";for(;i<t.length&&s<r.length;)if(t[i]===r[s])a.push(o==="b"?r[s]:t[i]),i++,s++;else if(n&&t[i]==="**"&&r[s]===t[i+1])a.push(t[i]),i++;else if(n&&r[s]==="**"&&t[i]===r[s+1])a.push(r[s]),s++;else if(t[i]==="*"&&r[s]&&(this.options.dot||!r[s].startsWith("."))&&r[s]!=="**"){if(o==="b")return!1;o="a",a.push(t[i]),i++,s++}else if(r[s]==="*"&&t[i]&&(this.options.dot||!t[i].startsWith("."))&&t[i]!=="**"){if(o==="a")return!1;o="b",a.push(r[s]),i++,s++}else return!1;return t.length===r.length&&a}parseNegate(){if(this.nonegate)return;let t=this.pattern,r=!1,n=0;for(let i=0;i<t.length&&t.charAt(i)==="!";i++)r=!r,n++;n&&(this.pattern=t.slice(n)),this.negate=r}matchOne(t,r,n=!1){let i=this.options;if(this.isWindows){let d=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),y=!d&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),x=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),_=!x&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),O=y?3:d?0:void 0,k=_?3:x?0:void 0;if(typeof O=="number"&&typeof k=="number"){let[I,L]=[t[O],r[k]];I.toLowerCase()===L.toLowerCase()&&(r[k]=I,k>O?r=r.slice(k):O>k&&(t=t.slice(O)))}}let{optimizationLevel:s=1}=this.options;s>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:r}),this.debug("matchOne",t.length,r.length);for(var a=0,o=0,l=t.length,u=r.length;a<l&&o<u;a++,o++){this.debug("matchOne loop");var c=r[o],p=t[a];if(this.debug(r,c,p),c===!1)return!1;if(c===dn){this.debug("GLOBSTAR",[r,c,p]);var f=a,m=o+1;if(m===u){for(this.debug("** at the end");a<l;a++)if(t[a]==="."||t[a]===".."||!i.dot&&t[a].charAt(0)===".")return!1;return!0}for(;f<l;){var g=t[f];if(this.debug(`
442
442
  globstar while`,t,f,r,m,g),this.matchOne(t.slice(f),r.slice(m),n))return this.debug("globstar found match!",f,l,g),!0;if(g==="."||g===".."||!i.dot&&g.charAt(0)==="."){this.debug("dot detected!",t,f,r,m);break}this.debug("globstar swallow a segment, and continue"),f++}return!!(n&&(this.debug(`
443
- >>> no match, partial?`,t,f,r,m),f===l))}let d;if(typeof c=="string"?(d=p===c,this.debug("string match",c,p,d)):(d=c.test(p),this.debug("pattern match",c,p,d)),!d)return!1}if(a===l&&o===u)return!0;if(a===l)return n;if(o===u)return a===l-1&&t[a]==="";throw new Error("wtf?")}braceExpand(){return pw(this.pattern,this.options)}parse(t){Ml(t);let r=this.options;if(t==="**")return dn;if(t==="")return"";let n,i=null;(n=t.match(iU))?i=r.dot?aU:sU:(n=t.match(Hq))?i=(r.nocase?r.dot?Qq:Jq:r.dot?Xq:Yq)(n[1]):(n=t.match(oU))?i=(r.nocase?r.dot?uU:lU:r.dot?cU:pU)(n):(n=t.match(Zq))?i=r.dot?tU:eU:(n=t.match(rU))&&(i=nU);let s=Ya.fromGlob(t,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?hU:r.dot?mU:yU,i=new Set(r.nocase?["i"]:[]),s=t.map(l=>{let u=l.map(c=>{if(c instanceof RegExp)for(let p of c.flags.split(""))i.add(p);return typeof c=="string"?EU(c):c===dn?dn:c._src});return u.forEach((c,p)=>{let f=u[p+1],m=u[p-1];c!==dn||m===dn||(m===void 0?f!==void 0&&f!==dn?u[p+1]="(?:\\/|"+n+"\\/)?"+f:u[p]=n:f===void 0?u[p-1]=m+"(?:\\/|"+n+")?":f!==dn&&(u[p-1]=m+"(?:\\/|\\/"+n+"\\/)"+f,u[p+1]=dn))}),u.filter(c=>c!==dn).join("/")}).join("|"),[a,o]=t.length>1?["(?:",")"]:["",""];s="^"+a+s+o+"$",this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,r=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&r)return!0;let n=this.options;this.isWindows&&(t=t.split("\\").join("/"));let i=this.slashSplit(t);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let a=i[i.length-1];if(!a)for(let o=i.length-2;!a&&o>=0;o--)a=i[o];for(let o=0;o<s.length;o++){let l=s[o],u=i;if(n.matchBase&&l.length===1&&(u=[a]),this.matchOne(u,l,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(t){return Xt.defaults(t).Minimatch}};Xt.AST=Ya;Xt.Minimatch=Xa;Xt.escape=Fy;Xt.unescape=rs;import{readFile as jU}from"node:fs/promises";import{extname as Ly,join as LU}from"node:path";var fw="build",dw=[],hw=[],Bp="**/*.+(css|js|mjs)",mw=[".ds_store","thumbs.db"],yw="#dapp",By=20;import{createReadStream as SU,createWriteStream as TU}from"node:fs";import{Readable as PU}from"node:stream";import{createGunzip as AU,createGzip as wU}from"node:zlib";var fUe=async({source:e})=>await new Promise((t,r)=>{let n=PU.from(e),i=[],s=AU();n.pipe(s),s.on("data",a=>i.push(a)),s.on("end",()=>{t(Buffer.concat(i))}),s.on("error",r)}),bw=async({sourceFiles:e,gzip:t})=>{if(t===!1)return[];let r=t===!0?Bp:t,n=e.filter(i=>Xt(i,r));return await Promise.all(n.map(async i=>await CU({source:i})))},CU=async({source:e,destination:t})=>await new Promise((r,n)=>{let i=SU(e),s=t??`${e}.gz`,a=TU(s),o=wU();i.pipe(o).pipe(a),a.on("close",()=>{r(s)}),a.on("error",n)}),dUe=e=>e.length>2&&e[0]===31&&e[1]===139;import{lstatSync as DU}from"node:fs";import{basename as NU}from"node:path";import{lstatSync as _U,readdirSync as OU}from"node:fs";import{access as IU}from"node:fs/promises";import{join as gw}from"node:path";var jy=e=>OU(e).flatMap(t=>{let r=gw(e,t);return _U(r).isDirectory()?jy(r):gw(r)}),gUe=async e=>{try{return await IU(e),!0}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return!1;throw t}};var jp=({file:e,sourceAbsolutePath:t})=>e.replace(t,"").replace(/\\/g,"/"),vw=({sourceAbsolutePath:e,ignore:t})=>jy(e).filter(n=>kU({file:n,ignore:t})),kU=({file:e,ignore:t})=>DU(e).size<=0||mw.includes(NU(e).toLowerCase())?!1:t.find(r=>Xt(e,r))===void 0;var Sw=async({config:e,listAssets:t,assertSourceDirExists:r})=>{let{source:n=fw,ignore:i=dw,encoding:s=hw,gzip:a=Bp}=e,o=LU(process.cwd(),n);return r?.(o),{files:await UU({sourceAbsolutePath:o,ignore:i,encoding:s,gzip:a,listAssets:t}),sourceAbsolutePath:o}},RU=async({files:e,sourceAbsolutePath:t,listAssets:r})=>{let n=await r({}),i=e.map(async a=>await qU({file:a,sourceAbsolutePath:t,existingAssets:n}));return(await Promise.all(i)).filter(({upload:a})=>a).map(({file:a})=>a)},MU=async e=>{let t=await jU(e);return BU.createHash("sha256").update(t).digest("base64")},qU=async({file:e,existingAssets:t,sourceAbsolutePath:r})=>{let n=e.alternateFile??e.file,i=t.find(({fullPath:a})=>a===jp({file:n,sourceAbsolutePath:r}));if(xw(i))return{file:e,upload:!0};let s=await MU(n);return{file:e,upload:s!==i.encodings.identity?.sha256}},UU=async({sourceAbsolutePath:e,ignore:t,encoding:r,gzip:n,listAssets:i})=>{let s=vw({sourceAbsolutePath:e,ignore:t}),a=await bw({sourceFiles:s,gzip:n}),o=[...s,...a.filter(f=>!s.includes(f))],l=({file:f,ext:m})=>{let g=r.find(([d,y])=>Xt(f,d));if(FU(g)){let[d,y]=g;return y}if(m==="Z")return"compress";if(m==="gz")return"gzip";if(Ly(f)===".br")return"br";if(Ly(f)===".zlib")return"deflate"},u=({file:f,encodingType:m})=>{if(!xw(m))return o.find(g=>g===f.replace(Ly(f),""))},c=async f=>{let m=await F2(f),g=l({file:f,ext:m?.ext}),d=u({file:f,encodingType:g}),y=Ew.default.lookup(d??f);return{file:f,alternateFile:d,mime:typeof y=="string"?y:void 0,encoding:g}},p=await Promise.all(o.map(c));return await RU({files:p,sourceAbsolutePath:e,listAssets:i})};var $N=Gs(VN(),1);import{isNullish as IJ,nonNullish as DJ}from"@junobuild/utils";import{Blob as NJ}from"buffer";import{readFile as kJ}from"node:fs/promises";import{basename as FJ,relative as BJ}from"node:path";var WN=async({files:e,sourceAbsolutePath:t,uploadFile:r})=>{let n=a=>a.alternateFile??a.file,i=async a=>{let o=n(a);await r({filename:FJ(o),fullPath:jp({file:o,sourceAbsolutePath:t}),data:new NJ([await kJ(a.file)]),collection:yw,headers:[...a.mime===void 0?[]:[["Content-Type",a.mime]]],encoding:a.encoding})},s=async a=>{for(let o=0;o<a.length;o+=20){let l=a.slice(o,o+20);await new $N.default(l.map(c=>({title:`Uploading ${BJ(t,c.file)}`,task:async()=>await i(c)})),{concurrent:!0}).run()}};await s(e.filter(({alternateFile:a})=>DJ(a))),await s(e.filter(({alternateFile:a})=>IJ(a)))};var PGe=async({assertMemory:e,uploadFile:t,...r})=>{let{files:n,sourceAbsolutePath:i}=await Sw(r);if(n.length===0){console.log("No new files to upload.");return}await e?.(),await WN({files:n,sourceAbsolutePath:i,uploadFile:t}),console.log(`
444
- \u{1F680} Deploy complete!`)};import{existsSync as Pp}from"node:fs";import{access as $7e,readFile as W7e}from"node:fs/promises";import{extname as G7e,join as Fl}from"node:path";var aq=Gs(Zt(),1),oq=Gs(LA(),1),lq=Gs(MA(),1);import{defineConfig as q7e,defineConsoleConfig as U7e,defineDevConfig as V7e}from"@junobuild/config";var uq=({id:e,extension:t})=>{delete ne.cache[e];let r=ne("module"),n=r._load;try{return ne.extensions[t]=(i,s)=>{let a=(0,aq.transformFileSync)(s,{presets:[lq.default],plugins:[oq.default]}).code;i._compile(a,s)},r._load=function(i){return i==="@junobuild/config"?{defineConfig:s=>q7e(s),defineDevConfig:s=>V7e(s),defineConsoleConfig:s=>U7e(s)}:n.apply(this,arguments)},ne(e)}finally{ne.extensions[t]=void 0,r._load=n}};var GZe=async e=>{try{let{configPath:t}=cq(e);return await $7e(t),!0}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return!1;throw t}},cq=({filename:e})=>{let t=Fl(process.cwd(),`${e}.ts`);if(Pp(t))return{configPath:t,configType:"ts"};let r=Fl(process.cwd(),`${e}.js`);if(Pp(r))return{configPath:r,configType:"js"};let n=Fl(process.cwd(),`${e}.mjs`);if(Pp(n))return{configPath:n,configType:"js"};let i=Fl(process.cwd(),`${e}.cjs`);if(Pp(i))return{configPath:i,configType:"js"};let s=Fl(process.cwd(),`${e.replace(".config","")}.json`);return Pp(s)?{configPath:s,configType:"json"}:{configPath:Fl(process.cwd(),`${e}.json`),configType:"json"}},KZe=async({config:e,...t})=>{let{configPath:r,configType:n}=cq({...t});switch(n){case"ts":case"js":{let{default:i}=uq({id:r,extension:G7e(r)});return e(i)}default:{let i=await W7e(r);return JSON.parse(i.toString("utf-8"))}}};var HZe=({args:e,options:t})=>e?.find(r=>t.includes(r))!==void 0,YZe=({args:e,option:t})=>{let r=(e??[]).findIndex(n=>n===t);if(r!==-1)return e?.[r+1]};import{nonNullish as pq}from"@junobuild/utils";import{spawn as fq}from"child_process";var ZZe=async({command:e,cwd:t,args:r,stdout:n,silentOut:i=!1,silentErrors:s=!1})=>await new Promise((a,o)=>{let l=fq(e,r,{shell:!0,...pq(t)&&{cwd:t}});l.stdout.on("data",u=>{if(pq(n)){n(`${u}`);return}i||console.log(`${u}`)}),l.stderr.on("data",u=>{s||o(new Error(`${u}`))}),l.on("close",u=>{a(u)}),l.on("error",u=>{o(u)})}),eet=async({command:e,args:t})=>await new Promise(r=>{fq(e,t??[],{stdio:"inherit"}).on("close",i=>{if(i===0){r(i);return}process.exit(1)})});import{nonNullish as K7e}from"@junobuild/utils";import{get as z7e}from"https";var H7e=async e=>await new Promise((t,r)=>{z7e(e,async n=>{K7e(n.statusCode)&&[301,302].includes(n.statusCode)&&await H7e(n.headers.location).then(t,r);let i=[];n.on("data",s=>i.push(s)),n.on("end",()=>{t(Buffer.concat(i))}),n.on("error",r)})});export{yw as COLLECTION_DAPP,hw as DEPLOY_DEFAULT_ENCODING,Bp as DEPLOY_DEFAULT_GZIP,dw as DEPLOY_DEFAULT_IGNORE,fw as DEPLOY_DEFAULT_SOURCE,mw as IGNORE_OS_FILES,By as UPLOAD_BATCH_SIZE,PGe as deploy,H7e as downloadFromURL,eet as execute,gUe as fileExists,jy as files,fUe as gunzipFile,CU as gzipFile,bw as gzipFiles,HZe as hasArgs,dUe as isGzip,GZe as junoConfigExist,cq as junoConfigFile,YZe as nextArg,KZe as readJunoConfig,ZZe as spawn};
443
+ >>> no match, partial?`,t,f,r,m),f===l))}let d;if(typeof c=="string"?(d=p===c,this.debug("string match",c,p,d)):(d=c.test(p),this.debug("pattern match",c,p,d)),!d)return!1}if(a===l&&o===u)return!0;if(a===l)return n;if(o===u)return a===l-1&&t[a]==="";throw new Error("wtf?")}braceExpand(){return pw(this.pattern,this.options)}parse(t){Ml(t);let r=this.options;if(t==="**")return dn;if(t==="")return"";let n,i=null;(n=t.match(iU))?i=r.dot?aU:sU:(n=t.match(Hq))?i=(r.nocase?r.dot?Qq:Jq:r.dot?Xq:Yq)(n[1]):(n=t.match(oU))?i=(r.nocase?r.dot?uU:lU:r.dot?cU:pU)(n):(n=t.match(Zq))?i=r.dot?tU:eU:(n=t.match(rU))&&(i=nU);let s=Ya.fromGlob(t,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?hU:r.dot?mU:yU,i=new Set(r.nocase?["i"]:[]),s=t.map(l=>{let u=l.map(c=>{if(c instanceof RegExp)for(let p of c.flags.split(""))i.add(p);return typeof c=="string"?EU(c):c===dn?dn:c._src});return u.forEach((c,p)=>{let f=u[p+1],m=u[p-1];c!==dn||m===dn||(m===void 0?f!==void 0&&f!==dn?u[p+1]="(?:\\/|"+n+"\\/)?"+f:u[p]=n:f===void 0?u[p-1]=m+"(?:\\/|"+n+")?":f!==dn&&(u[p-1]=m+"(?:\\/|\\/"+n+"\\/)"+f,u[p+1]=dn))}),u.filter(c=>c!==dn).join("/")}).join("|"),[a,o]=t.length>1?["(?:",")"]:["",""];s="^"+a+s+o+"$",this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,r=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&r)return!0;let n=this.options;this.isWindows&&(t=t.split("\\").join("/"));let i=this.slashSplit(t);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let a=i[i.length-1];if(!a)for(let o=i.length-2;!a&&o>=0;o--)a=i[o];for(let o=0;o<s.length;o++){let l=s[o],u=i;if(n.matchBase&&l.length===1&&(u=[a]),this.matchOne(u,l,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(t){return Xt.defaults(t).Minimatch}};Xt.AST=Ya;Xt.Minimatch=Xa;Xt.escape=Fy;Xt.unescape=rs;import{readFile as jU}from"node:fs/promises";import{extname as Ly,join as LU}from"node:path";var fw="build",dw=[],hw=[],Bp="**/*.+(css|js|mjs)",mw=[".ds_store","thumbs.db"],yw="#dapp",By=20;import{createReadStream as SU,createWriteStream as TU}from"node:fs";import{Readable as PU}from"node:stream";import{createGunzip as AU,createGzip as wU}from"node:zlib";var fUe=async({source:e})=>await new Promise((t,r)=>{let n=PU.from(e),i=[],s=AU();n.pipe(s),s.on("data",a=>i.push(a)),s.on("end",()=>{t(Buffer.concat(i))}),s.on("error",r)}),bw=async({sourceFiles:e,gzip:t})=>{if(t===!1)return[];let r=t===!0?Bp:t,n=e.filter(i=>Xt(i,r));return await Promise.all(n.map(async i=>await CU({source:i})))},CU=async({source:e,destination:t})=>await new Promise((r,n)=>{let i=SU(e),s=t??`${e}.gz`,a=TU(s),o=wU();i.pipe(o).pipe(a),a.on("close",()=>{r(s)}),a.on("error",n)}),dUe=e=>e.length>2&&e[0]===31&&e[1]===139;import{lstatSync as DU}from"node:fs";import{basename as NU}from"node:path";import{lstatSync as _U,readdirSync as OU}from"node:fs";import{access as IU}from"node:fs/promises";import{join as gw}from"node:path";var jy=e=>OU(e).flatMap(t=>{let r=gw(e,t);return _U(r).isDirectory()?jy(r):gw(r)}),gUe=async e=>{try{return await IU(e),!0}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return!1;throw t}};var jp=({file:e,sourceAbsolutePath:t})=>e.replace(t,"").replace(/\\/g,"/"),vw=({sourceAbsolutePath:e,ignore:t})=>jy(e).filter(n=>kU({file:n,ignore:t})),kU=({file:e,ignore:t})=>DU(e).size<=0||mw.includes(NU(e).toLowerCase())?!1:t.find(r=>Xt(e,r))===void 0;var Sw=async({config:e,listAssets:t,assertSourceDirExists:r})=>{let{source:n=fw,ignore:i=dw,encoding:s=hw,gzip:a=Bp}=e,o=LU(process.cwd(),n);return r?.(o),{files:await UU({sourceAbsolutePath:o,ignore:i,encoding:s,gzip:a,listAssets:t}),sourceAbsolutePath:o}},RU=async({files:e,sourceAbsolutePath:t,listAssets:r})=>{let n=await r({}),i=e.map(async a=>await qU({file:a,sourceAbsolutePath:t,existingAssets:n}));return(await Promise.all(i)).filter(({upload:a})=>a).map(({file:a})=>a)},MU=async e=>{let t=await jU(e);return BU.createHash("sha256").update(t).digest("base64")},qU=async({file:e,existingAssets:t,sourceAbsolutePath:r})=>{let n=e.alternateFile??e.file,i=t.find(({fullPath:a})=>a===jp({file:n,sourceAbsolutePath:r}));if(xw(i))return{file:e,upload:!0};let s=await MU(n);return{file:e,upload:s!==i.encodings.identity?.sha256}},UU=async({sourceAbsolutePath:e,ignore:t,encoding:r,gzip:n,listAssets:i})=>{let s=vw({sourceAbsolutePath:e,ignore:t}),a=await bw({sourceFiles:s,gzip:n}),o=[...s,...a.filter(f=>!s.includes(f))],l=({file:f,ext:m})=>{let g=r.find(([d,y])=>Xt(f,d));if(FU(g)){let[d,y]=g;return y}if(m==="Z")return"compress";if(m==="gz")return"gzip";if(Ly(f)===".br")return"br";if(Ly(f)===".zlib")return"deflate"},u=({file:f,encodingType:m})=>{if(!xw(m))return o.find(g=>g===f.replace(Ly(f),""))},c=async f=>{let m=await F2(f),g=l({file:f,ext:m?.ext}),d=u({file:f,encodingType:g}),y=Ew.default.lookup(d??f);return{file:f,alternateFile:d,mime:typeof y=="string"?y:void 0,encoding:g}},p=await Promise.all(o.map(c));return await RU({files:p,sourceAbsolutePath:e,listAssets:i})};var $N=Gs(VN(),1);import{isNullish as IJ,nonNullish as DJ}from"@junobuild/utils";import{Blob as NJ}from"buffer";import{readFile as kJ}from"node:fs/promises";import{basename as FJ,relative as BJ}from"node:path";var WN=async({files:e,sourceAbsolutePath:t,uploadFile:r})=>{let n=a=>a.alternateFile??a.file,i=async a=>{let o=n(a);await r({filename:FJ(o),fullPath:jp({file:o,sourceAbsolutePath:t}),data:new NJ([await kJ(a.file)]),collection:yw,headers:[...a.mime===void 0?[]:[["Content-Type",a.mime]]],encoding:a.encoding})},s=async a=>{for(let o=0;o<a.length;o+=20){let l=a.slice(o,o+20);await new $N.default(l.map(c=>({title:`Uploading ${BJ(t,c.file)}`,task:async()=>await i(c)})),{concurrent:!0}).run()}};await s(e.filter(({alternateFile:a})=>DJ(a))),await s(e.filter(({alternateFile:a})=>IJ(a)))};var PGe=async({assertMemory:e,uploadFile:t,...r})=>{let{files:n,sourceAbsolutePath:i}=await Sw(r);return n.length===0?(console.log("No new files to upload."),{sourceFiles:n,sourceAbsolutePath:i}):(await e?.(),await WN({files:n,sourceAbsolutePath:i,uploadFile:t}),console.log(`
444
+ \u{1F680} Deploy complete!`),{sourceFiles:n,sourceAbsolutePath:i})};import{existsSync as Pp}from"node:fs";import{access as $7e,readFile as W7e}from"node:fs/promises";import{extname as G7e,join as Fl}from"node:path";var aq=Gs(Zt(),1),oq=Gs(LA(),1),lq=Gs(MA(),1);import{defineConfig as q7e,defineConsoleConfig as U7e,defineDevConfig as V7e}from"@junobuild/config";var uq=({id:e,extension:t})=>{delete ne.cache[e];let r=ne("module"),n=r._load;try{return ne.extensions[t]=(i,s)=>{let a=(0,aq.transformFileSync)(s,{presets:[lq.default],plugins:[oq.default]}).code;i._compile(a,s)},r._load=function(i){return i==="@junobuild/config"?{defineConfig:s=>q7e(s),defineDevConfig:s=>V7e(s),defineConsoleConfig:s=>U7e(s)}:n.apply(this,arguments)},ne(e)}finally{ne.extensions[t]=void 0,r._load=n}};var GZe=async e=>{try{let{configPath:t}=cq(e);return await $7e(t),!0}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return!1;throw t}},cq=({filename:e})=>{let t=Fl(process.cwd(),`${e}.ts`);if(Pp(t))return{configPath:t,configType:"ts"};let r=Fl(process.cwd(),`${e}.js`);if(Pp(r))return{configPath:r,configType:"js"};let n=Fl(process.cwd(),`${e}.mjs`);if(Pp(n))return{configPath:n,configType:"js"};let i=Fl(process.cwd(),`${e}.cjs`);if(Pp(i))return{configPath:i,configType:"js"};let s=Fl(process.cwd(),`${e.replace(".config","")}.json`);return Pp(s)?{configPath:s,configType:"json"}:{configPath:Fl(process.cwd(),`${e}.json`),configType:"json"}},KZe=async({config:e,...t})=>{let{configPath:r,configType:n}=cq({...t});switch(n){case"ts":case"js":{let{default:i}=uq({id:r,extension:G7e(r)});return e(i)}default:{let i=await W7e(r);return JSON.parse(i.toString("utf-8"))}}};var HZe=({args:e,options:t})=>e?.find(r=>t.includes(r))!==void 0,YZe=({args:e,option:t})=>{let r=(e??[]).findIndex(n=>n===t);if(r!==-1)return e?.[r+1]};import{nonNullish as pq}from"@junobuild/utils";import{spawn as fq}from"child_process";var ZZe=async({command:e,cwd:t,args:r,stdout:n,silentOut:i=!1,silentErrors:s=!1})=>await new Promise((a,o)=>{let l=fq(e,r,{shell:!0,...pq(t)&&{cwd:t}});l.stdout.on("data",u=>{if(pq(n)){n(`${u}`);return}i||console.log(`${u}`)}),l.stderr.on("data",u=>{s||o(new Error(`${u}`))}),l.on("close",u=>{a(u)}),l.on("error",u=>{o(u)})}),eet=async({command:e,args:t})=>await new Promise(r=>{fq(e,t??[],{stdio:"inherit"}).on("close",i=>{if(i===0){r(i);return}process.exit(1)})});import{nonNullish as K7e}from"@junobuild/utils";import{get as z7e}from"https";var H7e=async e=>await new Promise((t,r)=>{z7e(e,async n=>{K7e(n.statusCode)&&[301,302].includes(n.statusCode)&&await H7e(n.headers.location).then(t,r);let i=[];n.on("data",s=>i.push(s)),n.on("end",()=>{t(Buffer.concat(i))}),n.on("error",r)})});export{yw as COLLECTION_DAPP,hw as DEPLOY_DEFAULT_ENCODING,Bp as DEPLOY_DEFAULT_GZIP,dw as DEPLOY_DEFAULT_IGNORE,fw as DEPLOY_DEFAULT_SOURCE,mw as IGNORE_OS_FILES,By as UPLOAD_BATCH_SIZE,PGe as deploy,H7e as downloadFromURL,eet as execute,gUe as fileExists,jy as files,fUe as gunzipFile,CU as gzipFile,bw as gzipFiles,HZe as hasArgs,dUe as isGzip,GZe as junoConfigExist,cq as junoConfigFile,YZe as nextArg,KZe as readJunoConfig,ZZe as spawn};
445
445
  /*! Bundled license information:
446
446
 
447
447
  ieee754/index.js: