@wener/utils 1.1.26 → 1.1.29
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/README.md +4 -0
- package/lib/arrays/MaybeArray.js +36 -25
- package/lib/arrays/MaybeArray.js.map +1 -1
- package/lib/arrays/arrayFromAsync.js +5 -7
- package/lib/arrays/arrayFromAsync.js.map +1 -1
- package/lib/asyncs/AsyncInterval.js +11 -12
- package/lib/asyncs/AsyncInterval.js.map +1 -1
- package/lib/asyncs/MaybePromise.js +3 -0
- package/lib/asyncs/MaybePromise.js.map +1 -0
- package/lib/asyncs/createAsyncIterator.js +37 -35
- package/lib/asyncs/createAsyncIterator.js.map +1 -1
- package/lib/asyncs/createLazyPromise.js +59 -60
- package/lib/asyncs/createLazyPromise.js.map +1 -1
- package/lib/asyncs/firstOfAsyncIterator.js +7 -9
- package/lib/asyncs/firstOfAsyncIterator.js.map +1 -1
- package/lib/asyncs/generatorOfStream.js +16 -0
- package/lib/asyncs/generatorOfStream.js.map +1 -0
- package/lib/asyncs/isIterator.js +3 -4
- package/lib/asyncs/isIterator.js.map +1 -1
- package/lib/asyncs/isPromise.js +3 -4
- package/lib/asyncs/isPromise.js.map +1 -1
- package/lib/asyncs/isThenable.js +6 -0
- package/lib/asyncs/isThenable.js.map +1 -0
- package/lib/asyncs/nextOfAsyncIterator.js +20 -14
- package/lib/asyncs/nextOfAsyncIterator.js.map +1 -1
- package/lib/asyncs/promiseOfCallback.js +17 -0
- package/lib/asyncs/promiseOfCallback.js.map +1 -0
- package/lib/asyncs/sleep.js +2 -3
- package/lib/asyncs/sleep.js.map +1 -1
- package/lib/asyncs/timeout.js +22 -26
- package/lib/asyncs/timeout.js.map +1 -1
- package/lib/browsers/copy.js +47 -45
- package/lib/browsers/copy.js.map +1 -1
- package/lib/browsers/download.js +38 -27
- package/lib/browsers/download.js.map +1 -1
- package/lib/browsers/getFileFromDataTransfer.js +41 -28
- package/lib/browsers/getFileFromDataTransfer.js.map +1 -1
- package/lib/browsers/loaders.js +43 -43
- package/lib/browsers/loaders.js.map +1 -1
- package/lib/crypto/base.js +5 -4
- package/lib/crypto/base.js.map +1 -1
- package/lib/crypto/getNodeCrypto.js +14 -13
- package/lib/crypto/getNodeCrypto.js.map +1 -1
- package/lib/crypto/getRandomValues.js +22 -26
- package/lib/crypto/getRandomValues.js.map +1 -1
- package/lib/crypto/hashing.js +42 -50
- package/lib/crypto/hashing.js.map +1 -1
- package/lib/crypto/md5.bench.js +21 -0
- package/lib/crypto/md5.bench.js.map +1 -0
- package/lib/crypto/md5.d.js +3 -0
- package/lib/crypto/md5.d.js.map +1 -0
- package/lib/crypto/md5.js +119 -121
- package/lib/crypto/md5.js.map +1 -1
- package/lib/crypto/pem/pem.js +32 -35
- package/lib/crypto/pem/pem.js.map +1 -1
- package/lib/crypto/randomUUID.js +12 -11
- package/lib/crypto/randomUUID.js.map +1 -1
- package/lib/crypto/ulid.js +123 -112
- package/lib/crypto/ulid.js.map +1 -1
- package/lib/errors/Errors.js +167 -149
- package/lib/errors/Errors.js.map +1 -1
- package/lib/fetch/createFetchWith.js +20 -23
- package/lib/fetch/createFetchWith.js.map +1 -1
- package/lib/fetch/createFetchWithLogging.js +20 -16
- package/lib/fetch/createFetchWithLogging.js.map +1 -1
- package/lib/fetch/createFetchWithRetry.js +61 -65
- package/lib/fetch/createFetchWithRetry.js.map +1 -1
- package/lib/fetch/dumpRequest.js +39 -42
- package/lib/fetch/dumpRequest.js.map +1 -1
- package/lib/fetch/dumpResponse.js +13 -20
- package/lib/fetch/dumpResponse.js.map +1 -1
- package/lib/fetch/index.js +7 -0
- package/lib/fetch/index.js.map +1 -0
- package/lib/fetch/types.js +3 -0
- package/lib/fetch/types.js.map +1 -0
- package/lib/http/HttpStatus.js +89 -80
- package/lib/http/HttpStatus.js.map +1 -1
- package/lib/i18n/createTranslate.js +48 -48
- package/lib/i18n/createTranslate.js.map +1 -1
- package/lib/index.js +30 -14
- package/lib/index.js.map +1 -1
- package/lib/io/AbstractEncoding.js +7 -0
- package/lib/io/AbstractEncoding.js.map +1 -0
- package/lib/io/ArrayBuffer.test-d.js +7 -0
- package/lib/io/ArrayBuffer.test-d.js.map +1 -0
- package/lib/io/ArrayBuffers.js +198 -172
- package/lib/io/ArrayBuffers.js.map +1 -1
- package/lib/io/Buffer.js +21 -20
- package/lib/io/Buffer.js.map +1 -1
- package/lib/io/base64.js +49 -48
- package/lib/io/base64.js.map +1 -1
- package/lib/io/isBuffer.js +7 -5
- package/lib/io/isBuffer.js.map +1 -1
- package/lib/io/isTransferable.js +23 -19
- package/lib/io/isTransferable.js.map +1 -1
- package/lib/isomorphics/getGlobalThis.js +17 -12
- package/lib/isomorphics/getGlobalThis.js.map +1 -1
- package/lib/isomorphics/structuredClone.js +71 -63
- package/lib/isomorphics/structuredClone.js.map +1 -1
- package/lib/langs/MaybeFunction.js +7 -7
- package/lib/langs/MaybeFunction.js.map +1 -1
- package/lib/langs/classOf.js +3 -4
- package/lib/langs/classOf.js.map +1 -1
- package/lib/langs/deepEqual.js +77 -85
- package/lib/langs/deepEqual.js.map +1 -1
- package/lib/langs/deepFreeze.js +20 -0
- package/lib/langs/deepFreeze.js.map +1 -0
- package/lib/langs/hashCode.ignored.js +112 -0
- package/lib/langs/hashCode.ignored.js.map +1 -0
- package/lib/langs/isClass.js +3 -4
- package/lib/langs/isClass.js.map +1 -1
- package/lib/langs/isDefined.js +3 -4
- package/lib/langs/isDefined.js.map +1 -1
- package/lib/langs/isEmptyObject.js +3 -5
- package/lib/langs/isEmptyObject.js.map +1 -1
- package/lib/langs/isFunction.js +5 -0
- package/lib/langs/isFunction.js.map +1 -0
- package/lib/langs/isPlainObject.js +7 -8
- package/lib/langs/isPlainObject.js.map +1 -1
- package/lib/langs/memoize.js +19 -21
- package/lib/langs/memoize.js.map +1 -1
- package/lib/langs/parseBoolean.js +26 -27
- package/lib/langs/parseBoolean.js.map +1 -1
- package/lib/langs/shallowClone.js +12 -12
- package/lib/langs/shallowClone.js.map +1 -1
- package/lib/langs/shallowEqual.js +21 -18
- package/lib/langs/shallowEqual.js.map +1 -1
- package/lib/libs/ms.js +123 -103
- package/lib/libs/ms.js.map +1 -1
- package/lib/logging/Logger.js +5 -0
- package/lib/logging/Logger.js.map +1 -0
- package/lib/logging/createChildLogger.js +12 -14
- package/lib/logging/createChildLogger.js.map +1 -1
- package/lib/logging/createLogger.js +59 -33
- package/lib/logging/createLogger.js.map +1 -1
- package/lib/logging/createNoopLogger.js +11 -12
- package/lib/logging/createNoopLogger.js.map +1 -1
- package/lib/logging/slog.js +143 -0
- package/lib/logging/slog.js.map +1 -0
- package/lib/maths/clamp.js +21 -0
- package/lib/maths/clamp.js.map +1 -0
- package/lib/maths/random.js +14 -15
- package/lib/maths/random.js.map +1 -1
- package/lib/modules/isModule.js +5 -4
- package/lib/modules/isModule.js.map +1 -1
- package/lib/modules/parseModuleId.js +36 -31
- package/lib/modules/parseModuleId.js.map +1 -1
- package/lib/objects/get.js +13 -11
- package/lib/objects/get.js.map +1 -1
- package/lib/objects/get.test-d.js +33 -0
- package/lib/objects/get.test-d.js.map +1 -0
- package/lib/objects/merge/index.js +3 -0
- package/lib/objects/merge/index.js.map +1 -0
- package/lib/objects/merge/isMergeableObject.js +11 -10
- package/lib/objects/merge/isMergeableObject.js.map +1 -1
- package/lib/objects/merge/merge.js +65 -66
- package/lib/objects/merge/merge.js.map +1 -1
- package/lib/objects/parseObjectPath.js +35 -23
- package/lib/objects/parseObjectPath.js.map +1 -1
- package/lib/objects/set.js +33 -34
- package/lib/objects/set.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/common/encoder.js +100 -0
- package/lib/schema/typebox/gen/codegen/common/encoder.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/common/formatter.js +33 -0
- package/lib/schema/typebox/gen/codegen/common/formatter.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/common/index.js +5 -0
- package/lib/schema/typebox/gen/codegen/common/index.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/common/jsdoc.js +117 -0
- package/lib/schema/typebox/gen/codegen/common/jsdoc.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/expression/compiler.js +367 -0
- package/lib/schema/typebox/gen/codegen/expression/compiler.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/expression/errors.js +259 -0
- package/lib/schema/typebox/gen/codegen/expression/errors.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/expression/evaluator.js +254 -0
- package/lib/schema/typebox/gen/codegen/expression/evaluator.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/expression/expression.js +384 -0
- package/lib/schema/typebox/gen/codegen/expression/expression.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/expression/index.js +6 -0
- package/lib/schema/typebox/gen/codegen/expression/index.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/index.js +5 -0
- package/lib/schema/typebox/gen/codegen/index.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/index.js +16 -0
- package/lib/schema/typebox/gen/codegen/model/index.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-arktype.js +239 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-arktype.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-expression.js +359 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-expression.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-grpc.js +217 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-grpc.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-io-ts.js +253 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-io-ts.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-javascript.js +47 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-javascript.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-json-schema.js +171 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-json-schema.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-typebox.js +33 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-typebox.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-typescript.js +164 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-typescript.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-valibot.js +218 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-valibot.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-value.js +43 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-value.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-yrel.js +206 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-yrel.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-yup.js +204 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-yup.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-zod.js +227 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-zod.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model.js +27 -0
- package/lib/schema/typebox/gen/codegen/model/model.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/typescript/index.js +4 -0
- package/lib/schema/typebox/gen/codegen/typescript/index.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/typescript/typescript-to-model.js +48 -0
- package/lib/schema/typebox/gen/codegen/typescript/typescript-to-model.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/typescript/typescript-to-typebox.js +596 -0
- package/lib/schema/typebox/gen/codegen/typescript/typescript-to-typebox.js.map +1 -0
- package/lib/schema/typebox/gen/index.js +3 -0
- package/lib/schema/typebox/gen/index.js.map +1 -0
- package/lib/schema/typebox/index.js +3 -0
- package/lib/schema/typebox/index.js.map +1 -0
- package/lib/schema/typebox/typebox.js +23 -0
- package/lib/schema/typebox/typebox.js.map +1 -0
- package/lib/server.js +2 -1
- package/lib/server.js.map +1 -1
- package/lib/servers/crypto/md5.js +3 -5
- package/lib/servers/crypto/md5.js.map +1 -1
- package/lib/servers/fetch/createFetchWithProxy.js +2 -4
- package/lib/servers/fetch/createFetchWithProxy.js.map +1 -1
- package/lib/servers/fetch/createFetchWithProxyByNodeFetch.js +34 -34
- package/lib/servers/fetch/createFetchWithProxyByNodeFetch.js.map +1 -1
- package/lib/servers/fetch/createFetchWithProxyByUndici.js +59 -45
- package/lib/servers/fetch/createFetchWithProxyByUndici.js.map +1 -1
- package/lib/servers/getPackageDir.js +8 -10
- package/lib/servers/getPackageDir.js.map +1 -1
- package/lib/servers/jsdom.js +3 -2
- package/lib/servers/jsdom.js.map +1 -1
- package/lib/servers/node-fetch.js +4 -3
- package/lib/servers/node-fetch.js.map +1 -1
- package/lib/servers/polyfill/polyfillBrowser.js +17 -0
- package/lib/servers/polyfill/polyfillBrowser.js.map +1 -0
- package/lib/servers/polyfill/polyfillCrypto.js +8 -10
- package/lib/servers/polyfill/polyfillCrypto.js.map +1 -1
- package/lib/servers/polyfill/polyfillFetch.js +23 -22
- package/lib/servers/polyfill/polyfillFetch.js.map +1 -1
- package/lib/servers/polyfill/polyfillJsDom.js +59 -52
- package/lib/servers/polyfill/polyfillJsDom.js.map +1 -1
- package/lib/servers/polyfill/polyfillWebSocket.js +13 -13
- package/lib/servers/polyfill/polyfillWebSocket.js.map +1 -1
- package/lib/servers/ws.js +3 -2
- package/lib/servers/ws.js.map +1 -1
- package/lib/strings/camelCase.js +51 -49
- package/lib/strings/camelCase.js.map +1 -1
- package/lib/strings/formatBytes.js +41 -15
- package/lib/strings/formatBytes.js.map +1 -1
- package/lib/strings/renderTemplate.js +27 -20
- package/lib/strings/renderTemplate.js.map +1 -1
- package/lib/typedoc.js +4 -0
- package/lib/typedoc.js.map +1 -0
- package/lib/types/global.d.js +2 -0
- package/lib/types/global.d.js.map +1 -0
- package/lib/types/index.d.js +6 -0
- package/lib/types/index.d.js.map +1 -0
- package/lib/validations/asserts.js +14 -0
- package/lib/validations/asserts.js.map +1 -0
- package/lib/validations/isUUID.js +3 -4
- package/lib/validations/isUUID.js.map +1 -1
- package/lib/validations/parseTimestamp.js +25 -21
- package/lib/validations/parseTimestamp.js.map +1 -1
- package/package.json +59 -44
- package/src/index.ts +3 -3
- package/src/langs/deepFreeze.ts +19 -0
- package/src/langs/hashCode.ignored.ts +125 -0
- package/src/libs/README.md +2 -0
- package/src/logging/slog.ts +121 -0
- package/src/maths/clamp.test.ts +19 -0
- package/src/maths/clamp.ts +23 -1
- package/src/objects/get.ts +14 -14
- package/src/objects/set.ts +5 -5
- package/src/schema/typebox/gen/codegen/common/encoder.ts +99 -0
- package/src/schema/typebox/gen/codegen/common/formatter.ts +31 -0
- package/src/schema/typebox/gen/codegen/common/index.ts +29 -0
- package/src/schema/typebox/gen/codegen/common/jsdoc.ts +93 -0
- package/src/schema/typebox/gen/codegen/expression/compiler.ts +377 -0
- package/src/schema/typebox/gen/codegen/expression/errors.ts +302 -0
- package/src/schema/typebox/gen/codegen/expression/evaluator.ts +268 -0
- package/src/schema/typebox/gen/codegen/expression/expression.ts +538 -0
- package/src/schema/typebox/gen/codegen/expression/index.ts +32 -0
- package/src/schema/typebox/gen/codegen/index.ts +29 -0
- package/src/schema/typebox/gen/codegen/model/index.ts +40 -0
- package/src/schema/typebox/gen/codegen/model/model-to-arktype.ts +266 -0
- package/src/schema/typebox/gen/codegen/model/model-to-expression.ts +378 -0
- package/src/schema/typebox/gen/codegen/model/model-to-grpc.ts +244 -0
- package/src/schema/typebox/gen/codegen/model/model-to-io-ts.ts +294 -0
- package/src/schema/typebox/gen/codegen/model/model-to-javascript.ts +42 -0
- package/src/schema/typebox/gen/codegen/model/model-to-json-schema.ts +166 -0
- package/src/schema/typebox/gen/codegen/model/model-to-typebox.ts +32 -0
- package/src/schema/typebox/gen/codegen/model/model-to-typescript.ts +189 -0
- package/src/schema/typebox/gen/codegen/model/model-to-valibot.ts +236 -0
- package/src/schema/typebox/gen/codegen/model/model-to-value.ts +42 -0
- package/src/schema/typebox/gen/codegen/model/model-to-yrel.ts +232 -0
- package/src/schema/typebox/gen/codegen/model/model-to-yup.ts +226 -0
- package/src/schema/typebox/gen/codegen/model/model-to-zod.ts +251 -0
- package/src/schema/typebox/gen/codegen/model/model.ts +33 -0
- package/src/schema/typebox/gen/codegen/typescript/index.ts +28 -0
- package/src/schema/typebox/gen/codegen/typescript/typescript-to-model.ts +61 -0
- package/src/schema/typebox/gen/codegen/typescript/typescript-to-typebox.ts +647 -0
- package/src/schema/typebox/gen/gen.test.ts +12 -0
- package/src/schema/typebox/gen/index.ts +1 -0
- package/src/schema/typebox/index.ts +1 -0
- package/src/schema/typebox/typebox.ts +34 -0
- package/src/servers/fetch/createFetchWithProxyByUndici.ts +16 -1
- package/src/types/index.d.ts +1 -0
- package/dist/LICENSE.txt +0 -1
- package/dist/cjs/getGlobalThis-304f74e0.js +0 -2
- package/dist/cjs/getGlobalThis-304f74e0.js.map +0 -1
- package/dist/cjs/index.cjs +0 -21
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/server.cjs +0 -2
- package/dist/cjs/server.cjs.map +0 -1
- package/dist/cjs/servers/jsdom.cjs +0 -2
- package/dist/cjs/servers/jsdom.cjs.map +0 -1
- package/dist/cjs/servers/node-fetch.cjs +0 -2
- package/dist/cjs/servers/node-fetch.cjs.map +0 -1
- package/dist/cjs/servers/ws.cjs +0 -2
- package/dist/cjs/servers/ws.cjs.map +0 -1
- package/dist/esm/getGlobalThis-b7ad0cf9.js +0 -2
- package/dist/esm/getGlobalThis-b7ad0cf9.js.map +0 -1
- package/dist/esm/index.js +0 -21
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/server.js +0 -2
- package/dist/esm/server.js.map +0 -1
- package/dist/esm/servers/jsdom.js +0 -2
- package/dist/esm/servers/jsdom.js.map +0 -1
- package/dist/esm/servers/node-fetch.js +0 -2
- package/dist/esm/servers/node-fetch.js.map +0 -1
- package/dist/esm/servers/ws.js +0 -2
- package/dist/esm/servers/ws.js.map +0 -1
- package/dist/system/getGlobalThis-8951eb0e.js +0 -2
- package/dist/system/getGlobalThis-8951eb0e.js.map +0 -1
- package/dist/system/index.js +0 -21
- package/dist/system/index.js.map +0 -1
- package/dist/system/server.js +0 -2
- package/dist/system/server.js.map +0 -1
- package/dist/system/servers/jsdom.js +0 -2
- package/dist/system/servers/jsdom.js.map +0 -1
- package/dist/system/servers/node-fetch.js +0 -2
- package/dist/system/servers/node-fetch.js.map +0 -1
- package/dist/system/servers/ws.js +0 -2
- package/dist/system/servers/ws.js.map +0 -1
- package/src/langs/hashCode.ts +0 -37
package/dist/esm/server.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{g as l}from"./getGlobalThis-b7ad0cf9.js";import{createHash as h}from"node:crypto";import d from"node:fs";import c from"node:path";import{fileURLToPath as g}from"node:url";async function w(){const t=l();return"crypto"in t?!1:(t.crypto=(await import("node:crypto")).webcrypto,!0)}function f({proxy:t,token:u,fetch:o,undici:s}={}){if(!t)return o||globalThis.fetch;let i;return async(...m)=>{const n=m[1]||={};{const r=n.body;typeof r=="object"&&r&&(r instanceof ReadableStream||Symbol.asyncIterator in r)&&(n.duplex||="half")}if(!i){let r=t,a=u;{let e;try{e=new URL(t)}catch{}!a&&e&&(e.username||e.password)&&(a=`Basic ${btoa(`${e.username||""}:${e.password}`)}`,e.username="",e.password="",r=e.toString())}s||=import("undici");const p=await s,y=p.ProxyAgent;o||=p.fetch,i=new y({uri:r,token:a})}return n.dispatcher=i,await o(...m)}}const b=f;function x(t){return h("md5").update(t).digest("hex")}const P=g(import.meta.url),k=c.dirname(P);function S(t=k){for(;!d.existsSync(c.join(t,"package.json"));)if(t=c.resolve(t,".."),t==="/")return;return t}export{b as createFetchWithProxy,f as createFetchWithProxyByUndici,S as getPackageDir,x as md5,w as polyfillCrypto};
|
|
2
|
-
//# sourceMappingURL=server.js.map
|
package/dist/esm/server.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sources":["../../src/servers/polyfill/polyfillCrypto.ts","../../src/servers/fetch/createFetchWithProxyByUndici.ts","../../src/servers/fetch/createFetchWithProxy.ts","../../src/servers/crypto/md5.ts","../../src/servers/getPackageDir.ts"],"sourcesContent":["import { getGlobalThis } from '../../isomorphics/getGlobalThis';\n\nexport async function polyfillCrypto() {\n const globalThis = getGlobalThis();\n if ('crypto' in globalThis) {\n return false;\n }\n (globalThis as any).crypto = (await import('node:crypto')).webcrypto as Crypto;\n return true;\n}\n","import { MaybePromise } from '../../asyncs/MaybePromise';\nimport { FetchLike } from '../../fetch';\n\nexport function createFetchWithProxyByUndici({\n proxy,\n token: _token,\n fetch,\n undici,\n}: {\n proxy?: string;\n token?: string;\n fetch?: FetchLike;\n undici?: MaybePromise<{ fetch: any; ProxyAgent: any }>;\n} = {}): FetchLike {\n if (!proxy) {\n return fetch || globalThis.fetch;\n }\n let agent: any;\n // https://github.com/nodejs/undici/blob/main/docs/best-practices/proxy.md\n return async (...args) => {\n const init = (args[1] ||= {}) as RequestInit & {\n duplex?: string;\n dispatcher?: any;\n };\n {\n const body = init.body;\n if (typeof body === 'object' && body && (body instanceof ReadableStream || Symbol.asyncIterator in body)) {\n // request.duplex must be set if request.body is ReadableStream or Async Iterables\n init.duplex ||= 'half';\n }\n }\n if (!agent) {\n let uri = proxy;\n let token = _token;\n {\n let u: URL | undefined;\n try {\n u = new URL(proxy);\n } catch (e) {}\n if (!token && u && (u.username || u.password)) {\n token = `Basic ${btoa(`${u.username || ''}:${u.password}`)}`;\n u.username = '';\n u.password = '';\n uri = u.toString();\n }\n }\n // if in next use 'next/dist/compiled/undici'\n undici ||= import('undici');\n const mod = await undici;\n const ProxyAgent = mod.ProxyAgent as new (_: any) => any;\n fetch ||= mod.fetch as FetchLike;\n // https://github.com/nodejs/undici/blob/main/docs/api/ProxyAgent.md\n agent = new ProxyAgent({\n uri,\n token,\n });\n // https://github.com/nodejs/node/issues/43187#issuecomment-1134634174\n // (global as any)[Symbol.for('undici.globalDispatcher.1')] = agent;\n // fixme should unwrap error https://github.com/nodejs/undici/issues/1248\n }\n init.dispatcher = agent;\n return await fetch!(...args);\n };\n}\n","import { createFetchWithProxyByUndici } from './createFetchWithProxyByUndici';\n\nexport const createFetchWithProxy = createFetchWithProxyByUndici;\n","import { createHash } from 'node:crypto';\n\nexport function md5(input: Buffer | string) {\n return createHash('md5').update(input).digest('hex') as string;\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\nexport function getPackageDir(currentDir: string = __dirname) {\n while (!fs.existsSync(path.join(currentDir, 'package.json'))) {\n currentDir = path.resolve(currentDir, '..');\n if (currentDir === '/') {\n return undefined;\n }\n }\n return currentDir;\n}\n"],"names":["polyfillCrypto","globalThis","getGlobalThis","createFetchWithProxyByUndici","proxy","_token","fetch","undici","agent","args","init","body","uri","token","u","mod","ProxyAgent","createFetchWithProxy","md5","input","createHash","__filename","fileURLToPath","__dirname","path","getPackageDir","currentDir","fs"],"mappings":"kLAEA,CAAsBA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAiB,CACrC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAMC,CAAaC,CAAAA,CAAAA,CAAc,CACjC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAYD,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CACP,IAERA,CAAmB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,CACpD,CAAA,CAAA,CAA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AA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{g as w}from"../getGlobalThis-b7ad0cf9.js";async function g(){if(typeof window<"u")return!1;const s=w(),{ResourceLoader:a,JSDOM:u}=await import("jsdom");class i{constructor(n={}){const{proxy:o,strictSSL:t,userAgent:r,...p}=n,y=new a({proxy:o,strictSSL:t,userAgent:r});return new u("",Object.assign(p,{resources:y})).window}}const c={},f=(()=>Object.getOwnPropertyNames(new i(c)).filter(e=>typeof s[e]<"u"))();function l(...e){const n=e.filter(r=>Array.isArray(r))[0],o=e.filter(r=>!Array.isArray(r))[0],t=new i(Object.assign({},o,c));return Object.getOwnPropertyNames(t).filter(r=>!f.includes(r)).filter(r=>!(n&&n.indexOf(r)===-1)).filter(r=>{switch(r){case"undefined":return!1}return!0}).forEach(r=>{Object.defineProperty(s,r,{configurable:!0,get:()=>t[r]})}),t}return l({url:"http://localhost"}),!0}export{g as polyfillJsDom};
|
|
2
|
-
//# sourceMappingURL=jsdom.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsdom.js","sources":["../../../src/servers/polyfill/polyfillJsDom.ts"],"sourcesContent":["import type { ConstructorOptions, ResourceLoaderConstructorOptions } from 'jsdom';\nimport { getGlobalThis } from '../../isomorphics/getGlobalThis';\n\nexport async function polyfillJsDom() {\n if (typeof window !== 'undefined') {\n return false;\n }\n\n const globalThis = getGlobalThis();\n\n const { ResourceLoader, JSDOM } = await import('jsdom');\n\n // https://github.com/lukechilds/window/blob/master/src/index.js\n // eslint-disable-next-line @typescript-eslint/no-extraneous-class\n class Window {\n constructor(opts: ResourceLoaderConstructorOptions & ConstructorOptions = {}) {\n const { proxy, strictSSL, userAgent, ...jsdomOpts } = opts;\n const resources = new ResourceLoader({\n proxy,\n strictSSL,\n userAgent,\n });\n return new JSDOM(\n '',\n Object.assign(jsdomOpts, {\n resources,\n }),\n ).window;\n }\n }\n\n // https://github.com/lukechilds/browser-env/blob/master/src/index.js\n // Default jsdom config.\n // These settings must override any custom settings to make sure we can iterate\n // over the window object.\n const defaultJsdomConfig = {\n // features: {\n // FetchExternalResources: false,\n // ProcessExternalResources: false,\n // },\n };\n // IIFE executed on import to return an array of global Node.js properties that\n // conflict with global browser properties.\n const protectedProperties = (() =>\n Object.getOwnPropertyNames(new Window(defaultJsdomConfig)).filter(\n (prop) => typeof globalThis[prop as keyof typeof globalThis] !== 'undefined',\n ))();\n\n function installEnv(...args: any[]) {\n // Sets up global browser environment\n // Extract options from args\n const properties = args.filter((arg: any) => Array.isArray(arg))[0];\n const userJsdomConfig = args.filter((arg: any) => !Array.isArray(arg))[0];\n\n // Create window object\n const window = new Window(Object.assign({}, userJsdomConfig, defaultJsdomConfig));\n\n // Get all global browser properties\n Object.getOwnPropertyNames(window)\n\n // Remove protected properties\n .filter((prop) => !protectedProperties.includes(prop))\n\n // If we're only applying specific required properties remove everything else\n .filter((prop) => !(properties && properties.indexOf(prop) === -1))\n .filter((prop) => {\n switch (prop) {\n case 'undefined':\n return false;\n }\n return true;\n })\n\n // Copy what's left to the Node.js global scope\n .forEach((prop) => {\n // console.debug(`define globalThis.${prop}`);\n Object.defineProperty(globalThis, prop, {\n configurable: true,\n get: () => window[prop as keyof Window] as any,\n });\n });\n\n return window;\n }\n\n installEnv({ url: 'http://localhost' });\n return true;\n}\n"],"names":["polyfillJsDom","globalThis","getGlobalThis","ResourceLoader","JSDOM","Window","opts","proxy","strictSSL","userAgent","jsdomOpts","resources","defaultJsdomConfig","protectedProperties","prop","installEnv","args","properties","arg","userJsdomConfig","window"],"mappings":"mBAGA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsBA,GAAgB,CACpC,CAAA,CAAA,CAAI,OAAO,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACpB,MAAO,CAGT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAMC,EAAaC,CAAc,CAAA,CAAA,CAE3B,CAAE,CAAAC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAgB,CAAAC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAM,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,SAAa,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAItD,MAAMC,CAAO,CACX,YAAYC,CAA8D,CAAA,CAAI,CAAA,CAAA,CAC5E,CAAM,CAAA,CAAA,CAAA,CAAA,CAAE,MAAAC,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAAC,EAAW,CAAAC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA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A,CAAA,CAAA,CAAA,CAAA,CAAO,eAAeb,CAAYa,CAAAA,CAAAA,CAAM,CACtC,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACd,IAAK,CAAMM,CAAAA,CAAAA,CAAAA,CAAAA,CAAON,CAAoB,CACxC,CAAC,CACH,CAAC,CAEIM,CAAAA,CACT,CAEA,CAAAL,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAW,CAAE,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAmB,CAAC,CAAA,CAC/B,CACT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{g as u}from"../getGlobalThis-b7ad0cf9.js";function f(n){if("fetch"in globalThis)return!1;if(n){const{default:t,Response:i,Headers:e,Request:s,AbortError:o,FetchError:a,FormData:r,Blob:c,File:l}=n;return Object.assign(globalThis,{fetch:t,Response:i,Headers:e,Request:s,AbortError:o,FetchError:a,FormData:r,Blob:c,File:l}),!0}return import("node-fetch").then(t=>f(t))}function h({proxy:n,fetch:t}={}){const i=u();if(!n)return t||i.fetch;let e;const s=i.Request;let o,a;return async(r,c)=>{if(!e){const{default:l}=await import("https-proxy-agent");e=l(n)}return o||({Request:o,default:a}=await import("node-fetch")),t||=a,r instanceof s?t(new s(r,{agent:e})):r instanceof o?t(new o(r,{agent:e})):t(r,{...c,agent:e})}}export{h as createFetchWithProxyByNodeFetch,f as polyfillFetch};
|
|
2
|
-
//# sourceMappingURL=node-fetch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"node-fetch.js","sources":["../../../src/servers/polyfill/polyfillFetch.ts","../../../src/servers/fetch/createFetchWithProxyByNodeFetch.ts"],"sourcesContent":["import type { MaybePromise } from '../../asyncs/MaybePromise';\n\nexport function polyfillFetch(nodeFetch: typeof import('node-fetch')): boolean;\nexport function polyfillFetch(nodeFetch?: undefined): Promise<boolean>;\nexport function polyfillFetch(nodeFetch?: typeof import('node-fetch')): MaybePromise<boolean> {\n if ('fetch' in globalThis) {\n return false;\n }\n // sync mode\n if (nodeFetch) {\n const { default: fetch, Response, Headers, Request, AbortError, FetchError, FormData, Blob, File } = nodeFetch;\n Object.assign(globalThis, {\n fetch,\n Response,\n Headers,\n Request,\n AbortError,\n FetchError,\n FormData,\n Blob,\n File,\n });\n // abort controller\n return true;\n }\n return import('node-fetch').then((v) => polyfillFetch(v));\n}\n","import { type FetchLike } from '../../fetch';\nimport { getGlobalThis } from '../../isomorphics/getGlobalThis';\n\nexport function createFetchWithProxyByNodeFetch({\n proxy,\n fetch,\n}: { proxy?: string; fetch?: FetchLike } = {}): FetchLike {\n const globalThis = getGlobalThis();\n if (!proxy) {\n return fetch || globalThis.fetch;\n }\n\n let agent: any;\n const Request = globalThis.Request;\n let NodeRequest: any;\n let NodeFetch: any;\n return async (url, init?: RequestInit) => {\n if (!agent) {\n const { default: createHttpsProxyAgent } = await import('https-proxy-agent');\n agent = (createHttpsProxyAgent as any)(proxy);\n }\n\n // node-fetch 才可以,node v18 fetch 不支持\n if (!NodeRequest) {\n ({ Request: NodeRequest, default: NodeFetch } = await import('node-fetch'));\n }\n\n fetch ||= NodeFetch;\n\n if (url instanceof Request) {\n return (fetch as any)(new Request(url, { agent } as any));\n }\n if ((url as any) instanceof NodeRequest) {\n return (fetch as any)(new NodeRequest(url, { agent } as any));\n }\n return (fetch as any)(url, {\n ...init,\n agent,\n } as any);\n };\n}\n"],"names":["polyfillFetch","nodeFetch","fetch","Response","Headers","Request","AbortError","FetchError","FormData","Blob","File","v","createFetchWithProxyByNodeFetch","proxy","globalThis","getGlobalThis","agent","NodeRequest","NodeFetch","url","init","createHttpsProxyAgent"],"mappings":"iDAIO,SAASA,CAAcC,CAAAA,CAAAA,CAAgE,CAC5F,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CACb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,GAGT,CAAIA,CAAAA,CAAAA,CAAAA,CAAW,CACb,CAAM,CAAA,CAAA,CAAA,CAAA,CAAE,QAASC,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAAC,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAAC,EAAS,CAAAC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAS,WAAAC,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAAC,EAAY,CAAAC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAU,KAAAC,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAAC,CAAK,CAAIT,CAAAA,CAAAA,CACrG,OAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,WAAY,CACxB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAAC,CACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAAC,EACA,CAAAC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CACA,QAAAC,CACA,CAAA,CAAA,CAAA,CAAA,CAAA,CA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A,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;"}
|
package/dist/esm/servers/ws.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ws.js","sources":["../../../src/servers/polyfill/polyfillWebSocket.ts"],"sourcesContent":["import type { MaybePromise } from '../../asyncs/MaybePromise';\nimport { getGlobalThis } from '../../isomorphics/getGlobalThis';\n\nexport function polyfillWebSocket(ws: any): boolean;\nexport function polyfillWebSocket(ws?: undefined): Promise<boolean>;\nexport function polyfillWebSocket(ws?: any): MaybePromise<boolean> {\n const globalThis = getGlobalThis();\n if ('WebSocket' in globalThis) {\n return false;\n }\n if (ws) {\n const { WebSocket } = ws;\n Object.assign(globalThis, { WebSocket });\n }\n return import('ws').then((ws) => polyfillWebSocket(ws));\n}\n"],"names":["polyfillWebSocket","ws","globalThis","getGlobalThis","WebSocket"],"mappings":"0DAKgBA,CAAkBC,CAAAA,CAAAA,CAAiC,CACjE,CAAMC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAaC,EACnB,CAAA,CAAA,CAAA,CAAA,CAAI,cAAeD,CACjB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,GAET,CAAID,CAAAA,CAAAA,CAAAA,CAAI,CACN,CAAM,CAAA,CAAA,CAAA,CAAA,CAAE,UAAAG,CAAU,CAAA,CAAIH,EACtB,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAOC,EAAY,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAAE,CAAU,CAAC,CACzC,CACA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,IAAI,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAMH,GAAOD,CAAkBC,CAAAA,CAAE,CAAC,CACxD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
System.register([],function(e){"use strict";return{execute:function(){const t=e("g",()=>{if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global `this`")})}}});
|
|
2
|
-
//# sourceMappingURL=getGlobalThis-8951eb0e.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getGlobalThis-8951eb0e.js","sources":["../../src/isomorphics/getGlobalThis.ts"],"sourcesContent":["declare const global: typeof globalThis;\n\n/**\n * isomorphic globalThis\n *\n * globalThis supported by ff 65, Chrome 71, Node 12, babel\n *\n * non-standard globalThis supported for Alipay Miniprogram\n *\n * @see https://caniuse.com/#search=globalThis\n * @see https://v8.dev/features/globalthis\n */\nexport const getGlobalThis = (): typeof globalThis => {\n if (typeof globalThis !== 'undefined') return globalThis;\n if (typeof self !== 'undefined') return self;\n if (typeof window !== 'undefined') return window;\n if (typeof global !== 'undefined') return global as any;\n if (typeof this !== 'undefined') return this as any;\n throw new Error('Unable to locate global `this`');\n};\n"],"names":["getGlobalThis"],"mappings":"sEAYa,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,OAAgB,CAAyB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",V.g)}],execute:function(){$({arrayFromAsync:Ge,arrayOfMaybeArray:_e,camelCase:pe,classOf:k,clearAsyncInterval:it,copy:kt,createAsyncIterator:ct,createChildLogger:St,createFetchWith:Ie,createFetchWithLogging:cr,createFetchWithRetry:ur,createLazyPromise:Z,createLogger:Y,createNoopLogger:ye,createRandom:ir,createTranslate:Ct,createULID:Pe,deepEqual:L,download:Dt,dumpRequest:Ne,dumpResponse:Le,firstOfAsyncIterator:ut,firstOfMaybeArray:ae,formatBytes:Rt,get:W,getFileFromDataTransfer:Ft,getHttpStatusText:ke,hex:Xt,hmac:Kt,isBuffer:D,isClass:yt,isDefined:pt,isEmptyObject:mt,isIterator:ue,isModule:Et,isPlainObject:he,isPromise:N,isRetryableHttpStatus:mr,isTransferable:Tt,isULID:er,isUUID:At,lastOfMaybeArray:He,loadScripts:ve,loadStyles:qt,maybeFunction:wt,md5:Qt,memoize:bt,merge:T,ms:lr,nextOfAsyncIterator:K,objectOfMaybeArray:V,parseBoolean:gt,parseModuleId:Ot,parseObjectPath:G,parseTimestamp:vt,parseULID:nr,pascalCase:Ut,renderTemplate:me,set:We,setAsyncInterval:at,sha1:Gt,sha256:Wt,sha384:Jt,sha512:Zt,shallowClone:ht,shallowEqual:ft,timeout:lt});function V(e,t=null,r=ae){return Object.fromEntries(t===null?Object.entries(e).map(([n,o])=>[n,r(o)]):t.map(n=>[n,r(n)]))}function ae(e){return Array.isArray(e)?e[0]:e}function He(e){return Array.isArray(e)?e[e.length-1]:e}function _e(e){return Array.isArray(e)?e:e==null?[]:[e]}async function Ge(e){const t=[];for await(const r of e)t.push(r);return t}function G(e){if(typeof e!="string")return Array.isArray(e)?e:[e];const t=e.split(".");if(!e.includes("["))return t;const r=[];for(const n of t)if(!n.endsWith("]"))r.push(n);else{const o=n.split("[");for(let s of o)s.endsWith("]")&&(s=s.slice(0,-1)),r.push(s)}return r}function W(e,t,r){const n=G(t);let o=e;for(const s of n)o=o?o[s]:void 0;return o===void 0?r:o}function We(e,t,r,n=!0){const o=G(t);let s=0;const a=o.length;let h=e,y,p;for(;s<a&&(p=o[s++],!(p==="__proto__"||p==="constructor"||p==="prototype"));)h=h[p]=s===a?n?J(h[p],r):r:typeof(y=h[p])==typeof o?y:o[s]*0!==0||~(""+o[s]).indexOf(".")?{}:[]}function J(e,t){let r;if(typeof e=="object"&&typeof t=="object"){if(Array.isArray(e)&&Array.isArray(t))for(r=0;r<t.length;r++)e[r]=J(e[r],t[r]);else for(r in t){if(r==="__proto__"||r==="constructor"||r==="prototype")break;e[r]=J(e[r],t[r])}return e}return t}function Je(e){return Ze(e)&&!Ke(e)}function Ze(e){return!!e&&typeof e=="object"}function Ke(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||Xe(e)}var Ye=typeof Symbol=="function"&&Symbol.for,Qe=Ye?Symbol.for("react.element"):60103;function Xe(e){return e.$$typeof===Qe}function et(e){return Array.isArray(e)?[]:{}}function I(e,t){return t.clone!==!1&&t.isMergeableObject(e)?T(et(e),e,t):e}function tt(e,t,r){return e.concat(t).map(function(n){return I(n,r)})}function rt(e,t){if(!t.customMerge)return T;var r=t.customMerge(e);return typeof r=="function"?r:T}function nt(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function ie(e){return Object.keys(e).concat(nt(e))}function ce(e,t){try{return t in e}catch{return!1}}function ot(e,t){return ce(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function st(e,t,r){const n={};return r.isMergeableObject(e)&&ie(e).forEach(o=>{n[o]=I(e[o],r)}),ie(t).forEach(o=>{ot(e,o)||(ce(e,o)&&r.isMergeableObject(t[o])?n[o]=rt(o,r)(e[o],t[o],r):n[o]=I(t[o],r))}),n}function T(e,t,r){const n={arrayMerge:tt,isMergeableObject:Je,...r,cloneUnlessOtherwiseSpecified:I};let o=Array.isArray(t),s=Array.isArray(e);return o===s?o?n.arrayMerge(e,t,n):st(e,t,n):I(t,n)}T.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(r,n){return T(r,n,t)},{})};function N(e){return e&&(e instanceof Promise||e.then&&e.catch)}function Z(e){const t={resolve(n){throw new Error("pending resolve")},reject(n){throw new Error("pending reject")}},r=Object.assign(new Promise((n,o)=>{t.reject=o,t.resolve=n}),{resolve(n){t.resolve(n)},reject(n){t.resolve(n)}});if(e){const n=t.resolve;let o=!0;t.resolve=h=>{o=!1,n(h)};const s=r.then.bind(r);r.then=(...h)=>{if(o){o=!1;try{const y=e(t.resolve,t.reject);N(y)?y.then(t.resolve,t.reject):y!==void 0&&t.resolve(y)}catch(y){t.reject(y)}}return s(...h)};const a=t;return a.then=r.then,a.catch=r.catch.bind(r),r.finally&&(a.finally=r.finally),Object.defineProperty(a,Symbol.species,{get(){return Promise}}),a}return r}function at(e,t,r=t){let n;const o=async()=>{await e(),n=setTimeout(o,t)};return n=setTimeout(o,r),()=>n}function it(e){clearTimeout(e==null?void 0:e())}function ct(e){const t=[];let r;{let n;t.push(n=Z()),r=(o,s)=>{if(s!==void 0)n.resolve([void 0,!0,s]);else if(o!==void 0)n.resolve(o);else return;t.push(n=Z())}}return e(r),async function*(){let n,o;for(let s=0,a=!1;!a;s++){let h=await t[s];if(delete t[s],[n,a,o]=h,o)throw o;n!==void 0&&(yield n)}}()}function ue(e){return typeof(e==null?void 0:e.next)=="function"}function K(e){if(N(e))return e.then(t=>K(t));if(ue(e)){let t=e.next();return N(t)?t.then(r=>[r.value,r.done]):[t.value,t.done]}return[e]}function ut(e){const t=K(e);return N(t)?t.then(r=>r[0]):t[0]}const wr=$("sleep",e=>new Promise(t=>setTimeout(t,e)));function lt(e,t){const r=new le;let n;return Promise.race([e,new Promise((o,s)=>{n=setTimeout(()=>{s(r)},t)})]).then(o=>(clearTimeout(n),o),o=>{throw clearTimeout(n),o})}class le extends Error{constructor(){super("TimeoutError")}}$("TimeoutError",le);function ft(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let n=0;n<r.length;n++)if(!Object.prototype.hasOwnProperty.call(t,r[n])||!Object.is(e[r[n]],t[r[n]]))return!1;return!0}const fe=Object.prototype.hasOwnProperty,dt=typeof Element<"u";function de(e,t,r){for(r of e.keys())if(L(r,t))return r}function L(e,t){let r,n,o;if(e===t)return!0;if(e&&t&&(r=e.constructor)===t.constructor){if(r===Date)return e.getTime()===t.getTime();if(r===RegExp)return e.toString()===t.toString();if(r===Array){if((n=e.length)===t.length)for(;n--&&L(e[n],t[n]););return n===-1}if(r===Set){if(e.size!==t.size)return!1;for(n of e)if(o=n,o&&typeof o=="object"&&(o=de(t,o),!o)||!t.has(o))return!1;return!0}if(r===Map){if(e.size!==t.size)return!1;for(n of e)if(o=n[0],o&&typeof o=="object"&&(o=de(t,o),!o)||!L(n[1],t.get(o)))return!1;return!0}if(r===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(r===DataView){if((n=e.byteLength)===t.byteLength)for(;n--&&e.getInt8(n)===t.getInt8(n););return n===-1}if(ArrayBuffer.isView(e)){if((n=e.byteLength)===t.byteLength)for(;n--&&e[n]===t[n];);return n===-1}if(dt&&e instanceof Element)return!1;if(!r||typeof e=="object"){n=0;for(r in e)if(!((r==="_owner"||r==="__v"||r==="__o")&&e.$$typeof)&&(fe.call(e,r)&&++n&&!fe.call(t,r)||!(r in t)||!L(e[r],t[r])))return!1;return Object.keys(t).length===n}}return e!==e&&t!==t}function k(e){return Object.prototype.toString.call(e).slice(8,-1)}function ht(e){return e&&(Array.isArray(e)?e.slice():typeof e=="object"?Object.assign({},e):e)}function yt(e){return typeof e=="function"&&/^class\s/.test(Function.prototype.toString.call(e))}function pt(e){return e!=null}function he(e){return k(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function mt(e){return he(e)&&Object.keys(e).length===0}function gt(e,t=!1){if(typeof e=="boolean")return e;if(typeof e=="string")switch(e.toLowerCase()){case"f":case"false":case"0":return!1;case"1":case"t":case"true":return!0}else if(typeof e=="number")switch(e){case 0:return!1;case 1:return!0}if(!t)return!!e}function wt(e,...t){return e instanceof Function?e(...t):e}function bt(e,{resolver:t=(...r)=>JSON.stringify(r)}={}){if(typeof e!="function")throw new Error("`callback` should be a function");if(t!==void 0&&typeof t!="function")throw new Error("`resolver` should be a function");const r={},n=function(){const o=Array.prototype.slice.call(arguments),s=t.apply(this,o);return s in r||(r[s]=e.apply(this,o)),r[s]};return n.cache=r,n}function At(e){return!!e&&/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(String(e))}function vt(e){if(e){if(e instanceof Date)return e;if(typeof e=="string"&&/^[0-9.]+$/.test(e)){let t=parseFloat(e);return Math.floor(t).toString().length<=11&&(t*=1e3),new Date(t)}else if(typeof e=="string"){const t=new Date(e);if(!isNaN(+t))return t}throw new Error(`parseTimestamp: invalid "${e}"`)}}const $t=/^(?<n>(?:@(?<org>[a-z0-9-~][a-z0-9-._~]*)\/)?(?<pkg>[a-z0-9-~][a-z0-9-._~]*))(?:@(?<v>[-a-z0-9><=_.^~]+))?(?<p>\/[^\r\n]*)?$/;function Ot(e){var t;const r=(t=e.match($t))==null?void 0:t.groups;if(!r)return;const{n,v:o,p:s,org:a,pkg:h}=r,y=!!a,p=/^\d+\.\d+\.\d+/.test(o)?o:void 0,g=o||"latest",f={id:`${n}@${g}`,name:n,range:g,scoped:y,pkg:h,org:a,versioned:!!o};return p&&(f.version=p),s&&(f.path=s),f.scoped||delete f.org,f}function Et(e){return e&&e[Symbol.toStringTag]==="Module"}function Y(e=({level:r,values:n,...o})=>{var s;({values:n,...o}=jt(o,n)),(s=console[r])==null||s.call(console,...n,o)},t={}){return{trace:(...r)=>{e({...t,level:"trace",values:r})},debug:(...r)=>{e({...t,level:"debug",values:r})},info:(...r)=>{e({...t,level:"info",values:r})},warn:(...r)=>{e({...t,level:"warn",values:r})},error:(...r)=>{e({...t,level:"error",values:r})},child:r=>Y(e,{...t,...r})}}function jt(e,t){return t[0]&&typeof t[0]=="object"?{...e,...t[0],values:t.slice(1)}:{...e,values:t}}function ye(){const e=(...t)=>{};return{trace:e,debug:e,info:e,warn:e,error:e,child:()=>ye()}}function St(e,t){return e.child?e.child(t):Y(r=>{const{level:n,values:o,...s}=r;Object.keys(s).length?e[n](s,...o):e[n](...o)},t)}function xt(e){let t=!1,r=!1,n=!1;for(let o=0;o<e.length;o++){const s=e[o];t&&/[a-zA-Z]/.test(s)&&s.toUpperCase()===s?(e=e.slice(0,o)+"-"+e.slice(o),t=!1,n=r,r=!0,o++):r&&n&&/[a-zA-Z]/.test(s)&&s.toLowerCase()===s?(e=e.slice(0,o-1)+"-"+e.slice(o-1),n=r,r=!1,t=!0):(t=s.toLowerCase()===s&&s.toUpperCase()!==s,n=r,r=s.toUpperCase()===s&&s.toLowerCase()!==s)}return e}function Ut(e){return pe(e,{pascalCase:!0})}function pe(e,t={pascalCase:!1}){if(!(typeof e=="string"||Array.isArray(e)))throw new TypeError("Expected the input to be `string | string[]`");const r=n=>t.pascalCase?n.charAt(0).toUpperCase()+n.slice(1):n;return Array.isArray(e)?e=e.map(n=>n.trim()).filter(n=>n.length).join("-"):e=e.trim(),e.length===0?"":e.length===1?t.pascalCase?e.toUpperCase():e.toLowerCase():(e!==e.toLowerCase()&&(e=xt(e)),e=e.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(n,o)=>o.toUpperCase()).replace(/\d+(\w|$)/g,n=>n.toUpperCase()),r(e))}function me(e,t,r="js"){let n;return t?typeof t=="function"?n=t:n=o=>W(t,o):n=()=>"",typeof r=="string"&&(r=ge[r]||ge.js),e.replace(r,(o,s)=>n(s.trim()))}const ge={js:/\${(.*?)}/g,common:/{{(.*?)}}/g};function Rt(e,t=!1,r=1){const n=t?1e3:1024;if(Math.abs(e)<n)return`${e} B`;const o=t?["kB","MB","GB","TB","PB","EB","ZB","YB"]:["KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"];let s=-1;const a=10**r;do e/=n,++s;while(Math.round(Math.abs(e)*a)/a>=n&&s<o.length-1);return e.toFixed(r)+" "+o[s]}function Ct(e){let t="";const r=e||{},n=o=>{if(Array.isArray(o))return o;const s=o.split(/[_-]/);return s.length>1?[o,s[0]]:[o]};return{locale(o){return t=o||t},dict:(o,s)=>{if(s){r[o]=Object.assign(r[o]||{},s);return}return r[o]},t(o,s,a){let h;for(const y of n(a||t))if(h=W(r[y],o,""),h)break;return typeof h=="function"?h(s):typeof h=="string"?me(h,s,"common"):h}}}function D(e){var t,r;return(r=(t=e==null?void 0:e.constructor)==null?void 0:t.isBuffer)==null?void 0:r.call(t,e)}const we=j();function Tt(e){return be||=Bt(),be.some(t=>e instanceof t)}let be;function Bt(){const e=we.window||we||global;return[e.ArrayBuffer,e.MessagePort,e.ReadableStream,e.WritableStream,e.TransformStream,e.AudioData,e.ImageBitmap,e.VideoFrame,e.OffscreenCanvas,e.RTCDataChannel].filter(Boolean)}const B="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",q=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<B.length;e++)q[B.charCodeAt(e)]=e;function Mt(e){const t=new Uint8Array(e),r=t.length;let n="";for(let o=0;o<r;o+=3)n+=B[t[o]>>2],n+=B[(t[o]&3)<<4|t[o+1]>>4],n+=B[(t[o+1]&15)<<2|t[o+2]>>6],n+=B[t[o+2]&63];return r%3===2?n=n.substring(0,n.length-1)+"=":r%3===1&&(n=n.substring(0,n.length-2)+"=="),n}function Pt(e){const t=e.length;let r=e.length*.75,n,o=0,s,a,h,y;e[e.length-1]==="="&&(r--,e[e.length-2]==="="&&r--);const p=new ArrayBuffer(r),g=new Uint8Array(p);for(n=0;n<t;n+=4)s=q[e.charCodeAt(n)],a=q[e.charCodeAt(n+1)],h=q[e.charCodeAt(n+2)],y=q[e.charCodeAt(n+3)],g[o++]=s<<2|a>>4,g[o++]=(a&15)<<4|h>>2,g[o++]=(h&3)<<6|y&63;return p}class b{static#e=!0;static#t;static isNativeBufferAvailable(){var t,r;return this.#t??=!((r=(t=j().Buffer)==null?void 0:t.isPollyfill)!=null&&r.call(t))}static isNativeBufferAllowed(){return this.#e&&this.#t}static setNativeBufferAllowed(t){this.#e=t}static isArrayBuffer=t=>t instanceof ArrayBuffer;static slice=(t,r,n)=>D(t)?Uint8Array.prototype.slice.call(t,r,n):t.slice(r,n);static asView=(t,r,n,o)=>r instanceof t&&(n??0)===0&&o===void 0?r:ArrayBuffer.isView(r)||D(r)?b.isNativeBufferAllowed()&&t===Buffer?Buffer.from(r.buffer,n,o):new t(r.buffer,r.byteOffset+(n??0),o??r.byteLength):new t(r,n,o);static toString=(t,r="utf8")=>{if(typeof t=="string")switch(r){case"base64":return btoa(t);case"utf-8":case"utf8":return t;default:throw new Error(`[ArrayBuffers.toString] Unsupported encoding for string: ${r}`)}if(b.isNativeBufferAllowed())return Buffer.from(b.asView(Uint8Array,t)).toString(r);switch(r){case"hex":return[...b.asView(Uint8Array,t)].map(n=>It[n]).join("");case"base64":return Mt(b.asView(Uint8Array,t));case"utf8":case"utf-8":return new TextDecoder().decode(t);case"ascii":{const n=b.asView(Uint8Array,t);return String.fromCharCode(...n.map(o=>o&127))}case"latin1":case"binary":{const n=b.asView(Uint8Array,t);return String.fromCharCode(...n)}case"ucs2":case"ucs-2":case"utf16le":{const n=b.asView(Uint8Array,t);let o="";for(let s=0;s<n.length-1;s+=2)o+=String.fromCharCode(n[s]+n[s+1]*256);return o}default:throw new Error(`[ArrayBuffers.toString] Unknown encoding: ${r}`)}};static toJSON=(t,r)=>JSON.parse(b.toString(t),r);static alloc=(t,r,n)=>r!==void 0?typeof r=="number"?new Uint8Array(t).fill(r):b.asView(Uint8Array,b.from(r,n)).slice(0,t):new ArrayBuffer(t);static from=(t,r="utf8")=>{if(!t)return new ArrayBuffer(0);if(typeof t=="string"){if(b.isNativeBufferAllowed())return Buffer.from(t,r);switch(r){case"utf-8":case"utf8":return new TextEncoder().encode(t).buffer;case"base64":return Pt(t.replace(/[^0-9a-zA-Z=+/_]/g,""));default:throw new Error(`[ArrayBuffers.from] Unknown encoding: ${r}`)}}if(t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t)||D(t)){if(t.byteOffset!==0)throw new Error("ArrayBuffers.from do not support view with offset");return t.buffer}if(Array.isArray(t))return new Uint8Array(t);const n=k(t);throw new TypeError(`ArrayBuffers.from unsupported type ${n}`)};static isEncoding=t=>{switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":return!0;default:return!1}};static concat=(t,r,n=0)=>{const o=t.reduce((a,h)=>a+h.byteLength,0),s=r?new Uint8Array(r):new Uint8Array(o);for(const a of t){if(!(a!=null&&a.byteLength))continue;let h;if(a instanceof ArrayBuffer)h=new Uint8Array(a);else if(ArrayBuffer.isView(a))h=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);else throw new Error(`ArrayBuffers.concat unsupported type ${k(a)}`);s.set(h,n),n+=a.byteLength}return s.buffer}}$("ArrayBuffers",b);const It=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=r*16;for(let o=0;o<16;++o)t[n+o]=e[r]+e[o]}return t}();let Nt=class se extends Uint8Array{static get isPolyfill(){return!0}static isBuffer(t){return t instanceof se||D(t)}static from(t,r){return new se(b.from(t,r))}static isEncoding=b.isEncoding;toString(t){return b.toString(this,t)}};$("Buffer",Nt);let Q;function Lt(){let e;function t(){return navigator.userAgent.match(/ipad|iphone/i)}function r(s){e=document.createElement("textArea"),e.value=s,document.body.appendChild(e)}function n(){let s,a;if(t()){if(s=document.createRange(),s.selectNodeContents(e),a=window.getSelection(),a===null){console.error("no selection");return}a.removeAllRanges(),a.addRange(s),e.setSelectionRange(0,999999)}else e.select()}function o(){document.execCommand("copy"),document.body.removeChild(e)}Q=s=>{r(s),n(),o()}}function kt(e){var t,r;return(r=(t=window.navigator)==null?void 0:t.clipboard)!=null&&r.writeText?window.navigator.clipboard.writeText(e):(Q||Lt(),Q(e))}function Dt(e,t,{type:r="application/octet-stream",raw:n=!1}={}){const o=document.createElement("a");let s=()=>null;try{if(o.download=e,typeof t=="string"&&/^(https?:|data:)/.test(t)&&!n?o.href=t:typeof t=="string"&&(t=new TextEncoder().encode(t)),t instanceof Uint8Array&&(t=new Blob([t],{type:r})),t instanceof File||t instanceof Blob||t instanceof MediaSource)o.href=URL.createObjectURL(t),s=()=>{URL.revokeObjectURL(o.href)};else throw console.error("invalid download data",t),new Error(`can not download ${Object.getPrototypeOf(t)}`);o.click()}finally{s()}}function Ae(e,t,r,n){e.onload=()=>{t(e)},e.onerror=s=>{e.remove(),r(s)};const{attributes:o={}}=n||{};Object.entries(o).forEach(([s,a])=>{e.setAttribute(s,a)}),document.head.appendChild(e)}function ve(e,t){if(Array.isArray(e))return Promise.resolve().then(async()=>{const n=[];for(const o of e)n.push(await ve(o));return n});const r=document.querySelector(`script[src="${e}"]`);return r?Promise.resolve(r):new Promise((n,o)=>{const s=document.createElement("script");s.src=e,Ae(s,n,o,t)})}function qt(e,t){const r=document.querySelector(`link[href="${e}"]`);return r?Promise.resolve(r):new Promise((n,o)=>{const s=document.createElement("link");s.rel="stylesheet",s.href=e,Ae(s,n,o,t)})}function Ft(e){var t;if(!e)return{};const r=e.items??[];if(r.length>=2&&r[0].kind==="string"&&r[1].kind==="file"){const n=e.getData("text"),o=r[1].getAsFile()??((t=e.files)==null?void 0:t.item(0));return o?{file:o,name:n}:(console.error(`no file ${n}`,r[1]),{})}else if(r[0].kind==="file"){const n=r[0].getAsFile();return n?{file:n,name:n.name}:(console.error("no file",r[0]),{})}else console.debug("file item not match",Array.from(r).map(n=>({type:n.type,kind:n.kind})));return{}}const Vt=j(),br=$("structuredClone",Vt.structuredClone||M);function $e(e,t,r){typeof r.value=="object"&&(r.value=M(r.value)),!r.enumerable||r.get||r.set||!r.configurable||!r.writable||t==="__proto__"?Object.defineProperty(e,t,r):e[t]=r.value}function M(e){if(typeof e!="object")return e;let t=0,r,n,o;const s=k(e);switch(s){case"Array":o=Array(e.length);break;case"Object":o=Object.create(e.__proto__||null);break;case"Set":o=new Set,e.forEach(function(a){o.add(M(a))});break;case"Map":o=new Map,e.forEach(function(a,h){o.set(M(h),M(a))});break;case"Date":o=new Date(+e);break;case"RegExp":o=new RegExp(e.source,e.flags);break;case"DataView":o=new e.constructor(M(e.buffer));break;case"ArrayBuffer":o=e.slice(0);break;default:s.endsWith("Array")&&(o=new e.constructor(e))}if(o){for(n=Object.getOwnPropertySymbols(e);t<n.length;t++)$e(o,n[t],Object.getOwnPropertyDescriptor(e,n[t]));for(t=0,n=Object.getOwnPropertyNames(e);t<n.length;t++)Object.hasOwnProperty.call(o,r=n[t])&&o[r]===e[r]||$e(o,r,Object.getOwnPropertyDescriptor(e,r))}return o||e}var Oe,Ee;const je=j(),Ar=$("randomUUID",((Ee=(Oe=je.crypto)==null?void 0:Oe.randomUUID)==null?void 0:Ee.bind(je.crypto))||zt);function zt(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}let X;if(typeof window>"u")try{typeof require>"u"?ze.import("crypto").then(e=>X=e.default):X=require("crypto")}catch{}function Ht(){return X}var Se,xe,Ue,Re;const z=j();let Ce=$("getRandomValues",((xe=(Se=z.crypto)==null?void 0:Se.getRandomValues)==null?void 0:xe.bind(z.crypto))||((Re=(Ue=z.msCrypto)==null?void 0:Ue.getRandomValues)==null?void 0:Re.bind(z.msCrypto))||_t);function _t(e){var t,r,n;const o=Ht();if((t=o==null?void 0:o.webcrypto)!=null&&t.getRandomValues)return $("getRandomValues",Ce=(n=(r=o==null?void 0:o.webcrypto)==null?void 0:r.getRandomValues)==null?void 0:n.bind(o==null?void 0:o.webcrypto)),o.webcrypto.getRandomValues(e);if(o!=null&&o.randomBytes){if(!(e instanceof Uint8Array))throw new TypeError("expected Uint8Array");if(e.length>65536){const a=new Error;throw a.code=22,a.message=`Failed to execute 'getRandomValues' on 'Crypto': The ArrayBufferView's byte length (${e.length}) exceeds the number of bytes of entropy available via this API (65536).`,a.name="QuotaExceededError",a}const s=o.randomBytes(e.length);return e.set(s),e}throw new Error("[getRandomValues]: No secure random number generator available.")}function Gt(e,t){return H("SHA-1",e,t)}function Wt(e,t){return H("SHA-256",e,t)}function Jt(e,t){return H("SHA-384",e,t)}function Zt(e,t){return H("SHA-512",e,t)}function H(e,t,r){let n=crypto.subtle.digest(e,ee(t));return r?n.then(o=>Te(o,r)):n}function ee(e){return typeof e=="string"?new TextEncoder().encode(e):e}function Te(e,t){if(t)switch(t){case"hex":case"base64":return b.toString(e,t)}return e}async function Kt(e,t,r,n){let o=t instanceof CryptoKey?t:await crypto.subtle.importKey("raw",ee(t),{name:"HMAC",hash:{name:Yt(e)}},!1,["sign"]),s=await crypto.subtle.sign({name:"HMAC",hash:{name:e}},o,ee(r));return Te(s,n)}function Yt(e){return e.replace(/^sha/i,"SHA-")}function Qt(e){var t="0123456789abcdef";function r(w){var m,A="";for(m=0;m<=3;m++)A+=t.charAt(w>>m*8+4&15)+t.charAt(w>>m*8&15);return A}function n(w,m){var A=(w&65535)+(m&65535),v=(w>>16)+(m>>16)+(A>>16);return v<<16|A&65535}function o(w,m){return w<<m|w>>>32-m}function s(w,m,A,v,O,E){return n(o(n(n(m,w),n(v,E)),O),A)}function a(w,m,A,v,O,E,C){return s(m&A|~m&v,w,m,O,E,C)}function h(w,m,A,v,O,E,C){return s(m&v|A&~v,w,m,O,E,C)}function y(w,m,A,v,O,E,C){return s(m^A^v,w,m,O,E,C)}function p(w,m,A,v,O,E,C){return s(A^(m|~v),w,m,O,E,C)}function g(w){var m,A=(w.length+8>>6)+1,v=new Array(A*16);for(m=0;m<A*16;m++)v[m]=0;for(m=0;m<w.length;m++)v[m>>2]|=w.charCodeAt(m)<<m%4*8;return v[m>>2]|=128<<m%4*8,v[A*16-2]=w.length*8,v}var f,d=g(""+e),i=1732584193,c=-271733879,u=-1732584194,l=271733878,De,qe,Fe,Ve;for(f=0;f<d.length;f+=16)De=i,qe=c,Fe=u,Ve=l,i=a(i,c,u,l,d[f+0],7,-680876936),l=a(l,i,c,u,d[f+1],12,-389564586),u=a(u,l,i,c,d[f+2],17,606105819),c=a(c,u,l,i,d[f+3],22,-1044525330),i=a(i,c,u,l,d[f+4],7,-176418897),l=a(l,i,c,u,d[f+5],12,1200080426),u=a(u,l,i,c,d[f+6],17,-1473231341),c=a(c,u,l,i,d[f+7],22,-45705983),i=a(i,c,u,l,d[f+8],7,1770035416),l=a(l,i,c,u,d[f+9],12,-1958414417),u=a(u,l,i,c,d[f+10],17,-42063),c=a(c,u,l,i,d[f+11],22,-1990404162),i=a(i,c,u,l,d[f+12],7,1804603682),l=a(l,i,c,u,d[f+13],12,-40341101),u=a(u,l,i,c,d[f+14],17,-1502002290),c=a(c,u,l,i,d[f+15],22,1236535329),i=h(i,c,u,l,d[f+1],5,-165796510),l=h(l,i,c,u,d[f+6],9,-1069501632),u=h(u,l,i,c,d[f+11],14,643717713),c=h(c,u,l,i,d[f+0],20,-373897302),i=h(i,c,u,l,d[f+5],5,-701558691),l=h(l,i,c,u,d[f+10],9,38016083),u=h(u,l,i,c,d[f+15],14,-660478335),c=h(c,u,l,i,d[f+4],20,-405537848),i=h(i,c,u,l,d[f+9],5,568446438),l=h(l,i,c,u,d[f+14],9,-1019803690),u=h(u,l,i,c,d[f+3],14,-187363961),c=h(c,u,l,i,d[f+8],20,1163531501),i=h(i,c,u,l,d[f+13],5,-1444681467),l=h(l,i,c,u,d[f+2],9,-51403784),u=h(u,l,i,c,d[f+7],14,1735328473),c=h(c,u,l,i,d[f+12],20,-1926607734),i=y(i,c,u,l,d[f+5],4,-378558),l=y(l,i,c,u,d[f+8],11,-2022574463),u=y(u,l,i,c,d[f+11],16,1839030562),c=y(c,u,l,i,d[f+14],23,-35309556),i=y(i,c,u,l,d[f+1],4,-1530992060),l=y(l,i,c,u,d[f+4],11,1272893353),u=y(u,l,i,c,d[f+7],16,-155497632),c=y(c,u,l,i,d[f+10],23,-1094730640),i=y(i,c,u,l,d[f+13],4,681279174),l=y(l,i,c,u,d[f+0],11,-358537222),u=y(u,l,i,c,d[f+3],16,-722521979),c=y(c,u,l,i,d[f+6],23,76029189),i=y(i,c,u,l,d[f+9],4,-640364487),l=y(l,i,c,u,d[f+12],11,-421815835),u=y(u,l,i,c,d[f+15],16,530742520),c=y(c,u,l,i,d[f+2],23,-995338651),i=p(i,c,u,l,d[f+0],6,-198630844),l=p(l,i,c,u,d[f+7],10,1126891415),u=p(u,l,i,c,d[f+14],15,-1416354905),c=p(c,u,l,i,d[f+5],21,-57434055),i=p(i,c,u,l,d[f+12],6,1700485571),l=p(l,i,c,u,d[f+3],10,-1894986606),u=p(u,l,i,c,d[f+10],15,-1051523),c=p(c,u,l,i,d[f+1],21,-2054922799),i=p(i,c,u,l,d[f+8],6,1873313359),l=p(l,i,c,u,d[f+15],10,-30611744),u=p(u,l,i,c,d[f+6],15,-1560198380),c=p(c,u,l,i,d[f+13],21,1309151649),i=p(i,c,u,l,d[f+4],6,-145523070),l=p(l,i,c,u,d[f+11],10,-1120210379),u=p(u,l,i,c,d[f+2],15,718787259),c=p(c,u,l,i,d[f+9],21,-343485551),i=n(i,De),c=n(c,qe),u=n(u,Fe),l=n(l,Ve);return r(i)+r(c)+r(u)+r(l)}function Xt(e){return Array.from(new Uint8Array(e)).map(t=>t.toString(16).padStart(2,"0")).join("")}function S(e){const t=new Error(e);return t.source="ulid",t}const x="0123456789ABCDEFGHJKMNPQRSTVWXYZ",U=x.length,te=Math.pow(2,48)-1,P=10,re=16;function er(e){return e?e.length===26&&/^[0-9A-HJKMNP-TV-Z]{26}$/i.test(e):!1}function Be(e,t,r){return t>e.length-1?e:e.substr(0,t)+r+e.substr(t+1)}function tr(e){let t,r=e.length,n,o;const s=U-1;for(;!t&&r-->=0;){if(n=e[r],o=x.indexOf(n),o===-1)throw S("incorrectly encoded string");if(o===s){e=Be(e,r,x[0]);continue}t=Be(e,r,x[o+1])}if(typeof t=="string")return t;throw S("cannot increment this string")}function rr(e){let t=Math.floor(e()*U);return t===U&&(t=U-1),x.charAt(t)}function ne(e,t){if(isNaN(e))throw new Error(`${e} must be a number`);if(e>te)throw S(`cannot encode time greater than ${te}`);if(e<0)throw S("time must be positive");if(!Number.isInteger(e))throw S("time must be an integer");let r,n="";for(;t>0;t--)r=e%U,n=x.charAt(r)+n,e=(e-r)/U;return n}function Me(e,t){let r="";for(;e>0;e--)r=rr(t)+r;return r}function nr(e){if(e.length!==P+re)throw S("malformed ulid");const t=e.substr(0,P).split("").reverse().reduce((r,n,o)=>{const s=x.indexOf(n);if(s===-1)throw S("invalid character found: "+n);return r+=s*Math.pow(U,o)},0);if(t>te)throw S("malformed ulid, timestamp too large");return{timestamp:t,random:e.substring(P)}}function or(){return()=>{const e=new Uint8Array(1);return Ce(e),e[0]/255}}function Pe({monotonic:e=!0,random:t=or(),now:r=Date.now}={}){if(!e)return function(s){return s||=r(),ne(s,P)+Me(re,t)};let n=0,o;return function(s){if(s||=r(),s<=n&&o){const h=o=tr(o);return ne(n,P)+h}n=s;const a=o=Me(re,t);return ne(s,P)+a}}let sr=$("ulid",(...e)=>F?F(...e):(F=Pe(),$("ulid",sr=F),F(...e))),F;class ar{static decode(t){const r=t.match(/^-----BEGIN (?<type>[^\r\n-]+)-----$\r?\n(?<headers>(^[^:\r\n]+:[^\n\r]+\r?\n)+\r?\n)?(?<data>[a-zA-Z0-9/_=\n\r+]+?)^-----END \1-----$\r?\n?/ms);if(!(r!=null&&r.groups))throw new Error("Invalid PEM data");const{type:n,headers:o="",data:s}=r.groups,a=o.split(`
|
|
2
|
-
`).filter(h=>h.trim()).map(h=>{const[y,...p]=h.split(":");return[y.trim(),p.join(":").trim()]}).reduce((h,[y,p])=>({...h,[y]:p}),{});return{block:{type:n,header:a,bytes:b.from(s.replace(/[\r\n]/g,""),"base64")},head:t.slice(0,r.index||0),tail:t.slice((r.index||0)+r[0].length)}}static encode(t){var r;const{type:n,header:o,bytes:s}=t,a=Object.entries(o||{}).map(([h,y])=>`${h}: ${y}`).join(`
|
|
3
|
-
`);return`-----BEGIN ${n}-----
|
|
4
|
-
${a}${a.length?`
|
|
5
|
-
|
|
6
|
-
`:""}${((r=b.toString(s,"base64").match(/.{1,64}/g))==null?void 0:r.join(`
|
|
7
|
-
`))||""}
|
|
8
|
-
-----END ${n}-----
|
|
9
|
-
`}}$("PEM",ar);function ir(e={}){let t=typeof e.seed=="string"?0:e.seed??0;if(typeof e.seed=="string"){let r=0;for(let n=0;n<e.seed.length;n++)r+=e.seed.charCodeAt(n);t=r}return()=>{const r=Math.sin(t++)*1e4;return r-Math.floor(r)}}function Ie({fetch:e=j().fetch,onRequest:t=n=>n.next(n.url,n.req),onResponse:r=n=>n.res}){return async(n,o)=>{const s=String(n);let a=o||{};const h=a.fetch||e,y=await t({url:s,req:a,next:(p,g)=>(a=g,h(p,g))})??await h(s,o);return r({url:s,req:a,res:y})}}function Ne({url:e,req:t={},log:r=console.log}){const{method:n="GET"}=t;let o=`-> ${n} ${e}
|
|
10
|
-
${Array.from(new Headers(t.headers).entries()).map(([a,h])=>`${a}: ${h}`).join(`
|
|
11
|
-
`)}
|
|
12
|
-
`,s;if(t.body){if(new Headers(t.headers).get("content-type")!=="application/octet-stream")if(t.body instanceof ReadableStream){const[a,h]=t.body.tee();t.body=a;const y=t.signal;s=Promise.resolve().then(async()=>{const p=h.getReader();for(r(o);!(y!=null&&y.aborted);){let{done:g,value:f}=await p.read();if(f instanceof Uint8Array&&(f=new TextDecoder().decode(f)),o+=f,r(f),!g)break}return o+=`
|
|
13
|
-
`,o})}else o+=`
|
|
14
|
-
${t.body}
|
|
15
|
-
`;r(o)}return s||Promise.resolve(o)}async function Le({res:e,url:t,req:r,log:n=console.log}){let o=`<- ${e.status} ${e.statusText} ${r.method} ${t}
|
|
16
|
-
${Array.from(e.headers.entries()).map(([a,h])=>`${a}: ${h}`).join(`
|
|
17
|
-
`)}
|
|
18
|
-
`,s=e.headers.get("content-type");if(s!=null&&s.includes("application/json")||s!=null&&s.includes("text/plain")){const a=await e.text();o+=`
|
|
19
|
-
${a}
|
|
20
|
-
`,e=new Response(a,e)}return n(o),e}function cr({fetch:e,log:t=console.log}={}){return Ie({fetch:e,onRequest:({url:r,req:n})=>{Ne({url:r,req:n,log:t})},onResponse:({url:r,req:n,res:o})=>Le({url:r,req:n,res:o,log:t})})}function ur({fetch:e=j().fetch,retries:t=3,retryDelay:r=1e3,retryOn:n=[]}={}){return function(o,s){return new Promise(function(a,h){var y=function(g){var f=typeof Request<"u"&&o instanceof Request?o.clone():o;e(f,s).then(function(d){if(Array.isArray(n)&&n.indexOf(d.status)===-1)a(d);else if(typeof n=="function")try{return Promise.resolve(n(g,null,d)).then(function(i){i?p(g,null,d):a(d)}).catch(h)}catch(i){h(i)}else g<t?p(g,null,d):a(d)}).catch(function(d){if(typeof n=="function")try{Promise.resolve(n(g,d,null)).then(function(i){i?p(g,d,null):h(d)}).catch(function(i){h(i)})}catch(i){h(i)}else g<t?p(g,d,null):h(d)})};function p(g,f,d){let i=typeof r=="function"?r(g,f,d):r;setTimeout(function(){y(++g)},i)}y(0)})}}function lr(e,t){try{if(typeof e=="string"&&e.length>0)return fr(e);if(typeof e=="number"&&isFinite(e))return t!=null&&t.long?hr(e):dr(e);throw new Error("Value is not a string or number.")}catch(r){const n=yr(r)?`${r.message}. value=${JSON.stringify(e)}`:"An unknown error has occurred.";throw new Error(n)}}function fr(e){if(e.length>100)throw new Error("Value exceeds the maximum length of 100 characters.");const t=/^(?<value>-?(?:\d+)?\.?\d+) *(?<type>milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e),r=t==null?void 0:t.groups;if(!r)return NaN;const n=parseFloat(r.value),o=(r.type||"ms").toLowerCase();switch(o){case"years":case"year":case"yrs":case"yr":case"y":return n*315576e5;case"weeks":case"week":case"w":return n*6048e5;case"days":case"day":case"d":return n*864e5;case"hours":case"hour":case"hrs":case"hr":case"h":return n*36e5;case"minutes":case"minute":case"mins":case"min":case"m":return n*6e4;case"seconds":case"second":case"secs":case"sec":case"s":return n*1e3;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:throw new Error(`The unit ${o} was matched, but no matching case exists.`)}}function dr(e){const t=Math.abs(e);return t>=864e5?`${Math.round(e/864e5)}d`:t>=36e5?`${Math.round(e/36e5)}h`:t>=6e4?`${Math.round(e/6e4)}m`:t>=1e3?`${Math.round(e/1e3)}s`:`${e}ms`}function hr(e){const t=Math.abs(e);return t>=864e5?_(e,t,864e5,"day"):t>=36e5?_(e,t,36e5,"hour"):t>=6e4?_(e,t,6e4,"minute"):t>=1e3?_(e,t,1e3,"second"):`${e} ms`}function _(e,t,r,n){const o=t>=r*1.5;return`${Math.round(e/r)} ${n}${o?"s":""}`}function yr(e){return typeof e=="object"&&e!==null&&"message"in e}const pr={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Unused",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Required",413:"Request Entry Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"};function ke(e){return pr[e]}function mr(e){switch(e){case 408:case 425:case 429:case 502:case 503:case 504:return!0;default:return!1}}class oe extends Error{constructor(t){super(t.message,{cause:t.cause}),this.detail=t,this.status=t.status,this.description=t.description}status;description;toJSON(){return{code:this.detail.code,message:this.message,status:this.status,description:this.description,cause:this.cause}}}$("DetailError",oe);class R{message;status;code;metadata;description;cause;constructor({status:t,message:r=ke(t),code:n=t,metadata:o,description:s,cause:a}){this.message=r??String(t),this.status=t,this.code=n,this.description=s,this.metadata=o,this.cause=a}with(t){return typeof t=="string"&&(t={message:t}),t===void 0?new R(this):new R({status:this.status,code:this.code,message:this.message,metadata:this.metadata,cause:this.cause,...t})}asError(t){return typeof t=="string"&&(t={message:t}),new oe(this.with(t))}require(t,r){if(t==null)throw this.asError(r);return t}check(t,r){switch(t){case!1:case void 0:case null:throw this.asError(r)}}throw(t){throw this.asError(t)}toJSON(){return{code:this.code,message:this.message,status:this.status,description:this.description,cause:this.cause,metadata:this.metadata}}asResponse(){return new Response(JSON.stringify(this.toJSON()),{status:this.status,statusText:this.description,headers:{"Content-Type":"application/json"}})}}class gr{static BadRequest=this.with({status:400});static Unauthorized=this.with({status:403});static Forbidden=this.with({status:403});static NotFound=this.with({status:404});static InternalServerError=this.with({status:501});static NotImplemented=this.with({status:501});static ServiceUnavailable=this.with({status:503});static resolvers=[];static with(t){return new R(t)}static ok(t,r){if(t.ok)return t;throw this.with({description:t.statusText,status:t.status,...r,metadata:{...r==null?void 0:r.metadata,response:t}}).asError()}static resolve(t){if(t instanceof R)return t;if(t instanceof oe)return t.detail;for(const r of this.resolvers){const n=r(t);if(n)return n}if(t instanceof Error){const{message:r,code:n,status:o}=t;return new R({message:r,status:parseInt(o)||500,code:n,cause:t})}return new R({message:t.message,status:500,cause:t})}}$("Errors",gr)}}});
|
|
21
|
-
//# sourceMappingURL=index.js.map
|