20 lines
110 KiB
JavaScript
Raw Permalink Normal View History

2025-09-05 14:59:21 +08:00
var Os=Object.defineProperty;var fi=i=>{throw TypeError(i)};var n=(i,o)=>Os(i,"name",{value:o,configurable:!0});var ci=(i,o,a)=>o.has(i)||fi("Cannot "+a);var O=(i,o,a)=>(ci(i,o,"read from private field"),a?a.call(i):o.get(i)),be=(i,o,a)=>o.has(i)?fi("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(i):o.set(i,a),X=(i,o,a,f)=>(ci(i,o,"write to private field"),f?f.call(i,a):o.set(i,a),a);var ve,zt,bt,Cr,ze,It,Ft,mt,ee,yt,He,Ve,gt;import Bt from"node:http";import zs from"node:https";import st from"node:zlib";import me,{PassThrough as dr,pipeline as lt}from"node:stream";import{Buffer as M}from"node:buffer";import{types as hr,deprecate as pr,promisify as Is}from"node:util";import{c as di,g as Fs}from"./shared/node-fetch-native.DfbY2q-x.mjs";import{format as js}from"node:url";import{isIP as Ls}from"node:net";import{promises as $s,statSync as hi,createReadStream as Ds}from"node:fs";import{basename as Ms}from"node:path";function Us(i){if(!/^data:/i.test(i))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');i=i.replace(/\r?\n/g,"");const o=i.indexOf(",");if(o===-1||o<=4)throw new TypeError("malformed data: URI");const a=i.substring(5,o).split(";");let f="",l=!1;const p=a[0]||"text/plain";let h=p;for(let A=1;A<a.length;A++)a[A]==="base64"?l=!0:a[A]&&(h+=`;${a[A]}`,a[A].indexOf("charset=")===0&&(f=a[A].substring(8)));!a[0]&&!f.length&&(h+=";charset=US-ASCII",f="US-ASCII");const S=l?"base64":"ascii",v=unescape(i.substring(o+1)),w=Buffer.from(v,S);return w.type=p,w.typeFull=h,w.charset=f,w}n(Us,"dataUriToBuffer");var pi={},kt={exports:{}};/**
* @license
* web-streams-polyfill v3.3.3
* Copyright 2024 Mattias Buelens, Diwank Singh Tomer and other contributors.
* This code is released under the MIT license.
* SPDX-License-Identifier: MIT
*/var xs=kt.exports,bi;function Ns(){return bi||(bi=1,function(i,o){(function(a,f){f(o)})(xs,function(a){function f(){}n(f,"noop");function l(e){return typeof e=="object"&&e!==null||typeof e=="function"}n(l,"typeIsObject");const p=f;function h(e,t){try{Object.defineProperty(e,"name",{value:t,configurable:!0})}catch{}}n(h,"setFunctionName");const S=Promise,v=Promise.prototype.then,w=Promise.reject.bind(S);function A(e){return new S(e)}n(A,"newPromise");function T(e){return A(t=>t(e))}n(T,"promiseResolvedWith");function b(e){return w(e)}n(b,"promiseRejectedWith");function q(e,t,r){return v.call(e,t,r)}n(q,"PerformPromiseThen");function g(e,t,r){q(q(e,t,r),void 0,p)}n(g,"uponPromise");function V(e,t){g(e,t)}n(V,"uponFulfillment");function I(e,t){g(e,void 0,t)}n(I,"uponRejection");function F(e,t,r){return q(e,t,r)}n(F,"transformPromiseWith");function Q(e){q(e,void 0,p)}n(Q,"setPromiseIsHandledToTrue");let ge=n(e=>{if(typeof queueMicrotask=="function")ge=queueMicrotask;else{const t=T(void 0);ge=n(r=>q(t,r),"_queueMicrotask")}return ge(e)},"_queueMicrotask");function z(e,t,r){if(typeof e!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}n(z,"reflectCall");function j(e,t,r){try{return T(z(e,t,r))}catch(s){return b(s)}}n(j,"promiseCall");const U=16384,bn=class bn{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(t){const r=this._back;let s=r;r._elements.length===U-1&&(s={_elements:[],_next:void 0}),r._elements.push(t),s!==r&&(this._back=s,r._next=s),++this._size}shift(){const t=this._front;let r=t;const s=this._cursor;let u=s+1;const c=t._elements,d=c[s];return u===U&&(r=t._next,u=0),--this._size,this._cursor=u,t!==r&&(this._front=r),c[s]=void 0,d}forEach(t){let r=this._cursor,s=this._front,u=s._elements;for(;(r!==u.length||s._next!==void 0)&&!(r===u.length&&(s=s._next,u=s._elements,r=0,u.length===0));)t(u[r]),++r}peek(){const t=this._front,r=this._cursor;return t._elements[r]}};n(bn,"SimpleQueue");let D=bn;const jt=Symbol("[[AbortSteps]]"),Qn=Symbol("[[ErrorSteps]]"),Ar=Symbol("[[CancelSteps]]"),Br=Symbol("[[PullSteps]]"),kr=Symbol("[[ReleaseSteps]]");function Yn(e,t){e._ownerReadableStream=t,t._reader=e,t._state==="readable"?qr(e):t._state==="closed"?xi(e):Gn(e,t._storedError)}n(Yn,"ReadableStreamReaderGenericInitialize");function Wr(e,t){const r=e._ownerReadableStream;return ie(r,t)}n(Wr,"ReadableStreamReaderGenericCancel");function _e(e){const t=e._ownerReadableStream;t._state==="readable"?Or(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):Ni(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),t._readableStreamController[kr](),t._reader=void 0,e._ownerReadableStream=void 0}n(_e,"ReadableStreamReaderGenericRelease");function Lt(e){return new TypeError("Cannot "+e+" a stream using a released reader")}n(Lt,"readerLockException");function qr(e){e._closedPromise=A((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r})}n(qr,"defaultReaderClosedPromiseInitialize");function Gn(e,t){qr(e),Or(e,t)}n(Gn,"defaultReaderClosedPromiseInitializeAsRejected");function xi(e){qr(e),Zn(e)}n(xi,"defaultReaderClosedPromiseInitializeAsResolved");function Or(e,t){e._closedPromise_reject!==void 0&&(Q(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}n(Or,"defaultReaderClosedPromiseReject");function Ni(e,t){Gn(e,t)}n(Ni,"defaultReaderClosedPromiseResetToRejected");function Zn(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}n(Zn,"defaultReaderClosedPromiseResolve");const Kn=Number.isFinite||function(e){return typeof e=="number"&&isFinite(e)},Hi=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function Vi(e){return typeof e=="object"||typeof e=="function"}n(Vi,"isDictionary");function ue(e,t){if(e!==void 0&&!Vi(e)
`)).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),"e$1"),Ue=n((i,o,a)=>{if(o.length<a)throw new TypeError(`Failed to execute '${i}' on 'FormData': ${a} arguments required, but only ${o.length} present.`)},"x");const br=(yt=class{constructor(...o){be(this,ee,[]);if(o.length)throw new TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}get[Wt](){return"FormData"}[Qs](){return this.entries()}static[Ys](o){return o&&typeof o=="object"&&o[Wt]==="FormData"&&!Gs.some(a=>typeof o[a]!="function")}append(...o){Ue("append",arguments,2),O(this,ee).push(Si(...o))}delete(o){Ue("delete",arguments,1),o+="",X(this,ee,O(this,ee).filter(([a])=>a!==o))}get(o){Ue("get",arguments,1),o+="";for(var a=O(this,ee),f=a.length,l=0;l<f;l++)if(a[l][0]===o)return a[l][1];return null}getAll(o,a){return Ue("getAll",arguments,1),a=[],o+="",O(this,ee).forEach(f=>f[0]===o&&a.push(f[1])),a}has(o){return Ue("has",arguments,1),o+="",O(this,ee).some(a=>a[0]===o)}forEach(o,a){Ue("forEach",arguments,1);for(var[f,l]of this)o.call(a,l,f,this)}set(...o){Ue("set",arguments,2);var a=[],f=!0;o=Si(...o),O(this,ee).forEach(l=>{l[0]===o[0]?f&&(f=!a.push(o)):a.push(l)}),f&&a.push(o),X(this,ee,a)}*entries(){yield*O(this,ee)}*keys(){for(var[o]of this)yield o}*values(){for(var[,o]of this)yield o}},ee=new WeakMap,n(yt,"FormData"),yt);function Zs(i,o=ut){var a=`${_i()}${_i()}`.replace(/\./g,"").slice(-28).padStart(32,"-"),f=[],l=`--${a}\r
Content-Disposition: form-data; name="`;return i.forEach((p,h)=>typeof p=="string"?f.push(l+On(h)+`"\r
\r
${p.replace(/\r(?!\n)|(?<!\r)\n/g,`\r
`)}\r
`):f.push(l+On(h)+`"; filename="${On(p.name,1)}"\r
Content-Type: ${p.type||"application/octet-stream"}\r
\r
`,p,`\r
`)),f.push(`--${a}--`),new o(f,{type:"multipart/form-data; boundary="+a})}n(Zs,"formDataToBlob");const Un=class Un extends Error{constructor(o,a){super(o),Error.captureStackTrace(this,this.constructor),this.type=a}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}};n(Un,"FetchBaseError");let ft=Un;const xn=class xn extends ft{constructor(o,a,f){super(o,a),f&&(this.code=this.errno=f.code,this.erroredSysCall=f.syscall)}};n(xn,"FetchError");let G=xn;const mr=Symbol.toStringTag,wi=n(i=>typeof i=="object"&&typeof i.append=="function"&&typeof i.delete=="function"&&typeof i.get=="function"&&typeof i.getAll=="function"&&typeof i.has=="function"&&typeof i.set=="function"&&typeof i.sort=="function"&&i[mr]==="URLSearchParams","isURLSearchParameters"),yr=n(i=>i&&typeof i=="object"&&typeof i.arrayBuffer=="function"&&typeof i.type=="string"&&typeof i.stream=="function"&&typeof i.constructor=="function"&&/^(Blob|File)$/.test(i[mr]),"isBlob"),Ks=n(i=>typeof i=="object"&&(i[mr]==="AbortSignal"||i[mr]==="EventTarget"),"isAbortSignal"),Js=n((i,o)=>{const a=new URL(o).hostname,f=new URL(i).hostname;return a===f||a.endsWith(`.${f}`)},"isDomainOrSubdomain"),Xs=n((i,o)=>{const a=new URL(o).protocol,f=new URL(i).protocol;return a===f},"isSameProtocol"),el=Is(me.pipeline),H=Symbol("Body internals"),Nn=class Nn{constructor(o,{size:a=0}={}){let f=null;o===null?o=null:wi(o)?o=M.from(o.toString()):yr(o)||M.isBuffer(o)||(hr.isAnyArrayBuffer(o)?o=M.from(o):ArrayBuffer.isView(o)?o=M.from(o.buffer,o.byteOffset,o.byteLength):o instanceof me||(o instanceof br?(o=Zs(o),f=o.type.split("=")[1]):o=M.from(String(o))));let l=o;M.isBuffer(o)?l=me.Readable.from(o):yr(o)&&(l=me.Readable.from(o.stream())),this[H]={body:o,stream:l,boundary:f,disturbed:!1,error:null},this.size=a,o instanceof me&&o.on("error",p=>{const h=p instanceof ft?p:new G(`Invalid response body while trying to fetch ${this.url}: ${p.message}`,"system",p);this[H].error=h})}get body(){return this[H].stream}get bodyUsed(){return this[H].disturbed}async arrayBuffer(){const{buffer:o,byteOffset:a,byteLength:f}=await zn(this);return o.slice(a,a+f)}async formData(){const o=this.headers.get("content-type");if(o.startsWith("application/x-www-form-urlencoded")){const f=new br,l=new URLSearchParams(await this.text());for(const[p,h]of l)f.append(p,h);return f}const{toFormData:a}=await import("./chunks/multipart-parser.mjs");return a(this.body,o)}async blob(){const o=this.headers&&this.headers.get("content-type")||this[H].body&&this[H].body.type||"",a=await this.arrayBuffer();return new ut([a],{type:o})}async json(){const o=await this.text();return JSON.parse(o)}async text(){const o=await zn(this);return new TextDecoder().decode(o)}buffer(){return zn(this)}};n(Nn,"Body");let xe=Nn;xe.prototype.buffer=pr(xe.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer"),Object.defineProperties(xe.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:pr(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function zn(i){if(i[H].disturbed)throw new TypeError(`body used already for: ${i.url}`);if(i[H].disturbed=!0,i[H].error)throw i[H].error;const{body:o}=i;if(o===null)return M.alloc(0);if(!(o instanceof me))return M.alloc(0);const a=[];let f=0;try{for await(const l of o){if(i.size>0&&f+l.length>i.size){const p=new G(`content size at ${i.url} over limit: ${i.size}`,"max-size");throw o.destroy(p),p}f+=l.length,a.push(l)}}catch(l){throw l instanceof ft?l:new G(`Invalid response body while trying to fetch ${i.url}: ${l.message}`,"system",l)}if(o.readableEnded===!0||o._readableState.ended===!0)try{return a.every(l=>typeof l=="string")?M.from(a.join("")):M.concat(a,f)}catch(l){throw new G(`Could not create Buffer from response body for ${i.url}: ${l.message}`,"system",l)}else throw new G(`Premature close of server response whil
\r
`);let f=!1,l=!1,p;i.on("response",h=>{const{headers:S}=h;f=S["transfer-encoding"]==="chunked"&&!S["content-length"]}),i.on("socket",h=>{const S=n(()=>{if(f&&!l){const w=new Error("Premature close");w.code="ERR_STREAM_PREMATURE_CLOSE",o(w)}},"onSocketClose"),v=n(w=>{l=M.compare(w.slice(-5),a)===0,!l&&p&&(l=M.compare(p.slice(-3),a.slice(0,3))===0&&M.compare(w.slice(-2),a.slice(3))===0),p=w},"onData");h.prependListener("close",S),h.on("data",v),i.on("close",()=>{h.removeListener("close",S),h.removeListener("data",v)})})}n(Rl,"fixResponseChunkedTransferBadEnding");const Bi=new WeakMap,Dn=new WeakMap;function W(i){const o=Bi.get(i);return console.assert(o!=null,"'this' is expected an Event object, but got",i),o}n(W,"pd");function ki(i){if(i.passiveListener!=null){typeof console<"u"&&typeof console.error=="function"&&console.error("Unable to preventDefault inside passive event listener invocation.",i.passiveListener);return}i.event.cancelable&&(i.canceled=!0,typeof i.event.preventDefault=="function"&&i.event.preventDefault())}n(ki,"setCancelFlag");function ht(i,o){Bi.set(this,{eventTarget:i,event:o,eventPhase:2,currentTarget:i,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:o.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});const a=Object.keys(o);for(let f=0;f<a.length;++f){const l=a[f];l in this||Object.defineProperty(this,l,Wi(l))}}n(ht,"Event"),ht.prototype={get type(){return W(this).event.type},get target(){return W(this).eventTarget},get currentTarget(){return W(this).currentTarget},composedPath(){const i=W(this).currentTarget;return i==null?[]:[i]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return W(this).eventPhase},stopPropagation(){const i=W(this);i.stopped=!0,typeof i.event.stopPropagation=="function"&&i.event.stopPropagation()},stopImmediatePropagation(){const i=W(this);i.stopped=!0,i.immediateStopped=!0,typeof i.event.stopImmediatePropagation=="function"&&i.event.stopImmediatePropagation()},get bubbles(){return!!W(this).event.bubbles},get cancelable(){return!!W(this).event.cancelable},preventDefault(){ki(W(this))},get defaultPrevented(){return W(this).canceled},get composed(){return!!W(this).event.composed},get timeStamp(){return W(this).timeStamp},get srcElement(){return W(this).eventTarget},get cancelBubble(){return W(this).stopped},set cancelBubble(i){if(!i)return;const o=W(this);o.stopped=!0,typeof o.event.cancelBubble=="boolean"&&(o.event.cancelBubble=!0)},get returnValue(){return!W(this).canceled},set returnValue(i){i||ki(W(this))},initEvent(){}},Object.defineProperty(ht.prototype,"constructor",{value:ht,configurable:!0,writable:!0}),typeof window<"u"&&typeof window.Event<"u"&&(Object.setPrototypeOf(ht.prototype,window.Event.prototype),Dn.set(window.Event.prototype,ht));function Wi(i){return{get(){return W(this).event[i]},set(o){W(this).event[i]=o},configurable:!0,enumerable:!0}}n(Wi,"defineRedirectDescriptor");function Tl(i){return{value(){const o=W(this).event;return o[i].apply(o,arguments)},configurable:!0,enumerable:!0}}n(Tl,"defineCallDescriptor");function Cl(i,o){const a=Object.keys(o);if(a.length===0)return i;function f(l,p){i.call(this,l,p)}n(f,"CustomEvent"),f.prototype=Object.create(i.prototype,{constructor:{value:f,configurable:!0,writable:!0}});for(let l=0;l<a.length;++l){const p=a[l];if(!(p in i.prototype)){const S=typeof Object.getOwnPropertyDescriptor(o,p).value=="function";Object.defineProperty(f.prototype,p,S?Tl(p):Wi(p))}}return f}n(Cl,"defineWrapper");function qi(i){if(i==null||i===Object.prototype)return ht;let o=Dn.get(i);return o==null&&(o=Cl(qi(Object.getPrototypeOf(i)),i),Dn.set(i,o)),o}n(qi,"getWrapper");function Pl(i,o){const a=qi(Object.getPrototypeOf(o));return new a(i,o)}n(Pl,"wrapEvent");function vl(i){return W(i).immediateStopped}n(vl,"isStopped");function El(i,o){W(i).eventPhase=o}n(El,"setEventPhase");function Al(i,o){W(i).currentTarget=o}n(Al,"setCurrentTarget");function Oi(i,o){W(i).passiveListener=o}n(Oi,"setPassiveListener"