@junobuild/cli 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -657,7 +657,7 @@ ${t}`,fce=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),dce=Obj
|
|
|
657
657
|
`),i=Math.max(0,n.length-r);return i?wd(t,$D(n.slice(0,i).join(`
|
|
658
658
|
`)).length+1):t},Fce=NB(Nce.stdout),spe=Fce,ape=NB(Nce.stderr)});function mXe(e){return e.replace(cpe,"")}function hXe(e){return lpe.test(e)}function yXe(e,t){let r=0;if(e.length>1)for(let n of e.slice(1))n>="\uFF00"&&n<="\uFFEF"&&(r+=VB(n.codePointAt(0),t));return r}function _D(e,t={}){if(typeof e!="string"||e.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:n=!1}=t,i=e;if(n||(i=$D(i)),i.length===0)return 0;let s=0,a={ambiguousAsWide:!r};for(let{segment:o}of ope.segment(i)){if(hXe(o))continue;if(upe.test(o)){s+=2;continue}let l=mXe(o).codePointAt(0);s+=VB(l,a),s+=yXe(o,a)}return s}var ope,lpe,cpe,upe,gXe=sa(()=>{UD(),qB(),ope=new Intl.Segmenter,lpe=new RegExp("^(?:\\p{Default_Ignorable_Code_Point}|\\p{Control}|\\p{Mark}|\\p{Surrogate})+$","v"),cpe=new RegExp("^[\\p{Default_Ignorable_Code_Point}\\p{Control}\\p{Format}\\p{Mark}\\p{Surrogate}]+","v"),upe=new RegExp("^\\p{RGI_Emoji}$","v")}),ppe={};MD(ppe,{default:()=>TXe});function wD(e,t,r){if(e.charAt(t)===" ")return t;let n=r?1:-1;for(let i=0;i<=3;i++){let s=t+i*n;if(e.charAt(s)===" ")return s}return t}function TXe(e,t,r={}){let{position:n="end",space:i=!1,preferTruncationOnSpace:s=!1}=r,{truncationCharacter:a="\u2026"}=r;if(typeof e!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof e}`);if(typeof t!="number")throw new TypeError(`Expected \`columns\` to be a number, got ${typeof t}`);if(t<1)return"";let o=_D(e);if(o<=t)return e;if(t===1)return a;let l={ESC:27,LEFT_BRACKET:91,LETTER_M:109},c=m=>m>=48&&m<=57||m===59;function u(m){let h=0;for(;h+2<m.length&&m.codePointAt(h)===l.ESC&&m.codePointAt(h+1)===l.LEFT_BRACKET;){let y=h+2;for(;y<m.length&&c(m.codePointAt(y));)y++;if(y<m.length&&m.codePointAt(y)===l.LETTER_M){h=y+1;continue}break}return h}function p(m){let h=m.length;for(;h>1&&m.codePointAt(h-1)===l.LETTER_M;){let y=h-2;for(;y>=0&&c(m.codePointAt(y));)y--;if(y>=1&&m.codePointAt(y-1)===l.ESC&&m.codePointAt(y)===l.LEFT_BRACKET){h=y-1;continue}break}return h}function f(m,h){let y=p(m);return y===m.length?m+h:m.slice(0,y)+h+m.slice(y)}function d(m,h){let y=u(h);return y===0?m+h:h.slice(0,y)+m+h.slice(y)}if(n==="start"){if(s){let h=wD(e,o-t+1,!0),y=wd(e,h,o).trim();return d(a,y)}i&&(a+=" ");let m=wd(e,o-t+_D(a),o);return d(a,m)}if(n==="middle"){i&&(a=` ${a} `);let m=Math.floor(t/2);if(s){let h=wD(e,m),y=wD(e,o-(t-m)+1,!0);return wd(e,0,h)+a+wd(e,y,o).trim()}return wd(e,0,m)+a+wd(e,o-(t-m)+_D(a),o)}if(n==="end"){if(s){let h=wD(e,t-1),y=wd(e,0,h);return f(y,a)}i&&(a=` ${a}`);let m=wd(e,0,t-_D(a));return f(m,a)}throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${n}`)}var bXe=sa(()=>{rpe(),gXe()}),fpe=async({infile:e,outfile:t,banner:r})=>{let{outputFiles:n,...i}=await mpe({infile:e,outfile:t,platform:"browser",treeShaking:!0,define:{self:"globalThis"},banner:r});return i},dpe=async({infile:e})=>await mpe({infile:e,platform:"node",treeShaking:!1,banner:{js:`import { createRequire as topLevelCreateRequire } from 'node:module';
|
|
659
659
|
import { resolve } from 'node:path';
|
|
660
|
-
const require = topLevelCreateRequire(resolve(process.cwd(), '.juno-pseudo-require-anchor.mjs'));`}}),mpe=async({infile:e,outfile:t,banner:r,platform:n,define:i,treeShaking:s})=>{let{build:a,version:o}=await SXe();ye(t)&&await xXe(t,{force:!0});let{metafile:l,errors:c,warnings:u,outputFiles:p}=await a({entryPoints:[e],outfile:t,write:ye(t),bundle:!0,minify:!0,treeShaking:s,format:"esm",platform:n,supported:{"top-level-await":!1,"inline-script":!1},define:i,metafile:!0,banner:r});return{metafile:l,errors:c,warnings:u,outputFiles:p,version:o}},SXe=()=>{try{return import("esbuild")}catch{console.error("Esbuild is required to build your functions. Please install it by running: npm i esbuild"),process.exit(1)}},VD="build",EXe=[],vXe=[],Fb={pattern:"**/*.+(css|js|mjs|html)",mode:"both",algorithm:"gzip"},PXe=[".ds_store","thumbs.db"],KB=50,$0="#dapp",zB="#_juno/releases",ype=async(e,t,r)=>await AXe(e,r)?[kB(e),t.map(n=>CXe(n)),{...r,shell:!0}]:[e,t,r],AXe=async(e,{shell:t,cwd:r,env:n=Rce.env})=>Rce.platform==="win32"&&!t&&!await IXe(e,r,n),IXe=async(e,t,{Path:r="",PATH:n=r})=>gpe.some(i=>e.toLowerCase().endsWith(i))||(DXe[`${e}\0${t}\0${n}`]??=await OXe(e,t,n)),DXe={},OXe=async(e,t,r)=>{let n=r.split(Lce.delimiter).filter(Boolean).map(i=>i.replace(/^"(.*)"$/,"$1"));try{await Promise.all(gpe.flatMap(i=>[t,...n].filter(ye).map(s=>`${Lce.resolve(s instanceof wXe?s.toString():s,e)}${i}`)).map(async i=>{try{await _Xe(i)}catch{return}throw 0}))}catch{return!0}return!1},gpe=[".exe",".com"],CXe=e=>kB(kB(`"${e.replaceAll(/(\\*)"/g,'$1$1\\"').replace(/(\\*)$/,"$1$1")}"`)),kB=e=>e.replaceAll(/([()\][%!^"`<>&|;, *?])/g,"^$1"),Oa=async({command:e,cwd:t,args:r,env:n,stdout:i,silentOut:s=!1,silentErrors:a=!1})=>await new Promise(async(o,l)=>{let[c,u,p]=await ype(e,r??[],{shell:!0,...ye(t)&&{cwd:t},...ye(n)&&{env:n}}),f=hpe(c,u,p);f.stdout.on("data",d=>{if(ye(i)){i(`${d}`);return}s||console.log(`${d}`)}),f.stderr.on("data",d=>{a||l(new Error(`${d}`))}),f.on("close",d=>{o(d)}),f.on("error",d=>{l(d)})}),Fo=async({command:e,args:t,env:r})=>await new Promise(async n=>{let[i,s,a]=await ype(e,t??[],{stdio:"inherit",...ye(r)&&{env:r}});hpe(i,s??[],a).on("close",o=>{if(o===0){n(o);return}process.exit(1)})}),Tpe=async e=>{for(let t of e??[]){let[r,...n]=t.split(" ");await Fo({command:r,args:n})}},BXe="End-Of-Stream",ho=class extends Error{constructor(){super(BXe),this.name="EndOfStreamError"}},bpe=class extends Error{constructor(e="The operation was aborted"){super(e),this.name="AbortError"}},jXe=class{constructor(){this.resolve=()=>null,this.reject=()=>null,this.promise=new Promise((e,t)=>{this.reject=t,this.resolve=e})}},WB=class{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(e,t=!1){let r=await this.read(e,t);return this.peekQueue.push(e.subarray(0,r)),r}async read(e,t=!1){if(e.length===0)return 0;let r=this.readFromPeekBuffer(e);if(this.endOfStream||(r+=await this.readRemainderFromStream(e.subarray(r),t)),r===0&&!t)throw new ho;return r}readFromPeekBuffer(e){let t=e.length,r=0;for(;this.peekQueue.length>0&&t>0;){let n=this.peekQueue.pop();if(!n)throw new Error("peekData should be defined");let i=Math.min(n.length,t);e.set(n.subarray(0,i),r),r+=i,t-=i,i<n.length&&this.peekQueue.push(n.subarray(i))}return r}async readRemainderFromStream(e,t){let r=0;for(;r<e.length&&!this.endOfStream;){if(this.interrupted)throw new bpe;let n=await this.readFromStream(e.subarray(r),t);if(n===0)break;r+=n}if(!t&&r<e.length)throw new ho;return r}},MXe=class extends WB{constructor(e){if(super(),this.s=e,this.deferred=null,!e.read||!e.once)throw new Error("Expected an instance of stream.Readable");this.s.once("end",()=>{this.endOfStream=!0,this.deferred&&this.deferred.resolve(0)}),this.s.once("error",t=>this.reject(t)),this.s.once("close",()=>this.abort())}async readFromStream(e,t){if(e.length===0)return 0;let r=this.s.read(e.length);if(r)return e.set(r),r.length;let n={buffer:e,mayBeLess:t,deferred:new jXe};return this.deferred=n.deferred,this.s.once("readable",()=>{this.readDeferred(n)}),n.deferred.promise}readDeferred(e){let t=this.s.read(e.buffer.length);t?(e.buffer.set(t),e.deferred.resolve(t.length),this.deferred=null):this.s.once("readable",()=>{this.readDeferred(e)})}reject(e){this.interrupted=!0,this.deferred&&(this.deferred.reject(e),this.deferred=null)}async abort(){this.reject(new bpe)}async close(){return this.abort()}},$Xe=class extends WB{constructor(e){super(),this.reader=e}async abort(){return this.close()}async close(){this.reader.releaseLock()}},UXe=class extends $Xe{async readFromStream(e,t){if(e.length===0)return 0;let r=await this.reader.read(new Uint8Array(e.length),{min:t?void 0:e.length});return r.done&&(this.endOfStream=r.done),r.value?(e.set(r.value),r.value.length):0}},jce=class extends WB{constructor(e){super(),this.reader=e,this.buffer=null}writeChunk(e,t){let r=Math.min(t.length,e.length);return e.set(t.subarray(0,r)),r<t.length?this.buffer=t.subarray(r):this.buffer=null,r}async readFromStream(e,t){if(e.length===0)return 0;let r=0;for(this.buffer&&(r+=this.writeChunk(e,this.buffer));r<e.length&&!this.endOfStream;){let n=await this.reader.read();if(n.done){this.endOfStream=!0;break}n.value&&(r+=this.writeChunk(e.subarray(r),n.value))}if(!t&&r===0&&this.endOfStream)throw new ho;return r}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}};function VXe(e){try{let t=e.getReader({mode:"byob"});return t instanceof ReadableStreamDefaultReader?new jce(t):new UXe(t)}catch(t){if(t instanceof TypeError)return new jce(e.getReader());throw t}}var qD=class{constructor(e){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=e?.onClose,e?.abortSignal&&e.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(e,t=this.position){let r=new Uint8Array(e.len);if(await this.readBuffer(r,{position:t})<e.len)throw new ho;return e.get(r,0)}async peekToken(e,t=this.position){let r=new Uint8Array(e.len);if(await this.peekBuffer(r,{position:t})<e.len)throw new ho;return e.get(r,0)}async readNumber(e){if(await this.readBuffer(this.numBuffer,{length:e.len})<e.len)throw new ho;return e.get(this.numBuffer,0)}async peekNumber(e){if(await this.peekBuffer(this.numBuffer,{length:e.len})<e.len)throw new ho;return e.get(this.numBuffer,0)}async ignore(e){if(this.fileInfo.size!==void 0){let t=this.fileInfo.size-this.position;if(e>t)return this.position+=t,t}return this.position+=e,e}async close(){await this.abort(),await this.onClose?.()}normalizeOptions(e,t){if(!this.supportsRandomAccess()&&t&&t.position!==void 0&&t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:e.length,position:this.position,...t}}abort(){return Promise.resolve()}},qXe=256e3,xpe=class extends qD{constructor(e,t){super(t),this.streamReader=e,this.fileInfo=t?.fileInfo??{}}async readBuffer(e,t){let r=this.normalizeOptions(e,t),n=r.position-this.position;if(n>0)return await this.ignore(n),this.readBuffer(e,t);if(n<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(r.length===0)return 0;let i=await this.streamReader.read(e.subarray(0,r.length),r.mayBeLess);if(this.position+=i,(!t||!t.mayBeLess)&&i<r.length)throw new ho;return i}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=0;if(r.position){let i=r.position-this.position;if(i>0){let s=new Uint8Array(r.length+i);return n=await this.peekBuffer(s,{mayBeLess:r.mayBeLess}),e.set(s.subarray(i)),n-i}if(i<0)throw new Error("Cannot peek from a negative offset in a stream")}if(r.length>0){try{n=await this.streamReader.peek(e.subarray(0,r.length),r.mayBeLess)}catch(i){if(t?.mayBeLess&&i instanceof ho)return 0;throw i}if(!r.mayBeLess&&n<r.length)throw new ho}return n}async ignore(e){let t=Math.min(qXe,e),r=new Uint8Array(t),n=0;for(;n<e;){let i=e-n,s=await this.readBuffer(r,{length:Math.min(t,i)});if(s<0)return s;n+=s}return n}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}},KXe=class extends qD{constructor(e,t){super(t),this.uint8Array=e,this.fileInfo={...t?.fileInfo??{},size:e.length}}async readBuffer(e,t){t?.position&&(this.position=t.position);let r=await this.peekBuffer(e,t);return this.position+=r,r}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=Math.min(this.uint8Array.length-r.position,r.length);if(!r.mayBeLess&&n<r.length)throw new ho;return e.set(this.uint8Array.subarray(r.position,r.position+n)),n}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}},zXe=class extends qD{constructor(e,t){super(t),this.blob=e,this.fileInfo={...t?.fileInfo??{},size:e.size,mimeType:e.type}}async readBuffer(e,t){t?.position&&(this.position=t.position);let r=await this.peekBuffer(e,t);return this.position+=r,r}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=Math.min(this.blob.size-r.position,r.length);if(!r.mayBeLess&&n<r.length)throw new ho;let i=await this.blob.slice(r.position,r.position+n).arrayBuffer();return e.set(new Uint8Array(i)),n}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}};function WXe(e,t){let r=new MXe(e),n=t??{},i=n.onClose;return n.onClose=async()=>{if(await r.close(),i)return i()},new xpe(r,n)}function Spe(e,t){let r=VXe(e),n=t??{},i=n.onClose;return n.onClose=async()=>{if(await r.close(),i)return i()},new xpe(r,n)}function YXe(e,t){return new KXe(e,t)}function JXe(e,t){return new zXe(e,t)}var XXe=class Epe extends qD{static async fromFile(t){let r=await HXe(t,"r"),n=await r.stat();return new Epe(r,{fileInfo:{path:t,size:n.size}})}constructor(t,r){super(r),this.fileHandle=t,this.fileInfo=r.fileInfo}async readBuffer(t,r){let n=this.normalizeOptions(t,r);if(this.position=n.position,n.length===0)return 0;let i=await this.fileHandle.read(t,0,n.length,n.position);if(this.position+=i.bytesRead,i.bytesRead<n.length&&(!r||!r.mayBeLess))throw new ho;return i.bytesRead}async peekBuffer(t,r){let n=this.normalizeOptions(t,r),i=await this.fileHandle.read(t,0,n.length,n.position);if(!n.mayBeLess&&i.bytesRead<n.length)throw new ho;return i.bytesRead}async close(){return await this.fileHandle.close(),super.close()}setPosition(t){this.position=t}supportsRandomAccess(){return!0}};async function GXe(e,t){let r=WXe(e,t);if(e.path){let n=await RXe(e.path);r.fileInfo.path=e.path,r.fileInfo.size=n.size}return r}var ZXe=XXe.fromFile,Pvn=Bb(lHe(),1),FB={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"},QXe={};for(let[e,t]of Object.entries(FB))QXe[t]=Number.parseInt(e);function eGe(e,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":return typeof globalThis.TextDecoder<"u"?new globalThis.TextDecoder("utf-8").decode(e):tGe(e);case"utf-16le":return rGe(e);case"ascii":return nGe(e);case"latin1":case"iso-8859-1":return iGe(e);case"windows-1252":return sGe(e);default:throw new RangeError(`Encoding '${t}' not supported`)}}function tGe(e){let t="",r=0;for(;r<e.length;){let n=e[r++];if(n<128)t+=String.fromCharCode(n);else if(n<224){let i=e[r++]&63;t+=String.fromCharCode((n&31)<<6|i)}else if(n<240){let i=e[r++]&63,s=e[r++]&63;t+=String.fromCharCode((n&15)<<12|i<<6|s)}else{let i=e[r++]&63,s=e[r++]&63,a=e[r++]&63,o=(n&7)<<18|i<<12|s<<6|a;o-=65536,t+=String.fromCharCode(55296+(o>>10&1023),56320+(o&1023))}}return t}function rGe(e){let t="";for(let r=0;r<e.length;r+=2)t+=String.fromCharCode(e[r]|e[r+1]<<8);return t}function nGe(e){return String.fromCharCode(...e.map(t=>t&127))}function iGe(e){return String.fromCharCode(...e)}function sGe(e){let t="";for(let r of e)r>=128&&r<=159&&FB[r]?t+=FB[r]:t+=String.fromCharCode(r);return t}function Xl(e){return new DataView(e.buffer,e.byteOffset)}var aGe={len:1,get(e,t){return Xl(e).getUint8(t)},put(e,t,r){return Xl(e).setUint8(t,r),t+1}},xa={len:2,get(e,t){return Xl(e).getUint16(t,!0)},put(e,t,r){return Xl(e).setUint16(t,r,!0),t+2}},dv={len:2,get(e,t){return Xl(e).getUint16(t)},put(e,t,r){return Xl(e).setUint16(t,r),t+2}},Ga={len:4,get(e,t){return Xl(e).getUint32(t,!0)},put(e,t,r){return Xl(e).setUint32(t,r,!0),t+4}},oGe={len:4,get(e,t){return Xl(e).getUint32(t)},put(e,t,r){return Xl(e).setUint32(t,r),t+4}},lGe={len:4,get(e,t){return Xl(e).getInt32(t)},put(e,t,r){return Xl(e).setInt32(t,r),t+4}},cGe={len:8,get(e,t){return Xl(e).getBigUint64(t,!0)},put(e,t,r){return Xl(e).setBigUint64(t,r,!0),t+8}},Ad=class{constructor(e,t){this.len=e,this.encoding=t}get(e,t=0){let r=e.subarray(t,t+this.len);return eGe(r,this.encoding)}},uGe=Bb(mHe(),1),Lb={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},Mce={get(e){return{signature:Ga.get(e,0),compressedSize:Ga.get(e,8),uncompressedSize:Ga.get(e,12)}},len:16},pGe={get(e){let t=xa.get(e,6);return{signature:Ga.get(e,0),minVersion:xa.get(e,4),dataDescriptor:!!(t&8),compressedMethod:xa.get(e,8),compressedSize:Ga.get(e,18),uncompressedSize:Ga.get(e,22),filenameLength:xa.get(e,26),extraFieldLength:xa.get(e,28),filename:null}},len:30},fGe={get(e){return{signature:Ga.get(e,0),nrOfThisDisk:xa.get(e,4),nrOfThisDiskWithTheStart:xa.get(e,6),nrOfEntriesOnThisDisk:xa.get(e,8),nrOfEntriesOfSize:xa.get(e,10),sizeOfCd:Ga.get(e,12),offsetOfStartOfCd:Ga.get(e,16),zipFileCommentLength:xa.get(e,20)}},len:22},dGe={get(e){let t=xa.get(e,8);return{signature:Ga.get(e,0),minVersion:xa.get(e,6),dataDescriptor:!!(t&8),compressedMethod:xa.get(e,10),compressedSize:Ga.get(e,20),uncompressedSize:Ga.get(e,24),filenameLength:xa.get(e,28),extraFieldLength:xa.get(e,30),fileCommentLength:xa.get(e,32),relativeOffsetOfLocalHeader:Ga.get(e,42),filename:null}},len:46};function vpe(e){let t=new Uint8Array(Ga.len);return Ga.put(t,0,e),t}var Gp=(0,uGe.default)("tokenizer:inflate"),gB=256*1024,mGe=vpe(Lb.DataDescriptor),AD=vpe(Lb.EndOfCentralDirectory),hGe=class Ppe{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(gB)}async isZip(){return await this.peekSignature()===Lb.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(Ga)}async findEndOfCentralDirectoryLocator(){let t=this.tokenizer,r=Math.min(16*1024,t.fileInfo.size),n=this.syncBuffer.subarray(0,r);await this.tokenizer.readBuffer(n,{position:t.fileInfo.size-r});for(let i=n.length-4;i>=0;i--)if(n[i]===AD[0]&&n[i+1]===AD[1]&&n[i+2]===AD[2]&&n[i+3]===AD[3])return t.fileInfo.size-r+i;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){Gp("Cannot reading central-directory without random-read support");return}Gp("Reading central-directory...");let t=this.tokenizer.position,r=await this.findEndOfCentralDirectoryLocator();if(r>0){Gp("Central-directory 32-bit signature found");let n=await this.tokenizer.readToken(fGe,r),i=[];this.tokenizer.setPosition(n.offsetOfStartOfCd);for(let s=0;s<n.nrOfEntriesOfSize;++s){let a=await this.tokenizer.readToken(dGe);if(a.signature!==Lb.CentralFileHeader)throw new Error("Expected Central-File-Header signature");a.filename=await this.tokenizer.readToken(new Ad(a.filenameLength,"utf-8")),await this.tokenizer.ignore(a.extraFieldLength),await this.tokenizer.ignore(a.fileCommentLength),i.push(a),Gp(`Add central-directory file-entry: n=${s+1}/${i.length}: filename=${i[s].filename}`)}return this.tokenizer.setPosition(t),i}this.tokenizer.setPosition(t)}async unzip(t){let r=await this.readCentralDirectory();if(r)return this.iterateOverCentralDirectory(r,t);let n=!1;do{let i=await this.readLocalFileHeader();if(!i)break;let s=t(i);n=!!s.stop;let a;if(await this.tokenizer.ignore(i.extraFieldLength),i.dataDescriptor&&i.compressedSize===0){let o=[],l=gB;Gp("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let c=-1;for(;c<0&&l===gB;){l=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),c=yGe(this.syncBuffer.subarray(0,l),mGe);let u=c>=0?c:l;if(s.handler){let p=new Uint8Array(u);await this.tokenizer.readBuffer(p),o.push(p)}else await this.tokenizer.ignore(u)}Gp(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),s.handler&&await this.inflate(i,gGe(o),s.handler)}else s.handler?(Gp(`Reading compressed-file-data: ${i.compressedSize} bytes`),a=new Uint8Array(i.compressedSize),await this.tokenizer.readBuffer(a),await this.inflate(i,a,s.handler)):(Gp(`Ignoring compressed-file-data: ${i.compressedSize} bytes`),await this.tokenizer.ignore(i.compressedSize));if(Gp(`Reading data-descriptor at pos=${this.tokenizer.position}`),i.dataDescriptor&&(await this.tokenizer.readToken(Mce)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-Mce.len}`)}while(!n)}async iterateOverCentralDirectory(t,r){for(let n of t){let i=r(n);if(i.handler){this.tokenizer.setPosition(n.relativeOffsetOfLocalHeader);let s=await this.readLocalFileHeader();if(s){await this.tokenizer.ignore(s.extraFieldLength);let a=new Uint8Array(n.compressedSize);await this.tokenizer.readBuffer(a),await this.inflate(s,a,i.handler)}}if(i.stop)break}}async inflate(t,r,n){if(t.compressedMethod===0)return n(r);if(t.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${t.compressedMethod}`);Gp(`Decompress filename=${t.filename}, compressed-size=${r.length}`);let i=await Ppe.decompressDeflateRaw(r);return n(i)}static async decompressDeflateRaw(t){let r=new ReadableStream({start(s){s.enqueue(t),s.close()}}),n=new DecompressionStream("deflate-raw"),i=r.pipeThrough(n);try{let s=await new Response(i).arrayBuffer();return new Uint8Array(s)}catch(s){let a=s instanceof Error?`Failed to deflate ZIP entry: ${s.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(a)}}async readLocalFileHeader(){let t=await this.tokenizer.peekToken(Ga);if(t===Lb.LocalFileHeader){let r=await this.tokenizer.readToken(pGe);return r.filename=await this.tokenizer.readToken(new Ad(r.filenameLength,"utf-8")),r}if(t===Lb.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}};function yGe(e,t){let r=e.length,n=t.length;if(n>r)return-1;for(let i=0;i<=r-n;i++){let s=!0;for(let a=0;a<n;a++)if(e[i+a]!==t[a]){s=!1;break}if(s)return i}return-1}function gGe(e){let t=e.reduce((i,s)=>i+s.length,0),r=new Uint8Array(t),n=0;for(let i of e)r.set(i,n),n+=i.length;return r}var TGe=class{constructor(e){this.tokenizer=e}inflate(){let e=this.tokenizer;return new ReadableStream({async pull(t){let r=new Uint8Array(1024),n=await e.readBuffer(r,{mayBeLess:!0});if(n===0){t.close();return}t.enqueue(r.subarray(0,n))}}).pipeThrough(new DecompressionStream("gzip"))}},_vn={utf8:new globalThis.TextDecoder("utf8")},wvn=new globalThis.TextEncoder,Avn=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function $ce(e){let{byteLength:t}=e;if(t===6)return e.getUint16(0)*2**32+e.getUint32(2);if(t===5)return e.getUint8(0)*2**32+e.getUint32(1);if(t===4)return e.getUint32(0);if(t===3)return e.getUint8(0)*2**16+e.getUint16(1);if(t===2)return e.getUint16(0);if(t===1)return e.getUint8(0)}function bGe(e,t){if(t==="utf-16le"){let r=[];for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);r.push(i&255,i>>8&255)}return r}if(t==="utf-16be"){let r=[];for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);r.push(i>>8&255,i&255)}return r}return[...e].map(r=>r.charCodeAt(0))}function xGe(e,t=0){let r=Number.parseInt(new Ad(6).get(e,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(r))return!1;let n=256;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 SGe={get:(e,t)=>e[t+3]&127|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4},EGe=["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","ttc","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","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","rm","ppsm","ppsx","tar.gz","reg","dat"],vGe=["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.ms-powerpoint.slideshow.macroenabled.12","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/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/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","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/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","font/collection","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","text/vtt","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/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-ms-regedit","application/x-ft-windows-registry-hive"],ND=4100;function TB(e){switch(e=e.toLowerCase(),e){case"application/epub+zip":return{ext:"epub",mime:e};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:e};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:e};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:e};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:e};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:e};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:e};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:e};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:e};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:e};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:e};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:e};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:e};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:e};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:e};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:e};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"};default:}}function Zp(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 PGe=class{constructor(e){this.options={mpegOffsetTolerance:0,...e},this.detectors=[...e?.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:e?.signal}}async fromTokenizer(e){let t=e.position;for(let r of this.detectors){let n=await r.detect(e);if(n)return n;if(t!==e.position)return}}async fromBuffer(e){if(!(e instanceof Uint8Array||e instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``);let t=e instanceof Uint8Array?e:new Uint8Array(e);if(t?.length>1)return this.fromTokenizer(YXe(t,this.tokenizerOptions))}async fromBlob(e){let t=JXe(e,this.tokenizerOptions);try{return await this.fromTokenizer(t)}finally{await t.close()}}async fromStream(e){let t=Spe(e,this.tokenizerOptions);try{return await this.fromTokenizer(t)}finally{await t.close()}}async toDetectionStream(e,t){let{sampleSize:r=ND}=t,n,i,s=e.getReader({mode:"byob"});try{let{value:l,done:c}=await s.read(new Uint8Array(r));if(i=l,!c&&l)try{n=await this.fromBuffer(l.subarray(0,r))}catch(u){if(!(u instanceof ho))throw u;n=void 0}i=l}finally{s.releaseLock()}let a=new TransformStream({async start(l){l.enqueue(i)},transform(l,c){c.enqueue(l)}}),o=e.pipeThrough(a);return o.fileType=n,o}check(e,t){return Zp(this.buffer,e,t)}checkString(e,t){return this.check(bGe(e,t?.encoding),t)}detectConfident=async e=>{if(this.buffer=new Uint8Array(ND),e.fileInfo.size===void 0&&(e.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=e,await e.peekBuffer(this.buffer,{length:32,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 e.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.detectConfident(e);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])){let t=new TGe(e).inflate(),r=!0;try{let n;try{n=await this.fromStream(t)}catch{r=!1}if(n&&n.ext==="tar")return{ext:"tar.gz",mime:"application/gzip"}}finally{r&&await t.cancel()}return{ext:"gz",mime:"application/gzip"}}if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await e.ignore(6);let t=await e.readToken(SGe);return e.position+t>e.fileInfo.size?{ext:"mp3",mime:"audio/mpeg"}:(await e.ignore(t),this.fromTokenizer(e))}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("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])){let t;return await new hGe(e).unzip(r=>{switch(r.filename){case"META-INF/mozilla.rsa":return t={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return t={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return{async handler(n){let i=new TextDecoder("utf-8").decode(n).trim();t=TB(i)},stop:!0};case"[Content_Types].xml":return{async handler(n){let i=new TextDecoder("utf-8").decode(n),s=i.indexOf('.main+xml"');if(s===-1){let a="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";i.includes(`ContentType="${a}"`)&&(t=TB(a))}else{i=i.slice(0,Math.max(0,s));let a=i.lastIndexOf('"'),o=i.slice(Math.max(0,a+1));t=TB(o)}},stop:!0};default:return/classes\d*\.dex/.test(r.filename)?(t={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}}).catch(r=>{if(!(r instanceof ho))throw r}),t??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await e.ignore(28);let t=new Uint8Array(8);return await e.readBuffer(t),Zp(t,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:Zp(t,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:Zp(t,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:Zp(t,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:Zp(t,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:Zp(t,[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("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/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"))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 t=await this.readTiffHeader(!1);if(t)return t}if(this.check([77,77])){let t=await this.readTiffHeader(!0);if(t)return t}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function t(){let s=await e.peekNumber(aGe),a=128,o=0;for(;(s&a)===0&&a!==0;)++o,a>>=1;let l=new Uint8Array(o+1);return await e.readBuffer(l),l}async function r(){let s=await t(),a=await t();a[0]^=128>>a.length-1;let o=Math.min(6,a.length),l=new DataView(s.buffer),c=new DataView(a.buffer,a.length-o,o);return{id:$ce(l),len:$ce(c)}}async function n(s){for(;s>0;){let a=await r();if(a.id===17026)return(await e.readToken(new Ad(a.len))).replaceAll(/\00.*$/g,"");await e.ignore(a.len),--s}}let i=await r();switch(await n(i.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}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")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};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.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};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 t=new Ad(4,"latin1").get(this.buffer,2);if(t.match("^d*")&&t>=1e3&&t<=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 e.ignore(8),await e.readToken(new Ad(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
|
|
660
|
+
const require = topLevelCreateRequire(resolve(process.cwd(), '.juno-pseudo-require-anchor.mjs'));`}}),mpe=async({infile:e,outfile:t,banner:r,platform:n,define:i,treeShaking:s})=>{let{build:a,version:o}=await SXe();ye(t)&&await xXe(t,{force:!0});let{metafile:l,errors:c,warnings:u,outputFiles:p}=await a({entryPoints:[e],outfile:t,write:ye(t),bundle:!0,minify:!0,treeShaking:s,format:"esm",platform:n,supported:{"top-level-await":!1,"inline-script":!1},define:i,metafile:!0,banner:r});return{metafile:l,errors:c,warnings:u,outputFiles:p,version:o}},SXe=()=>{try{return import("esbuild")}catch{console.error("Esbuild is required to build your functions. Please install it by running: npm i esbuild"),process.exit(1)}},VD="build",EXe=[],vXe=[],Fb={pattern:"**/*.+(css|js|mjs|html)",mode:"both",algorithm:"gzip"},PXe=[".ds_store","thumbs.db"],KB=50,$0="#dapp",zB="#_juno/releases",ype=async(e,t,r)=>await AXe(e,r)?[kB(e),t.map(n=>CXe(n)),{...r,shell:!0}]:[e,t,r],AXe=async(e,{shell:t,cwd:r,env:n=Rce.env})=>Rce.platform==="win32"&&!t&&!await IXe(e,r,n),IXe=async(e,t,{Path:r="",PATH:n=r})=>gpe.some(i=>e.toLowerCase().endsWith(i))||(DXe[`${e}\0${t}\0${n}`]??=await OXe(e,t,n)),DXe={},OXe=async(e,t,r)=>{let n=r.split(Lce.delimiter).filter(Boolean).map(i=>i.replace(/^"(.*)"$/,"$1"));try{await Promise.all(gpe.flatMap(i=>[t,...n].filter(ye).map(s=>`${Lce.resolve(s instanceof wXe?s.toString():s,e)}${i}`)).map(async i=>{try{await _Xe(i)}catch{return}throw 0}))}catch{return!0}return!1},gpe=[".exe",".com"],CXe=e=>kB(kB(`"${e.replaceAll(/(\\*)"/g,'$1$1\\"').replace(/(\\*)$/,"$1$1")}"`)),kB=e=>e.replaceAll(/([()\][%!^"`<>&|;, *?])/g,"^$1"),Oa=async({command:e,cwd:t,args:r,env:n,stdout:i,silentOut:s=!1,silentErrors:a=!1})=>await new Promise(async(o,l)=>{let[c,u,p]=await ype(e,r??[],{...ye(t)&&{cwd:t},...ye(n)&&{env:n}}),f=hpe(c,u,p);f.stdout.on("data",d=>{if(ye(i)){i(`${d}`);return}s||console.log(`${d}`)}),f.stderr.on("data",d=>{a||l(new Error(`${d}`))}),f.on("close",d=>{o(d)}),f.on("error",d=>{l(d)})}),Fo=async({command:e,args:t,env:r})=>await new Promise(async n=>{let[i,s,a]=await ype(e,t??[],{stdio:"inherit",...ye(r)&&{env:r}});hpe(i,s??[],a).on("close",o=>{if(o===0){n(o);return}process.exit(1)})}),Tpe=async e=>{for(let t of e??[]){let[r,...n]=t.split(" ");await Fo({command:r,args:n})}},BXe="End-Of-Stream",ho=class extends Error{constructor(){super(BXe),this.name="EndOfStreamError"}},bpe=class extends Error{constructor(e="The operation was aborted"){super(e),this.name="AbortError"}},jXe=class{constructor(){this.resolve=()=>null,this.reject=()=>null,this.promise=new Promise((e,t)=>{this.reject=t,this.resolve=e})}},WB=class{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(e,t=!1){let r=await this.read(e,t);return this.peekQueue.push(e.subarray(0,r)),r}async read(e,t=!1){if(e.length===0)return 0;let r=this.readFromPeekBuffer(e);if(this.endOfStream||(r+=await this.readRemainderFromStream(e.subarray(r),t)),r===0&&!t)throw new ho;return r}readFromPeekBuffer(e){let t=e.length,r=0;for(;this.peekQueue.length>0&&t>0;){let n=this.peekQueue.pop();if(!n)throw new Error("peekData should be defined");let i=Math.min(n.length,t);e.set(n.subarray(0,i),r),r+=i,t-=i,i<n.length&&this.peekQueue.push(n.subarray(i))}return r}async readRemainderFromStream(e,t){let r=0;for(;r<e.length&&!this.endOfStream;){if(this.interrupted)throw new bpe;let n=await this.readFromStream(e.subarray(r),t);if(n===0)break;r+=n}if(!t&&r<e.length)throw new ho;return r}},MXe=class extends WB{constructor(e){if(super(),this.s=e,this.deferred=null,!e.read||!e.once)throw new Error("Expected an instance of stream.Readable");this.s.once("end",()=>{this.endOfStream=!0,this.deferred&&this.deferred.resolve(0)}),this.s.once("error",t=>this.reject(t)),this.s.once("close",()=>this.abort())}async readFromStream(e,t){if(e.length===0)return 0;let r=this.s.read(e.length);if(r)return e.set(r),r.length;let n={buffer:e,mayBeLess:t,deferred:new jXe};return this.deferred=n.deferred,this.s.once("readable",()=>{this.readDeferred(n)}),n.deferred.promise}readDeferred(e){let t=this.s.read(e.buffer.length);t?(e.buffer.set(t),e.deferred.resolve(t.length),this.deferred=null):this.s.once("readable",()=>{this.readDeferred(e)})}reject(e){this.interrupted=!0,this.deferred&&(this.deferred.reject(e),this.deferred=null)}async abort(){this.reject(new bpe)}async close(){return this.abort()}},$Xe=class extends WB{constructor(e){super(),this.reader=e}async abort(){return this.close()}async close(){this.reader.releaseLock()}},UXe=class extends $Xe{async readFromStream(e,t){if(e.length===0)return 0;let r=await this.reader.read(new Uint8Array(e.length),{min:t?void 0:e.length});return r.done&&(this.endOfStream=r.done),r.value?(e.set(r.value),r.value.length):0}},jce=class extends WB{constructor(e){super(),this.reader=e,this.buffer=null}writeChunk(e,t){let r=Math.min(t.length,e.length);return e.set(t.subarray(0,r)),r<t.length?this.buffer=t.subarray(r):this.buffer=null,r}async readFromStream(e,t){if(e.length===0)return 0;let r=0;for(this.buffer&&(r+=this.writeChunk(e,this.buffer));r<e.length&&!this.endOfStream;){let n=await this.reader.read();if(n.done){this.endOfStream=!0;break}n.value&&(r+=this.writeChunk(e.subarray(r),n.value))}if(!t&&r===0&&this.endOfStream)throw new ho;return r}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}};function VXe(e){try{let t=e.getReader({mode:"byob"});return t instanceof ReadableStreamDefaultReader?new jce(t):new UXe(t)}catch(t){if(t instanceof TypeError)return new jce(e.getReader());throw t}}var qD=class{constructor(e){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=e?.onClose,e?.abortSignal&&e.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(e,t=this.position){let r=new Uint8Array(e.len);if(await this.readBuffer(r,{position:t})<e.len)throw new ho;return e.get(r,0)}async peekToken(e,t=this.position){let r=new Uint8Array(e.len);if(await this.peekBuffer(r,{position:t})<e.len)throw new ho;return e.get(r,0)}async readNumber(e){if(await this.readBuffer(this.numBuffer,{length:e.len})<e.len)throw new ho;return e.get(this.numBuffer,0)}async peekNumber(e){if(await this.peekBuffer(this.numBuffer,{length:e.len})<e.len)throw new ho;return e.get(this.numBuffer,0)}async ignore(e){if(this.fileInfo.size!==void 0){let t=this.fileInfo.size-this.position;if(e>t)return this.position+=t,t}return this.position+=e,e}async close(){await this.abort(),await this.onClose?.()}normalizeOptions(e,t){if(!this.supportsRandomAccess()&&t&&t.position!==void 0&&t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:e.length,position:this.position,...t}}abort(){return Promise.resolve()}},qXe=256e3,xpe=class extends qD{constructor(e,t){super(t),this.streamReader=e,this.fileInfo=t?.fileInfo??{}}async readBuffer(e,t){let r=this.normalizeOptions(e,t),n=r.position-this.position;if(n>0)return await this.ignore(n),this.readBuffer(e,t);if(n<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(r.length===0)return 0;let i=await this.streamReader.read(e.subarray(0,r.length),r.mayBeLess);if(this.position+=i,(!t||!t.mayBeLess)&&i<r.length)throw new ho;return i}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=0;if(r.position){let i=r.position-this.position;if(i>0){let s=new Uint8Array(r.length+i);return n=await this.peekBuffer(s,{mayBeLess:r.mayBeLess}),e.set(s.subarray(i)),n-i}if(i<0)throw new Error("Cannot peek from a negative offset in a stream")}if(r.length>0){try{n=await this.streamReader.peek(e.subarray(0,r.length),r.mayBeLess)}catch(i){if(t?.mayBeLess&&i instanceof ho)return 0;throw i}if(!r.mayBeLess&&n<r.length)throw new ho}return n}async ignore(e){let t=Math.min(qXe,e),r=new Uint8Array(t),n=0;for(;n<e;){let i=e-n,s=await this.readBuffer(r,{length:Math.min(t,i)});if(s<0)return s;n+=s}return n}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}},KXe=class extends qD{constructor(e,t){super(t),this.uint8Array=e,this.fileInfo={...t?.fileInfo??{},size:e.length}}async readBuffer(e,t){t?.position&&(this.position=t.position);let r=await this.peekBuffer(e,t);return this.position+=r,r}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=Math.min(this.uint8Array.length-r.position,r.length);if(!r.mayBeLess&&n<r.length)throw new ho;return e.set(this.uint8Array.subarray(r.position,r.position+n)),n}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}},zXe=class extends qD{constructor(e,t){super(t),this.blob=e,this.fileInfo={...t?.fileInfo??{},size:e.size,mimeType:e.type}}async readBuffer(e,t){t?.position&&(this.position=t.position);let r=await this.peekBuffer(e,t);return this.position+=r,r}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=Math.min(this.blob.size-r.position,r.length);if(!r.mayBeLess&&n<r.length)throw new ho;let i=await this.blob.slice(r.position,r.position+n).arrayBuffer();return e.set(new Uint8Array(i)),n}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}};function WXe(e,t){let r=new MXe(e),n=t??{},i=n.onClose;return n.onClose=async()=>{if(await r.close(),i)return i()},new xpe(r,n)}function Spe(e,t){let r=VXe(e),n=t??{},i=n.onClose;return n.onClose=async()=>{if(await r.close(),i)return i()},new xpe(r,n)}function YXe(e,t){return new KXe(e,t)}function JXe(e,t){return new zXe(e,t)}var XXe=class Epe extends qD{static async fromFile(t){let r=await HXe(t,"r"),n=await r.stat();return new Epe(r,{fileInfo:{path:t,size:n.size}})}constructor(t,r){super(r),this.fileHandle=t,this.fileInfo=r.fileInfo}async readBuffer(t,r){let n=this.normalizeOptions(t,r);if(this.position=n.position,n.length===0)return 0;let i=await this.fileHandle.read(t,0,n.length,n.position);if(this.position+=i.bytesRead,i.bytesRead<n.length&&(!r||!r.mayBeLess))throw new ho;return i.bytesRead}async peekBuffer(t,r){let n=this.normalizeOptions(t,r),i=await this.fileHandle.read(t,0,n.length,n.position);if(!n.mayBeLess&&i.bytesRead<n.length)throw new ho;return i.bytesRead}async close(){return await this.fileHandle.close(),super.close()}setPosition(t){this.position=t}supportsRandomAccess(){return!0}};async function GXe(e,t){let r=WXe(e,t);if(e.path){let n=await RXe(e.path);r.fileInfo.path=e.path,r.fileInfo.size=n.size}return r}var ZXe=XXe.fromFile,Pvn=Bb(lHe(),1),FB={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"},QXe={};for(let[e,t]of Object.entries(FB))QXe[t]=Number.parseInt(e);function eGe(e,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":return typeof globalThis.TextDecoder<"u"?new globalThis.TextDecoder("utf-8").decode(e):tGe(e);case"utf-16le":return rGe(e);case"ascii":return nGe(e);case"latin1":case"iso-8859-1":return iGe(e);case"windows-1252":return sGe(e);default:throw new RangeError(`Encoding '${t}' not supported`)}}function tGe(e){let t="",r=0;for(;r<e.length;){let n=e[r++];if(n<128)t+=String.fromCharCode(n);else if(n<224){let i=e[r++]&63;t+=String.fromCharCode((n&31)<<6|i)}else if(n<240){let i=e[r++]&63,s=e[r++]&63;t+=String.fromCharCode((n&15)<<12|i<<6|s)}else{let i=e[r++]&63,s=e[r++]&63,a=e[r++]&63,o=(n&7)<<18|i<<12|s<<6|a;o-=65536,t+=String.fromCharCode(55296+(o>>10&1023),56320+(o&1023))}}return t}function rGe(e){let t="";for(let r=0;r<e.length;r+=2)t+=String.fromCharCode(e[r]|e[r+1]<<8);return t}function nGe(e){return String.fromCharCode(...e.map(t=>t&127))}function iGe(e){return String.fromCharCode(...e)}function sGe(e){let t="";for(let r of e)r>=128&&r<=159&&FB[r]?t+=FB[r]:t+=String.fromCharCode(r);return t}function Xl(e){return new DataView(e.buffer,e.byteOffset)}var aGe={len:1,get(e,t){return Xl(e).getUint8(t)},put(e,t,r){return Xl(e).setUint8(t,r),t+1}},xa={len:2,get(e,t){return Xl(e).getUint16(t,!0)},put(e,t,r){return Xl(e).setUint16(t,r,!0),t+2}},dv={len:2,get(e,t){return Xl(e).getUint16(t)},put(e,t,r){return Xl(e).setUint16(t,r),t+2}},Ga={len:4,get(e,t){return Xl(e).getUint32(t,!0)},put(e,t,r){return Xl(e).setUint32(t,r,!0),t+4}},oGe={len:4,get(e,t){return Xl(e).getUint32(t)},put(e,t,r){return Xl(e).setUint32(t,r),t+4}},lGe={len:4,get(e,t){return Xl(e).getInt32(t)},put(e,t,r){return Xl(e).setInt32(t,r),t+4}},cGe={len:8,get(e,t){return Xl(e).getBigUint64(t,!0)},put(e,t,r){return Xl(e).setBigUint64(t,r,!0),t+8}},Ad=class{constructor(e,t){this.len=e,this.encoding=t}get(e,t=0){let r=e.subarray(t,t+this.len);return eGe(r,this.encoding)}},uGe=Bb(mHe(),1),Lb={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},Mce={get(e){return{signature:Ga.get(e,0),compressedSize:Ga.get(e,8),uncompressedSize:Ga.get(e,12)}},len:16},pGe={get(e){let t=xa.get(e,6);return{signature:Ga.get(e,0),minVersion:xa.get(e,4),dataDescriptor:!!(t&8),compressedMethod:xa.get(e,8),compressedSize:Ga.get(e,18),uncompressedSize:Ga.get(e,22),filenameLength:xa.get(e,26),extraFieldLength:xa.get(e,28),filename:null}},len:30},fGe={get(e){return{signature:Ga.get(e,0),nrOfThisDisk:xa.get(e,4),nrOfThisDiskWithTheStart:xa.get(e,6),nrOfEntriesOnThisDisk:xa.get(e,8),nrOfEntriesOfSize:xa.get(e,10),sizeOfCd:Ga.get(e,12),offsetOfStartOfCd:Ga.get(e,16),zipFileCommentLength:xa.get(e,20)}},len:22},dGe={get(e){let t=xa.get(e,8);return{signature:Ga.get(e,0),minVersion:xa.get(e,6),dataDescriptor:!!(t&8),compressedMethod:xa.get(e,10),compressedSize:Ga.get(e,20),uncompressedSize:Ga.get(e,24),filenameLength:xa.get(e,28),extraFieldLength:xa.get(e,30),fileCommentLength:xa.get(e,32),relativeOffsetOfLocalHeader:Ga.get(e,42),filename:null}},len:46};function vpe(e){let t=new Uint8Array(Ga.len);return Ga.put(t,0,e),t}var Gp=(0,uGe.default)("tokenizer:inflate"),gB=256*1024,mGe=vpe(Lb.DataDescriptor),AD=vpe(Lb.EndOfCentralDirectory),hGe=class Ppe{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(gB)}async isZip(){return await this.peekSignature()===Lb.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(Ga)}async findEndOfCentralDirectoryLocator(){let t=this.tokenizer,r=Math.min(16*1024,t.fileInfo.size),n=this.syncBuffer.subarray(0,r);await this.tokenizer.readBuffer(n,{position:t.fileInfo.size-r});for(let i=n.length-4;i>=0;i--)if(n[i]===AD[0]&&n[i+1]===AD[1]&&n[i+2]===AD[2]&&n[i+3]===AD[3])return t.fileInfo.size-r+i;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){Gp("Cannot reading central-directory without random-read support");return}Gp("Reading central-directory...");let t=this.tokenizer.position,r=await this.findEndOfCentralDirectoryLocator();if(r>0){Gp("Central-directory 32-bit signature found");let n=await this.tokenizer.readToken(fGe,r),i=[];this.tokenizer.setPosition(n.offsetOfStartOfCd);for(let s=0;s<n.nrOfEntriesOfSize;++s){let a=await this.tokenizer.readToken(dGe);if(a.signature!==Lb.CentralFileHeader)throw new Error("Expected Central-File-Header signature");a.filename=await this.tokenizer.readToken(new Ad(a.filenameLength,"utf-8")),await this.tokenizer.ignore(a.extraFieldLength),await this.tokenizer.ignore(a.fileCommentLength),i.push(a),Gp(`Add central-directory file-entry: n=${s+1}/${i.length}: filename=${i[s].filename}`)}return this.tokenizer.setPosition(t),i}this.tokenizer.setPosition(t)}async unzip(t){let r=await this.readCentralDirectory();if(r)return this.iterateOverCentralDirectory(r,t);let n=!1;do{let i=await this.readLocalFileHeader();if(!i)break;let s=t(i);n=!!s.stop;let a;if(await this.tokenizer.ignore(i.extraFieldLength),i.dataDescriptor&&i.compressedSize===0){let o=[],l=gB;Gp("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let c=-1;for(;c<0&&l===gB;){l=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),c=yGe(this.syncBuffer.subarray(0,l),mGe);let u=c>=0?c:l;if(s.handler){let p=new Uint8Array(u);await this.tokenizer.readBuffer(p),o.push(p)}else await this.tokenizer.ignore(u)}Gp(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),s.handler&&await this.inflate(i,gGe(o),s.handler)}else s.handler?(Gp(`Reading compressed-file-data: ${i.compressedSize} bytes`),a=new Uint8Array(i.compressedSize),await this.tokenizer.readBuffer(a),await this.inflate(i,a,s.handler)):(Gp(`Ignoring compressed-file-data: ${i.compressedSize} bytes`),await this.tokenizer.ignore(i.compressedSize));if(Gp(`Reading data-descriptor at pos=${this.tokenizer.position}`),i.dataDescriptor&&(await this.tokenizer.readToken(Mce)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-Mce.len}`)}while(!n)}async iterateOverCentralDirectory(t,r){for(let n of t){let i=r(n);if(i.handler){this.tokenizer.setPosition(n.relativeOffsetOfLocalHeader);let s=await this.readLocalFileHeader();if(s){await this.tokenizer.ignore(s.extraFieldLength);let a=new Uint8Array(n.compressedSize);await this.tokenizer.readBuffer(a),await this.inflate(s,a,i.handler)}}if(i.stop)break}}async inflate(t,r,n){if(t.compressedMethod===0)return n(r);if(t.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${t.compressedMethod}`);Gp(`Decompress filename=${t.filename}, compressed-size=${r.length}`);let i=await Ppe.decompressDeflateRaw(r);return n(i)}static async decompressDeflateRaw(t){let r=new ReadableStream({start(s){s.enqueue(t),s.close()}}),n=new DecompressionStream("deflate-raw"),i=r.pipeThrough(n);try{let s=await new Response(i).arrayBuffer();return new Uint8Array(s)}catch(s){let a=s instanceof Error?`Failed to deflate ZIP entry: ${s.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(a)}}async readLocalFileHeader(){let t=await this.tokenizer.peekToken(Ga);if(t===Lb.LocalFileHeader){let r=await this.tokenizer.readToken(pGe);return r.filename=await this.tokenizer.readToken(new Ad(r.filenameLength,"utf-8")),r}if(t===Lb.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}};function yGe(e,t){let r=e.length,n=t.length;if(n>r)return-1;for(let i=0;i<=r-n;i++){let s=!0;for(let a=0;a<n;a++)if(e[i+a]!==t[a]){s=!1;break}if(s)return i}return-1}function gGe(e){let t=e.reduce((i,s)=>i+s.length,0),r=new Uint8Array(t),n=0;for(let i of e)r.set(i,n),n+=i.length;return r}var TGe=class{constructor(e){this.tokenizer=e}inflate(){let e=this.tokenizer;return new ReadableStream({async pull(t){let r=new Uint8Array(1024),n=await e.readBuffer(r,{mayBeLess:!0});if(n===0){t.close();return}t.enqueue(r.subarray(0,n))}}).pipeThrough(new DecompressionStream("gzip"))}},_vn={utf8:new globalThis.TextDecoder("utf8")},wvn=new globalThis.TextEncoder,Avn=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function $ce(e){let{byteLength:t}=e;if(t===6)return e.getUint16(0)*2**32+e.getUint32(2);if(t===5)return e.getUint8(0)*2**32+e.getUint32(1);if(t===4)return e.getUint32(0);if(t===3)return e.getUint8(0)*2**16+e.getUint16(1);if(t===2)return e.getUint16(0);if(t===1)return e.getUint8(0)}function bGe(e,t){if(t==="utf-16le"){let r=[];for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);r.push(i&255,i>>8&255)}return r}if(t==="utf-16be"){let r=[];for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);r.push(i>>8&255,i&255)}return r}return[...e].map(r=>r.charCodeAt(0))}function xGe(e,t=0){let r=Number.parseInt(new Ad(6).get(e,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(r))return!1;let n=256;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 SGe={get:(e,t)=>e[t+3]&127|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4},EGe=["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","ttc","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","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","rm","ppsm","ppsx","tar.gz","reg","dat"],vGe=["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.ms-powerpoint.slideshow.macroenabled.12","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/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/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","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/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","font/collection","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","text/vtt","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/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-ms-regedit","application/x-ft-windows-registry-hive"],ND=4100;function TB(e){switch(e=e.toLowerCase(),e){case"application/epub+zip":return{ext:"epub",mime:e};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:e};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:e};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:e};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:e};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:e};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:e};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:e};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:e};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:e};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:e};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:e};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:e};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:e};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:e};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:e};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"};default:}}function Zp(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 PGe=class{constructor(e){this.options={mpegOffsetTolerance:0,...e},this.detectors=[...e?.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:e?.signal}}async fromTokenizer(e){let t=e.position;for(let r of this.detectors){let n=await r.detect(e);if(n)return n;if(t!==e.position)return}}async fromBuffer(e){if(!(e instanceof Uint8Array||e instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``);let t=e instanceof Uint8Array?e:new Uint8Array(e);if(t?.length>1)return this.fromTokenizer(YXe(t,this.tokenizerOptions))}async fromBlob(e){let t=JXe(e,this.tokenizerOptions);try{return await this.fromTokenizer(t)}finally{await t.close()}}async fromStream(e){let t=Spe(e,this.tokenizerOptions);try{return await this.fromTokenizer(t)}finally{await t.close()}}async toDetectionStream(e,t){let{sampleSize:r=ND}=t,n,i,s=e.getReader({mode:"byob"});try{let{value:l,done:c}=await s.read(new Uint8Array(r));if(i=l,!c&&l)try{n=await this.fromBuffer(l.subarray(0,r))}catch(u){if(!(u instanceof ho))throw u;n=void 0}i=l}finally{s.releaseLock()}let a=new TransformStream({async start(l){l.enqueue(i)},transform(l,c){c.enqueue(l)}}),o=e.pipeThrough(a);return o.fileType=n,o}check(e,t){return Zp(this.buffer,e,t)}checkString(e,t){return this.check(bGe(e,t?.encoding),t)}detectConfident=async e=>{if(this.buffer=new Uint8Array(ND),e.fileInfo.size===void 0&&(e.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=e,await e.peekBuffer(this.buffer,{length:32,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 e.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.detectConfident(e);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])){let t=new TGe(e).inflate(),r=!0;try{let n;try{n=await this.fromStream(t)}catch{r=!1}if(n&&n.ext==="tar")return{ext:"tar.gz",mime:"application/gzip"}}finally{r&&await t.cancel()}return{ext:"gz",mime:"application/gzip"}}if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await e.ignore(6);let t=await e.readToken(SGe);return e.position+t>e.fileInfo.size?{ext:"mp3",mime:"audio/mpeg"}:(await e.ignore(t),this.fromTokenizer(e))}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("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])){let t;return await new hGe(e).unzip(r=>{switch(r.filename){case"META-INF/mozilla.rsa":return t={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return t={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return{async handler(n){let i=new TextDecoder("utf-8").decode(n).trim();t=TB(i)},stop:!0};case"[Content_Types].xml":return{async handler(n){let i=new TextDecoder("utf-8").decode(n),s=i.indexOf('.main+xml"');if(s===-1){let a="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";i.includes(`ContentType="${a}"`)&&(t=TB(a))}else{i=i.slice(0,Math.max(0,s));let a=i.lastIndexOf('"'),o=i.slice(Math.max(0,a+1));t=TB(o)}},stop:!0};default:return/classes\d*\.dex/.test(r.filename)?(t={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}}).catch(r=>{if(!(r instanceof ho))throw r}),t??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await e.ignore(28);let t=new Uint8Array(8);return await e.readBuffer(t),Zp(t,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:Zp(t,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:Zp(t,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:Zp(t,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:Zp(t,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:Zp(t,[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("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/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"))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 t=await this.readTiffHeader(!1);if(t)return t}if(this.check([77,77])){let t=await this.readTiffHeader(!0);if(t)return t}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function t(){let s=await e.peekNumber(aGe),a=128,o=0;for(;(s&a)===0&&a!==0;)++o,a>>=1;let l=new Uint8Array(o+1);return await e.readBuffer(l),l}async function r(){let s=await t(),a=await t();a[0]^=128>>a.length-1;let o=Math.min(6,a.length),l=new DataView(s.buffer),c=new DataView(a.buffer,a.length-o,o);return{id:$ce(l),len:$ce(c)}}async function n(s){for(;s>0;){let a=await r();if(a.id===17026)return(await e.readToken(new Ad(a.len))).replaceAll(/\00.*$/g,"");await e.ignore(a.len),--s}}let i=await r();switch(await n(i.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}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")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};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.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};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 t=new Ad(4,"latin1").get(this.buffer,2);if(t.match("^d*")&&t>=1e3&&t<=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 e.ignore(8),await e.readToken(new Ad(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
|
|
661
661
|
`,"\r"," "," ","\0"].some(t=>this.checkString(t,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){await e.ignore(8);async function t(){return{length:await e.readToken(lGe),type:await e.readToken(new Ad(4,"latin1"))}}do{let r=await t();if(r.length<0)return;switch(r.type){case"IDAT":return{ext:"png",mime:"image/png"};case"acTL":return{ext:"apng",mime:"image/apng"};default:await e.ignore(r.length+4)}}while(e.position+8<e.fileInfo.size);return{ext:"png",mime:"image/png"}}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/vnd.apache.arrow.file"};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.checkString("ftyp",{offset:4})&&(this.buffer[8]&96)!==0){let t=new Ad(4,"latin1").get(this.buffer,8).replace("\0"," ").trim();switch(t){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 t.startsWith("3g")?t.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString(`REGEDIT4\r
|
|
662
662
|
`))return{ext:"reg",mime:"application/x-ms-regedit"};if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};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.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 t(){let r=new Uint8Array(16);return await e.readBuffer(r),{id:r,size:Number(await e.readToken(cGe))}}for(await e.ignore(30);e.position+24<e.fileInfo.size;){let r=await t(),n=r.size-24;if(Zp(r.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){let i=new Uint8Array(16);if(n-=await e.readBuffer(i),Zp(i,[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(Zp(i,[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 e.ignore(n)}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 e.ignore(20),await e.readToken(new Ad(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.checkString("<?xml ",{offset:2,encoding:"utf-16be"})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await e.peekBuffer(this.buffer,{length:Math.min(256,e.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};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 t=new DataView(this.buffer.buffer).getUint32(12,!0);if(t>12&&this.buffer.length>=t+16)try{let r=new TextDecoder().decode(this.buffer.subarray(16,t+16));if(JSON.parse(r).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 e.peekBuffer(this.buffer,{length:Math.min(512,e.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\0",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&xGe(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){let t="utf-16le";return this.checkString("<?xml ",{offset:2,encoding:t})?{ext:"xml",mime:"application/xml"}:this.check([255,14],{offset:2})&&this.checkString("SketchUp Model",{offset:4,encoding:t})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:this.checkString(`Windows Registry Editor Version 5.00\r
|
|
663
663
|
`,{offset:2,encoding:t})?{ext:"reg",mime:"application/x-ms-regedit"}:void 0}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}};detectImprecise=async e=>{if(this.buffer=new Uint8Array(ND),await e.peekBuffer(this.buffer,{length:Math.min(8,e.fileInfo.size),mayBeLess:!0}),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(await e.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,e.fileInfo.size),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let t=0;t<=this.options.mpegOffsetTolerance;++t){let r=this.scanMpeg(t);if(r)return r}};async readTiffTag(e){let t=await this.tokenizer.readToken(e?dv:xa);switch(this.tokenizer.ignore(10),t){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"};default:}}async readTiffIFD(e){let t=await this.tokenizer.readToken(e?dv:xa);for(let r=0;r<t;++r){let n=await this.readTiffTag(e);if(n)return n}}async readTiffHeader(e){let t=(e?dv:xa).get(this.buffer,2),r=(e?oGe:Ga).get(this.buffer,4);if(t===42){if(r>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(r>=8){let n=(e?dv:xa).get(this.buffer,8),i=(e?dv:xa).get(this.buffer,10);if(n===28&&i===254||n===31&&i===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}return await this.tokenizer.ignore(r),await this.readTiffIFD(e)??{ext:"tif",mime:"image/tiff"}}if(t===43)return{ext:"tif",mime:"image/tiff"}}scanMpeg(e){if(this.check([255,224],{offset:e,mask:[255,224]})){if(this.check([16],{offset:e+1,mask:[22]}))return this.check([8],{offset:e+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:e+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:e+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:e+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}},Ivn=new Set(EGe),Dvn=new Set(vGe),_Ge=class extends PGe{async fromStream(e){let t=await(e instanceof kXe?Spe(e,this.tokenizerOptions):GXe(e,this.tokenizerOptions));try{return await super.fromTokenizer(t)}finally{await t.close()}}async fromFile(e){let t=await ZXe(e);try{return await super.fromTokenizer(t)}finally{await t.close()}}async toDetectionStream(e,t={}){if(!(e instanceof LXe))return super.toDetectionStream(e,t);let{sampleSize:r=ND}=t;return new Promise((n,i)=>{e.on("error",i),e.once("readable",()=>{(async()=>{try{let s=new FXe,a=Bce?Bce(e,s,()=>{}):e.pipe(s),o=e.read(r)??e.read()??new Uint8Array(0);try{s.fileType=await this.fromBuffer(o)}catch(l){l instanceof ho?s.fileType=void 0:i(l)}n(a)}catch(s){i(s)}})()})})}};async function wGe(e,t){return new _Ge(t).fromFile(e,t)}var AGe=Bb(THe(),1),_pe=(e,t,r)=>{let n=e instanceof RegExp?Uce(e,r):e,i=t instanceof RegExp?Uce(t,r):t,s=n!==null&&i!=null&&IGe(n,i,r);return s&&{start:s[0],end:s[1],pre:r.slice(0,s[0]),body:r.slice(s[0]+n.length,s[1]),post:r.slice(s[1]+i.length)}},Uce=(e,t)=>{let r=t.match(e);return r?r[0]:null},IGe=(e,t,r)=>{let n,i,s,a,o,l=r.indexOf(e),c=r.indexOf(t,l+1),u=l;if(l>=0&&c>0){if(e===t)return[l,c];for(n=[],s=r.length;u>=0&&!o;){if(u===l)n.push(u),l=r.indexOf(e,u+1);else if(n.length===1){let p=n.pop();p!==void 0&&(o=[p,c])}else i=n.pop(),i!==void 0&&i<s&&(s=i,a=c),c=r.indexOf(t,u+1);u=l<c&&l>=0?l:c}n.length&&a!==void 0&&(o=[s,a])}return o},wpe="\0SLASH"+Math.random()+"\0",Ape="\0OPEN"+Math.random()+"\0",YB="\0CLOSE"+Math.random()+"\0",Ipe="\0COMMA"+Math.random()+"\0",Dpe="\0PERIOD"+Math.random()+"\0",DGe=new RegExp(wpe,"g"),OGe=new RegExp(Ape,"g"),CGe=new RegExp(YB,"g"),NGe=new RegExp(Ipe,"g"),kGe=new RegExp(Dpe,"g"),FGe=/\\\\/g,LGe=/\\{/g,RGe=/\\}/g,BGe=/\\,/g,jGe=/\\./g;function bB(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function MGe(e){return e.replace(FGe,wpe).replace(LGe,Ape).replace(RGe,YB).replace(BGe,Ipe).replace(jGe,Dpe)}function $Ge(e){return e.replace(DGe,"\\").replace(OGe,"{").replace(CGe,"}").replace(NGe,",").replace(kGe,".")}function Ope(e){if(!e)return[""];let t=[],r=_pe("{","}",e);if(!r)return e.split(",");let{pre:n,body:i,post:s}=r,a=n.split(",");a[a.length-1]+="{"+i+"}";let o=Ope(s);return s.length&&(a[a.length-1]+=o.shift(),a.push.apply(a,o)),t.push.apply(t,a),t}function UGe(e){return e?(e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),yv(MGe(e),!0).map($Ge)):[]}function VGe(e){return"{"+e+"}"}function qGe(e){return/^-?0\d/.test(e)}function KGe(e,t){return e<=t}function zGe(e,t){return e>=t}function yv(e,t){let r=[],n=_pe("{","}",e);if(!n)return[e];let i=n.pre,s=n.post.length?yv(n.post,!1):[""];if(/\$$/.test(n.pre))for(let a=0;a<s.length;a++){let o=i+"{"+n.body+"}"+s[a];r.push(o)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),o=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),l=a||o,c=n.body.indexOf(",")>=0;if(!l&&!c)return n.post.match(/,(?!,).*\}/)?(e=n.pre+"{"+n.body+YB+n.post,yv(e)):[e];let u;if(l)u=n.body.split(/\.\./);else if(u=Ope(n.body),u.length===1&&u[0]!==void 0&&(u=yv(u[0],!1).map(VGe),u.length===1))return s.map(f=>n.pre+u[0]+f);let p;if(l&&u[0]!==void 0&&u[1]!==void 0){let f=bB(u[0]),d=bB(u[1]),m=Math.max(u[0].length,u[1].length),h=u.length===3&&u[2]!==void 0?Math.abs(bB(u[2])):1,y=KGe;d<f&&(h*=-1,y=zGe);let T=u.some(qGe);p=[];for(let x=f;y(x,d);x+=h){let b;if(o)b=String.fromCharCode(x),b==="\\"&&(b="");else if(b=String(x),T){let D=m-b.length;if(D>0){let O=new Array(D+1).join("0");x<0?b="-"+O+b.slice(1):b=O+b}}p.push(b)}}else{p=[];for(let f=0;f<u.length;f++)p.push.apply(p,yv(u[f],!1))}for(let f=0;f<p.length;f++)for(let d=0;d<s.length;d++){let m=i+p[f]+s[d];(!t||l||m)&&r.push(m)}}return r}var RD=e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},WGe={"[: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]},mv=e=>e.replace(/[[\]\\-]/g,"\\$&"),YGe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Vce=e=>e.join(""),JGe=(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,c=!1,u=r,p="";e:for(;s<e.length;){let m=e.charAt(s);if((m==="!"||m==="^")&&s===r+1){c=!0,s++;continue}if(m==="]"&&a&&!l){u=s+1;break}if(a=!0,m==="\\"&&!l){l=!0,s++;continue}if(m==="["&&!l){for(let[h,[y,T,x]]of Object.entries(WGe))if(e.startsWith(h,s)){if(p)return["$.",!1,e.length-r,!0];s+=h.length,x?i.push(y):n.push(y),o=o||T;continue e}}if(l=!1,p){m>p?n.push(mv(p)+"-"+mv(m)):m===p&&n.push(mv(m)),p="",s++;continue}if(e.startsWith("-]",s+1)){n.push(mv(m+"-")),s+=2;continue}if(e.startsWith("-",s+1)){p=m,s+=2;continue}n.push(mv(m)),s++}if(u<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])&&!c){let m=n[0].length===2?n[0].slice(-1):n[0];return[YGe(m),!1,u-r,!1]}let f="["+(c?"^":"")+Vce(n)+"]",d="["+(c?"":"^")+Vce(i)+"]";return[n.length&&i.length?"("+f+"|"+d+")":n.length?f:d,o,u-r,!0]},gv=(e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!0}={})=>r?t?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):t?e.replace(/\[([^\/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1"),HGe=new Set(["!","?","+","*","@"]),qce=e=>HGe.has(e),XGe="(?!(?:^|/)\\.\\.?(?:$|/))",ID="(?!\\.)",GGe=new Set(["[","."]),ZGe=new Set(["..","."]),QGe=new Set("().*{}+?[]^$\\!"),eZe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),JB="[^/]",Kce=JB+"*?",zce=JB+"+?",Cpe=class Ec{type;#e;#t;#r=!1;#n=[];#s;#l;#i;#o=!1;#a;#h;#f=!1;constructor(t,r,n={}){this.type=t,t&&(this.#t=!0),this.#s=r,this.#e=this.#s?this.#s.#e:this,this.#a=this.#e===this?n:this.#e.#a,this.#i=this.#e===this?[]:this.#e.#i,t==="!"&&!this.#e.#o&&this.#i.push(this),this.#l=this.#s?this.#s.#n.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let t of this.#n)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#h!==void 0?this.#h:this.type?this.#h=this.type+"("+this.#n.map(t=>String(t)).join("|")+")":this.#h=this.#n.map(t=>String(t)).join("")}#u(){if(this!==this.#e)throw new Error("should only call on root");if(this.#o)return this;this.toString(),this.#o=!0;let t;for(;t=this.#i.pop();){if(t.type!=="!")continue;let r=t,n=r.#s;for(;n;){for(let i=r.#l+1;!n.type&&i<n.#n.length;i++)for(let s of t.#n){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(n.#n[i])}r=n,n=r.#s}}return this}push(...t){for(let r of t)if(r!==""){if(typeof r!="string"&&!(r instanceof Ec&&r.#s===this))throw new Error("invalid part: "+r);this.#n.push(r)}}toJSON(){let t=this.type===null?this.#n.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#n.map(r=>r.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#o&&this.#s?.type==="!")&&t.push({}),t}isStart(){if(this.#e===this)return!0;if(!this.#s?.isStart())return!1;if(this.#l===0)return!0;let t=this.#s;for(let r=0;r<this.#l;r++){let n=t.#n[r];if(!(n instanceof Ec&&n.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#s?.type==="!")return!0;if(!this.#s?.isEnd())return!1;if(!this.type)return this.#s?.isEnd();let t=this.#s?this.#s.#n.length:0;return this.#l===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let r=new Ec(this.type,t);for(let n of this.#n)r.copyIn(n);return r}static#p(t,r,n,i){let s=!1,a=!1,o=-1,l=!1;if(r.type===null){let d=n,m="";for(;d<t.length;){let h=t.charAt(d++);if(s||h==="\\"){s=!s,m+=h;continue}if(a){d===o+1?(h==="^"||h==="!")&&(l=!0):h==="]"&&!(d===o+2&&l)&&(a=!1),m+=h;continue}else if(h==="["){a=!0,o=d,l=!1,m+=h;continue}if(!i.noext&&qce(h)&&t.charAt(d)==="("){r.push(m),m="";let y=new Ec(h,r);d=Ec.#p(t,y,d,i),r.push(y);continue}m+=h}return r.push(m),d}let c=n+1,u=new Ec(null,r),p=[],f="";for(;c<t.length;){let d=t.charAt(c++);if(s||d==="\\"){s=!s,f+=d;continue}if(a){c===o+1?(d==="^"||d==="!")&&(l=!0):d==="]"&&!(c===o+2&&l)&&(a=!1),f+=d;continue}else if(d==="["){a=!0,o=c,l=!1,f+=d;continue}if(qce(d)&&t.charAt(c)==="("){u.push(f),f="";let m=new Ec(d,u);u.push(m),c=Ec.#p(t,m,c,i);continue}if(d==="|"){u.push(f),f="",p.push(u),u=new Ec(null,r);continue}if(d===")")return f===""&&r.#n.length===0&&(r.#f=!0),u.push(f),f="",r.push(...p,u),c;f+=d}return r.type=null,r.#t=void 0,r.#n=[t.substring(n-1)],c}static fromGlob(t,r={}){let n=new Ec(null,void 0,r);return Ec.#p(t,n,0,r),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let t=this.toString(),[r,n,i,s]=this.toRegExpSource();if(!(i||this.#t||this.#a.nocase&&!this.#a.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return n;let a=(this.#a.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${r}$`,a),{_src:r,_glob:t})}get options(){return this.#a}toRegExpSource(t){let r=t??!!this.#a.dot;if(this.#e===this&&this.#u(),!this.type){let l=this.isStart()&&this.isEnd()&&!this.#n.some(f=>typeof f!="string"),c=this.#n.map(f=>{let[d,m,h,y]=typeof f=="string"?Ec.#T(f,this.#t,l):f.toRegExpSource(t);return this.#t=this.#t||h,this.#r=this.#r||y,d}).join(""),u="";if(this.isStart()&&typeof this.#n[0]=="string"&&!(this.#n.length===1&&ZGe.has(this.#n[0]))){let f=GGe,d=r&&f.has(c.charAt(0))||c.startsWith("\\.")&&f.has(c.charAt(2))||c.startsWith("\\.\\.")&&f.has(c.charAt(4)),m=!r&&!t&&f.has(c.charAt(0));u=d?XGe:m?ID:""}let p="";return this.isEnd()&&this.#e.#o&&this.#s?.type==="!"&&(p="(?:$|\\/)"),[u+c+p,gv(c),this.#t=!!this.#t,this.#r]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#c(r);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let l=this.toString();return this.#n=[l],this.type=null,this.#t=void 0,[l,gv(this.toString()),!1,!1]}let a=!n||t||r||!ID?"":this.#c(!0);a===s&&(a=""),a&&(s=`(?:${s})(?:${a})*?`);let o="";if(this.type==="!"&&this.#f)o=(this.isStart()&&!r?ID:"")+zce;else{let l=this.type==="!"?"))"+(this.isStart()&&!r&&!t?ID:"")+Kce+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;o=i+s+l}return[o,gv(s),this.#t=!!this.#t,this.#r]}#c(t){return this.#n.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,i,s,a]=r.toRegExpSource(t);return this.#r=this.#r||a,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#T(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+=(QGe.has(l)?"\\":"")+l;continue}if(l==="\\"){o===t.length-1?s+="\\\\":i=!0;continue}if(l==="["){let[c,u,p,f]=JGe(t,o);if(p){s+=c,a=a||u,o+=p-1,r=r||f;continue}}if(l==="*"){s+=n&&t==="*"?zce:Kce,r=!0;continue}if(l==="?"){s+=JB,r=!0;continue}s+=eZe(l)}return[s,gv(t),!!r,a]}},tZe=(e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!1}={})=>r?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),Za=(e,t,r={})=>(RD(t),!r.nocomment&&t.charAt(0)==="#"?!1:new KD(t,r).match(e)),rZe=/^\*+([^+@!?\*\[\(]*)$/,nZe=e=>t=>!t.startsWith(".")&&t.endsWith(e),iZe=e=>t=>t.endsWith(e),sZe=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),aZe=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),oZe=/^\*+\.\*+$/,lZe=e=>!e.startsWith(".")&&e.includes("."),cZe=e=>e!=="."&&e!==".."&&e.includes("."),uZe=/^\.\*+$/,pZe=e=>e!=="."&&e!==".."&&e.startsWith("."),fZe=/^\*+$/,dZe=e=>e.length!==0&&!e.startsWith("."),mZe=e=>e.length!==0&&e!=="."&&e!=="..",hZe=/^\?+([^+@!?\*\[\(]*)?$/,yZe=([e,t=""])=>{let r=Npe([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},gZe=([e,t=""])=>{let r=kpe([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},TZe=([e,t=""])=>{let r=kpe([e]);return t?n=>r(n)&&n.endsWith(t):r},bZe=([e,t=""])=>{let r=Npe([e]);return t?n=>r(n)&&n.endsWith(t):r},Npe=([e])=>{let t=e.length;return r=>r.length===t&&!r.startsWith(".")},kpe=([e])=>{let t=e.length;return r=>r.length===t&&r!=="."&&r!==".."},Fpe=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Wce={win32:{sep:"\\"},posix:{sep:"/"}},xZe=Fpe==="win32"?Wce.win32.sep:Wce.posix.sep;Za.sep=xZe;var tu=Symbol("globstar **");Za.GLOBSTAR=tu;var SZe="[^/]",EZe=SZe+"*?",vZe="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",PZe="(?:(?!(?:\\/|^)\\.).)*?",_Ze=(e,t={})=>r=>Za(r,e,t);Za.filter=_Ze;var eu=(e,t={})=>Object.assign({},e,t),wZe=e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return Za;let t=Za;return Object.assign((r,n,i={})=>t(r,n,eu(e,i)),{Minimatch:class extends t.Minimatch{constructor(r,n={}){super(r,eu(e,n))}static defaults(r){return t.defaults(eu(e,r)).Minimatch}},AST:class extends t.AST{constructor(r,n,i={}){super(r,n,eu(e,i))}static fromGlob(r,n={}){return t.AST.fromGlob(r,eu(e,n))}},unescape:(r,n={})=>t.unescape(r,eu(e,n)),escape:(r,n={})=>t.escape(r,eu(e,n)),filter:(r,n={})=>t.filter(r,eu(e,n)),defaults:r=>t.defaults(eu(e,r)),makeRe:(r,n={})=>t.makeRe(r,eu(e,n)),braceExpand:(r,n={})=>t.braceExpand(r,eu(e,n)),match:(r,n,i={})=>t.match(r,n,eu(e,i)),sep:t.sep,GLOBSTAR:tu})};Za.defaults=wZe;var Lpe=(e,t={})=>(RD(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:UGe(e));Za.braceExpand=Lpe;var AZe=(e,t={})=>new KD(e,t).makeRe();Za.makeRe=AZe;var IZe=(e,t,r={})=>{let n=new KD(t,r);return e=e.filter(i=>n.match(i)),n.options.nonull&&!e.length&&e.push(t),e};Za.match=IZe;var Yce=/[?*]|[+@!]\(.*?\)|\[|\]/,DZe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),KD=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,t={}){RD(e),t=t||{},this.options=t,this.pattern=e,this.platform=t.platform||Fpe,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot!==void 0?t.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 e of this.set)for(let t of e)if(typeof t!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...i)=>console.error(...i)),this.debug(this.pattern,this.globSet);let r=this.globSet.map(i=>this.slashSplit(i));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let n=this.globParts.map((i,s,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let o=i[0]===""&&i[1]===""&&(i[2]==="?"||!Yce.test(i[2]))&&!Yce.test(i[3]),l=/^[a-z]:/i.test(i[0]);if(o)return[...i.slice(0,4),...i.slice(4).map(c=>this.parse(c))];if(l)return[i[0],...i.slice(1).map(c=>this.parse(c))]}return i.map(o=>this.parse(o))});if(this.debug(this.pattern,n),this.set=n.filter(i=>i.indexOf(!1)===-1),this.isWindows)for(let i=0;i<this.set.length;i++){let s=this.set[i];s[0]===""&&s[1]===""&&this.globParts[i][2]==="?"&&typeof s[3]=="string"&&/^[a-z]:$/i.test(s[3])&&(s[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let r=0;r<e.length;r++)for(let n=0;n<e[r].length;n++)e[r][n]==="**"&&(e[r][n]="*");let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):t>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(t=>{let r=-1;for(;(r=t.indexOf("**",r+1))!==-1;){let n=r;for(;t[n+1]==="**";)n++;n!==r&&t.splice(r,n-r)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((r,n)=>{let i=r[r.length-1];return n==="**"&&i==="**"?r:n===".."&&i&&i!==".."&&i!=="."&&i!=="**"?(r.pop(),r):(r.push(n),r)},[]),t.length===0?[""]:t))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let i=e[n];n===1&&i===""&&e[0]===""||(i==="."||i==="")&&(t=!0,e.splice(n,1),n--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=!0,e.pop())}let r=0;for(;(r=e.indexOf("..",r+1))!==-1;){let n=e[r-1];n&&n!=="."&&n!==".."&&n!=="**"&&(t=!0,e.splice(r-1,2),r-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let r of e){let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let s=n;for(;r[s+1]==="**";)s++;s>n&&r.splice(n+1,s-n);let a=r[n+1],o=r[n+2],l=r[n+3];if(a!==".."||!o||o==="."||o===".."||!l||l==="."||l==="..")continue;t=!0,r.splice(n,1);let c=r.slice(0);c[n]="**",e.push(c),n--}if(!this.preserveMultipleSlashes){for(let s=1;s<r.length-1;s++){let a=r[s];s===1&&a===""&&r[0]===""||(a==="."||a==="")&&(t=!0,r.splice(s,1),s--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(t=!0,r.pop())}let i=0;for(;(i=r.indexOf("..",i+1))!==-1;){let s=r[i-1];if(s&&s!=="."&&s!==".."&&s!=="**"){t=!0;let a=i===1&&r[i+1]==="**"?["."]:[];r.splice(i-1,2,...a),r.length===0&&r.push(""),i-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let r=t+1;r<e.length;r++){let n=this.partsMatch(e[t],e[r],!this.preserveMultipleSlashes);if(n){e[t]=[],e[r]=n;break}}return e.filter(t=>t.length)}partsMatch(e,t,r=!1){let n=0,i=0,s=[],a="";for(;n<e.length&&i<t.length;)if(e[n]===t[i])s.push(a==="b"?t[i]:e[n]),n++,i++;else if(r&&e[n]==="**"&&t[i]===e[n+1])s.push(e[n]),n++;else if(r&&t[i]==="**"&&e[n]===t[i+1])s.push(t[i]),i++;else if(e[n]==="*"&&t[i]&&(this.options.dot||!t[i].startsWith("."))&&t[i]!=="**"){if(a==="b")return!1;a="a",s.push(e[n]),n++,i++}else if(t[i]==="*"&&e[n]&&(this.options.dot||!e[n].startsWith("."))&&e[n]!=="**"){if(a==="a")return!1;a="b",s.push(t[i]),n++,i++}else return!1;return e.length===t.length&&s}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,r=0;for(let n=0;n<e.length&&e.charAt(n)==="!";n++)t=!t,r++;r&&(this.pattern=e.slice(r)),this.negate=t}matchOne(e,t,r=!1){let n=this.options;if(this.isWindows){let m=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),h=!m&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),y=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),T=!y&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),x=h?3:m?0:void 0,b=T?3:y?0:void 0;if(typeof x=="number"&&typeof b=="number"){let[D,O]=[e[x],t[b]];D.toLowerCase()===O.toLowerCase()&&(t[b]=D,b>x?t=t.slice(b):x>b&&(e=e.slice(x)))}}let{optimizationLevel:i=1}=this.options;i>=2&&(e=this.levelTwoFileOptimize(e)),this.debug("matchOne",this,{file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var s=0,a=0,o=e.length,l=t.length;s<o&&a<l;s++,a++){this.debug("matchOne loop");var c=t[a],u=e[s];if(this.debug(t,c,u),c===!1)return!1;if(c===tu){this.debug("GLOBSTAR",[t,c,u]);var p=s,f=a+1;if(f===l){for(this.debug("** at the end");s<o;s++)if(e[s]==="."||e[s]===".."||!n.dot&&e[s].charAt(0)===".")return!1;return!0}for(;p<o;){var d=e[p];if(this.debug(`
|
|
@@ -714,7 +714,7 @@ Done. The ${ga(t)} ${(0,Mc.green)(r)} has been configured for your terminal. \u2
|
|
|
714
714
|
${(0,zi.yellow)("--source-path")} Optional path to the TypeScript or JavaScript entry file.`,pA=`${Fpn}
|
|
715
715
|
${Lpn}`,Zne=`${(0,zi.yellow)("--container-url")} Override a custom container URL. If not provided, defaults to production or the local container in development mode.`,Gi=`${pA}
|
|
716
716
|
${Zne}
|
|
717
|
-
${(0,zi.yellow)("--console-url")} Specify a custom URL to access the developer Console.`,tL=`The option ${(0,zi.yellow)("--keep-staged")} only applies when ${(0,zi.yellow)("--no-apply")} is NOT used (i.e. the change is applied immediately).`;var er=e=>Rr({args:e,options:["-d","--doc"]})?"doc":"cli";var ra=nt(ct(),1);var fA="0.12.
|
|
717
|
+
${(0,zi.yellow)("--console-url")} Specify a custom URL to access the developer Console.`,tL=`The option ${(0,zi.yellow)("--keep-staged")} only applies when ${(0,zi.yellow)("--no-apply")} is NOT used (i.e. the change is applied immediately).`;var er=e=>Rr({args:e,options:["-d","--doc"]})?"doc":"cli";var ra=nt(ct(),1);var fA="0.12.1";var Bpn=` __ __ __ __ _ ____
|
|
718
718
|
__) || | || \\| |/ \\
|
|
719
719
|
\\___/ \\___/ |_|\\__|\\____/`,Xt=`${Bpn} CLI ${(0,ra.grey)(`v${fA}`)}`,$Me=`Juno CLI ${(0,ra.grey)(`v${fA}`)}`,dA=`
|
|
720
720
|
${Xt}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@junobuild/cli",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "The Juno command-line interface",
|
|
5
5
|
"author": "David Dal Busco (https://daviddalbusco.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@icp-sdk/core": "^4.2.3",
|
|
36
36
|
"@junobuild/admin": "^3.0.2",
|
|
37
37
|
"@junobuild/cdn": "^2.0.2",
|
|
38
|
-
"@junobuild/cli-tools": "^0.9.
|
|
38
|
+
"@junobuild/cli-tools": "^0.9.2",
|
|
39
39
|
"@junobuild/config": "^2.6.0",
|
|
40
40
|
"@junobuild/config-loader": "^0.4.6",
|
|
41
41
|
"@junobuild/core": "^3.2.0",
|