@queuedash/api
Version:
A stunning, sleek dashboard for Bull, BullMQ, and Bee-Queue
1,667 lines • 1.11 MB
JavaScript
var a4 = Object.defineProperty;
var Uv = (e) => {
throw TypeError(e);
};
var c4 = (e, t, r) => t in e ? a4(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
var we = (e, t, r) => c4(e, typeof t != "symbol" ? t + "" : t, r), aI = (e, t, r) => t.has(e) || Uv("Cannot " + r);
var M = (e, t, r) => (aI(e, t, "read from private field"), r ? r.call(e) : t.get(e)), qe = (e, t, r) => t.has(e) ? Uv("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r), Oe = (e, t, r, n) => (aI(e, t, "write to private field"), n ? n.call(e, r) : t.set(e, r), r), rt = (e, t, r) => (aI(e, t, "access private method"), r);
var Bv = (e, t, r, n) => ({
set _(s) {
Oe(e, t, s, r);
},
get _() {
return M(e, t, n);
}
});
import Lp from "events";
const f4 = () => {
}, Kv = (e) => {
Object.freeze && Object.freeze(e);
};
function Dx(e, t, r) {
var n, s;
const i = t.join(".");
return (n = r)[s = i] ?? (n[s] = new Proxy(f4, {
get(a, c) {
if (!(typeof c != "string" || c === "then"))
return Dx(e, [
...t,
c
], r);
},
apply(a, c, l) {
const d = t[t.length - 1];
let h = {
args: l,
path: t
};
return d === "call" ? h = {
args: l.length >= 2 ? [
l[1]
] : [],
path: t.slice(0, -1)
} : d === "apply" && (h = {
args: l.length >= 2 ? l[1] : [],
path: t.slice(0, -1)
}), Kv(h.args), Kv(h.path), e(h);
}
})), r[i];
}
const l4 = (e) => Dx(e, [], /* @__PURE__ */ Object.create(null)), d4 = {
/**
* Invalid JSON was received by the server.
* An error occurred on the server while parsing the JSON text.
*/
PARSE_ERROR: -32700,
/**
* The JSON sent is not a valid Request object.
*/
BAD_REQUEST: -32600,
// Internal JSON-RPC error
INTERNAL_SERVER_ERROR: -32603,
NOT_IMPLEMENTED: -32603,
BAD_GATEWAY: -32603,
SERVICE_UNAVAILABLE: -32603,
GATEWAY_TIMEOUT: -32603,
// Implementation specific errors
UNAUTHORIZED: -32001,
FORBIDDEN: -32003,
NOT_FOUND: -32004,
METHOD_NOT_SUPPORTED: -32005,
TIMEOUT: -32008,
CONFLICT: -32009,
PRECONDITION_FAILED: -32012,
PAYLOAD_TOO_LARGE: -32013,
UNSUPPORTED_MEDIA_TYPE: -32015,
UNPROCESSABLE_CONTENT: -32022,
TOO_MANY_REQUESTS: -32029,
CLIENT_CLOSED_REQUEST: -32099
}, m4 = {
[-32700]: "PARSE_ERROR",
[-32600]: "BAD_REQUEST",
[-32603]: "INTERNAL_SERVER_ERROR",
[-32001]: "UNAUTHORIZED",
[-32003]: "FORBIDDEN",
[-32004]: "NOT_FOUND",
[-32005]: "METHOD_NOT_SUPPORTED",
[-32008]: "TIMEOUT",
[-32009]: "CONFLICT",
[-32012]: "PRECONDITION_FAILED",
[-32013]: "PAYLOAD_TOO_LARGE",
[-32015]: "UNSUPPORTED_MEDIA_TYPE",
[-32022]: "UNPROCESSABLE_CONTENT",
[-32029]: "TOO_MANY_REQUESTS",
[-32099]: "CLIENT_CLOSED_REQUEST"
}, cI = Symbol();
function $x(e, ...t) {
const r = Object.assign(/* @__PURE__ */ Object.create(null), e);
for (const n of t)
for (const s in n) {
if (s in r && r[s] !== n[s])
throw new Error(`Duplicate key ${s}`);
r[s] = n[s];
}
return r;
}
function an(e) {
return !!e && !Array.isArray(e) && typeof e == "object";
}
function Cx(e) {
return typeof e == "function";
}
function fI(e) {
return Object.assign(/* @__PURE__ */ Object.create(null), e);
}
const h4 = typeof Symbol == "function" && !!Symbol.asyncIterator;
function yg(e) {
return h4 && an(e) && Symbol.asyncIterator in e;
}
const Yo = (e) => e();
function _4(e) {
return e;
}
const g4 = {
PARSE_ERROR: 400,
BAD_REQUEST: 400,
UNAUTHORIZED: 401,
FORBIDDEN: 403,
NOT_FOUND: 404,
METHOD_NOT_SUPPORTED: 405,
TIMEOUT: 408,
CONFLICT: 409,
PRECONDITION_FAILED: 412,
PAYLOAD_TOO_LARGE: 413,
UNSUPPORTED_MEDIA_TYPE: 415,
UNPROCESSABLE_CONTENT: 422,
TOO_MANY_REQUESTS: 429,
CLIENT_CLOSED_REQUEST: 499,
INTERNAL_SERVER_ERROR: 500,
NOT_IMPLEMENTED: 501,
BAD_GATEWAY: 502,
SERVICE_UNAVAILABLE: 503,
GATEWAY_TIMEOUT: 504
};
function wx(e) {
return g4[e] ?? 500;
}
function E4(e) {
const t = Array.isArray(e) ? e : [
e
], r = new Set(t.map((s) => {
var i;
if ("error" in s && an(s.error.data)) {
if (typeof ((i = s.error.data) == null ? void 0 : i.httpStatus) == "number")
return s.error.data.httpStatus;
const a = m4[s.error.code];
return wx(a);
}
return 200;
}));
return r.size !== 1 ? 207 : r.values().next().value;
}
function y4(e) {
return wx(e.code);
}
function rs(e) {
const { path: t, error: r, config: n } = e, { code: s } = e.error, i = {
message: r.message,
code: d4[s],
data: {
code: s,
httpStatus: y4(r)
}
};
return n.isDev && typeof e.error.stack == "string" && (i.data.stack = e.error.stack), typeof t == "string" && (i.data.path = t), n.errorFormatter({
...e,
shape: i
});
}
function Xv(e, t, r) {
return t in e ? Object.defineProperty(e, t, {
value: r,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = r, e;
}
let p4 = class extends Error {
};
function R4(e) {
if (e instanceof Error)
return e;
const t = typeof e;
if (!(t === "undefined" || t === "function" || e === null)) {
if (t !== "object")
return new Error(String(e));
if (an(e)) {
const r = new p4();
for (const n in e)
r[n] = e[n];
return r;
}
}
}
function Tr(e) {
if (e instanceof ge || e instanceof Error && e.name === "TRPCError")
return e;
const t = new ge({
code: "INTERNAL_SERVER_ERROR",
cause: e
});
return e instanceof Error && e.stack && (t.stack = e.stack), t;
}
let ge = class extends Error {
constructor(t) {
const r = R4(t.cause), n = t.message ?? (r == null ? void 0 : r.message) ?? t.code;
super(n, {
cause: r
}), // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore override doesn't work in all environments due to "This member cannot have an 'override' modifier because it is not declared in the base class 'Error'"
Xv(this, "cause", void 0), Xv(this, "code", void 0), this.code = t.code, this.name = "TRPCError", this.cause || (this.cause = r);
}
};
const ng = ({ shape: e }) => e;
function A4(e) {
return "input" in e ? e : {
input: e,
output: e
};
}
const sg = {
input: {
serialize: (e) => e,
deserialize: (e) => e
},
output: {
serialize: (e) => e,
deserialize: (e) => e
}
};
function Gv(e, t) {
return "error" in t ? {
...t,
error: e.transformer.output.serialize(t.error)
} : "data" in t.result ? {
...t,
result: {
...t.result,
data: e.transformer.output.serialize(t.result.data)
}
} : t;
}
function pg(e, t) {
return Array.isArray(t) ? t.map((r) => Gv(e, r)) : Gv(e, t);
}
const S4 = Symbol("lazy");
function I4(e) {
const t = Symbol();
let r = t;
return () => (r === t && (r = e()), r);
}
function O4(e) {
return typeof e == "function" && S4 in e;
}
function b4(e) {
return an(e) && an(e._def) && "router" in e._def;
}
const T4 = {
_ctx: null,
_errorShape: null,
_meta: null,
queries: {},
mutations: {},
subscriptions: {},
errorFormatter: ng,
transformer: sg
}, v4 = [
/**
* Then is a reserved word because otherwise we can't return a promise that returns a Proxy
* since JS will think that `.then` is something that exists
*/
"then",
/**
* `fn.call()` and `fn.apply()` are reserved words because otherwise we can't call a function using `.call` or `.apply`
*/
"call",
"apply"
];
function Lx(e) {
function t(r) {
const n = new Set(Object.keys(r).filter((_) => v4.includes(_)));
if (n.size > 0)
throw new Error("Reserved words used in `router({})` call: " + Array.from(n).join(", "));
const s = fI({}), i = fI({});
function a(_) {
return {
ref: _.ref,
load: I4(async () => {
const p = await _.ref(), y = [
..._.path,
_.key
], g = y.join(".");
_.aggregate[_.key] = c(p._def.record, y), delete i[g];
for (const [R, b] of Object.entries(p._def.lazy)) {
const v = [
...y,
R
].join(".");
i[v] = a({
ref: b.ref,
path: y,
key: R,
aggregate: _.aggregate[_.key]
});
}
})
};
}
function c(_, p = []) {
const y = fI({});
for (const [g, R] of Object.entries(_ ?? {})) {
if (O4(R)) {
i[[
...p,
g
].join(".")] = a({
path: p,
ref: R,
key: g,
aggregate: y
});
continue;
}
if (b4(R)) {
y[g] = c(R._def.record, [
...p,
g
]);
continue;
}
if (!Mx(R)) {
y[g] = c(R, [
...p,
g
]);
continue;
}
const b = [
...p,
g
].join(".");
if (s[b])
throw new Error(`Duplicate key: ${b}`);
s[b] = R, y[g] = R;
}
return y;
}
const l = c(r), d = {
_config: e,
router: !0,
procedures: s,
lazy: i,
...T4,
record: l
};
return {
...l,
_def: d,
createCaller: Fx()({
_def: d
})
};
}
return t;
}
function Mx(e) {
return typeof e == "function";
}
async function Ug(e, t) {
const { _def: r } = e;
let n = r.procedures[t];
for (; !n; ) {
const s = Object.keys(r.lazy).find((a) => t.startsWith(a));
if (!s)
return null;
await r.lazy[s].load(), n = r.procedures[t];
}
return n;
}
async function N4(e) {
const { type: t, path: r } = e, n = await Ug(e.router, r);
if (!n || !Mx(n) || n._def.type !== t && !e.allowMethodOverride)
throw new ge({
code: "NOT_FOUND",
message: `No "${t}"-procedure on path "${r}"`
});
/* istanbul ignore if -- @preserve */
if (n._def.type !== t && e.allowMethodOverride && n._def.type === "subscription")
throw new ge({
code: "METHOD_NOT_SUPPORTED",
message: "Method override is not supported for subscriptions"
});
return n(e);
}
function Fx() {
return function(t) {
const { _def: r } = t;
return function(s, i) {
return l4(async ({ path: a, args: c }) => {
var _;
const l = a.join(".");
if (a.length === 1 && a[0] === "_def")
return r;
const d = await Ug(t, l);
let h;
try {
if (!d)
throw new ge({
code: "NOT_FOUND",
message: `No procedure found on path "${a}"`
});
return h = Cx(s) ? await Promise.resolve(s()) : s, await d({
path: l,
getRawInput: async () => c[0],
ctx: h,
type: d._def.type,
signal: i == null ? void 0 : i.signal
});
} catch (p) {
throw (_ = i == null ? void 0 : i.onError) == null || _.call(i, {
ctx: h,
error: Tr(p),
input: c[0],
path: l,
type: (d == null ? void 0 : d._def.type) ?? "unknown"
}), p;
}
});
};
};
}
function P4(...e) {
var i;
const t = $x({}, ...e.map((a) => a._def.record)), r = e.reduce((a, c) => {
if (c._def._config.errorFormatter && c._def._config.errorFormatter !== ng) {
if (a !== ng && a !== c._def._config.errorFormatter)
throw new Error("You seem to have several error formatters");
return c._def._config.errorFormatter;
}
return a;
}, ng), n = e.reduce((a, c) => {
if (c._def._config.transformer && c._def._config.transformer !== sg) {
if (a !== sg && a !== c._def._config.transformer)
throw new Error("You seem to have several transformers");
return c._def._config.transformer;
}
return a;
}, sg);
return Lx({
errorFormatter: r,
transformer: n,
isDev: e.every((a) => a._def._config.isDev),
allowOutsideOfServer: e.every((a) => a._def._config.allowOutsideOfServer),
isServer: e.every((a) => a._def._config.isServer),
$types: (i = e[0]) == null ? void 0 : i._def._config.$types
})(t);
}
function by(e, t, r) {
return t in e ? Object.defineProperty(e, t, {
value: r,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = r, e;
}
var xx;
const lI = /* @__PURE__ */ new WeakMap(), D4 = () => {
};
xx = Symbol.toStringTag;
let $4 = xx;
class Os {
/** Create a promise that mitigates uncontrolled subscription to a long-lived
* Promise via .then() and .catch() - otherwise a source of memory leaks.
*
* The returned promise has an `unsubscribe()` method which can be called when
* the Promise is no longer being tracked by application logic, and which
* ensures that there is no reference chain from the original promise to the
* new one, and therefore no memory leak.
*
* If original promise has not yet settled, this adds a new unique promise
* that listens to then/catch events, along with an `unsubscribe()` method to
* detach it.
*
* If original promise has settled, then creates a new Promise.resolve() or
* Promise.reject() and provided unsubscribe is a noop.
*
* If you call `unsubscribe()` before the returned Promise has settled, it
* will never settle.
*/
subscribe() {
let t, r;
const { settlement: n } = this;
if (n === null) {
if (this.subscribers === null)
throw new Error("Unpromise settled but still has subscribers");
const s = w4();
this.subscribers = L4(this.subscribers, s), t = s.promise, r = () => {
this.subscribers !== null && (this.subscribers = F4(this.subscribers, s));
};
} else {
const { status: s } = n;
s === "fulfilled" ? t = Promise.resolve(n.value) : t = Promise.reject(n.reason), r = D4;
}
return Object.assign(t, {
unsubscribe: r
});
}
/** STANDARD PROMISE METHODS (but returning a SubscribedPromise) */
then(t, r) {
const n = this.subscribe(), { unsubscribe: s } = n;
return Object.assign(n.then(t, r), {
unsubscribe: s
});
}
catch(t) {
const r = this.subscribe(), { unsubscribe: n } = r;
return Object.assign(r.catch(t), {
unsubscribe: n
});
}
finally(t) {
const r = this.subscribe(), { unsubscribe: n } = r;
return Object.assign(r.finally(t), {
unsubscribe: n
});
}
/** Unpromise STATIC METHODS */
/** Create or Retrieve the proxy Unpromise (a re-used Unpromise for the VM lifetime
* of the provided Promise reference) */
static proxy(t) {
const r = Os.getSubscribablePromise(t);
return typeof r < "u" ? r : Os.createSubscribablePromise(t);
}
/** Create and store an Unpromise keyed by an original Promise. */
static createSubscribablePromise(t) {
const r = new Os(t);
return lI.set(t, r), lI.set(r, r), r;
}
/** Retrieve a previously-created Unpromise keyed by an original Promise. */
static getSubscribablePromise(t) {
return lI.get(t);
}
/** Promise STATIC METHODS */
/** Lookup the Unpromise for this promise, and derive a SubscribedPromise from
* it (that can be later unsubscribed to eliminate Memory leaks) */
static resolve(t) {
const r = typeof t == "object" && t !== null && "then" in t && typeof t.then == "function" ? t : Promise.resolve(t);
return Os.proxy(r).subscribe();
}
static async any(t) {
const n = (Array.isArray(t) ? t : [
...t
]).map(Os.resolve);
try {
return await Promise.any(n);
} finally {
n.forEach(({ unsubscribe: s }) => {
s();
});
}
}
static async race(t) {
const n = (Array.isArray(t) ? t : [
...t
]).map(Os.resolve);
try {
return await Promise.race(n);
} finally {
n.forEach(({ unsubscribe: s }) => {
s();
});
}
}
/** Create a race of SubscribedPromises that will fulfil to a single winning
* Promise (in a 1-Tuple). Eliminates memory leaks from long-lived promises
* accumulating .then() and .catch() subscribers. Allows simple logic to
* consume the result, like...
* ```ts
* const [ winner ] = await Unpromise.race([ promiseA, promiseB ]);
* if(winner === promiseB){
* const result = await promiseB;
* // do the thing
* }
* ```
* */
static async raceReferences(t) {
const r = t.map(C4);
try {
return await Promise.race(r);
} finally {
for (const n of r)
n.unsubscribe();
}
}
constructor(t) {
by(this, "promise", void 0), by(this, "subscribers", []), by(this, "settlement", null), by(this, $4, "Unpromise"), typeof t == "function" ? this.promise = new Promise(t) : this.promise = t;
const r = this.promise.then((n) => {
const { subscribers: s } = this;
this.subscribers = null, this.settlement = {
status: "fulfilled",
value: n
}, s == null || s.forEach(({ resolve: i }) => {
i(n);
});
});
"catch" in r && r.catch((n) => {
const { subscribers: s } = this;
this.subscribers = null, this.settlement = {
status: "rejected",
reason: n
}, s == null || s.forEach(({ reject: i }) => {
i(n);
});
});
}
}
function C4(e) {
return Os.proxy(e).then(() => [
e
]);
}
function w4() {
let e, t;
return {
promise: new Promise((n, s) => {
e = n, t = s;
}),
resolve: e,
reject: t
};
}
function L4(e, t) {
return [
...e,
t
];
}
function M4(e, t) {
return [
...e.slice(0, t),
...e.slice(t + 1)
];
}
function F4(e, t) {
const r = e.indexOf(t);
return r !== -1 ? M4(e, r) : e;
}
var kv, Hv;
(kv = Symbol).dispose ?? (kv.dispose = Symbol());
(Hv = Symbol).asyncDispose ?? (Hv.asyncDispose = Symbol());
function x4(e, t) {
const r = e, n = r[Symbol.dispose];
return r[Symbol.dispose] = () => {
t(), n == null || n();
}, r;
}
function jx(e, t) {
const r = e, n = r[Symbol.asyncDispose];
return r[Symbol.asyncDispose] = async () => {
await t(), await (n == null ? void 0 : n());
}, r;
}
const j4 = Symbol();
function Yx(e) {
return Array.isArray(e) && e[2] === j4;
}
const Ux = "middlewareMarker";
function Y4() {
function e(r) {
return {
_middlewares: r,
unstable_pipe(n) {
const s = "_middlewares" in n ? n._middlewares : [
n
];
return e([
...r,
...s
]);
}
};
}
function t(r) {
return e([
r
]);
}
return t;
}
function U4(e) {
const t = async function(n) {
let s;
const i = await n.getRawInput();
try {
s = await e(i);
} catch (c) {
throw new ge({
code: "BAD_REQUEST",
cause: c
});
}
const a = an(n.input) && an(s) ? {
...n.input,
...s
} : s;
return n.next({
input: a
});
};
return t._type = "input", t;
}
function B4(e) {
const t = async function({ next: n }) {
const s = await n();
if (!s.ok)
return s;
try {
const i = await e(s.data);
return {
...s,
data: i
};
} catch (i) {
throw new ge({
message: "Output validation failed",
code: "INTERNAL_SERVER_ERROR",
cause: i
});
}
};
return t._type = "output", t;
}
function K4(e, t, r) {
return t in e ? Object.defineProperty(e, t, {
value: r,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = r, e;
}
class X4 extends Error {
/**
* Creates a schema error with useful information.
*
* @param issues The schema issues.
*/
constructor(t) {
var r;
super((r = t[0]) == null ? void 0 : r.message), /** The schema issues. */
K4(this, "issues", void 0), this.name = "SchemaError", this.issues = t;
}
}
function Wv(e) {
const t = e, r = "~standard" in t;
if (typeof t == "function" && typeof t.assert == "function")
return t.assert.bind(t);
if (typeof t == "function" && !r)
return t;
if (typeof t.parseAsync == "function")
return t.parseAsync.bind(t);
if (typeof t.parse == "function")
return t.parse.bind(t);
if (typeof t.validateSync == "function")
return t.validateSync.bind(t);
if (typeof t.create == "function")
return t.create.bind(t);
if (typeof t.assert == "function")
return (n) => (t.assert(n), n);
if (r)
return async (n) => {
const s = await t["~standard"].validate(n);
if (s.issues)
throw new X4(s.issues);
return s.value;
};
throw new Error("Could not find a validator fn");
}
function Au(e, t) {
const { middlewares: r = [], inputs: n, meta: s, ...i } = t;
return Bx({
...$x(e, i),
inputs: [
...e.inputs,
...n ?? []
],
middlewares: [
...e.middlewares,
...r
],
meta: e.meta && s ? {
...e.meta,
...s
} : s ?? e.meta
});
}
function Bx(e = {}) {
const t = {
procedure: !0,
inputs: [],
middlewares: [],
...e
};
return {
_def: t,
input(n) {
const s = Wv(n);
return Au(t, {
inputs: [
n
],
middlewares: [
U4(s)
]
});
},
output(n) {
const s = Wv(n);
return Au(t, {
output: n,
middlewares: [
B4(s)
]
});
},
meta(n) {
return Au(t, {
meta: n
});
},
use(n) {
const s = "_middlewares" in n ? n._middlewares : [
n
];
return Au(t, {
middlewares: s
});
},
unstable_concat(n) {
return Au(t, n._def);
},
concat(n) {
return Au(t, n._def);
},
query(n) {
return dI({
...t,
type: "query"
}, n);
},
mutation(n) {
return dI({
...t,
type: "mutation"
}, n);
},
subscription(n) {
return dI({
...t,
type: "subscription"
}, n);
},
experimental_caller(n) {
return Au(t, {
caller: n
});
}
};
}
function dI(e, t) {
const r = Au(e, {
resolver: t,
middlewares: [
async function(l) {
const d = await t(l);
return {
marker: Ux,
ok: !0,
data: d,
ctx: l.ctx
};
}
]
}), n = {
...r._def,
type: e.type,
experimental_caller: !!r._def.caller,
meta: r._def.meta,
$types: null
}, s = k4(r._def), i = r._def.caller;
if (!i)
return s;
const a = async (...c) => await i({
args: c,
invoke: s,
_def: n
});
return a._def = n, a;
}
const G4 = `
This is a client-only function.
If you want to call this function on the server, see https://trpc.io/docs/v11/server/server-side-calls
`.trim();
async function Kx(e, t, r) {
try {
const n = t.middlewares[e];
return await n({
...r,
meta: t.meta,
input: r.input,
next(i) {
const a = i;
return Kx(e + 1, t, {
...r,
ctx: a != null && a.ctx ? {
...r.ctx,
...a.ctx
} : r.ctx,
input: a && "input" in a ? a.input : r.input,
getRawInput: (a == null ? void 0 : a.getRawInput) ?? r.getRawInput
});
}
});
} catch (n) {
return {
ok: !1,
error: Tr(n),
marker: Ux
};
}
}
function k4(e) {
async function t(r) {
if (!r || !("getRawInput" in r))
throw new Error(G4);
const n = await Kx(0, e, r);
if (!n)
throw new ge({
code: "INTERNAL_SERVER_ERROR",
message: "No result from middlewares - did you forget to `return next()`?"
});
if (!n.ok)
throw n.error;
return n.data;
}
return t._def = e, t.procedure = !0, t;
}
var cx, fx, lx, dx, mx, hx;
const qv = typeof window > "u" || "Deno" in window || // eslint-disable-next-line @typescript-eslint/dot-notation
((fx = (cx = globalThis.process) == null ? void 0 : cx.env) == null ? void 0 : fx.NODE_ENV) === "test" || !!((dx = (lx = globalThis.process) == null ? void 0 : lx.env) != null && dx.JEST_WORKER_ID) || !!((hx = (mx = globalThis.process) == null ? void 0 : mx.env) != null && hx.VITEST_WORKER_ID);
class Qy {
/**
* Add a context shape as a generic to the root object
* @see https://trpc.io/docs/v11/server/context
*/
context() {
return new Qy();
}
/**
* Add a meta shape as a generic to the root object
* @see https://trpc.io/docs/v11/quickstart
*/
meta() {
return new Qy();
}
/**
* Create the root object
* @see https://trpc.io/docs/v11/server/routers#initialize-trpc
*/
create(t) {
var n;
const r = {
...t,
transformer: A4((t == null ? void 0 : t.transformer) ?? sg),
isDev: (t == null ? void 0 : t.isDev) ?? // eslint-disable-next-line @typescript-eslint/dot-notation
((n = globalThis.process) == null ? void 0 : n.env.NODE_ENV) !== "production",
allowOutsideOfServer: (t == null ? void 0 : t.allowOutsideOfServer) ?? !1,
errorFormatter: (t == null ? void 0 : t.errorFormatter) ?? ng,
isServer: (t == null ? void 0 : t.isServer) ?? qv,
/**
* These are just types, they can't be used at runtime
* @internal
*/
$types: null
};
if (!((t == null ? void 0 : t.isServer) ?? qv) && (t == null ? void 0 : t.allowOutsideOfServer) !== !0)
throw new Error("You're trying to use @trpc/server in a non-server environment. This is not supported by default.");
return {
/**
* Your router config
* @internal
*/
_config: r,
/**
* Builder object for creating procedures
* @see https://trpc.io/docs/v11/server/procedures
*/
procedure: Bx({
meta: t == null ? void 0 : t.defaultMeta
}),
/**
* Create reusable middlewares
* @see https://trpc.io/docs/v11/server/middlewares
*/
middleware: Y4(),
/**
* Create a router
* @see https://trpc.io/docs/v11/server/routers
*/
router: Lx(r),
/**
* Merge Routers
* @see https://trpc.io/docs/v11/server/merging-routers
*/
mergeRouters: P4,
/**
* Create a server-side caller for a router
* @see https://trpc.io/docs/v11/server/server-side-calls
*/
createCallerFactory: Fx()
};
}
}
const H4 = new Qy(), Xx = H4.context().create(), Mp = Xx.router, un = Xx.procedure;
var Et;
(function(e) {
e.assertEqual = (s) => {
};
function t(s) {
}
e.assertIs = t;
function r(s) {
throw new Error();
}
e.assertNever = r, e.arrayToEnum = (s) => {
const i = {};
for (const a of s)
i[a] = a;
return i;
}, e.getValidEnumValues = (s) => {
const i = e.objectKeys(s).filter((c) => typeof s[s[c]] != "number"), a = {};
for (const c of i)
a[c] = s[c];
return e.objectValues(a);
}, e.objectValues = (s) => e.objectKeys(s).map(function(i) {
return s[i];
}), e.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
const i = [];
for (const a in s)
Object.prototype.hasOwnProperty.call(s, a) && i.push(a);
return i;
}, e.find = (s, i) => {
for (const a of s)
if (i(a))
return a;
}, e.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && Number.isFinite(s) && Math.floor(s) === s;
function n(s, i = " | ") {
return s.map((a) => typeof a == "string" ? `'${a}'` : a).join(i);
}
e.joinValues = n, e.jsonStringifyReplacer = (s, i) => typeof i == "bigint" ? i.toString() : i;
})(Et || (Et = {}));
var Vv;
(function(e) {
e.mergeShapes = (t, r) => ({
...t,
...r
// second overwrites first
});
})(Vv || (Vv = {}));
const Ee = Et.arrayToEnum([
"string",
"nan",
"number",
"integer",
"float",
"boolean",
"date",
"bigint",
"symbol",
"function",
"undefined",
"null",
"array",
"object",
"unknown",
"promise",
"void",
"never",
"map",
"set"
]), Iu = (e) => {
switch (typeof e) {
case "undefined":
return Ee.undefined;
case "string":
return Ee.string;
case "number":
return Number.isNaN(e) ? Ee.nan : Ee.number;
case "boolean":
return Ee.boolean;
case "function":
return Ee.function;
case "bigint":
return Ee.bigint;
case "symbol":
return Ee.symbol;
case "object":
return Array.isArray(e) ? Ee.array : e === null ? Ee.null : e.then && typeof e.then == "function" && e.catch && typeof e.catch == "function" ? Ee.promise : typeof Map < "u" && e instanceof Map ? Ee.map : typeof Set < "u" && e instanceof Set ? Ee.set : typeof Date < "u" && e instanceof Date ? Ee.date : Ee.object;
default:
return Ee.unknown;
}
}, ne = Et.arrayToEnum([
"invalid_type",
"invalid_literal",
"custom",
"invalid_union",
"invalid_union_discriminator",
"invalid_enum_value",
"unrecognized_keys",
"invalid_arguments",
"invalid_return_type",
"invalid_date",
"invalid_string",
"too_small",
"too_big",
"invalid_intersection_types",
"not_multiple_of",
"not_finite"
]);
class Jo extends Error {
get errors() {
return this.issues;
}
constructor(t) {
super(), this.issues = [], this.addIssue = (n) => {
this.issues = [...this.issues, n];
}, this.addIssues = (n = []) => {
this.issues = [...this.issues, ...n];
};
const r = new.target.prototype;
Object.setPrototypeOf ? Object.setPrototypeOf(this, r) : this.__proto__ = r, this.name = "ZodError", this.issues = t;
}
format(t) {
const r = t || function(i) {
return i.message;
}, n = { _errors: [] }, s = (i) => {
for (const a of i.issues)
if (a.code === "invalid_union")
a.unionErrors.map(s);
else if (a.code === "invalid_return_type")
s(a.returnTypeError);
else if (a.code === "invalid_arguments")
s(a.argumentsError);
else if (a.path.length === 0)
n._errors.push(r(a));
else {
let c = n, l = 0;
for (; l < a.path.length; ) {
const d = a.path[l];
l === a.path.length - 1 ? (c[d] = c[d] || { _errors: [] }, c[d]._errors.push(r(a))) : c[d] = c[d] || { _errors: [] }, c = c[d], l++;
}
}
};
return s(this), n;
}
static assert(t) {
if (!(t instanceof Jo))
throw new Error(`Not a ZodError: ${t}`);
}
toString() {
return this.message;
}
get message() {
return JSON.stringify(this.issues, Et.jsonStringifyReplacer, 2);
}
get isEmpty() {
return this.issues.length === 0;
}
flatten(t = (r) => r.message) {
const r = {}, n = [];
for (const s of this.issues)
s.path.length > 0 ? (r[s.path[0]] = r[s.path[0]] || [], r[s.path[0]].push(t(s))) : n.push(t(s));
return { formErrors: n, fieldErrors: r };
}
get formErrors() {
return this.flatten();
}
}
Jo.create = (e) => new Jo(e);
const gO = (e, t) => {
let r;
switch (e.code) {
case ne.invalid_type:
e.received === Ee.undefined ? r = "Required" : r = `Expected ${e.expected}, received ${e.received}`;
break;
case ne.invalid_literal:
r = `Invalid literal value, expected ${JSON.stringify(e.expected, Et.jsonStringifyReplacer)}`;
break;
case ne.unrecognized_keys:
r = `Unrecognized key(s) in object: ${Et.joinValues(e.keys, ", ")}`;
break;
case ne.invalid_union:
r = "Invalid input";
break;
case ne.invalid_union_discriminator:
r = `Invalid discriminator value. Expected ${Et.joinValues(e.options)}`;
break;
case ne.invalid_enum_value:
r = `Invalid enum value. Expected ${Et.joinValues(e.options)}, received '${e.received}'`;
break;
case ne.invalid_arguments:
r = "Invalid function arguments";
break;
case ne.invalid_return_type:
r = "Invalid function return type";
break;
case ne.invalid_date:
r = "Invalid date";
break;
case ne.invalid_string:
typeof e.validation == "object" ? "includes" in e.validation ? (r = `Invalid input: must include "${e.validation.includes}"`, typeof e.validation.position == "number" && (r = `${r} at one or more positions greater than or equal to ${e.validation.position}`)) : "startsWith" in e.validation ? r = `Invalid input: must start with "${e.validation.startsWith}"` : "endsWith" in e.validation ? r = `Invalid input: must end with "${e.validation.endsWith}"` : Et.assertNever(e.validation) : e.validation !== "regex" ? r = `Invalid ${e.validation}` : r = "Invalid";
break;
case ne.too_small:
e.type === "array" ? r = `Array must contain ${e.exact ? "exactly" : e.inclusive ? "at least" : "more than"} ${e.minimum} element(s)` : e.type === "string" ? r = `String must contain ${e.exact ? "exactly" : e.inclusive ? "at least" : "over"} ${e.minimum} character(s)` : e.type === "number" ? r = `Number must be ${e.exact ? "exactly equal to " : e.inclusive ? "greater than or equal to " : "greater than "}${e.minimum}` : e.type === "date" ? r = `Date must be ${e.exact ? "exactly equal to " : e.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(e.minimum))}` : r = "Invalid input";
break;
case ne.too_big:
e.type === "array" ? r = `Array must contain ${e.exact ? "exactly" : e.inclusive ? "at most" : "less than"} ${e.maximum} element(s)` : e.type === "string" ? r = `String must contain ${e.exact ? "exactly" : e.inclusive ? "at most" : "under"} ${e.maximum} character(s)` : e.type === "number" ? r = `Number must be ${e.exact ? "exactly" : e.inclusive ? "less than or equal to" : "less than"} ${e.maximum}` : e.type === "bigint" ? r = `BigInt must be ${e.exact ? "exactly" : e.inclusive ? "less than or equal to" : "less than"} ${e.maximum}` : e.type === "date" ? r = `Date must be ${e.exact ? "exactly" : e.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(e.maximum))}` : r = "Invalid input";
break;
case ne.custom:
r = "Invalid input";
break;
case ne.invalid_intersection_types:
r = "Intersection results could not be merged";
break;
case ne.not_multiple_of:
r = `Number must be a multiple of ${e.multipleOf}`;
break;
case ne.not_finite:
r = "Number must be finite";
break;
default:
r = t.defaultError, Et.assertNever(e);
}
return { message: r };
};
let W4 = gO;
function q4() {
return W4;
}
const V4 = (e) => {
const { data: t, path: r, errorMaps: n, issueData: s } = e, i = [...r, ...s.path || []], a = {
...s,
path: i
};
if (s.message !== void 0)
return {
...s,
path: i,
message: s.message
};
let c = "";
const l = n.filter((d) => !!d).slice().reverse();
for (const d of l)
c = d(a, { data: t, defaultError: c }).message;
return {
...s,
path: i,
message: c
};
};
function me(e, t) {
const r = q4(), n = V4({
issueData: t,
data: e.data,
path: e.path,
errorMaps: [
e.common.contextualErrorMap,
// contextual error map is first priority
e.schemaErrorMap,
// then schema-bound map if available
r,
// then global override map
r === gO ? void 0 : gO
// then global default map
].filter((s) => !!s)
});
e.common.issues.push(n);
}
class Rn {
constructor() {
this.value = "valid";
}
dirty() {
this.value === "valid" && (this.value = "dirty");
}
abort() {
this.value !== "aborted" && (this.value = "aborted");
}
static mergeArray(t, r) {
const n = [];
for (const s of r) {
if (s.status === "aborted")
return Ge;
s.status === "dirty" && t.dirty(), n.push(s.value);
}
return { status: t.value, value: n };
}
static async mergeObjectAsync(t, r) {
const n = [];
for (const s of r) {
const i = await s.key, a = await s.value;
n.push({
key: i,
value: a
});
}
return Rn.mergeObjectSync(t, n);
}
static mergeObjectSync(t, r) {
const n = {};
for (const s of r) {
const { key: i, value: a } = s;
if (i.status === "aborted" || a.status === "aborted")
return Ge;
i.status === "dirty" && t.dirty(), a.status === "dirty" && t.dirty(), i.value !== "__proto__" && (typeof a.value < "u" || s.alwaysSet) && (n[i.value] = a.value);
}
return { status: t.value, value: n };
}
}
const Ge = Object.freeze({
status: "aborted"
}), X_ = (e) => ({ status: "dirty", value: e }), Ps = (e) => ({ status: "valid", value: e }), zv = (e) => e.status === "aborted", Zv = (e) => e.status === "dirty", kl = (e) => e.status === "valid", ep = (e) => typeof Promise < "u" && e instanceof Promise;
var Ae;
(function(e) {
e.errToObj = (t) => typeof t == "string" ? { message: t } : t || {}, e.toString = (t) => typeof t == "string" ? t : t == null ? void 0 : t.message;
})(Ae || (Ae = {}));
var tp = function(e, t, r, n) {
if (r === "a" && !n) throw new TypeError("Private accessor was defined without a getter");
if (typeof t == "function" ? e !== t || !n : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return r === "m" ? n : r === "a" ? n.call(e) : n ? n.value : t.get(e);
}, Gx = function(e, t, r, n, s) {
if (n === "m") throw new TypeError("Private method is not writable");
if (n === "a" && !s) throw new TypeError("Private accessor was defined without a setter");
if (typeof t == "function" ? e !== t || !s : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return n === "a" ? s.call(e, r) : s ? s.value = r : t.set(e, r), r;
}, G_, k_;
class eo {
constructor(t, r, n, s) {
this._cachedPath = [], this.parent = t, this.data = r, this._path = n, this._key = s;
}
get path() {
return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
}
}
const Jv = (e, t) => {
if (kl(t))
return { success: !0, data: t.value };
if (!e.common.issues.length)
throw new Error("Validation failed but no issues detected.");
return {
success: !1,
get error() {
if (this._error)
return this._error;
const r = new Jo(e.common.issues);
return this._error = r, this._error;
}
};
};
function ze(e) {
if (!e)
return {};
const { errorMap: t, invalid_type_error: r, required_error: n, description: s } = e;
if (t && (r || n))
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
return t ? { errorMap: t, description: s } : { errorMap: (a, c) => {
const { message: l } = e;
return a.code === "invalid_enum_value" ? { message: l ?? c.defaultError } : typeof c.data > "u" ? { message: l ?? n ?? c.defaultError } : a.code !== "invalid_type" ? { message: c.defaultError } : { message: l ?? r ?? c.defaultError };
}, description: s };
}
class dt {
get description() {
return this._def.description;
}
_getType(t) {
return Iu(t.data);
}
_getOrReturnCtx(t, r) {
return r || {
common: t.parent.common,
data: t.data,
parsedType: Iu(t.data),
schemaErrorMap: this._def.errorMap,
path: t.path,
parent: t.parent
};
}
_processInputParams(t) {
return {
status: new Rn(),
ctx: {
common: t.parent.common,
data: t.data,
parsedType: Iu(t.data),
schemaErrorMap: this._def.errorMap,
path: t.path,
parent: t.parent
}
};
}
_parseSync(t) {
const r = this._parse(t);
if (ep(r))
throw new Error("Synchronous parse encountered promise.");
return r;
}
_parseAsync(t) {
const r = this._parse(t);
return Promise.resolve(r);
}
parse(t, r) {
const n = this.safeParse(t, r);
if (n.success)
return n.data;
throw n.error;
}
safeParse(t, r) {
const n = {
common: {
issues: [],
async: (r == null ? void 0 : r.async) ?? !1,
contextualErrorMap: r == null ? void 0 : r.errorMap
},
path: (r == null ? void 0 : r.path) || [],
schemaErrorMap: this._def.errorMap,
parent: null,
data: t,
parsedType: Iu(t)
}, s = this._parseSync({ data: t, path: n.path, parent: n });
return Jv(n, s);
}
"~validate"(t) {
var n, s;
const r = {
common: {
issues: [],
async: !!this["~standard"].async
},
path: [],
schemaErrorMap: this._def.errorMap,
parent: null,
data: t,
parsedType: Iu(t)
};
if (!this["~standard"].async)
try {
const i = this._parseSync({ data: t, path: [], parent: r });
return kl(i) ? {
value: i.value
} : {
issues: r.common.issues
};
} catch (i) {
(s = (n = i == null ? void 0 : i.message) == null ? void 0 : n.toLowerCase()) != null && s.includes("encountered") && (this["~standard"].async = !0), r.common = {
issues: [],
async: !0
};
}
return this._parseAsync({ data: t, path: [], parent: r }).then((i) => kl(i) ? {
value: i.value
} : {
issues: r.common.issues
});
}
async parseAsync(t, r) {
const n = await this.safeParseAsync(t, r);
if (n.success)
return n.data;
throw n.error;
}
async safeParseAsync(t, r) {
const n = {
common: {
issues: [],
contextualErrorMap: r == null ? void 0 : r.errorMap,
async: !0
},
path: (r == null ? void 0 : r.path) || [],
schemaErrorMap: this._def.errorMap,
parent: null,
data: t,
parsedType: Iu(t)
}, s = this._parse({ data: t, path: n.path, parent: n }), i = await (ep(s) ? s : Promise.resolve(s));
return Jv(n, i);
}
refine(t, r) {
const n = (s) => typeof r == "string" || typeof r > "u" ? { message: r } : typeof r == "function" ? r(s) : r;
return this._refinement((s, i) => {
const a = t(s), c = () => i.addIssue({
code: ne.custom,
...n(s)
});
return typeof Promise < "u" && a instanceof Promise ? a.then((l) => l ? !0 : (c(), !1)) : a ? !0 : (c(), !1);
});
}
refinement(t, r) {
return this._refinement((n, s) => t(n) ? !0 : (s.addIssue(typeof r == "function" ? r(n, s) : r), !1));
}
_refinement(t) {
return new ql({
schema: this,
typeName: Ye.ZodEffects,
effect: { type: "refinement", refinement: t }
});
}
superRefine(t) {
return this._refinement(t);
}
constructor(t) {
this.spa = this.safeParseAsync, this._def = t, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
version: 1,
vendor: "zod",
validate: (r) => this["~validate"](r)
};
}
optional() {
return ju.create(this, this._def);
}
nullable() {
return Vl.create(this, this._def);
}
nullish() {
return this.nullable().optional();
}
array() {
return Xi.create(this);
}
promise() {
return op.create(this, this._def);
}
or(t) {
return np.create([this, t], this._def);
}
and(t) {
return sp.create(this, t, this._def);
}
transform(t) {
return new ql({
...ze(this._def),
schema: this,
typeName: Ye.ZodEffects,
effect: { type: "transform", transform: t }
});
}
default(t) {
const r = typeof t == "function" ? t : () => t;
return new pO({
...ze(this._def),
innerType: this,
defaultValue: r,
typeName: Ye.ZodDefault
});
}
brand() {
return new yW({
typeName: Ye.ZodBranded,
type: this,
...ze(this._def)
});
}
catch(t) {
const r = typeof t == "function" ? t : () => t;
return new RO({
...ze(this._def),
innerType: this,
catchValue: r,
typeName: Ye.ZodCatch
});
}
describe(t) {
const r = this.constructor;
return new r({
...this._def,
description: t
});
}
pipe(t) {
return db.create(this, t);
}
readonly() {
return AO.create(this);
}
isOptional() {
return this.safeParse(void 0).success;
}
isNullable() {
return this.safeParse(null).success;
}
}
const z4 = /^c[^\s-]{8,}$/i, Z4 = /^[0-9a-z]+$/, J4 = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Q4 = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, eW = /^[a-z0-9_-]{21}$/i, tW = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, rW = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, nW = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, sW = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
let mI;
const iW = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, oW = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, uW = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, aW = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, cW = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, fW = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, kx = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", lW = new RegExp(`^${kx}$`);
function Hx(e) {
let t = "[0-5]\\d";
e.precision ? t = `${t}\\.\\d{${e.precision}}` : e.precision == null && (t = `${t}(\\.\\d+)?`);
const r = e.precision ? "+" : "?";
return `([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`;
}
function dW(e) {
return new RegExp(`^${Hx(e)}$`);
}
function mW(e) {
let t = `${kx}T${Hx(e)}`;
const r = [];
return r.push(e.local ? "Z?" : "Z"), e.offset && r.push("([+-]\\d{2}:?\\d{2})"), t = `${t}(${r.join("|")})`, new RegExp(`^${t}$`);
}
function hW(e, t) {
return !!((t === "v4" || !t) && iW.test(e) || (t === "v6" || !t) && uW.test(e));
}
function _W(e, t) {
if (!tW.test(e))
return !1;
try {
const [r] = e.split("."), n = r.replace(/-/g, "+").replace(/_/g, "/").padEnd(r.length + (4 - r.length % 4) % 4, "="), s = JSON.parse(atob(n));
return !(typeof s != "object" || s === null || "typ" in s && (s == null ? void 0 : s.typ) !== "JWT" || !s.alg || t && s.alg !== t);
} catch {
return !1;
}
}
function gW(e, t) {
return !!((t === "v4" || !t) && oW.test(e) || (t === "v6" || !t) && aW.test(e));
}
class Uo extends dt {
_parse(t) {
if (this._def.coerce && (t.data = String(t.data)), this._getType(t) !== Ee.string) {
const i = this._getOrReturnCtx(t);
return me(i, {
code: ne.invalid_type,
expected: Ee.string,
received: i.parsedType
}), Ge;
}
const n = new Rn();
let s;
for (const i of this._def.checks)
if (i.kind === "min")
t.data.length < i.value && (s = this._getOrReturnCtx(t, s), me(s, {
code: ne.too_small,
minimum: i.value,
type: "string",
inclusive: !0,
exact: !1,
message: i.message
}), n.dirty());
else if (i.kind === "max")
t.data.length > i.value && (s = this._getOrReturnCtx(t, s), me(s, {
code: ne.too_big,
maximum: i.value,
type: "string