docs: 仓库链接指向本镜像仓库
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run

This commit is contained in:
TanTan committed 2026-11-13 09:27:07 +08:00
1 parent fa9c73363d
commit 2a69b23b47
18210 files changed
+5101211 -16

No files matched your search

@@ -0,0 +1,104 @@
import { parseBody } from "../../utils/body.js";
//#region src/middleware/method-override/index.ts
const DEFAULT_METHOD_FORM_NAME = "_method";
/**
* Method Override Middleware for Hono.
*
* @see {@link https://hono.dev/docs/middleware/builtin/method-override}
*
* @param {MethodOverrideOptions} options - The options for the method override middleware.
* @param {Hono} options.app - The instance of Hono is used in your application.
* @param {string} [options.form=_method] - Form key with a value containing the method name.
* @param {string} [options.header] - Header name with a value containing the method name.
* @param {string} [options.query] - Query parameter key with a value containing the method name.
* @returns {MiddlewareHandler} The middleware handler function.
*
* @example
* ```ts
* const app = new Hono()
*
* // If no options are specified, the value of `_method` in the form,
* // e.g. DELETE, is used as the method.
* app.use('/posts', methodOverride({ app }))
*
* app.delete('/posts', (c) => {
* // ....
* })
* ```
*/
const methodOverride = (options) => async function methodOverride(c, next) {
if (c.req.method === "GET") return await next();
const app = options.app;
if (!(options.header || options.query)) {
const contentType = c.req.header("content-type");
const methodFormName = options.form || DEFAULT_METHOD_FORM_NAME;
const clonedRequest = c.req.raw.clone();
const newRequest = clonedRequest.clone();
if (contentType?.startsWith("multipart/form-data")) {
const method = (await clonedRequest.formData()).get(methodFormName);
if (method) {
const newForm = await newRequest.formData();
newForm.delete(methodFormName);
const newHeaders = new Headers(clonedRequest.headers);
newHeaders.delete("content-type");
newHeaders.delete("content-length");
const request = new Request(c.req.url, {
body: newForm,
headers: newHeaders,
method
});
return app.fetch(request, c.env, getExecutionCtx(c));
}
}
if (contentType?.startsWith("application/x-www-form-urlencoded")) {
const params = await parseBody(clonedRequest);
const method = params[methodFormName];
if (method) {
delete params[methodFormName];
const newParams = new URLSearchParams(params);
const request = new Request(newRequest, {
body: newParams,
method
});
return app.fetch(request, c.env, getExecutionCtx(c));
}
}
} else if (options.header) {
const headerName = options.header;
const method = c.req.header(headerName);
if (method) {
const newHeaders = new Headers(c.req.raw.headers);
newHeaders.delete(headerName);
const request = new Request(c.req.raw, {
headers: newHeaders,
method
});
return app.fetch(request, c.env, getExecutionCtx(c));
}
} else if (options.query) {
const queryName = options.query;
const method = c.req.query(queryName);
if (method) {
const url = new URL(c.req.url);
url.searchParams.delete(queryName);
const requestInit = {
body: c.req.raw.body,
headers: c.req.raw.headers,
method,
duplex: c.req.raw.body ? "half" : void 0
};
const request = new Request(url.toString(), requestInit);
return app.fetch(request, c.env, getExecutionCtx(c));
}
}
await next();
};
const getExecutionCtx = (c) => {
let executionCtx;
try {
executionCtx = c.executionCtx;
} catch {}
return executionCtx;
};
//#endregion
export { methodOverride };
@@ -0,0 +1,623 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var events = require('events');
function toArr(any) {
return any == null ? [] : Array.isArray(any) ? any : [any];
}
function toVal(out, key, val, opts) {
var x, old=out[key], nxt=(
!!~opts.string.indexOf(key) ? (val == null || val === true ? '' : String(val))
: typeof val === 'boolean' ? val
: !!~opts.boolean.indexOf(key) ? (val === 'false' ? false : val === 'true' || (out._.push((x = +val,x * 0 === 0) ? x : val),!!val))
: (x = +val,x * 0 === 0) ? x : val
);
out[key] = old == null ? nxt : (Array.isArray(old) ? old.concat(nxt) : [old, nxt]);
}
function mri2 (args, opts) {
args = args || [];
opts = opts || {};
var k, arr, arg, name, val, out={ _:[] };
var i=0, j=0, idx=0, len=args.length;
const alibi = opts.alias !== void 0;
const strict = opts.unknown !== void 0;
const defaults = opts.default !== void 0;
opts.alias = opts.alias || {};
opts.string = toArr(opts.string);
opts.boolean = toArr(opts.boolean);
if (alibi) {
for (k in opts.alias) {
arr = opts.alias[k] = toArr(opts.alias[k]);
for (i=0; i < arr.length; i++) {
(opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
}
}
}
for (i=opts.boolean.length; i-- > 0;) {
arr = opts.alias[opts.boolean[i]] || [];
for (j=arr.length; j-- > 0;) opts.boolean.push(arr[j]);
}
for (i=opts.string.length; i-- > 0;) {
arr = opts.alias[opts.string[i]] || [];
for (j=arr.length; j-- > 0;) opts.string.push(arr[j]);
}
if (defaults) {
for (k in opts.default) {
name = typeof opts.default[k];
arr = opts.alias[k] = opts.alias[k] || [];
if (opts[name] !== void 0) {
opts[name].push(k);
for (i=0; i < arr.length; i++) {
opts[name].push(arr[i]);
}
}
}
}
const keys = strict ? Object.keys(opts.alias) : [];
for (i=0; i < len; i++) {
arg = args[i];
if (arg === '--') {
out._ = out._.concat(args.slice(++i));
break;
}
for (j=0; j < arg.length; j++) {
if (arg.charCodeAt(j) !== 45) break; // "-"
}
if (j === 0) {
out._.push(arg);
} else if (arg.substring(j, j + 3) === 'no-') {
name = arg.substring(j + 3);
if (strict && !~keys.indexOf(name)) {
return opts.unknown(arg);
}
out[name] = false;
} else {
for (idx=j+1; idx < arg.length; idx++) {
if (arg.charCodeAt(idx) === 61) break; // "="
}
name = arg.substring(j, idx);
val = arg.substring(++idx) || (i+1 === len || (''+args[i+1]).charCodeAt(0) === 45 || args[++i]);
arr = (j === 2 ? [name] : name);
for (idx=0; idx < arr.length; idx++) {
name = arr[idx];
if (strict && !~keys.indexOf(name)) return opts.unknown('-'.repeat(j) + name);
toVal(out, name, (idx + 1 < arr.length) || val, opts);
}
}
}
if (defaults) {
for (k in opts.default) {
if (out[k] === void 0) {
out[k] = opts.default[k];
}
}
}
if (alibi) {
for (k in out) {
arr = opts.alias[k] || [];
while (arr.length > 0) {
out[arr.shift()] = out[k];
}
}
}
return out;
}
const removeBrackets = (v) => v.replace(/[<[].+/, "").trim();
const findAllBrackets = (v) => {
const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;
const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g;
const res = [];
const parse = (match) => {
let variadic = false;
let value = match[1];
if (value.startsWith("...")) {
value = value.slice(3);
variadic = true;
}
return {
required: match[0].startsWith("<"),
value,
variadic
};
};
let angledMatch;
while (angledMatch = ANGLED_BRACKET_RE_GLOBAL.exec(v)) {
res.push(parse(angledMatch));
}
let squareMatch;
while (squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v)) {
res.push(parse(squareMatch));
}
return res;
};
const getMriOptions = (options) => {
const result = {alias: {}, boolean: []};
for (const [index, option] of options.entries()) {
if (option.names.length > 1) {
result.alias[option.names[0]] = option.names.slice(1);
}
if (option.isBoolean) {
if (option.negated) {
const hasStringTypeOption = options.some((o, i) => {
return i !== index && o.names.some((name) => option.names.includes(name)) && typeof o.required === "boolean";
});
if (!hasStringTypeOption) {
result.boolean.push(option.names[0]);
}
} else {
result.boolean.push(option.names[0]);
}
}
}
return result;
};
const findLongest = (arr) => {
return arr.sort((a, b) => {
return a.length > b.length ? -1 : 1;
})[0];
};
const padRight = (str, length) => {
return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
};
const camelcase = (input) => {
return input.replace(/([a-z])-([a-z])/g, (_, p1, p2) => {
return p1 + p2.toUpperCase();
});
};
const setDotProp = (obj, keys, val) => {
let i = 0;
let length = keys.length;
let t = obj;
let x;
for (; i < length; ++i) {
x = t[keys[i]];
t = t[keys[i]] = i === length - 1 ? val : x != null ? x : !!~keys[i + 1].indexOf(".") || !(+keys[i + 1] > -1) ? {} : [];
}
};
const setByType = (obj, transforms) => {
for (const key of Object.keys(transforms)) {
const transform = transforms[key];
if (transform.shouldTransform) {
obj[key] = Array.prototype.concat.call([], obj[key]);
if (typeof transform.transformFunction === "function") {
obj[key] = obj[key].map(transform.transformFunction);
}
}
}
};
const getFileName = (input) => {
const m = /([^\\\/]+)$/.exec(input);
return m ? m[1] : "";
};
const camelcaseOptionName = (name) => {
return name.split(".").map((v, i) => {
return i === 0 ? camelcase(v) : v;
}).join(".");
};
class CACError extends Error {
constructor(message) {
super(message);
this.name = this.constructor.name;
if (typeof Error.captureStackTrace === "function") {
Error.captureStackTrace(this, this.constructor);
} else {
this.stack = new Error(message).stack;
}
}
}
class Option {
constructor(rawName, description, config) {
this.rawName = rawName;
this.description = description;
this.config = Object.assign({}, config);
rawName = rawName.replace(/\.\*/g, "");
this.negated = false;
this.names = removeBrackets(rawName).split(",").map((v) => {
let name = v.trim().replace(/^-{1,2}/, "");
if (name.startsWith("no-")) {
this.negated = true;
name = name.replace(/^no-/, "");
}
return camelcaseOptionName(name);
}).sort((a, b) => a.length > b.length ? 1 : -1);
this.name = this.names[this.names.length - 1];
if (this.negated && this.config.default == null) {
this.config.default = true;
}
if (rawName.includes("<")) {
this.required = true;
} else if (rawName.includes("[")) {
this.required = false;
} else {
this.isBoolean = true;
}
}
}
const processArgs = process.argv;
const platformInfo = `${process.platform}-${process.arch} node-${process.version}`;
class Command {
constructor(rawName, description, config = {}, cli) {
this.rawName = rawName;
this.description = description;
this.config = config;
this.cli = cli;
this.options = [];
this.aliasNames = [];
this.name = removeBrackets(rawName);
this.args = findAllBrackets(rawName);
this.examples = [];
}
usage(text) {
this.usageText = text;
return this;
}
allowUnknownOptions() {
this.config.allowUnknownOptions = true;
return this;
}
ignoreOptionDefaultValue() {
this.config.ignoreOptionDefaultValue = true;
return this;
}
version(version, customFlags = "-v, --version") {
this.versionNumber = version;
this.option(customFlags, "Display version number");
return this;
}
example(example) {
this.examples.push(example);
return this;
}
option(rawName, description, config) {
const option = new Option(rawName, description, config);
this.options.push(option);
return this;
}
alias(name) {
this.aliasNames.push(name);
return this;
}
action(callback) {
this.commandAction = callback;
return this;
}
isMatched(name) {
return this.name === name || this.aliasNames.includes(name);
}
get isDefaultCommand() {
return this.name === "" || this.aliasNames.includes("!");
}
get isGlobalCommand() {
return this instanceof GlobalCommand;
}
hasOption(name) {
name = name.split(".")[0];
return this.options.find((option) => {
return option.names.includes(name);
});
}
outputHelp() {
const {name, commands} = this.cli;
const {
versionNumber,
options: globalOptions,
helpCallback
} = this.cli.globalCommand;
let sections = [
{
body: `${name}${versionNumber ? `/${versionNumber}` : ""}`
}
];
sections.push({
title: "Usage",
body: ` $ ${name} ${this.usageText || this.rawName}`
});
const showCommands = (this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0;
if (showCommands) {
const longestCommandName = findLongest(commands.map((command) => command.rawName));
sections.push({
title: "Commands",
body: commands.map((command) => {
return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
}).join("\n")
});
sections.push({
title: `For more info, run any command with the \`--help\` flag`,
body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join("\n")
});
}
let options = this.isGlobalCommand ? globalOptions : [...this.options, ...globalOptions || []];
if (!this.isGlobalCommand && !this.isDefaultCommand) {
options = options.filter((option) => option.name !== "version");
}
if (options.length > 0) {
const longestOptionName = findLongest(options.map((option) => option.rawName));
sections.push({
title: "Options",
body: options.map((option) => {
return ` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${option.config.default === void 0 ? "" : `(default: ${option.config.default})`}`;
}).join("\n")
});
}
if (this.examples.length > 0) {
sections.push({
title: "Examples",
body: this.examples.map((example) => {
if (typeof example === "function") {
return example(name);
}
return example;
}).join("\n")
});
}
if (helpCallback) {
sections = helpCallback(sections) || sections;
}
console.log(sections.map((section) => {
return section.title ? `${section.title}:
${section.body}` : section.body;
}).join("\n\n"));
}
outputVersion() {
const {name} = this.cli;
const {versionNumber} = this.cli.globalCommand;
if (versionNumber) {
console.log(`${name}/${versionNumber} ${platformInfo}`);
}
}
checkRequiredArgs() {
const minimalArgsCount = this.args.filter((arg) => arg.required).length;
if (this.cli.args.length < minimalArgsCount) {
throw new CACError(`missing required args for command \`${this.rawName}\``);
}
}
checkUnknownOptions() {
const {options, globalCommand} = this.cli;
if (!this.config.allowUnknownOptions) {
for (const name of Object.keys(options)) {
if (name !== "--" && !this.hasOption(name) && !globalCommand.hasOption(name)) {
throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);
}
}
}
}
checkOptionValue() {
const {options: parsedOptions, globalCommand} = this.cli;
const options = [...globalCommand.options, ...this.options];
for (const option of options) {
const value = parsedOptions[option.name.split(".")[0]];
if (option.required) {
const hasNegated = options.some((o) => o.negated && o.names.includes(option.name));
if (value === true || value === false && !hasNegated) {
throw new CACError(`option \`${option.rawName}\` value is missing`);
}
}
}
}
}
class GlobalCommand extends Command {
constructor(cli) {
super("@@global@@", "", {}, cli);
}
}
var __assign = Object.assign;
class CAC extends events.EventEmitter {
constructor(name = "") {
super();
this.name = name;
this.commands = [];
this.rawArgs = [];
this.args = [];
this.options = {};
this.globalCommand = new GlobalCommand(this);
this.globalCommand.usage("<command> [options]");
}
usage(text) {
this.globalCommand.usage(text);
return this;
}
command(rawName, description, config) {
const command = new Command(rawName, description || "", config, this);
command.globalCommand = this.globalCommand;
this.commands.push(command);
return command;
}
option(rawName, description, config) {
this.globalCommand.option(rawName, description, config);
return this;
}
help(callback) {
this.globalCommand.option("-h, --help", "Display this message");
this.globalCommand.helpCallback = callback;
this.showHelpOnExit = true;
return this;
}
version(version, customFlags = "-v, --version") {
this.globalCommand.version(version, customFlags);
this.showVersionOnExit = true;
return this;
}
example(example) {
this.globalCommand.example(example);
return this;
}
outputHelp() {
if (this.matchedCommand) {
this.matchedCommand.outputHelp();
} else {
this.globalCommand.outputHelp();
}
}
outputVersion() {
this.globalCommand.outputVersion();
}
setParsedInfo({args, options}, matchedCommand, matchedCommandName) {
this.args = args;
this.options = options;
if (matchedCommand) {
this.matchedCommand = matchedCommand;
}
if (matchedCommandName) {
this.matchedCommandName = matchedCommandName;
}
return this;
}
unsetMatchedCommand() {
this.matchedCommand = void 0;
this.matchedCommandName = void 0;
}
parse(argv = processArgs, {
run = true
} = {}) {
this.rawArgs = argv;
if (!this.name) {
this.name = argv[1] ? getFileName(argv[1]) : "cli";
}
let shouldParse = true;
for (const command of this.commands) {
const parsed = this.mri(argv.slice(2), command);
const commandName = parsed.args[0];
if (command.isMatched(commandName)) {
shouldParse = false;
const parsedInfo = __assign(__assign({}, parsed), {
args: parsed.args.slice(1)
});
this.setParsedInfo(parsedInfo, command, commandName);
this.emit(`command:${commandName}`, command);
}
}
if (shouldParse) {
for (const command of this.commands) {
if (command.name === "") {
shouldParse = false;
const parsed = this.mri(argv.slice(2), command);
this.setParsedInfo(parsed, command);
this.emit(`command:!`, command);
}
}
}
if (shouldParse) {
const parsed = this.mri(argv.slice(2));
this.setParsedInfo(parsed);
}
if (this.options.help && this.showHelpOnExit) {
this.outputHelp();
run = false;
this.unsetMatchedCommand();
}
if (this.options.version && this.showVersionOnExit && this.matchedCommandName == null) {
this.outputVersion();
run = false;
this.unsetMatchedCommand();
}
const parsedArgv = {args: this.args, options: this.options};
if (run) {
this.runMatchedCommand();
}
if (!this.matchedCommand && this.args[0]) {
this.emit("command:*");
}
return parsedArgv;
}
mri(argv, command) {
const cliOptions = [
...this.globalCommand.options,
...command ? command.options : []
];
const mriOptions = getMriOptions(cliOptions);
let argsAfterDoubleDashes = [];
const doubleDashesIndex = argv.indexOf("--");
if (doubleDashesIndex > -1) {
argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);
argv = argv.slice(0, doubleDashesIndex);
}
let parsed = mri2(argv, mriOptions);
parsed = Object.keys(parsed).reduce((res, name) => {
return __assign(__assign({}, res), {
[camelcaseOptionName(name)]: parsed[name]
});
}, {_: []});
const args = parsed._;
const options = {
"--": argsAfterDoubleDashes
};
const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;
let transforms = Object.create(null);
for (const cliOption of cliOptions) {
if (!ignoreDefault && cliOption.config.default !== void 0) {
for (const name of cliOption.names) {
options[name] = cliOption.config.default;
}
}
if (Array.isArray(cliOption.config.type)) {
if (transforms[cliOption.name] === void 0) {
transforms[cliOption.name] = Object.create(null);
transforms[cliOption.name]["shouldTransform"] = true;
transforms[cliOption.name]["transformFunction"] = cliOption.config.type[0];
}
}
}
for (const key of Object.keys(parsed)) {
if (key !== "_") {
const keys = key.split(".");
setDotProp(options, keys, parsed[key]);
setByType(options, transforms);
}
}
return {
args,
options
};
}
runMatchedCommand() {
const {args, options, matchedCommand: command} = this;
if (!command || !command.commandAction)
return;
command.checkUnknownOptions();
command.checkOptionValue();
command.checkRequiredArgs();
const actionArgs = [];
command.args.forEach((arg, index) => {
if (arg.variadic) {
actionArgs.push(args.slice(index));
} else {
actionArgs.push(args[index]);
}
});
actionArgs.push(options);
return command.commandAction.apply(this, actionArgs);
}
}
const cac = (name = "") => new CAC(name);
exports.CAC = CAC;
exports.Command = Command;
exports.cac = cac;
exports.default = cac;
@@ -0,0 +1,69 @@
"use strict";
/**
* Cloudflare Worker-compatible JSON Schema validator provider
*
* This provider uses @cfworker/json-schema for validation without code generation,
* making it compatible with edge runtimes like Cloudflare Workers that restrict
* eval and new Function.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.CfWorkerJsonSchemaValidator = void 0;
const json_schema_1 = require("@cfworker/json-schema");
/**
*
* @example
* ```typescript
* // Use with default configuration (2020-12, shortcircuit)
* const validator = new CfWorkerJsonSchemaValidator();
*
* // Use with custom configuration
* const validator = new CfWorkerJsonSchemaValidator({
* draft: '2020-12',
* shortcircuit: false // Report all errors
* });
* ```
*/
class CfWorkerJsonSchemaValidator {
/**
* Create a validator
*
* @param options - Configuration options
* @param options.shortcircuit - If true, stop validation after first error (default: true)
* @param options.draft - JSON Schema draft version to use (default: '2020-12')
*/
constructor(options) {
this.shortcircuit = options?.shortcircuit ?? true;
this.draft = options?.draft ?? '2020-12';
}
/**
* Create a validator for the given JSON Schema
*
* Unlike AJV, this validator is not cached internally
*
* @param schema - Standard JSON Schema object
* @returns A validator function that validates input data
*/
getValidator(schema) {
// Cast to the cfworker Schema type - our JsonSchemaType is structurally compatible
const validator = new json_schema_1.Validator(schema, this.draft, this.shortcircuit);
return (input) => {
const result = validator.validate(input);
if (result.valid) {
return {
valid: true,
data: input,
errorMessage: undefined
};
}
else {
return {
valid: false,
data: undefined,
errorMessage: result.errors.map(err => `${err.instanceLocation}: ${err.error}`).join('; ')
};
}
};
}
}
exports.CfWorkerJsonSchemaValidator = CfWorkerJsonSchemaValidator;
//# sourceMappingURL=cfworker-provider.js.map
@@ -0,0 +1 @@
{"version":3,"sources":["../lib/v4/isZodErrorLike.ts","../lib/v4/ValidationError.ts","../lib/v4/isValidationError.ts","../lib/v4/isValidationErrorLike.ts","../lib/v4/errorMap/custom.ts","../lib/v4/errorMap/invalidElement.ts","../lib/v4/errorMap/invalidKey.ts","../lib/v4/errorMap/invalidStringFormat.ts","../lib/v4/errorMap/invalidType.ts","../lib/v4/errorMap/invalidUnion.ts","../lib/utils/stringify.ts","../lib/utils/joinValues.ts","../lib/v4/errorMap/invalidValue.ts","../lib/v4/errorMap/notMultipleOf.ts","../lib/v4/errorMap/tooBig.ts","../lib/v4/errorMap/tooSmall.ts","../lib/v4/errorMap/unrecognizedKeys.ts","../lib/v4/errorMap/errorMap.ts","../lib/utils/NonEmptyArray.ts","../lib/utils/joinPath.ts","../lib/utils/titleCase.ts","../lib/v4/MessageBuilder.ts","../lib/v4/fromZodError.ts","../lib/v4/toValidationError.ts","../lib/v4/fromError.ts","../lib/v4/fromZodIssue.ts"],"sourcesContent":["import type * as zod from 'zod/v4/core';\n\nexport function isZodErrorLike(err: unknown): err is zod.$ZodError {\n return (\n err instanceof Object &&\n 'name' in err &&\n (err.name === 'ZodError' || err.name === '$ZodError') &&\n 'issues' in err &&\n Array.isArray(err.issues)\n );\n}\n","import { isZodErrorLike } from './isZodErrorLike.ts';\nimport type * as zod from 'zod/v4/core';\n\nexport const ZOD_VALIDATION_ERROR_NAME = 'ZodValidationError';\n\n// make zod-validation-error compatible with\n// earlier to es2022 typescript configurations\n// @see https://github.com/causaly/zod-validation-error/issues/226\nexport interface ErrorOptions {\n cause?: unknown;\n}\n\nexport class ValidationError extends Error {\n name: typeof ZOD_VALIDATION_ERROR_NAME;\n details: Array<zod.$ZodIssue>;\n\n constructor(message?: string, options?: ErrorOptions) {\n super(message, options);\n this.name = ZOD_VALIDATION_ERROR_NAME;\n this.details = getIssuesFromErrorOptions(options);\n }\n\n toString(): string {\n return this.message;\n }\n}\n\nfunction getIssuesFromErrorOptions(\n options?: ErrorOptions\n): Array<zod.$ZodIssue> {\n if (options) {\n const cause = options.cause;\n if (isZodErrorLike(cause)) {\n return cause.issues;\n }\n }\n\n return [];\n}\n","import { ValidationError } from './ValidationError.ts';\n\nexport function isValidationError(err: unknown): err is ValidationError {\n return err instanceof ValidationError;\n}\n","import {\n ZOD_VALIDATION_ERROR_NAME,\n type ValidationError,\n} from './ValidationError.ts';\n\nexport function isValidationErrorLike(err: unknown): err is ValidationError {\n return err instanceof Error && err.name === ZOD_VALIDATION_ERROR_NAME;\n}\n","import type * as zod from 'zod/v4/core';\nimport type { AbstractSyntaxTree } from './types.ts';\n\nexport function parseCustomIssue(\n issue: zod.$ZodRawIssue<zod.$ZodIssueCustom>\n): AbstractSyntaxTree {\n return {\n type: issue.code,\n path: issue.path,\n message: issue.message ?? 'Invalid input',\n };\n}\n","import type * as zod from 'zod/v4/core';\nimport type { AbstractSyntaxTree } from './types.ts';\n\nexport function parseInvalidElementIssue(\n issue: zod.$ZodRawIssue<zod.$ZodIssueInvalidElement>\n): AbstractSyntaxTree {\n return {\n type: issue.code,\n path: issue.path,\n message: `unexpected element in ${issue.origin}`,\n };\n}\n","import type * as zod from 'zod/v4/core';\nimport type { AbstractSyntaxTree } from './types.ts';\n\nexport function parseInvalidKeyIssue(\n issue: zod.$ZodRawIssue<zod.$ZodIssueInvalidKey>\n): AbstractSyntaxTree {\n return {\n type: issue.code,\n path: issue.path,\n message: `unexpected key in ${issue.origin}`,\n };\n}\n","import type { AbstractSyntaxTree, ErrorMapOptions } from './types.ts';\nimport type * as zod from 'zod/v4/core';\n\nexport function parseInvalidStringFormatIssue(\n issue: zod.$ZodRawIssue<zod.$ZodIssueInvalidStringFormat>,\n options: Pick<ErrorMapOptions, 'displayInvalidFormatDetails'> = {\n displayInvalidFormatDetails: false,\n }\n): AbstractSyntaxTree {\n switch (issue.format) {\n case 'lowercase':\n case 'uppercase':\n return {\n type: issue.code,\n path: issue.path,\n message: `value must be in ${issue.format} format`,\n };\n default: {\n if (isZodIssueStringStartsWith(issue)) {\n return parseStringStartsWith(issue);\n }\n if (isZodIssueStringEndsWith(issue)) {\n return parseStringEndsWith(issue);\n }\n if (isZodIssueStringIncludes(issue)) {\n return parseStringIncludes(issue);\n }\n if (isZodIssueStringInvalidRegex(issue)) {\n return parseStringInvalidRegex(issue, options);\n }\n if (isZodIssueStringInvalidJWT(issue)) {\n return parseStringInvalidJWT(issue, options);\n }\n\n return {\n type: issue.code,\n path: issue.path,\n message: `invalid ${issue.format}`,\n };\n }\n }\n}\nfunction isZodIssueStringStartsWith(\n issue: zod.$ZodRawIssue<zod.$ZodIsLine truncated
@@ -0,0 +1,28 @@
MIT License
Cookie-es copyright (c) Pooya Parsa <pooya@pi0.io>
Cookie parsing based on https://github.com/jshttp/cookie
Copyright (c) 2012-2014 Roman Shtylman <shtylman@gmail.com>
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
Set-Cookie parsing based on https://github.com/nfriedly/set-cookie-parser
Copyright (c) 2015 Nathan Friedly <nathan@nfriedly.com> (http://nfriedly.com/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,16 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const CircleCheck = createLucideIcon("CircleCheck", [
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
]);
export { CircleCheck as default };
//# sourceMappingURL=circle-check.js.map
@@ -0,0 +1,375 @@
flf2a 1 1 10 -1 16
B1FF by Joe Rumsey 12/94 based on Terminal by Glenn Chappell
Includes characters 128-255
figlet release 2.1 -- 12 Aug 1994
Permission is hereby given to modify this font, as long as the
modifier's name is placed on a comment line.
Explanation of first line:
flf2 - "magic number" for file identification
a - should always be `a', for now
 - the "hardblank" -- prints as a blank, but can't be smushed
1 - height of a character
1 - height of a character, not including descenders
10 - max line length (excluding comment lines) + a fudge factor
-1 - default smushmode for this font
16 - number of comment lines
@
!@
"@
#@
$@
%@
&@
'@
(@
)@
*@
+@
,@
-@
.@
/@
0@
1@
2@
3@
4@
5@
6@
7@
8@
9@
:@
;@
<@
=@
>@
?@
@#
/-\@
|3@
(@
|)@
3@
F@
6@
H@
1@
_/@
/<@
|_@
/\/\@
/\/@
0@
P@
Q@
R@
5@
T@
|_|@
\/@
\/\/@
X@
Y@
Z@
[@
\@
]@
^@
_@
`@
/-\@
|3@
(@
|)@
3@
F@
6@
H@
1@
_/@
/<@
|_@
/\/\@
/\/@
0@
P@
Q@
R@
5@
T@
|_|@
\/@
\/\/@
X@
Y@
Z@
{@
|@
}@
~@
願
淐
軹
裰
蠩
廹
稛
128
�@
129
�
130
�
131
�
132
�
133
�
134
�
135
䏰
136
㇀
137
𪎩
138
𧶄
139
𣏴
140
倻
141
𠮟
142
𣻗
143
蕋
144
趩
145
𥜆
146
𡏆
147
媁
148
銉
149
𦅜
150
桇
151
愌
152
𦴦
153
䄉
154
鋣
155
𡨭
156
嵛
157
𨆉
158
𠺢
159
籖
160
𨩚
161
 
162
\
163
w
164
一
165
世
166
共
167
作
168
杓
169
咖
170
昇
171
陂
172
拯
173
耐
174
哦
175
浬
176
虔
177
娼
178
毫
179
莆
180
婷
181
溉
182
詔
183
媳
184
睹
185
辟
186
愿
187
罰
188
劇
189
瑾
190
輥
191
濃
192
錐
193
瞧
194
駿
195
鞭
196
願
197
護
198
讖
199
す
200
Л
201
乂
202
汌
203
杙
204
坨
205
泒
206
哃
207
柜
208
穾
209
唊
210
毨
211
笄
212
酎
213
崰
214
淐
215
耞
216
釫
217
惲
218
湨
219
罦
220
軹
221
媷
222
毹
223
稛
224
觡
225
凘
226
榠
227
禗
228
裰
229
噚
230
澍
231
膞
232
踔
233
噳
234
澢
235
蕀
236
錋
237
檕
238
蕷
239
鞞
240
璸
241
蹛
242
徿
243
譑
244
嚵
245
鏼
246
蠩
247
糴
248
讌
249
纘
250
𠕇
251
𨦼
252
廹
253
𣑯
254
鑂
255
�@
@@ -0,0 +1,90 @@
'use strict';
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
const INDENT = ' ';
function attrString(attrs) {
return Object.entries(attrs || {})
.map(([k, v]) => ` ${k}="${v}"`)
.join('');
}
/**
* a utility class to produce well-formed, indented XML
* @param {ContentWriter} contentWriter the content writer that this utility wraps
* @constructor
*/
class XMLWriter {
constructor(contentWriter) {
this.cw = contentWriter;
this.stack = [];
}
indent(str) {
return this.stack.map(() => INDENT).join('') + str;
}
/**
* writes the opening XML tag with the supplied attributes
* @param {String} name tag name
* @param {Object} [attrs=null] attrs attributes for the tag
*/
openTag(name, attrs) {
const str = this.indent(`<${name + attrString(attrs)}>`);
this.cw.println(str);
this.stack.push(name);
}
/**
* closes an open XML tag.
* @param {String} name - tag name to close. This must match the writer's
* notion of the tag that is currently open.
*/
closeTag(name) {
if (this.stack.length === 0) {
throw new Error(`Attempt to close tag ${name} when not opened`);
}
const stashed = this.stack.pop();
const str = `</${name}>`;
if (stashed !== name) {
throw new Error(
`Attempt to close tag ${name} when ${stashed} was the one open`
);
}
this.cw.println(this.indent(str));
}
/**
* writes a tag and its value opening and closing it at the same time
* @param {String} name tag name
* @param {Object} [attrs=null] attrs tag attributes
* @param {String} [content=null] content optional tag content
*/
inlineTag(name, attrs, content) {
let str = '<' + name + attrString(attrs);
if (content) {
str += `>${content}</${name}>`;
} else {
str += '/>';
}
str = this.indent(str);
this.cw.println(str);
}
/**
* closes all open tags and ends the document
*/
closeAll() {
this.stack
.slice()
.reverse()
.forEach(name => {
this.closeTag(name);
});
}
}
module.exports = XMLWriter;
@@ -0,0 +1,12 @@
'use strict'
async function rebuild (gyp, argv) {
gyp.todo.push(
{ name: 'clean', args: [] },
{ name: 'configure', args: argv },
{ name: 'build', args: [] }
)
}
module.exports = rebuild
module.exports.usage = 'Runs "clean", "configure" and "build" all at once'
@@ -0,0 +1,14 @@
import type { TypeOrValueSpecifier } from '../util';
export type Options = [
{
allow?: TypeOrValueSpecifier[];
checkParameterProperties?: boolean;
ignoreInferredTypes?: boolean;
treatMethodsAsReadonly?: boolean;
}
];
export type MessageIds = 'shouldBeReadonly';
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"shouldBeReadonly", Options, import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
name: string;
};
export default _default;
@@ -0,0 +1 @@
{"version":3,"file":"iteration-ccw.js","sources":["../../../src/icons/iteration-ccw.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name IterationCcw\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMjAgMTBjMC00LjQtMy42LTgtOC04cy04IDMuNi04IDggMy42IDggOCA4aDgiIC8+CiAgPHBvbHlsaW5lIHBvaW50cz0iMTYgMTQgMjAgMTggMTYgMjIiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/iteration-ccw\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst IterationCcw = createLucideIcon('IterationCcw', [\n ['path', { d: 'M20 10c0-4.4-3.6-8-8-8s-8 3.6-8 8 3.6 8 8 8h8', key: '4znkd0' }],\n ['polyline', { points: '16 14 20 18 16 22', key: '11njsm' }],\n]);\n\nexport default IterationCcw;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,iBAAiB,cAAgB,CAAA,CAAA,CAAA;AAAA,CAAA,CACpD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAiD,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,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC9E,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,CAAA,CAAA,CAAA,CAAE,QAAQ,CAAqB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC7D,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,26 @@
import type {CodeKeywordDefinition, KeywordErrorDefinition} from "../../types"
import type {KeywordCxt} from "../../compile/validate"
import {_, str, operators} from "../../compile/codegen"
const error: KeywordErrorDefinition = {
message({keyword, schemaCode}) {
const comp = keyword === "maxProperties" ? "more" : "fewer"
return str`must NOT have ${comp} than ${schemaCode} properties`
},
params: ({schemaCode}) => _`{limit: ${schemaCode}}`,
}
const def: CodeKeywordDefinition = {
keyword: ["maxProperties", "minProperties"],
type: "object",
schemaType: "number",
$data: true,
error,
code(cxt: KeywordCxt) {
const {keyword, data, schemaCode} = cxt
const op = keyword === "maxProperties" ? operators.GT : operators.LT
cxt.fail$data(_`Object.keys(${data}).length ${op} ${schemaCode}`)
},
}
export default def
@@ -0,0 +1,43 @@
"use client";
import { useConstant } from '../../utils/use-constant.mjs';
import { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';
import { animationControls } from './animation-controls.mjs';
/**
* Creates `LegacyAnimationControls`, which can be used to manually start, stop
* and sequence animations on one or more components.
*
* The returned `LegacyAnimationControls` should be passed to the `animate` property
* of the components you want to animate.
*
* These components can then be animated with the `start` method.
*
* ```jsx
* import * as React from 'react'
* import { motion, useAnimation } from 'framer-motion'
*
* export function MyComponent(props) {
* const controls = useAnimation()
*
* controls.start({
* x: 100,
* transition: { duration: 0.5 },
* })
*
* return <motion.div animate={controls} />
* }
* ```
*
* @returns Animation controller with `start` and `stop` methods
*
* @public
*/
function useAnimationControls() {
const controls = useConstant(animationControls);
useIsomorphicLayoutEffect(controls.mount, []);
return controls;
}
const useAnimation = useAnimationControls;
export { useAnimation, useAnimationControls };
//# sourceMappingURL=use-animation.mjs.map
@@ -0,0 +1,9 @@
const createHtmlRenderState = () => ({
style: {},
transform: {},
transformOrigin: {},
vars: {},
});
export { createHtmlRenderState };
//# sourceMappingURL=create-render-state.mjs.map
@@ -0,0 +1,232 @@
"use strict";
"use client";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var index_exports = {};
__export(index_exports, {
Content: () => Content,
List: () => List,
Root: () => Root2,
Tabs: () => Tabs,
TabsContent: () => TabsContent,
TabsList: () => TabsList,
TabsTrigger: () => TabsTrigger,
Trigger: () => Trigger,
createTabsScope: () => createTabsScope
});
module.exports = __toCommonJS(index_exports);
// src/tabs.tsx
var React = __toESM(require("react"));
var import_primitive = require("@radix-ui/primitive");
var import_react_context = require("@radix-ui/react-context");
var import_react_roving_focus = require("@radix-ui/react-roving-focus");
var import_react_presence = require("@radix-ui/react-presence");
var import_react_primitive = require("@radix-ui/react-primitive");
var RovingFocusGroup = __toESM(require("@radix-ui/react-roving-focus"));
var import_react_direction = require("@radix-ui/react-direction");
var import_react_use_controllable_state = require("@radix-ui/react-use-controllable-state");
var import_react_id = require("@radix-ui/react-id");
var import_jsx_runtime = require("react/jsx-runtime");
var TABS_NAME = "Tabs";
var [createTabsContext, createTabsScope] = (0, import_react_context.createContextScope)(TABS_NAME, [
import_react_roving_focus.createRovingFocusGroupScope
]);
var useRovingFocusGroupScope = (0, import_react_roving_focus.createRovingFocusGroupScope)();
var [TabsProvider, useTabsContext] = createTabsContext(TABS_NAME);
var Tabs = React.forwardRef(
(props, forwardedRef) => {
const {
__scopeTabs,
value: valueProp,
onValueChange,
defaultValue,
orientation = "horizontal",
dir,
activationMode = "automatic",
...tabsProps
} = props;
const direction = (0, import_react_direction.useDirection)(dir);
const [value, setValue] = (0, import_react_use_controllable_state.useControllableState)({
prop: valueProp,
onChange: onValueChange,
defaultProp: defaultValue ?? "",
caller: TABS_NAME
});
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
TabsProvider,
{
scope: __scopeTabs,
baseId: (0, import_react_id.useId)(),
value,
onValueChange: setValue,
orientation,
dir: direction,
activationMode,
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_primitive.Primitive.div,
{
dir: direction,
"data-orientation": orientation,
...tabsProps,
ref: forwardedRef
}
)
}
);
}
);
Tabs.displayName = TABS_NAME;
var TAB_LIST_NAME = "TabsList";
var TabsList = React.forwardRef(
(props, forwardedRef) => {
const { __scopeTabs, loop = true, ...listProps } = props;
const context = useTabsContext(TAB_LIST_NAME, __scopeTabs);
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
RovingFocusGroup.Root,
{
asChild: true,
...rovingFocusGroupScope,
orientation: context.orientation,
dir: context.dir,
loop,
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_primitive.Primitive.div,
{
role: "tablist",
"aria-orientation": context.orientation,
...listProps,
ref: forwardedRef
}
)
}
);
}
);
TabsList.displayName = TAB_LIST_NAME;
var TRIGGER_NAME = "TabsTrigger";
var TabsTrigger = React.forwardRef(
(props, forwardedRef) => {
const { __scopeTabs, value, disabled = false, ...triggerProps } = props;
const context = useTabsContext(TRIGGER_NAME, __scopeTabs);
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);
const triggerId = makeTriggerId(context.baseId, value);
const contentId = makeContentId(context.baseId, value);
const isSelected = value === context.value;
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
RovingFocusGroup.Item,
{
asChild: true,
...rovingFocusGroupScope,
focusable: !disabled,
active: isSelected,
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_primitive.Primitive.button,
{
type: "button",
role: "tab",
"aria-selected": isSelected,
"aria-controls": contentId,
"data-state": isSelected ? "active" : "inactive",
"data-disabled": disabled ? "" : void 0,
disabled,
id: triggerId,
...triggerProps,
ref: forwardedRef,
onMouseDown: (0, import_primitive.composeEventHandlers)(props.onMouseDown, (event) => {
if (!disabled && event.button === 0 && event.ctrlKey === false) {
context.onValueChange(value);
} else {
event.preventDefault();
}
}),
onKeyDown: (0, import_primitive.composeEventHandlers)(props.onKeyDown, (event) => {
if ([" ", "Enter"].includes(event.key)) context.onValueChange(value);
}),
onFocus: (0, import_primitive.composeEventHandlers)(props.onFocus, () => {
const isAutomaticActivation = context.activationMode !== "manual";
if (!isSelected && !disabled && isAutomaticActivation) {
context.onValueChange(value);
}
})
}
)
}
);
}
);
TabsTrigger.displayName = TRIGGER_NAME;
var CONTENT_NAME = "TabsContent";
var TabsContent = React.forwardRef(
(props, forwardedRef) => {
const { __scopeTabs, value, forceMount, children, ...contentProps } = props;
const context = useTabsContext(CONTENT_NAME, __scopeTabs);
const triggerId = makeTriggerId(context.baseId, value);
const contentId = makeContentId(context.baseId, value);
const isSelected = value === context.value;
const isMountAnimationPreventedRef = React.useRef(isSelected);
React.useEffect(() => {
const rAF = requestAnimationFrame(() => isMountAnimationPreventedRef.current = false);
return () => cancelAnimationFrame(rAF);
}, []);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || isSelected, children: ({ present }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_primitive.Primitive.div,
{
"data-state": isSelected ? "active" : "inactive",
"data-orientation": context.orientation,
role: "tabpanel",
"aria-labelledby": triggerId,
hidden: !present,
id: contentId,
tabIndex: 0,
...contentProps,
ref: forwardedRef,
style: {
...props.style,
animationDuration: isMountAnimationPreventedRef.current ? "0s" : void 0
},
children: present && children
}
) });
}
);
TabsContent.displayName = CONTENT_NAME;
function makeTriggerId(baseId, value) {
return `${baseId}-trigger-${value}`;
}
function makeContentId(baseId, value) {
return `${baseId}-content-${value}`;
}
var Root2 = Tabs;
var List = TabsList;
var Trigger = TabsTrigger;
var Content = TabsContent;
//# sourceMappingURL=index.js.map
@@ -0,0 +1,5 @@
'use strict';
// do NOT remove this file - it would break pre-compiled schemas
// https://github.com/ajv-validator/ajv/issues/889
module.exports = require('fast-deep-equal');
@@ -0,0 +1,725 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// lib/v4/index.ts
var index_exports = {};
__export(index_exports, {
ValidationError: () => ValidationError,
createErrorMap: () => createErrorMap,
createMessageBuilder: () => createMessageBuilder,
fromError: () => fromError,
fromZodError: () => fromZodError,
fromZodIssue: () => fromZodIssue,
isValidationError: () => isValidationError,
isValidationErrorLike: () => isValidationErrorLike,
isZodErrorLike: () => isZodErrorLike,
toValidationError: () => toValidationError
});
module.exports = __toCommonJS(index_exports);
// lib/v4/isZodErrorLike.ts
function isZodErrorLike(err) {
return err instanceof Object && "name" in err && (err.name === "ZodError" || err.name === "$ZodError") && "issues" in err && Array.isArray(err.issues);
}
// lib/v4/ValidationError.ts
var ZOD_VALIDATION_ERROR_NAME = "ZodValidationError";
var ValidationError = class extends Error {
name;
details;
constructor(message, options) {
super(message, options);
this.name = ZOD_VALIDATION_ERROR_NAME;
this.details = getIssuesFromErrorOptions(options);
}
toString() {
return this.message;
}
};
function getIssuesFromErrorOptions(options) {
if (options) {
const cause = options.cause;
if (isZodErrorLike(cause)) {
return cause.issues;
}
}
return [];
}
// lib/v4/isValidationError.ts
function isValidationError(err) {
return err instanceof ValidationError;
}
// lib/v4/isValidationErrorLike.ts
function isValidationErrorLike(err) {
return err instanceof Error && err.name === ZOD_VALIDATION_ERROR_NAME;
}
// lib/v4/errorMap/custom.ts
function parseCustomIssue(issue) {
return {
type: issue.code,
path: issue.path,
message: issue.message ?? "Invalid input"
};
}
// lib/v4/errorMap/invalidElement.ts
function parseInvalidElementIssue(issue) {
return {
type: issue.code,
path: issue.path,
message: `unexpected element in ${issue.origin}`
};
}
// lib/v4/errorMap/invalidKey.ts
function parseInvalidKeyIssue(issue) {
return {
type: issue.code,
path: issue.path,
message: `unexpected key in ${issue.origin}`
};
}
// lib/v4/errorMap/invalidStringFormat.ts
function parseInvalidStringFormatIssue(issue, options = {
displayInvalidFormatDetails: false
}) {
switch (issue.format) {
case "lowercase":
case "uppercase":
return {
type: issue.code,
path: issue.path,
message: `value must be in ${issue.format} format`
};
default: {
if (isZodIssueStringStartsWith(issue)) {
return parseStringStartsWith(issue);
}
if (isZodIssueStringEndsWith(issue)) {
return parseStringEndsWith(issue);
}
if (isZodIssueStringIncludes(issue)) {
return parseStringIncludes(issue);
}
if (isZodIssueStringInvalidRegex(issue)) {
return parseStringInvalidRegex(issue, options);
}
if (isZodIssueStringInvalidJWT(issue)) {
return parseStringInvalidJWT(issue, options);
}
return {
type: issue.code,
path: issue.path,
message: `invalid ${issue.format}`
};
}
}
}
function isZodIssueStringStartsWith(issue) {
return issue.format === "starts_with";
}
function parseStringStartsWith(issue) {
return {
type: issue.code,
path: issue.path,
message: `value must start with "${issue.prefix}"`
};
}
function isZodIssueStringEndsWith(issue) {
return issue.format === "ends_with";
}
function parseStringEndsWith(issue) {
return {
type: issue.code,
path: issue.path,
message: `value must end with "${issue.suffix}"`
};
}
function isZodIssueStringIncludes(issue) {
return issue.format === "includes";
}
function parseStringIncludes(issue) {
return {
type: issue.code,
path: issue.path,
message: `value must include "${issue.includes}"`
};
}
function isZodIssueStringInvalidRegex(issue) {
return issue.format === "regex";
}
function parseStringInvalidRegex(issue, options = {
displayInvalidFormatDetails: false
}) {
let message = "value must match pattern";
if (options.displayInvalidFormatDetails) {
message += ` "${issue.pattern}"`;
}
return {
type: issue.code,
path: issue.path,
message
};
}
function isZodIssueStringInvalidJWT(issue) {
return issue.format === "jwt";
}
function parseStringInvalidJWT(issue, options = {
displayInvalidFormatDetails: false
}) {
return {
type: issue.code,
path: issue.path,
message: options.displayInvalidFormatDetails && issue.algorithm ? `invalid jwt/${issue.algorithm}` : `invalid jwt`
};
}
// lib/v4/errorMap/invalidType.ts
function parseInvalidTypeIssue(issue) {
let message = `expected ${issue.expected}`;
if ("input" in issue) {
message += `, received ${getTypeName(issue.input)}`;
}
return {
type: issue.code,
path: issue.path,
message
};
}
function getTypeName(value) {
if (typeof value === "object") {
if (value === null) {
return "null";
}
if (value === void 0) {
return "undefined";
}
if (Array.isArray(value)) {
return "array";
}
if (value instanceof Date) {
return "date";
}
if (value instanceof RegExp) {
return "regexp";
}
if (value instanceof Map) {
return "map";
}
if (value instanceof Set) {
return "set";
}
if (value instanceof Error) {
return "error";
}
if (value instanceof Function) {
return "function";
}
return "object";
}
return typeof value;
}
// lib/v4/errorMap/invalidUnion.ts
function parseInvalidUnionIssue(issue) {
return {
type: issue.code,
path: issue.path,
message: issue.message ?? "Invalid input"
};
}
// lib/utils/stringify.ts
function stringifySymbol(symbol) {
return symbol.description ?? "";
}
function stringify(value, options = {}) {
switch (typeof value) {
case "symbol":
return stringifySymbol(value);
case "bigint":
case "number": {
switch (options.localization) {
case true:
return value.toLocaleString();
case false:
return value.toString();
default:
return value.toLocaleString(options.localization);
}
}
case "string": {
if (options.wrapStringValueInQuote) {
return `"${value}"`;
}
return value;
}
default: {
if (value instanceof Date) {
switch (options.localization) {
case true:
return value.toLocaleString();
case false:
return value.toISOString();
default:
return value.toLocaleString(options.localization);
}
}
return String(value);
}
}
}
// lib/utils/joinValues.ts
function joinValues(values, options) {
const valuesToDisplay = (options.maxValuesToDisplay ? values.slice(0, options.maxValuesToDisplay) : values).map((value) => {
return stringify(value, {
wrapStringValueInQuote: options.wrapStringValuesInQuote
});
});
if (valuesToDisplay.length < values.length) {
valuesToDisplay.push(
`${values.length - valuesToDisplay.length} more value(s)`
);
}
return valuesToDisplay.reduce((acc, value, index) => {
if (index > 0) {
if (index === valuesToDisplay.length - 1 && options.lastSeparator) {
acc += options.lastSeparator;
} else {
acc += options.separator;
}
}
acc += value;
return acc;
}, "");
}
// lib/v4/errorMap/invalidValue.ts
function parseInvalidValueIssue(issue, options) {
let message;
if (issue.values.length === 0) {
message = "invalid value";
} else if (issue.values.length === 1) {
const valueStr = stringify(issue.values[0], {
wrapStringValueInQuote: true
});
message = `expected value to be ${valueStr}`;
} else {
const valuesStr = joinValues(issue.values, {
separator: options.allowedValuesSeparator,
lastSeparator: options.allowedValuesLastSeparator,
wrapStringValuesInQuote: options.wrapAllowedValuesInQuote,
maxValuesToDisplay: options.maxAllowedValuesToDisplay
});
message = `expected value to be one of ${valuesStr}`;
}
return {
type: issue.code,
path: issue.path,
message
};
}
// lib/v4/errorMap/notMultipleOf.ts
function parseNotMultipleOfIssue(issue) {
return {
type: issue.code,
path: issue.path,
message: `expected multiple of ${issue.divisor}`
};
}
// lib/v4/errorMap/tooBig.ts
function parseTooBigIssue(issue, options) {
const maxValueStr = issue.origin === "date" ? stringify(new Date(issue.maximum), {
localization: options.dateLocalization
}) : stringify(issue.maximum, {
localization: options.numberLocalization
});
switch (issue.origin) {
case "number":
case "int":
case "bigint": {
return {
type: issue.code,
path: issue.path,
message: `number must be less than${issue.inclusive ? " or equal to" : ""} ${maxValueStr}`
};
}
case "string": {
return {
type: issue.code,
path: issue.path,
message: `string must contain at most ${maxValueStr} character(s)`
};
}
case "date": {
return {
type: issue.code,
path: issue.path,
message: `date must be ${issue.inclusive ? "prior or equal to" : "prior to"} "${maxValueStr}"`
};
}
case "array": {
return {
type: issue.code,
path: issue.path,
message: `array must contain at most ${maxValueStr} item(s)`
};
}
case "set": {
return {
type: issue.code,
path: issue.path,
message: `set must contain at most ${maxValueStr} item(s)`
};
}
case "file": {
return {
type: issue.code,
path: issue.path,
message: `file must not exceed ${maxValueStr} byte(s) in size`
};
}
default:
return {
type: issue.code,
path: issue.path,
message: `value must be less than${issue.inclusive ? " or equal to" : ""} ${maxValueStr}`
};
}
}
// lib/v4/errorMap/tooSmall.ts
function parseTooSmallIssue(issue, options) {
const minValueStr = issue.origin === "date" ? stringify(new Date(issue.minimum), {
localization: options.dateLocalization
}) : stringify(issue.minimum, {
localization: options.numberLocalization
});
switch (issue.origin) {
case "number":
case "int":
case "bigint": {
return {
type: issue.code,
path: issue.path,
message: `number must be greater than${issue.inclusive ? " or equal to" : ""} ${minValueStr}`
};
}
case "date": {
return {
type: issue.code,
path: issue.path,
message: `date must be ${issue.inclusive ? "later or equal to" : "later to"} "${minValueStr}"`
};
}
case "string": {
return {
type: issue.code,
path: issue.path,
message: `string must contain at least ${minValueStr} character(s)`
};
}
case "array": {
return {
type: issue.code,
path: issue.path,
message: `array must contain at least ${minValueStr} item(s)`
};
}
case "set": {
return {
type: issue.code,
path: issue.path,
message: `set must contain at least ${minValueStr} item(s)`
};
}
case "file": {
return {
type: issue.code,
path: issue.path,
message: `file must be at least ${minValueStr} byte(s) in size`
};
}
default:
return {
type: issue.code,
path: issue.path,
message: `value must be greater than${issue.inclusive ? " or equal to" : ""} ${minValueStr}`
};
}
}
// lib/v4/errorMap/unrecognizedKeys.ts
function parseUnrecognizedKeysIssue(issue, options) {
const keysStr = joinValues(issue.keys, {
separator: options.unrecognizedKeysSeparator,
lastSeparator: options.unrecognizedKeysLastSeparator,
wrapStringValuesInQuote: options.wrapUnrecognizedKeysInQuote,
maxValuesToDisplay: options.maxUnrecognizedKeysToDisplay
});
return {
type: issue.code,
path: issue.path,
message: `unrecognized key(s) ${keysStr} in object`
};
}
// lib/v4/errorMap/errorMap.ts
var issueParsers = {
invalid_type: parseInvalidTypeIssue,
too_big: parseTooBigIssue,
too_small: parseTooSmallIssue,
invalid_format: parseInvalidStringFormatIssue,
invalid_value: parseInvalidValueIssue,
invalid_element: parseInvalidElementIssue,
not_multiple_of: parseNotMultipleOfIssue,
unrecognized_keys: parseUnrecognizedKeysIssue,
invalid_key: parseInvalidKeyIssue,
custom: parseCustomIssue,
invalid_union: parseInvalidUnionIssue
};
var defaultErrorMapOptions = {
displayInvalidFormatDetails: false,
allowedValuesSeparator: ", ",
allowedValuesLastSeparator: " or ",
wrapAllowedValuesInQuote: true,
maxAllowedValuesToDisplay: 10,
unrecognizedKeysSeparator: ", ",
unrecognizedKeysLastSeparator: " and ",
wrapUnrecognizedKeysInQuote: true,
maxUnrecognizedKeysToDisplay: 5,
dateLocalization: true,
numberLocalization: true
};
function createErrorMap(partialOptions = {}) {
const options = {
...defaultErrorMapOptions,
...partialOptions
};
const errorMap = (issue) => {
if (issue.code === void 0) {
return "Not supported issue type";
}
const parseFunc = issueParsers[issue.code];
const ast = parseFunc(issue, options);
return ast.message;
};
return errorMap;
}
// lib/utils/NonEmptyArray.ts
function isNonEmptyArray(value) {
return value.length !== 0;
}
// lib/utils/joinPath.ts
var identifierRegex = /[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;
function joinPath(path) {
if (path.length === 1) {
let propertyKey = path[0];
if (typeof propertyKey === "symbol") {
propertyKey = stringifySymbol(propertyKey);
}
return propertyKey.toString() || '""';
}
return path.reduce((acc, propertyKey) => {
if (typeof propertyKey === "number") {
return acc + "[" + propertyKey.toString() + "]";
}
if (typeof propertyKey === "symbol") {
propertyKey = stringifySymbol(propertyKey);
}
if (propertyKey.includes('"')) {
return acc + '["' + escapeQuotes(propertyKey) + '"]';
}
if (!identifierRegex.test(propertyKey)) {
return acc + '["' + propertyKey + '"]';
}
const separator = acc.length === 0 ? "" : ".";
return acc + separator + propertyKey;
}, "");
}
function escapeQuotes(str) {
return str.replace(/"/g, '\\"');
}
// lib/utils/titleCase.ts
function titleCase(value) {
if (value.length === 0) {
return value;
}
return value.charAt(0).toUpperCase() + value.slice(1);
}
// lib/v4/MessageBuilder.ts
var defaultMessageBuilderOptions = {
prefix: "Validation error",
prefixSeparator: ": ",
maxIssuesInMessage: 99,
// I've got 99 problems but the b$tch ain't one
unionSeparator: " or ",
issueSeparator: "; ",
includePath: true,
forceTitleCase: true
};
function createMessageBuilder(partialOptions = {}) {
const options = {
...defaultMessageBuilderOptions,
...partialOptions
};
return function messageBuilder(issues) {
const message = issues.slice(0, options.maxIssuesInMessage).map((issue) => mapIssue(issue, options)).join(options.issueSeparator);
return conditionallyPrefixMessage(message, options);
};
}
function mapIssue(issue, options) {
if (issue.code === "invalid_union" && isNonEmptyArray(issue.errors)) {
const individualMessages = issue.errors.map(
(issues) => issues.map(
(subIssue) => mapIssue(
{
...subIssue,
path: issue.path.concat(subIssue.path)
},
options
)
).join(options.issueSeparator)
);
return Array.from(new Set(individualMessages)).join(options.unionSeparator);
}
const buf = [];
if (options.forceTitleCase) {
buf.push(titleCase(issue.message));
} else {
buf.push(issue.message);
}
pathCondition: if (options.includePath && issue.path !== void 0 && isNonEmptyArray(issue.path)) {
if (issue.path.length === 1) {
const identifier = issue.path[0];
if (typeof identifier === "number") {
buf.push(` at index ${identifier}`);
break pathCondition;
}
}
buf.push(` at "${joinPath(issue.path)}"`);
}
return buf.join("");
}
function conditionallyPrefixMessage(message, options) {
if (options.prefix != null) {
if (message.length > 0) {
return [options.prefix, message].join(options.prefixSeparator);
}
return options.prefix;
}
if (message.length > 0) {
return message;
}
return defaultMessageBuilderOptions.prefix;
}
// lib/v4/fromZodError.ts
function fromZodError(zodError, options = {}) {
if (!isZodErrorLike(zodError)) {
throw new TypeError(
`Invalid zodError param; expected instance of ZodError. Did you mean to use the "${fromError.name}" method instead?`
);
}
return fromZodErrorWithoutRuntimeCheck(zodError, options);
}
function fromZodErrorWithoutRuntimeCheck(zodError, options = {}) {
const zodIssues = zodError.issues;
let message;
if (isNonEmptyArray(zodIssues)) {
const messageBuilder = createMessageBuilderFromOptions(options);
message = messageBuilder(zodIssues);
} else {
message = zodError.message;
}
return new ValidationError(message, { cause: zodError });
}
function createMessageBuilderFromOptions(options) {
if ("messageBuilder" in options) {
return options.messageBuilder;
}
return createMessageBuilder(options);
}
// lib/v4/toValidationError.ts
var toValidationError = (options = {}) => (err) => {
if (isZodErrorLike(err)) {
return fromZodErrorWithoutRuntimeCheck(err, options);
}
if (err instanceof Error) {
return new ValidationError(err.message, { cause: err });
}
return new ValidationError("Unknown error");
};
// lib/v4/fromError.ts
function fromError(err, options = {}) {
return toValidationError(options)(err);
}
// lib/v4/fromZodIssue.ts
var zod = __toESM(require("zod/v4/core"));
function fromZodIssue(issue, options = {}) {
const messageBuilder = createMessageBuilderFromOptions2(options);
const message = messageBuilder([issue]);
return new ValidationError(message, {
cause: new zod.$ZodRealError([issue])
});
}
function createMessageBuilderFromOptions2(options) {
if ("messageBuilder" in options) {
return options.messageBuilder;
}
return createMessageBuilder(options);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
ValidationError,
createErrorMap,
createMessageBuilder,
fromError,
fromZodError,
fromZodIssue,
isValidationError,
isValidationErrorLike,
isZodErrorLike,
toValidationError
});
//# sourceMappingURL=index.js.map
@@ -0,0 +1,80 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var index_exports = {};
__export(index_exports, {
Primitive: () => Primitive,
Root: () => Root,
dispatchDiscreteCustomEvent: () => dispatchDiscreteCustomEvent
});
module.exports = __toCommonJS(index_exports);
// src/primitive.tsx
var React = __toESM(require("react"));
var ReactDOM = __toESM(require("react-dom"));
var import_react_slot = require("@radix-ui/react-slot");
var import_jsx_runtime = require("react/jsx-runtime");
var NODES = [
"a",
"button",
"div",
"form",
"h2",
"h3",
"img",
"input",
"label",
"li",
"nav",
"ol",
"p",
"select",
"span",
"svg",
"ul"
];
var Primitive = NODES.reduce((primitive, node) => {
const Slot = (0, import_react_slot.createSlot)(`Primitive.${node}`);
const Node = React.forwardRef((props, forwardedRef) => {
const { asChild, ...primitiveProps } = props;
const Comp = asChild ? Slot : node;
if (typeof window !== "undefined") {
window[Symbol.for("radix-ui")] = true;
}
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Comp, { ...primitiveProps, ref: forwardedRef });
});
Node.displayName = `Primitive.${node}`;
return { ...primitive, [node]: Node };
}, {});
function dispatchDiscreteCustomEvent(target, event) {
if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
}
var Root = Primitive;
//# sourceMappingURL=index.js.map
@@ -0,0 +1,937 @@
flf2a$ 9 8 18 -1 18
AMC razor 2 font by LESTER
============================
-> Conversion to FigLet font by MEPH. (Part of ASCII Editor Service Pack I)
(http://studenten.freepage.de/meph/ascii/ascii/editor/_index.htm)
-> Defined: ASCII code alphanumeric
-> Uppercase characters only.
.-~~-.
(_^..^_)
Lester||||AMC - Anthony Cucchiara
*Mythos Online : Internet Magazine of Lovecraftian Horror - Dead Alice*
http://www.fortunecity.com/victorian/redlion/157/deadal.htm
*Visit my web page ANSI/ASCII/Fonts*
http://members.aol.com/lester5374/
$@
$@
$@
$@
$@
$@
$@
$@
$@@
. @
|`+. @
| | @
| | @
`+.| @
. @
|`+. @
`+.| @
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
. @
|`+. @
`+.| @
@@
@
@
@
@
@
@
@
@
@@
. . @
.+'|=|`+. @
| +' `+ | @
| |\ | | @
| | \ | | @
| | \| | @
| +. .+ | @
`+.|=|.+' @
@@
. . @
.'|=|`+. @
|.' | | @
| | @
| | @
| | @
| | @
|.+' @
@@
. . @
.+'|=|`+. @
|.+' | | @
. | | @
.+'|=|.+' @
| | . @
| | .+'| @
`+.|=|.+' @
@@
. . @
.+'|=|`+. @
|.+' | | @
.'|=| | @
|.' | | @
. | | @
|`+. | | @
`+.|=|.+' @
@@
. . @
.+'| |`+. @
| | | | @
`++'=| | @
| | @
| | @
| | @
|.+' @
@@
. @
|~~|=|`+. @
| | `+.| @
| | . @
|..|=|`+. @
. | | @
|`+. | | @
`+.|=|.+' @
@@
. . @
|`+.=|`+. @
| | `+.| @
| | . @
| |=|`+. @
| | | | @
| | | | @
`+.|=|.+' @
@@
. . @
.+'|=.+'| @
|.+' | | @
|.+' @
.=' @
.+'| @
| | @
|..| @
@@
. . @
.+'|=|`+. @
| | | | @
.' |=| `. @
| | | | @
| | | | @
| | | | @
`+.|=|.+' @
@@
. . @
.+'|=|`+. @
| | | | @
| | | | @
`+.|=| | @
. | | @
|`+. | | @
`+.|=|.+' @
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
. . @
.+'|=|`+. @
| | | | @
| |=| | @
| | | | @
| | | | @
| | | | @
`+.| |..| @
@@
. . @
.+'|=|`+. @
| | | | @
| |'. '. @
| | | | @
| | | | @
| | | | @
`+.|=|.+' @
@@
. . @
.+'|=|`+. @
| | `+.| @
| | @
| | @
| | . @
| | .+'| @
`+.|=|.+' @
@@
. . @
.+'|=|`+. @
| | `+ | @
| | | | @
| | | | @
| | | | @
| | .+ | @
`+.|=|.+' @
@@
. . @
.+'|=|`+. @
| | `+.| @
| |=|`. @
| | `.| @
| | . @
| | .+'| @
`+.|=|.+' @
@@
. . @
.+'|=|`+. @
| | `+.| @
| |=|`. @
| | `.| @
| | @
| | @
`+.| @
@@
. . @
.+'|=|`+. @
| | `+.| @
| | . @
| | |`+. @
| | `. | @
| | .+ | @
`+.|=|.+' @
@@
. . @
.+'| |`+. @
| | | | @
| |=| | @
| | | | @
| | | | @
| | | | @
`+.| |..| @
@@
. @
|`+. @
| | @
| | @
| | @
| | @
| | @
|.+' @
@@
. @
|`+. @
| | @
| | @
| | @
. | | @
|`+. | | @
`+.|=|.+' @
@@
. . @
.+'| |`. @
| | .+ | @
| |=|.+' @
| | |`+. @
| | | | @
| | | | @
`+.| |..| @
@@
. @
.+'| @
| | @
| | @
| | @
| | . @
| | .+'| @
`+.|=|.+' @
@@
. . . @
.+'|=|`+.=|`+. @
| | `+ | `+ | @
| | | | | | @
| | | | | | @
| | | | | | @
| | | | | | @
`+.| |.| |+' @
@@
. . @
.+'|=|`+. @
| | `+ | @
| | | | @
| | | | @
| | | | @
| | | | @
`+.| |.| @
@@
. . @
.+'|=|`+. @
| | | | @
| | | | @
| | | | @
| | | | @
| | | | @
`+.|=|.+' @
@@
. . @
.+'|=|`+. @
| | | | @
| |=`++' @
| | @
| | @
| | @
`+.| @
@@
. . @
.+'|=|`+. @
| +' `+ | @
| | | | @
| | | | @
| | .| | @
| +.`. | @
`+.|=|.-. @
@@
. . @
.+'|=|`+. @
| | | | @
| |'. '. @
| | | | @
| | | | @
| | | | @
`+.| |.+' @
@@
. . @
.+'|=|`+. @
| | `+.| @
| | . @
`+.|=|`+. @
. | | @
|`+. | | @
`+.|=|.+' @
@@
. . . @
.+'|=|`+.=|`+. @
|.+' | | `+.| @
| | @
| | @
| | @
| | @
|.+' @
@@
. . @
.+'| |`+. @
| | | | @
| | | | @
| | | | @
| | | | @
| | | | @
`+.|=|.+' @
@@
. . @
.+'| .'| @
| | | | @
| | | | @
| | | | @
| | | | @
| | .+ | @
`+.|=|.+' @
@@
. . . @
.+'| .'| .'| @
| | | | | | @
| | | | | | @
| | | | | | @
| | | | | | @
| | .+ | .+ | @
`+.|=|.+'=|.+' @
@@
. . @
.+'| |`+. @
| | | | @
.' .`. `. @
| | | | @
| | | | @
| | | | @
`+.| |.+' @
@@
. . @
.+'|.+'| @
| || | @
`+.`'.+' @
| | @
| | @
| | @
|.+' @
@@
@
|~~|=|~~| @
|.+' | | @
|.+' @
.=' @
.+'| . @
| | .+'| @
|..|=|..| @
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
. . @
.+'|=|`+. @
| | | | @
| |=| | @
| | | | @
| | | | @
| | | | @
`+.| |..| @
@@
. . @
.+'|=|`+. @
| | | | @
| |'. '. @
| | | | @
| | | | @
| | | | @
`+.|=|.+' @
@@
. . @
.+'|=|`+. @
| | `+.| @
| | @
| | @
| | . @
| | .+'| @
`+.|=|.+' @
@@
. . @
.+'|=|`+. @
| | `+ | @
| | | | @
| | | | @
| | | | @
| | .+ | @
`+.|=|.+' @
@@
. . @
.+'|=|`+. @
| | `+.| @
| |=|`. @
| | `.| @
| | . @
| | .+'| @
`+.|=|.+' @
@@
. . @
.+'|=|`+. @
| | `+.| @
| |=|`. @
| | `.| @
| | @
| | @
`+.| @
@@
. . @
.+'|=|`+. @
| | `+.| @
| | . @
| | |`+. @
| | `. | @
| | .+ | @
`+.|=|.+' @
@@
. . @
.+'| |`+. @
| | | | @
| |=| | @
| | | | @
| | | | @
| | | | @
`+.| |..| @
@@
. @
|`+. @
| | @
| | @
| | @
| | @
| | @
|.+' @
@@
. @
|`+. @
| | @
| | @
| | @
. | | @
|`+. | | @
`+.|=|.+' @
@@
. . @
.+'| |`. @
| | .+ | @
| |=|.+' @
| | |`+. @
| | | | @
| | | | @
`+.| |..| @
@@
. @
.+'| @
| | @
| | @
| | @
| | . @
| | .+'| @
`+.|=|.+' @
@@
. . . @
.+'|=|`+.=|`+. @
| | `+ | `+ | @
| | | | | | @
| | | | | | @
| | | | | | @
| | | | | | @
`+.| |.| |+' @
@@
. . @
.+'|=|`+. @
| | `+ | @
| | | | @
| | | | @
| | | | @
| | | | @
`+.| |.| @
@@
. . @
.+'|=|`+. @
| | | | @
| | | | @
| | | | @
| | | | @
| | | | @
`+.|=|.+' @
@@
. . @
.+'|=|`+. @
| | | | @
| |=`++' @
| | @
| | @
| | @
`+.| @
@@
. . @
.+'|=|`+. @
| +' `+ | @
| | | | @
| | | | @
| | .| | @
| +.`. | @
`+.|=|.-. @
@@
. . @
.+'|=|`+. @
| | | | @
| |'. '. @
| | | | @
| | | | @
| | | | @
`+.| |.+' @
@@
. . @
.+'|=|`+. @
| | `+.| @
| | . @
`+.|=|`+. @
. | | @
|`+. | | @
`+.|=|.+' @
@@
. . . @
.+'|=|`+.=|`+. @
|.+' | | `+.| @
| | @
| | @
| | @
| | @
|.+' @
@@
. . @
.+'| |`+. @
| | | | @
| | | | @
| | | | @
| | | | @
| | | | @
`+.|=|.+' @
@@
. . @
.+'| .'| @
| | | | @
| | | | @
| | | | @
| | | | @
| | .+ | @
`+.|=|.+' @
@@
. . . @
.+'| .'| .'| @
| | | | | | @
| | | | | | @
| | | | | | @
| | | | | | @
| | .+ | .+ | @
`+.|=|.+'=|.+' @
@@
. . @
.+'| |`+. @
| | | | @
.' .`. `. @
| | | | @
| | | | @
| | | | @
`+.| |.+' @
@@
. . @
.+'|.+'| @
| || | @
`+.`'.+' @
| | @
| | @
| | @
|.+' @
@@
@
|~~|=|~~| @
|.+' | | @
|.+' @
.=' @
.+'| . @
| | .+'| @
|..|=|..| @
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@@ -0,0 +1,16 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const DollarSign = createLucideIcon("DollarSign", [
["line", { x1: "12", x2: "12", y1: "2", y2: "22", key: "7eqyqh" }],
["path", { d: "M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6", key: "1b0p4s" }]
]);
export { DollarSign as default };
//# sourceMappingURL=dollar-sign.js.map
@@ -0,0 +1,356 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseStringDef = exports.zodPatterns = void 0;
const errorMessages_js_1 = require("../errorMessages.js");
let emojiRegex = undefined;
/**
* Generated from the regular expressions found here as of 2024-05-22:
* https://github.com/colinhacks/zod/blob/master/src/types.ts.
*
* Expressions with /i flag have been changed accordingly.
*/
exports.zodPatterns = {
/**
* `c` was changed to `[cC]` to replicate /i flag
*/
cuid: /^[cC][^\s-]{8,}$/,
cuid2: /^[0-9a-z]+$/,
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
/**
* `a-z` was added to replicate /i flag
*/
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
/**
* Constructed a valid Unicode RegExp
*
* Lazily instantiate since this type of regex isn't supported
* in all envs (e.g. React Native).
*
* See:
* https://github.com/colinhacks/zod/issues/2433
* Fix in Zod:
* https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
*/
emoji: () => {
if (emojiRegex === undefined) {
emojiRegex = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u");
}
return emojiRegex;
},
/**
* Unused
*/
uuid: /^[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}$/,
/**
* Unused
*/
ipv4: /^(?:(?: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])$/,
ipv4Cidr: /^(?:(?: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])$/,
/**
* Unused
*/
ipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,
ipv6Cidr: /^(([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])$/,
base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
nanoid: /^[a-zA-Z0-9_-]{21}$/,
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,
};
function parseStringDef(def, refs) {
const res = {
type: "string",
};
if (def.checks) {
for (const check of def.checks) {
switch (check.kind) {
case "min":
(0, errorMessages_js_1.setResponseValueAndErrors)(res, "minLength", typeof res.minLength === "number"
? Math.max(res.minLength, check.value)
: check.value, check.message, refs);
break;
case "max":
(0, errorMessages_js_1.setResponseValueAndErrors)(res, "maxLength", typeof res.maxLength === "number"
? Math.min(res.maxLength, check.value)
: check.value, check.message, refs);
break;
case "email":
switch (refs.emailStrategy) {
case "format:email":
addFormat(res, "email", check.message, refs);
break;
case "format:idn-email":
addFormat(res, "idn-email", check.message, refs);
break;
case "pattern:zod":
addPattern(res, exports.zodPatterns.email, check.message, refs);
break;
}
break;
case "url":
addFormat(res, "uri", check.message, refs);
break;
case "uuid":
addFormat(res, "uuid", check.message, refs);
break;
case "regex":
addPattern(res, check.regex, check.message, refs);
break;
case "cuid":
addPattern(res, exports.zodPatterns.cuid, check.message, refs);
break;
case "cuid2":
addPattern(res, exports.zodPatterns.cuid2, check.message, refs);
break;
case "startsWith":
addPattern(res, RegExp(`^${escapeLiteralCheckValue(check.value, refs)}`), check.message, refs);
break;
case "endsWith":
addPattern(res, RegExp(`${escapeLiteralCheckValue(check.value, refs)}$`), check.message, refs);
break;
case "datetime":
addFormat(res, "date-time", check.message, refs);
break;
case "date":
addFormat(res, "date", check.message, refs);
break;
case "time":
addFormat(res, "time", check.message, refs);
break;
case "duration":
addFormat(res, "duration", check.message, refs);
break;
case "length":
(0, errorMessages_js_1.setResponseValueAndErrors)(res, "minLength", typeof res.minLength === "number"
? Math.max(res.minLength, check.value)
: check.value, check.message, refs);
(0, errorMessages_js_1.setResponseValueAndErrors)(res, "maxLength", typeof res.maxLength === "number"
? Math.min(res.maxLength, check.value)
: check.value, check.message, refs);
break;
case "includes": {
addPattern(res, RegExp(escapeLiteralCheckValue(check.value, refs)), check.message, refs);
break;
}
case "ip": {
if (check.version !== "v6") {
addFormat(res, "ipv4", check.message, refs);
}
if (check.version !== "v4") {
addFormat(res, "ipv6", check.message, refs);
}
break;
}
case "base64url":
addPattern(res, exports.zodPatterns.base64url, check.message, refs);
break;
case "jwt":
addPattern(res, exports.zodPatterns.jwt, check.message, refs);
break;
case "cidr": {
if (check.version !== "v6") {
addPattern(res, exports.zodPatterns.ipv4Cidr, check.message, refs);
}
if (check.version !== "v4") {
addPattern(res, exports.zodPatterns.ipv6Cidr, check.message, refs);
}
break;
}
case "emoji":
addPattern(res, exports.zodPatterns.emoji(), check.message, refs);
break;
case "ulid": {
addPattern(res, exports.zodPatterns.ulid, check.message, refs);
break;
}
case "base64": {
switch (refs.base64Strategy) {
case "format:binary": {
addFormat(res, "binary", check.message, refs);
break;
}
case "contentEncoding:base64": {
(0, errorMessages_js_1.setResponseValueAndErrors)(res, "contentEncoding", "base64", check.message, refs);
break;
}
case "pattern:zod": {
addPattern(res, exports.zodPatterns.base64, check.message, refs);
break;
}
}
break;
}
case "nanoid": {
addPattern(res, exports.zodPatterns.nanoid, check.message, refs);
}
case "toLowerCase":
case "toUpperCase":
case "trim":
break;
default:
((_) => { })(check);
}
}
}
return res;
}
exports.parseStringDef = parseStringDef;
function escapeLiteralCheckValue(literal, refs) {
return refs.patternStrategy === "escape"
? escapeNonAlphaNumeric(literal)
: literal;
}
const ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
function escapeNonAlphaNumeric(source) {
let result = "";
for (let i = 0; i < source.length; i++) {
if (!ALPHA_NUMERIC.has(source[i])) {
result += "\\";
}
result += source[i];
}
return result;
}
// Adds a "format" keyword to the schema. If a format exists, both formats will be joined in an allOf-node, along with subsequent ones.
function addFormat(schema, value, message, refs) {
if (schema.format || schema.anyOf?.some((x) => x.format)) {
if (!schema.anyOf) {
schema.anyOf = [];
}
if (schema.format) {
schema.anyOf.push({
format: schema.format,
...(schema.errorMessage &&
refs.errorMessages && {
errorMessage: { format: schema.errorMessage.format },
}),
});
delete schema.format;
if (schema.errorMessage) {
delete schema.errorMessage.format;
if (Object.keys(schema.errorMessage).length === 0) {
delete schema.errorMessage;
}
}
}
schema.anyOf.push({
format: value,
...(message &&
refs.errorMessages && { errorMessage: { format: message } }),
});
}
else {
(0, errorMessages_js_1.setResponseValueAndErrors)(schema, "format", value, message, refs);
}
}
// Adds a "pattern" keyword to the schema. If a pattern exists, both patterns will be joined in an allOf-node, along with subsequent ones.
function addPattern(schema, regex, message, refs) {
if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {
if (!schema.allOf) {
schema.allOf = [];
}
if (schema.pattern) {
schema.allOf.push({
pattern: schema.pattern,
...(schema.errorMessage &&
refs.errorMessages && {
errorMessage: { pattern: schema.errorMessage.pattern },
}),
});
delete schema.pattern;
if (schema.errorMessage) {
delete schema.errorMessage.pattern;
if (Object.keys(schema.errorMessage).length === 0) {
delete schema.errorMessage;
}
}
}
schema.allOf.push({
pattern: stringifyRegExpWithFlags(regex, refs),
...(message &&
refs.errorMessages && { errorMessage: { pattern: message } }),
});
}
else {
(0, errorMessages_js_1.setResponseValueAndErrors)(schema, "pattern", stringifyRegExpWithFlags(regex, refs), message, refs);
}
}
// Mutate z.string.regex() in a best attempt to accommodate for regex flags when applyRegexFlags is true
function stringifyRegExpWithFlags(regex, refs) {
if (!refs.applyRegexFlags || !regex.flags) {
return regex.source;
}
// Currently handled flags
const flags = {
i: regex.flags.includes("i"),
m: regex.flags.includes("m"),
s: regex.flags.includes("s"), // `.` matches newlines
};
// The general principle here is to step through each character, one at a time, applying mutations as flags require. We keep track when the current character is escaped, and when it's inside a group /like [this]/ or (also) a range like /[a-z]/. The following is fairly brittle imperative code; edit at your peril!
const source = flags.i ? regex.source.toLowerCase() : regex.source;
let pattern = "";
let isEscaped = false;
let inCharGroup = false;
let inCharRange = false;
for (let i = 0; i < source.length; i++) {
if (isEscaped) {
pattern += source[i];
isEscaped = false;
continue;
}
if (flags.i) {
if (inCharGroup) {
if (source[i].match(/[a-z]/)) {
if (inCharRange) {
pattern += source[i];
pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
inCharRange = false;
}
else if (source[i + 1] === "-" && source[i + 2]?.match(/[a-z]/)) {
pattern += source[i];
inCharRange = true;
}
else {
pattern += `${source[i]}${source[i].toUpperCase()}`;
}
continue;
}
}
else if (source[i].match(/[a-z]/)) {
pattern += `[${source[i]}${source[i].toUpperCase()}]`;
continue;
}
}
if (flags.m) {
if (source[i] === "^") {
pattern += `(^|(?<=[\r\n]))`;
continue;
}
else if (source[i] === "$") {
pattern += `($|(?=[\r\n]))`;
continue;
}
}
if (flags.s && source[i] === ".") {
pattern += inCharGroup ? `${source[i]}\r\n` : `[${source[i]}\r\n]`;
continue;
}
pattern += source[i];
if (source[i] === "\\") {
isEscaped = true;
}
else if (inCharGroup && source[i] === "]") {
inCharGroup = false;
}
else if (!inCharGroup && source[i] === "[") {
inCharGroup = true;
}
}
try {
new RegExp(pattern);
}
catch {
console.warn(`Could not convert regex pattern at ${refs.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`);
return regex.source;
}
return pattern;
}
@@ -0,0 +1,22 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
//#region src/conninfo.ts
/**
* ConnInfo Helper for Node.js
* @param c Context
* @returns ConnInfo
*/
const getConnInfo = (c) => {
const bindings = c.env.server ? c.env.server : c.env;
const address = bindings.incoming.socket.remoteAddress;
const port = bindings.incoming.socket.remotePort;
const family = bindings.incoming.socket.remoteFamily;
return { remote: {
address,
port,
addressType: family === "IPv4" ? "IPv4" : family === "IPv6" ? "IPv6" : void 0
} };
};
//#endregion
exports.getConnInfo = getConnInfo;
@@ -0,0 +1 @@
{"version":3,"file":"grid-3x3.js","sources":["../../../src/icons/grid-3x3.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Grid3x3\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHg9IjMiIHk9IjMiIHJ4PSIyIiAvPgogIDxwYXRoIGQ9Ik0zIDloMTgiIC8+CiAgPHBhdGggZD0iTTMgMTVoMTgiIC8+CiAgPHBhdGggZD0iTTkgM3YxOCIgLz4KICA8cGF0aCBkPSJNMTUgM3YxOCIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/grid-3x3\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst Grid3x3 = createLucideIcon('Grid3x3', [\n ['rect', { width: '18', height: '18', x: '3', y: '3', rx: '2', key: 'afitv7' }],\n ['path', { d: 'M3 9h18', key: '1pudct' }],\n ['path', { d: 'M3 15h18', key: '5xshup' }],\n ['path', { d: 'M9 3v18', key: 'fh3hqa' }],\n ['path', { d: 'M15 3v18', key: '14nvp0' }],\n]);\n\nexport default Grid3x3;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,iBAAiB,SAAW,CAAA,CAAA,CAAA;AAAA,CAAA,CAC1C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,MAAM,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC9E,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC3C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"file":"receipt-swiss-franc.js","sources":["../../../src/icons/receipt-swiss-franc.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ReceiptSwissFranc\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNNCAydjIwbDItMSAyIDEgMi0xIDIgMSAyLTEgMiAxIDItMSAyIDFWMmwtMiAxLTItMS0yIDEtMi0xLTIgMS0yLTEtMiAxWiIgLz4KICA8cGF0aCBkPSJNMTAgMTdWN2g1IiAvPgogIDxwYXRoIGQ9Ik0xMCAxMWg0IiAvPgogIDxwYXRoIGQ9Ik04IDE1aDUiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/receipt-swiss-franc\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst ReceiptSwissFranc = createLucideIcon('ReceiptSwissFranc', [\n [\n 'path',\n { d: 'M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z', key: 'q3az6g' },\n ],\n ['path', { d: 'M10 17V7h5', key: 'k7jq18' }],\n ['path', { d: 'M10 11h4', key: '1i0mka' }],\n ['path', { d: 'M8 15h5', key: 'vxg57a' }],\n]);\n\nexport default ReceiptSwissFranc;\n"],"names":[],"mappings":";;;;;;;;;AAaM,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,CAAoB,iBAAiB,mBAAqB,CAAA,CAAA,CAAA;AAAA,CAC9D,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA,CAAE,CAAA,CAAG,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,CAA2E,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,QAAS,CAAA,CAAA;AAAA,CAChG,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC3C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC1C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,9 @@
import type { AnyRouter } from './router'
declare global {
interface Window {
__TSR_ROUTER__?: AnyRouter
}
}
export {}
@@ -0,0 +1,6 @@
// Does this device prefer reduced motion? Returns `null` server-side.
const prefersReducedMotion = { current: null };
const hasReducedMotionListener = { current: false };
export { hasReducedMotionListener, prefersReducedMotion };
//# sourceMappingURL=state.mjs.map
@@ -0,0 +1,279 @@
import {TokenType as tt} from "../parser/tokenizer/types";
import isIdentifier from "../util/isIdentifier";
import Transformer from "./Transformer";
export default class TypeScriptTransformer extends Transformer {
constructor(
rootTransformer,
tokens,
isImportsTransformEnabled,
) {
super();this.rootTransformer = rootTransformer;this.tokens = tokens;this.isImportsTransformEnabled = isImportsTransformEnabled;;
}
process() {
if (
this.rootTransformer.processPossibleArrowParamEnd() ||
this.rootTransformer.processPossibleAsyncArrowWithTypeParams() ||
this.rootTransformer.processPossibleTypeRange()
) {
return true;
}
if (
this.tokens.matches1(tt._public) ||
this.tokens.matches1(tt._protected) ||
this.tokens.matches1(tt._private) ||
this.tokens.matches1(tt._abstract) ||
this.tokens.matches1(tt._readonly) ||
this.tokens.matches1(tt._override) ||
this.tokens.matches1(tt.nonNullAssertion)
) {
this.tokens.removeInitialToken();
return true;
}
if (this.tokens.matches1(tt._enum) || this.tokens.matches2(tt._const, tt._enum)) {
this.processEnum();
return true;
}
if (
this.tokens.matches2(tt._export, tt._enum) ||
this.tokens.matches3(tt._export, tt._const, tt._enum)
) {
this.processEnum(true);
return true;
}
return false;
}
processEnum(isExport = false) {
// We might have "export const enum", so just remove all relevant tokens.
this.tokens.removeInitialToken();
while (this.tokens.matches1(tt._const) || this.tokens.matches1(tt._enum)) {
this.tokens.removeToken();
}
const enumName = this.tokens.identifierName();
this.tokens.removeToken();
if (isExport && !this.isImportsTransformEnabled) {
this.tokens.appendCode("export ");
}
this.tokens.appendCode(`var ${enumName}; (function (${enumName})`);
this.tokens.copyExpectedToken(tt.braceL);
this.processEnumBody(enumName);
this.tokens.copyExpectedToken(tt.braceR);
if (isExport && this.isImportsTransformEnabled) {
this.tokens.appendCode(`)(${enumName} || (exports.${enumName} = ${enumName} = {}));`);
} else {
this.tokens.appendCode(`)(${enumName} || (${enumName} = {}));`);
}
}
/**
* Transform an enum into equivalent JS. This has complexity in a few places:
* - TS allows string enums, numeric enums, and a mix of the two styles within an enum.
* - Enum keys are allowed to be referenced in later enum values.
* - Enum keys are allowed to be strings.
* - When enum values are omitted, they should follow an auto-increment behavior.
*/
processEnumBody(enumName) {
// Code that can be used to reference the previous enum member, or null if this is the first
// enum member.
let previousValueCode = null;
while (true) {
if (this.tokens.matches1(tt.braceR)) {
break;
}
const {nameStringCode, variableName} = this.extractEnumKeyInfo(this.tokens.currentToken());
this.tokens.removeInitialToken();
if (
this.tokens.matches3(tt.eq, tt.string, tt.comma) ||
this.tokens.matches3(tt.eq, tt.string, tt.braceR)
) {
this.processStringLiteralEnumMember(enumName, nameStringCode, variableName);
} else if (this.tokens.matches1(tt.eq)) {
this.processExplicitValueEnumMember(enumName, nameStringCode, variableName);
} else {
this.processImplicitValueEnumMember(
enumName,
nameStringCode,
variableName,
previousValueCode,
);
}
if (this.tokens.matches1(tt.comma)) {
this.tokens.removeToken();
}
if (variableName != null) {
previousValueCode = variableName;
} else {
previousValueCode = `${enumName}[${nameStringCode}]`;
}
}
}
/**
* Detect name information about this enum key, which will be used to determine which code to emit
* and whether we should declare a variable as part of this declaration.
*
* Some cases to keep in mind:
* - Enum keys can be implicitly referenced later, e.g. `X = 1, Y = X`. In Sucrase, we implement
* this by declaring a variable `X` so that later expressions can use it.
* - In addition to the usual identifier key syntax, enum keys are allowed to be string literals,
* e.g. `"hello world" = 3,`. Template literal syntax is NOT allowed.
* - Even if the enum key is defined as a string literal, it may still be referenced by identifier
* later, e.g. `"X" = 1, Y = X`. That means that we need to detect whether or not a string
* literal is identifier-like and emit a variable if so, even if the declaration did not use an
* identifier.
* - Reserved keywords like `break` are valid enum keys, but are not valid to be referenced later
* and would be a syntax error if we emitted a variable, so we need to skip the variable
* declaration in those cases.
*
* The variableName return value captures these nuances: if non-null, we can and must emit a
* variable declaration, and if null, we can't and shouldn't.
*/
extractEnumKeyInfo(nameToken) {
if (nameToken.type === tt.name) {
const name = this.tokens.identifierNameForToken(nameToken);
return {
nameStringCode: `"${name}"`,
variableName: isIdentifier(name) ? name : null,
};
} else if (nameToken.type === tt.string) {
const name = this.tokens.stringValueForToken(nameToken);
return {
nameStringCode: this.tokens.code.slice(nameToken.start, nameToken.end),
variableName: isIdentifier(name) ? name : null,
};
} else {
throw new Error("Expected name or string at beginning of enum element.");
}
}
/**
* Handle an enum member where the RHS is just a string literal (not omitted, not a number, and
* not a complex expression). This is the typical form for TS string enums, and in this case, we
* do *not* create a reverse mapping.
*
* This is called after deleting the key token, when the token processor is at the equals sign.
*
* Example 1:
* someKey = "some value"
* ->
* const someKey = "some value"; MyEnum["someKey"] = someKey;
*
* Example 2:
* "some key" = "some value"
* ->
* MyEnum["some key"] = "some value";
*/
processStringLiteralEnumMember(
enumName,
nameStringCode,
variableName,
) {
if (variableName != null) {
this.tokens.appendCode(`const ${variableName}`);
// =
this.tokens.copyToken();
// value string
this.tokens.copyToken();
this.tokens.appendCode(`; ${enumName}[${nameStringCode}] = ${variableName};`);
} else {
this.tokens.appendCode(`${enumName}[${nameStringCode}]`);
// =
this.tokens.copyToken();
// value string
this.tokens.copyToken();
this.tokens.appendCode(";");
}
}
/**
* Handle an enum member initialized with an expression on the right-hand side (other than a
* string literal). In these cases, we should transform the expression and emit code that sets up
* a reverse mapping.
*
* The TypeScript implementation of this operation distinguishes between expressions that can be
* "constant folded" at compile time (i.e. consist of number literals and simple math operations
* on those numbers) and ones that are dynamic. For constant expressions, it emits the resolved
* numeric value, and auto-incrementing is only allowed in that case. Evaluating expressions at
* compile time would add significant complexity to Sucrase, so Sucrase instead leaves the
* expression as-is, and will later emit something like `MyEnum["previousKey"] + 1` to implement
* auto-incrementing.
*
* This is called after deleting the key token, when the token processor is at the equals sign.
*
* Example 1:
* someKey = 1 + 1
* ->
* const someKey = 1 + 1; MyEnum[MyEnum["someKey"] = someKey] = "someKey";
*
* Example 2:
* "some key" = 1 + 1
* ->
* MyEnum[MyEnum["some key"] = 1 + 1] = "some key";
*/
processExplicitValueEnumMember(
enumName,
nameStringCode,
variableName,
) {
const rhsEndIndex = this.tokens.currentToken().rhsEndIndex;
if (rhsEndIndex == null) {
throw new Error("Expected rhsEndIndex on enum assign.");
}
if (variableName != null) {
this.tokens.appendCode(`const ${variableName}`);
this.tokens.copyToken();
while (this.tokens.currentIndex() < rhsEndIndex) {
this.rootTransformer.processToken();
}
this.tokens.appendCode(
`; ${enumName}[${enumName}[${nameStringCode}] = ${variableName}] = ${nameStringCode};`,
);
} else {
this.tokens.appendCode(`${enumName}[${enumName}[${nameStringCode}]`);
this.tokens.copyToken();
while (this.tokens.currentIndex() < rhsEndIndex) {
this.rootTransformer.processToken();
}
this.tokens.appendCode(`] = ${nameStringCode};`);
}
}
/**
* Handle an enum member with no right-hand side expression. In this case, the value is the
* previous value plus 1, or 0 if there was no previous value. We should also always emit a
* reverse mapping.
*
* Example 1:
* someKey2
* ->
* const someKey2 = someKey1 + 1; MyEnum[MyEnum["someKey2"] = someKey2] = "someKey2";
*
* Example 2:
* "some key 2"
* ->
* MyEnum[MyEnum["some key 2"] = someKey1 + 1] = "some key 2";
*/
processImplicitValueEnumMember(
enumName,
nameStringCode,
variableName,
previousValueCode,
) {
let valueCode = previousValueCode != null ? `${previousValueCode} + 1` : "0";
if (variableName != null) {
this.tokens.appendCode(`const ${variableName} = ${valueCode}; `);
valueCode = variableName;
}
this.tokens.appendCode(
`${enumName}[${enumName}[${nameStringCode}] = ${valueCode}] = ${nameStringCode};`,
);
}
}
@@ -0,0 +1 @@
{"version":3,"file":"edge.mjs","sources":["../../../../../../src/render/dom/scroll/offsets/edge.ts"],"sourcesContent":["import { Edge, NamedEdges } from \"../types\"\n\nexport const namedEdges: Record<NamedEdges, number> = {\n start: 0,\n center: 0.5,\n end: 1,\n}\n\nexport function resolveEdge(edge: Edge, length: number, inset = 0) {\n let delta = 0\n\n /**\n * If we have this edge defined as a preset, replace the definition\n * with the numerical value.\n */\n if (edge in namedEdges) {\n edge = namedEdges[edge as NamedEdges]\n }\n\n /**\n * Handle unit values\n */\n if (typeof edge === \"string\") {\n const asNumber = parseFloat(edge)\n\n if (edge.endsWith(\"px\")) {\n delta = asNumber\n } else if (edge.endsWith(\"%\")) {\n edge = asNumber / 100\n } else if (edge.endsWith(\"vw\")) {\n delta = (asNumber / 100) * document.documentElement.clientWidth\n } else if (edge.endsWith(\"vh\")) {\n delta = (asNumber / 100) * document.documentElement.clientHeight\n } else {\n edge = asNumber\n }\n }\n\n /**\n * If the edge is defined as a number, handle as a progress value.\n */\n if (typeof edge === \"number\") {\n delta = length * edge\n }\n\n return inset + delta\n}\n"],"names":[],"mappings":"AAEO,MAAM,UAAU,GAA+B;AAClD,IAAA,KAAK,EAAE,CAAC;AACR,IAAA,MAAM,EAAE,GAAG;AACX,IAAA,GAAG,EAAE,CAAC;;AAGJ,SAAU,WAAW,CAAC,IAAU,EAAE,MAAc,EAAE,KAAK,GAAG,CAAC,EAAA;IAC7D,IAAI,KAAK,GAAG,CAAC;AAEb;;;AAGG;AACH,IAAA,IAAI,IAAI,IAAI,UAAU,EAAE;AACpB,QAAA,IAAI,GAAG,UAAU,CAAC,IAAkB,CAAC;IACzC;AAEA;;AAEG;AACH,IAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AAC1B,QAAA,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC;AAEjC,QAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YACrB,KAAK,GAAG,QAAQ;QACpB;AAAO,aAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AAC3B,YAAA,IAAI,GAAG,QAAQ,GAAG,GAAG;QACzB;AAAO,aAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;AAC5B,YAAA,KAAK,GAAG,CAAC,QAAQ,GAAG,GAAG,IAAI,QAAQ,CAAC,eAAe,CAAC,WAAW;QACnE;AAAO,aAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;AAC5B,YAAA,KAAK,GAAG,CAAC,QAAQ,GAAG,GAAG,IAAI,QAAQ,CAAC,eAAe,CAAC,YAAY;QACpE;aAAO;YACH,IAAI,GAAG,QAAQ;QACnB;IACJ;AAEA;;AAEG;AACH,IAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AAC1B,QAAA,KAAK,GAAG,MAAM,GAAG,IAAI;IACzB;IAEA,OAAO,KAAK,GAAG,KAAK;AACxB;;;;"}
@@ -0,0 +1,41 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./errors.cjs"), exports);
__exportStar(require("./helpers/parseUtil.cjs"), exports);
__exportStar(require("./helpers/typeAliases.cjs"), exports);
__exportStar(require("./helpers/util.cjs"), exports);
__exportStar(require("./types.cjs"), exports);
__exportStar(require("./ZodError.cjs"), exports);
// seal-cjs-exports
(function () {
var keys = Object.getOwnPropertyNames(exports);
for (var i = 0; i < keys.length; i++) {
var desc = Object.getOwnPropertyDescriptor(exports, keys[i]);
if (!desc || !desc.get || !desc.configurable) continue;
var value;
try {
value = desc.get();
} catch (e) {
continue;
}
// a circular require may not have settled this one yet, so leave it live
if (value === undefined) continue;
Object.defineProperty(exports, keys[i], { value: value, writable: false, enumerable: desc.enumerable, configurable: false });
}
Object.freeze(exports);
})();
@@ -0,0 +1,9 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
export { default } from './layers.js';
//# sourceMappingURL=layers-3.js.map
@@ -0,0 +1,18 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const SatelliteDish = createLucideIcon("SatelliteDish", [
["path", { d: "M4 10a7.31 7.31 0 0 0 10 10Z", key: "1fzpp3" }],
["path", { d: "m9 15 3-3", key: "88sc13" }],
["path", { d: "M17 13a6 6 0 0 0-6-6", key: "15cc6u" }],
["path", { d: "M21 13A10 10 0 0 0 11 3", key: "11nf8s" }]
]);
export { SatelliteDish as default };
//# sourceMappingURL=satellite-dish.js.map
@@ -0,0 +1,17 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const FileCheck = createLucideIcon("FileCheck", [
["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
["path", { d: "m9 15 2 2 4-4", key: "1grp1n" }]
]);
export { FileCheck as default };
//# sourceMappingURL=file-check.js.map
@@ -0,0 +1,9 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
export { default } from './square-menu.js';
//# sourceMappingURL=menu-square.js.map
@@ -0,0 +1,207 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ArrayExpression = ArrayExpression;
exports.AssignmentExpression = AssignmentExpression;
exports.BinaryExpression = BinaryExpression;
exports.BooleanLiteral = BooleanLiteral;
exports.CallExpression = CallExpression;
exports.ConditionalExpression = ConditionalExpression;
exports.ClassDeclaration = exports.ClassExpression = exports.FunctionDeclaration = exports.ArrowFunctionExpression = exports.FunctionExpression = Func;
Object.defineProperty(exports, "Identifier", {
enumerable: true,
get: function () {
return _infererReference.default;
}
});
exports.LogicalExpression = LogicalExpression;
exports.NewExpression = NewExpression;
exports.NullLiteral = NullLiteral;
exports.NumericLiteral = NumericLiteral;
exports.ObjectExpression = ObjectExpression;
exports.ParenthesizedExpression = ParenthesizedExpression;
exports.RegExpLiteral = RegExpLiteral;
exports.RestElement = RestElement;
exports.SequenceExpression = SequenceExpression;
exports.StringLiteral = StringLiteral;
exports.TSAsExpression = TSAsExpression;
exports.TSNonNullExpression = TSNonNullExpression;
exports.TaggedTemplateExpression = TaggedTemplateExpression;
exports.TemplateLiteral = TemplateLiteral;
exports.TypeCastExpression = TypeCastExpression;
exports.UnaryExpression = UnaryExpression;
exports.UpdateExpression = UpdateExpression;
exports.VariableDeclarator = VariableDeclarator;
var _t = require("@babel/types");
var _infererReference = require("./inferer-reference.js");
var _util = require("./util.js");
const {
BOOLEAN_BINARY_OPERATORS,
BOOLEAN_UNARY_OPERATORS,
NUMBER_BINARY_OPERATORS,
NUMBER_UNARY_OPERATORS,
STRING_UNARY_OPERATORS,
anyTypeAnnotation,
arrayTypeAnnotation,
booleanTypeAnnotation,
buildMatchMemberExpression,
genericTypeAnnotation,
identifier,
nullLiteralTypeAnnotation,
numberTypeAnnotation,
stringTypeAnnotation,
tupleTypeAnnotation,
unionTypeAnnotation,
voidTypeAnnotation,
isIdentifier
} = _t;
function VariableDeclarator() {
if (!this.get("id").isIdentifier()) return;
return this.get("init").getTypeAnnotation();
}
function TypeCastExpression(node) {
return node.typeAnnotation;
}
TypeCastExpression.validParent = true;
function TSAsExpression(node) {
return node.typeAnnotation;
}
TSAsExpression.validParent = true;
function TSNonNullExpression() {
return this.get("expression").getTypeAnnotation();
}
function NewExpression(node) {
if (node.callee.type === "Identifier") {
return genericTypeAnnotation(node.callee);
}
}
function TemplateLiteral() {
return stringTypeAnnotation();
}
function UnaryExpression(node) {
const operator = node.operator;
if (operator === "void") {
return voidTypeAnnotation();
} else if (NUMBER_UNARY_OPERATORS.includes(operator)) {
return numberTypeAnnotation();
} else if (STRING_UNARY_OPERATORS.includes(operator)) {
return stringTypeAnnotation();
} else if (BOOLEAN_UNARY_OPERATORS.includes(operator)) {
return booleanTypeAnnotation();
}
}
function BinaryExpression(node) {
const operator = node.operator;
if (NUMBER_BINARY_OPERATORS.includes(operator)) {
return numberTypeAnnotation();
} else if (BOOLEAN_BINARY_OPERATORS.includes(operator)) {
return booleanTypeAnnotation();
} else if (operator === "+") {
const right = this.get("right");
const left = this.get("left");
if (left.isBaseType("number") && right.isBaseType("number")) {
return numberTypeAnnotation();
} else if (left.isBaseType("string") || right.isBaseType("string")) {
return stringTypeAnnotation();
}
return unionTypeAnnotation([stringTypeAnnotation(), numberTypeAnnotation()]);
}
}
function LogicalExpression() {
const argumentTypes = [this.get("left").getTypeAnnotation(), this.get("right").getTypeAnnotation()];
return (0, _util.createUnionType)(argumentTypes);
}
function ConditionalExpression() {
const argumentTypes = [this.get("consequent").getTypeAnnotation(), this.get("alternate").getTypeAnnotation()];
return (0, _util.createUnionType)(argumentTypes);
}
function SequenceExpression() {
return this.get("expressions").pop().getTypeAnnotation();
}
function ParenthesizedExpression() {
return this.get("expression").getTypeAnnotation();
}
function AssignmentExpression() {
return this.get("right").getTypeAnnotation();
}
function UpdateExpression(node) {
const operator = node.operator;
if (operator === "++" || operator === "--") {
return numberTypeAnnotation();
}
}
function StringLiteral() {
return stringTypeAnnotation();
}
function NumericLiteral() {
return numberTypeAnnotation();
}
function BooleanLiteral() {
return booleanTypeAnnotation();
}
function NullLiteral() {
return nullLiteralTypeAnnotation();
}
function RegExpLiteral() {
return genericTypeAnnotation(identifier("RegExp"));
}
function ObjectExpression() {
return genericTypeAnnotation(identifier("Object"));
}
function ArrayExpression() {
return genericTypeAnnotation(identifier("Array"));
}
function RestElement() {
return ArrayExpression();
}
RestElement.validParent = true;
function Func() {
return genericTypeAnnotation(identifier("Function"));
}
const isArrayFrom = buildMatchMemberExpression("Array.from");
const isObjectKeys = buildMatchMemberExpression("Object.keys");
const isObjectValues = buildMatchMemberExpression("Object.values");
const isObjectEntries = buildMatchMemberExpression("Object.entries");
function CallExpression() {
const {
callee
} = this.node;
if (isObjectKeys(callee)) {
return arrayTypeAnnotation(stringTypeAnnotation());
} else if (isArrayFrom(callee) || isObjectValues(callee) || isIdentifier(callee, {
name: "Array"
})) {
return arrayTypeAnnotation(anyTypeAnnotation());
} else if (isObjectEntries(callee)) {
return arrayTypeAnnotation(tupleTypeAnnotation([stringTypeAnnotation(), anyTypeAnnotation()]));
}
return resolveCall(this.get("callee"));
}
function TaggedTemplateExpression() {
return resolveCall(this.get("tag"));
}
function resolveCall(callee) {
callee = callee.resolve();
if (callee.isFunction()) {
const {
node
} = callee;
if (node.async) {
if (node.generator) {
return genericTypeAnnotation(identifier("AsyncIterator"));
} else {
return genericTypeAnnotation(identifier("Promise"));
}
} else {
if (node.generator) {
return genericTypeAnnotation(identifier("Iterator"));
} else if (callee.node.returnType) {
return callee.node.returnType;
} else {}
}
}
}
//# sourceMappingURL=inferers.js.map
@@ -0,0 +1,27 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const CalendarCog = createLucideIcon("CalendarCog", [
["path", { d: "m15.2 16.9-.9-.4", key: "1r0w5f" }],
["path", { d: "m15.2 19.1-.9.4", key: "j188fs" }],
["path", { d: "M16 2v4", key: "4m81vk" }],
["path", { d: "m16.9 15.2-.4-.9", key: "699xu" }],
["path", { d: "m16.9 20.8-.4.9", key: "dfjc4z" }],
["path", { d: "m19.5 14.3-.4.9", key: "1eb35c" }],
["path", { d: "m19.5 21.7-.4-.9", key: "1tonu5" }],
["path", { d: "M21 10.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6", key: "11kmuh" }],
["path", { d: "m21.7 16.5-.9.4", key: "1knoei" }],
["path", { d: "m21.7 19.5-.9-.4", key: "q4dx6b" }],
["path", { d: "M3 10h18", key: "8toen8" }],
["path", { d: "M8 2v4", key: "1cmpym" }],
["circle", { cx: "18", cy: "18", r: "3", key: "1xkwt0" }]
]);
export { CalendarCog as default };
//# sourceMappingURL=calendar-cog.js.map
@@ -0,0 +1,20 @@
/*
Progress within given range
Given a lower limit and an upper limit, we return the progress
(expressed as a number 0-1) represented by the given value, and
limit that progress to within 0-1.
@param [number]: Lower limit
@param [number]: Upper limit
@param [number]: Value to find progress within given range
@return [number]: Progress of value within range as expressed 0-1
*/
/*#__NO_SIDE_EFFECTS__*/
const progress = (from, to, value) => {
const toFromDifference = to - from;
return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
};
export { progress };
//# sourceMappingURL=progress.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"mediaType.js","sourceRoot":"","sources":["../../../src/shared/mediaType.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,cAAc,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAiC;IAC9D,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,IAAI,CAAC;QACD,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACL,MAAM,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACrE,kEAAkE;QAClE,oEAAoE;QACpE,kEAAkE;QAClE,uBAAuB;QACvB,IAAI,OAAO,KAAK,EAAE,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC/D,OAAO,SAAS,CAAC;QACrB,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAiC;IAC/D,uEAAuE;IACvE,IAAI,MAAM,KAAK,kBAAkB,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,OAAO,gBAAgB,CAAC,MAAM,CAAC,KAAK,kBAAkB,CAAC;AAC3D,CAAC"}
@@ -0,0 +1 @@
{"version":3,"file":"user-round-search.js","sources":["../../../src/icons/user-round-search.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name UserRoundSearch\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxMCIgY3k9IjgiIHI9IjUiIC8+CiAgPHBhdGggZD0iTTIgMjFhOCA4IDAgMCAxIDEwLjQzNC03LjYyIiAvPgogIDxjaXJjbGUgY3g9IjE4IiBjeT0iMTgiIHI9IjMiIC8+CiAgPHBhdGggZD0ibTIyIDIyLTEuOS0xLjkiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/user-round-search\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst UserRoundSearch = createLucideIcon('UserRoundSearch', [\n ['circle', { cx: '10', cy: '8', r: '5', key: 'o932ke' }],\n ['path', { d: 'M2 21a8 8 0 0 1 10.434-7.62', key: '1yezr2' }],\n ['circle', { cx: '18', cy: '18', r: '3', key: '1xkwt0' }],\n ['path', { d: 'm22 22-1.9-1.9', key: '1e5ubv' }],\n]);\n\nexport default UserRoundSearch;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkB,iBAAiB,iBAAmB,CAAA,CAAA,CAAA;AAAA,CAC1D,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAM,CAAI,CAAA,CAAA,CAAA,GAAA,CAAK,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,CAAA;AAAA,CAAA,CACvD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA+B,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,CAAK,UAAU,CAAA,CAAA;AAAA,CAC5D,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAM,CAAI,CAAA,CAAA,CAAA,IAAA,CAAM,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,CAAA;AAAA,CAAA,CACxD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AACjD,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"file":"euro.js","sources":["../../../src/icons/euro.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Euro\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNNCAxMGgxMiIgLz4KICA8cGF0aCBkPSJNNCAxNGg5IiAvPgogIDxwYXRoIGQ9Ik0xOSA2YTcuNyA3LjcgMCAwIDAtNS4yLTJBNy45IDcuOSAwIDAgMCA2IDEyYzAgNC40IDMuNSA4IDcuOCA4IDIgMCAzLjgtLjggNS4yLTIiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/euro\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst Euro = createLucideIcon('Euro', [\n ['path', { d: 'M4 10h12', key: '1y6xl8' }],\n ['path', { d: 'M4 14h9', key: '1loblj' }],\n [\n 'path',\n {\n d: 'M19 6a7.7 7.7 0 0 0-5.2-2A7.9 7.9 0 0 0 6 12c0 4.4 3.5 8 7.8 8 2 0 3.8-.8 5.2-2',\n key: '1j6lzo',\n },\n ],\n]);\n\nexport default Euro;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,iBAAiB,MAAQ,CAAA,CAAA,CAAA;AAAA,CAAA,CACpC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CACxC,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA;AAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,EAAA,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;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA;AACF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,45 @@
import * as z from 'zod/v4';
import { InvalidRequestError, InvalidClientError, ServerError, OAuthError } from '../errors.js';
const ClientAuthenticatedRequestSchema = z.object({
client_id: z.string(),
client_secret: z.string().optional()
});
export function authenticateClient({ clientsStore }) {
return async (req, res, next) => {
try {
const result = ClientAuthenticatedRequestSchema.safeParse(req.body);
if (!result.success) {
throw new InvalidRequestError(String(result.error));
}
const { client_id, client_secret } = result.data;
const client = await clientsStore.getClient(client_id);
if (!client) {
throw new InvalidClientError('Invalid client_id');
}
if (client.client_secret) {
if (!client_secret) {
throw new InvalidClientError('Client secret is required');
}
if (client.client_secret !== client_secret) {
throw new InvalidClientError('Invalid client_secret');
}
if (client.client_secret_expires_at && client.client_secret_expires_at < Math.floor(Date.now() / 1000)) {
throw new InvalidClientError('Client secret has expired');
}
}
req.client = client;
next();
}
catch (error) {
if (error instanceof OAuthError) {
const status = error instanceof ServerError ? 500 : 400;
res.status(status).json(error.toResponseObject());
}
else {
const serverError = new ServerError('Internal Server Error');
res.status(500).json(serverError.toResponseObject());
}
}
};
}
//# sourceMappingURL=clientAuth.js.map
@@ -0,0 +1 @@
{"version":3,"file":"cloud-rain.js","sources":["../../../src/icons/cloud-rain.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name CloudRain\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNNCAxNC44OTlBNyA3IDAgMSAxIDE1LjcxIDhoMS43OWE0LjUgNC41IDAgMCAxIDIuNSA4LjI0MiIgLz4KICA8cGF0aCBkPSJNMTYgMTR2NiIgLz4KICA8cGF0aCBkPSJNOCAxNHY2IiAvPgogIDxwYXRoIGQ9Ik0xMiAxNnY2IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/cloud-rain\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst CloudRain = createLucideIcon('CloudRain', [\n ['path', { d: 'M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242', key: '1pljnt' }],\n ['path', { d: 'M16 14v6', key: '1j4efv' }],\n ['path', { d: 'M8 14v6', key: '17c4r9' }],\n ['path', { d: 'M12 16v6', key: 'c8a4gj' }],\n]);\n\nexport default CloudRain;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,iBAAiB,WAAa,CAAA,CAAA,CAAA;AAAA,CAAA,CAC9C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA4D,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,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzF,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC3C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,457 @@
tlf2a 3 3 8 -1 22 0 0 0
===============================================================================
This is future.tlf, or “Future”, by Sam Hocevar.
2006/10/01 -- Sam Hocevar <sam@hocevar.net>
font creation
still missing: # % ( ) * / < > \ ^ ~
2006/10/02 -- Sam Hocevar <sam@hocevar.net>
added Unicode block and line glyphs
added: % ( ) * / \ ~
fixed: & 2 5 X
This font is free software. It comes without any warranty, to the extent
permitted by applicable law. You can redistribute it and/or modify it under
the terms of the Do What The Fuck You Want To Public License, Version 2,
as published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more
details.
Missing characters: # < > ^
This font is part of TOIlet’s official distribution. More information
on the TOIlet website at http://caca.zoy.org/wiki/toilet
===============================================================================
@
@
@@
╻!
╹!
╹!!
╻╻"
"
""
@
@
#@@
┏┳┓$
┗╋┓$
┗┻┛$$
┏┓╻%
┏━┛%
╹┗┛%%
┏┓ &
┃╺╋╸&
┗━┛ &&
╻'
'
''
┏╸(
┃ (
┗╸((
╺┓)
┃)
╺┛))
╻ ╻*
╺╋╸*
╹ ╹**
╻ +
╺╋╸+
╹ ++
,
,
┛,,
-
╺━╸-
--
.
.
╹..
╻/
┏┛/
╹ //
┏━┓0
┃┃┃0
┗━┛00
╺┓ 1
┃ 1
╺┻╸11
┏━┓2
┏━┛2
┗━╸22
┏━┓3
╺━┫3
┗━┛33
╻ ╻4
┗━┫4
╹44
┏━╸5
┗━┓5
┗━┛55
┏━┓6
┣━┓6
┗━┛66
┏━┓7
┃7
╹77
┏━┓8
┣━┫8
┗━┛88
┏━┓9
┗━┫9
┗━┛99
:
╹:
╹::
;
╹;
┛;;
@
@
<@@
=
╺━╸=
╺━╸==
@
@
>@@
┏━┓?
╺┛?
╹ ??
┏━┓@
┃┣┛@
┗━╸@@
┏━┓A
┣━┫A
╹ ╹AA
┏┓ B
┣┻┓B
┗━┛BB
┏━╸C
┃ C
┗━╸CC
╺┳┓D
┃┃D
╺┻┛DD
┏━╸E
┣╸ E
┗━╸EE
┏━╸F
┣╸ F
╹ FF
┏━╸G
┃╺┓G
┗━┛GG
╻ ╻H
┣━┫H
╹ ╹HH
╻I
┃I
╹II
┏┓J
┃J
┗━┛JJ
╻┏ K
┣┻┓K
╹ ╹KK
╻ L
┃ L
┗━╸LL
┏┳┓M
┃┃┃M
╹ ╹MM
┏┓╻N
┃┗┫N
╹ ╹NN
┏━┓O
┃ ┃O
┗━┛OO
┏━┓P
┣━┛P
╹ PP
┏━┓Q
┃┓┃Q
┗┻┛QQ
┏━┓R
┣┳┛R
╹┗╸RR
┏━┓S
┗━┓S
┗━┛SS
╺┳╸T
┃ T
╹ TT
╻ ╻U
┃ ┃U
┗━┛UU
╻ ╻V
┃┏┛V
┗┛ VV
╻ ╻W
┃╻┃W
┗┻┛WW
╻ ╻X
┏╋┛X
╹ ╹XX
╻ ╻Y
┗┳┛Y
╹ YY
╺━┓Z
┏━┛Z
┗━╸ZZ
┏━ [
┃ [
┗━ [[
╻ \
┗┓\
╹\\
━┓]
┃]
━┛]]
@
@
^@@
_
_
╺━╸__
┓`
`
``
┏━┓a
┣━┫a
╹ ╹aa
┏┓ b
┣┻┓b
┗━┛bb
┏━╸c
┃ c
┗━╸cc
╺┳┓d
┃┃d
╺┻┛dd
┏━╸e
┣╸ e
┗━╸ee
┏━╸f
┣╸ f
╹ ff
┏━╸g
┃╺┓g
┗━┛gg
╻ ╻h
┣━┫h
╹ ╹hh
╻i
┃i
╹ii
┏┓j
┃j
┗━┛jj
╻┏ k
┣┻┓k
╹ ╹kk
╻ l
┃ l
┗━╸ll
┏┳┓m
┃┃┃m
╹ ╹mm
┏┓╻n
┃┗┫n
╹ ╹nn
┏━┓o
┃ ┃o
┗━┛oo
┏━┓p
┣━┛p
╹ pp
┏━┓q
┃┓┃q
┗┻┛qq
┏━┓r
┣┳┛r
╹┗╸rr
┏━┓s
┗━┓s
┗━┛ss
╺┳╸t
┃ t
╹ tt
╻ ╻u
┃ ┃u
┗━┛uu
╻ ╻v
┃┏┛v
┗┛ vv
╻ ╻w
┃╻┃w
┗┻┛ww
╻ ╻x
┏╋┛x
╹ ╹xx
╻ ╻y
┗┳┛y
╹ yy
╺━┓z
┏━┛z
┗━╸zz
┏╸{
╺┫ {
┗╸{{
╻|
┃|
╹||
╺┓ }
┣╸}
╺┛ }}
~
┏━┛~
~~
┏━┓┏━╸Ä
┣━┫┣╸ Ä
╹ ╹┗━╸ÄÄ
┏━┓┏━╸Ö
┃ ┃┣╸ Ö
┗━┛┗━╸ÖÖ
╻ ╻┏━╸Ü
┃ ┃┣╸ Ü
┗━┛┗━╸ÜÜ
┏━┓┏━╸ä
┣━┫┣╸ ä
╹ ╹┗━╸ää
┏━┓┏━╸ö
┃ ┃┣╸ ö
┗━┛┗━╸öö
╻ ╻┏━╸ü
┃ ┃┣╸ ü
┗━┛┗━╸üü
┏━┓┏━┓ß
┗━┓┗━┓ß
┗━┛┗━┛ßß
0x2500 ─ BOX DRAWINGS LIGHT HORIZONTAL
@
━━━@
@@
0x2501 ━ BOX DRAWINGS HEAVY HORIZONTAL
@
■■■@
@@
0x2502 │ BOX DRAWINGS LIGHT VERTICAL
┃ @
┃ @
┃@@
0x2503 ┃ BOX DRAWINGS HEAVY VERTICAL
█ @
█ @
█@@
0x250C ┌ BOX DRAWINGS LIGHT DOWN AND RIGHT
@
┏━@
┃ @@
0x250F ┏ BOX DRAWINGS HEAVY DOWN AND RIGHT
@
▄■@
█ @@
0x2510 ┐ BOX DRAWINGS LIGHT DOWN AND LEFT
@
━┓ @
┃@@
0x2513 ┓ BOX DRAWINGS HEAVY DOWN AND LEFT
@
■▄ @
█@@
0x2514 └ BOX DRAWINGS LIGHT UP AND RIGHT
┃ @
┗━@
@@
0x2517 ┗ BOX DRAWINGS HEAVY UP AND RIGHT
█ @
▀■@
@@
0x2518 ┘ BOX DRAWINGS LIGHT UP AND LEFT
┃ @
━┛ @
@@
0x251B ┛ BOX DRAWINGS HEAVY UP AND LEFT
█ @
■▀ @
@@
0x251c ├ BOX DRAWINGS LIGHT VERTICAL AND RIGHT
┃ @
┣━@
┃ @@
0x2523 ┣ BOX DRAWINGS HEAVY VERTICAL AND RIGHT
█ @
█■@
█ @@
0x2524 ┤ BOX DRAWINGS LIGHT VERTICAL AND LEFT
┃ @
━┫ @
┃@@
0x252B ┫ BOX DRAWINGS HEAVY VERTICAL AND LEFT
█ @
■█ @
█@@
0x252c ┬ BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
@
━┳━@
┃ @@
0x2533 ┳ BOX DRAWINGS HEAVY DOWN AND HORIZONTAL
@
■▄■@
█ @@
0x2534 ┴ BOX DRAWINGS LIGHT UP AND HORIZONTAL
┃ @
━┻━@
@@
0x253B ┻ BOX DRAWINGS HEAVY UP AND HORIZONTAL
█ @
■▀■@
@@
0x253c ┼ BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
┃ @
━╋━@
┃ @@
0x254B ╋ BOX DRAWINGS HEAVY VERTICAL AND HORIZONTAL
█ @
■█■@
█ @@
0x2578 ╸ BOX DRAWINGS HEAVY LEFT
@
■■ @
@@
0x2579 ╹ BOX DRAWINGS HEAVY UP
█ @
▀ @
@@
0x257A ╺ BOX DRAWINGS HEAVY RIGHT
@
■■@
@@
0x257B ╻ BOX DRAWINGS HEAVY DOWN
@
▄ @
█@@
0x2580 ▀ UPPER HALF BLOCK
███@
▀▀▀@
@@
0x2584 ▄ LOWER HALF BLOCK
@
▄▄▄@
███@
0x2588 █ FULL BLOCK
███@
███@
███@@
0x25A0 ■ BLACK SQUARE
▄▄▄@
███@
▀▀▀@@
0x5350 卐 CJK UNIFIED IDEOGRAPH-5350
╻┏╸@
┗╋┓@
╺┛╹@@
0x534D 卍 CJK UNIFIED IDEOGRAPH-534D
╺┓╻@
┏╋┛@
╹┗╸@@
@@ -0,0 +1,269 @@
import { randomUUID } from 'node:crypto';
import { McpServer } from '../../server/mcp.js';
import { StreamableHTTPServerTransport } from '../../server/streamableHttp.js';
import { SSEServerTransport } from '../../server/sse.js';
import * as z from 'zod/v4';
import { isInitializeRequest } from '../../types.js';
import { InMemoryEventStore } from '../shared/inMemoryEventStore.js';
import { createMcpExpressApp } from '../../server/express.js';
/**
* This example server demonstrates backwards compatibility with both:
* 1. The deprecated HTTP+SSE transport (protocol version 2024-11-05)
* 2. The Streamable HTTP transport (protocol version 2025-11-25)
*
* It maintains a single MCP server instance but exposes two transport options:
* - /mcp: The new Streamable HTTP endpoint (supports GET/POST/DELETE)
* - /sse: The deprecated SSE endpoint for older clients (GET to establish stream)
* - /messages: The deprecated POST endpoint for older clients (POST to send messages)
*/
const getServer = () => {
const server = new McpServer({
name: 'backwards-compatible-server',
version: '1.0.0'
}, { capabilities: { logging: {} } });
// Register a simple tool that sends notifications over time
server.registerTool('start-notification-stream', {
description: 'Starts sending periodic notifications for testing resumability',
inputSchema: {
interval: z.number().describe('Interval in milliseconds between notifications').default(100),
count: z.number().describe('Number of notifications to send (0 for 100)').default(50)
}
}, async ({ interval, count }, extra) => {
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
let counter = 0;
while (count === 0 || counter < count) {
counter++;
try {
await server.sendLoggingMessage({
level: 'info',
data: `Periodic notification #${counter} at ${new Date().toISOString()}`
}, extra.sessionId);
}
catch (error) {
console.error('Error sending notification:', error);
}
// Wait for the specified interval
await sleep(interval);
}
return {
content: [
{
type: 'text',
text: `Started sending periodic notifications every ${interval}ms`
}
]
};
});
return server;
};
// Create Express application
const app = createMcpExpressApp();
// Close sessions that have been idle for IDLE_MS, and keep at most MAX_SESSIONS open
const IDLE_MS = 30 * 60000;
const MAX_SESSIONS = 1000;
const sessions = new Map();
// Count open responses so a long-running request or a listening SSE stream is not treated as idle
const trackResponse = (session, res) => {
if (!res.socket || res.destroyed)
return;
session.open++;
res.on('close', () => {
session.open--;
session.lastActive = Date.now();
});
};
// Close sessions with nothing open and no activity for IDLE_MS
setInterval(() => {
const cutoff = Date.now() - IDLE_MS;
for (const { transport, open, lastActive } of sessions.values()) {
if (open === 0 && lastActive < cutoff)
transport.close().catch(console.error);
}
}, 60000).unref();
//=============================================================================
// STREAMABLE HTTP TRANSPORT (PROTOCOL VERSION 2025-11-25)
//=============================================================================
// Handle all MCP Streamable HTTP requests (GET, POST, DELETE) on a single endpoint
app.all('/mcp', async (req, res) => {
console.log(`Received ${req.method} request to /mcp`);
try {
// Check for existing session ID
const sessionId = req.headers['mcp-session-id'];
const session = sessionId ? sessions.get(sessionId) : undefined;
let transport;
if (session) {
// Check if the transport is of the correct type
if (session.transport instanceof StreamableHTTPServerTransport) {
// Reuse existing transport
transport = session.transport;
trackResponse(session, res);
}
else {
// Transport exists but is not a StreamableHTTPServerTransport (could be SSEServerTransport)
res.status(400).json({
jsonrpc: '2.0',
error: {
code: -32000,
message: 'Bad Request: Session exists but uses a different transport protocol'
},
id: null
});
return;
}
}
else if (!sessionId && req.method === 'POST' && isInitializeRequest(req.body)) {
if (sessions.size >= MAX_SESSIONS) {
res.status(503).json({ jsonrpc: '2.0', error: { code: -32000, message: 'Too many open sessions' }, id: null });
return;
}
const eventStore = new InMemoryEventStore();
transport = new StreamableHTTPServerTransport({
sessionIdGenerator: () => randomUUID(),
eventStore, // Enable resumability
onsessioninitialized: sessionId => {
// Store the transport by session ID when session is initialized
console.log(`StreamableHTTP session initialized with ID: ${sessionId}`);
sessions.set(sessionId, { transport, open: 0, lastActive: Date.now() });
}
});
// Set up onclose handler to clean up transport when closed
transport.onclose = () => {
const sid = transport.sessionId;
if (sid && sessions.has(sid)) {
console.log(`Transport closed for session ${sid}, removing from sessions map`);
sessions.delete(sid);
}
};
// Connect the transport to the MCP server
const server = getServer();
await server.connect(transport);
}
else if (sessionId) {
// Unknown or expired session ID - the client should start a new session
res.status(404).json({ jsonrpc: '2.0', error: { code: -32001, message: 'Session not found' }, id: null });
return;
}
else {
// Invalid request - no session ID and not an initialization request
res.status(400).json({
jsonrpc: '2.0',
error: {
code: -32000,
message: 'Bad Request: No valid session ID provided'
},
id: null
});
return;
}
// Handle the request with the transport
await transport.handleRequest(req, res, req.body);
}
catch (error) {
console.error('Error handling MCP request:', error);
if (!res.headersSent) {
res.status(500).json({
jsonrpc: '2.0',
error: {
code: -32603,
message: 'Internal server error'
},
id: null
});
}
}
});
//=============================================================================
// DEPRECATED HTTP+SSE TRANSPORT (PROTOCOL VERSION 2024-11-05)
//=============================================================================
app.get('/sse', async (req, res) => {
console.log('Received GET request to /sse (deprecated SSE transport)');
if (sessions.size >= MAX_SESSIONS) {
res.status(503).send('Too many open sessions');
return;
}
const transport = new SSEServerTransport('/messages', res);
// An SSE session lasts as long as this response, which counts as open until it closes
const session = { transport, open: 0, lastActive: Date.now() };
sessions.set(transport.sessionId, session);
trackResponse(session, res);
// Set up onclose handler to clean up transport when closed
transport.onclose = () => {
sessions.delete(transport.sessionId);
};
const server = getServer();
await server.connect(transport);
});
app.post('/messages', async (req, res) => {
const sessionId = req.query.sessionId;
let transport;
const existingTransport = sessions.get(sessionId)?.transport;
if (existingTransport instanceof SSEServerTransport) {
// Reuse existing transport
transport = existingTransport;
}
else {
// Transport exists but is not a SSEServerTransport (could be StreamableHTTPServerTransport)
res.status(400).json({
jsonrpc: '2.0',
error: {
code: -32000,
message: 'Bad Request: Session exists but uses a different transport protocol'
},
id: null
});
return;
}
if (transport) {
await transport.handlePostMessage(req, res, req.body);
}
else {
res.status(400).send('No transport found for sessionId');
}
});
// Start the server
const PORT = 3000;
app.listen(PORT, error => {
if (error) {
console.error('Failed to start server:', error);
process.exit(1);
}
console.log(`Backwards compatible MCP server listening on port ${PORT}`);
console.log(`
==============================================
SUPPORTED TRANSPORT OPTIONS:
1. Streamable Http(Protocol version: 2025-11-25)
Endpoint: /mcp
Methods: GET, POST, DELETE
Usage:
- Initialize with POST to /mcp
- Establish SSE stream with GET to /mcp
- Send requests with POST to /mcp
- Terminate session with DELETE to /mcp
2. Http + SSE (Protocol version: 2024-11-05)
Endpoints: /sse (GET) and /messages (POST)
Usage:
- Establish SSE stream with GET to /sse
- Send requests with POST to /messages?sessionId=<id>
==============================================
`);
});
// Handle server shutdown
process.on('SIGINT', async () => {
console.log('Shutting down server...');
// Close all active transports to properly clean up resources
for (const [sessionId, { transport }] of sessions) {
try {
console.log(`Closing transport for session ${sessionId}`);
await transport.close();
sessions.delete(sessionId);
}
catch (error) {
console.error(`Error closing transport for session ${sessionId}:`, error);
}
}
console.log('Server shutdown complete');
process.exit(0);
});
//# sourceMappingURL=sseAndStreamableHttpCompatibleServer.js.map
@@ -0,0 +1,128 @@
{
"name": "fflate",
"version": "0.8.3",
"description": "High performance (de)compression in an 8kB package",
"main": "./lib/index.cjs",
"module": "./esm/browser.js",
"types": "./lib/index.d.ts",
"unpkg": "./umd/index.js",
"jsdelivr": "./umd/index.js",
"browser": {
"./lib/node-worker.cjs": "./lib/worker.cjs"
},
"exports": {
".": {
"node": {
"import": {
"types": "./esm/index.d.mts",
"default": "./esm/index.mjs"
},
"require": {
"types": "./lib/node.d.cts",
"default": "./lib/node.cjs"
}
},
"import": {
"types": "./esm/browser.d.ts",
"default": "./esm/browser.js"
},
"require": {
"types": "./lib/browser.d.cts",
"default": "./lib/browser.cjs"
}
},
"./node": {
"import": {
"types": "./esm/index.d.mts",
"default": "./esm/index.mjs"
},
"require": {
"types": "./lib/node.d.cts",
"default": "./lib/node.cjs"
}
},
"./browser": {
"import": {
"types": "./esm/browser.d.ts",
"default": "./esm/browser.js"
},
"require": {
"types": "./lib/browser.d.cts",
"default": "./lib/browser.cjs"
}
},
"./package.json": "./package.json"
},
"targets": {
"main": false,
"module": false,
"browser": false,
"types": false
},
"sideEffects": false,
"homepage": "https://101arrowz.github.io/fflate",
"repository": "https://github.com/101arrowz/fflate",
"bugs": {
"email": "arjunbarrett@gmail.com",
"url": "https://github.com/101arrowz/fflate/issues"
},
"author": "Arjun Barrett <arjunbarrett@gmail.com>",
"license": "MIT",
"keywords": [
"gzip",
"gunzip",
"deflate",
"inflate",
"compression",
"decompression",
"zlib",
"pako",
"jszip",
"browser",
"node.js",
"tiny",
"fast",
"zip",
"unzip",
"non-blocking"
],
"scripts": {
"build": "npm run build:lib && npm run build:docs && npm run build:demo",
"script": "node -r ts-node/register scripts/$SC.ts",
"build:lib": "tsc && tsc --project tsconfig.esm.json && npm run build:rewrite && npm run build:umd",
"build:umd": "SC=buildUMD npm run script",
"build:rewrite": "SC=rewriteBuilds npm run script",
"build:demo": "tsc --project tsconfig.demo.json && parcel build demo/index.html --no-cache --public-url \"./\" && SC=cpGHPages npm run script",
"build:docs": "typedoc --plugin typedoc-plugin-markdown --hideBreadcrumbs --readme none --disableSources --excludePrivate --excludeProtected --expandParameters --githubPages false --out docs/ src/index.ts",
"test": "TS_NODE_PROJECT=test/tsconfig.json uvu -b -r ts-node/register test",
"prepack": "npm run build && npm run test"
},
"devDependencies": {
"@parcel/service-worker": "^2.9.3",
"@types/node": "^25.8.0",
"@types/pako": "*",
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"jszip": "^3.10.1",
"pako": "*",
"parcel": "^2.9.3",
"preact": "^10.17.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"simple-git": "^3.19.1",
"terser": "^5.47.1",
"tiny-inflate": "*",
"ts-node": "^10.9.2",
"typedoc": "^0.28.19",
"typedoc-plugin-markdown": "^4.11.0",
"typescript": "^6.0.3",
"uvu": "^0.5.6",
"uzip": "*"
},
"alias": {
"react": "preact/compat",
"react-dom": "preact/compat",
"buffer": false,
"process": false
}
}
@@ -0,0 +1,23 @@
The MIT License (MIT)
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
Copyright (c) 2016 Douglas Christopher Wilson <doug@somethingdoug.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
@@ -0,0 +1,77 @@
import { NavigateOptions } from './link.js';
import { AnyRouter, RegisteredRouter } from './router.js';
export type AnyRedirect = Redirect<any, any, any, any, any>;
/**
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType)
*/
export type Redirect<TRouter extends AnyRouter = RegisteredRouter, TFrom extends string = string, TTo extends string | undefined = undefined, TMaskFrom extends string = TFrom, TMaskTo extends string = '.'> = Response & {
options: NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {};
redirectHandled?: boolean;
};
export type RedirectOptions<TRouter extends AnyRouter = RegisteredRouter, TFrom extends string = string, TTo extends string | undefined = undefined, TMaskFrom extends string = TFrom, TMaskTo extends string = '.'> = {
href?: string;
/**
* @deprecated Use `statusCode` instead
**/
code?: number;
/**
* The HTTP status code to use when redirecting.
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType#statuscode-property)
*/
statusCode?: number;
/**
* If provided, will throw the redirect object instead of returning it. This can be useful in places where `throwing` in a function might cause it to have a return type of `never`. In that case, you can use `redirect({ throw: true })` to throw the redirect object instead of returning it.
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType#throw-property)
*/
throw?: any;
/**
* The HTTP headers to use when redirecting.
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType#headers-property)
*/
headers?: HeadersInit;
} & NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>;
export type ResolvedRedirect<TRouter extends AnyRouter = RegisteredRouter, TFrom extends string = string, TTo extends string = '', TMaskFrom extends string = TFrom, TMaskTo extends string = ''> = Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>;
/**
* Options for route-bound redirect, where 'from' is automatically set.
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType)
*/
export type RedirectOptionsRoute<TDefaultFrom extends string = string, TRouter extends AnyRouter = RegisteredRouter, TTo extends string | undefined = undefined, TMaskTo extends string = ''> = Omit<RedirectOptions<TRouter, TDefaultFrom, TTo, TDefaultFrom, TMaskTo>, 'from'>;
/**
* A redirect function bound to a specific route, with 'from' pre-set to the route's fullPath.
* This enables relative redirects like `Route.redirect({ to: './overview' })`.
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType)
*/
export interface RedirectFnRoute<in out TDefaultFrom extends string = string> {
<TRouter extends AnyRouter = RegisteredRouter, const TTo extends string | undefined = undefined, const TMaskTo extends string = ''>(opts: RedirectOptionsRoute<TDefaultFrom, TRouter, TTo, TMaskTo>): Redirect<TRouter, TDefaultFrom, TTo, TDefaultFrom, TMaskTo>;
}
/**
* Create a redirect Response understood by TanStack Router.
*
* Use from route `loader`/`beforeLoad` or server functions to trigger a
* navigation. If `throw: true` is set, the redirect is thrown instead of
* returned. When an absolute `href` is supplied and `reloadDocument` is not
* set, a full-document navigation is inferred.
*
* @param opts Options for the redirect. Common fields:
* - `href`: absolute URL for external redirects; infers `reloadDocument`.
* - `statusCode`: HTTP status code to use (defaults to 307).
* - `headers`: additional headers to include on the Response.
* - Standard navigation options like `to`, `params`, `search`, `replace`,
* and `reloadDocument` for internal redirects.
* @returns A Response augmented with router navigation options.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/redirectFunction
*/
export declare function redirect<TRouter extends AnyRouter = RegisteredRouter, const TTo extends string | undefined = '.', const TFrom extends string = string, const TMaskFrom extends string = TFrom, const TMaskTo extends string = ''>(opts: RedirectOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>;
/** Check whether a value is a TanStack Router redirect Response. */
/** Check whether a value is a TanStack Router redirect Response. */
export declare function isRedirect(obj: any): obj is AnyRedirect;
/** True if value is a redirect with a resolved `href` location. */
/** True if value is a redirect with a resolved `href` location. */
export declare function isResolvedRedirect(obj: any): obj is AnyRedirect & {
options: {
href: string;
};
};
/** Parse a serialized redirect object back into a redirect Response. */
/** Parse a serialized redirect object back into a redirect Response. */
export declare function parseRedirect(obj: any): Redirect<AnyRouter, string, ".", string, ""> | undefined;
@@ -0,0 +1,412 @@
flf2a$ 4 3 8 -1 3
Stick Figures By Joan Stark
Website: http://www.geocities.com/SoHo/7373/
Figlet conversion by patorjk, April 17, 2008
$ $@
$ $@
$ $@
$ $@@
/@
/ @
. @
@@
..@
''@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
. @
' @
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
. @
' @@
@
__ @
@
@@
@
@
.@
@@
/ @
/ @
/ @
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
$@
.@
.@
@@
$@
.@
,@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
__ @
_|@
. @
@@
@
@
@
@@
@
/\ @
/~~\ @
@@
__ @
|__) @
|__) @
@@
__ @
/ ` @
\__, @
@@
__ @
| \ @
|__/ @
@@
___ @
|__ @
|___ @
@@
___ @
|__ @
| @
@@
__ @
/ _` @
\__> @
@@
@
|__| @
| | @
@@
@
| @
| @
@@
@
| @
\__/ @
@@
@
|__/ @
| \ @
@@
@
| @
|___ @
@@
@
|\/| @
| | @
@@
@
|\ | @
| \| @
@@
__ @
/ \ @
\__/ @
@@
__ @
|__) @
| @
@@
__ @
/ \ @
\__X @
@@
__ @
|__) @
| \ @
@@
__ @
/__` @
.__/ @
@@
___ @
| @
| @
@@
@
| | @
\__/ @
@@
@
\ / @
\/ @
@@
@
| | @
|/\| @
@@
@
\_/ @
/ \ @
@@
@
\ / @
| @
@@
__ @
/ @
/_ @
@@
@
@
@
@@
\ @
\ @
\ @
@@
@
@
@
@@
@
@
@
@@
@
@
___ @
@@
. @
` @
@
@@
@
/\ @
/~~\ @
@@
__ @
|__) @
|__) @
@@
__ @
/ ` @
\__, @
@@
__ @
| \ @
|__/ @
@@
___ @
|__ @
|___ @
@@
___ @
|__ @
| @
@@
__ @
/ _` @
\__> @
@@
@
|__| @
| | @
@@
@
| @
| @
@@
@
| @
\__/ @
@@
@
|__/ @
| \ @
@@
@
| @
|___ @
@@
@
|\/| @
| | @
@@
@
|\ | @
| \| @
@@
__ @
/ \ @
\__/ @
@@
__ @
|__) @
| @
@@
__ @
/ \ @
\__X @
@@
__ @
|__) @
| \ @
@@
__ @
/__` @
.__/ @
@@
___ @
| @
| @
@@
@
| | @
\__/ @
@@
@
\ / @
\/ @
@@
@
| | @
|/\| @
@@
@
\_/ @
/ \ @
@@
@
\ / @
| @
@@
__ @
/ @
/_ @
@@
@
@
@
@@
| @
| @
| @
| @@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@@ -0,0 +1,18 @@
import { __assign, __rest } from "tslib";
import * as React from 'react';
var SideCar = function (_a) {
var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
if (!sideCar) {
throw new Error('Sidecar: please provide `sideCar` property to import the right car');
}
var Target = sideCar.read();
if (!Target) {
throw new Error('Sidecar medium not found');
}
return React.createElement(Target, __assign({}, rest));
};
SideCar.isSideCarExport = true;
export function exportSidecar(medium, exported) {
medium.useMedium(exported);
return SideCar;
}
@@ -0,0 +1,210 @@
# 🧀 Magicast
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![bundle][bundle-src]][bundle-href]
[![Codecov][codecov-src]][codecov-href]
[![License][license-src]][license-href]
[![JSDocs][jsdocs-src]][jsdocs-href]
Programmatically modify JavaScript and TypeScript source codes with a simplified, elegant and familiar syntax. Built on top of the [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) parsed by [recast](https://github.com/benjamn/recast) and [babel](https://babeljs.io/).
❯ 🧙🏼 **Magical** modify a JS/TS file and write back magically just like JSON!<br>
❯ 🔀 **Exports/Import** manipulate module's imports and exports at ease<br>
❯ 💼 **Function Arguments** easily manipulate arguments passed to a function call, like `defineConfig()`<br>
❯ 🎨 **Smart Formatting** preseves the formatting style (quotes, tabs, etc.) from the original code<br>
❯ 🧑‍💻 **Readable** get rid of the complexity of AST manipulation and make your code super readable<br>
## Install
Install npm package:
```sh
yarn add --dev magicast
npm install -D magicast
pnpm add -D magicast
```
Import utilities:
```js
import { parseModule, generateCode, builders, createNode } from "magicast";
```
## Examples
**Example:** Modify a file:
`config.js`:
```js
export default {
foo: ["a"],
};
```
Code to modify and append `b` to `foo` prop of defaultExport:
```js
import { loadFile, writeFile } from "magicast";
const mod = await loadFile("config.js");
mod.exports.default.foo.push("b");
await writeFile(mod, "config.js");
```
Updated `config.js`:
```js
export default {
foo: ["a", "b"],
};
```
**Example:** Directly use AST utils:
```js
import { parseModule, generateCode } from "magicast";
// Parse to AST
const mod = parseModule(`export default { }`);
// Ensure foo is an array
mod.exports.default.foo ||= [];
// Add a new array member
mod.exports.default.foo.push("b");
mod.exports.default.foo.unshift("a");
// Generate code
const { code, map } = generateCode(mod);
```
Generated code:
```js
export default {
foo: ["a", "b"],
};
```
**Example:** Get the AST directly:
```js
import { parseModule, generateCode } from "magicast";
const mod = parseModule(`export default { }`);
const ast = mod.exports.default.$ast;
// do something with ast
```
**Example:** Function arguments:
```js
import { parseModule, generateCode } from "magicast";
const mod = parseModule(`export default defineConfig({ foo: 'bar' })`);
// Support for both bare object export and `defineConfig` wrapper
const options =
mod.exports.default.$type === "function-call"
? mod.exports.default.$args[0]
: mod.exports.default;
console.log(options.foo); // bar
```
**Example:** Create a function call:
```js
import { parseModule, generateCode, builders } from "magicast";
const mod = parseModule(`export default {}`);
const options = (mod.exports.default.list = builders.functionCall(
"create",
[1, 2, 3],
));
console.log(mod.generateCode()); // export default { list: create([1, 2, 3]) }
```
## Notes
As JavaScript is a very dynamic language, you should be aware that Magicast's convention **CAN NOT cover all possible cases**. Magicast serves as a simple and maintainable interface to update static-ish JavaScript code. When interacting with Magicast node, be aware that every option might have chance to throw an error depending on the input code. We recommend to always wrap the code in a `try/catch` block (even better to do some defensive coding), for example:
```ts
import { loadFile, writeFile } from "magicast";
function updateConfig() {
try {
const mod = await loadFile("config.js");
mod.exports.default.foo.push("b");
await writeFile(mod);
} catch {
console.error("Unable to update config.js");
console.error(
"Please update it manually with the following instructions: ...",
);
// handle error
}
}
```
## Browser / Worker Support
The main export of `magicast` contains filesystem utilities. If you want to use it in a browser or worker, import from `magicast/core` instead.
```js
import { parseModule } from "magicast/core";
```
## High Level Helpers
We also experiment to provide a few high level helpers to make common tasks easier. You could import them from `magicast/helpers`. They might be moved to a separate package in the future.
```js
import {
deepMergeObject,
addNuxtModule,
addVitePlugin,
// ...
} from "magicast/helpers";
```
We recommend to check out the [source code](./src/helpers) and [test cases](./test/helpers) for more details.
## Development
- Clone this repository
- Install latest LTS version of [Node.js](https://nodejs.org/en/)
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
- Install dependencies using `pnpm install`
- Run interactive tests using `pnpm dev`
## License
Made with 💛
Published under [MIT License](./LICENSE).
<!-- Badges -->
[npm-version-src]: https://img.shields.io/npm/v/magicast?style=flat&colorA=18181B&colorB=F0DB4F
[npm-version-href]: https://npmjs.com/package/magicast
[npm-downloads-src]: https://img.shields.io/npm/dm/magicast?style=flat&colorA=18181B&colorB=F0DB4F
[npm-downloads-href]: https://npmjs.com/package/magicast
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/magicast/main?style=flat&colorA=18181B&colorB=F0DB4F
[codecov-href]: https://codecov.io/gh/unjs/magicast
[bundle-src]: https://img.shields.io/bundlephobia/minzip/magicast?style=flat&colorA=18181B&colorB=F0DB4F
[bundle-href]: https://bundlephobia.com/result?p=magicast
[license-src]: https://img.shields.io/github/license/unjs/magicast.svg?style=flat&colorA=18181B&colorB=F0DB4F
[license-href]: https://github.com/unjs/magicast/blob/main/LICENSE
[jsdocs-src]: https://img.shields.io/badge/jsDocs.io-reference-18181B?style=flat&colorA=18181B&colorB=F0DB4F
[jsdocs-href]: https://www.jsdocs.io/package/magicast
@@ -0,0 +1 @@
{"version":3,"names":["_index","require","STANDARDIZED_TYPES","exports","FLIPPED_ALIAS_KEYS","EXPRESSION_TYPES","BINARY_TYPES","SCOPABLE_TYPES","BLOCKPARENT_TYPES","BLOCK_TYPES","STATEMENT_TYPES","TERMINATORLESS_TYPES","COMPLETIONSTATEMENT_TYPES","CONDITIONAL_TYPES","LOOP_TYPES","WHILE_TYPES","EXPRESSIONWRAPPER_TYPES","FOR_TYPES","FORXSTATEMENT_TYPES","FUNCTION_TYPES","FUNCTIONPARENT_TYPES","PUREISH_TYPES","DECLARATION_TYPES","FUNCTIONPARAMETER_TYPES","PATTERNLIKE_TYPES","LVAL_TYPES","TSENTITYNAME_TYPES","LITERAL_TYPES","IMMUTABLE_TYPES","USERWHITESPACABLE_TYPES","METHOD_TYPES","OBJECTMEMBER_TYPES","PROPERTY_TYPES","UNARYLIKE_TYPES","PATTERN_TYPES","CLASS_TYPES","IMPORTOREXPORTDECLARATION_TYPES","EXPORTDECLARATION_TYPES","MODULESPECIFIER_TYPES","ACCESSOR_TYPES","PRIVATE_TYPES","FLOW_TYPES","FLOWTYPE_TYPES","FLOWBASEANNOTATION_TYPES","FLOWDECLARATION_TYPES","FLOWPREDICATE_TYPES","ENUMBODY_TYPES","ENUMMEMBER_TYPES","JSX_TYPES","MISCELLANEOUS_TYPES","TYPESCRIPT_TYPES","TSTYPEELEMENT_TYPES","TSTYPE_TYPES","TSBASETYPE_TYPES","MODULEDECLARATION_TYPES"],"sources":["../../../src/constants/generated/index.ts"],"sourcesContent":["/*\n * This file is auto-generated! Do not modify it directly.\n * To re-generate run 'make build'\n */\nimport { FLIPPED_ALIAS_KEYS } from \"../../definitions/index.ts\";\n\nexport const STANDARDIZED_TYPES = FLIPPED_ALIAS_KEYS[\"Standardized\"];\nexport const EXPRESSION_TYPES = FLIPPED_ALIAS_KEYS[\"Expression\"];\nexport const BINARY_TYPES = FLIPPED_ALIAS_KEYS[\"Binary\"];\nexport const SCOPABLE_TYPES = FLIPPED_ALIAS_KEYS[\"Scopable\"];\nexport const BLOCKPARENT_TYPES = FLIPPED_ALIAS_KEYS[\"BlockParent\"];\nexport const BLOCK_TYPES = FLIPPED_ALIAS_KEYS[\"Block\"];\nexport const STATEMENT_TYPES = FLIPPED_ALIAS_KEYS[\"Statement\"];\nexport const TERMINATORLESS_TYPES = FLIPPED_ALIAS_KEYS[\"Terminatorless\"];\nexport const COMPLETIONSTATEMENT_TYPES =\n FLIPPED_ALIAS_KEYS[\"CompletionStatement\"];\nexport const CONDITIONAL_TYPES = FLIPPED_ALIAS_KEYS[\"Conditional\"];\nexport const LOOP_TYPES = FLIPPED_ALIAS_KEYS[\"Loop\"];\nexport const WHILE_TYPES = FLIPPED_ALIAS_KEYS[\"While\"];\nexport const EXPRESSIONWRAPPER_TYPES = FLIPPED_ALIAS_KEYS[\"ExpressionWrapper\"];\nexport const FOR_TYPES = FLIPPED_ALIAS_KEYS[\"For\"];\nexport const FORXSTATEMENT_TYPES = FLIPPED_ALIAS_KEYS[\"ForXStatement\"];\nexport const FUNCTION_TYPES = FLIPPED_ALIAS_KEYS[\"Function\"];\nexport const FUNCTIONPARENT_TYPES = FLIPPED_ALIAS_KEYS[\"FunctionParent\"];\nexport const PUREISH_TYPES = FLIPPED_ALIAS_KEYS[\"Pureish\"];\nexport const DECLARATION_TYPES = FLIPPED_ALIAS_KEYS[\"Declaration\"];\nexport const FUNCTIONPARAMETER_TYPES = FLIPPED_ALIAS_KEYS[\"FunctionParameter\"];\nexport const PATTERNLIKE_TYPES = FLIPPED_ALIAS_KEYS[\"PatternLike\"];\nexport const LVAL_TYPES = FLIPPED_ALIAS_KEYS[\"LVal\"];\nexport const TSENTITYNAME_TYPES = FLIPPED_ALIAS_KEYS[\"TSEntityName\"];\nexport const LITERAL_TYPES = FLIPPED_ALIAS_KEYS[\"Literal\"];\nexport const IMMUTABLE_TYPES = FLIPPED_ALIAS_KEYS[\"Immutable\"];\nexport const USERWHITESPACABLE_TYPES = FLIPPED_ALIAS_KEYS[\"UserWhitespacable\"];\nexport const METHOD_TYPES = FLIPPED_ALIAS_KEYS[\"Method\"];\nexport const OBJECTMEMBER_TYPES = FLIPPED_ALIAS_KEYS[\"ObjectMember\"];\nexport const PROPERTY_TYPES = FLIPPED_ALIAS_KEYS[\"Property\"];\nexport const UNARYLIKE_TYPES = FLIPPED_ALIAS_KEYS[\"UnaryLike\"];\nexport const PATTERN_TYPES = FLIPPED_ALIAS_KEYS[\"Pattern\"];\nexport const CLASS_TYPES = FLIPPED_ALIAS_KEYS[\"Class\"];\nexport const IMPORTOREXPORTDECLARATION_TYPES =\n FLIPPED_ALIAS_KEYS[\"ImportOrExportDeclaration\"];\nexport const EXPORTDECLARATION_TYPES = FLIPPED_ALIAS_KEYS[\"ExportDeclaration\"];\nexport const MODULESPECIFIER_TYPES = FLIPPED_ALIAS_KEYS[\"ModuleSpecifier\"];\nexport const ACCESSOR_TYPES = FLIPPED_ALIAS_KEYS[\"Accessor\"];\nexport const PRIVATE_TYPES = FLIPPED_ALIAS_KEYS[\"Private\"];\nexport const FLOW_TYPES = FLIPPED_ALIAS_KEYS[\"Flow\"];\nexport const FLOWTYPE_TYPES = FLIPPED_ALIAS_KEYS[\"FlowType\"];\nexport const FLOWBASEANNOTATION_TYPES =\n FLIPPED_ALIAS_KEYS[\"FlowBaseAnnotation\"];\nexport const FLOWDECLARATION_TYPES = FLIPPED_ALIAS_KEYS[\"FlowDeclaration\"];\nexport const FLOWPREDICATE_TYPES = FLIPPED_ALIAS_KEYS[\"FlowPredicate\"];\nexport const ENUMBODY_TYPES = FLIPPED_ALIAS_KEYS[\"EnumBody\"];\nexport const ENUMMEMBER_TYPES = FLIPPED_ALIAS_KEYS[\"EnumMember\"];\nexport const JSX_TYPES = FLIPPED_ALIAS_KEYS[\"JSX\"];\nexport const MISCELLANEOUS_TYPES = FLIPPED_ALIAS_KEYS[\"Miscellaneous\"];\nexport const TYPESCRIPT_TYPES = FLIPPED_ALIAS_KEYS[\"TypeScript\"];\nexport const TSTYPEELEMENT_TYPES = FLIPPED_ALIAS_KEYS[\"TSTypeElement\"];\nexport const TSTYPE_TYPES = FLIPPED_ALIAS_KEYS[\"TSType\"];\nexport const TSBASETYPE_TYPES = FLIPPED_ALIAS_KEYS[\"TSBaseType\"];\n/**\n * @deprecated migrate to IMPORTOREXPORTDECLARATION_TYPES.\n */\nexport const MODULEDECLARATION_TYPES = IMPORTOREXPORTDECLARATION_TYPES;\n"],"mappings":";;;;;;AAIA,IAAAA,MAAA,GAAAC,OAAA;AAEO,MAALine truncated
@@ -0,0 +1,77 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.AnyType = void 0;
exports.discriminateAnyType = discriminateAnyType;
const tsutils = __importStar(require("ts-api-utils"));
const predicates_1 = require("./predicates");
var AnyType;
(function (AnyType) {
AnyType[AnyType["Any"] = 0] = "Any";
AnyType[AnyType["PromiseAny"] = 1] = "PromiseAny";
AnyType[AnyType["AnyArray"] = 2] = "AnyArray";
AnyType[AnyType["Safe"] = 3] = "Safe";
})(AnyType || (exports.AnyType = AnyType = {}));
/**
* @returns `AnyType.Any` if the type is `any`, `AnyType.AnyArray` if the type is `any[]` or `readonly any[]`, `AnyType.PromiseAny` if the type is `Promise<any>`,
* otherwise it returns `AnyType.Safe`.
*/
function discriminateAnyType(type, checker, program, tsNode) {
return discriminateAnyTypeWorker(type, checker, program, tsNode, new Set());
}
function discriminateAnyTypeWorker(type, checker, program, tsNode, visited) {
if (visited.has(type)) {
return AnyType.Safe;
}
visited.add(type);
if ((0, predicates_1.isTypeAnyType)(type)) {
return AnyType.Any;
}
if ((0, predicates_1.isTypeAnyArrayType)(type, checker)) {
return AnyType.AnyArray;
}
for (const part of tsutils.typeConstituents(type)) {
if (tsutils.isThenableType(checker, tsNode, part)) {
const awaitedType = checker.getAwaitedType(part);
if (awaitedType) {
const awaitedAnyType = discriminateAnyTypeWorker(awaitedType, checker, program, tsNode, visited);
if (awaitedAnyType === AnyType.Any) {
return AnyType.PromiseAny;
}
}
}
}
return AnyType.Safe;
}
@@ -0,0 +1 @@
{"version":3,"file":"use-drag-controls.mjs","sources":["../../../../src/gestures/drag/use-drag-controls.ts"],"sourcesContent":["import * as React from \"react\"\nimport { useConstant } from \"../../utils/use-constant\"\nimport {\n DragControlOptions,\n VisualElementDragControls,\n} from \"./VisualElementDragControls\"\n\n/**\n * Can manually trigger a drag gesture on one or more `drag`-enabled `motion` components.\n *\n * ```jsx\n * const dragControls = useDragControls()\n *\n * function startDrag(event) {\n * dragControls.start(event, { snapToCursor: true })\n * }\n *\n * return (\n * <>\n * <div onPointerDown={startDrag} />\n * <motion.div drag=\"x\" dragControls={dragControls} />\n * </>\n * )\n * ```\n *\n * @public\n */\nexport class DragControls {\n private componentControls = new Set<VisualElementDragControls>()\n\n /**\n * Subscribe a component's internal `VisualElementDragControls` to the user-facing API.\n *\n * @internal\n */\n subscribe(controls: VisualElementDragControls): () => void {\n this.componentControls.add(controls)\n\n return () => this.componentControls.delete(controls)\n }\n\n /**\n * Start a drag gesture on every `motion` component that has this set of drag controls\n * passed into it via the `dragControls` prop.\n *\n * ```jsx\n * dragControls.start(e, {\n * snapToCursor: true\n * })\n * ```\n *\n * @param event - PointerEvent\n * @param options - Options\n *\n * @public\n */\n start(\n event: React.PointerEvent | PointerEvent,\n options?: DragControlOptions\n ) {\n this.componentControls.forEach((controls) => {\n controls.start(\n (event as React.PointerEvent).nativeEvent || event,\n options\n )\n })\n }\n\n /**\n * Cancels a drag gesture.\n *\n * ```jsx\n * dragControls.cancel()\n * ```\n *\n * @public\n */\n cancel() {\n this.componentControls.forEach((controls) => {\n controls.cancel()\n })\n }\n\n /**\n * Stops a drag gesture.\n *\n * ```jsx\n * dragControls.stop()\n * ```\n *\n * @public\n */\n stop() {\n this.componentControls.forEach((controls) => {\n controls.stop()\n })\n }\n}\n\nconst createDragControls = () => new DragControls()\n\n/**\n * Usually, dragging is initiated by pressing down on a `motion` component with a `drag` prop\n * and moving it. For some use-cases, for instance clicking at an arbitrary point on a video scrubber, we\n * might want to initiate that dragging from a different component than the draggable one.\n *\n * By creating a `dragControls` using the `useDragControls` hook, we can pass this into\n * the draggable component's `dragControls` prop. It exposes a `start` method\n * that can start dragging from pointer events on other components.\n *\n * ```jsx\n * const dragControls = useDragControls()\n *\n * function startDrag(event) {\n * dragControls.start(event, { snapToCursor: true })\n * }\n *\n * return (\n * <>\n * <div onPointerDown={startDrag} />\n * <motion.div drag=\"x\" dragControls={dragControls} />\n * </>\n * )\n * ```\n *\n * @public\n */\nexport function useDragControls() {\n return useConstant(createDragControls)\n}\n"],"names":[],"mappings":";;AAOA;;;;;;;;;;;;;;;;;;;AAmBG;MACU,YAAY,CAAA;AAAzB,IAAA,WAAA,GAAA;AACY,QAAA,IAAA,CAAA,iBAAiB,GAAG,IAAI,GAAG,EAA6B;IAqEpE;AAnEI;;;;AAIG;AACH,IAAA,SAAS,CAAC,QAAmC,EAAA;AACzC,QAAA,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC;QAEpC,OAAO,MAAM,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,QAAQ,CAAC;IACxD;AAEA;;;;;;;;;;;;;;AAcG;IACH,KAAK,CACD,KAAwC,EACxC,OAA4B,EAAA;QAE5B,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,QAAQ,KAAI;YACxC,QAAQ,CAAC,KAAK,CACT,KAA4B,CAAC,WAAW,IAAI,KAAK,EAClD,OAAO,CACV;AACL,QAAA,CAAC,CAAC;IACN;AAEA;;;;;;;;AAQG;IACH,MAAM,GAAA;QACF,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,QAAQ,KAAI;YACxC,QAAQ,CAAC,MAAM,EAAE;AACrB,QAAA,CAAC,CAAC;IACN;AAEA;;;;;;;;AAQG;IACH,IAAI,GAAA;QACA,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,QAAQ,KAAI;YACxC,QAAQ,CAAC,IAAI,EAAE;AACnB,QAAA,CAAC,CAAC;IACN;AACH;AAED,MAAM,kBAAkB,GAAG,MAAM,IAAI,YAAY,EAAE;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;SACa,eAAe,GAAA;AAC3B,IAAA,OAAO,WAAW,CAAC,kBAAkB,CAAC;AAC1C;;;;"}
@@ -0,0 +1 @@
{"version":3,"file":"arrow-up-right-square.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,219 @@
import { EventSource } from 'eventsource';
import { createFetchWithInit, fetchLeavingRedirects, fetchWithinOrigin, normalizeHeaders, unfollowedRedirect } from '../shared/transport.js';
import { JSONRPCMessageSchema } from '../types.js';
import { auth, extractWWWAuthenticateParams, UnauthorizedError } from './auth.js';
export class SseError extends Error {
constructor(code, message, event) {
super(`SSE error: ${message}`);
this.code = code;
this.event = event;
}
}
/**
* Client transport for SSE: this will connect to a server using Server-Sent Events for receiving
* messages and make separate POST requests for sending messages.
* @deprecated SSEClientTransport is deprecated. Prefer to use StreamableHTTPClientTransport where possible instead. Note that because some servers are still using SSE, clients may need to support both transports during the migration period.
*/
export class SSEClientTransport {
constructor(url, opts) {
this._url = url;
this._resourceMetadataUrl = undefined;
this._scope = undefined;
this._eventSourceInit = opts?.eventSourceInit;
this._requestInit = opts?.requestInit;
this._authProvider = opts?.authProvider;
this._fetch = opts?.fetch;
this._fetchWithInit = createFetchWithInit(opts?.fetch, opts?.requestInit);
this._followRedirects = opts?.redirectPolicy === 'follow';
if (this._followRedirects) {
this._fetch = fetchLeavingRedirects(this._fetch);
this._fetchWithInit = fetchLeavingRedirects(this._fetchWithInit);
}
}
/** Error text for a redirect `response` that was not followed, or `undefined` for any other response. */
_unfollowedRedirect(response, url) {
const text = unfollowedRedirect(response, url);
return text && !this._followRedirects ? `${text} (redirectPolicy: 'same-origin')` : text;
}
async _authThenStart() {
if (!this._authProvider) {
throw new UnauthorizedError('No auth provider');
}
let result;
try {
result = await auth(this._authProvider, {
serverUrl: this._url,
resourceMetadataUrl: this._resourceMetadataUrl,
scope: this._scope,
fetchFn: this._fetchWithInit
});
}
catch (error) {
this.onerror?.(error);
throw error;
}
if (result !== 'AUTHORIZED') {
throw new UnauthorizedError();
}
return await this._startOrAuth();
}
async _commonHeaders() {
const headers = {};
if (this._authProvider) {
const tokens = await this._authProvider.tokens();
if (tokens) {
headers['Authorization'] = `Bearer ${tokens.access_token}`;
}
}
if (this._protocolVersion) {
headers['mcp-protocol-version'] = this._protocolVersion;
}
const extraHeaders = normalizeHeaders(this._requestInit?.headers);
return new Headers({
...headers,
...extraHeaders
});
}
_startOrAuth() {
const baseFetch = (this?._eventSourceInit?.fetch ?? this._fetch ?? fetch);
const fetchImpl = this._followRedirects ? baseFetch : fetchWithinOrigin(baseFetch);
let redirect;
return new Promise((resolve, reject) => {
this._eventSource = new EventSource(this._url.href, {
...this._eventSourceInit,
fetch: async (url, init) => {
const headers = await this._commonHeaders();
headers.set('Accept', 'text/event-stream');
const response = await fetchImpl(url, {
...init,
headers
});
redirect = this._unfollowedRedirect(response, url);
if (response.status === 401 && response.headers.has('www-authenticate')) {
const { resourceMetadataUrl, scope } = extractWWWAuthenticateParams(response);
this._resourceMetadataUrl = resourceMetadataUrl;
this._scope = scope;
}
return response;
}
});
this._abortController = new AbortController();
this._eventSource.onerror = event => {
if (event.code === 401 && this._authProvider) {
this._authThenStart().then(resolve, reject);
return;
}
const error = new SseError(event.code, redirect ?? event.message, event);
reject(error);
this.onerror?.(error);
};
this._eventSource.onopen = () => {
// The connection is open, but we need to wait for the endpoint to be received.
};
this._eventSource.addEventListener('endpoint', (event) => {
const messageEvent = event;
try {
this._endpoint = new URL(messageEvent.data, this._url);
if (this._endpoint.origin !== this._url.origin) {
throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`);
}
}
catch (error) {
reject(error);
this.onerror?.(error);
void this.close();
return;
}
resolve();
});
this._eventSource.onmessage = (event) => {
const messageEvent = event;
let message;
try {
message = JSONRPCMessageSchema.parse(JSON.parse(messageEvent.data));
}
catch (error) {
this.onerror?.(error);
return;
}
this.onmessage?.(message);
};
});
}
async start() {
if (this._eventSource) {
throw new Error('SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.');
}
return await this._startOrAuth();
}
/**
* Call this method after the user has finished authorizing via their user agent and is redirected back to the MCP client application. This will exchange the authorization code for an access token, enabling the next connection attempt to successfully auth.
*/
async finishAuth(authorizationCode) {
if (!this._authProvider) {
throw new UnauthorizedError('No auth provider');
}
const result = await auth(this._authProvider, {
serverUrl: this._url,
authorizationCode,
resourceMetadataUrl: this._resourceMetadataUrl,
scope: this._scope,
fetchFn: this._fetchWithInit
});
if (result !== 'AUTHORIZED') {
throw new UnauthorizedError('Failed to authorize');
}
}
async close() {
this._abortController?.abort();
this._eventSource?.close();
this.onclose?.();
}
async send(message) {
if (!this._endpoint) {
throw new Error('Not connected');
}
try {
const headers = await this._commonHeaders();
headers.set('content-type', 'application/json');
const init = {
...this._requestInit,
method: 'POST',
headers,
body: JSON.stringify(message),
signal: this._abortController?.signal
};
const response = await fetchWithinOrigin(this._fetch ?? fetch)(this._endpoint, init);
if (!response.ok) {
const text = await response.text().catch(() => null);
if (response.status === 401 && this._authProvider) {
const { resourceMetadataUrl, scope } = extractWWWAuthenticateParams(response);
this._resourceMetadataUrl = resourceMetadataUrl;
this._scope = scope;
const result = await auth(this._authProvider, {
serverUrl: this._url,
resourceMetadataUrl: this._resourceMetadataUrl,
scope: this._scope,
fetchFn: this._fetchWithInit
});
if (result !== 'AUTHORIZED') {
throw new UnauthorizedError();
}
// Purposely _not_ awaited, so we don't call onerror twice
return this.send(message);
}
throw new Error(`Error POSTing to endpoint (HTTP ${response.status}): ${this._unfollowedRedirect(response, this._endpoint) ?? text}`);
}
// Release connection - POST responses don't have content we need
await response.body?.cancel();
}
catch (error) {
this.onerror?.(error);
throw error;
}
}
setProtocolVersion(version) {
this._protocolVersion = version;
}
}
//# sourceMappingURL=sse.js.map