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,224 @@
"use strict";
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Checker = exports.createCheckers = void 0;
var types_1 = require("./types");
var util_1 = require("./util");
/**
* Export functions used to define interfaces.
*/
var types_2 = require("./types");
Object.defineProperty(exports, "TArray", { enumerable: true, get: function () { return types_2.TArray; } });
Object.defineProperty(exports, "TEnumType", { enumerable: true, get: function () { return types_2.TEnumType; } });
Object.defineProperty(exports, "TEnumLiteral", { enumerable: true, get: function () { return types_2.TEnumLiteral; } });
Object.defineProperty(exports, "TFunc", { enumerable: true, get: function () { return types_2.TFunc; } });
Object.defineProperty(exports, "TIface", { enumerable: true, get: function () { return types_2.TIface; } });
Object.defineProperty(exports, "TLiteral", { enumerable: true, get: function () { return types_2.TLiteral; } });
Object.defineProperty(exports, "TName", { enumerable: true, get: function () { return types_2.TName; } });
Object.defineProperty(exports, "TOptional", { enumerable: true, get: function () { return types_2.TOptional; } });
Object.defineProperty(exports, "TParam", { enumerable: true, get: function () { return types_2.TParam; } });
Object.defineProperty(exports, "TParamList", { enumerable: true, get: function () { return types_2.TParamList; } });
Object.defineProperty(exports, "TProp", { enumerable: true, get: function () { return types_2.TProp; } });
Object.defineProperty(exports, "TTuple", { enumerable: true, get: function () { return types_2.TTuple; } });
Object.defineProperty(exports, "TType", { enumerable: true, get: function () { return types_2.TType; } });
Object.defineProperty(exports, "TUnion", { enumerable: true, get: function () { return types_2.TUnion; } });
Object.defineProperty(exports, "TIntersection", { enumerable: true, get: function () { return types_2.TIntersection; } });
Object.defineProperty(exports, "array", { enumerable: true, get: function () { return types_2.array; } });
Object.defineProperty(exports, "enumlit", { enumerable: true, get: function () { return types_2.enumlit; } });
Object.defineProperty(exports, "enumtype", { enumerable: true, get: function () { return types_2.enumtype; } });
Object.defineProperty(exports, "func", { enumerable: true, get: function () { return types_2.func; } });
Object.defineProperty(exports, "iface", { enumerable: true, get: function () { return types_2.iface; } });
Object.defineProperty(exports, "lit", { enumerable: true, get: function () { return types_2.lit; } });
Object.defineProperty(exports, "name", { enumerable: true, get: function () { return types_2.name; } });
Object.defineProperty(exports, "opt", { enumerable: true, get: function () { return types_2.opt; } });
Object.defineProperty(exports, "param", { enumerable: true, get: function () { return types_2.param; } });
Object.defineProperty(exports, "tuple", { enumerable: true, get: function () { return types_2.tuple; } });
Object.defineProperty(exports, "union", { enumerable: true, get: function () { return types_2.union; } });
Object.defineProperty(exports, "intersection", { enumerable: true, get: function () { return types_2.intersection; } });
Object.defineProperty(exports, "BasicType", { enumerable: true, get: function () { return types_2.BasicType; } });
var util_2 = require("./util");
Object.defineProperty(exports, "VError", { enumerable: true, get: function () { return util_2.VError; } });
/**
* Takes one of more type suites (e.g. a module generated by `ts-interface-builder`), and combines
* them into a suite of interface checkers. If a type is used by name, that name should be present
* among the passed-in type suites.
*
* The returned object maps type names to Checker objects.
*/
function createCheckers() {
var typeSuite = [];
for (var _i = 0; _i < arguments.length; _i++) {
typeSuite[_i] = arguments[_i];
}
var fullSuite = Object.assign.apply(Object, __spreadArrays([{}, types_1.basicTypes], typeSuite));
var checkers = {};
for (var _a = 0, typeSuite_1 = typeSuite; _a < typeSuite_1.length; _a++) {
var suite_1 = typeSuite_1[_a];
for (var _b = 0, _c = Object.keys(suite_1); _b < _c.length; _b++) {
var name = _c[_b];
checkers[name] = new Checker(fullSuite, suite_1[name]);
}
}
return checkers;
}
exports.createCheckers = createCheckers;
/**
* Checker implements validation of objects, and also includes accessors to validate method calls.
* Checkers should be created using `createCheckers()`.
*/
var Checker = /** @class */ (function () {
// Create checkers by using `createCheckers()` function.
function Checker(suite, ttype, _path) {
if (_path === void 0) { _path = 'value'; }
this.suite = suite;
this.ttype = ttype;
this._path = _path;
this.props = new Map();
if (ttype instanceof types_1.TIface) {
for (var _i = 0, _a = ttype.props; _i < _a.length; _i++) {
var p = _a[_i];
this.props.set(p.name, p.ttype);
}
}
this.checkerPlain = this.ttype.getChecker(suite, false);
this.checkerStrict = this.ttype.getChecker(suite, true);
}
/**
* Set the path to report in errors, instead of the default "value". (E.g. if the Checker is for
* a "person" interface, set path to "person" to report e.g. "person.name is not a string".)
*/
Checker.prototype.setReportedPath = function (path) {
this._path = path;
};
/**
* Check that the given value satisfies this checker's type, or throw Error.
*/
Checker.prototype.check = function (value) { return this._doCheck(this.checkerPlain, value); };
/**
* A fast check for whether or not the given value satisfies this Checker's type. This returns
* true or false, does not produce an error message, and is fast both on success and on failure.
*/
Checker.prototype.test = function (value) {
return this.checkerPlain(value, new util_1.NoopContext());
};
/**
* Returns an error object describing the errors if the given value does not satisfy this
* Checker's type, or null if it does.
*/
Checker.prototype.validate = function (value) {
return this._doValidate(this.checkerPlain, value);
};
/**
* Check that the given value satisfies this checker's type strictly. This checks that objects
* and tuples have no extra members. Note that this prevents backward compatibility, so usually
* a plain check() is more appropriate.
*/
Checker.prototype.strictCheck = function (value) { return this._doCheck(this.checkerStrict, value); };
/**
* A fast strict check for whether or not the given value satisfies this Checker's type. Returns
* true or false, does not produce an error message, and is fast both on success and on failure.
*/
Checker.prototype.strictTest = function (value) {
return this.checkerStrict(value, new util_1.NoopContext());
};
/**
* Returns an error object describing the errors if the given value does not satisfy this
* Checker's type strictly, or null if it does.
*/
Checker.prototype.strictValidate = function (value) {
return this._doValidate(this.checkerStrict, value);
};
/**
* If this checker is for an interface, returns a Checker for the type required for the given
* property of this interface.
*/
Checker.prototype.getProp = function (prop) {
var ttype = this.props.get(prop);
if (!ttype) {
throw new Error("Type has no property " + prop);
}
return new Checker(this.suite, ttype, this._path + "." + prop);
};
/**
* If this checker is for an interface, returns a Checker for the argument-list required to call
* the given method of this interface. E.g. if this Checker is for the interface:
* interface Foo {
* find(s: string, pos?: number): number;
* }
* Then methodArgs("find").check(...) will succeed for ["foo"] and ["foo", 3], but not for [17].
*/
Checker.prototype.methodArgs = function (methodName) {
var tfunc = this._getMethod(methodName);
return new Checker(this.suite, tfunc.paramList);
};
/**
* If this checker is for an interface, returns a Checker for the return value of the given
* method of this interface.
*/
Checker.prototype.methodResult = function (methodName) {
var tfunc = this._getMethod(methodName);
return new Checker(this.suite, tfunc.result);
};
/**
* If this checker is for a function, returns a Checker for its argument-list.
*/
Checker.prototype.getArgs = function () {
if (!(this.ttype instanceof types_1.TFunc)) {
throw new Error("getArgs() applied to non-function");
}
return new Checker(this.suite, this.ttype.paramList);
};
/**
* If this checker is for a function, returns a Checker for its result.
*/
Checker.prototype.getResult = function () {
if (!(this.ttype instanceof types_1.TFunc)) {
throw new Error("getResult() applied to non-function");
}
return new Checker(this.suite, this.ttype.result);
};
/**
* Return the type for which this is a checker.
*/
Checker.prototype.getType = function () {
return this.ttype;
};
/**
* Actual implementation of check() and strictCheck().
*/
Checker.prototype._doCheck = function (checkerFunc, value) {
var noopCtx = new util_1.NoopContext();
if (!checkerFunc(value, noopCtx)) {
var detailCtx = new util_1.DetailContext();
checkerFunc(value, detailCtx);
throw detailCtx.getError(this._path);
}
};
Checker.prototype._doValidate = function (checkerFunc, value) {
var noopCtx = new util_1.NoopContext();
if (checkerFunc(value, noopCtx)) {
return null;
}
var detailCtx = new util_1.DetailContext();
checkerFunc(value, detailCtx);
return detailCtx.getErrorDetail(this._path);
};
Checker.prototype._getMethod = function (methodName) {
var ttype = this.props.get(methodName);
if (!ttype) {
throw new Error("Type has no property " + methodName);
}
if (!(ttype instanceof types_1.TFunc)) {
throw new Error("Property " + methodName + " is not a method");
}
return ttype;
};
return Checker;
}());
exports.Checker = Checker;
@@ -0,0 +1,41 @@
import { isSVGElement, isSVGSVGElement, SVGVisualElement, HTMLVisualElement, visualElementStore, ObjectVisualElement } from 'motion-dom';
function createDOMVisualElement(element) {
const options = {
presenceContext: null,
props: {},
visualState: {
renderState: {
transform: {},
transformOrigin: {},
style: {},
vars: {},
attrs: {},
},
latestValues: {},
},
};
const node = isSVGElement(element) && !isSVGSVGElement(element)
? new SVGVisualElement(options)
: new HTMLVisualElement(options);
node.mount(element);
visualElementStore.set(element, node);
}
function createObjectVisualElement(subject) {
const options = {
presenceContext: null,
props: {},
visualState: {
renderState: {
output: {},
},
latestValues: {},
},
};
const node = new ObjectVisualElement(options);
node.mount(subject);
visualElementStore.set(subject, node);
}
export { createDOMVisualElement, createObjectVisualElement };
//# sourceMappingURL=create-visual-element.mjs.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 './chart-bar.js';
//# sourceMappingURL=bar-chart-horizontal.js.map
@@ -0,0 +1 @@
{"version":3,"file":"webcrypto.d.ts","sourceRoot":"","sources":["src/webcrypto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAOL,KAAK,QAAQ,EACb,KAAK,IAAI,EACT,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AASpB,mDAAmD;AACnD,MAAM,MAAM,OAAO,GAAG;IACpB;;;;OAIG;IACH,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IACnD,0DAA0D;IAC1D,aAAa,EAAE,MAAM,CAAC;IACtB,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AA0BF,uFAAuF;AAGvF;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,EAAE,IAAI,CAAC,OAAO,CAAoD,CAAC;AACtF;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,EAAE,IAAI,CAAC,OAAO,CAAqD,CAAC;AACvF;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,EAAE,IAAI,CAAC,OAAO,CAAqD,CAAC;AAEvF;;;;;;;;;;;;;;GAcG;AACH,KAAK,SAAS,GAAG;IACf,CACE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,EACnB,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,EACrB,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,GACxB,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAC7B,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC;CACzD,CAAC;AACF,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,SAAS,CA2B7B,CAAC;AAEL;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,IAAI,CACxB,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,EACnB,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,EACrB,IAAI,EAAE,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,EAClC,IAAI,EAAE,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,EAClC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAe3B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,MAAM,CAC1B,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,EACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,EACxB,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,EACpB,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAgB3B"}
@@ -0,0 +1,13 @@
# `react-use-callback-ref`
## Installation
```sh
$ yarn add @radix-ui/react-use-callback-ref
# or
$ npm install @radix-ui/react-use-callback-ref
```
## Usage
This is an internal utility, not intended for public usage.
@@ -0,0 +1,118 @@
{
"name": "entities",
"version": "6.0.1",
"description": "Encode & decode XML and HTML entities with ease & speed",
"keywords": [
"html entities",
"entity decoder",
"entity encoding",
"html decoding",
"html encoding",
"xml decoding",
"xml encoding"
],
"repository": {
"type": "git",
"url": "git://github.com/fb55/entities.git"
},
"funding": "https://github.com/fb55/entities?sponsor=1",
"license": "BSD-2-Clause",
"author": "Felix Boehm <me@feedic.com>",
"sideEffects": false,
"type": "module",
"exports": {
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.js"
}
},
"./decode": {
"import": {
"types": "./dist/esm/decode.d.ts",
"default": "./dist/esm/decode.js"
},
"require": {
"types": "./dist/commonjs/decode.d.ts",
"default": "./dist/commonjs/decode.js"
}
},
"./escape": {
"import": {
"types": "./dist/esm/escape.d.ts",
"default": "./dist/esm/escape.js"
},
"require": {
"types": "./dist/commonjs/escape.d.ts",
"default": "./dist/commonjs/escape.js"
}
}
},
"main": "./dist/commonjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/commonjs/index.d.ts",
"files": [
"decode.js",
"decode.d.ts",
"escape.js",
"escape.d.ts",
"dist",
"src"
],
"scripts": {
"build:docs": "typedoc --hideGenerator src/index.ts",
"build:encode-trie": "node --import=tsx scripts/write-encode-map.ts",
"build:trie": "node --import=tsx scripts/write-decode-map.ts",
"format": "npm run format:es && npm run format:prettier",
"format:es": "npm run lint:es -- --fix",
"format:prettier": "npm run prettier -- --write",
"lint": "npm run lint:es && npm run lint:ts && npm run lint:prettier",
"lint:es": "eslint . --ignore-path .gitignore",
"lint:prettier": "npm run prettier -- --check",
"lint:ts": "tsc --noEmit",
"prepublishOnly": "tshy",
"prettier": "prettier '**/*.{ts,md,json,yml}'",
"test": "npm run test:vi && npm run lint",
"test:vi": "vitest run"
},
"prettier": {
"proseWrap": "always",
"tabWidth": 4
},
"devDependencies": {
"@types/node": "^22.15.30",
"@typescript-eslint/eslint-plugin": "^8.33.1",
"@typescript-eslint/parser": "^8.33.1",
"@vitest/coverage-v8": "^2.1.8",
"eslint": "^8.57.1",
"eslint-config-prettier": "^10.1.5",
"eslint-plugin-n": "^17.19.0",
"eslint-plugin-unicorn": "^56.0.1",
"prettier": "^3.5.3",
"tshy": "^3.0.2",
"tsx": "^4.19.4",
"typedoc": "^0.28.5",
"typescript": "^5.8.3",
"vitest": "^2.0.2"
},
"engines": {
"node": ">=0.12"
},
"tshy": {
"exclude": [
"**/*.spec.ts",
"**/__fixtures__/*",
"**/__tests__/*",
"**/__snapshots__/*"
],
"exports": {
".": "./src/index.ts",
"./decode": "./src/decode.ts",
"./escape": "./src/escape.ts"
}
}
}
@@ -0,0 +1,341 @@
import { expect, expectTypeOf, test } from "vitest";
import { z } from "zod/mini";
test("recursive object schema type aliases", () => {
type ObjectField = z.ZodMiniObject<{ [k: string]: ObjectField }>;
type Field = z.ZodMiniString<string> | z.ZodMiniObject<{ [k: string]: Field }>;
type ObjectValue = { [k: string]: ObjectValue };
type Value = string | { [k: string]: Value };
expectTypeOf<z.input<ObjectField>>().toEqualTypeOf<ObjectValue>();
expectTypeOf<z.output<ObjectField>>().toEqualTypeOf<ObjectValue>();
expectTypeOf<keyof z.input<ObjectField>>().toEqualTypeOf<string>();
expectTypeOf<keyof z.output<ObjectField>>().toEqualTypeOf<string>();
expectTypeOf<z.input<Field>>().toEqualTypeOf<Value>();
expectTypeOf<z.output<Field>>().toEqualTypeOf<Value>();
const schema: Field = z.object({ nested: z.object({ name: z.string() }) });
expect(schema.parse({ nested: { name: "a", extra: true } })).toEqual({ nested: { name: "a" } });
expect(schema.safeParse({ nested: { name: 123 } }).success).toBe(false);
});
test("recursion with z.lazy", () => {
const data = {
name: "I",
subcategories: [
{
name: "A",
subcategories: [
{
name: "1",
subcategories: [
{
name: "a",
subcategories: [],
},
],
},
],
},
],
};
const Category = z.object({
name: z.string(),
get subcategories(): z.ZodMiniOptional<z.ZodMiniArray<typeof Category>> {
return z.optional(z.array(Category));
},
});
Category.parse(data);
type Category = z.infer<typeof Category>;
interface _Category {
name: string;
subcategories?: _Category[] | undefined;
}
expectTypeOf<Category>().toEqualTypeOf<_Category>();
});
test("recursion involving union type", () => {
const data = {
value: 1,
next: {
value: 2,
next: {
value: 3,
next: {
value: 4,
next: null,
},
},
},
};
const LL = z.object({
value: z.number(),
get next(): z.ZodMiniNullable<typeof LL> {
return z.nullable(LL);
},
});
LL.parse(data);
type LL = z.infer<typeof LL>;
type _LL = {
value: number;
next: _LL | null;
};
expectTypeOf<LL>().toEqualTypeOf<_LL>();
});
test("mutual recursion - native", () => {
const Alazy = z.object({
val: z.number(),
get b() {
return z.optional(Blazy);
},
});
const Blazy = z.object({
val: z.number(),
get a() {
return z.optional(Alazy);
},
});
const testData = {
val: 1,
b: {
val: 5,
a: {
val: 3,
b: {
val: 4,
a: {
val: 2,
b: {
val: 1,
},
},
},
},
},
};
Alazy.parse(testData);
Blazy.parse(testData.b);
type Alazy = z.infer<typeof Alazy>;
type Blazy = z.infer<typeof Blazy>;
interface _Alazy {
val: number;
b?: _Blazy | undefined;
}
interface _Blazy {
val: number;
a?: _Alazy | undefined;
}
expectTypeOf<Alazy>().toEqualTypeOf<_Alazy>();
expectTypeOf<Blazy>().toEqualTypeOf<_Blazy>();
expect(() => Alazy.parse({ val: "asdf" })).toThrow();
});
test("pick and omit with getter", () => {
const Category = z.strictObject({
name: z.string(),
get subcategories() {
return z.array(Category);
},
});
type Category = z.infer<typeof Category>;
interface _Category {
name: string;
subcategories: _Category[];
}
expectTypeOf<Category>().toEqualTypeOf<_Category>();
const PickedCategory = z.pick(Category, { name: true });
const OmittedCategory = z.omit(Category, { subcategories: true });
type PickedCategory = z.infer<typeof PickedCategory>;
type OmittedCategory = z.infer<typeof OmittedCategory>;
interface _PickedCategory {
name: string;
}
interface _OmittedCategory {
name: string;
}
expectTypeOf<PickedCategory>().toEqualTypeOf<_PickedCategory>();
expectTypeOf<OmittedCategory>().toEqualTypeOf<_OmittedCategory>();
const picked = { name: "test" };
const omitted = { name: "test" };
PickedCategory.parse(picked);
OmittedCategory.parse(omitted);
expect(() => PickedCategory.parse({ name: "test", subcategories: [] })).toThrow();
expect(() => OmittedCategory.parse({ name: "test", subcategories: [] })).toThrow();
});
test("deferred self-recursion", () => {
const Feature = z.object({
title: z.string(),
get features(): z.ZodMiniOptional<z.ZodMiniArray<typeof Feature>> {
return z.optional(z.array(Feature)); //.optional();
},
});
type Feature = z.infer<typeof Feature>;
const Output = z.object({
id: z.int(), //.nonnegative(),
name: z.string(),
features: z.array(Feature), //.array(), // <—
});
type Output = z.output<typeof Output>;
type _Feature = {
title: string;
features?: _Feature[] | undefined;
};
type _Output = {
id: number;
name: string;
features: _Feature[];
};
expectTypeOf<Feature>().toEqualTypeOf<_Feature>();
expectTypeOf<Output>().toEqualTypeOf<_Output>();
});
test("recursion compatibility", () => {
// array
const A = z.object({
get subcategories() {
return z.array(A);
},
});
// tuple
const B = z.object({
get subcategories() {
return z.tuple([B, B]);
},
});
// object
const C = z.object({
get subcategories() {
return z.object({
subcategories: C,
});
},
});
// union
const D = z.object({
get subcategories() {
return z.union([D, z.string()]);
},
});
// intersection
const E = z.object({
get subcategories() {
return z.intersection(E, E);
},
});
// record
const F = z.object({
get subcategories() {
return z.record(z.string(), F);
},
});
// map
const G = z.object({
get subcategories() {
return z.map(z.string(), G);
},
});
// set
const H = z.object({
get subcategories() {
return z.set(H);
},
});
// optional
const I = z.object({
get subcategories() {
return z.optional(I);
},
});
// nullable
const J = z.object({
get subcategories() {
return z.nullable(J);
},
});
// optional
const L = z.object({
get subcategories() {
return z.optional(L);
},
});
// nullable
const M = z.object({
get subcategories() {
return z.nullable(M);
},
});
// nonoptional
const N = z.object({
get subcategories() {
return z.nonoptional(N);
},
});
});
test("shape stays writeable through object/strictObject/looseObject/extend with getters", () => {
const Cat = z.object({
name: z.string(),
get sub(): z.ZodMiniArray<typeof Cat> {
return z.array(Cat);
},
});
type CatShape = (typeof Cat)["shape"];
expectTypeOf<CatShape>().toEqualTypeOf<{
name: z.ZodMiniString<string>;
sub: z.ZodMiniArray<typeof Cat>;
}>();
const StrictCat = z.strictObject({
name: z.string(),
get sub(): z.ZodMiniArray<typeof StrictCat> {
return z.array(StrictCat);
},
});
type StrictShape = (typeof StrictCat)["shape"];
expectTypeOf<StrictShape>().toEqualTypeOf<{
name: z.ZodMiniString<string>;
sub: z.ZodMiniArray<typeof StrictCat>;
}>();
const LooseCat = z.looseObject({
name: z.string(),
get sub(): z.ZodMiniArray<typeof LooseCat> {
return z.array(LooseCat);
},
});
type LooseShape = (typeof LooseCat)["shape"];
expectTypeOf<LooseShape>().toEqualTypeOf<{
name: z.ZodMiniString<string>;
sub: z.ZodMiniArray<typeof LooseCat>;
}>();
const Base = z.object({ name: z.string() });
const Extended = z.extend(Base, {
get sub(): z.ZodMiniArray<typeof Extended> {
return z.array(Extended);
},
});
type ExtendedShape = (typeof Extended)["shape"];
expectTypeOf<ExtendedShape>().toEqualTypeOf<{
name: z.ZodMiniString<string>;
sub: z.ZodMiniArray<typeof Extended>;
}>();
});
@@ -0,0 +1 @@
{"version":3,"file":"droplet.js","sources":["../../../src/icons/droplet.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Droplet\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTIgMjJhNyA3IDAgMCAwIDctN2MwLTItMS0zLjktMy01LjVzLTMuNS00LTQtNi41Yy0uNSAyLjUtMiA0LjktNCA2LjVDNiAxMS4xIDUgMTMgNSAxNWE3IDcgMCAwIDAgNyA3eiIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/droplet\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 Droplet = createLucideIcon('Droplet', [\n [\n 'path',\n {\n d: 'M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z',\n key: 'c7niix',\n },\n ],\n]);\n\nexport default Droplet;\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,CAC1C,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,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 @@
{"version":3,"file":"facebook.js","sources":["../../../src/icons/facebook.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Facebook\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTggMmgtM2E1IDUgMCAwIDAtNSA1djNIN3Y0aDN2OGg0di04aDNsMS00aC00VjdhMSAxIDAgMCAxIDEtMWgzeiIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/facebook\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 * @deprecated Brand icons have been deprecated and are due to be removed, please refer to https://github.com/lucide-icons/lucide/issues/670. We recommend using https://simpleicons.org/?q=facebook instead. This icon will be removed in v1.0\n */\nconst Facebook = createLucideIcon('Facebook', [\n [\n 'path',\n { d: 'M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z', key: '1jg4f8' },\n ],\n]);\n\nexport default Facebook;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,iBAAiB,UAAY,CAAA,CAAA,CAAA;AAAA,CAC5C,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,CAAqE,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,QAAS,CAAA,CAAA;AAAA,CAC1F,CAAA,CAAA;AACF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,586 @@
// @ts-ignore TS6133
import { expect, test } from "vitest";
import * as z from "zod/v3";
import { ZodError, ZodIssueCode } from "../ZodError.js";
import { ZodParsedType } from "../helpers/util.js";
test("error creation", () => {
const err1 = ZodError.create([]);
err1.addIssue({
code: ZodIssueCode.invalid_type,
expected: ZodParsedType.object,
received: ZodParsedType.string,
path: [],
message: "",
fatal: true,
});
err1.isEmpty;
const err2 = ZodError.create(err1.issues);
const err3 = new ZodError([]);
err3.addIssues(err1.issues);
err3.addIssue(err1.issues[0]);
err1.message;
err2.message;
err3.message;
});
const errorMap: z.ZodErrorMap = (error, ctx) => {
if (error.code === ZodIssueCode.invalid_type) {
if (error.expected === "string") {
return { message: "bad type!" };
}
}
if (error.code === ZodIssueCode.custom) {
return { message: `less-than-${error.params?.minimum}` };
}
return { message: ctx.defaultError };
};
test("type error with custom error map", () => {
try {
z.string().parse(234, { errorMap });
} catch (err) {
const zerr: z.ZodError = err as any;
expect(zerr.issues[0].code).toEqual(z.ZodIssueCode.invalid_type);
expect(zerr.issues[0].message).toEqual(`bad type!`);
}
});
test("refinement fail with params", () => {
try {
z.number()
.refine((val) => val >= 3, {
params: { minimum: 3 },
})
.parse(2, { errorMap });
} catch (err) {
const zerr: z.ZodError = err as any;
expect(zerr.issues[0].code).toEqual(z.ZodIssueCode.custom);
expect(zerr.issues[0].message).toEqual(`less-than-3`);
}
});
test("custom error with custom errormap", () => {
try {
z.string()
.refine((val) => val.length > 12, {
params: { minimum: 13 },
message: "override",
})
.parse("asdf", { errorMap });
} catch (err) {
const zerr: z.ZodError = err as any;
expect(zerr.issues[0].message).toEqual("override");
}
});
test("default error message", () => {
try {
z.number()
.refine((x) => x > 3)
.parse(2);
} catch (err) {
const zerr: z.ZodError = err as any;
expect(zerr.issues.length).toEqual(1);
expect(zerr.issues[0].message).toEqual("Invalid input");
}
});
test("override error in refine", () => {
try {
z.number()
.refine((x) => x > 3, "override")
.parse(2);
} catch (err) {
const zerr: z.ZodError = err as any;
expect(zerr.issues.length).toEqual(1);
expect(zerr.issues[0].message).toEqual("override");
}
});
test("override error in refinement", () => {
try {
z.number()
.refine((x) => x > 3, {
message: "override",
})
.parse(2);
} catch (err) {
const zerr: z.ZodError = err as any;
expect(zerr.issues.length).toEqual(1);
expect(zerr.issues[0].message).toEqual("override");
}
});
test("array minimum", () => {
try {
z.array(z.string()).min(3, "tooshort").parse(["asdf", "qwer"]);
} catch (err) {
const zerr: ZodError = err as any;
expect(zerr.issues[0].code).toEqual(ZodIssueCode.too_small);
expect(zerr.issues[0].message).toEqual("tooshort");
}
try {
z.array(z.string()).min(3).parse(["asdf", "qwer"]);
} catch (err) {
const zerr: ZodError = err as any;
expect(zerr.issues[0].code).toEqual(ZodIssueCode.too_small);
expect(zerr.issues[0].message).toEqual(`Array must contain at least 3 element(s)`);
}
});
// implement test for semi-smart union logic that checks for type error on either left or right
// test("union smart errors", () => {
// // expect.assertions(2);
// const p1 = z
// .union([z.string(), z.number().refine((x) => x > 0)])
// .safeParse(-3.2);
// if (p1.success === true) throw new Error();
// expect(p1.success).toBe(false);
// expect(p1.error.issues[0].code).toEqual(ZodIssueCode.custom);
// const p2 = z.union([z.string(), z.number()]).safeParse(false);
// // .catch(err => expect(err.issues[0].code).toEqual(ZodIssueCode.invalid_union));
// if (p2.success === true) throw new Error();
// expect(p2.success).toBe(false);
// expect(p2.error.issues[0].code).toEqual(ZodIssueCode.invalid_union);
// });
test("custom path in custom error map", () => {
const schema = z.object({
items: z.array(z.string()).refine((data) => data.length > 3, {
path: ["items-too-few"],
}),
});
const errorMap: z.ZodErrorMap = (error) => {
expect(error.path.length).toBe(2);
return { message: "doesnt matter" };
};
const result = schema.safeParse({ items: ["first"] }, { errorMap });
expect(result.success).toEqual(false);
if (!result.success) {
expect(result.error.issues[0].path).toEqual(["items", "items-too-few"]);
}
});
test("error metadata from value", () => {
const dynamicRefine = z.string().refine(
(val) => val === val.toUpperCase(),
(val) => ({ params: { val } })
);
const result = dynamicRefine.safeParse("asdf");
expect(result.success).toEqual(false);
if (!result.success) {
const sub = result.error.issues[0];
expect(result.error.issues[0].code).toEqual("custom");
if (sub.code === "custom") {
expect(sub.params!.val).toEqual("asdf");
}
}
});
// test("don't call refine after validation failed", () => {
// const asdf = z
// .union([
// z.number(),
// z.string().transform(z.number(), (val) => {
// return parseFloat(val);
// }),
// ])
// .refine((v) => v >= 1);
// expect(() => asdf.safeParse("foo")).not.toThrow();
// });
test("root level formatting", () => {
const schema = z.string().email();
const result = schema.safeParse("asdfsdf");
expect(result.success).toEqual(false);
if (!result.success) {
expect(result.error.format()._errors).toEqual(["Invalid email"]);
}
});
test("custom path", () => {
const schema = z
.object({
password: z.string(),
confirm: z.string(),
})
.refine((val) => val.confirm === val.password, { path: ["confirm"] });
const result = schema.safeParse({
password: "peanuts",
confirm: "qeanuts",
});
expect(result.success).toEqual(false);
if (!result.success) {
// nested errors
const error = result.error.format();
expect(error._errors).toEqual([]);
expect(error.password?._errors).toEqual(undefined);
expect(error.confirm?._errors).toEqual(["Invalid input"]);
}
});
test("custom path", () => {
const schema = z
.object({
password: z.string().min(6),
confirm: z.string().min(6),
})
.refine((val) => val.confirm === val.password);
const result = schema.safeParse({
password: "qwer",
confirm: "asdf",
});
expect(result.success).toEqual(false);
if (!result.success) {
expect(result.error.issues.length).toEqual(3);
}
});
const schema = z.object({
inner: z.object({
name: z
.string()
.refine((val) => val.length > 5)
.array()
.refine((val) => val.length <= 1),
}),
});
test("no abort early on refinements", () => {
const invalidItem = {
inner: { name: ["aasd", "asdfasdfasfd"] },
};
const result1 = schema.safeParse(invalidItem);
expect(result1.success).toEqual(false);
if (!result1.success) {
expect(result1.error.issues.length).toEqual(2);
}
});
test("formatting", () => {
const invalidItem = {
inner: { name: ["aasd", "asdfasdfasfd"] },
};
const invalidArray = {
inner: { name: ["asdfasdf", "asdfasdfasfd"] },
};
const result1 = schema.safeParse(invalidItem);
const result2 = schema.safeParse(invalidArray);
expect(result1.success).toEqual(false);
expect(result2.success).toEqual(false);
if (!result1.success) {
const error = result1.error.format();
expect(error._errors).toEqual([]);
expect(error.inner?._errors).toEqual([]);
// expect(error.inner?.name?._errors).toEqual(["Invalid input"]);
// expect(error.inner?.name?.[0]._errors).toEqual(["Invalid input"]);
expect(error.inner?.name?.[1]).toEqual(undefined);
}
if (!result2.success) {
type FormattedError = z.inferFormattedError<typeof schema>;
const error: FormattedError = result2.error.format();
expect(error._errors).toEqual([]);
expect(error.inner?._errors).toEqual([]);
expect(error.inner?.name?._errors).toEqual(["Invalid input"]);
expect(error.inner?.name?.[0]).toEqual(undefined);
expect(error.inner?.name?.[1]).toEqual(undefined);
expect(error.inner?.name?.[2]).toEqual(undefined);
}
// test custom mapper
if (!result2.success) {
type FormattedError = z.inferFormattedError<typeof schema, number>;
const error: FormattedError = result2.error.format(() => 5);
expect(error._errors).toEqual([]);
expect(error.inner?._errors).toEqual([]);
expect(error.inner?.name?._errors).toEqual([5]);
}
});
test("formatting with nullable and optional fields", () => {
const nameSchema = z.string().refine((val) => val.length > 5);
const schema = z.object({
nullableObject: z.object({ name: nameSchema }).nullable(),
nullableArray: z.array(nameSchema).nullable(),
nullableTuple: z.tuple([nameSchema, nameSchema, z.number()]).nullable(),
optionalObject: z.object({ name: nameSchema }).optional(),
optionalArray: z.array(nameSchema).optional(),
optionalTuple: z.tuple([nameSchema, nameSchema, z.number()]).optional(),
});
const invalidItem = {
nullableObject: { name: "abcd" },
nullableArray: ["abcd"],
nullableTuple: ["abcd", "abcd", 1],
optionalObject: { name: "abcd" },
optionalArray: ["abcd"],
optionalTuple: ["abcd", "abcd", 1],
};
const result = schema.safeParse(invalidItem);
expect(result.success).toEqual(false);
if (!result.success) {
type FormattedError = z.inferFormattedError<typeof schema>;
const error: FormattedError = result.error.format();
expect(error._errors).toEqual([]);
expect(error.nullableObject?._errors).toEqual([]);
expect(error.nullableObject?.name?._errors).toEqual(["Invalid input"]);
expect(error.nullableArray?._errors).toEqual([]);
expect(error.nullableArray?.[0]?._errors).toEqual(["Invalid input"]);
expect(error.nullableTuple?._errors).toEqual([]);
expect(error.nullableTuple?.[0]?._errors).toEqual(["Invalid input"]);
expect(error.nullableTuple?.[1]?._errors).toEqual(["Invalid input"]);
expect(error.optionalObject?._errors).toEqual([]);
expect(error.optionalObject?.name?._errors).toEqual(["Invalid input"]);
expect(error.optionalArray?._errors).toEqual([]);
expect(error.optionalArray?.[0]?._errors).toEqual(["Invalid input"]);
expect(error.optionalTuple?._errors).toEqual([]);
expect(error.optionalTuple?.[0]?._errors).toEqual(["Invalid input"]);
expect(error.optionalTuple?.[1]?._errors).toEqual(["Invalid input"]);
}
});
const stringWithCustomError = z.string({
errorMap: (issue, ctx) => ({
message: issue.code === "invalid_type" ? (ctx.data ? "Invalid name" : "Name is required") : ctx.defaultError,
}),
});
test("schema-bound error map", () => {
const result = stringWithCustomError.safeParse(1234);
expect(result.success).toEqual(false);
if (!result.success) {
expect(result.error.issues[0].message).toEqual("Invalid name");
}
const result2 = stringWithCustomError.safeParse(undefined);
expect(result2.success).toEqual(false);
if (!result2.success) {
expect(result2.error.issues[0].message).toEqual("Name is required");
}
// support contextual override
const result3 = stringWithCustomError.safeParse(undefined, {
errorMap: () => ({ message: "OVERRIDE" }),
});
expect(result3.success).toEqual(false);
if (!result3.success) {
expect(result3.error.issues[0].message).toEqual("OVERRIDE");
}
});
test("overrideErrorMap", () => {
// support overrideErrorMap
z.setErrorMap(() => ({ message: "OVERRIDE" }));
const result4 = stringWithCustomError.min(10).safeParse("tooshort");
expect(result4.success).toEqual(false);
if (!result4.success) {
expect(result4.error.issues[0].message).toEqual("OVERRIDE");
}
z.setErrorMap(z.defaultErrorMap);
});
test("invalid and required", () => {
const str = z.string({
invalid_type_error: "Invalid name",
required_error: "Name is required",
});
const result1 = str.safeParse(1234);
expect(result1.success).toEqual(false);
if (!result1.success) {
expect(result1.error.issues[0].message).toEqual("Invalid name");
}
const result2 = str.safeParse(undefined);
expect(result2.success).toEqual(false);
if (!result2.success) {
expect(result2.error.issues[0].message).toEqual("Name is required");
}
});
test("Fallback to default required error", () => {
const str = z.string({
invalid_type_error: "Invalid name",
// required_error: "Name is required",
});
const result2 = str.safeParse(undefined);
expect(result2.success).toEqual(false);
if (!result2.success) {
expect(result2.error.issues[0].message).toEqual("Required");
}
});
test("invalid and required and errorMap", () => {
expect(() => {
return z.string({
invalid_type_error: "Invalid name",
required_error: "Name is required",
errorMap: () => ({ message: "OVERRIDE" }),
});
}).toThrow();
});
test("strict error message", () => {
const errorMsg = "Invalid object";
const obj = z.object({ x: z.string() }).strict(errorMsg);
const result = obj.safeParse({ x: "a", y: "b" });
expect(result.success).toEqual(false);
if (!result.success) {
expect(result.error.issues[0].message).toEqual(errorMsg);
}
});
test("enum error message, invalid enum elementstring", () => {
try {
z.enum(["Tuna", "Trout"]).parse("Salmon");
} catch (err) {
const zerr: z.ZodError = err as any;
expect(zerr.issues.length).toEqual(1);
expect(zerr.issues[0].message).toEqual("Invalid enum value. Expected 'Tuna' | 'Trout', received 'Salmon'");
}
});
test("enum error message, invalid type", () => {
try {
z.enum(["Tuna", "Trout"]).parse(12);
} catch (err) {
const zerr: z.ZodError = err as any;
expect(zerr.issues.length).toEqual(1);
expect(zerr.issues[0].message).toEqual("Expected 'Tuna' | 'Trout', received number");
}
});
test("nativeEnum default error message", () => {
enum Fish {
Tuna = "Tuna",
Trout = "Trout",
}
try {
z.nativeEnum(Fish).parse("Salmon");
} catch (err) {
const zerr: z.ZodError = err as any;
expect(zerr.issues.length).toEqual(1);
expect(zerr.issues[0].message).toEqual("Invalid enum value. Expected 'Tuna' | 'Trout', received 'Salmon'");
}
});
test("literal default error message", () => {
try {
z.literal("Tuna").parse("Trout");
} catch (err) {
const zerr: z.ZodError = err as any;
expect(zerr.issues.length).toEqual(1);
expect(zerr.issues[0].message).toEqual(`Invalid literal value, expected "Tuna"`);
}
});
test("literal bigint default error message", () => {
try {
z.literal(BigInt(12)).parse(BigInt(13));
} catch (err) {
const zerr: z.ZodError = err as any;
expect(zerr.issues.length).toEqual(1);
expect(zerr.issues[0].message).toEqual(`Invalid literal value, expected "12"`);
}
});
test("enum with message returns the custom error message", () => {
const schema = z.enum(["apple", "banana"], {
message: "the value provided is invalid",
});
const result1 = schema.safeParse("berries");
expect(result1.success).toEqual(false);
if (!result1.success) {
expect(result1.error.issues[0].message).toEqual("the value provided is invalid");
}
const result2 = schema.safeParse(undefined);
expect(result2.success).toEqual(false);
if (!result2.success) {
expect(result2.error.issues[0].message).toEqual("the value provided is invalid");
}
const result3 = schema.safeParse("banana");
expect(result3.success).toEqual(true);
const result4 = schema.safeParse(null);
expect(result4.success).toEqual(false);
if (!result4.success) {
expect(result4.error.issues[0].message).toEqual("the value provided is invalid");
}
});
test("when the message is falsy, it is used as is provided", () => {
const schema = z.string().max(1, { message: "" });
const result = schema.safeParse("asdf");
expect(result.success).toEqual(false);
if (!result.success) {
expect(result.error.issues[0].message).toEqual("");
}
});
// test("dont short circuit on continuable errors", () => {
// const user = z
// .object({
// password: z.string().min(6),
// confirm: z.string(),
// })
// .refine((data) => data.password === data.confirm, {
// message: "Passwords don't match",
// path: ["confirm"],
// });
// const result = user.safeParse({ password: "asdf", confirm: "qwer" });
// if (!result.success) {
// expect(result.error.issues.length).toEqual(2);
// }
// });
test("format() handles Object.prototype names in the issue path", () => {
const result = z
.record(z.string(), z.object({ pwn: z.number() }))
.safeParse(JSON.parse('{"__proto__": {"pwn": "x"}}'));
expect(result.success).toEqual(false);
if (!result.success) {
// the node must be a real own data property, not the inherited accessor
const node = Object.getOwnPropertyDescriptor(result.error.format(), "__proto__")!.value;
expect(node.pwn._errors).toHaveLength(1);
}
expect(({} as any).pwn).toBeUndefined();
const inherited = z.record(z.string(), z.string()).safeParse(JSON.parse('{"toString": 1}'));
expect(inherited.success).toEqual(false);
if (!inherited.success) {
expect((inherited.error.format() as any).toString._errors).toHaveLength(1);
}
});
test("format() handles an input-derived _errors path", () => {
const result = z.object({ parent: z.record(z.string()) }).safeParse({ parent: { _errors: 1 } });
expect(result.success).toEqual(false);
if (!result.success) {
expect(result.error.format().parent?._errors).toEqual(["Expected string, received number"]);
}
const nested = z
.object({ parent: z.record(z.object({ child: z.string() })) })
.safeParse({ parent: { _errors: { child: 1 } } });
expect(nested.success).toEqual(false);
if (!nested.success) {
expect((nested.error.format() as any).parent.child._errors).toEqual(["Expected string, received number"]);
}
});
@@ -0,0 +1 @@
module.exports={C:{"48":0.00696,"52":0.02437,"85":0.00348,"111":0.00348,"115":0.18797,"119":0.00348,"120":0.13924,"121":0.30285,"123":0.04873,"124":0.01044,"125":0.00348,"130":0.00348,"132":0.0557,"135":0.01044,"136":0.00696,"138":0.00348,"140":0.01044,"142":0.00348,"143":0.00348,"145":0.01392,"146":0.00348,"147":0.00696,"148":0.00348,"149":0.00348,"150":0.01392,"151":0.00348,"152":0.01044,"153":0.01392,"154":0.2924,"155":0.77278,"156":0.60221,"157":0.01741,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 49 50 51 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 112 113 114 116 117 118 122 126 127 128 129 131 133 134 137 139 141 144 158 159 160 3.5 3.6"},D:{"49":0.00348,"53":0.00348,"55":0.00348,"56":0.00348,"63":0.00348,"69":0.01741,"70":0.00696,"72":0.00348,"79":0.00696,"83":0.00348,"84":0.04177,"87":0.01044,"91":0.00348,"92":0.00348,"93":0.03481,"95":0.00696,"100":0.00348,"101":0.01044,"103":0.10095,"104":0.09051,"105":0.09399,"106":0.08703,"107":0.08703,"108":0.09399,"109":1.34715,"110":0.09051,"111":0.10095,"112":0.09399,"113":0.00696,"114":0.00348,"116":0.17405,"117":0.08703,"118":0.28196,"119":0.33766,"120":0.48386,"121":0.01741,"122":0.05222,"123":0.03133,"124":0.11139,"125":0.00696,"126":0.01741,"127":0.00696,"128":0.01741,"129":0.00348,"130":0.01044,"131":0.22975,"132":0.01741,"133":0.28544,"134":0.0731,"135":0.07658,"136":0.08703,"137":0.0731,"138":0.11835,"139":0.09747,"140":0.09051,"141":0.08703,"142":0.26108,"143":0.02089,"144":0.10443,"145":0.09747,"146":0.04873,"147":0.02089,"148":0.18797,"149":0.14968,"150":0.21582,"151":2.38449,"152":8.67465,"153":7.01073,"154":1.67784,"155":0.01741,"156":0.00348,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 50 51 52 54 57 58 59 60 61 62 64 65 66 67 68 71 73 74 75 76 77 78 80 81 85 86 88 89 90 94 96 97 98 99 102 115 157"},F:{"36":0.00696,"46":0.01044,"56":0.00348,"90":0.00348,"95":0.03133,"99":0.00696,"101":0.00696,"106":0.00696,"107":0.00348,"110":0.00348,"114":0.00348,"117":0.00348,"121":0.00348,"133":0.00348,"134":0.06614,"135":0.44905,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40 41 42 43 44 45 47 48 49 50 51 52 53 54 55 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 91 92 93 94 96 97 98 100 102 103 104 105 108 109 111 112 113 115 116 118 119 120 122 123 124 125 126 127 131 132 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"92":0.00348,"109":0.01044,"119":0.12184,"120":0.14272,"121":0.00696,"122":0.01044,"123":0.00348,"124":0.00348,"128":0.00348,"131":0.00348,"134":0.01044,"137":0.00348,"138":0.00696,"140":0.01392,"141":0.02089,"142":0.00696,"143":0.00696,"144":0.01044,"145":0.00696,"146":0.04525,"147":0.02437,"148":0.01392,"149":0.01741,"150":0.02437,"151":0.0731,"152":0.77278,"153":0.86329,"154":0.2193,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 114 115 116 117 118 125 126 127 129 130 132 133 135 136 139"},E:{"27":0.0557,_:"4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 14.1 15.1 15.2-15.3 15.4 15.5 16.0 16.1 16.2 16.3 16.4 16.5 17.0 17.2 18.1 18.2 26.0 27.1 TP","13.1":0.01741,"15.6":0.00696,"16.6":0.01392,"17.1":0.01392,"17.3":0.00348,"17.4":0.00348,"17.5":0.00348,"17.6":0.01392,"18.0":0.00348,"18.3":0.02089,"18.4":0.00348,"18.5-18.7":0.00348,"26.1":0.00696,"26.2":0.00696,"26.3":0.01741,"26.4":0.01044,"26.5":0.05222,"26.6":0.3307,"27.2":0.00696},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00178,"5.0-5.1":0.00178,"6.0-6.1":0,"7.0-7.1":0.00356,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.01781,"11.0-11.2":0.00178,"11.3-11.4":0.00356,"12.0-12.1":0,"12.2-12.5":0.04631,"13.0-13.1":0,"13.2":0.0089,"13.3":0,"13.4-13.7":0.00178,"14.0-14.4":0.00712,"14.5-14.8":0.01069,"15.0-15.1":0.01069,"15.2-15.3":0.00712,"15.4":0.0089,"15.5":0.01069,"15.6-15.8":0.23153,"16.0":0.01781,"16.1":0.03206,"16.2":0.01781,"16.3":0.03918,"16.4":0.0089,"16.5":0.01425,"16.6-16.7":0.32236,"17.0":0.01247,"17.1":0.01781,"17.2":0.01781,"17.3":0.02671,"17.4":0.0374,"17.5":0.07302,"17.6-17.7":0.18879,"18.0":0.03918,"18.1":0.07836,"18.2":0.10686,"18.3":0.18522,"18.4":0.11576,"18.5-18.7":2.39187,"26.0":0.11576,"26.1":0.11755,"26.2":0.30633,"26.3":0.33126,"26.4":0.24221,"26.5":1.62248,"26.6":10.01095,"27.0":0.76761,"27.1":0,"27.2":0.01959},P:{"4":0.02775,"20":0.00925,"22":0.00925,"25":0.037,"26":0.02775,"27":0.00925,"28":0.04626,"29":0.06476,"30":3.21938,_:"21 23 24 5.0-5.4 6.2-6.4 7.2-7.4 8.2 10.1 11.1-11.2 12.0 13.0 15.0 17.0 18.0 19.0","9.2":0.00925,"14.0":0.00925,"16.0":0.0185},I:{"0":0.01303,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.00001},K:{"0Line truncated
@@ -0,0 +1,24 @@
'use strict';
var _const = require('../../data/const.cjs');
var bruteforceMatcher = ({
token
}) => {
let guesses = _const.BRUTEFORCE_CARDINALITY ** token.length;
if (guesses === Number.POSITIVE_INFINITY) {
guesses = Number.MAX_VALUE;
}
let minGuesses;
// small detail: make bruteforce matches at minimum one guess bigger than smallest allowed
// submatch guesses, such that non-bruteforce submatches over the same [i..j] take precedence.
if (token.length === 1) {
minGuesses = _const.MIN_SUBMATCH_GUESSES_SINGLE_CHAR + 1;
} else {
minGuesses = _const.MIN_SUBMATCH_GUESSES_MULTI_CHAR + 1;
}
return Math.max(guesses, minGuesses);
};
module.exports = bruteforceMatcher;
//# sourceMappingURL=scoring.cjs.map
@@ -0,0 +1,49 @@
import type { TarOptions, TarOptionsAsyncFile, TarOptionsAsyncNoFile, TarOptionsSyncFile, TarOptionsSyncNoFile, TarOptionsWithAliases, TarOptionsWithAliasesAsync, TarOptionsWithAliasesAsyncFile, TarOptionsWithAliasesAsyncNoFile, TarOptionsWithAliasesFile, TarOptionsWithAliasesNoFile, TarOptionsWithAliasesSync, TarOptionsWithAliasesSyncFile, TarOptionsWithAliasesSyncNoFile } from './options.js';
export type CB = (er?: Error) => unknown;
export type TarCommand<AsyncClass, SyncClass extends {
sync: true;
}> = {
(): AsyncClass;
(opt: TarOptionsWithAliasesAsyncNoFile): AsyncClass;
(entries: string[]): AsyncClass;
(opt: TarOptionsWithAliasesAsyncNoFile, entries: string[]): AsyncClass;
} & {
(opt: TarOptionsWithAliasesSyncNoFile): SyncClass;
(opt: TarOptionsWithAliasesSyncNoFile, entries: string[]): SyncClass;
} & {
(opt: TarOptionsWithAliasesAsyncFile): Promise<void>;
(opt: TarOptionsWithAliasesAsyncFile, entries: string[]): Promise<void>;
(opt: TarOptionsWithAliasesAsyncFile, cb: CB): Promise<void>;
(opt: TarOptionsWithAliasesAsyncFile, entries: string[], cb: CB): Promise<void>;
} & {
(opt: TarOptionsWithAliasesSyncFile): void;
(opt: TarOptionsWithAliasesSyncFile, entries: string[]): void;
} & {
(opt: TarOptionsWithAliasesSync): typeof opt extends (TarOptionsWithAliasesFile) ? void : typeof opt extends TarOptionsWithAliasesNoFile ? SyncClass : void | SyncClass;
(opt: TarOptionsWithAliasesSync, entries: string[]): typeof opt extends TarOptionsWithAliasesFile ? void : typeof opt extends TarOptionsWithAliasesNoFile ? SyncClass : void | SyncClass;
} & {
(opt: TarOptionsWithAliasesAsync): typeof opt extends (TarOptionsWithAliasesFile) ? Promise<void> : typeof opt extends TarOptionsWithAliasesNoFile ? AsyncClass : Promise<void> | AsyncClass;
(opt: TarOptionsWithAliasesAsync, entries: string[]): typeof opt extends TarOptionsWithAliasesFile ? Promise<void> : typeof opt extends TarOptionsWithAliasesNoFile ? AsyncClass : Promise<void> | AsyncClass;
(opt: TarOptionsWithAliasesAsync, cb: CB): Promise<void>;
(opt: TarOptionsWithAliasesAsync, entries: string[], cb: CB): typeof opt extends TarOptionsWithAliasesFile ? Promise<void> : typeof opt extends TarOptionsWithAliasesNoFile ? never : Promise<void>;
} & {
(opt: TarOptionsWithAliasesFile): Promise<void> | void;
(opt: TarOptionsWithAliasesFile, entries: string[]): typeof opt extends TarOptionsWithAliasesSync ? void : typeof opt extends TarOptionsWithAliasesAsync ? Promise<void> : Promise<void> | void;
(opt: TarOptionsWithAliasesFile, cb: CB): Promise<void>;
(opt: TarOptionsWithAliasesFile, entries: string[], cb: CB): typeof opt extends TarOptionsWithAliasesSync ? never : typeof opt extends TarOptionsWithAliasesAsync ? Promise<void> : Promise<void>;
} & {
(opt: TarOptionsWithAliasesNoFile): typeof opt extends (TarOptionsWithAliasesSync) ? SyncClass : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass : SyncClass | AsyncClass;
(opt: TarOptionsWithAliasesNoFile, entries: string[]): typeof opt extends TarOptionsWithAliasesSync ? SyncClass : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass : SyncClass | AsyncClass;
} & {
(opt: TarOptionsWithAliases): typeof opt extends (TarOptionsWithAliasesFile) ? typeof opt extends TarOptionsWithAliasesSync ? void : typeof opt extends TarOptionsWithAliasesAsync ? Promise<void> : void | Promise<void> : typeof opt extends TarOptionsWithAliasesNoFile ? typeof opt extends TarOptionsWithAliasesSync ? SyncClass : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass : SyncClass | AsyncClass : typeof opt extends TarOptionsWithAliasesSync ? SyncClass | void : typeof opt extends TarOptionsWithAliasesAsync ? AsyncClass | Promise<void> : SyncClass | void | AsyncClass | Promise<void>;
} & {
syncFile: (opt: TarOptionsSyncFile, entries: string[]) => void;
asyncFile: (opt: TarOptionsAsyncFile, entries: string[], cb?: CB) => Promise<void>;
syncNoFile: (opt: TarOptionsSyncNoFile, entries: string[]) => SyncClass;
asyncNoFile: (opt: TarOptionsAsyncNoFile, entries: string[]) => AsyncClass;
validate?: (opt: TarOptions, entries?: string[]) => void;
};
export declare const makeCommand: <AsyncClass, SyncClass extends {
sync: true;
}>(syncFile: (opt: TarOptionsSyncFile, entries: string[]) => void, asyncFile: (opt: TarOptionsAsyncFile, entries: string[], cb?: CB) => Promise<void>, syncNoFile: (opt: TarOptionsSyncNoFile, entries: string[]) => SyncClass, asyncNoFile: (opt: TarOptionsAsyncNoFile, entries: string[]) => AsyncClass, validate?: (opt: TarOptions, entries?: string[]) => void) => TarCommand<AsyncClass, SyncClass>;
//# sourceMappingURL=make-command.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"square-check.js","sources":["../../../src/icons/square-check.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name SquareCheck\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHg9IjMiIHk9IjMiIHJ4PSIyIiAvPgogIDxwYXRoIGQ9Im05IDEyIDIgMiA0LTQiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/square-check\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 SquareCheck = createLucideIcon('SquareCheck', [\n ['rect', { width: '18', height: '18', x: '3', y: '3', rx: '2', key: 'afitv7' }],\n ['path', { d: 'm9 12 2 2 4-4', key: 'dzmm74' }],\n]);\n\nexport default SquareCheck;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAc,iBAAiB,aAAe,CAAA,CAAA,CAAA;AAAA,CAAA,CAClD,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,CAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAChD,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,45 @@
import { describe, expect, it } from "vitest";
import * as z from "zod/v4";
describe("Recursive Tuples Regression #5089", () => {
it("creates recursive tuple without crash", () => {
expect(() => {
const y = z.lazy((): any => z.tuple([y, y]).or(z.string()));
}).not.toThrow();
});
it("parses recursive tuple data correctly", () => {
const y = z.lazy((): any => z.tuple([y, y]).or(z.string()));
// Base case
expect(y.parse("hello")).toBe("hello");
// Recursive cases
expect(() => y.parse(["a", "b"])).not.toThrow();
expect(() => y.parse(["a", ["b", "c"]])).not.toThrow();
});
it("matches #5089 expected behavior", () => {
// Exact code from the issue
expect(() => {
const y = z.lazy((): any => z.tuple([y, y]).or(z.string()));
y.parse(["a", ["b", "c"]]);
}).not.toThrow();
});
it("handles workaround pattern", () => {
// Alternative pattern from issue discussion
expect(() => {
const y = z.lazy((): any => z.string().or(z.lazy(() => z.tuple([y, y]))));
y.parse(["a", ["b", "c"]]);
}).not.toThrow();
});
it("recursive arrays still work (comparison)", () => {
const y = z.lazy((): any => z.array(y).or(z.string()));
expect(y.parse("hello")).toBe("hello");
expect(y.parse(["hello", "world"])).toEqual(["hello", "world"]);
expect(y.parse(["a", ["b", "c"]])).toEqual(["a", ["b", "c"]]);
});
});
@@ -0,0 +1,764 @@
'use strict'
const {
safeHTTPMethods,
pathHasQueryOrFragment,
hasSafeIterator,
isValidHTTPToken,
setHeader
} = require('../core/util')
const { serializePathWithQuery } = require('../core/util')
const { kRequestOrigin } = require('../core/symbols')
const MAX_DELTA_SECONDS = 2147483647
const RESTRICTIVE_DIRECTIVE_NAMES = ['no-store', 'private', 'no-cache']
const kInvalidCacheControlDirectives = Symbol('invalid cache-control directives')
function trimOWS (value) {
return value.replace(/^[\t ]+|[\t ]+$/g, '')
}
function arrayIncludes (array, value) {
for (let i = 0; i < array.length; i++) {
if (array[i] === value) {
return true
}
}
return false
}
function trimOWSStart (value) {
return value.replace(/^[\t ]+/, '')
}
function trimOWSEnd (value) {
return value.replace(/[\t ]+$/, '')
}
function findUnescapedQuote (value, start) {
let escaped = false
for (let i = start; i < value.length; i++) {
if (escaped) {
escaped = false
} else if (value[i] === '\\') {
escaped = true
} else if (value[i] === '"') {
return i
}
}
return -1
}
function splitCacheControlHeaderValue (value) {
const directives = []
let start = 0
let quoteStart = -1
let inQuote = false
let escaped = false
for (let i = 0; i < value.length; i++) {
if (inQuote) {
if (escaped) {
escaped = false
} else if (value[i] === '\\') {
escaped = true
} else if (value[i] === '"') {
inQuote = false
quoteStart = -1
}
} else if (value[i] === '"') {
inQuote = true
quoteStart = i
} else if (value[i] === ',') {
directives.push({ value: value.substring(start, i), fromMalformedQuote: false })
start = i + 1
}
}
if (!inQuote) {
directives.push({ value: value.substring(start), fromMalformedQuote: false })
return directives
}
const tail = value.substring(start)
const quoteOffset = quoteStart - start
let tailStart = 0
for (let i = 0; i < tail.length; i++) {
if (tail[i] === ',') {
directives.push({
value: tail.substring(tailStart, i),
fromMalformedQuote: tailStart > quoteOffset
})
tailStart = i + 1
}
}
directives.push({
value: tail.substring(tailStart),
fromMalformedQuote: tailStart > quoteOffset
})
return directives
}
function markInvalidCacheControlDirective (directives, key) {
let invalidDirectives = directives[kInvalidCacheControlDirectives]
if (invalidDirectives === undefined) {
invalidDirectives = new Set()
Object.defineProperty(directives, kInvalidCacheControlDirectives, {
value: invalidDirectives
})
}
invalidDirectives.add(key)
}
function hasInvalidCacheControlDirective (directives, key) {
return directives[kInvalidCacheControlDirectives]?.has(key) === true
}
function getMalformedRestrictiveDirectiveName (key) {
for (const directiveName of RESTRICTIVE_DIRECTIVE_NAMES) {
if (
key.startsWith(directiveName) &&
key.length > directiveName.length &&
!isValidHTTPToken(key[directiveName.length])
) {
return directiveName
}
}
let tokenOnlyKey = ''
let hasInvalidTokenChar = false
for (let i = 0; i < key.length; i++) {
if (isValidHTTPToken(key[i])) {
tokenOnlyKey += key[i]
} else {
hasInvalidTokenChar = true
}
}
if (hasInvalidTokenChar && arrayIncludes(RESTRICTIVE_DIRECTIVE_NAMES, tokenOnlyKey)) {
return tokenOnlyKey
}
}
/**
* @param {import('../../types/dispatcher.d.ts').default.DispatchOptions} opts
*/
function getRequestOrigin (opts) {
const origin = opts[kRequestOrigin] === undefined
? opts.origin
: opts[kRequestOrigin]
return typeof origin === 'string' || origin instanceof URL
? origin
: null
}
/**
* @param {import('../../types/dispatcher.d.ts').default.DispatchOptions} opts
* @param {string|null|undefined} interceptorOrigin
*/
function getInterceptorOrigin (opts, interceptorOrigin) {
const requestOrigin = getRequestOrigin(opts)
if (interceptorOrigin === undefined) {
return requestOrigin
}
if (interceptorOrigin === null) {
return null
}
if (requestOrigin) {
try {
if (new URL(requestOrigin).origin !== interceptorOrigin) {
return null
}
} catch {
return interceptorOrigin
}
}
return interceptorOrigin
}
/**
* @param {import('../../types/dispatcher.d.ts').default.DispatchOptions} opts
* @param {string|URL|null} [origin]
*/
function makeCacheKey (opts, origin = getRequestOrigin(opts)) {
if (!origin) {
throw new Error('opts.origin is undefined')
}
let fullPath = opts.path || '/'
if (opts.query && !pathHasQueryOrFragment(fullPath)) {
fullPath = serializePathWithQuery(fullPath, opts.query)
}
return {
origin: origin.toString(),
method: opts.method,
path: fullPath,
headers: opts.headers
}
}
function appendHeader (headers, key, val) {
const headerName = key.toLowerCase()
// Reading `headers[headerName]` directly would resolve `__proto__` (and any
// other inherited name) through the prototype chain rather than report the
// header as absent.
const current = Object.hasOwn(headers, headerName)
? headers[headerName]
: undefined
const values = Array.isArray(val) ? val : [val]
if (current === undefined) {
setHeader(headers, headerName, Array.isArray(val) ? val.slice() : val)
} else if (Array.isArray(current)) {
current.push(...values)
} else {
setHeader(headers, headerName, [current, ...values])
}
}
/**
* @param {Record<string, string[] | string>}
* @returns {Record<string, string[] | string>}
*/
function normalizeHeaders (opts) {
let headers
if (opts.headers == null) {
headers = {}
} else if (typeof opts.headers === 'object') {
headers = {}
if (hasSafeIterator(opts.headers)) {
if (Array.isArray(opts.headers)) {
// Array format: could be flat alternating [k, v, k, v, ...]
// or array-of-pairs [[k, v], ...]
const first = opts.headers[0]
if (Array.isArray(first)) {
for (const x of opts.headers) {
if (!Array.isArray(x)) {
throw new Error('opts.headers is not a valid header map')
}
const [key, val] = x
if (typeof key !== 'string' || typeof val !== 'string') {
throw new Error('opts.headers is not a valid header map')
}
appendHeader(headers, key, val)
}
} else {
// Flat alternating array [k, v, k, v, ...]
const len = opts.headers.length
if (len % 2 !== 0) {
throw new Error('opts.headers is not a valid header map')
}
for (let i = 0; i < len; i += 2) {
const key = opts.headers[i]
const val = opts.headers[i + 1]
if (typeof key !== 'string' || (typeof val !== 'string' && !Array.isArray(val))) {
throw new Error('opts.headers is not a valid header map')
}
if (typeof val === 'string') {
appendHeader(headers, key, val)
} else {
const mapped = []
for (let j = 0; j < val.length; j++) {
const v = val[j]
mapped.push(typeof v === 'string' ? v : v.toString('latin1'))
}
appendHeader(headers, key, mapped)
}
}
}
} else {
// Non-array iterable (e.g. Map) — use original iteration logic
for (const x of opts.headers) {
if (!Array.isArray(x)) {
throw new Error('opts.headers is not a valid header map')
}
const [key, val] = x
if (typeof key !== 'string' || typeof val !== 'string') {
throw new Error('opts.headers is not a valid header map')
}
appendHeader(headers, key, val)
}
}
} else {
for (const key of Object.keys(opts.headers)) {
appendHeader(headers, key, opts.headers[key])
}
}
} else {
throw new Error('opts.headers is not an object')
}
return headers
}
/**
* @param {any} key
*/
function assertCacheKey (key) {
if (typeof key !== 'object') {
throw new TypeError(`expected key to be object, got ${typeof key}`)
}
for (const property of ['origin', 'method', 'path']) {
if (typeof key[property] !== 'string') {
throw new TypeError(`expected key.${property} to be string, got ${typeof key[property]}`)
}
}
if (key.headers !== undefined && typeof key.headers !== 'object') {
throw new TypeError(`expected headers to be object, got ${typeof key}`)
}
}
/**
* @param {any} value
*/
function assertCacheValue (value) {
if (typeof value !== 'object') {
throw new TypeError(`expected value to be object, got ${typeof value}`)
}
for (const property of ['statusCode', 'cachedAt', 'staleAt', 'deleteAt']) {
if (typeof value[property] !== 'number') {
throw new TypeError(`expected value.${property} to be number, got ${typeof value[property]}`)
}
}
if (typeof value.statusMessage !== 'string') {
throw new TypeError(`expected value.statusMessage to be string, got ${typeof value.statusMessage}`)
}
if (value.headers != null && typeof value.headers !== 'object') {
throw new TypeError(`expected value.rawHeaders to be object, got ${typeof value.headers}`)
}
if (value.vary !== undefined && typeof value.vary !== 'object') {
throw new TypeError(`expected value.vary to be object, got ${typeof value.vary}`)
}
if (value.etag !== undefined && typeof value.etag !== 'string') {
throw new TypeError(`expected value.etag to be string, got ${typeof value.etag}`)
}
}
/**
* @see https://www.rfc-editor.org/rfc/rfc9111.html#name-cache-control
* @see https://www.iana.org/assignments/http-cache-directives/http-cache-directives.xhtml
* @param {string | string[]} header
* @returns {import('../../types/cache-interceptor.d.ts').default.CacheControlDirectives}
*/
function parseCacheControlHeader (header) {
/**
* @type {import('../../types/cache-interceptor.d.ts').default.CacheControlDirectives}
*/
const output = {}
const invalidNumericDirectives = new Set()
const invalidNoArgumentDirectives = new Set()
const directives = splitCacheControlHeaderValue(Array.isArray(header) ? header.join(',') : header)
for (let i = 0; i < directives.length; i++) {
const directiveRecord = directives[i]
const directive = directiveRecord.value.toLowerCase()
const fromMalformedQuote = directiveRecord.fromMalformedQuote
const keyValueDelimiter = directive.indexOf('=')
let key
let value
let keyHasTrailingWhitespace = false
let valueHasLeadingWhitespace = false
if (keyValueDelimiter !== -1) {
const rawKey = directive.substring(0, keyValueDelimiter)
const rawValue = directive.substring(keyValueDelimiter + 1)
keyHasTrailingWhitespace = trimOWSEnd(rawKey) !== rawKey
valueHasLeadingWhitespace = trimOWSStart(rawValue) !== rawValue
key = trimOWS(rawKey)
value = trimOWSStart(rawValue)
} else {
key = trimOWS(directive)
}
const malformedRestrictiveDirectiveName = getMalformedRestrictiveDirectiveName(key)
if (malformedRestrictiveDirectiveName !== undefined) {
output[malformedRestrictiveDirectiveName] = true
continue
}
switch (key) {
case 'min-fresh':
case 'max-stale':
case 'max-age':
case 's-maxage':
case 'stale-while-revalidate':
case 'stale-if-error': {
if (fromMalformedQuote || invalidNumericDirectives.has(key)) {
continue
}
if (value === undefined || keyHasTrailingWhitespace || valueHasLeadingWhitespace) {
delete output[key]
invalidNumericDirectives.add(key)
markInvalidCacheControlDirective(output, key)
continue
}
if (
value.length >= 2 &&
value[0] === '"' &&
value[value.length - 1] === '"'
) {
value = value.substring(1, value.length - 1)
}
if (!/^[0-9]+$/.test(value)) {
delete output[key]
invalidNumericDirectives.add(key)
markInvalidCacheControlDirective(output, key)
continue
}
const parsedValue = Math.min(parseInt(value, 10), MAX_DELTA_SECONDS)
if (key === 'min-fresh') {
if (!(key in output) || output[key] < parsedValue) {
output[key] = parsedValue
}
} else if (!(key in output) || output[key] > parsedValue) {
output[key] = parsedValue
}
break
}
case 'private':
case 'no-cache': {
if (fromMalformedQuote) {
output[key] = true
break
}
if (value !== undefined && value.length === 0) {
output[key] = true
break
}
if (value) {
// The private and no-cache directives can be unqualified (aka just
// `private` or `no-cache`) or qualified (w/ a value). When they're
// qualified, it's a list of headers like `no-cache=header1`,
// `no-cache="header1"`, or `no-cache="header1, header2"`
// If we're given multiple headers, the comma messes us up since
// we split the full header by commas. So, let's loop through the
// remaining parts in front of us until we find one that contains a
// closing quote. We can then skip the consumed quoted-list fragments and
// continue parsing like normal.
// https://www.rfc-editor.org/rfc/rfc9111.html#name-no-cache-2
if (value[0] === '"') {
// Something like `no-cache="some-header"` OR `no-cache="some-header, another-header"`.
value = trimOWSEnd(value)
let fieldList = ''
let lastQuotedPart = i
let foundEndingQuote = false
const closingQuote = findUnescapedQuote(value, 1)
if (closingQuote !== -1) {
fieldList = value.substring(1, closingQuote)
foundEndingQuote = true
} else {
// Something like `no-cache="some-header, another-header"`
// This can still be something invalid, e.g. `no-cache="some-header, ...`
const fieldListParts = [value.substring(1)]
for (let j = i + 1; j < directives.length; j++) {
const nextPart = trimOWS(directives[j].value)
const closingQuote = findUnescapedQuote(nextPart, 0)
lastQuotedPart = j
if (closingQuote !== -1) {
fieldListParts.push(nextPart.substring(0, closingQuote))
foundEndingQuote = true
break
}
fieldListParts.push(nextPart)
}
fieldList = fieldListParts.join(',')
}
if (!foundEndingQuote) {
output[key] = true
break
}
i = lastQuotedPart
const headers = fieldList.split(',')
let validFieldNames = true
for (let j = 0; j < headers.length; j++) {
headers[j] = trimOWS(headers[j])
if (!isValidHTTPToken(headers[j])) {
validFieldNames = false
}
}
if (!validFieldNames) {
output[key] = true
} else if (output[key] !== true) {
if (key in output) {
output[key] = output[key].concat(headers)
} else {
output[key] = headers
}
}
} else {
// Something like `no-cache=some-header`
const fieldName = trimOWS(value)
if (!isValidHTTPToken(fieldName)) {
output[key] = true
} else if (output[key] !== true) {
if (key in output) {
output[key] = output[key].concat(fieldName)
} else {
output[key] = [fieldName]
}
}
}
break
}
}
// eslint-disable-next-line no-fallthrough
case 'public':
case 'must-revalidate':
case 'proxy-revalidate':
case 'immutable':
case 'no-transform':
case 'must-understand':
case 'only-if-cached':
if (fromMalformedQuote || invalidNoArgumentDirectives.has(key)) {
continue
}
if (value !== undefined) {
// These are qualified (something like `public=...`) when they aren't
// allowed to be, skip all instances of the malformed directive.
delete output[key]
invalidNoArgumentDirectives.add(key)
continue
}
output[key] = true
break
case 'no-store':
output[key] = true
break
default:
// Ignore unknown directives as per https://www.rfc-editor.org/rfc/rfc9111.html#section-5.2.3-1
continue
}
}
return output
}
/**
* @param {string | string[]} varyHeader Vary header from the server
* @returns {string[]}
*/
function splitVaryHeader (varyHeader) {
const values = Array.isArray(varyHeader) ? varyHeader : [varyHeader]
const output = []
for (let i = 0; i < values.length; i++) {
const parts = values[i].split(',')
for (let j = 0; j < parts.length; j++) {
output.push(parts[j])
}
}
return output
}
/**
* @param {string | string[]} varyHeader Vary header from the server
* @returns {boolean}
*/
function hasVaryStar (varyHeader) {
const values = splitVaryHeader(varyHeader)
for (let i = 0; i < values.length; i++) {
if (trimOWS(values[i]).indexOf('*') !== -1) {
return true
}
}
return false
}
/**
* @param {string | string[]} varyHeader Vary header from the server
* @param {Record<string, string | string[]>} headers Request headers
* @returns {Record<string, string | string[] | null> | undefined}
*/
function parseVaryHeader (varyHeader, headers) {
if (hasVaryStar(varyHeader)) {
return headers
}
const output = /** @type {Record<string, string | string[] | null>} */ ({})
const varyingHeaders = splitVaryHeader(varyHeader)
for (const header of varyingHeaders) {
const trimmedHeader = trimOWS(header).toLowerCase()
if (trimmedHeader.length === 0) {
continue
}
if (!isValidHTTPToken(trimmedHeader)) {
return undefined
}
const headerValue = headers[trimmedHeader]
output[trimmedHeader] = Array.isArray(headerValue) ? headerValue.slice() : headerValue ?? null
}
return output
}
/**
* @param {string | string[]} varyHeader Vary header from the server
* @returns {boolean}
*/
function isInvalidOrWildcardVaryHeader (varyHeader) {
return hasVaryStar(varyHeader) || parseVaryHeader(varyHeader, {}) === undefined
}
/**
* Note: this deviates from the spec a little. Empty etags ("", W/"") are valid,
* however, including them in cached resposnes serves little to no purpose.
*
* @see https://www.rfc-editor.org/rfc/rfc9110.html#name-etag
*
* @param {string} etag
* @returns {boolean}
*/
function isEtagUsable (etag) {
if (etag.length <= 2) {
// Shortest an etag can be is two chars (just ""). This is where we deviate
// from the spec requiring a min of 3 chars however
return false
}
if (etag[0] === '"' && etag[etag.length - 1] === '"') {
// ETag: ""asd123"" or ETag: "W/"asd123"", kinda undefined behavior in the
// spec. Some servers will accept these while others don't.
// ETag: "asd123"
return !(etag[1] === '"' || etag.startsWith('"W/'))
}
if (etag.startsWith('W/"') && etag[etag.length - 1] === '"') {
// ETag: W/"", also where we deviate from the spec & require a min of 3
// chars
// ETag: for W/"", W/"asd123"
return etag.length !== 4
}
// Anything else
return false
}
/**
* @param {unknown} store
* @returns {asserts store is import('../../types/cache-interceptor.d.ts').default.CacheStore}
*/
function assertCacheStore (store, name = 'CacheStore') {
if (typeof store !== 'object' || store === null) {
throw new TypeError(`expected type of ${name} to be a CacheStore, got ${store === null ? 'null' : typeof store}`)
}
for (const fn of ['get', 'createWriteStream', 'delete']) {
if (typeof store[fn] !== 'function') {
throw new TypeError(`${name} needs to have a \`${fn}()\` function`)
}
}
}
/**
* @param {unknown} methods
* @returns {asserts methods is import('../../types/cache-interceptor.d.ts').default.CacheMethods[]}
*/
function assertCacheMethods (methods, name = 'CacheMethods') {
if (!Array.isArray(methods)) {
throw new TypeError(`expected type of ${name} needs to be an array, got ${methods === null ? 'null' : typeof methods}`)
}
if (methods.length === 0) {
throw new TypeError(`${name} needs to have at least one method`)
}
for (const method of methods) {
if (!arrayIncludes(safeHTTPMethods, method)) {
throw new TypeError(`element of ${name}-array needs to be one of following values: ${safeHTTPMethods.join(', ')}, got ${method}`)
}
}
}
/**
* Creates a string key for request deduplication purposes.
* This key is used to identify in-flight requests that can be shared.
* @param {import('../../types/cache-interceptor.d.ts').default.CacheKey} cacheKey
* @param {Set<string>} [excludeHeaders] Set of lowercase header names to exclude from the key
* @returns {string}
*/
function makeDeduplicationKey (cacheKey, excludeHeaders) {
// Use JSON.stringify to produce a collision-resistant key.
// Previous format used `:` and `=` delimiters without escaping, which
// allowed different header sets to produce identical keys (e.g.
// {a:"x:b=y"} vs {a:"x", b:"y"}). See: https://github.com/nodejs/undici/issues/5012
const headers = {}
if (cacheKey.headers) {
const sortedHeaders = Object.keys(cacheKey.headers).sort()
for (const header of sortedHeaders) {
// Skip excluded headers
if (excludeHeaders?.has(header.toLowerCase())) {
continue
}
setHeader(headers, header, cacheKey.headers[header])
}
}
return JSON.stringify([cacheKey.origin, cacheKey.method, cacheKey.path, headers])
}
module.exports = {
getInterceptorOrigin,
getRequestOrigin,
makeCacheKey,
normalizeHeaders,
assertCacheKey,
assertCacheValue,
parseCacheControlHeader,
hasInvalidCacheControlDirective,
parseVaryHeader,
hasVaryStar,
isInvalidOrWildcardVaryHeader,
isEtagUsable,
assertCacheMethods,
assertCacheStore,
makeDeduplicationKey
}
@@ -0,0 +1,13 @@
import type { ZodErrorMap } from "./ZodError.js";
import defaultErrorMap from "./locales/en.js";
let overrideErrorMap = defaultErrorMap;
export { defaultErrorMap };
export function setErrorMap(map: ZodErrorMap) {
overrideErrorMap = map;
}
export function getErrorMap() {
return overrideErrorMap;
}
@@ -0,0 +1,67 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VisitorBase = void 0;
const visitor_keys_1 = require("@typescript-eslint/visitor-keys");
function isObject(obj) {
return typeof obj === 'object' && obj != null;
}
function isNode(node) {
return isObject(node) && typeof node.type === 'string';
}
class VisitorBase {
#childVisitorKeys;
#visitChildrenEvenIfSelectorExists;
constructor(options) {
this.#childVisitorKeys = options.childVisitorKeys ?? visitor_keys_1.visitorKeys;
this.#visitChildrenEvenIfSelectorExists =
options.visitChildrenEvenIfSelectorExists ?? false;
}
/**
* Default method for visiting children.
* @param node the node whose children should be visited
* @param excludeArr a list of keys to not visit
*/
visitChildren(node, excludeArr = []) {
if (node?.type == null) {
return;
}
const exclude = new Set([...excludeArr, 'parent']);
const children = this.#childVisitorKeys[node.type] ?? Object.keys(node);
for (const key of children) {
if (exclude.has(key)) {
continue;
}
const child = node[key];
if (!child) {
continue;
}
if (Array.isArray(child)) {
for (const subChild of child) {
if (isNode(subChild)) {
this.visit(subChild);
}
}
}
else if (isNode(child)) {
this.visit(child);
}
}
}
/**
* Dispatching node.
*/
visit(node) {
if (node?.type == null) {
return;
}
const visitor = this[node.type];
if (visitor) {
visitor.call(this, node);
if (!this.#visitChildrenEvenIfSelectorExists) {
return;
}
}
this.visitChildren(node);
}
}
exports.VisitorBase = VisitorBase;
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=delay.interface.js.map
@@ -0,0 +1,145 @@
#!/usr/bin/env node
'use strict'
process.title = 'node-gyp'
const envPaths = require('env-paths')
const gyp = require('../')
const log = require('../lib/log')
const os = require('os')
/**
* Process and execute the selected commands.
*/
const prog = gyp()
let completed = false
prog.parseArgv(process.argv)
prog.devDir = prog.opts.devdir
const homeDir = os.homedir()
if (prog.devDir) {
prog.devDir = prog.devDir.replace(/^~/, homeDir)
} else if (homeDir) {
prog.devDir = envPaths('node-gyp', { suffix: '' }).cache
} else {
throw new Error(
"node-gyp requires that the user's home directory is specified " +
'in either of the environmental variables HOME or USERPROFILE. ' +
'Overide with: --devdir /path/to/.node-gyp')
}
if (prog.todo.length === 0) {
if (~process.argv.indexOf('-v') || ~process.argv.indexOf('--version')) {
log.stdout('v%s', prog.version)
} else {
log.stdout('%s', prog.usage())
}
process.exit(0)
}
log.info('it worked if it ends with', 'ok')
log.verbose('cli', process.argv)
log.info('using', 'node-gyp@%s', prog.version)
log.info('using', 'node@%s | %s | %s', process.versions.node, process.platform, process.arch)
/**
* Change dir if -C/--directory was passed.
*/
const dir = prog.opts.directory
if (dir) {
const fs = require('fs')
try {
const stat = fs.statSync(dir)
if (stat.isDirectory()) {
log.info('chdir', dir)
process.chdir(dir)
} else {
log.warn('chdir', dir + ' is not a directory')
}
} catch (e) {
if (e.code === 'ENOENT') {
log.warn('chdir', dir + ' is not a directory')
} else {
log.warn('chdir', 'error during chdir() "%s"', e.message)
}
}
}
async function run () {
const command = prog.todo.shift()
if (!command) {
// done!
completed = true
log.info('ok')
return
}
try {
const args = await prog.commands[command.name](command.args) ?? []
if (command.name === 'list') {
if (args.length) {
args.forEach((version) => log.stdout(version))
} else {
log.stdout('No node development files installed. Use `node-gyp install` to install a version.')
}
} else if (args.length >= 1) {
log.stdout(...args.slice(1))
}
// now run the next command in the queue
return run()
} catch (err) {
log.error(command.name + ' error')
log.error('stack', err.stack)
errorMessage()
log.error('not ok')
return process.exit(1)
}
}
process.on('exit', function (code) {
if (!completed && !code) {
log.error('Completion callback never invoked!')
issueMessage()
process.exit(6)
}
})
process.on('uncaughtException', function (err) {
log.error('UNCAUGHT EXCEPTION')
log.error('stack', err.stack)
issueMessage()
process.exit(7)
})
function errorMessage () {
// copied from npm's lib/utils/error-handler.js
const os = require('os')
log.error('System', os.type() + ' ' + os.release())
log.error('command', process.argv
.map(JSON.stringify).join(' '))
log.error('cwd', process.cwd())
log.error('node -v', process.version)
log.error('node-gyp -v', 'v' + prog.package.version)
// print the npm package version
for (const env of ['npm_package_name', 'npm_package_version']) {
const value = process.env[env]
if (value != null) {
log.error(`$${env}`, value)
}
}
}
function issueMessage () {
errorMessage()
log.error('', ['Node-gyp failed to build your package.',
'Try to update npm and/or node-gyp and if it does not help file an issue with the package author.'
].join('\n'))
}
// start running the given commands!
run()
@@ -0,0 +1,5 @@
commonWords.json:
- OpenSubtitles 2024 (via OPUS)
License: ODC-BY
Source: https://opus.nlpl.eu/
Provider: Helsinki-NLP
@@ -0,0 +1,518 @@
export default `flf2a$ 5 4 20 15 6
Square by Chris Gill, 30-JUN-94 -- based on .sig of Jeb Hagan.
---
Font modified June 17, 2007 by patorjk
This was to widen the space character.
$ $@
$ $@
$ $@
$ $@
$ $@@
__ @
| |@
|__|@
|__|@
@@
____ @
| | |@
|_|_|@
@
@@
_____ @
_| | |_ @
|_ _|@
|_ _|@
|__|__| @@
__,-,__ @
| ' '__|@
|__ |@
|_______|@
|_| @@
__ ___ @
|__| |@
| __|@
|___|__|@
@@
__,-,__ @
| ' '__|@
| __|@
|_______|@
|_| @@
__ @
| |@
|_|@
@
@@
___ @
,' _|@
| | @
| |_ @
\`.___|@@
___ @
|_ \`.@
| |@
_| |@
|___,'@@
__ _ __ @
| | | |@
> < @
|__|_|__|@
@@
__ @
_| |_ @
|_ _|@
|__| @
@@
@
@
__ @
| |@
|_|@@
@
______ @
|______|@
@
@@
@
@
__ @
|__|@
@@
___@
/ /@
,' ,' @
/__/ @
@@
______ @
| |@
| -- |@
|______|@
@@
____ @
|_ | @
_| |_ @
|______|@
@@
______ @
|__ |@
| __|@
|______|@
@@
______ @
|__ |@
|__ |@
|______|@
@@
_____ @
| | | @
|__ |@
|__| @
@@
______ @
| __|@
|__ |@
|______|@
@@
______ @
| __|@
| __ |@
|______|@
@@
______ @
| |@
|_ |@
|____|@
@@
______ @
| __ |@
| __ |@
|______|@
@@
______ @
| __ |@
|__ |@
|______|@
@@
__ @
|__|@
__ @
|__|@
@@
__ @
|__|@
__ @
| |@
|_|@@
__ @
,' _|@
/ / @
\\ \\_ @
\`.__|@@
@
______ @
|______|@
|______|@
@@
__ @
|_ \`. @
\\ \\@
_/ /@
|__,' @@
_____ @
|__ |@
', ,-'@
|--| @
'--' @@
_________ @
| ___ |@
| | _ |@
| |______|@
|_________|@@
_______ @
| _ |@
| |@
|___|___|@
@@
______ @
| __ \\@
| __ <@
|______/@
@@
______ @
| |@
| ---|@
|______|@
@@
_____ @
| \\ @
| -- |@
|_____/ @
@@
_______ @
| ___|@
| ___|@
|_______|@
@@
_______ @
| ___|@
| ___|@
|___| @
@@
_______ @
| __|@
| | |@
|_______|@
@@
_______ @
| | |@
| |@
|___|___|@
@@
_______ @
|_ _|@
_| |_ @
|_______|@
@@
_____ @
_| |@
| |@
|_______|@
@@
__ __ @
| |/ |@
| < @
|__|\\__|@
@@
_____ @
| |_ @
| |@
|_______|@
@@
_______ @
| | |@
| |@
|__|_|__|@
@@
_______ @
| | |@
| |@
|__|____|@
@@
_______ @
| |@
| - |@
|_______|@
@@
______ @
| __ \\@
| __/@
|___| @
@@
_______ @
| |@
| - _|@
|_______|@
@@
______ @
| __ \\@
| <@
|___|__|@
@@
_______ @
| __|@
|__ |@
|_______|@
@@
_______ @
|_ _|@
| | @
|___| @
@@
_______ @
| | |@
| | |@
|_______|@
@@
___ ___ @
| | |@
| | |@
\\_____/ @
@@
________ @
| | | |@
| | | |@
|________|@
@@
___ ___ @
| | |@
|- -|@
|___|___|@
@@
___ ___ @
| | |@
\\ / @
|___| @
@@
_______ @
|__ |@
| __|@
|_______|@
@@
____ @
| _|@
| | @
| |_ @
|____|@@
___ @
\\ \\ @
\`. \`. @
\\__\\@
@@
____ @
|_ |@
| |@
_| |@
|____|@@
____ @
| |@
|_/\\_|@
@
@@
@
@
@
______ @
|______|@@
__ @
| |@
|_| @
@
@@
@
.---.-.@
| _ |@
|___._|@
@@
__ @
| |--.@
| _ |@
|_____|@
@@
@
.----.@
| __|@
|____|@
@@
__ @
.--| |@
| _ |@
|_____|@
@@
@
.-----.@
| -__|@
|_____|@
@@
___ @
.' _|@
| _|@
|__| @
@@
@
.-----.@
| _ |@
|___ |@
|_____|@@
__ @
| |--.@
| |@
|__|__|@
@@
__ @
|__|@
| |@
|__|@
@@
__ @
|__|@
| |@
| |@
|___|@@
__ @
| |--.@
| < @
|__|__|@
@@
__ @
| |@
| |@
|__|@
@@
@
.--------.@
| |@
|__|__|__|@
@@
@
.-----.@
| |@
|__|__|@
@@
@
.-----.@
| _ |@
|_____|@
@@
@
.-----.@
| _ |@
| __|@
|__| @@
@
.-----.@
| _ |@
|__ |@
|__|@@
@
.----.@
| _|@
|__| @
@@
@
.-----.@
|__ --|@
|_____|@
@@
__ @
| |_ @
| _|@
|____|@
@@
@
.--.--.@
| | |@
|_____|@
@@
@
.--.--.@
| | |@
\\___/ @
@@
@
.--.--.--.@
| | | |@
|________|@
@@
@
.--.--.@
|_ _|@
|__.__|@
@@
@
.--.--.@
| | |@
|___ |@
|_____|@@
@
.-----.@
|-- __|@
|_____|@
@@
___ @
| _|@
/ / @
\\ \\_ @
|___|@@
__ @
| |@
| |@
| |@
|__|@@
___ @
|_ | @
\\ \\@
_/ /@
|___| @@
___ @
| ' |@
|_,_| @
@
@@
.--.--.@
|-----|@
| - |@
|__|__|@
@@
.--.--.@
|-----|@
| _ |@
|_____|@
@@
.--.--.@
|--|--|@
| | |@
|_____|@
@@
.--.--.@
|---.-|@
| _ |@
|___._|@
@@
.--.--.@
|-----|@
| _ |@
|_____|@
@@
.--.--.@
|--|--|@
| | |@
|_____|@
@@
_______ @
| __ \\@
| __ <@
| |____/@
|__| @@
`
@@ -0,0 +1 @@
module.exports={A:{A:{"4":"_b","132":"_V"},B:{"4":"_J"},C:{"1":"_5J","8":"_KM"},D:{"4":"_7D","8":"J"},E:{"4":"_nB","8":"_k"},F:{"4":"_a","8":"_T"},G:{"4":"_t","8":"_d"},H:{"8":"1D"},I:{"4":"_8B","8":"_n"},J:{"4":"A","8":"D"},K:{"4":"H","8":"_D"},L:{"4":"I"},M:{"1":"YC"},N:{"132":"_A"},O:{"4":"bC"},P:{"4":"_F"},Q:{"4":"JE"},R:{"4":"KE"},S:{"1":"_C"}},B:1,C:"Ruby annotation",D:true};
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/compile/index.ts"],"names":[],"mappings":";;;AAUA,uCAAgF;AAChF,kEAAyD;AACzD,mCAAuB;AACvB,uCAAkG;AAClG,iCAA6D;AAC7D,yCAA+C;AA0D/C,MAAa,SAAS;IAkBpB,YAAY,GAAkB;;QATrB,SAAI,GAAe,EAAE,CAAA;QACrB,mBAAc,GAA6B,EAAE,CAAA;QASpD,IAAI,MAAmC,CAAA;QACvC,IAAI,OAAO,GAAG,CAAC,MAAM,IAAI,QAAQ;YAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA;QACtD,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA;QACxB,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAA;QAC5B,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,IAAI,CAAA;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAA,GAAG,CAAC,MAAM,mCAAI,IAAA,qBAAW,EAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAG,GAAG,CAAC,QAAQ,IAAI,KAAK,CAAC,CAAC,CAAA;QACxE,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAA;QAChC,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,CAAA;QAC9B,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,CAAA;QAC5B,IAAI,CAAC,IAAI,GAAG,EAAE,CAAA;IAChB,CAAC;CACF;AA/BD,8BA+BC;AAED,mBAAmB;AACnB,oBAAoB;AAEpB,+BAA+B;AAC/B,SAAgB,aAAa,CAAY,GAAc;IACrD,sCAAsC;IACtC,MAAM,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAC/C,IAAI,IAAI;QAAE,OAAO,IAAI,CAAA;IACrB,MAAM,MAAM,GAAG,IAAA,qBAAW,EAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA,CAAC,4CAA4C;IAC/G,MAAM,EAAC,GAAG,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAA;IACnC,MAAM,EAAC,aAAa,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;IACjC,MAAM,GAAG,GAAG,IAAI,iBAAO,CAAC,IAAI,CAAC,KAAK,EAAE,EAAC,GAAG,EAAE,KAAK,EAAE,aAAa,EAAC,CAAC,CAAA;IAChE,IAAI,gBAAgB,CAAA;IACpB,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QACf,gBAAgB,GAAG,GAAG,CAAC,UAAU,CAAC,OAAO,EAAE;YACzC,GAAG,EAAE,0BAAe;YACpB,IAAI,EAAE,IAAA,WAAC,EAAA,sDAAsD;SAC9D,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,YAAY,GAAG,GAAG,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;IAC9C,GAAG,CAAC,YAAY,GAAG,YAAY,CAAA;IAE/B,MAAM,SAAS,GAAc;QAC3B,GAAG;QACH,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS;QAC9B,IAAI,EAAE,eAAC,CAAC,IAAI;QACZ,UAAU,EAAE,eAAC,CAAC,UAAU;QACxB,kBAAkB,EAAE,eAAC,CAAC,kBAAkB;QACxC,SAAS,EAAE,CAAC,eAAC,CAAC,IAAI,CAAC;QACnB,WAAW,EAAE,CAAC,aAAG,CAAC,EAAE,8DAA8D;QAClF,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,EAAE;QACb,iBAAiB,EAAE,IAAI,GAAG,EAAU;QACpC,YAAY,EAAE,GAAG,CAAC,UAAU,CAC1B,QAAQ,EACR,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI;YAC5B,CAAC,CAAC,EAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAA,mBAAS,EAAC,GAAG,CAAC,MAAM,CAAC,EAAC;YAChD,CAAC,CAAC,EAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAC,CACtB;QACD,YAAY;QACZ,eAAe,EAAE,gBAAgB;QACjC,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,SAAS,EAAE,GAAG;QACd,MAAM;QACN,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,MAAM;QAC5B,UAAU,EAAE,aAAG;QACf,aAAa,EAAE,GAAG,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QAC3D,SAAS,EAAE,IAAA,WAAC,EAAA,IAAI;QAChB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,IAAI,EAAE,IAAI;KACX,CAAA;IAED,IAAI,UAA8B,CAAA;IAClC,IAAI,CAAC;QACH,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAC3B,IAAA,+BAAoB,EAAC,SAAS,CAAC,CAAA;QAC/B,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACrC,kBAAkB;QAClB,MAAM,YAAY,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAA;QACnC,UAAU,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,eAAC,CAAC,KAAK,CAAC,UAAU,YAAY,EAAE,CAAA;QAC9D,6EAA6E;QAC7E,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CAAA;QAChF,2CAA2C;QAC3C,MAAM,YAAY,GAAG,IAAI,QAAQ,CAAC,GAAG,eAAC,CAAC,IAAI,EAAE,EAAE,GAAG,eAAC,CAAC,KAAK,EAAE,EAAE,UAAU,CAAC,CAAA;QACxE,MAAM,QAAQ,GAAwB,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAA;QAC1E,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,EAAE,EAAC,GAAG,EAAE,QAAQ,EAAC,CAAC,CAAA;QAE/C,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAA;QACtB,QAAQ,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA;QAC5B,QAAQ,CAAC,SAAS,GAAG,GAAG,CAAA;QACxB,IAAI,GAAG,CAAC,MAAM;YAAG,QAAkC,CAAC,MAAM,GAAG,IAAI,CAAA;QACjE,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;YACnC,QAAQ,CAAC,MAAM,GAAG,EAAC,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,CAAC,OAAO,EAAC,CAAA;QAC1E,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YAC1B,MAAM,EAAC,KAAK,EAAE,KAAK,EAAC,GAAG,SAAS,CAAA;YAChC,QAAQ,CAAC,SAAS,GAAG;gBACnB,KAAK,EAAE,KAAK,YAAY,cAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK;gBAChD,KAAK,EAAE,KAAK,YAAY,cAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK;gBAChD,YAAY,EAAE,KAAK,YAAY,cAAI;gBACnC,YAAY,EAAE,KAAK,YAAY,cAAI;aACpC,CAAA;YACD,IAAI,QAAQ,CAAC,MAAM;gBAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,GAAG,IAAA,mBAAS,EAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;QAChF,CAAC;QACD,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACvB,OAAO,GAAG,CAAA;IACZ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,GAAG,CAAC,QAAQ,CAAA;QACnB,OAAO,GAAG,CAAC,YAAY,CAAA;QACvB,IAAI,UAAU;YAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wCAAwC,EAAE,UAAU,CAAC,CAAA;QACvF,sDAAsD;QACtD,MAAM,CAAC,CAAA;IACT,CAAC;YAAS,CAAC;QACT,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAChC,CAAC;AACH,CAAC;AA5FD,sCA4FC;AAED,SAAgB,UAAU,CAExB,IAAe,EACf,MAAc,EACd,GAAW;;IAEX,GAAG,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA;IACpD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAChC,IAAI,SAAS;QAAE,OAAO,SAAS,CAAA;IAE/B,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAA;IACxC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,MAAM,GAAG,MAAA,IAAI,CAAC,SAAS,0CAAG,GAAG,CAAC,Line truncated
@@ -0,0 +1,361 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// Generated file, do not edit! Run "yarn generate" to re-generate this file.
/* istanbul ignore file */
/**
* Enum of all token types, with bit fields to signify meaningful properties.
*/
var TokenType; (function (TokenType) {
// Precedence 0 means not an operator; otherwise it is a positive number up to 12.
const PRECEDENCE_MASK = 0xf; TokenType[TokenType["PRECEDENCE_MASK"] = PRECEDENCE_MASK] = "PRECEDENCE_MASK";
const IS_KEYWORD = 1 << 4; TokenType[TokenType["IS_KEYWORD"] = IS_KEYWORD] = "IS_KEYWORD";
const IS_ASSIGN = 1 << 5; TokenType[TokenType["IS_ASSIGN"] = IS_ASSIGN] = "IS_ASSIGN";
const IS_RIGHT_ASSOCIATIVE = 1 << 6; TokenType[TokenType["IS_RIGHT_ASSOCIATIVE"] = IS_RIGHT_ASSOCIATIVE] = "IS_RIGHT_ASSOCIATIVE";
const IS_PREFIX = 1 << 7; TokenType[TokenType["IS_PREFIX"] = IS_PREFIX] = "IS_PREFIX";
const IS_POSTFIX = 1 << 8; TokenType[TokenType["IS_POSTFIX"] = IS_POSTFIX] = "IS_POSTFIX";
const IS_EXPRESSION_START = 1 << 9; TokenType[TokenType["IS_EXPRESSION_START"] = IS_EXPRESSION_START] = "IS_EXPRESSION_START";
const num = 512; TokenType[TokenType["num"] = num] = "num"; // num startsExpr
const bigint = 1536; TokenType[TokenType["bigint"] = bigint] = "bigint"; // bigint startsExpr
const decimal = 2560; TokenType[TokenType["decimal"] = decimal] = "decimal"; // decimal startsExpr
const regexp = 3584; TokenType[TokenType["regexp"] = regexp] = "regexp"; // regexp startsExpr
const string = 4608; TokenType[TokenType["string"] = string] = "string"; // string startsExpr
const name = 5632; TokenType[TokenType["name"] = name] = "name"; // name startsExpr
const eof = 6144; TokenType[TokenType["eof"] = eof] = "eof"; // eof
const bracketL = 7680; TokenType[TokenType["bracketL"] = bracketL] = "bracketL"; // [ startsExpr
const bracketR = 8192; TokenType[TokenType["bracketR"] = bracketR] = "bracketR"; // ]
const braceL = 9728; TokenType[TokenType["braceL"] = braceL] = "braceL"; // { startsExpr
const braceBarL = 10752; TokenType[TokenType["braceBarL"] = braceBarL] = "braceBarL"; // {| startsExpr
const braceR = 11264; TokenType[TokenType["braceR"] = braceR] = "braceR"; // }
const braceBarR = 12288; TokenType[TokenType["braceBarR"] = braceBarR] = "braceBarR"; // |}
const parenL = 13824; TokenType[TokenType["parenL"] = parenL] = "parenL"; // ( startsExpr
const parenR = 14336; TokenType[TokenType["parenR"] = parenR] = "parenR"; // )
const comma = 15360; TokenType[TokenType["comma"] = comma] = "comma"; // ,
const semi = 16384; TokenType[TokenType["semi"] = semi] = "semi"; // ;
const colon = 17408; TokenType[TokenType["colon"] = colon] = "colon"; // :
const doubleColon = 18432; TokenType[TokenType["doubleColon"] = doubleColon] = "doubleColon"; // ::
const dot = 19456; TokenType[TokenType["dot"] = dot] = "dot"; // .
const question = 20480; TokenType[TokenType["question"] = question] = "question"; // ?
const questionDot = 21504; TokenType[TokenType["questionDot"] = questionDot] = "questionDot"; // ?.
const arrow = 22528; TokenType[TokenType["arrow"] = arrow] = "arrow"; // =>
const template = 23552; TokenType[TokenType["template"] = template] = "template"; // template
const ellipsis = 24576; TokenType[TokenType["ellipsis"] = ellipsis] = "ellipsis"; // ...
const backQuote = 25600; TokenType[TokenType["backQuote"] = backQuote] = "backQuote"; // `
const dollarBraceL = 27136; TokenType[TokenType["dollarBraceL"] = dollarBraceL] = "dollarBraceL"; // ${ startsExpr
const at = 27648; TokenType[TokenType["at"] = at] = "at"; // @
const hash = 29184; TokenType[TokenType["hash"] = hash] = "hash"; // # startsExpr
const eq = 29728; TokenType[TokenType["eq"] = eq] = "eq"; // = isAssign
const assign = 30752; TokenType[TokenType["assign"] = assign] = "assign"; // _= isAssign
const preIncDec = 32640; TokenType[TokenType["preIncDec"] = preIncDec] = "preIncDec"; // ++/-- prefix postfix startsExpr
const postIncDec = 33664; TokenType[TokenType["postIncDec"] = postIncDec] = "postIncDec"; // ++/-- prefix postfix startsExpr
const bang = 34432; TokenType[TokenType["bang"] = bang] = "bang"; // ! prefix startsExpr
const tilde = 35456; TokenType[TokenType["tilde"] = tilde] = "tilde"; // ~ prefix startsExpr
const pipeline = 35841; TokenType[TokenType["pipeline"] = pipeline] = "pipeline"; // |> prec:1
const nullishCoalescing = 36866; TokenType[TokenType["nullishCoalescing"] = nullishCoalescing] = "nullishCoalescing"; // ?? prec:2
const logicalOR = 37890; TokenType[TokenType["logicalOR"] = logicalOR] = "logicalOR"; // || prec:2
const logicalAND = 38915; TokenType[TokenType["logicalAND"] = logicalAND] = "logicalAND"; // && prec:3
const bitwiseOR = 39940; TokenType[TokenType["bitwiseOR"] = bitwiseOR] = "bitwiseOR"; // | prec:4
const bitwiseXOR = 40965; TokenType[TokenType["bitwiseXOR"] = bitwiseXOR] = "bitwiseXOR"; // ^ prec:5
const bitwiseAND = 41990; TokenType[TokenType["bitwiseAND"] = bitwiseAND] = "bitwiseAND"; // & prec:6
const equality = 43015; TokenType[TokenType["equality"] = equality] = "equality"; // ==/!= prec:7
const lessThan = 44040; TokenType[TokenType["lessThan"] = lessThan] = "lessThan"; // < prec:8
const greaterThan = 45064; TokenType[TokenType["greaterThan"] = greaterThan] = "greaterThan"; // > prec:8
const relationalOrEqual = 46088; TokenType[TokenType["relationalOrEqual"] = relationalOrEqual] = "relationalOrEqual"; // <=/>= prec:8
const bitShiftL = 47113; TokenType[TokenType["bitShiftL"] = bitShiftL] = "bitShiftL"; // << prec:9
const bitShiftR = 48137; TokenType[TokenType["bitShiftR"] = bitShiftR] = "bitShiftR"; // >>/>>> prec:9
const plus = 49802; TokenType[TokenType["plus"] = plus] = "plus"; // + prec:10 prefix startsExpr
const minus = 50826; TokenType[TokenType["minus"] = minus] = "minus"; // - prec:10 prefix startsExpr
const modulo = 51723; TokenType[TokenType["modulo"] = modulo] = "modulo"; // % prec:11 startsExpr
const star = 52235; TokenType[TokenType["star"] = star] = "star"; // * prec:11
const slash = 53259; TokenType[TokenType["slash"] = slash] = "slash"; // / prec:11
const exponent = 54348; TokenType[TokenType["exponent"] = exponent] = "exponent"; // ** prec:12 rightAssociative
const jsxName = 55296; TokenType[TokenType["jsxName"] = jsxName] = "jsxName"; // jsxName
const jsxText = 56320; TokenType[TokenType["jsxText"] = jsxText] = "jsxText"; // jsxText
const jsxEmptyText = 57344; TokenType[TokenType["jsxEmptyText"] = jsxEmptyText] = "jsxEmptyText"; // jsxEmptyText
const jsxTagStart = 58880; TokenType[TokenType["jsxTagStart"] = jsxTagStart] = "jsxTagStart"; // jsxTagStart startsExpr
const jsxTagEnd = 59392; TokenType[TokenType["jsxTagEnd"] = jsxTagEnd] = "jsxTagEnd"; // jsxTagEnd
const typeParameterStart = 60928; TokenType[TokenType["typeParameterStart"] = typeParameterStart] = "typeParameterStart"; // typeParameterStart startsExpr
const nonNullAssertion = 61440; TokenType[TokenType["nonNullAssertion"] = nonNullAssertion] = "nonNullAssertion"; // nonNullAssertion
const _break = 62480; TokenType[TokenType["_break"] = _break] = "_break"; // break keyword
const _case = 63504; TokenType[TokenType["_case"] = _case] = "_case"; // case keyword
const _catch = 64528; TokenType[TokenType["_catch"] = _catch] = "_catch"; // catch keyword
const _continue = 65552; TokenType[TokenType["_continue"] = _continue] = "_continue"; // continue keyword
const _debugger = 66576; TokenType[TokenType["_debugger"] = _debugger] = "_debugger"; // debugger keyword
const _default = 67600; TokenType[TokenType["_default"] = _default] = "_default"; // default keyword
const _do = 68624; TokenType[TokenType["_do"] = _do] = "_do"; // do keyword
const _else = 69648; TokenType[TokenType["_else"] = _else] = "_else"; // else keyword
const _finally = 70672; TokenType[TokenType["_finally"] = _finally] = "_finally"; // finally keyword
const _for = 71696; TokenType[TokenType["_for"] = _for] = "_for"; // for keyword
const _function = 73232; TokenType[TokenType["_function"] = _function] = "_function"; // function keyword startsExpr
const _if = 73744; TokenType[TokenType["_if"] = _if] = "_if"; // if keyword
const _return = 74768; TokenType[TokenType["_return"] = _return] = "_return"; // return keyword
const _switch = 75792; TokenType[TokenType["_switch"] = _switch] = "_switch"; // switch keyword
const _throw = 77456; TokenType[TokenType["_throw"] = _throw] = "_throw"; // throw keyword prefix startsExpr
const _try = 77840; TokenType[TokenType["_try"] = _try] = "_try"; // try keyword
const _var = 78864; TokenType[TokenType["_var"] = _var] = "_var"; // var keyword
const _let = 79888; TokenType[TokenType["_let"] = _let] = "_let"; // let keyword
const _const = 80912; TokenType[TokenType["_const"] = _const] = "_const"; // const keyword
const _while = 81936; TokenType[TokenType["_while"] = _while] = "_while"; // while keyword
const _with = 82960; TokenType[TokenType["_with"] = _with] = "_with"; // with keyword
const _new = 84496; TokenType[TokenType["_new"] = _new] = "_new"; // new keyword startsExpr
const _this = 85520; TokenType[TokenType["_this"] = _this] = "_this"; // this keyword startsExpr
const _super = 86544; TokenType[TokenType["_super"] = _super] = "_super"; // super keyword startsExpr
const _class = 87568; TokenType[TokenType["_class"] = _class] = "_class"; // class keyword startsExpr
const _extends = 88080; TokenType[TokenType["_extends"] = _extends] = "_extends"; // extends keyword
const _export = 89104; TokenType[TokenType["_export"] = _export] = "_export"; // export keyword
const _import = 90640; TokenType[TokenType["_import"] = _import] = "_import"; // import keyword startsExpr
const _yield = 91664; TokenType[TokenType["_yield"] = _yield] = "_yield"; // yield keyword startsExpr
const _null = 92688; TokenType[TokenType["_null"] = _null] = "_null"; // null keyword startsExpr
const _true = 93712; TokenType[TokenType["_true"] = _true] = "_true"; // true keyword startsExpr
const _false = 94736; TokenType[TokenType["_false"] = _false] = "_false"; // false keyword startsExpr
const _in = 95256; TokenType[TokenType["_in"] = _in] = "_in"; // in prec:8 keyword
const _instanceof = 96280; TokenType[TokenType["_instanceof"] = _instanceof] = "_instanceof"; // instanceof prec:8 keyword
const _typeof = 97936; TokenType[TokenType["_typeof"] = _typeof] = "_typeof"; // typeof keyword prefix startsExpr
const _void = 98960; TokenType[TokenType["_void"] = _void] = "_void"; // void keyword prefix startsExpr
const _delete = 99984; TokenType[TokenType["_delete"] = _delete] = "_delete"; // delete keyword prefix startsExpr
const _async = 100880; TokenType[TokenType["_async"] = _async] = "_async"; // async keyword startsExpr
const _get = 101904; TokenType[TokenType["_get"] = _get] = "_get"; // get keyword startsExpr
const _set = 102928; TokenType[TokenType["_set"] = _set] = "_set"; // set keyword startsExpr
const _declare = 103952; TokenType[TokenType["_declare"] = _declare] = "_declare"; // declare keyword startsExpr
const _readonly = 104976; TokenType[TokenType["_readonly"] = _readonly] = "_readonly"; // readonly keyword startsExpr
const _abstract = 106000; TokenType[TokenType["_abstract"] = _abstract] = "_abstract"; // abstract keyword startsExpr
const _static = 107024; TokenType[TokenType["_static"] = _static] = "_static"; // static keyword startsExpr
const _public = 107536; TokenType[TokenType["_public"] = _public] = "_public"; // public keyword
const _private = 108560; TokenType[TokenType["_private"] = _private] = "_private"; // private keyword
const _protected = 109584; TokenType[TokenType["_protected"] = _protected] = "_protected"; // protected keyword
const _override = 110608; TokenType[TokenType["_override"] = _override] = "_override"; // override keyword
const _as = 112144; TokenType[TokenType["_as"] = _as] = "_as"; // as keyword startsExpr
const _enum = 113168; TokenType[TokenType["_enum"] = _enum] = "_enum"; // enum keyword startsExpr
const _type = 114192; TokenType[TokenType["_type"] = _type] = "_type"; // type keyword startsExpr
const _implements = 115216; TokenType[TokenType["_implements"] = _implements] = "_implements"; // implements keyword startsExpr
})(TokenType || (exports.TokenType = TokenType = {}));
function formatTokenType(tokenType) {
switch (tokenType) {
case TokenType.num:
return "num";
case TokenType.bigint:
return "bigint";
case TokenType.decimal:
return "decimal";
case TokenType.regexp:
return "regexp";
case TokenType.string:
return "string";
case TokenType.name:
return "name";
case TokenType.eof:
return "eof";
case TokenType.bracketL:
return "[";
case TokenType.bracketR:
return "]";
case TokenType.braceL:
return "{";
case TokenType.braceBarL:
return "{|";
case TokenType.braceR:
return "}";
case TokenType.braceBarR:
return "|}";
case TokenType.parenL:
return "(";
case TokenType.parenR:
return ")";
case TokenType.comma:
return ",";
case TokenType.semi:
return ";";
case TokenType.colon:
return ":";
case TokenType.doubleColon:
return "::";
case TokenType.dot:
return ".";
case TokenType.question:
return "?";
case TokenType.questionDot:
return "?.";
case TokenType.arrow:
return "=>";
case TokenType.template:
return "template";
case TokenType.ellipsis:
return "...";
case TokenType.backQuote:
return "`";
case TokenType.dollarBraceL:
return "${";
case TokenType.at:
return "@";
case TokenType.hash:
return "#";
case TokenType.eq:
return "=";
case TokenType.assign:
return "_=";
case TokenType.preIncDec:
return "++/--";
case TokenType.postIncDec:
return "++/--";
case TokenType.bang:
return "!";
case TokenType.tilde:
return "~";
case TokenType.pipeline:
return "|>";
case TokenType.nullishCoalescing:
return "??";
case TokenType.logicalOR:
return "||";
case TokenType.logicalAND:
return "&&";
case TokenType.bitwiseOR:
return "|";
case TokenType.bitwiseXOR:
return "^";
case TokenType.bitwiseAND:
return "&";
case TokenType.equality:
return "==/!=";
case TokenType.lessThan:
return "<";
case TokenType.greaterThan:
return ">";
case TokenType.relationalOrEqual:
return "<=/>=";
case TokenType.bitShiftL:
return "<<";
case TokenType.bitShiftR:
return ">>/>>>";
case TokenType.plus:
return "+";
case TokenType.minus:
return "-";
case TokenType.modulo:
return "%";
case TokenType.star:
return "*";
case TokenType.slash:
return "/";
case TokenType.exponent:
return "**";
case TokenType.jsxName:
return "jsxName";
case TokenType.jsxText:
return "jsxText";
case TokenType.jsxEmptyText:
return "jsxEmptyText";
case TokenType.jsxTagStart:
return "jsxTagStart";
case TokenType.jsxTagEnd:
return "jsxTagEnd";
case TokenType.typeParameterStart:
return "typeParameterStart";
case TokenType.nonNullAssertion:
return "nonNullAssertion";
case TokenType._break:
return "break";
case TokenType._case:
return "case";
case TokenType._catch:
return "catch";
case TokenType._continue:
return "continue";
case TokenType._debugger:
return "debugger";
case TokenType._default:
return "default";
case TokenType._do:
return "do";
case TokenType._else:
return "else";
case TokenType._finally:
return "finally";
case TokenType._for:
return "for";
case TokenType._function:
return "function";
case TokenType._if:
return "if";
case TokenType._return:
return "return";
case TokenType._switch:
return "switch";
case TokenType._throw:
return "throw";
case TokenType._try:
return "try";
case TokenType._var:
return "var";
case TokenType._let:
return "let";
case TokenType._const:
return "const";
case TokenType._while:
return "while";
case TokenType._with:
return "with";
case TokenType._new:
return "new";
case TokenType._this:
return "this";
case TokenType._super:
return "super";
case TokenType._class:
return "class";
case TokenType._extends:
return "extends";
case TokenType._export:
return "export";
case TokenType._import:
return "import";
case TokenType._yield:
return "yield";
case TokenType._null:
return "null";
case TokenType._true:
return "true";
case TokenType._false:
return "false";
case TokenType._in:
return "in";
case TokenType._instanceof:
return "instanceof";
case TokenType._typeof:
return "typeof";
case TokenType._void:
return "void";
case TokenType._delete:
return "delete";
case TokenType._async:
return "async";
case TokenType._get:
return "get";
case TokenType._set:
return "set";
case TokenType._declare:
return "declare";
case TokenType._readonly:
return "readonly";
case TokenType._abstract:
return "abstract";
case TokenType._static:
return "static";
case TokenType._public:
return "public";
case TokenType._private:
return "private";
case TokenType._protected:
return "protected";
case TokenType._override:
return "override";
case TokenType._as:
return "as";
case TokenType._enum:
return "enum";
case TokenType._type:
return "type";
case TokenType._implements:
return "implements";
default:
return "";
}
} exports.formatTokenType = formatTokenType;
@@ -0,0 +1,559 @@
(function (global, factory) {
if (typeof exports === 'object' && typeof module !== 'undefined') {
factory(module, require('@jridgewell/resolve-uri'), require('@jridgewell/sourcemap-codec'));
module.exports = def(module);
} else if (typeof define === 'function' && define.amd) {
define(['module', '@jridgewell/resolve-uri', '@jridgewell/sourcemap-codec'], function(mod) {
factory.apply(this, arguments);
mod.exports = def(mod);
});
} else {
const mod = { exports: {} };
factory(mod, global.resolveURI, global.sourcemapCodec);
global = typeof globalThis !== 'undefined' ? globalThis : global || self;
global.traceMapping = def(mod);
}
function def(m) { return 'default' in m.exports ? m.exports.default : m.exports; }
})(this, (function (module, require_resolveURI, require_sourcemapCodec) {
"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 __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
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);
// umd:@jridgewell/sourcemap-codec
var require_sourcemap_codec = __commonJS({
"umd:@jridgewell/sourcemap-codec"(exports, module2) {
module2.exports = require_sourcemapCodec;
}
});
// umd:@jridgewell/resolve-uri
var require_resolve_uri = __commonJS({
"umd:@jridgewell/resolve-uri"(exports, module2) {
module2.exports = require_resolveURI;
}
});
// src/trace-mapping.ts
var trace_mapping_exports = {};
__export(trace_mapping_exports, {
AnyMap: () => FlattenMap,
FlattenMap: () => FlattenMap,
GREATEST_LOWER_BOUND: () => GREATEST_LOWER_BOUND,
LEAST_UPPER_BOUND: () => LEAST_UPPER_BOUND,
TraceMap: () => TraceMap,
allGeneratedPositionsFor: () => allGeneratedPositionsFor,
decodedMap: () => decodedMap,
decodedMappings: () => decodedMappings,
eachMapping: () => eachMapping,
encodedMap: () => encodedMap,
encodedMappings: () => encodedMappings,
generatedPositionFor: () => generatedPositionFor,
isIgnored: () => isIgnored,
originalPositionFor: () => originalPositionFor,
presortedDecodedMap: () => presortedDecodedMap,
sourceContentFor: () => sourceContentFor,
traceSegment: () => traceSegment
});
module.exports = __toCommonJS(trace_mapping_exports);
var import_sourcemap_codec = __toESM(require_sourcemap_codec());
// src/resolve.ts
var import_resolve_uri = __toESM(require_resolve_uri());
// src/strip-filename.ts
function stripFilename(path) {
if (!path) return "";
const index = path.lastIndexOf("/");
return path.slice(0, index + 1);
}
// src/resolve.ts
function resolver(mapUrl, sourceRoot) {
const from = stripFilename(mapUrl);
const prefix = sourceRoot ? sourceRoot + "/" : "";
return (source) => (0, import_resolve_uri.default)(prefix + (source || ""), from);
}
// src/sourcemap-segment.ts
var COLUMN = 0;
var SOURCES_INDEX = 1;
var SOURCE_LINE = 2;
var SOURCE_COLUMN = 3;
var NAMES_INDEX = 4;
var REV_GENERATED_LINE = 1;
var REV_GENERATED_COLUMN = 2;
// src/sort.ts
function maybeSort(mappings, owned) {
const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
if (unsortedIndex === mappings.length) return mappings;
if (!owned) mappings = mappings.slice();
for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) {
mappings[i] = sortSegments(mappings[i], owned);
}
return mappings;
}
function nextUnsortedSegmentLine(mappings, start) {
for (let i = start; i < mappings.length; i++) {
if (!isSorted(mappings[i])) return i;
}
return mappings.length;
}
function isSorted(line) {
for (let j = 1; j < line.length; j++) {
if (line[j][COLUMN] < line[j - 1][COLUMN]) {
return false;
}
}
return true;
}
function sortSegments(line, owned) {
if (!owned) line = line.slice();
return line.sort(sortComparator);
}
function sortComparator(a, b) {
return a[COLUMN] - b[COLUMN];
}
// src/by-source.ts
function buildBySources(decoded, memos) {
const sources = memos.map(() => []);
for (let i = 0; i < decoded.length; i++) {
const line = decoded[i];
for (let j = 0; j < line.length; j++) {
const seg = line[j];
if (seg.length === 1) continue;
const sourceIndex2 = seg[SOURCES_INDEX];
const sourceLine = seg[SOURCE_LINE];
const sourceColumn = seg[SOURCE_COLUMN];
const source = sources[sourceIndex2];
const segs = source[sourceLine] || (source[sourceLine] = []);
segs.push([sourceColumn, i, seg[COLUMN]]);
}
}
for (let i = 0; i < sources.length; i++) {
const source = sources[i];
for (let j = 0; j < source.length; j++) {
const line = source[j];
if (line) line.sort(sortComparator);
}
}
return sources;
}
// src/binary-search.ts
var found = false;
function binarySearch(haystack, needle, low, high) {
while (low <= high) {
const mid = low + (high - low >> 1);
const cmp = haystack[mid][COLUMN] - needle;
if (cmp === 0) {
found = true;
return mid;
}
if (cmp < 0) {
low = mid + 1;
} else {
high = mid - 1;
}
}
found = false;
return low - 1;
}
function upperBound(haystack, needle, index) {
for (let i = index + 1; i < haystack.length; index = i++) {
if (haystack[i][COLUMN] !== needle) break;
}
return index;
}
function lowerBound(haystack, needle, index) {
for (let i = index - 1; i >= 0; index = i--) {
if (haystack[i][COLUMN] !== needle) break;
}
return index;
}
function memoizedState() {
return {
lastKey: -1,
lastNeedle: -1,
lastIndex: -1
};
}
function memoizedBinarySearch(haystack, needle, state, key) {
const { lastKey, lastNeedle, lastIndex } = state;
let low = 0;
let high = haystack.length - 1;
if (key === lastKey) {
if (needle === lastNeedle) {
found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
return lastIndex;
}
if (needle >= lastNeedle) {
low = lastIndex === -1 ? 0 : lastIndex;
} else {
high = lastIndex;
}
}
state.lastKey = key;
state.lastNeedle = needle;
return state.lastIndex = binarySearch(haystack, needle, low, high);
}
// src/types.ts
function parse(map) {
return typeof map === "string" ? JSON.parse(map) : map;
}
// src/flatten-map.ts
var FlattenMap = function(map, mapUrl) {
const parsed = parse(map);
if (!("sections" in parsed)) {
return new TraceMap(parsed, mapUrl);
}
const mappings = [];
const sources = [];
const sourcesContent = [];
const names = [];
const ignoreList = [];
recurse(
parsed,
mapUrl,
mappings,
sources,
sourcesContent,
names,
ignoreList,
0,
0,
Infinity,
Infinity
);
const joined = {
version: 3,
file: parsed.file,
names,
sources,
sourcesContent,
mappings,
ignoreList
};
return presortedDecodedMap(joined);
};
function recurse(input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {
const { sections } = input;
for (let i = 0; i < sections.length; i++) {
const { map, offset } = sections[i];
let sl = stopLine;
let sc = stopColumn;
if (i + 1 < sections.length) {
const nextOffset = sections[i + 1].offset;
sl = Math.min(stopLine, lineOffset + nextOffset.line);
if (sl === stopLine) {
sc = Math.min(stopColumn, columnOffset + nextOffset.column);
} else if (sl < stopLine) {
sc = columnOffset + nextOffset.column;
}
}
addSection(
map,
mapUrl,
mappings,
sources,
sourcesContent,
names,
ignoreList,
lineOffset + offset.line,
columnOffset + offset.column,
sl,
sc
);
}
}
function addSection(input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {
const parsed = parse(input);
if ("sections" in parsed) return recurse(...arguments);
const map = new TraceMap(parsed, mapUrl);
const sourcesOffset = sources.length;
const namesOffset = names.length;
const decoded = decodedMappings(map);
const { resolvedSources, sourcesContent: contents, ignoreList: ignores } = map;
append(sources, resolvedSources);
append(names, map.names);
if (contents) append(sourcesContent, contents);
else for (let i = 0; i < resolvedSources.length; i++) sourcesContent.push(null);
if (ignores) for (let i = 0; i < ignores.length; i++) ignoreList.push(ignores[i] + sourcesOffset);
for (let i = 0; i < decoded.length; i++) {
const lineI = lineOffset + i;
if (lineI > stopLine) return;
const out = getLine(mappings, lineI);
const cOffset = i === 0 ? columnOffset : 0;
const line = decoded[i];
for (let j = 0; j < line.length; j++) {
const seg = line[j];
const column = cOffset + seg[COLUMN];
if (lineI === stopLine && column >= stopColumn) return;
if (seg.length === 1) {
out.push([column]);
continue;
}
const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX];
const sourceLine = seg[SOURCE_LINE];
const sourceColumn = seg[SOURCE_COLUMN];
out.push(
seg.length === 4 ? [column, sourcesIndex, sourceLine, sourceColumn] : [column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]]
);
}
}
}
function append(arr, other) {
for (let i = 0; i < other.length; i++) arr.push(other[i]);
}
function getLine(arr, index) {
for (let i = arr.length; i <= index; i++) arr[i] = [];
return arr[index];
}
// src/trace-mapping.ts
var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)";
var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)";
var LEAST_UPPER_BOUND = -1;
var GREATEST_LOWER_BOUND = 1;
var TraceMap = class {
constructor(map, mapUrl) {
const isString = typeof map === "string";
if (!isString && map._decodedMemo) return map;
const parsed = parse(map);
const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
this.version = version;
this.file = file;
this.names = names || [];
this.sourceRoot = sourceRoot;
this.sources = sources;
this.sourcesContent = sourcesContent;
this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
const resolve = resolver(mapUrl, sourceRoot);
this.resolvedSources = sources.map(resolve);
const { mappings } = parsed;
if (typeof mappings === "string") {
this._encoded = mappings;
this._decoded = void 0;
} else if (Array.isArray(mappings)) {
this._encoded = void 0;
this._decoded = maybeSort(mappings, isString);
} else if (parsed.sections) {
throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);
} else {
throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
}
this._decodedMemo = memoizedState();
this._bySources = void 0;
this._bySourceMemos = void 0;
}
};
function cast(map) {
return map;
}
function encodedMappings(map) {
var _a, _b;
return (_b = (_a = cast(map))._encoded) != null ? _b : _a._encoded = (0, import_sourcemap_codec.encode)(cast(map)._decoded);
}
function decodedMappings(map) {
var _a;
return (_a = cast(map))._decoded || (_a._decoded = (0, import_sourcemap_codec.decode)(cast(map)._encoded));
}
function traceSegment(map, line, column) {
const decoded = decodedMappings(map);
if (line >= decoded.length) return null;
const segments = decoded[line];
const index = traceSegmentInternal(
segments,
cast(map)._decodedMemo,
line,
column,
GREATEST_LOWER_BOUND
);
return index === -1 ? null : segments[index];
}
function originalPositionFor(map, needle) {
let { line, column, bias } = needle;
line--;
if (line < 0) throw new Error(LINE_GTR_ZERO);
if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
const decoded = decodedMappings(map);
if (line >= decoded.length) return OMapping(null, null, null, null);
const segments = decoded[line];
const index = traceSegmentInternal(
segments,
cast(map)._decodedMemo,
line,
column,
bias || GREATEST_LOWER_BOUND
);
if (index === -1) return OMapping(null, null, null, null);
const segment = segments[index];
if (segment.length === 1) return OMapping(null, null, null, null);
const { names, resolvedSources } = map;
return OMapping(
resolvedSources[segment[SOURCES_INDEX]],
segment[SOURCE_LINE] + 1,
segment[SOURCE_COLUMN],
segment.length === 5 ? names[segment[NAMES_INDEX]] : null
);
}
function generatedPositionFor(map, needle) {
const { source, line, column, bias } = needle;
return generatedPosition(map, source, line, column, bias || GREATEST_LOWER_BOUND, false);
}
function allGeneratedPositionsFor(map, needle) {
const { source, line, column, bias } = needle;
return generatedPosition(map, source, line, column, bias || LEAST_UPPER_BOUND, true);
}
function eachMapping(map, cb) {
const decoded = decodedMappings(map);
const { names, resolvedSources } = map;
for (let i = 0; i < decoded.length; i++) {
const line = decoded[i];
for (let j = 0; j < line.length; j++) {
const seg = line[j];
const generatedLine = i + 1;
const generatedColumn = seg[0];
let source = null;
let originalLine = null;
let originalColumn = null;
let name = null;
if (seg.length !== 1) {
source = resolvedSources[seg[1]];
originalLine = seg[2] + 1;
originalColumn = seg[3];
}
if (seg.length === 5) name = names[seg[4]];
cb({
generatedLine,
generatedColumn,
source,
originalLine,
originalColumn,
name
});
}
}
}
function sourceIndex(map, source) {
const { sources, resolvedSources } = map;
let index = sources.indexOf(source);
if (index === -1) index = resolvedSources.indexOf(source);
return index;
}
function sourceContentFor(map, source) {
const { sourcesContent } = map;
if (sourcesContent == null) return null;
const index = sourceIndex(map, source);
return index === -1 ? null : sourcesContent[index];
}
function isIgnored(map, source) {
const { ignoreList } = map;
if (ignoreList == null) return false;
const index = sourceIndex(map, source);
return index === -1 ? false : ignoreList.includes(index);
}
function presortedDecodedMap(map, mapUrl) {
const tracer = new TraceMap(clone(map, []), mapUrl);
cast(tracer)._decoded = map.mappings;
return tracer;
}
function decodedMap(map) {
return clone(map, decodedMappings(map));
}
function encodedMap(map) {
return clone(map, encodedMappings(map));
}
function clone(map, mappings) {
return {
version: map.version,
file: map.file,
names: map.names,
sourceRoot: map.sourceRoot,
sources: map.sources,
sourcesContent: map.sourcesContent,
mappings,
ignoreList: map.ignoreList || map.x_google_ignoreList
};
}
function OMapping(source, line, column, name) {
return { source, line, column, name };
}
function GMapping(line, column) {
return { line, column };
}
function traceSegmentInternal(segments, memo, line, column, bias) {
let index = memoizedBinarySearch(segments, column, memo, line);
if (found) {
index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);
} else if (bias === LEAST_UPPER_BOUND) index++;
if (index === -1 || index === segments.length) return -1;
return index;
}
function sliceGeneratedPositions(segments, memo, line, column, bias) {
let min = traceSegmentInternal(segments, memo, line, column, GREATEST_LOWER_BOUND);
if (!found && bias === LEAST_UPPER_BOUND) min++;
if (min === -1 || min === segments.length) return [];
const matchedColumn = found ? column : segments[min][COLUMN];
if (!found) min = lowerBound(segments, matchedColumn, min);
const max = upperBound(segments, matchedColumn, min);
const result = [];
for (; min <= max; min++) {
const segment = segments[min];
result.push(GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]));
}
return result;
}
function generatedPosition(map, source, line, column, bias, all) {
var _a, _b;
line--;
if (line < 0) throw new Error(LINE_GTR_ZERO);
if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
const { sources, resolvedSources } = map;
let sourceIndex2 = sources.indexOf(source);
if (sourceIndex2 === -1) sourceIndex2 = resolvedSources.indexOf(source);
if (sourceIndex2 === -1) return all ? [] : GMapping(null, null);
const bySourceMemos = (_a = cast(map))._bySourceMemos || (_a._bySourceMemos = sources.map(memoizedState));
const generated = (_b = cast(map))._bySources || (_b._bySources = buildBySources(decodedMappings(map), bySourceMemos));
const segments = generated[sourceIndex2][line];
if (segments == null) return all ? [] : GMapping(null, null);
const memo = bySourceMemos[sourceIndex2];
if (all) return sliceGeneratedPositions(segments, memo, line, column, bias);
const index = traceSegmentInternal(segments, memo, line, column, bias);
if (index === -1) return GMapping(null, null);
const segment = segments[index];
return GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]);
}
}));
//# sourceMappingURL=trace-mapping.umd.js.map
@@ -0,0 +1,4 @@
'use strict';
/** @type {import('./type')} */
module.exports = TypeError;
@@ -0,0 +1,7 @@
import { AnyRouter } from './router.cjs';
declare global {
interface Window {
__TSR_ROUTER__?: AnyRouter;
}
}
export {};
@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ParserOptionsKeys = void 0;
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @format
*/
const ParserOptionsKeys = new Set(['allowReturnOutsideFunction', 'babel', 'flow', 'enableExperimentalComponentSyntax', 'reactRuntimeTarget', 'sourceFilename', 'sourceType', 'tokens']);
exports.ParserOptionsKeys = ParserOptionsKeys;
@@ -0,0 +1 @@
{"version":3,"file":"units.mjs","sources":["../../../../../src/value/types/numbers/units.ts"],"sourcesContent":["import { AnyResolvedKeyframe } from \"../../../animation/types\"\n\n/*#__NO_SIDE_EFFECTS__*/\nconst createUnitType = (unit: string) => ({\n test: (v: AnyResolvedKeyframe) =>\n typeof v === \"string\" && v.endsWith(unit) && v.split(\" \").length === 1,\n parse: parseFloat,\n transform: (v: number | string) => `${v}${unit}`,\n})\n\nexport const degrees = /*@__PURE__*/ createUnitType(\"deg\")\nexport const percent = /*@__PURE__*/ createUnitType(\"%\")\nexport const px = /*@__PURE__*/ createUnitType(\"px\")\nexport const vh = /*@__PURE__*/ createUnitType(\"vh\")\nexport const vw = /*@__PURE__*/ createUnitType(\"vw\")\n\nexport const progressPercentage = /*@__PURE__*/ (() => ({\n ...percent,\n parse: (v: string) => percent.parse(v) / 100,\n transform: (v: number) => percent.transform(v * 100),\n}))()\n"],"names":[],"mappings":"AAEA;AACA,MAAM,cAAc,GAAG,CAAC,IAAY,MAAM;IACtC,IAAI,EAAE,CAAC,CAAsB,KACzB,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC;AAC1E,IAAA,KAAK,EAAE,UAAU;IACjB,SAAS,EAAE,CAAC,CAAkB,KAAK,CAAA,EAAG,CAAC,CAAA,EAAG,IAAI,CAAA,CAAE;AACnD,CAAA,CAAC;AAEK,MAAM,OAAO,iBAAiB,cAAc,CAAC,KAAK;AAClD,MAAM,OAAO,iBAAiB,cAAc,CAAC,GAAG;AAChD,MAAM,EAAE,iBAAiB,cAAc,CAAC,IAAI;AAC5C,MAAM,EAAE,iBAAiB,cAAc,CAAC,IAAI;AAC5C,MAAM,EAAE,iBAAiB,cAAc,CAAC,IAAI;AAE5C,MAAM,kBAAkB,iBAAiB,CAAC,OAAO;AACpD,IAAA,GAAG,OAAO;AACV,IAAA,KAAK,EAAE,CAAC,CAAS,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG;AAC5C,IAAA,SAAS,EAAE,CAAC,CAAS,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,GAAG,CAAC;CACvD,CAAC;;;;"}
@@ -0,0 +1 @@
"use strict";"function"==typeof SuppressedError&&SuppressedError;const n=(n,a)=>{if(n===a)return 0;const[e=0,u=0]=n.split(".",2).map(Number),[s=0,o=0]=a.split(".",2).map(Number);if(isNaN(e)||isNaN(u))throw new Error(`Invalid version: ${n}`);if(isNaN(s)||isNaN(o))throw new Error(`Invalid version: ${a}`);return e!==s?e>s?1:-1:u!==o?u>o?1:-1:0},a={c:{longName:"chrome"},ca:{longName:"chrome_android"},e:{longName:"edge"},f:{longName:"firefox"},fa:{longName:"firefox_android"},s:{longName:"safari"},si:{longName:"safari_ios"},o:{longName:"opera",engine:"Blink"},oa:{longName:"opera_android",engine:"Blink"},sa:{longName:"samsunginternet_android",engine:"Blink"},wva:{longName:"webview_android",engine:"Blink"},y:{longName:"ya_android",engine:"Blink"},u:{longName:"uc_android",engine:"Blink"},q:{longName:"qq_android",engine:"Blink"},k:{longName:"kai_os",engine:"Gecko"},fb:{longName:"facebook_android",engine:"Blink"},ia:{longName:"instagram_android",engine:"Blink"}},e=n=>6===n.length&&/^\d{6}$/.test(n)?`20${n.slice(0,2)}-${n.slice(2,4)}-${n.slice(4,6)}`:8===n.length&&/^\d{8}$/.test(n)?`${n.slice(0,4)}-${n.slice(4,6)}-${n.slice(6,8)}`:n,u={},s={};let o="",f=!1;"pre_baseline\nc,1,081211\nc,2,090521\nc,3,090915\nc,4,100125\nc,5,100525\nc,6,100902\nc,7,101019\nc,8,101202\nc,9,110203\nc,10,110308\nc,11,110427\nc,12,110607\nc,13,110802\nc,14,110916\nc,15,111025\nc,16,111213\nc,17,120208\nc,18,120328\nc,19,120515\nc,20,120626\nc,21,120731\nc,22,120925\nc,23,121106\nc,24,130110\nc,25,130221\nc,26,130326\nc,27,130521\nc,28,130709\nc,29,130820\nc,30,131001\nc,31,131112\nc,32,140114\nc,33,140220\nc,34,140408\nc,35,140520\nc,36,140716\nc,37,140826\nc,38,141007\nc,39,141118\nc,40,150121\nc,41,150303\nc,42,150414\nc,43,150519\nc,44,150721\nca,18,120627\nca,25,130227\nca,26,130403\nca,27,130522\nca,28,130710\nca,29,130821\nca,30,131002\nca,31,131114\nca,32,140115\nca,33,140226\nca,34,140402\nca,35,140520\nca,36,140716\nca,37,140903\nca,38,141008\nca,39,141112\nca,40,150121\nca,41,150311\nca,42,150415\nca,43,150527\nf,1,041109\nf,1.5,051129\nf,2,061024\nf,3,080617\nf,3.5,090630\nf,3.6,100121\nf,4,110322\nf,5,110621\nf,6,110816\nf,7,110927\nf,8,111108\nf,9,111220\nf,10,120131\nf,11,120313\nf,12,120424\nf,13,120605\nf,14,120717\nf,15,120828\nf,16,121009\nf,17,121120\nf,18,130108\nf,19,130219\nf,20,130402\nf,21,130514\nf,22,130625\nf,23,130806\nf,24,130917\nf,25,131029\nf,26,131210\nf,27,140204\nf,28,140318\nf,29,140429\nf,30,140610\nf,31,140722\nf,32,140902\nf,33,141014\nf,34,141201\nf,35,150113\nf,36,150224\nf,37,150331\nf,38,150512\nf,39,150702\nfa,4,110329\nfa,5,110621\nfa,6,110816\nfa,7,110927\nfa,8,111108\nfa,9,111221\nfa,10,120131\nfa,14,120626\nfa,15,120828\nfa,16,121009\nfa,17,121120\nfa,18,130108\nfa,19,130219\nfa,20,130402\nfa,21,130514\nfa,22,130625\nfa,23,130806\nfa,24,130917\nfa,25,131029\nfa,26,131210\nfa,27,140204\nfa,28,140318\nfa,29,140429\nfa,30,140610\nfa,31,140722\nfa,32,140902\nfa,33,141014\nfa,34,141201\nfa,35,150113\nfa,36,150227\nfa,37,150331\nfa,38,150512\nfa,39,150702\ns,1,030623\ns,1.1,031024\ns,1.2,040202\ns,1.3,050415\ns,2,050429\ns,3,071026\ns,3.1,080318\ns,4,090608\ns,5,100607\ns,5.1,110720\ns,6,120725\ns,7,131022\ns,8,141016\nsi,1,070629\nsi,2,080711\nsi,3,090617\nsi,3.2,100403\nsi,4,100621\nsi,4.2,101122\nsi,5,111012\nsi,6,120910\nsi,7,130918\nsi,8,140917\n20150729\nc,38,141007\nca,38,141008\ne,12,150729\nf,38,150512\nfa,38,150512\ns,11,170919\nsi,11,170919\no,25,141015,38\noa,25,141016,38\nsa,3.0,150410,38\nwva,38,141008,38\ny,14.12,u,38\nu,11.1,u,40\nq,8.1,u,57\nk,2.0,170701,48\nfb,66,u,48\nia,23,u,62\n20150922\nf,41,150922\nfa,41,150922\n20150930\nc,44,150721\nca,44,150729\no,31,150804,44\noa,32,150923,45\nsa,4.0,160311,44\nwva,44,150729,44\ny,15.9,u,44\nu,11.6,u,57\n20151112\ne,13,151112\n20151231\nc,44,150721\nca,44,150729\ne,13,151112\nf,41,150922\nfa,41,150922\ns,11,170919\nsi,11,170919\no,31,150804,44\noa,32,150923,45\nsa,4.0,160311,44\nwva,44,150729,44\ny,15.9,u,44\nu,11.6,u,57\nq,8.1,u,57\nk,2.0,170701,48\nfb,66,u,48\nia,23,u,62\n20160308\nf,45,160308\nfa,45,160308\n20160607\nf,47,160607\nfa,47,160607\n20160802\ne,14,160802\n20160907\nc,53,160831\nca,53,160907\no,40,160920,53\noa,41,161025,54\nsa,6.0,170823,56\nwva,53,160907,53\ny,16.10,u,53\nfb,95,u,53\n20160920\nf,49,160920\nfa,49,160920\nk,3.0,210901,84\n20161231\nc,53,160831\nca,53,160907\ne,14,160802\nf,49,160920\nfa,49,160920\ns,11,170919\nsi,11,170919\no,40,160920,53\noa,41,161025,54\nsa,6.0,170823,56\nwva,53,160907,53\ny,16.10,u,53\nu,11.6,u,57\nq,8.1,u,57\nk,3.0,210901,84\nfb,95,u,53\nia,23,u,62\n20170201\nc,56,170125\nca,56,170201\nf,50,161115\nfa,50,161115\no,43,170207,56\noa,43,170927,59\nwva,56,170201,56\ny,17.3,u,56\nfb,112,u,56\n20170307\nf,52,170307\nfa,52,170307\n20170316\nca,57,170316\n20170405\nc,57,170309\ne,15,170405\no,44,170321,57\nsa,7.0,180316,59\nwva,57,170316,57\ny,17.4,u,57\nfb,117,u,57\n20170419\nf,53,170419\nfa,53,170419\n20170928\nfa,56,170928\n20171017\ne,16,171017\n20171024\nc,62,171017\nca,62,171024\no,49,171108,Line truncated
@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _readOnlyError;
function _readOnlyError(name) {
throw new TypeError('"' + name + '" is read-only');
}
//# sourceMappingURL=readOnlyError.js.map
@@ -0,0 +1,188 @@
"use strict";
/**
* Experimental client task features for MCP SDK.
* WARNING: These APIs are experimental and may change without notice.
*
* @experimental
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExperimentalClientTasks = void 0;
const types_js_1 = require("../../types.js");
/**
* Experimental task features for MCP clients.
*
* Access via `client.experimental.tasks`:
* ```typescript
* const stream = client.experimental.tasks.callToolStream({ name: 'tool', arguments: {} });
* const task = await client.experimental.tasks.getTask(taskId);
* ```
*
* @experimental
*/
class ExperimentalClientTasks {
constructor(_client) {
this._client = _client;
}
/**
* Calls a tool and returns an AsyncGenerator that yields response messages.
* The generator is guaranteed to end with either a 'result' or 'error' message.
*
* This method provides streaming access to tool execution, allowing you to
* observe intermediate task status updates for long-running tool calls.
* Automatically validates structured output if the tool has an outputSchema.
*
* @example
* ```typescript
* const stream = client.experimental.tasks.callToolStream({ name: 'myTool', arguments: {} });
* for await (const message of stream) {
* switch (message.type) {
* case 'taskCreated':
* console.log('Tool execution started:', message.task.taskId);
* break;
* case 'taskStatus':
* console.log('Tool status:', message.task.status);
* break;
* case 'result':
* console.log('Tool result:', message.result);
* break;
* case 'error':
* console.error('Tool error:', message.error);
* break;
* }
* }
* ```
*
* @param params - Tool call parameters (name and arguments)
* @param resultSchema - Zod schema for validating the result (defaults to CallToolResultSchema)
* @param options - Optional request options (timeout, signal, task creation params, etc.)
* @returns AsyncGenerator that yields ResponseMessage objects
*
* @experimental
*/
async *callToolStream(params, resultSchema = types_js_1.CallToolResultSchema, options) {
// Access Client's internal methods
const clientInternal = this._client;
// Add task creation parameters if server supports it and not explicitly provided
const optionsWithTask = {
...options,
// We check if the tool is known to be a task during auto-configuration, but assume
// the caller knows what they're doing if they pass this explicitly
task: options?.task ?? (clientInternal.isToolTask(params.name) ? {} : undefined)
};
const stream = clientInternal.requestStream({ method: 'tools/call', params }, resultSchema, optionsWithTask);
// Get the validator for this tool (if it has an output schema)
const validator = clientInternal.getToolOutputValidator(params.name);
// Iterate through the stream and validate the final result if needed
for await (const message of stream) {
// If this is a result message and the tool has an output schema, validate it
if (message.type === 'result' && validator) {
const result = message.result;
// If tool has outputSchema, it MUST return structuredContent (unless it's an error)
if (!result.structuredContent && !result.isError) {
yield {
type: 'error',
error: new types_js_1.McpError(types_js_1.ErrorCode.InvalidRequest, `Tool ${params.name} has an output schema but did not return structured content`)
};
return;
}
// Only validate structured content if present (not when there's an error)
if (result.structuredContent) {
try {
// Validate the structured content against the schema
const validationResult = validator(result.structuredContent);
if (!validationResult.valid) {
yield {
type: 'error',
error: new types_js_1.McpError(types_js_1.ErrorCode.InvalidParams, `Structured content does not match the tool's output schema: ${validationResult.errorMessage}`)
};
return;
}
}
catch (error) {
if (error instanceof types_js_1.McpError) {
yield { type: 'error', error };
return;
}
yield {
type: 'error',
error: new types_js_1.McpError(types_js_1.ErrorCode.InvalidParams, `Failed to validate structured content: ${error instanceof Error ? error.message : String(error)}`)
};
return;
}
}
}
// Yield the message (either validated result or any other message type)
yield message;
}
}
/**
* Gets the current status of a task.
*
* @param taskId - The task identifier
* @param options - Optional request options
* @returns The task status
*
* @experimental
*/
async getTask(taskId, options) {
return this._client.getTask({ taskId }, options);
}
/**
* Retrieves the result of a completed task.
*
* @param taskId - The task identifier
* @param resultSchema - Zod schema for validating the result
* @param options - Optional request options
* @returns The task result
*
* @experimental
*/
async getTaskResult(taskId, resultSchema, options) {
// Delegate to the client's underlying Protocol method
return this._client.getTaskResult({ taskId }, resultSchema, options);
}
/**
* Lists tasks with optional pagination.
*
* @param cursor - Optional pagination cursor
* @param options - Optional request options
* @returns List of tasks with optional next cursor
*
* @experimental
*/
async listTasks(cursor, options) {
// Delegate to the client's underlying Protocol method
return this._client.listTasks(cursor ? { cursor } : undefined, options);
}
/**
* Cancels a running task.
*
* @param taskId - The task identifier
* @param options - Optional request options
*
* @experimental
*/
async cancelTask(taskId, options) {
// Delegate to the client's underlying Protocol method
return this._client.cancelTask({ taskId }, options);
}
/**
* Sends a request and returns an AsyncGenerator that yields response messages.
* The generator is guaranteed to end with either a 'result' or 'error' message.
*
* This method provides streaming access to request processing, allowing you to
* observe intermediate task status updates for task-augmented requests.
*
* @param request - The request to send
* @param resultSchema - Zod schema for validating the result
* @param options - Optional request options (timeout, signal, task creation params, etc.)
* @returns AsyncGenerator that yields ResponseMessage objects
*
* @experimental
*/
requestStream(request, resultSchema, options) {
return this._client.requestStream(request, resultSchema, options);
}
}
exports.ExperimentalClientTasks = ExperimentalClientTasks;
//# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
{"version":3,"file":"section.js","sources":["../../../src/icons/section.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Section\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTYgNWE0IDMgMCAwIDAtOCAwYzAgNCA4IDMgOCA3YTQgMyAwIDAgMS04IDAiIC8+CiAgPHBhdGggZD0iTTggMTlhNCAzIDAgMCAwIDggMGMwLTQtOC0zLTgtN2E0IDMgMCAwIDEgOCAwIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/section\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 Section = createLucideIcon('Section', [\n ['path', { d: 'M16 5a4 3 0 0 0-8 0c0 4 8 3 8 7a4 3 0 0 1-8 0', key: 'vqan6v' }],\n ['path', { d: 'M8 19a4 3 0 0 0 8 0c0-4-8-3-8-7a4 3 0 0 1 8 0', key: 'wdjd8o' }],\n]);\n\nexport default Section;\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,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,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;AAChF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,53 @@
/**
* Signing JSON Web Signature (JWS) in General JSON Serialization
*
* @module
*/
import type * as types from '../../types.d.ts';
/** Used to build General JWS object's individual signatures. */
export interface Signature {
/**
* Sets the JWS Protected Header on the Signature object.
*
* @param protectedHeader JWS Protected Header.
*/
setProtectedHeader(protectedHeader: types.JWSHeaderParameters): Signature;
/**
* Sets the JWS Unprotected Header on the Signature object.
*
* @param unprotectedHeader JWS Unprotected Header.
*/
setUnprotectedHeader(unprotectedHeader: types.JWSHeaderParameters): Signature;
/** A shorthand for calling addSignature() on the enclosing {@link GeneralSign} instance */
addSignature(...args: Parameters<GeneralSign['addSignature']>): Signature;
/** A shorthand for calling encrypt() on the enclosing {@link GeneralSign} instance */
sign(...args: Parameters<GeneralSign['sign']>): Promise<types.GeneralJWS>;
/** Returns the enclosing {@link GeneralSign} instance */
done(): GeneralSign;
}
/**
* The GeneralSign class is used to build and sign General JWS objects.
*
* This class is exported (as a named export) from the main `'jose'` module entry point as well as
* from its subpath export `'jose/jws/general/sign'`.
*
*/
export declare class GeneralSign {
#private;
/**
* {@link GeneralSign} constructor
*
* @param payload Binary representation of the payload to sign.
*/
constructor(payload: Uint8Array);
/**
* Adds an additional signature for the General JWS object.
*
* @param key Private Key or Secret to sign the individual JWS signature with. See
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
* @param options JWS Sign options.
*/
addSignature(key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.SignOptions): Signature;
/** Signs and resolves the value of the General JWS object. */
sign(): Promise<types.GeneralJWS>;
}
@@ -0,0 +1,575 @@
'use strict'
const buffer = require('node:buffer')
const { Transform } = require('node:stream')
const { isASCIINumber, isValidLastEventId } = require('./util')
/**
* @type {number[]} BOM
*/
const BOM = [0xEF, 0xBB, 0xBF]
/**
* @type {10} LF
*/
const LF = 0x0A
/**
* @type {13} CR
*/
const CR = 0x0D
/**
* @type {58} COLON
*/
const COLON = 0x3A
/**
* @type {32} SPACE
*/
const SPACE = 0x20
const defaultMaxEventSize = buffer.kStringMaxLength
const DATA = Buffer.from('data')
const EVENT = Buffer.from('event')
const ID = Buffer.from('id')
const RETRY = Buffer.from('retry')
// Each data field creates a string node, and each unconsumed input chunk keeps
// a Buffer wrapper. The absolute ceiling protects the large default byte limit.
const minParserItems = 1024
const maxParserItems = 131072
const bytesPerParserItem = 128
function isASCIINumberBytes (buffer, start) {
if (start >= buffer.length) {
return false
}
for (let i = start; i < buffer.length; i++) {
if (buffer[i] < 0x30 || buffer[i] > 0x39) {
return false
}
}
return true
}
function isValidLastEventIdBytes (buffer, start) {
for (let i = start; i < buffer.length; i++) {
if (buffer[i] === 0x00) {
return false
}
}
return true
}
function isFieldName (line, length, field) {
if (length !== field.length) {
return false
}
for (let i = 0; i < length; i++) {
if (line[i] !== field[i]) {
return false
}
}
return true
}
function createMaxEventSizeExceededError () {
const error = new Error('EventSource message size exceeded')
error.aborted = false
return error
}
/**
* @typedef {object} EventSourceStreamEvent
* @type {object}
* @property {string} [event] The event type.
* @property {string} [data] The data of the message.
* @property {string} [id] A unique ID for the event.
* @property {string} [retry] The reconnection time, in milliseconds.
*/
/**
* @typedef eventSourceSettings
* @type {object}
* @property {string} [lastEventId] The last event ID received from the server.
* @property {string} [origin] The origin of the event source.
* @property {number} [reconnectionTime] The reconnection time, in milliseconds.
*/
class EventSourceStream extends Transform {
/**
* @type {eventSourceSettings}
*/
state
/**
* Leading byte-order-mark check.
* @type {boolean}
*/
checkBOM = true
/**
* @type {boolean}
*/
crlfCheck = false
/**
* @type {boolean}
*/
eventEndCheck = false
/**
* @type {Buffer[]}
*/
chunks = []
chunkIndex = 0
pos = 0
lineChunkIndex = 0
linePos = 0
lineLength = 0
eventSize = 0
eventFieldSizes = { data: 0, event: 0, id: 0, retry: 0 }
dataLineCount = 0
maxEventSize
maxDataLines
maxBufferedChunks
event = {
data: undefined,
event: undefined,
id: undefined,
retry: undefined
}
/**
* @param {object} options
* @param {boolean} [options.readableObjectMode]
* @param {number} [options.maxEventSize]
* @param {eventSourceSettings} [options.eventSourceSettings]
* @param {(chunk: any, encoding?: BufferEncoding | undefined) => boolean} [options.push]
*/
constructor (options = {}) {
// Enable object mode as EventSourceStream emits objects of shape
// EventSourceStreamEvent
options.readableObjectMode = true
super(options)
this.state = options.eventSourceSettings || {}
this.maxEventSize = options.maxEventSize ?? defaultMaxEventSize
const parserItemLimit = this.maxEventSize > 0
? Math.min(maxParserItems, Math.max(minParserItems, Math.floor(this.maxEventSize / bytesPerParserItem)))
: 0
this.maxDataLines = parserItemLimit
this.maxBufferedChunks = parserItemLimit
if (options.push) {
this.push = options.push
}
}
/**
* @param {Buffer} chunk
* @param {string} _encoding
* @param {Function} callback
* @returns {void}
*/
_transform (chunk, _encoding, callback) {
if (chunk.length === 0) {
callback()
return
}
// A leading line ending can immediately release the currently buffered
// line, even when it uses the final allowed chunk slot.
if (this.maxEventSize > 0 &&
this.chunks.length >= this.maxBufferedChunks &&
chunk[0] !== LF && chunk[0] !== CR) {
callback(createMaxEventSizeExceededError())
return
}
this.chunks.push(chunk)
// Strip leading byte-order-mark if we opened the stream and started
// the processing of the incoming data
if (this.checkBOM) {
if (this.handleBOM()) {
callback()
return
}
}
while (this.hasCurrentByte()) {
const byte = this.currentByte()
// If the previous line ended with an end-of-line, we need to check
// if the next character is also an end-of-line.
if (this.eventEndCheck) {
// If the the current character is an end-of-line, then the event
// is finished and we can process it
// If the previous line ended with a carriage return, we need to
// check if the current character is a line feed and remove it
// from the buffer.
if (this.crlfCheck) {
// If the current character is a line feed, we can remove it
// from the buffer and reset the crlfCheck flag
if (byte === LF) {
this.crlfCheck = false
this.consumeCurrentByte()
// It is possible that the line feed is not the end of the
// event. We need to check if the next character is an
// end-of-line character to determine if the event is
// finished. We simply continue the loop to check the next
// character.
// As we removed the line feed from the buffer and set the
// crlfCheck flag to false, we basically don't make any
// distinction between a line feed and a carriage return.
continue
}
this.crlfCheck = false
}
if (byte === LF || byte === CR) {
// If the current character is a carriage return, we need to
// set the crlfCheck flag to true, as we need to check if the
// next character is a line feed so we can remove it from the
// buffer
if (byte === CR) {
this.crlfCheck = true
}
this.consumeCurrentByte()
if (this.hasPendingEvent()) {
this.processEvent(this.event)
}
this.clearEvent()
continue
}
// If the current character is not an end-of-line, then the event
// is not finished and we have to reset the eventEndCheck flag
this.eventEndCheck = false
continue
}
// If the current character is an end-of-line, we can process the
// line
if (byte === LF || byte === CR) {
// If the current character is a carriage return, we need to
// set the crlfCheck flag to true, as we need to check if the
// next character is a line feed
if (byte === CR) {
this.crlfCheck = true
}
// In any case, we can process the line as we reached an
// end-of-line character
try {
this.parseLine(this.readLine(), this.event)
} catch (error) {
callback(error)
return
}
this.consumeCurrentByte()
// A line was processed and this could be the end of the event. We need
// to check if the next line is empty to determine if the event is
// finished.
this.eventEndCheck = true
continue
}
// readLine() is only called after CR or LF. Reject an unfinished line
// before it can retain an unbounded number of decoded chunks. The seven
// extra bytes allow the longest field prefix ("event: " or "retry: ").
if (this.maxEventSize > 0 && ++this.lineLength > this.maxEventSize + 7) {
callback(createMaxEventSizeExceededError())
return
}
this.advanceCursor()
}
callback()
}
_destroy (error, callback) {
this.chunks.length = 0
this.clearEvent()
super._destroy(error, callback)
}
/**
* @param {Buffer} line
* @param {EventSourceStreamEvent} event
*/
parseLine (line, event) {
// If the line is empty (a blank line)
// Dispatch the event, as defined below.
// This will be handled in the _transform method
if (line.length === 0) {
return
}
// If the line starts with a U+003A COLON character (:)
// Ignore the line.
const colonPosition = line.indexOf(COLON)
if (colonPosition === 0) {
return
}
let fieldLength = line.length
let valueStart = line.length
// If the line contains a U+003A COLON character (:)
if (colonPosition !== -1) {
fieldLength = colonPosition
// Collect the characters on the line after the first U+003A COLON
// character (:), and let value be that string.
// If value starts with a U+0020 SPACE character, remove it from value.
valueStart = colonPosition + 1
if (line[valueStart] === SPACE) {
++valueStart
}
}
if (isFieldName(line, fieldLength, DATA)) {
if (this.maxEventSize > 0 && this.dataLineCount >= this.maxDataLines) {
throw createMaxEventSizeExceededError()
}
const valueBytes = line.length - valueStart
const dataSize = this.eventFieldSizes.data + (event.data === undefined ? 0 : 1) + valueBytes
this.setEventFieldSize('data', dataSize)
const value = line.toString('utf8', valueStart)
if (event.data === undefined) {
event.data = value
} else {
event.data += `\n${value}`
}
this.dataLineCount++
return
}
if (isFieldName(line, fieldLength, RETRY)) {
if (isASCIINumberBytes(line, valueStart)) {
this.setEventFieldSize('retry', line.length - valueStart)
event.retry = line.toString('utf8', valueStart)
}
return
}
if (isFieldName(line, fieldLength, ID)) {
if (isValidLastEventIdBytes(line, valueStart)) {
this.setEventFieldSize('id', line.length - valueStart)
event.id = line.toString('utf8', valueStart)
}
return
}
if (isFieldName(line, fieldLength, EVENT)) {
if (valueStart < line.length) {
this.setEventFieldSize('event', line.length - valueStart)
event.event = line.toString('utf8', valueStart)
}
}
}
setEventFieldSize (field, size) {
const eventSize = this.eventSize - this.eventFieldSizes[field] + size
if (this.maxEventSize > 0 && eventSize > this.maxEventSize) {
throw createMaxEventSizeExceededError()
}
this.eventSize = eventSize
this.eventFieldSizes[field] = size
}
/**
* @param {EventSourceStreamEvent} event
*/
processEvent (event) {
if (event.retry && isASCIINumber(event.retry)) {
this.state.reconnectionTime = parseInt(event.retry, 10)
}
if (event.id !== undefined && isValidLastEventId(event.id)) {
this.state.lastEventId = event.id
}
// only dispatch event, when data is provided
if (event.data !== undefined) {
this.push({
type: event.event || 'message',
options: {
data: event.data,
lastEventId: this.state.lastEventId,
origin: this.state.origin
}
})
}
}
clearEvent () {
this.event.data = undefined
this.event.event = undefined
this.event.id = undefined
this.event.retry = undefined
this.eventSize = 0
this.dataLineCount = 0
this.eventFieldSizes.data = 0
this.eventFieldSizes.event = 0
this.eventFieldSizes.id = 0
this.eventFieldSizes.retry = 0
}
hasPendingEvent () {
return this.event.data !== undefined ||
this.event.event !== undefined ||
this.event.id !== undefined ||
this.event.retry !== undefined
}
hasCurrentByte () {
return this.chunkIndex < this.chunks.length &&
this.pos < this.chunks[this.chunkIndex].length
}
currentByte () {
return this.chunks[this.chunkIndex][this.pos]
}
consumeCurrentByte () {
this.advanceCursor()
this.syncLineStartToCursor()
}
advanceCursor () {
this.pos++
while (this.chunkIndex < this.chunks.length && this.pos >= this.chunks[this.chunkIndex].length) {
this.chunkIndex++
this.pos = 0
}
}
syncLineStartToCursor () {
this.lineChunkIndex = this.chunkIndex
this.linePos = this.pos
this.lineLength = 0
this.dropConsumedChunks()
}
dropConsumedChunks () {
if (this.lineChunkIndex > 0) {
const consumed = this.lineChunkIndex
this.chunks.splice(0, consumed)
this.lineChunkIndex = 0
this.chunkIndex -= consumed
}
if (this.chunkIndex === this.chunks.length) {
this.chunks.length = 0
this.chunkIndex = 0
this.pos = 0
this.lineChunkIndex = 0
this.linePos = 0
}
}
readLine () {
if (this.lineChunkIndex === this.chunkIndex) {
return this.chunks[this.chunkIndex].subarray(this.linePos, this.pos)
}
const chunks = []
let length = 0
for (let i = this.lineChunkIndex; i <= this.chunkIndex; i++) {
const chunk = this.chunks[i]
const start = i === this.lineChunkIndex ? this.linePos : 0
const end = i === this.chunkIndex ? this.pos : chunk.length
const slice = chunk.subarray(start, end)
length += slice.length
chunks.push(slice)
}
return Buffer.concat(chunks, length)
}
peekBufferedByte (offset) {
let chunkIndex = this.lineChunkIndex
let pos = this.linePos
while (chunkIndex < this.chunks.length) {
const chunk = this.chunks[chunkIndex]
const remaining = chunk.length - pos
if (offset < remaining) {
return chunk[pos + offset]
}
offset -= remaining
chunkIndex++
pos = 0
}
}
discardLeadingBytes (count) {
while (count > 0 && this.lineChunkIndex < this.chunks.length) {
const chunk = this.chunks[this.lineChunkIndex]
const remaining = chunk.length - this.linePos
if (count < remaining) {
this.linePos += count
count = 0
} else {
count -= remaining
this.lineChunkIndex++
this.linePos = 0
}
}
this.chunkIndex = this.lineChunkIndex
this.pos = this.linePos
this.dropConsumedChunks()
}
handleBOM () {
const first = this.peekBufferedByte(0)
const second = this.peekBufferedByte(1)
const third = this.peekBufferedByte(2)
if (second === undefined) {
if (first === BOM[0]) {
return true
}
this.checkBOM = false
return true
}
if (third === undefined) {
if (first === BOM[0] && second === BOM[1]) {
return true
}
this.checkBOM = false
return false
}
if (first === BOM[0] && second === BOM[1] && third === BOM[2]) {
this.discardLeadingBytes(3)
}
this.checkBOM = false
return !this.hasCurrentByte()
}
}
module.exports = {
EventSourceStream
}
@@ -0,0 +1,23 @@
/**
* @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 MousePointerBan = createLucideIcon("MousePointerBan", [
[
"path",
{
d: "M2.034 2.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.944L8.204 7.545a1 1 0 0 0-.66.66l-1.066 3.443a.5.5 0 0 1-.944.033z",
key: "11pp1i"
}
],
["circle", { cx: "16", cy: "16", r: "6", key: "qoo3c4" }],
["path", { d: "m11.8 11.8 8.4 8.4", key: "oogvdj" }]
]);
export { MousePointerBan as default };
//# sourceMappingURL=mouse-pointer-ban.js.map
@@ -0,0 +1,3 @@
declare const MAX_VALUE: 1.7976931348623157e+308;
export = MAX_VALUE;
@@ -0,0 +1 @@
module.exports={C:{"47":0.00119,"48":0.00237,"52":0.00119,"56":0.00119,"57":0.00237,"58":0.00119,"61":0.00237,"63":0.00119,"67":0.00119,"68":0.00119,"72":0.00356,"107":0.00119,"115":0.02728,"120":0.00119,"121":0.00237,"124":0.00119,"127":0.00593,"140":0.00593,"146":0.00237,"148":0.00237,"150":0.00237,"151":0.00119,"152":0.00712,"153":0.00474,"154":0.02609,"155":0.102,"156":0.08065,"157":0.00474,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 49 50 51 53 54 55 59 60 62 64 65 66 69 70 71 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 108 109 110 111 112 113 114 116 117 118 119 122 123 125 126 128 129 130 131 132 133 134 135 136 137 138 139 141 142 143 144 145 147 149 158 159 160 3.5 3.6"},D:{"37":0.05456,"50":0.00237,"52":0.00356,"55":0.00119,"56":0.00119,"57":0.00237,"63":0.00119,"64":0.00237,"65":0.00119,"66":0.00119,"67":0.00237,"68":0.00474,"69":0.00474,"70":0.00949,"71":0.00119,"72":0.00119,"75":0.00119,"76":0.00119,"78":0.02372,"79":0.00712,"81":0.00119,"83":0.00119,"84":0.00119,"87":0.00119,"88":0.0083,"89":0.00237,"91":0.0759,"93":0.00119,"95":0.00119,"98":0.00119,"99":0.00237,"101":0.00474,"102":0.00119,"103":0.00356,"104":0.00119,"105":0.00119,"106":0.00237,"107":0.00119,"109":0.05218,"110":0.00119,"111":0.00356,"112":0.00119,"114":0.00474,"115":0.00119,"116":0.00474,"117":0.00593,"118":0.00949,"119":0.00712,"120":0.00593,"122":0.00356,"123":0.00474,"125":0.00119,"126":0.00712,"127":0.00356,"128":0.00119,"129":0.00119,"130":0.00237,"131":0.01186,"132":0.00119,"133":0.00474,"134":0.00237,"135":0.00356,"136":0.00237,"137":0.00949,"138":0.03084,"139":0.00474,"140":0.00356,"141":0.00474,"142":0.00474,"143":0.00949,"144":0.00949,"145":0.00712,"146":0.0166,"147":0.08183,"148":0.01898,"149":0.03558,"150":0.04981,"151":0.2289,"152":0.46847,"153":0.29531,"154":0.09607,"155":0.00119,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 38 39 40 41 42 43 44 45 46 47 48 49 51 53 54 58 59 60 61 62 73 74 77 80 85 86 90 92 94 96 97 100 108 113 121 124 156 157"},F:{"46":0.00119,"62":0.00119,"79":0.00237,"84":0.00119,"87":0.00119,"90":0.00593,"92":0.00356,"93":0.00119,"94":0.00237,"95":0.01423,"96":0.00949,"97":0.00712,"98":0.02135,"99":0.00949,"100":0.27041,"101":0.58588,"102":0.00712,"131":0.00593,"132":0.00119,"133":0.00119,"134":0.0166,"135":0.08183,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 47 48 49 50 51 52 53 54 55 56 57 58 60 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 80 81 82 83 85 86 88 89 91 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"14":0.00119,"18":0.00237,"89":0.00119,"90":0.00237,"92":0.02372,"100":0.00119,"109":0.00237,"110":0.00119,"114":0.00237,"119":0.00119,"120":0.00119,"122":0.00237,"133":0.00119,"135":0.00119,"139":0.00119,"140":0.00119,"142":0.00237,"143":0.00356,"144":0.00119,"145":0.00593,"146":0.00119,"147":0.00119,"148":0.00119,"149":0.00356,"150":0.01186,"151":0.01423,"152":0.10555,"153":0.1103,"154":0.04151,_:"12 13 15 16 17 79 80 81 83 84 85 86 87 88 91 93 94 95 96 97 98 99 101 102 103 104 105 106 107 108 111 112 113 115 116 117 118 121 123 124 125 126 127 128 129 130 131 132 134 136 137 138 141"},E:{"27":0.00237,_:"4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 13.1 14.1 15.1 15.2-15.3 15.4 15.5 16.0 16.1 16.2 16.4 16.5 17.0 17.1 17.2 17.3 17.4 17.5 17.6 18.0 18.1 18.2 18.4 18.5-18.7 26.0 26.1 26.4 27.1 27.2 TP","12.1":0.00119,"15.6":0.00119,"16.3":0.00119,"16.6":0.00356,"18.3":0.00119,"26.2":0.00119,"26.3":0.0083,"26.5":0.00237,"26.6":0.00949},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00011,"5.0-5.1":0.00011,"6.0-6.1":0,"7.0-7.1":0.00022,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.00109,"11.0-11.2":0.00011,"11.3-11.4":0.00022,"12.0-12.1":0,"12.2-12.5":0.00284,"13.0-13.1":0,"13.2":0.00055,"13.3":0,"13.4-13.7":0.00011,"14.0-14.4":0.00044,"14.5-14.8":0.00066,"15.0-15.1":0.00066,"15.2-15.3":0.00044,"15.4":0.00055,"15.5":0.00066,"15.6-15.8":0.01421,"16.0":0.00109,"16.1":0.00197,"16.2":0.00109,"16.3":0.0024,"16.4":0.00055,"16.5":0.00087,"16.6-16.7":0.01978,"17.0":0.00077,"17.1":0.00109,"17.2":0.00109,"17.3":0.00164,"17.4":0.0023,"17.5":0.00448,"17.6-17.7":0.01159,"18.0":0.0024,"18.1":0.00481,"18.2":0.00656,"18.3":0.01137,"18.4":0.0071,"18.5-18.7":0.14678,"26.0":0.0071,"26.1":0.00721,"26.2":0.0188,"26.3":0.02033,"26.4":0.01486,"26.5":0.09957,"26.6":0.61434,"27.0":0.04711,"27.1":0,"27.2":0.0012},P:{"21":0.0089,"22":0.0178,"23":0.0089,"24":0.03561,"25":0.03561,"26":0.19584,"27":0.10682,"28":0.16023,"29":0.23144,"30":0.88127,_:"4 20 5.0-5.4 6.2-6.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 17.0","7.2-7.4":0.08012,"16.0":0.0089,"18.0":0.0089,"19.0":0.0089},I:{"0":0.29066,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1Line truncated
@@ -0,0 +1,3 @@
declare const ReferenceError: ReferenceErrorConstructor;
export = ReferenceError;
@@ -0,0 +1,11 @@
export type PreferOptionalChainMessageIds = 'optionalChainSuggest' | 'preferOptionalChain';
export interface PreferOptionalChainOptions {
allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing?: boolean;
checkAny?: boolean;
checkBigInt?: boolean;
checkBoolean?: boolean;
checkNumber?: boolean;
checkString?: boolean;
checkUnknown?: boolean;
requireNullish?: boolean;
}
@@ -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 Contrast = createLucideIcon("Contrast", [
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
["path", { d: "M12 18a6 6 0 0 0 0-12v12z", key: "j4l70d" }]
]);
export { Contrast as default };
//# sourceMappingURL=contrast.js.map
@@ -0,0 +1 @@
{"version":3,"file":"measure.mjs","sources":["../../../../src/projection/utils/measure.ts"],"sourcesContent":["import { TransformPoint } from \"motion-utils\"\nimport {\n convertBoundingBoxToBox,\n transformBoxPoints,\n} from \"../geometry/conversion\"\nimport { translateAxis } from \"../geometry/delta-apply\"\n\nexport function measureViewportBox(\n instance: HTMLElement,\n transformPoint?: TransformPoint\n) {\n return convertBoundingBoxToBox(\n transformBoxPoints(instance.getBoundingClientRect(), transformPoint)\n )\n}\n\nexport function measurePageBox(\n element: HTMLElement,\n rootProjectionNode: any,\n transformPagePoint?: TransformPoint\n) {\n const viewportBox = measureViewportBox(element, transformPagePoint)\n const { scroll } = rootProjectionNode\n\n if (scroll) {\n translateAxis(viewportBox.x, scroll.offset.x)\n translateAxis(viewportBox.y, scroll.offset.y)\n }\n\n return viewportBox\n}\n"],"names":[],"mappings":";;;AAOM,SAAU,kBAAkB,CAC9B,QAAqB,EACrB,cAA+B,EAAA;AAE/B,IAAA,OAAO,uBAAuB,CAC1B,kBAAkB,CAAC,QAAQ,CAAC,qBAAqB,EAAE,EAAE,cAAc,CAAC,CACvE;AACL;SAEgB,cAAc,CAC1B,OAAoB,EACpB,kBAAuB,EACvB,kBAAmC,EAAA;IAEnC,MAAM,WAAW,GAAG,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,CAAC;AACnE,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,kBAAkB;IAErC,IAAI,MAAM,EAAE;QACR,aAAa,CAAC,WAAW,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;QAC7C,aAAa,CAAC,WAAW,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACjD;AAEA,IAAA,OAAO,WAAW;AACtB;;;;"}
@@ -0,0 +1,125 @@
## 0.8.3
- Fix buffer over-read for Zip64 extra fields
- Support sync flushes (`Z_SYNC_FLUSH` in zlib)
- Allows for immediate decompression of all pushed bytes
- Enables DEFLATE stream concatenation
- Fix `zip`/`zipSync` when using cross-realm `Uint8Array`
- Improve Zip64 support for streamed or undersized archives
- Update performance estimates in README
- Fix typings for TypeScript v5.7+
- Reduce memory consumption after compression stream completion
## 0.8.2
- Fixed broken UMD build
- Fixed edge-case causing skipped data during streaming compression
- Fixed bug in GZIP streaming on member boundary
- Improved streaming performance on inconsistent chunk sizes
- Improved `unzip` performance on undercompressed archives
- Added flushing support into streaming API
- Added backpressure support into async streaming API
- Use new `ondrain` handler and `queuedSize`
## 0.8.1
- Fixed reallocating on pre-supplied buffer in `inflateSync` and `unzlibSync`
- Minor documentation fixes
## 0.8.0
- BREAKING: synchronous decompression functions now take an options object rather than an output buffer as a second parameter
- `inflateSync(compressed, outBuf)` is now `inflateSync(compressed, { out: outBuf })`
- Support dictionaries in compression and decompression
- Support multi-member files in GZIP streaming decompression
- Dramatically improved streaming performance
- Fixed missing error on certain malformed GZIP files
## 0.7.3
- Fix folder creation for certain operating system
- Create 0-length "files" for each directory specified with "object" syntax"
- Support empty folders
- Add options for folders
- Fix minification in SWC
- Remove instanceof, no-whitespace assumptions in async functions
## 0.7.2
- Fixed TypeScript typing for errors when using `strictNullChecks`
- Fixed failure to compress files above 64kB with `{ level: 0 }`
- Fixed AMD module definition in UMD build
## 0.7.1
- Removed requirement for `setTimeout`
- Added support for unzip file filters (thanks to [@manucorporat](https://github.com/manucorporat): #67)
- Fixed streaming gunzip and unzlib bug causing corruption
## 0.7.0
- Improved errors
- Now errors are error objects instead of strings
- Check the error code to apply custom logic based on error type
- Made async operations always call callbacks asynchronously
- Fixed bug that caused errors to not appear in asynchronous operations in browsers
## 0.6.10
- Fixed async operations on Node.js with native ESM
## 0.6.5
- Fixed streams not recognizing final chunk
- Fixed streaming UTF-8 decoder bug
## 0.6.4
- Made streaming inflate consume all data possible
- Optimized use of values near 32-bit boundary
## 0.6.3
- Patch exports of async functions
- Fix streaming unzip
## 0.6.2
- Replace Adler-32 implementation (used in Zlib compression) with one more optimized for V8
- Advice from @SheetJSDev
- Add support for extra fields, file comments in ZIP files
- Work on Rust version
## 0.6.0
- Revamped streaming unzip for compatibility and performance improvements
- Fixed streaming data bugs
- Fixed inflation errors
- Planned new tests
## 0.5.2
- General bugfixes
## 0.5.0
- Add streaming zip, unzip
- Fix import issues with certain environments
- If you had problems with `worker_threads` being included in your bundle, try updating!
## 0.4.8
- Support strict Content Security Policy
- Remove `new Function`
## 0.4.7
- Fix data streaming bugs
## 0.4.5
- Zip64 support
- Still not possible to have above 4GB files
## 0.4.4
- Files up to 4GB supported
- Hey, that's better than even Node.js `zlib`!
## 0.4.1
- Fix ZIP failure bug
- Make ZIP options work better
- Improve docs
- Fix async inflate failure
- Work on Rust version
## 0.3.11
- Fix docs
## 0.3.9
- Fixed issue with unzipping
## 0.3.7
- Patched streaming compression bugs
- Added demo page
## 0.3.6
- Allowed true ESM imports
## 0.3.4
- Fixed rare overflow bug causing corruption
- Added async stream termination
- Added UMD bundle
## 0.3.0
- Added support for asynchronous and synchronous streaming
- Reduced bundle size by autogenerating worker code, even in minified environments
- Error detection rather than hanging
- Improved performance
## 0.2.3
- Improved Zlib autodetection
## 0.2.2
- Fixed Node Worker
## 0.2.1
- Fixed ZIP bug
## 0.2.0
- Added support for ZIP files (parallelized)
- Added ability to terminate running asynchronous operations
## 0.1.0
- Rewrote API: added support for asynchronous (Worker) compression/decompression, fixed critical bug involving fixed Huffman trees
## 0.0.1
- Created, works on basic input
@@ -0,0 +1,3 @@
"use strict";
const get = require("./set-Bwi5SIy8.js");
module.exports = get.set;
@@ -0,0 +1,8 @@
import type { TSESTree } from '@typescript-eslint/types';
import { DefinitionBase } from './DefinitionBase';
import { DefinitionType } from './DefinitionType';
export declare class TypeDefinition extends DefinitionBase<DefinitionType.Type, TSESTree.TSInterfaceDeclaration | TSESTree.TSMappedType | TSESTree.TSTypeAliasDeclaration | TSESTree.TSTypeParameter, null, TSESTree.Identifier> {
readonly isTypeDefinition = true;
readonly isVariableDefinition = false;
constructor(name: TSESTree.Identifier, node: TypeDefinition['node']);
}
@@ -0,0 +1,632 @@
flf2a$ 6 5 18 -1 19
usaflag.flf -- 11/6/94
Figlet conversion by Kent Nassen (kentn@cyberspace.org) based on the
font design by:
Article 2688 of rec.arts.ascii:
Path: news.itd.umich.edu!caen!spool.mu.edu!howland.reston.ans.net!news.sprintlink.net!sashimi.wwa.com!not-for-mail
From: dissel@nunic.nu.edu (David S. Issel)
Newsgroups: rec.arts.ascii,alt.ascii-art
Subject: Line: USA FLAG font
Date: 6 Nov 1994 15:48:01 -0600
Organization: National University
Lines: 72
Sender: boba@wwa.com
Approved: boba@wwa.com
Message-ID: <39jiuh$k12@gagme.wwa.com>
NNTP-Posting-Host: gagme.wwa.com
Xref: news.itd.umich.edu rec.arts.ascii:2688 alt.ascii-art:15738
--------------
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@@
$===@
$===@
$===@
$ @
$===@
$ @@
$== == @
$ == ==@
$ $@
$ $@
$ $@
$ $@@
$ === === @
$=========@
$ === === @
$=========@
$ === === @
$ @@
$ =H=H= @
$==H H @
$ ===== @
$ H H==@
$ =H=H= @
$ @@
$ == ==@
$ ===@
$ === @
$=== @
$== == @
$ @@
$:::== @
$::: == @
$ ===== ==@
$=== === @
$ ===== ==@
$ @@
$ ==@
$== @
$ $@
$ $@
$ $@
$ $@@
$ ===@
$=== @
$=== @
$=== @
$ ===@
$ @@
$=== @
$ ===@
$ ===@
$ ===@
$=== @
$ @@
$ ::: === @
$ ::==== @
$==========@
$ ====== @
$ === === @
$ @@
$ === @
$ === @
$=======@
$ === @
$ === @
$ @@
$ @
$ @
$ @
$ ==@
$ ==@
$== @@
$ $@
$ $@
$========@
$ $@
$ $@
$ $@@
$ $@
$ $@
$ $@
$ $@
$==@
$ $@@
$ ===@
$ === @
$ === @
$ === @
$=== @
$ @@
$:::==== @
$::: ===@
$=== ===@
$=== ===@
$ ====== @
$ @@
$:::@
$:::@
$===@
$===@
$===@
$ @@
$:::==== @
$:: ===@
$ ==== @
$ === @
$========@
$ @@
$:::=== @
$ ===@
$ ===== @
$ ===@
$====== @
$ @@
$::: ===@
$::: ===@
$========@
$ ===@
$ ===@
$ @@
$:::====@
$::: @
$====== @
$ ===@
$====== @
$ @@
$:::==== @
$::: @
$======= @
$=== ===@
$ ====== @
$ @@
$:::=====@
$ ===@
$ === @
$ ==== @
$=== @
$ @@
$:::==== @
$::: ===@
$ ====== @
$=== ===@
$ ====== @
$ @@
$:::==== @
$::: ===@
$ =======@
$ ===@
$ ===== @
$ @@
$ $@
$==@
$ $@
$==@
$ $@
$ $@@
$ $@
$ ==@
$ $@
$ ==@
$ ==@
$==$@@
$ ===@
$ === @
$=== @
$ === @
$ ===@
$ @@
$ $@
$========@
$ $@
$========@
$ $@
$ $@@
$=== @
$ === @
$ ===@
$ === @
$=== @
$ @@
$ ====== @
$== ===@
$ ==== @
$ "" @
$ == @
$ @@
$ ======= @
$=== ===@
$=== =====@
$=== @
$ ======= @
$ @@
$:::==== @
$::: ===@
$========@
$=== ===@
$=== ===@
$ @@
$:::==== @
$::: ===@
$======= @
$=== ===@
$======= @
$ @@
$:::=====@
$::: @
$=== @
$=== @
$ =======@
$ @@
$:::==== @
$::: ===@
$=== ===@
$=== ===@
$======= @
$ @@
$:::=====@
$::: @
$====== @
$=== @
$========@
$ @@
$:::=====@
$::: @
$====== @
$=== @
$=== @
$ @@
$:::===== @
$::: @
$=== =====@
$=== ===@
$ ======= @
$ @@
$::: ===@
$::: ===@
$========@
$=== ===@
$=== ===@
$ @@
$:::@
$:::@
$===@
$===@
$===@
$ @@
$ :::@
$ :::@
$ ===@
$== ===@
$====== @
$ @@
$::: ===@
$::: === @
$====== @
$=== === @
$=== ===@
$ @@
$::: @
$::: @
$=== @
$=== @
$========@
$ @@
$:::======= @
$::: === ===@
$=== === ===@
$=== ===@
$=== ===@
$ @@
$:::= ===@
$:::=====@
$========@
$=== ====@
$=== ===@
$ @@
$:::==== @
$::: ===@
$=== ===@
$=== ===@
$ ====== @
$ @@
$:::==== @
$::: ===@
$======= @
$=== @
$=== @
$ @@
$:::==== @
$::: === @
$=== ==== @
$======== @
$ ==== ===@
$ @@
$:::==== @
$::: ===@
$======= @
$=== === @
$=== ===@
$ @@
$:::=== @
$::: @
$ ===== @
$ ===@
$====== @
$ @@
$:::====@
$:::====@
$ === @
$ === @
$ === @
$ @@
$::: ===@
$::: ===@
$=== ===@
$=== ===@
$ ====== @
$ @@
$::: ===@
$::: ===@
$=== ===@
$ ====== @
$ == @
$ @@
$::: === ===@
$::: === ===@
$=== === ===@
$ =========== @
$ ==== ==== @
$ @@
$::: ===@
$::: ===@
$ ====== @
$ ====== @
$=== ===@
$ @@
$::: ===@
$::: ===@
$ ===== @
$ === @
$ === @
$ @@
$:::=====@
$ ===@
$ === @
$ === @
$========@
$ @@
$=====@
$=== @
$=== @
$=== @
$=====@
$ @@
$=== @
$ === @
$ === @
$ === @
$ ===@
$ @@
$=====@
$ ===@
$ ===@
$ ===@
$=====@
$ @@
$ ==== $@
$=== ===@
$ $@
$ $@
$ $@
$ $@@
$ $@
$ $@
$ $@
$ $@
$ $@
$========@@
$== @
$ ==@
$ $@
$ $@
$ $@
$ $@@
$:::==== @
$::: ===@
$========@
$=== ===@
$=== ===@
$ @@
$:::==== @
$::: ===@
$======= @
$=== ===@
$======= @
$ @@
$:::=====@
$::: @
$=== @
$=== @
$ =======@
$ @@
$:::==== @
$::: ===@
$=== ===@
$=== ===@
$======= @
$ @@
$:::=====@
$::: @
$====== @
$=== @
$========@
$ @@
$:::=====@
$::: @
$====== @
$=== @
$=== @
$ @@
$:::===== @
$::: @
$=== =====@
$=== ===@
$ ======= @
$ @@
$::: ===@
$::: ===@
$========@
$=== ===@
$=== ===@
$ @@
$:::@
$:::@
$===@
$===@
$===@
$ @@
$ :::@
$ :::@
$ ===@
$== ===@
$====== @
$ @@
$::: ===@
$::: === @
$====== @
$=== === @
$=== ===@
$ @@
$::: @
$::: @
$=== @
$=== @
$========@
$ @@
$:::======= @
$::: === ===@
$=== === ===@
$=== ===@
$=== ===@
$ @@
$:::= ===@
$:::=====@
$========@
$=== ====@
$=== ===@
$ @@
$:::==== @
$::: ===@
$=== ===@
$=== ===@
$ ====== @
$ @@
$:::==== @
$::: ===@
$======= @
$=== @
$=== @
$ @@
$:::==== @
$::: === @
$=== ==== @
$======== @
$ ==== ===@
$ @@
$:::==== @
$::: ===@
$======= @
$=== === @
$=== ===@
$ @@
$:::=== @
$::: @
$ ===== @
$ ===@
$====== @
$ @@
$:::====@
$:::====@
$ === @
$ === @
$ === @
$ @@
$::: ===@
$::: ===@
$=== ===@
$=== ===@
$ ====== @
$ @@
$::: ===@
$::: ===@
$=== ===@
$ ====== @
$ == @
$ @@
$::: === ===@
$::: === ===@
$=== === ===@
$ =========== @
$ ==== ==== @
$ @@
$::: ===@
$::: ===@
$ ====== @
$ ====== @
$=== ===@
$ @@
$::: ===@
$::: ===@
$ ===== @
$ === @
$ === @
$ @@
$:::=====@
$ ===@
$ === @
$ === @
$========@
$ @@
$ ===@
$ ===@
$=== @
$ ===@
$ ===@
$ @@
$===@
$===@
$===@
$===@
$===@
$ @@
$=== @
$=== @
$ ===@
$=== @
$=== @
$ @@
$=== ==@
$= ===$@
$ $@
$ $@
$ $@
$ $@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@@ -0,0 +1,9 @@
import SemVer = require("../classes/semver");
import semver = require("../index");
/**
* v1 == v2 This is true if they're logically equivalent, even if they're not the exact same string. You already know how to compare strings.
*/
declare function eq(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | semver.Options): boolean;
export = eq;
@@ -0,0 +1 @@
{"version":3,"file":"folder-cog.js","sources":["../../../src/icons/folder-cog.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name FolderCog\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxOCIgY3k9IjE4IiByPSIzIiAvPgogIDxwYXRoIGQ9Ik0xMC4zIDIwSDRhMiAyIDAgMCAxLTItMlY1YTIgMiAwIDAgMSAyLTJoMy45YTIgMiAwIDAgMSAxLjY5LjlsLjgxIDEuMmEyIDIgMCAwIDAgMS42Ny45SDIwYTIgMiAwIDAgMSAyIDJ2My4zIiAvPgogIDxwYXRoIGQ9Im0yMS43IDE5LjQtLjktLjMiIC8+CiAgPHBhdGggZD0ibTE1LjIgMTYuOS0uOS0uMyIgLz4KICA8cGF0aCBkPSJtMTYuNiAyMS43LjMtLjkiIC8+CiAgPHBhdGggZD0ibTE5LjEgMTUuMi4zLS45IiAvPgogIDxwYXRoIGQ9Im0xOS42IDIxLjctLjQtMSIgLz4KICA8cGF0aCBkPSJtMTYuOCAxNS4zLS40LTEiIC8+CiAgPHBhdGggZD0ibTE0LjMgMTkuNiAxLS40IiAvPgogIDxwYXRoIGQ9Im0yMC43IDE2LjggMS0uNCIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/folder-cog\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 FolderCog = createLucideIcon('FolderCog', [\n ['circle', { cx: '18', cy: '18', r: '3', key: '1xkwt0' }],\n [\n 'path',\n {\n d: 'M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v3.3',\n key: '1k8050',\n },\n ],\n ['path', { d: 'm21.7 19.4-.9-.3', key: '1qgwi9' }],\n ['path', { d: 'm15.2 16.9-.9-.3', key: '1t7mvx' }],\n ['path', { d: 'm16.6 21.7.3-.9', key: '1j67ps' }],\n ['path', { d: 'm19.1 15.2.3-.9', key: '18r7jp' }],\n ['path', { d: 'm19.6 21.7-.4-1', key: 'z2vh2' }],\n ['path', { d: 'm16.8 15.3-.4-1', key: '1ei7r6' }],\n ['path', { d: 'm14.3 19.6 1-.4', key: '11sv9r' }],\n ['path', { d: 'm20.7 16.8 1-.4', key: '19m87a' }],\n]);\n\nexport default FolderCog;\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,CAC9C,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,CACxD,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,CAAA,CAAA,CAAA,CAAA,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,CAAA;AAAA,CAAA,CACA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAoB,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,CACjD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAoB,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,CACjD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAmB,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,CAChD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAmB,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,CAChD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAmB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,SAAS,CAAA,CAAA;AAAA,CAAA,CAC/C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAmB,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,CAChD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAmB,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,CAChD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAALine truncated
@@ -0,0 +1,39 @@
import{useEffect as nQ,useState as r}from"react";import{Protocol as lQ}from"@modelcontextprotocol/client";import{EmptyResultSchema as pQ}from"@modelcontextprotocol/core";var $Q="ui/resourceUri",KQ="text/html;profile=mcp-app";class j{_eventSlots=new Map;setHandler(X,Y){let Z=this._ensureEventSlot(X);if(Z.onHandler&&Y)console.warn(`[MCP Apps] on${String(X)} handler replaced. Use addEventListener("${String(X)}", …) to add multiple listeners without replacing.`);Z.onHandler=Y}getHandler(X){return this._eventSlots.get(X)?.onHandler}addEventListener(X,Y){this._ensureEventSlot(X).listeners.push(Y)}removeEventListener(X,Y){let Z=this._eventSlots.get(X);if(!Z)return;let $=Z.listeners.indexOf(Y);if($!==-1)Z.listeners.splice($,1)}dispatch(X,Y){let Z=this._eventSlots.get(X);if(!Z)return;Z.onHandler?.(Y);for(let $ of[...Z.listeners])$(Y)}_ensureEventSlot(X){let Y=this._eventSlots.get(X);if(!Y)Y={listeners:[]},this._eventSlots.set(X,Y);return Y}}class M{_methods=new Set;claim(X,Y){if(this._methods.has(X))throw Error(`Handler for "${X}" already registered (via ${Y}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._methods.add(X)}replace(X){this._methods.add(X)}release(X){this._methods.delete(X)}has(X){return this._methods.has(X)}}var i=new Set;function H(X,Y){let[Z,$]=Y,K=Z?.shape;if(typeof K?.method?.value!=="string")return;let J=K.method.value,G=X==="request"?"setRequestHandler":"setNotificationHandler";if(!i.has(G))i.add(G),console.warn(`[ext-apps] ${G}(Schema, handler) is deprecated; use ${G}("${J}", { params: Schema.shape.params }, handler).`);let W=$;return[J,{params:K.params},X==="request"?(L,N)=>W({method:J,params:L},JQ(N)):(L)=>W({method:J,params:L})]}function JQ(X){return{signal:X.mcpReq.signal,requestId:X.mcpReq.id,sessionId:X.sessionId,_meta:X.mcpReq._meta,sendRequest:X.mcpReq.send,sendNotification:X.mcpReq.notify,authInfo:X.http?.authInfo}}import{JSONRPCMessageSchema as zQ}from"@modelcontextprotocol/core";var T="2026-01-26",GQ="ui/open-link",WQ="ui/download-file",LQ="ui/message",NQ="ui/notifications/sandbox-proxy-ready",BQ="ui/notifications/sandbox-resource-ready",VQ="ui/notifications/size-changed",_Q="ui/notifications/tool-input",A="ui/notifications/tool-input-partial",qQ="ui/notifications/tool-result",OQ="ui/notifications/tool-cancelled",PQ="ui/notifications/host-context-changed",jQ="ui/notifications/request-teardown",DQ="ui/resource-teardown",FQ="ui/initialize",EQ="ui/notifications/initialized",RQ="ui/request-display-mode";class V{eventTarget;eventSource;messageListener;constructor(X=window.parent,Y){this.eventTarget=X;this.eventSource=Y;this.messageListener=(Z)=>{if(Y&&Z.source!==this.eventSource){console.debug("Ignoring message from unknown source",Z);return}let $=zQ.safeParse(Z.data);if($.success)console.debug("Parsed message",$.data),this.onmessage?.($.data);else if(Z.data?.jsonrpc!=="2.0")console.debug("Ignoring non-JSON-RPC message",$.error.message,Z);else console.error("Failed to parse message",$.error.message,Z),this.onerror?.(Error("Invalid JSON-RPC message received: "+$.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send(X,Y){if(X.method!==A)console.debug("Sending message",X);this.eventTarget.postMessage(X,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}import{z as Q}from"zod/v4";import{ContentBlockSchema as n,CallToolResultSchema as IQ,EmbeddedResourceSchema as UQ,ImplementationSchema as o,RequestIdSchema as wQ,ResourceLinkSchema as MQ,ToolSchema as HQ}from"@modelcontextprotocol/core";var s=Q.union([Q.literal("light"),Q.literal("dark")]).describe("Color theme preference for the host environment."),_=Q.union([Q.literal("inline"),Q.literal("fullscreen"),Q.literal("pip")]).describe("Display mode for UI presentation."),TQ=Q.union([Q.literal("--color-background-primary"),Q.literal("--color-background-secondary"),Q.literal("--color-background-tertiary"),Q.literal("--color-background-inverse"),Q.literal("--color-background-ghost"),Q.literal("--color-background-info"),Q.literal("--color-background-danger"),Q.literal("--color-background-success"),Q.literal("--color-background-warning"),Q.literal("--color-background-disabled"),Q.literal("--color-text-primary"),Q.literal("--color-text-secondary"),Q.literal("--color-text-tertiary"),Q.literal("--color-text-inverse"),Q.literal("--color-text-ghost"),Q.literal("--color-text-info"),Q.literal("--color-text-danger"),Q.literal("--color-text-success"),Q.literal("--color-text-warning"),Q.literal("--color-text-disabled"),Q.literal("--color-border-primary"),Q.literal("--color-border-secondary"),Q.literal("--color-border-tertiary"),Q.literal("--color-border-inverse"),Q.literal("--color-border-ghost"),Q.literal("--color-border-info"),Q.literal("--color-border-danger"),Q.literal("--color-border-success"),Q.literal("--color-border-warning"),Q.literal("--color-border-disabLine truncated
Individual style keys are optional - hosts may provide any subset of these values.
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),Q.union([Q.string(),Q.undefined()]).describe(`Style variables for theming MCP apps.
Individual style keys are optional - hosts may provide any subset of these values.
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`)).describe(`Style variables for theming MCP apps.
Individual style keys are optional - hosts may provide any subset of these values.
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),kQ=Q.object({method:Q.literal("ui/open-link"),params:Q.object({url:Q.string().describe("URL to open in the host's browser")})}),S=Q.object({isError:Q.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),C=Q.object({isError:Q.boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),b=Q.object({isError:Q.boolean().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),SQ=Q.object({method:Q.literal("ui/notifications/sandbox-proxy-ready"),params:Q.object({})}),D=Q.object({connectDomains:Q.array(Q.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
- Maps to CSP \`connect-src\` directive
- Empty or omitted → no network connections (secure default)`),resourceDomains:Q.array(Q.string()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:Q.array(Q.string()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:Q.array(Q.string()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),F=Q.object({camera:Q.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:Q.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:Q.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:Q.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),CQ=Q.object({method:Q.literal("ui/notifications/size-changed"),params:Q.object({width:Q.number().optional().describe("New width in pixels."),height:Q.number().optional().describe("New height in pixels.")})}),x=Q.object({method:Q.literal("ui/notifications/tool-input"),params:Q.object({arguments:Q.record(Q.string(),Q.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),v=Q.object({method:Q.literal("ui/notifications/tool-input-partial"),params:Q.object({arguments:Q.record(Q.string(),Q.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),g=Q.object({method:Q.literal("ui/notifications/tool-cancelled"),params:Q.object({reason:Q.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),a=Q.object({fonts:Q.string().optional()}),t=Q.object({variables:AQ.optional().describe("CSS variables for theming the app."),css:a.optional().describe("CSS blocks that apps can inject.")}),y=Q.object({method:Q.literal("ui/resource-teardown"),params:Q.object({})}),f=Q.record(Q.string(),Q.unknown()),k=Q.object({text:Q.object({}).optional().describe("Host supports text content blocks."),image:Q.object({}).optional().describe("Host supports image content blocks."),audio:Q.object({}).optional().describe("Host supports audio content blocks."),resource:Q.object({}).optional().describe("Host supports resource content blocks."),resourceLink:Q.object({}).optional().describe("Host supports resource link content blocks."),structuredContent:Q.object({}).optional().describe("Host supports structured content.")}),bQ=Q.object({method:Q.literal("ui/notifications/request-teardown"),params:Q.object({}).optional()}),e=Q.object({experimental:Q.record(Q.string(),Q.record(Q.string(),Q.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:Q.object({}).optional().describe("Host supports opening external URLs."),downloadFile:Q.object({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:Q.object({listChanged:Q.boolean().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:Q.object({listChanged:Q.boolean().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:Q.object({}).optional().describe("Host accepts log messages."),sandbox:Q.object({permissions:F.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:D.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:k.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:k.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:Q.object({tools:Q.object({}).optional().describe("Host supports tool use via `tools` and `toolChoice` parameters.")}).optional().describe("Host supports LLM sampling (sampling/createMessage) from the view.\nMirrors the MCP `ClientCapabilities.sampling` shape so hosts can pass it through.")}),QQ=Q.object({experimental:Q.record(Q.string(),Q.record(Q.string(),Q.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyedLine truncated
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
**Host-dependent:** The format and validation rules for this field are determined by each host. Servers MUST consult host-specific documentation for the expected domain format. Common patterns include:
- Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
- URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:Q.boolean().optional().describe(`Visual boundary preference - true if view prefers a visible border.
Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.
- \`true\`: request visible border + background
- \`false\`: request no visible border + background
- omitted: host decides border`)}),gQ=Q.object({method:Q.literal("ui/request-display-mode"),params:Q.object({mode:_.describe("The display mode being requested.")})}),u=Q.object({mode:_.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),XQ=Q.union([Q.literal("model"),Q.literal("app")]).describe("Tool visibility scope - who can access the tool."),yQ=Q.object({resourceUri:Q.string().optional(),visibility:Q.array(XQ).optional().describe(`Who can access this tool. Default: ["model", "app"]
- "model": Tool visible to and callable by the agent
- "app": Tool callable by the app from this server only`),csp:Q.never().optional(),permissions:Q.never().optional()}),LX=Q.object({mimeTypes:Q.array(Q.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),fQ=Q.object({method:Q.literal("ui/download-file"),params:Q.object({contents:Q.array(Q.union([UQ,MQ])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),uQ=Q.object({method:Q.literal("ui/message"),params:Q.object({role:Q.literal("user").describe('Message role, currently only "user" is supported.'),content:Q.array(n).describe("Message content blocks (text, image, etc.).")})}),dQ=Q.object({method:Q.literal("ui/notifications/sandbox-resource-ready"),params:Q.object({html:Q.string().describe("HTML content to load into the inner iframe."),sandbox:Q.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:D.optional().describe("CSP configuration from resource metadata."),permissions:F.optional().describe("Sandbox permissions from resource metadata.")})}),d=Q.object({method:Q.literal("ui/notifications/tool-result"),params:IQ.describe("Standard MCP tool execution result.")}),h=Q.object({toolInfo:Q.object({id:wQ.optional().describe("JSON-RPC id of the tools/call request."),tool:HQ.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:s.optional().describe("Current color theme preference."),styles:t.optional().describe("Style configuration for theming the app."),displayMode:_.optional().describe("How the UI is currently displayed."),availableDisplayModes:Q.array(_).optional().describe("Display modes the host supports."),containerDimensions:Q.union([Q.object({height:Q.number().describe("Fixed container height in pixels.")}),Q.object({maxHeight:Q.union([Q.number(),Q.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(Q.union([Q.object({width:Q.number().describe("Fixed container width in pixels.")}),Q.object({maxWidth:Q.union([Q.number(),Q.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:Q.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:Q.string().optional().describe("User's timezone in IANA format."),userAgent:Q.string().optional().describe("Host application identifier."),platform:Q.union([Q.literal("web"),Q.literal("desktop"),Q.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:Q.object({touch:Q.boolean().optional().describe("Whether the device supports touch input."),hover:Q.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:Q.object({top:Q.number().describe("Top safe area inset in pixels."),right:Q.number().describe("Right safe area inset in pixels."),bottom:Q.number().describe("Bottom safe area inset in pixels."),left:Q.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),m=Q.object({method:Q.literal("ui/notifications/host-context-changed"),params:h.describe("Partial context update containing only changed fields.")}),hQ=Q.object({method:Q.literal("ui/update-model-context"),params:Q.object({content:Q.array(n).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:Q.record(Q.string(),Q.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),mQ=Q.object({method:Q.literal("ui/initialize"),params:Q.object({appInfo:o.describe("App identification (name and version)."),appCapabilities:QQ.describe("Features and capabilities this app provides."),protocolVersion:Q.string().describe("Protocol version this app supports.")})}),c=Q.object({protocolVersion:Q.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:o.describe("Host application identification and version."),hostCapabilities:e.describe("Features and capabilities provided by the host."),hostContext:h.describe("Rich context about the host environment.")}).passthrough();var cQ={target:"draft-2020-12"};async function l(X,Y){let Z=X["~standard"];if(Z.jsonSchema)return Z.jsonSchema[Y](cQ);throw Error(`Schema (vendor: ${Z.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function p(X,Y,Z=""){let $=await X["~standard"].validate(Y);if($.issues){let K=$.issues.map((J)=>{let G=J.path?.map((W)=>typeof W==="object"?W.key:W).join(".");return G?`${G}: ${J.message}`:J.message}).join("; ");throw Error(Z+K)}return $.value}import{z as rQ}from"zod/v4";function E(){let X=document.documentElement.getAttribute("data-theme");if(X==="dark"||X==="light")return X;return document.documentElement.classList.contains("dark")?"dark":"light"}function R(X){let Y=document.documentElement;Y.setAttribute("data-theme",X),Y.style.colorScheme=X}function z(X,Y=document.documentElement){for(let[Z,$]of Object.entries(X))if($!==void 0)Y.style.setProperty(Z,$)}function I(X){if(document.getElementById("__mcp-host-fonts"))return;let Z=document.createElement("style");Z.id="__mcp-host-fonts",Z.textContent=X,document.head.appendChild(Z)}function iQ(X,Y){let Z={...X,...Y};if(Y.experimental!==void 0)Z.experimental={...X.experimental,...Y.experimental};if(Y.tools!==void 0)Z.tools={...X.tools,...Y.tools};return Z}class U extends lQ{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new j;_methods=new M;setRequestHandler=(...X)=>{let[Y,...Z]=H("request",X)??X;this._methods.claim(Y,"setRequestHandler"),super.setRequestHandler.call(this,Y,...Z)};setNotificationHandler=(...X)=>{let[Y,...Z]=H("notification",X)??X;this._methods.claim(Y,"setNotificationHandler"),super.setNotificationHandler.call(this,Y,...Z)};removeRequestHandler=(X)=>{this._methods.release(X),super.removeRequestHandler(X)};removeNotificationHandler=(X)=>{this._methods.release(X),super.removeNotificationHandler(X)};replaceRequestHandler=(X,...Y)=>{this._methods.replace(X),super.setRequestHandler.call(this,X,...Y)};_assertInitialized(X){if(this._initializedSent)return;let Y=`[ext-apps] App.${X}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(Y);console.warn(`${Y}. This will throw in a future release.`)}eventSchemas={toolinput:x,toolinputpartial:v,toolresult:d,toolcancelled:g,hostcontextchanged:m};static ONE_SHOT_EVENTS=new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]);_everHadListener=new Set;_assertHandlerTiming(X){if(!U.ONE_SHOT_EVENTS.has(X)||this._everHadListener.has(X))return;if(this._everHadListener.add(X),!thLine truncated
@@ -0,0 +1,619 @@
export default `flf2a$ 6 6 12 0 5 0 0 0
Font Author: Jäger
FIGFont created with: http://patorjk.com/figfont-editor
***Alphabetical only, no numbers or symbols***
░░░░░░@
▒▒▒▒▒▒@
▓▓▓▓▓▓@
██████@
██████@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
░░ ░░@
▒ ▒▒▒▒ ▒@
▓ ▓▓▓▓ ▓@
█ █@
█ ████ █@
@@
░ ░░@
▒ ▒▒▒▒ ▒@
▓ ▓▓@
█ ████ █@
█ ██@
@@
░░ ░░@
▒ ▒▒▒▒ ▒@
▓ ▓▓▓▓▓▓▓@
█ ████ █@
██ ██@
@@
░ ░░@
▒ ▒▒▒▒ ▒@
▓ ▓▓▓▓ ▓@
█ ████ █@
█ ██@
@@
░ ░@
▒ ▒▒▒▒▒▒▒@
▓ ▓▓▓@
█ ███████@
█ █@
@@
░ ░@
▒ ▒▒▒▒▒▒▒@
▓ ▓▓▓@
█ ███████@
█ ███████@
@@
░░ ░░@
▒ ▒▒▒▒▒▒▒@
▓ ▓▓▓ ▓@
█ ████ █@
██ ██@
@@
░ ░░░░ ░@
▒ ▒▒▒▒ ▒@
▓ ▓@
█ ████ █@
█ ████ █@
@@
░ ░@
▒▒▒▒ ▒▒▒▒@
▓▓▓▓ ▓▓▓▓@
████ ████@
█ █@
@@
░ ░@
▒▒▒▒▒▒▒ ▒@
▓▓▓▓▓▓▓ ▓@
█ ████ █@
██ ██@
@@
░ ░░░░ ░@
▒ ▒▒▒ ▒▒@
▓ ▓▓▓▓@
█ ███ ██@
█ ████ █@
@@
░ ░░░░░░░@
▒ ▒▒▒▒▒▒▒@
▓ ▓▓▓▓▓▓▓@
█ ███████@
█ █@
@@
░ ░░░░ ░@
▒ ▒▒ ▒@
▓ ▓@
█ █ █ █@
█ ████ █@
@@
░ ░░░ ░@
▒ ▒▒ ▒@
▓ ▓ ▓ ▓@
█ ██ █@
█ ███ █@
@@
░░ ░░@
▒ ▒▒▒▒ ▒@
▓ ▓▓▓▓ ▓@
█ ████ █@
██ ██@
@@
░ ░░@
▒ ▒▒▒▒ ▒@
▓ ▓▓@
█ ███████@
█ ███████@
@@
░░ ░░@
▒ ▒▒▒▒ ▒@
▓ ▓▓ ▓ ▓@
█ ███ █@
██ █ @
@@
░ ░░@
▒ ▒▒▒▒ ▒@
▓ ▓▓@
█ ███ ██@
█ ████ █@
@@
░░ ░░@
▒ ▒▒▒▒▒▒▒@
▓▓ ▓▓@
███████ █@
██ ██@
@@
░ ░@
▒▒▒▒ ▒▒▒▒@
▓▓▓▓ ▓▓▓▓@
████ ████@
████ ████@
@@
░ ░░░░ ░@
▒ ▒▒▒▒ ▒@
▓ ▓▓▓▓ ▓@
█ ████ █@
██ ██@
@@
░ ░░░░ ░@
▒ ▒▒▒▒ ▒@
▓▓ ▓▓ ▓▓@
███ ███@
████ ████@
@@
░ ░░░░ ░@
▒ ▒ ▒ ▒@
▓ ▓@
█ ██ █@
█ ████ █@
@@
░ ░░░░ ░@
▒▒ ▒▒ ▒▒@
▓▓▓ ▓▓▓@
██ ██ ██@
█ ████ █@
@@
░ ░░░░ ░@
▒▒ ▒▒ ▒▒@
▓▓▓ ▓▓▓@
████ ████@
████ ████@
@@
░ ░@
▒▒▒▒▒▒ ▒▒@
▓▓▓▓ ▓▓▓▓@
██ ██████@
█ █@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
░░ ░░@
▒ ▒▒▒▒ ▒@
▓ ▓▓▓▓ ▓@
█ █@
█ ████ █@
@@
░ ░░@
▒ ▒▒▒▒ ▒@
▓ ▓▓@
█ ████ █@
█ ██@
@@
░░ ░░@
▒ ▒▒▒▒ ▒@
▓ ▓▓▓▓▓▓▓@
█ ████ █@
██ ██@
@@
░ ░░@
▒ ▒▒▒▒ ▒@
▓ ▓▓▓▓ ▓@
█ ████ █@
█ ██@
@@
░ ░@
▒ ▒▒▒▒▒▒▒@
▓ ▓▓▓@
█ ███████@
█ █@
@@
░ ░@
▒ ▒▒▒▒▒▒▒@
▓ ▓▓▓@
█ ███████@
█ ███████@
@@
░░ ░░@
▒ ▒▒▒▒▒▒▒@
▓ ▓▓▓ ▓@
█ ████ █@
██ ██@
@@
░ ░░░░ ░@
▒ ▒▒▒▒ ▒@
▓ ▓@
█ ████ █@
█ ████ █@
@@
░ ░@
▒▒▒▒ ▒▒▒▒@
▓▓▓▓ ▓▓▓▓@
████ ████@
█ █@
@@
░ ░@
▒▒▒▒▒▒▒ ▒@
▓▓▓▓▓▓▓ ▓@
█ ████ █@
██ ██@
@@
░ ░░░░ ░@
▒ ▒▒▒ ▒▒@
▓ ▓▓▓▓@
█ ███ ██@
█ ████ █@
@@
░ ░░░░░░░@
▒ ▒▒▒▒▒▒▒@
▓ ▓▓▓▓▓▓▓@
█ ███████@
█ █@
@@
░ ░░░░ ░@
▒ ▒▒ ▒@
▓ ▓@
█ █ █ █@
█ ████ █@
@@
░ ░░░ ░@
▒ ▒▒ ▒@
▓ ▓ ▓ ▓@
█ ██ █@
█ ███ █@
@@
░░ ░░@
▒ ▒▒▒▒ ▒@
▓ ▓▓▓▓ ▓@
█ ████ █@
██ ██@
@@
░ ░░@
▒ ▒▒▒▒ ▒@
▓ ▓▓@
█ ███████@
█ ███████@
@@
░░ ░░@
▒ ▒▒▒▒ ▒@
▓ ▓▓ ▓ ▓@
█ ███ █@
██ █ @
@@
░ ░░@
▒ ▒▒▒▒ ▒@
▓ ▓▓@
█ ███ ██@
█ ████ █@
@@
░░ ░░@
▒ ▒▒▒▒▒▒▒@
▓▓ ▓▓@
███████ █@
██ ██@
@@
░ ░@
▒▒▒▒ ▒▒▒▒@
▓▓▓▓ ▓▓▓▓@
████ ████@
████ ████@
@@
░ ░░░░ ░@
▒ ▒▒▒▒ ▒@
▓ ▓▓▓▓ ▓@
█ ████ █@
██ ██@
@@
░ ░░░░ ░@
▒ ▒▒▒▒ ▒@
▓▓ ▓▓ ▓▓@
███ ███@
████ ████@
@@
░ ░░░░ ░@
▒ ▒ ▒ ▒@
▓ ▓@
█ ██ █@
█ ████ █@
@@
░ ░░░░ ░@
▒▒ ▒▒ ▒▒@
▓▓▓ ▓▓▓@
██ ██ ██@
█ ████ █@
@@
░ ░░░░ ░@
▒▒ ▒▒ ▒▒@
▓▓▓ ▓▓▓@
████ ████@
████ ████@
@@
░ ░@
▒▒▒▒▒▒ ▒▒@
▓▓▓▓ ▓▓▓▓@
██ ██████@
█ █@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
`
@@ -0,0 +1,32 @@
import { RequestHandler } from 'express';
/**
* Express middleware for DNS rebinding protection.
* Validates Host header hostname (port-agnostic) against an allowed list.
*
* This is particularly important for servers without authorization or HTTPS,
* such as localhost servers or development servers. DNS rebinding attacks can
* bypass same-origin policy by manipulating DNS to point a domain to a
* localhost address, allowing malicious websites to access your local server.
*
* @param allowedHostnames - List of allowed hostnames (without ports).
* For IPv6, provide the address with brackets (e.g., '[::1]').
* @returns Express middleware function
*
* @example
* ```typescript
* const middleware = hostHeaderValidation(['localhost', '127.0.0.1', '[::1]']);
* app.use(middleware);
* ```
*/
export declare function hostHeaderValidation(allowedHostnames: string[]): RequestHandler;
/**
* Convenience middleware for localhost DNS rebinding protection.
* Allows only localhost, 127.0.0.1, and [::1] (IPv6 localhost) hostnames.
*
* @example
* ```typescript
* app.use(localhostHostValidation());
* ```
*/
export declare function localhostHostValidation(): RequestHandler;
//# sourceMappingURL=hostHeaderValidation.d.ts.map
@@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.renderCar = void 0;
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var react_1 = require("react");
function renderCar(WrappedComponent, defaults) {
function State(_a) {
var stateRef = _a.stateRef, props = _a.props;
var renderTarget = (0, react_1.useCallback)(function SideTarget() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
(0, react_1.useLayoutEffect)(function () {
stateRef.current(args);
});
return null;
}, []);
// @ts-ignore
return React.createElement(WrappedComponent, tslib_1.__assign({}, props, { children: renderTarget }));
}
var Children = React.memo(function (_a) {
var stateRef = _a.stateRef, defaultState = _a.defaultState, children = _a.children;
var _b = (0, react_1.useState)(defaultState.current), state = _b[0], setState = _b[1];
(0, react_1.useEffect)(function () {
stateRef.current = setState;
}, []);
return children.apply(void 0, state);
}, function () { return true; });
return function Combiner(props) {
var defaultState = React.useRef(defaults(props));
var ref = React.useRef(function (state) { return (defaultState.current = state); });
return (React.createElement(React.Fragment, null,
React.createElement(State, { stateRef: ref, props: props }),
React.createElement(Children, { stateRef: ref, defaultState: defaultState, children: props.children })));
};
}
exports.renderCar = renderCar;
@@ -0,0 +1,4 @@
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"mismatch", [], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
name: string;
};
export default _default;
@@ -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 WindArrowDown = createLucideIcon("WindArrowDown", [
["path", { d: "M10 2v8", key: "d4bbey" }],
["path", { d: "M12.8 21.6A2 2 0 1 0 14 18H2", key: "19kp1d" }],
["path", { d: "M17.5 10a2.5 2.5 0 1 1 2 4H2", key: "19kpjc" }],
["path", { d: "m6 6 4 4 4-4", key: "k13n16" }]
]);
export { WindArrowDown as default };
//# sourceMappingURL=wind-arrow-down.js.map
@@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/compile/jtd/types.ts"],"names":[],"mappings":";;;AAIa,QAAA,QAAQ,GAAG;IACtB,UAAU;IACV,QAAQ;IACR,eAAe;IACf,YAAY;IACZ,oBAAoB;IACpB,MAAM;IACN,MAAM;IACN,KAAK;CACG,CAAA"}
@@ -0,0 +1,145 @@
/**
* @fileoverview Rule to disallow duplicate conditions in if-else-if chains
* @author Milos Djermanovic
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
/**
* Determines whether the first given array is a subset of the second given array.
* @param {Function} comparator A function to compare two elements, should return `true` if they are equal.
* @param {Array} arrA The array to compare from.
* @param {Array} arrB The array to compare against.
* @returns {boolean} `true` if the array `arrA` is a subset of the array `arrB`.
*/
function isSubsetByComparator(comparator, arrA, arrB) {
return arrA.every(a => arrB.some(b => comparator(a, b)));
}
/**
* Splits the given node by the given logical operator.
* @param {string} operator Logical operator `||` or `&&`.
* @param {ASTNode} node The node to split.
* @returns {ASTNode[]} Array of conditions that makes the node when joined by the operator.
*/
function splitByLogicalOperator(operator, node) {
if (node.type === "LogicalExpression" && node.operator === operator) {
return [
...splitByLogicalOperator(operator, node.left),
...splitByLogicalOperator(operator, node.right),
];
}
return [node];
}
const splitByOr = splitByLogicalOperator.bind(null, "||");
const splitByAnd = splitByLogicalOperator.bind(null, "&&");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "problem",
docs: {
description: "Disallow duplicate conditions in if-else-if chains",
recommended: true,
url: "https://eslint.org/docs/latest/rules/no-dupe-else-if",
},
schema: [],
messages: {
unexpected:
"This branch can never execute. Its condition is a duplicate or covered by previous conditions in the if-else-if chain.",
},
},
create(context) {
const sourceCode = context.sourceCode;
/**
* Determines whether the two given nodes are considered to be equal. In particular, given that the nodes
* represent expressions in a boolean context, `||` and `&&` can be considered as commutative operators.
* @param {ASTNode} a First node.
* @param {ASTNode} b Second node.
* @returns {boolean} `true` if the nodes are considered to be equal.
*/
function equal(a, b) {
if (a.type !== b.type) {
return false;
}
if (
a.type === "LogicalExpression" &&
(a.operator === "||" || a.operator === "&&") &&
a.operator === b.operator
) {
return (
(equal(a.left, b.left) && equal(a.right, b.right)) ||
(equal(a.left, b.right) && equal(a.right, b.left))
);
}
return astUtils.equalTokens(a, b, sourceCode);
}
const isSubset = isSubsetByComparator.bind(null, equal);
return {
IfStatement(node) {
const test = node.test,
conditionsToCheck =
test.type === "LogicalExpression" &&
test.operator === "&&"
? [test, ...splitByAnd(test)]
: [test];
let current = node,
listToCheck = conditionsToCheck.map(c =>
splitByOr(c).map(splitByAnd),
);
while (
current.parent &&
current.parent.type === "IfStatement" &&
current.parent.alternate === current
) {
current = current.parent;
const currentOrOperands = splitByOr(current.test).map(
splitByAnd,
);
listToCheck = listToCheck.map(orOperands =>
orOperands.filter(
orOperand =>
!currentOrOperands.some(currentOrOperand =>
isSubset(currentOrOperand, orOperand),
),
),
);
if (
listToCheck.some(orOperands => orOperands.length === 0)
) {
context.report({ node: test, messageId: "unexpected" });
break;
}
}
},
};
},
};
@@ -0,0 +1,20 @@
import * as core from "../core/index.js";
import { ZodISODate, ZodISODateTime, ZodISODuration, ZodISOTime } from "./schemas.js";
export { ZodISODate, ZodISODateTime, ZodISODuration, ZodISOTime } from "./schemas.js";
export function datetime(params?: string | core.$ZodISODateTimeParams): ZodISODateTime {
return core._isoDateTime(ZodISODateTime, params);
}
export function date(params?: string | core.$ZodISODateParams): ZodISODate {
return core._isoDate(ZodISODate, params);
}
export function time(params?: string | core.$ZodISOTimeParams): ZodISOTime {
return core._isoTime(ZodISOTime, params);
}
export function duration(params?: string | core.$ZodISODurationParams): ZodISODuration {
return core._isoDuration(ZodISODuration, params);
}
@@ -0,0 +1,17 @@
import { SSROption } from './router.js';
import { AnySerializationAdapter } from './ssr/serializer/transformer.js';
export interface RouterConfigOptions<in out TSerializationAdapters, in out TDefaultSsr> {
serializationAdapters?: TSerializationAdapters;
defaultSsr?: TDefaultSsr;
}
export interface RouterConfig<in out TSerializationAdapters, in out TDefaultSsr> {
'~types': RouterConfigTypes<TSerializationAdapters, TDefaultSsr>;
serializationAdapters: TSerializationAdapters;
defaultSsr: TDefaultSsr | undefined;
}
export interface RouterConfigTypes<in out TSerializationAdapters, in out TDefaultSsr> {
serializationAdapters: TSerializationAdapters;
defaultSsr: TDefaultSsr;
}
export declare const createRouterConfig: <const TSerializationAdapters extends ReadonlyArray<AnySerializationAdapter> = [], TDefaultSsr extends SSROption = SSROption>(options: RouterConfigOptions<TSerializationAdapters, TDefaultSsr>) => RouterConfig<TSerializationAdapters, TDefaultSsr>;
export type AnyRouterConfig = RouterConfig<any, any>;
@@ -0,0 +1,34 @@
type Awaitable<T> = T | PromiseLike<T>;
type Nullable<T> = T | null | undefined;
type Arrayable<T> = T | Array<T>;
type ArgumentsType<T> = T extends (...args: infer U) => any ? U : never;
type MergeInsertions<T> = T extends object ? { [K in keyof T] : MergeInsertions<T[K]> } : T;
type DeepMerge<
F,
S
> = MergeInsertions<{ [K in keyof F | keyof S] : K extends keyof S & keyof F ? DeepMerge<F[K], S[K]> : K extends keyof S ? S[K] : K extends keyof F ? F[K] : never }>;
interface Constructable {
new (...args: any[]): any;
}
interface ParsedStack {
method: string;
file: string;
line: number;
column: number;
}
interface SerializedError {
message: string;
stacks?: ParsedStack[];
stack?: string;
name?: string;
cause?: SerializedError;
[key: string]: unknown;
}
interface TestError extends SerializedError {
cause?: TestError;
diff?: string;
actual?: string;
expected?: string;
}
export type { ArgumentsType, Arrayable, Awaitable, Constructable, DeepMerge, MergeInsertions, Nullable, ParsedStack, SerializedError, TestError };
@@ -0,0 +1 @@
export declare function isArray(arg: unknown): arg is readonly unknown[];
@@ -0,0 +1 @@
import{q as t,t as e,u as i,v as n,w as s,x as o,y as r,z as a,A as l,B as h,C as u,D as c,E as d,F as m,G as p,H as f,I as y,J as g,K as v,M as x,N as T,O as w,W as P,Q as S,R as E,T as A,U as D,V as b,X as M,Y as k,Z as C,_ as V,$ as L,k as R,a0 as B,a1 as j,b as I,o as O,a2 as F,a3 as U,a4 as z,a5 as W,a6 as N,a7 as $,a8 as G,a9 as H,aa as K,ab as Y,d as X,s as q,ac as _,ad as Z,l as J,e as Q,f as tt,ae as et,a as it,af as nt,j as st,ag as ot,ah as rt,ai as at,aj as lt,ak as ht,al as ut,am as ct,an as dt,ao as mt,r as pt,ap as ft,p as yt,P as gt,L as vt,S as xt,g as Tt}from"./size-rollup-dom-max-assets.js";import{jsx as wt}from"react/jsx-runtime";import{useContext as Pt,useId as St,useEffect as Et,useCallback as At,Component as Dt,Fragment as bt}from"react";function Mt(t){return"object"==typeof t&&null!==t}const kt=(t,e)=>i=>e(t(i)),Ct=(...t)=>t.reduce(kt),Vt=(t,e,i)=>{const n=e-t;return 0===n?1:(i-t)/n},Lt=(t,e,i)=>(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t;function Rt(e,i,n,s){if(e===i&&n===s)return t;const o=t=>function(t,e,i,n,s){let o,r,a=0;do{r=e+(i-e)/2,o=Lt(r,n,s)-t,o>0?i=r:e=r}while(Math.abs(o)>1e-7&&++a<12);return r}(t,0,1,e,n);return t=>0===t||1===t?t:Lt(o(t),i,s)}const Bt=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,jt=t=>e=>1-t(1-e),It=Rt(.33,1.53,.69,.99),Ot=jt(It),Ft=Bt(Ot),Ut=t=>t>=1?1:(t*=2)<1?.5*Ot(t):.5*(2-Math.pow(2,-10*(t-1))),zt=t=>1-Math.sin(Math.acos(t)),Wt=jt(zt),Nt=Bt(zt),$t=Rt(.42,0,1,1),Gt=Rt(0,0,.58,1),Ht=Rt(.42,0,.58,1),Kt={linear:t,easeIn:$t,easeInOut:Ht,easeOut:Gt,circIn:zt,circInOut:Nt,circOut:Wt,backIn:Ot,backInOut:Ft,backOut:It,anticipate:Ut},Yt=t=>{if(e(t)){i(4===t.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,n,s,o]=t;return Rt(e,n,s,o)}return"string"==typeof t?(i(void 0!==Kt[t],`Invalid easing type '${t}'`,"invalid-easing-type"),Kt[t]):t};function Xt(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}function qt(t,e){return i=>i>0?e:t}const _t=(t,e,i)=>{const n=t*t,s=i*(e*e-n)+n;return s<0?0:Math.sqrt(s)},Zt=[r,s,o];function Jt(t){const e=(i=t,Zt.find(t=>t.test(i)));var i;if(a(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!Boolean(e))return!1;let n=e.parse(t);return e===o&&(n=function({hue:t,saturation:e,lightness:i,alpha:n}){t/=360,i/=100;let s=0,o=0,r=0;if(e/=100){const n=i<.5?i*(1+e):i+e-i*e,a=2*i-n;s=Xt(a,n,t+1/3),o=Xt(a,n,t),r=Xt(a,n,t-1/3)}else s=o=r=i;return{red:Math.round(255*s),green:Math.round(255*o),blue:Math.round(255*r),alpha:n}}(n)),n}const Qt=(t,e)=>{const i=Jt(t),o=Jt(e);if(!i||!o)return qt(t,e);const r={...i};return t=>(r.red=_t(i.red,o.red,t),r.green=_t(i.green,o.green,t),r.blue=_t(i.blue,o.blue,t),r.alpha=n(i.alpha,o.alpha,t),s.transform(r))},te=new Set(["none","hidden"]);function ee(t,e){return i=>n(t,e,i)}function ie(t){return"number"==typeof t?ee:"string"==typeof t?l(t)?qt:h.test(t)?Qt:oe:Array.isArray(t)?ne:"object"==typeof t?h.test(t)?Qt:se:qt}function ne(t,e){const i=[...t],n=i.length,s=t.map((t,i)=>ie(t)(t,e[i]));return t=>{for(let e=0;e<n;e++)i[e]=s[e](t);return i}}function se(t,e){const i={...t,...e},n={};for(const s in i)void 0!==t[s]&&void 0!==e[s]&&(n[s]=ie(t[s])(t[s],e[s]));return t=>{for(const e in n)i[e]=n[e](t);return i}}const oe=(t,e)=>{const i=u.createTransformer(e),n=c(t),s=c(e);return n.indexes.var.length===s.indexes.var.length&&n.indexes.color.length===s.indexes.color.length&&n.indexes.number.length>=s.indexes.number.length?te.has(t)&&!s.values.length||te.has(e)&&!n.values.length?function(t,e){return te.has(t)?i=>i<=0?t:e:i=>i>=1?e:t}(t,e):Ct(ne(function(t,e){const i=[],n={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const o=e.types[s],r=t.indexes[o][n[o]],a=t.values[r]??0;i[s]=a,n[o]++}return i}(n,s),s.values),i):(a(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),qt(t,e))};function re(t,e,i){if("number"==typeof t&&"number"==typeof e&&"number"==typeof i)return n(t,e,i);return ie(t)(t,e)}const ae=t=>{const e=({timestamp:e})=>t(e);return{start:(t=!0)=>f.update(e,t),stop:()=>p(e),now:()=>d.isProcessing?d.timestamp:m.now()}},le=2e4;function he(t){let e=0;let i=t.next(e);for(;!i.done&&e<le;)e+=50,i=t.next(e);return e>=le?1/0:e}const ue=100,ce=10,de=1,me=0,pe=800,fe=.3,ye=.3,ge={granular:.01,default:2},ve={granular:.005,default:.5},xe=.01,Te=10,we=.05,Pe=1;function Se(t,e){return t*Math.sqrt(1-e*e)}const Ee=.001;const Ae=["duration","bounce"],De=["stiffness","damping","mass"];function be(t,e){return e.some(e=>void 0!==t[e])}function Me(t){let e={velocity:me,stiffness:ue,damping:ce,mass:de,isResolvedFromDuration:!1,...t};if(!be(t,De)&&be(t,Ae))if(e.velocity=0,t.visualDuration){const i=t.visualDuration,n=2*Math.PI/(1.2*i),s=n*n,o=2*g(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:de,stiffness:s,dampinLine truncated
@@ -0,0 +1,308 @@
import * as React from 'react';
import { createContextScope } from '@radix-ui/react-context';
import { useComposedRefs } from '@radix-ui/react-compose-refs';
import * as DialogPrimitive from '@radix-ui/react-dialog';
import { createDialogScope } from '@radix-ui/react-dialog';
import { composeEventHandlers } from '@radix-ui/primitive';
import { createSlottable } from '@radix-ui/react-slot';
import type { Scope } from '@radix-ui/react-context';
/* -------------------------------------------------------------------------------------------------
* AlertDialog
* -----------------------------------------------------------------------------------------------*/
const ROOT_NAME = 'AlertDialog';
type ScopedProps<P> = P & { __scopeAlertDialog?: Scope };
const [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [
createDialogScope,
]);
const useDialogScope = createDialogScope();
type DialogProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;
interface AlertDialogProps extends Omit<DialogProps, 'modal'> {}
const AlertDialog: React.FC<AlertDialogProps> = (props: ScopedProps<AlertDialogProps>) => {
const { __scopeAlertDialog, ...alertDialogProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return <DialogPrimitive.Root {...dialogScope} {...alertDialogProps} modal={true} />;
};
AlertDialog.displayName = ROOT_NAME;
/* -------------------------------------------------------------------------------------------------
* AlertDialogTrigger
* -----------------------------------------------------------------------------------------------*/
const TRIGGER_NAME = 'AlertDialogTrigger';
type AlertDialogTriggerElement = React.ComponentRef<typeof DialogPrimitive.Trigger>;
type DialogTriggerProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;
interface AlertDialogTriggerProps extends DialogTriggerProps {}
const AlertDialogTrigger = React.forwardRef<AlertDialogTriggerElement, AlertDialogTriggerProps>(
(props: ScopedProps<AlertDialogTriggerProps>, forwardedRef) => {
const { __scopeAlertDialog, ...triggerProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return <DialogPrimitive.Trigger {...dialogScope} {...triggerProps} ref={forwardedRef} />;
}
);
AlertDialogTrigger.displayName = TRIGGER_NAME;
/* -------------------------------------------------------------------------------------------------
* AlertDialogPortal
* -----------------------------------------------------------------------------------------------*/
const PORTAL_NAME = 'AlertDialogPortal';
type DialogPortalProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;
interface AlertDialogPortalProps extends DialogPortalProps {}
const AlertDialogPortal: React.FC<AlertDialogPortalProps> = (
props: ScopedProps<AlertDialogPortalProps>
) => {
const { __scopeAlertDialog, ...portalProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return <DialogPrimitive.Portal {...dialogScope} {...portalProps} />;
};
AlertDialogPortal.displayName = PORTAL_NAME;
/* -------------------------------------------------------------------------------------------------
* AlertDialogOverlay
* -----------------------------------------------------------------------------------------------*/
const OVERLAY_NAME = 'AlertDialogOverlay';
type AlertDialogOverlayElement = React.ComponentRef<typeof DialogPrimitive.Overlay>;
type DialogOverlayProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;
interface AlertDialogOverlayProps extends DialogOverlayProps {}
const AlertDialogOverlay = React.forwardRef<AlertDialogOverlayElement, AlertDialogOverlayProps>(
(props: ScopedProps<AlertDialogOverlayProps>, forwardedRef) => {
const { __scopeAlertDialog, ...overlayProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return <DialogPrimitive.Overlay {...dialogScope} {...overlayProps} ref={forwardedRef} />;
}
);
AlertDialogOverlay.displayName = OVERLAY_NAME;
/* -------------------------------------------------------------------------------------------------
* AlertDialogContent
* -----------------------------------------------------------------------------------------------*/
const CONTENT_NAME = 'AlertDialogContent';
type AlertDialogContentContextValue = {
cancelRef: React.MutableRefObject<AlertDialogCancelElement | null>;
};
const [AlertDialogContentProvider, useAlertDialogContentContext] =
createAlertDialogContext<AlertDialogContentContextValue>(CONTENT_NAME);
type AlertDialogContentElement = React.ComponentRef<typeof DialogPrimitive.Content>;
type DialogContentProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;
interface AlertDialogContentProps
extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {}
const Slottable = createSlottable('AlertDialogContent');
const AlertDialogContent = React.forwardRef<AlertDialogContentElement, AlertDialogContentProps>(
(props: ScopedProps<AlertDialogContentProps>, forwardedRef) => {
const { __scopeAlertDialog, children, ...contentProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
const contentRef = React.useRef<AlertDialogContentElement>(null);
const composedRefs = useComposedRefs(forwardedRef, contentRef);
const cancelRef = React.useRef<AlertDialogCancelElement | null>(null);
return (
<DialogPrimitive.WarningProvider
contentName={CONTENT_NAME}
titleName={TITLE_NAME}
docsSlug="alert-dialog"
>
<AlertDialogContentProvider scope={__scopeAlertDialog} cancelRef={cancelRef}>
<DialogPrimitive.Content
role="alertdialog"
{...dialogScope}
{...contentProps}
ref={composedRefs}
onOpenAutoFocus={composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {
event.preventDefault();
cancelRef.current?.focus({ preventScroll: true });
})}
onPointerDownOutside={(event) => event.preventDefault()}
onInteractOutside={(event) => event.preventDefault()}
>
{/**
* We have to use `Slottable` here as we cannot wrap the `AlertDialogContentProvider`
* around everything, otherwise the `DescriptionWarning` would be rendered straight away.
* This is because we want the accessibility checks to run only once the content is actually
* open and that behaviour is already encapsulated in `DialogContent`.
*/}
<Slottable>{children}</Slottable>
{process.env.NODE_ENV === 'development' && (
<DescriptionWarning contentRef={contentRef} />
)}
</DialogPrimitive.Content>
</AlertDialogContentProvider>
</DialogPrimitive.WarningProvider>
);
}
);
AlertDialogContent.displayName = CONTENT_NAME;
/* -------------------------------------------------------------------------------------------------
* AlertDialogTitle
* -----------------------------------------------------------------------------------------------*/
const TITLE_NAME = 'AlertDialogTitle';
type AlertDialogTitleElement = React.ComponentRef<typeof DialogPrimitive.Title>;
type DialogTitleProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;
interface AlertDialogTitleProps extends DialogTitleProps {}
const AlertDialogTitle = React.forwardRef<AlertDialogTitleElement, AlertDialogTitleProps>(
(props: ScopedProps<AlertDialogTitleProps>, forwardedRef) => {
const { __scopeAlertDialog, ...titleProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return <DialogPrimitive.Title {...dialogScope} {...titleProps} ref={forwardedRef} />;
}
);
AlertDialogTitle.displayName = TITLE_NAME;
/* -------------------------------------------------------------------------------------------------
* AlertDialogDescription
* -----------------------------------------------------------------------------------------------*/
const DESCRIPTION_NAME = 'AlertDialogDescription';
type AlertDialogDescriptionElement = React.ComponentRef<typeof DialogPrimitive.Description>;
type DialogDescriptionProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;
interface AlertDialogDescriptionProps extends DialogDescriptionProps {}
const AlertDialogDescription = React.forwardRef<
AlertDialogDescriptionElement,
AlertDialogDescriptionProps
>((props: ScopedProps<AlertDialogDescriptionProps>, forwardedRef) => {
const { __scopeAlertDialog, ...descriptionProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return <DialogPrimitive.Description {...dialogScope} {...descriptionProps} ref={forwardedRef} />;
});
AlertDialogDescription.displayName = DESCRIPTION_NAME;
/* -------------------------------------------------------------------------------------------------
* AlertDialogAction
* -----------------------------------------------------------------------------------------------*/
const ACTION_NAME = 'AlertDialogAction';
type AlertDialogActionElement = React.ComponentRef<typeof DialogPrimitive.Close>;
type DialogCloseProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;
interface AlertDialogActionProps extends DialogCloseProps {}
const AlertDialogAction = React.forwardRef<AlertDialogActionElement, AlertDialogActionProps>(
(props: ScopedProps<AlertDialogActionProps>, forwardedRef) => {
const { __scopeAlertDialog, ...actionProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return <DialogPrimitive.Close {...dialogScope} {...actionProps} ref={forwardedRef} />;
}
);
AlertDialogAction.displayName = ACTION_NAME;
/* -------------------------------------------------------------------------------------------------
* AlertDialogCancel
* -----------------------------------------------------------------------------------------------*/
const CANCEL_NAME = 'AlertDialogCancel';
type AlertDialogCancelElement = React.ComponentRef<typeof DialogPrimitive.Close>;
interface AlertDialogCancelProps extends DialogCloseProps {}
const AlertDialogCancel = React.forwardRef<AlertDialogCancelElement, AlertDialogCancelProps>(
(props: ScopedProps<AlertDialogCancelProps>, forwardedRef) => {
const { __scopeAlertDialog, ...cancelProps } = props;
const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);
const dialogScope = useDialogScope(__scopeAlertDialog);
const ref = useComposedRefs(forwardedRef, cancelRef);
return <DialogPrimitive.Close {...dialogScope} {...cancelProps} ref={ref} />;
}
);
AlertDialogCancel.displayName = CANCEL_NAME;
/* ---------------------------------------------------------------------------------------------- */
type DescriptionWarningProps = {
contentRef: React.RefObject<AlertDialogContentElement | null>;
};
const DescriptionWarning: React.FC<DescriptionWarningProps> = ({ contentRef }) => {
const MESSAGE = `\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
You can add a description to the \`${CONTENT_NAME}\` by passing a \`${DESCRIPTION_NAME}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${CONTENT_NAME}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;
React.useEffect(() => {
const hasDescription = document.getElementById(
contentRef.current?.getAttribute('aria-describedby')!
);
if (!hasDescription) console.warn(MESSAGE);
}, [MESSAGE, contentRef]);
return null;
};
const Root = AlertDialog;
const Trigger = AlertDialogTrigger;
const Portal = AlertDialogPortal;
const Overlay = AlertDialogOverlay;
const Content = AlertDialogContent;
const Action = AlertDialogAction;
const Cancel = AlertDialogCancel;
const Title = AlertDialogTitle;
const Description = AlertDialogDescription;
export {
createAlertDialogScope,
//
AlertDialog,
AlertDialogTrigger,
AlertDialogPortal,
AlertDialogOverlay,
AlertDialogContent,
AlertDialogAction,
AlertDialogCancel,
AlertDialogTitle,
AlertDialogDescription,
//
Root,
Trigger,
Portal,
Overlay,
Content,
Action,
Cancel,
Title,
Description,
};
export type {
AlertDialogProps,
AlertDialogTriggerProps,
AlertDialogPortalProps,
AlertDialogOverlayProps,
AlertDialogContentProps,
AlertDialogActionProps,
AlertDialogCancelProps,
AlertDialogTitleProps,
AlertDialogDescriptionProps,
};
@@ -0,0 +1,36 @@
/**
* @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 Radiation = createLucideIcon("Radiation", [
["path", { d: "M12 12h.01", key: "1mp3jc" }],
[
"path",
{
d: "M7.5 4.2c-.3-.5-.9-.7-1.3-.4C3.9 5.5 2.3 8.1 2 11c-.1.5.4 1 1 1h5c0-1.5.8-2.8 2-3.4-1.1-1.9-2-3.5-2.5-4.4z",
key: "wy49g3"
}
],
[
"path",
{
d: "M21 12c.6 0 1-.4 1-1-.3-2.9-1.8-5.5-4.1-7.1-.4-.3-1.1-.2-1.3.3-.6.9-1.5 2.5-2.6 4.3 1.2.7 2 2 2 3.5h5z",
key: "vklnvr"
}
],
[
"path",
{
d: "M7.5 19.8c-.3.5-.1 1.1.4 1.3 2.6 1.2 5.6 1.2 8.2 0 .5-.2.7-.8.4-1.3-.5-.9-1.4-2.5-2.5-4.3-1.2.7-2.8.7-4 0-1.1 1.8-2 3.4-2.5 4.3z",
key: "wkdf1o"
}
]
]);
export { Radiation as default };
//# sourceMappingURL=radiation.js.map
@@ -0,0 +1 @@
{"version":3,"file":"code-square.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1 @@
{"version":3,"names":["_gensync","data","require","_async","_util","synchronize","gen","gensync","sync","genTrue","makeWeakCache","handler","makeCachedFunction","WeakMap","makeWeakCacheSync","makeStrongCache","Map","makeStrongCacheSync","CallCache","callCacheSync","callCacheAsync","futureCache","cachedFunction","arg","asyncContext","isAsync","callCache","cached","getCachedValueOrWait","valid","value","cache","CacheConfigurator","handlerResult","finishLock","isIterableIterator","onFirstPause","setupAsyncLocks","updateFunctionCache","delete","release","getCachedValue","cachedValue","get","waitFor","promise","config","Lock","configured","forever","deactivate","mode","set","validator","push","constructor","_active","_never","_forever","_invalidate","_configured","_pairs","_data","simple","makeSimpleConfigurator","Error","never","using","key","fn","maybeAsync","isThenable","then","invalidate","pairs","cacheFn","val","assertSimpleType","cb","released","_resolve","Promise","resolve"],"sources":["../../src/config/caching.ts"],"sourcesContent":["import gensync from \"gensync\";\nimport type { Handler } from \"gensync\";\nimport {\n maybeAsync,\n isAsync,\n onFirstPause,\n waitFor,\n isThenable,\n} from \"../gensync-utils/async.ts\";\nimport { isIterableIterator } from \"./util.ts\";\n\nexport type { CacheConfigurator };\n\nexport type SimpleCacheConfigurator = {\n (forever: boolean): void;\n <T extends SimpleType>(handler: () => T): T;\n\n forever: () => void;\n never: () => void;\n using: <T extends SimpleType>(handler: () => T) => T;\n invalidate: <T extends SimpleType>(handler: () => T) => T;\n};\n\nexport type CacheEntry<ResultT, SideChannel> = {\n value: ResultT;\n valid: (channel: SideChannel) => Handler<boolean>;\n}[];\n\nconst synchronize = <ArgsT extends unknown[], ResultT>(\n gen: (...args: ArgsT) => Handler<ResultT>,\n): ((...args: ArgsT) => ResultT) => {\n return gensync(gen).sync;\n};\n\n// eslint-disable-next-line require-yield\nfunction* genTrue() {\n return true;\n}\n\nexport function makeWeakCache<ArgT extends object, ResultT, SideChannel>(\n handler: (\n arg: ArgT,\n cache: CacheConfigurator<SideChannel>,\n ) => Handler<ResultT> | ResultT,\n): (arg: ArgT, data: SideChannel) => Handler<ResultT> {\n return makeCachedFunction<ArgT, ResultT, SideChannel>(WeakMap, handler);\n}\n\nexport function makeWeakCacheSync<ArgT extends object, ResultT, SideChannel>(\n handler: (arg: ArgT, cache?: CacheConfigurator<SideChannel>) => ResultT,\n): (arg: ArgT, data?: SideChannel) => ResultT {\n return synchronize<[ArgT, SideChannel], ResultT>(\n makeWeakCache<ArgT, ResultT, SideChannel>(handler),\n );\n}\n\nexport function makeStrongCache<ArgT, ResultT, SideChannel>(\n handler: (\n arg: ArgT,\n cache: CacheConfigurator<SideChannel>,\n ) => Handler<ResultT> | ResultT,\n): (arg: ArgT, data: SideChannel) => Handler<ResultT> {\n return makeCachedFunction<ArgT, ResultT, SideChannel>(Map, handler);\n}\n\nexport function makeStrongCacheSync<ArgT, ResultT, SideChannel>(\n handler: (arg: ArgT, cache?: CacheConfigurator<SideChannel>) => ResultT,\n): (arg: ArgT, data?: SideChannel) => ResultT {\n return synchronize<[ArgT, SideChannel], ResultT>(\n makeStrongCache<ArgT, ResultT, SideChannel>(handler),\n );\n}\n\n/* NOTE: Part of the logic explained in this comment is explained in the\n * getCachedValueOrWait and setupAsyncLocks functions.\n *\n * > There are only two hard things in Computer Science: cache invalidation and naming things.\n * > -- Phil Karlton\n *\n * I don't know if Phil was also thinking about handling a cache whose invalidation function is\n * defined asynchronously is considered, but it is REALLY hard to do correctly.\n *\n * The implemented logic (only when gensync is run asynchronously) is the following:\n * 1. If there is a valid cache associated to the current \"arg\" parameter,\n * a. RETURN the cached value\n * 3. If there is a FinishLock associated to the current \"arg\" parameter representing a valid cache,\n * a. Wait for that lock to be released\n * b. RETURN the value associated with that lock\n * 5. Start executing the function to be cached\n * a. If it pauses on a promise, then\n * i. Let FinishLock be a new lock\n * ii. Store FinishLock as associated to the current \"arg\" parameter\n * iii. Wait for the function to finish executing\n * iv. Release FinishLock\n * v. Send the function result to anyone waiting on FinishLock\n * 6. Store the result in the cache\n * 7. RETURN the result\n */\nfunction makeCachedFunction<ArgT, ResultT, SideChannel>(\n CallCache: new <Cached>() => CacheMap<ArgT, Cached, SideChannel>,\n handler: (\n arg: ArgT,\n cache: CacheConfigurator<SideChannel>,\n ) => Handler<ResultT> | ResultT,\n): (arg: ArgT, data: SideChannel) => Handler<ResultT> {\n const callCacheSync = new CallCache<ResultT>();\n const callCacheAsync = new CallCache<RLine truncated
@@ -0,0 +1 @@
{"version":3,"file":"stagger.mjs","sources":["../../../src/utils/stagger.ts"],"sourcesContent":["import { Easing, easingDefinitionToFunction } from \"motion-utils\"\nimport { DynamicOption } from \"../animation/types\"\n\nexport type StaggerOrigin = \"first\" | \"last\" | \"center\" | number\n\nexport type StaggerOptions = {\n startDelay?: number\n from?: StaggerOrigin\n ease?: Easing\n}\n\nexport function getOriginIndex(from: StaggerOrigin, total: number) {\n if (from === \"first\") {\n return 0\n } else {\n const lastIndex = total - 1\n return from === \"last\" ? lastIndex : lastIndex / 2\n }\n}\n\nexport function stagger(\n duration: number = 0.1,\n { startDelay = 0, from = 0, ease }: StaggerOptions = {}\n): DynamicOption<number> {\n return (i: number, total: number) => {\n const fromIndex =\n typeof from === \"number\" ? from : getOriginIndex(from, total)\n const distance = Math.abs(fromIndex - i)\n let delay = duration * distance\n\n if (ease) {\n const maxDelay = total * duration\n const easingFunction = easingDefinitionToFunction(ease)\n delay = easingFunction(delay / maxDelay) * maxDelay\n }\n\n return startDelay + delay\n }\n}\n"],"names":[],"mappings":";;AAWM,SAAU,cAAc,CAAC,IAAmB,EAAE,KAAa,EAAA;AAC7D,IAAA,IAAI,IAAI,KAAK,OAAO,EAAE;AAClB,QAAA,OAAO,CAAC;IACZ;SAAO;AACH,QAAA,MAAM,SAAS,GAAG,KAAK,GAAG,CAAC;AAC3B,QAAA,OAAO,IAAI,KAAK,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,CAAC;IACtD;AACJ;SAEgB,OAAO,CACnB,QAAA,GAAmB,GAAG,EACtB,EAAE,UAAU,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,KAAqB,EAAE,EAAA;AAEvD,IAAA,OAAO,CAAC,CAAS,EAAE,KAAa,KAAI;AAChC,QAAA,MAAM,SAAS,GACX,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,GAAG,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC;QACjE,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,CAAC,CAAC;AACxC,QAAA,IAAI,KAAK,GAAG,QAAQ,GAAG,QAAQ;QAE/B,IAAI,IAAI,EAAE;AACN,YAAA,MAAM,QAAQ,GAAG,KAAK,GAAG,QAAQ;AACjC,YAAA,MAAM,cAAc,GAAG,0BAA0B,CAAC,IAAI,CAAC;YACvD,KAAK,GAAG,cAAc,CAAC,KAAK,GAAG,QAAQ,CAAC,GAAG,QAAQ;QACvD;QAEA,OAAO,UAAU,GAAG,KAAK;AAC7B,IAAA,CAAC;AACL;;;;"}
@@ -0,0 +1 @@
{"version":3,"names":["_validate","require","_deprecationWarning","utils","validateInternal","validate","NODE_FIELDS","bigIntLiteral","value","toString","node","type","defs","BigIntLiteral","arrayExpression","elements","ArrayExpression","assignmentExpression","operator","left","right","AssignmentExpression","binaryExpression","BinaryExpression","interpreterDirective","InterpreterDirective","directive","Directive","directiveLiteral","DirectiveLiteral","blockStatement","body","directives","BlockStatement","breakStatement","label","BreakStatement","callExpression","callee","_arguments","arguments","CallExpression","catchClause","param","CatchClause","conditionalExpression","test","consequent","alternate","ConditionalExpression","continueStatement","ContinueStatement","debuggerStatement","doWhileStatement","DoWhileStatement","emptyStatement","expressionStatement","expression","ExpressionStatement","file","program","comments","tokens","File","forInStatement","ForInStatement","forStatement","init","update","ForStatement","functionDeclaration","id","params","generator","async","FunctionDeclaration","functionExpression","FunctionExpression","identifier","name","Identifier","ifStatement","IfStatement","labeledStatement","LabeledStatement","stringLiteral","StringLiteral","numericLiteral","NumericLiteral","nullLiteral","booleanLiteral","BooleanLiteral","regExpLiteral","pattern","flags","RegExpLiteral","logicalExpression","LogicalExpression","memberExpression","object","property","computed","optional","MemberExpression","newExpression","NewExpression","sourceType","interpreter","Program","objectExpression","properties","ObjectExpression","objectMethod","kind","key","ObjectMethod","objectProperty","shorthand","decorators","ObjectProperty","restElement","argument","RestElement","returnStatement","ReturnStatement","sequenceExpression","expressions","SequenceExpression","parenthesizedExpression","ParenthesizedExpression","switchCase","SwitchCase","switchStatement","discriminant","cases","SwitchStatement","thisExpression","throwStatement","ThrowStatement","tryStatement","block","handler","finalizer","TryStatement","unaryExpression","prefix","UnaryExpression","updateExpression","UpdateExpression","variableDeclaration","declarations","VariableDeclaration","variableDeclarator","VariableDeclarator","whileStatement","WhileStatement","withStatement","WithStatement","assignmentPattern","AssignmentPattern","arrayPattern","ArrayPattern","arrowFunctionExpression","ArrowFunctionExpression","classBody","ClassBody","classExpression","superClass","ClassExpression","classDeclaration","ClassDeclaration","exportAllDeclaration","source","attributes","ExportAllDeclaration","exportDefaultDeclaration","declaration","ExportDefaultDeclaration","exportNamedDeclaration","specifiers","ExportNamedDeclaration","exportSpecifier","local","exported","ExportSpecifier","forOfStatement","_await","await","ForOfStatement","importDeclaration","ImportDeclaration","importDefaultSpecifier","ImportDefaultSpecifier","importNamespaceSpecifier","ImportNamespaceSpecifier","importSpecifier","imported","ImportSpecifier","importExpression","options","ImportExpression","metaProperty","meta","MetaProperty","classMethod","_static","static","ClassMethod","objectPattern","ObjectPattern","spreadElement","SpreadElement","_super","taggedTemplateExpression","tag","quasi","TaggedTemplateExpression","templateElement","tail","TemplateElement","templateLiteral","quasis","TemplateLiteral","yieldExpression","delegate","YieldExpression","awaitExpression","AwaitExpression","_import","exportNamespaceSpecifier","ExportNamespaceSpecifier","optionalMemberExpression","OptionalMemberExpression","optionalCallExpression","OptionalCallExpression","classProperty","typeAnnotation","ClassProperty","classAccessorProperty","ClassAccessorProperty","classPrivateProperty","ClassPrivateProperty","classPrivateMethod","ClassPrivateMethod","privateName","PrivateName","staticBlock","StaticBlock","importAttribute","ImportAttribute","anyTypeAnnotation","arrayTypeAnnotation","elementType","ArrayTypeAnnotation","booleanTypeAnnotation","booleanLiteralTypeAnnotation","BooleanLiteralTypeAnnotation","nullLiteralTypeAnnotation","classImplements","typeParameters","ClassImplements","declareClass","_extends","extends","DeclareClass","declareFunction","DeclareFunction","declareInterface","DeclareInterface","declareModule","DeclareModule","declareModuleExports","DeclareModuleExports","declareTypeAlias","DeclareTypeAlias","declareOpaqueType","supertype","DeclareOpaqueType","declareVariable","DeclareVariable","declareExportDeclaration","DeclareExportDeclaration","declareExportAllDeclaration","DeclareExportAllDeclaration","declaredPredicate","DeclaredPredicate","existsTypeAnnotation","functionTypeAnnotation","rest","returnType","FunctionTypeAnnotation","functionTypeParam","FunctionTypeParam","genericTypeAnnotation","GenericTypeAnnotation","inferredPredicate","interfaceExtends","InterfaceExtends","interfaceDeclaration","InterLine truncated
@@ -0,0 +1,881 @@
import { globalRegistry } from "../core/registries.js";
import { assignProp, isPlainObject } from "../core/util.js";
import * as _checks from "./checks.js";
import * as _iso from "./iso.js";
import * as _schemas from "./schemas.js";
// Local z object to avoid circular dependency with ../index.js
const z = {
..._schemas,
..._checks,
iso: _iso,
};
// Keys that are recognized and handled by the conversion logic
const RECOGNIZED_KEYS = /*@__PURE__*/ new Set([
// Schema identification
"$schema",
"$ref",
"$defs",
"definitions",
// Core schema keywords
"$id",
"id",
"$comment",
"$anchor",
"$vocabulary",
"$dynamicRef",
"$dynamicAnchor",
// Type
"type",
"enum",
"const",
// Composition
"anyOf",
"oneOf",
"allOf",
"not",
// Object
"properties",
"required",
"additionalProperties",
"patternProperties",
"propertyNames",
"minProperties",
"maxProperties",
// Array
"items",
"prefixItems",
"additionalItems",
"minItems",
"maxItems",
"uniqueItems",
"contains",
"minContains",
"maxContains",
// String
"minLength",
"maxLength",
"pattern",
"format",
// Number
"minimum",
"maximum",
"exclusiveMinimum",
"exclusiveMaximum",
"multipleOf",
// Already handled metadata
"description",
"default",
// Content
"contentEncoding",
"contentMediaType",
"contentSchema",
// Unsupported (error-throwing)
"unevaluatedItems",
"unevaluatedProperties",
"if",
"then",
"else",
"dependentSchemas",
"dependentRequired",
// OpenAPI
"nullable",
"readOnly",
]);
function detectVersion(schema, defaultTarget) {
const $schema = schema.$schema;
if ($schema === "https://json-schema.org/draft/2020-12/schema") {
return "draft-2020-12";
}
if ($schema === "http://json-schema.org/draft-07/schema#") {
return "draft-7";
}
if ($schema === "http://json-schema.org/draft-04/schema#") {
return "draft-4";
}
// Use defaultTarget if provided, otherwise default to draft-2020-12
return defaultTarget ?? "draft-2020-12";
}
// Positional schemas constrain the elements that are present; only minItems makes them required.
function applyMinItems(items, minItems) {
return items.map((item, index) => (index < minItems ? item : item.optional()));
}
// Inverse of the encoding applied to $ref pointer segments in to-json-schema.ts. Per RFC 6901 the `~1` replacement must run before `~0`.
function decodeJSONPointerSegment(segment) {
return segment.replace(/~1/g, "/").replace(/~0/g, "~");
}
function resolveRef(ref, ctx) {
if (!ref.startsWith("#")) {
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
}
const path = ref.slice(1).split("/").filter(Boolean);
// Handle root reference "#"
if (path.length === 0) {
return ctx.rootSchema;
}
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
if (path[0] === defsKey) {
const key = path[1] === undefined ? undefined : decodeJSONPointerSegment(path[1]);
if (!key || !ctx.defs[key]) {
throw new Error(`Reference not found: ${ref}`);
}
return ctx.defs[key];
}
throw new Error(`Reference not found: ${ref}`);
}
/**
* Enforces the keywords that constrain an object's own keys — `propertyNames`,
* `minProperties`, `maxProperties` — before `objectSchema` runs. The guard has
* to see the raw input: an object parse drops `__proto__` and can add keys from
* a property `default`, so its output is not the set of names the instance
* actually carried.
*/
function checkObjectGuards(objectSchema, guards) {
// An identity transform, not z.any(), so `toJSONSchema` reports the object on both the input and the output side of the pipe.
const guard = z
.transform((value) => value)
.check((payload) => {
const value = payload.value;
if (typeof value !== "object" || value === null || Array.isArray(value))
return;
const keys = Object.getOwnPropertyNames(value);
if (guards.minProperties !== undefined && keys.length < guards.minProperties) {
payload.issues.push({
origin: "object",
code: "too_small",
minimum: guards.minProperties,
inclusive: true,
message: `Too small: expected object to have >=${guards.minProperties} properties`,
input: value,
inst: objectSchema,
continue: true,
});
}
if (guards.maxProperties !== undefined && keys.length > guards.maxProperties) {
payload.issues.push({
origin: "object",
code: "too_big",
maximum: guards.maxProperties,
inclusive: true,
message: `Too big: expected object to have <=${guards.maxProperties} properties`,
input: value,
inst: objectSchema,
continue: true,
});
}
if (guards.keySchema) {
for (const key of keys) {
const result = guards.keySchema.safeParse(key);
if (result.success)
continue;
payload.issues.push({
code: "invalid_key",
origin: "record",
issues: result.error.issues,
input: key,
path: [key],
continue: true,
});
}
}
});
return guard.pipe(objectSchema);
}
/**
* An injective string for JSON data: two values share a key exactly when `uniqueItems` calls them
* equal, so duplicate detection is a Map lookup rather than a pairwise walk. Strings and keys are
* length-prefixed so no value can spell another one. `null` means "never equal to anything" — a
* cycle or a NaN, neither of which JSON can express.
*/
function canonicalKey(value, seen) {
if (value === null)
return "z";
const type = typeof value;
if (type !== "object") {
if (type === "number" && Number.isNaN(value))
return null;
const raw = String(value);
return `${type[0]}${raw.length}:${raw}`;
}
if (seen.has(value))
return null;
seen.add(value);
try {
if (Array.isArray(value)) {
const parts = [];
for (const item of value) {
const key = canonicalKey(item, seen);
if (key === null)
return null;
parts.push(key);
}
return `a${parts.length}:[${parts.join(",")}]`;
}
const keys = Object.keys(value).sort();
const parts = [];
for (const k of keys) {
const key = canonicalKey(value[k], seen);
if (key === null)
return null;
parts.push(`${k.length}:${k}=${key}`);
}
return `o${parts.length}:{${parts.join(",")}}`;
}
finally {
seen.delete(value);
}
}
// keywords whose value is a schema or an array of them
const SCHEMA_KEYWORDS = /*@__PURE__*/ new Set([
"items",
"prefixItems",
"additionalItems",
"additionalProperties",
"contains",
"propertyNames",
"not",
"if",
"then",
"else",
"allOf",
"anyOf",
"oneOf",
"unevaluatedItems",
"unevaluatedProperties",
"contentSchema",
]);
// keywords whose value maps names to schemas. draft-7 `dependencies` also allows an array of property names, which holds no schema to walk
const SCHEMA_MAP_KEYWORDS = /*@__PURE__*/ new Set([
"properties",
"patternProperties",
"dependentSchemas",
"dependencies",
"$defs",
"definitions",
]);
/**
* True when a subschema holds a `$ref` anywhere a schema can appear. Only those positions are
* walked: `$ref` under `default` or an `x-` annotation is instance data with an ordinary key, and
* reading it as a reference would drop a constraint that resolves perfectly well.
*/
function containsRef(value) {
if (typeof value !== "object" || value === null)
return false;
if (Array.isArray(value))
return value.some(containsRef);
if (typeof value.$ref === "string")
return true;
return Object.entries(value).some(([key, sub]) => {
if (SCHEMA_KEYWORDS.has(key))
return containsRef(sub);
if (!SCHEMA_MAP_KEYWORDS.has(key) || typeof sub !== "object" || sub === null)
return false;
return Object.values(sub).some(containsRef);
});
}
function plural(n) {
return n === 1 ? "element" : "elements";
}
/**
* Enforces `uniqueItems` and the `contains` family before `arraySchema` runs, for the same reason
* `checkObjectGuards` runs pre-pipe: an item parse can apply a nested `default`, so the parsed
* array is not the instance the keywords are defined over. A guard issue aborts the pipe, so
* `minItems`/`maxItems` are not also reported on the same parse — instance correctness is worth
* more than co-reporting two issues.
*/
function checkArrayGuards(arraySchema, guards) {
// An identity transform, not z.any(), so `toJSONSchema` reports the array on both the input and the output side of the pipe.
const guard = z
.transform((value) => value)
.check((payload) => {
const items = payload.value;
if (!Array.isArray(items))
return;
if (guards.uniqueItems === true) {
const firstSeen = new Map();
for (let i = 0; i < items.length; i++) {
const key = canonicalKey(items[i], new Set());
if (key === null)
continue;
const first = firstSeen.get(key);
if (first === undefined) {
firstSeen.set(key, i);
continue;
}
payload.issues.push({
code: "custom",
message: `Array items must be unique: element at index ${i} duplicates the one at index ${first}`,
input: items,
path: [i],
continue: true,
});
}
}
if (guards.containsSchema) {
const minContains = guards.minContains ?? 1;
// one past the ceiling already proves the failure, and nothing above it changes the verdict
const ceiling = guards.maxContains !== undefined ? guards.maxContains + 1 : Number.POSITIVE_INFINITY;
let matches = 0;
for (const item of items) {
if (guards.containsSchema.safeParse(item).success && ++matches >= ceiling)
break;
}
if (matches < minContains) {
// the scan ran to the end, so this count is exact
payload.issues.push({
code: "custom",
message: `Array must contain at least ${minContains} matching ${plural(minContains)}; found ${matches}`,
input: items,
continue: true,
});
}
if (guards.maxContains !== undefined && matches > guards.maxContains) {
payload.issues.push({
code: "custom",
message: `Array must contain at most ${guards.maxContains} matching ${plural(guards.maxContains)}`,
input: items,
continue: true,
});
}
}
});
return guard.pipe(arraySchema);
}
function getTupleRest(restSchema, ctx) {
if (restSchema === false) {
return undefined;
}
if (restSchema === undefined || restSchema === true) {
return z.any();
}
return convertSchema(restSchema, ctx);
}
// the RFC 3339 full-time keyword, narrower than `z.iso.time()`; local because sharing it via `timeSource` pins that builder into every bundle (+139 B gzipped on a mini `z.boolean()`)
const fullTime = /^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;
function convertBaseSchema(schema, ctx) {
// Handle unsupported features
if (schema.not !== undefined) {
// Special case: { not: {} } represents never
if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
return z.never();
}
throw new Error("not is not supported in Zod (except { not: {} } for never)");
}
if (schema.unevaluatedItems !== undefined) {
throw new Error("unevaluatedItems is not supported");
}
if (schema.unevaluatedProperties !== undefined) {
throw new Error("unevaluatedProperties is not supported");
}
if (schema.if !== undefined || schema.then !== undefined || schema.else !== undefined) {
throw new Error("Conditional schemas (if/then/else) are not supported");
}
if (schema.dependentSchemas !== undefined || schema.dependentRequired !== undefined) {
throw new Error("dependentSchemas and dependentRequired are not supported");
}
// Handle $ref
if (schema.$ref) {
const refPath = schema.$ref;
if (ctx.refs.has(refPath)) {
return ctx.refs.get(refPath);
}
if (ctx.processing.has(refPath)) {
// Circular reference - use lazy
return z.lazy(() => {
if (!ctx.refs.has(refPath)) {
throw new Error(`Circular reference not resolved: ${refPath}`);
}
return ctx.refs.get(refPath);
});
}
ctx.processing.add(refPath);
const resolved = resolveRef(refPath, ctx);
const zodSchema = convertSchema(resolved, ctx);
ctx.refs.set(refPath, zodSchema);
ctx.processing.delete(refPath);
return zodSchema;
}
// Handle enum
if (schema.enum !== undefined) {
const enumValues = schema.enum;
// Special case: OpenAPI 3.0 null representation { type: "string", nullable: true, enum: [null] }
if (ctx.version === "openapi-3.0" &&
schema.nullable === true &&
enumValues.length === 1 &&
enumValues[0] === null) {
return z.null();
}
if (enumValues.length === 0) {
return z.never();
}
if (enumValues.length === 1) {
return z.literal(enumValues[0]);
}
// Check if all values are strings
if (enumValues.every((v) => typeof v === "string")) {
return z.enum(enumValues);
}
// Mixed types - use union of literals
const literalSchemas = enumValues.map((v) => z.literal(v));
if (literalSchemas.length < 2) {
return literalSchemas[0];
}
return z.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
}
// Handle const
if (schema.const !== undefined) {
return z.literal(schema.const);
}
// Handle type
const type = schema.type;
if (Array.isArray(type)) {
// Expand type array into anyOf union
const typeSchemas = type.map((t) => {
const typeSchema = { ...schema, type: t };
return convertBaseSchema(typeSchema, ctx);
});
if (typeSchemas.length === 0) {
return z.never();
}
if (typeSchemas.length === 1) {
return typeSchemas[0];
}
return z.union(typeSchemas);
}
if (!type) {
// No type specified - empty schema (any)
return z.any();
}
let zodSchema;
switch (type) {
case "string": {
let stringSchema = z.string();
// Apply format using .check() with Zod format functions
if (schema.format) {
const format = schema.format;
// Map common formats to Zod check functions
if (format === "email") {
stringSchema = stringSchema.check(z.email());
}
else if (format === "uri" || format === "uri-reference") {
stringSchema = stringSchema.check(z.url());
}
else if (format === "uuid" || format === "guid") {
stringSchema = stringSchema.check(z.uuid());
}
else if (format === "date-time") {
stringSchema = stringSchema.check(z.iso.datetime({ offset: true }));
}
else if (format === "date") {
stringSchema = stringSchema.check(z.iso.date());
}
else if (format === "time") {
stringSchema = stringSchema.check(z.regex(fullTime));
}
else if (format === "duration") {
stringSchema = stringSchema.check(z.iso.duration());
}
else if (format === "hostname") {
stringSchema = stringSchema.check(z.hostname());
}
else if (format === "ipv4") {
stringSchema = stringSchema.check(z.ipv4());
}
else if (format === "ipv6") {
stringSchema = stringSchema.check(z.ipv6());
}
else if (format === "mac") {
stringSchema = stringSchema.check(z.mac());
}
else if (format === "cidr") {
stringSchema = stringSchema.check(z.cidrv4());
}
else if (format === "cidr-v6") {
stringSchema = stringSchema.check(z.cidrv6());
}
else if (format === "base64") {
stringSchema = stringSchema.check(z.base64());
}
else if (format === "base64url") {
stringSchema = stringSchema.check(z.base64url());
}
else if (format === "e164") {
stringSchema = stringSchema.check(z.e164());
}
else if (format === "credit_card") {
stringSchema = stringSchema.check(z.creditCard());
}
else if (format === "iban") {
stringSchema = stringSchema.check(z.iban());
}
else if (format === "jwt") {
stringSchema = stringSchema.check(z.jwt());
}
else if (format === "emoji") {
stringSchema = stringSchema.check(z.emoji());
}
else if (format === "nanoid") {
stringSchema = stringSchema.check(z.nanoid());
}
else if (format === "cuid") {
stringSchema = stringSchema.check(z.cuid());
}
else if (format === "cuid2") {
stringSchema = stringSchema.check(z.cuid2());
}
else if (format === "ulid") {
stringSchema = stringSchema.check(z.ulid());
}
else if (format === "xid") {
stringSchema = stringSchema.check(z.xid());
}
else if (format === "ksuid") {
stringSchema = stringSchema.check(z.ksuid());
}
// Note: json-string format is not currently supported by Zod
// Custom formats are ignored - keep as plain string
}
// Apply constraints
if (typeof schema.minLength === "number") {
stringSchema = stringSchema.min(schema.minLength);
}
if (typeof schema.maxLength === "number") {
stringSchema = stringSchema.max(schema.maxLength);
}
if (schema.pattern) {
// JSON Schema patterns are not implicitly anchored (match anywhere in string)
stringSchema = stringSchema.regex(new RegExp(schema.pattern));
}
zodSchema = stringSchema;
break;
}
case "number":
case "integer": {
let numberSchema = type === "integer" ? z.number().int() : z.number();
// Apply constraints
// In draft-04, `exclusiveMinimum: true` makes the sibling `minimum` exclusive rather than an independent bound, so the inclusive `.min()` is skipped; emitting it too would be dominated by the exclusive check and report a second, weaker issue.
if (typeof schema.minimum === "number" && schema.exclusiveMinimum !== true) {
numberSchema = numberSchema.min(schema.minimum);
}
if (typeof schema.maximum === "number" && schema.exclusiveMaximum !== true) {
numberSchema = numberSchema.max(schema.maximum);
}
if (typeof schema.exclusiveMinimum === "number") {
numberSchema = numberSchema.gt(schema.exclusiveMinimum);
}
else if (schema.exclusiveMinimum === true && typeof schema.minimum === "number") {
numberSchema = numberSchema.gt(schema.minimum);
}
if (typeof schema.exclusiveMaximum === "number") {
numberSchema = numberSchema.lt(schema.exclusiveMaximum);
}
else if (schema.exclusiveMaximum === true && typeof schema.maximum === "number") {
numberSchema = numberSchema.lt(schema.maximum);
}
if (typeof schema.multipleOf === "number") {
numberSchema = numberSchema.multipleOf(schema.multipleOf);
}
zodSchema = numberSchema;
break;
}
case "boolean": {
zodSchema = z.boolean();
break;
}
case "null": {
zodSchema = z.null();
break;
}
case "object": {
const shape = {};
const properties = schema.properties || {};
const requiredSet = new Set(schema.required || []);
const additionalSchema = typeof schema.additionalProperties === "object"
? convertSchema(schema.additionalProperties, ctx)
: undefined;
// Convert properties - mark optional ones
for (const [key, propSchema] of Object.entries(properties)) {
const propZodSchema = convertSchema(propSchema, ctx);
// If not in required array, make it optional. assignProp so a __proto__ key becomes an own property instead of hitting the inherited setter
assignProp(shape, key, requiredSet.has(key) ? propZodSchema : propZodSchema.optional());
}
// Handle patternProperties
if (schema.patternProperties) {
// patternProperties: keys matching pattern must satisfy corresponding schema. Use loose records so non-matching keys pass through
const patternProps = schema.patternProperties;
const patternKeys = Object.keys(patternProps);
const looseRecords = [];
for (const pattern of patternKeys) {
const patternValue = convertSchema(patternProps[pattern], ctx);
const keySchema = z.string().regex(new RegExp(pattern));
looseRecords.push(z.looseRecord(keySchema, patternValue));
}
// Build intersection: object schema + all pattern property records
const schemasToIntersect = [];
if (Object.keys(shape).length > 0) {
// Use passthrough so patternProperties can validate additional keys
schemasToIntersect.push(z.object(shape).passthrough());
}
schemasToIntersect.push(...looseRecords);
if (schemasToIntersect.length === 0) {
zodSchema = z.object({}).passthrough();
}
else if (schemasToIntersect.length === 1) {
zodSchema = schemasToIntersect[0];
}
else {
// Chain intersections: (A & B) & C & D ...
let result = z.intersection(schemasToIntersect[0], schemasToIntersect[1]);
for (let i = 2; i < schemasToIntersect.length; i++) {
result = z.intersection(result, schemasToIntersect[i]);
}
zodSchema = result;
}
// When additionalProperties is false, reject keys that are neither defined in properties nor matched by any patternProperty.
if (schema.additionalProperties === false) {
const propertyKeys = Object.keys(shape);
const patterns = patternKeys.map((p) => new RegExp(p));
const basePatternSchema = zodSchema;
zodSchema = zodSchema.check((payload) => {
if (!isPlainObject(payload.value))
return;
const unrecognized = [];
for (const key of Object.keys(payload.value)) {
if (propertyKeys.includes(key))
continue;
if (patterns.some((regex) => regex.test(key)))
continue;
unrecognized.push(key);
}
if (unrecognized.length) {
payload.issues.push({
code: "unrecognized_keys",
keys: unrecognized,
input: payload.value,
inst: basePatternSchema,
});
}
});
}
}
else {
// Handle additionalProperties. In JSON Schema, additionalProperties defaults to true (allow any extra properties). In Zod, objects strip unknown keys by default, so we need to handle this explicitly
const objectSchema = z.object(shape);
if (schema.additionalProperties === false) {
// Strict mode - no extra properties allowed
zodSchema = objectSchema.strict();
}
else if (additionalSchema) {
// Extra properties must match the specified schema
zodSchema = objectSchema.catchall(additionalSchema);
}
else {
// additionalProperties is true or undefined - allow any extra properties (passthrough)
zodSchema = objectSchema.passthrough();
}
}
// propertyNames constrains key *names* only, and says nothing about which keys are required or how their values validate. Layering it on top of the result keeps properties/patternProperties/additionalProperties composing underneath. `true` allows every name, so it needs no guard.
const hasKeyGuard = schema.propertyNames !== undefined && schema.propertyNames !== true;
const minProperties = typeof schema.minProperties === "number" ? schema.minProperties : undefined;
const maxProperties = typeof schema.maxProperties === "number" ? schema.maxProperties : undefined;
if (hasKeyGuard || minProperties !== undefined || maxProperties !== undefined) {
let keySchema;
if (hasKeyGuard) {
// Keys are always strings, so a propertyNames subschema that omits `type` still constrains them — without this it would convert to z.any().
const keyJSONSchema = typeof schema.propertyNames === "object" && schema.propertyNames.type === undefined
? { type: "string", ...schema.propertyNames }
: schema.propertyNames;
keySchema = convertSchema(keyJSONSchema, ctx);
}
zodSchema = checkObjectGuards(zodSchema, { keySchema, minProperties, maxProperties });
}
break;
}
case "array": {
// Check if this is a tuple (prefixItems or items as array)
const prefixItems = schema.prefixItems;
const items = schema.items;
if (prefixItems && Array.isArray(prefixItems)) {
// Tuple with prefixItems (draft-2020-12)
const minItems = typeof schema.minItems === "number" ? schema.minItems : 0;
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
const positionalItems = applyMinItems(tupleItems, minItems);
const rest = !Array.isArray(items) ? getTupleRest(items, ctx) : undefined;
const tupleSchema = z.tuple(positionalItems);
zodSchema = rest ? tupleSchema.rest(rest) : tupleSchema;
// Apply minItems/maxItems constraints to tuples
if (typeof schema.minItems === "number") {
zodSchema = zodSchema.check(z.minLength(schema.minItems));
}
if (typeof schema.maxItems === "number") {
zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
}
}
else if (Array.isArray(items)) {
// Tuple with items array (draft-7)
const minItems = typeof schema.minItems === "number" ? schema.minItems : 0;
const tupleItems = items.map((item) => convertSchema(item, ctx));
const positionalItems = applyMinItems(tupleItems, minItems);
const rest = getTupleRest(schema.additionalItems, ctx);
const tupleSchema = z.tuple(positionalItems);
zodSchema = rest ? tupleSchema.rest(rest) : tupleSchema;
// Apply minItems/maxItems constraints to tuples
if (typeof schema.minItems === "number") {
zodSchema = zodSchema.check(z.minLength(schema.minItems));
}
if (typeof schema.maxItems === "number") {
zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
}
}
else if (items !== undefined) {
// Regular array
const element = convertSchema(items, ctx);
let arraySchema = z.array(element);
// Apply constraints
if (typeof schema.minItems === "number") {
arraySchema = arraySchema.min(schema.minItems);
}
if (typeof schema.maxItems === "number") {
arraySchema = arraySchema.max(schema.maxItems);
}
zodSchema = arraySchema;
}
else {
// No items specified - array of any
zodSchema = z.array(z.any());
}
// minContains/maxContains only constrain anything when `contains` itself is present
if (schema.uniqueItems === true || schema.contains !== undefined) {
zodSchema = checkArrayGuards(zodSchema, {
uniqueItems: schema.uniqueItems === true,
containsSchema: schema.contains !== undefined ? convertSchema(schema.contains, ctx) : undefined,
minContains: typeof schema.minContains === "number" ? schema.minContains : undefined,
maxContains: typeof schema.maxContains === "number" ? schema.maxContains : undefined,
});
}
break;
}
default:
throw new Error(`Unsupported type: ${type}`);
}
return zodSchema;
}
function convertSchema(schema, ctx) {
if (typeof schema === "boolean") {
return schema ? z.any() : z.never();
}
// Convert base schema first (ignoring composition keywords)
let baseSchema = convertBaseSchema(schema, ctx);
const hasExplicitType = schema.type || schema.enum !== undefined || schema.const !== undefined;
// Process composition keywords LAST (they can appear together)
// Handle anyOf - wrap base schema with union
if (schema.anyOf && Array.isArray(schema.anyOf)) {
const options = schema.anyOf.map((s) => convertSchema(s, ctx));
const anyOfUnion = z.union(options);
baseSchema = hasExplicitType ? z.intersection(baseSchema, anyOfUnion) : anyOfUnion;
}
// Handle oneOf - exclusive union (exactly one must match)
if (schema.oneOf && Array.isArray(schema.oneOf)) {
const options = schema.oneOf.map((s) => convertSchema(s, ctx));
const oneOfUnion = z.xor(options);
baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion;
}
// Handle allOf - wrap base schema with intersection
if (schema.allOf && Array.isArray(schema.allOf)) {
if (schema.allOf.length === 0) {
baseSchema = hasExplicitType ? baseSchema : z.any();
}
else {
let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
const startIdx = hasExplicitType ? 0 : 1;
for (let i = startIdx; i < schema.allOf.length; i++) {
result = z.intersection(result, convertSchema(schema.allOf[i], ctx));
}
baseSchema = result;
}
}
// Handle nullable (OpenAPI 3.0)
if (schema.nullable === true && ctx.version === "openapi-3.0") {
baseSchema = z.nullable(baseSchema);
}
// Handle readOnly
if (schema.readOnly === true) {
baseSchema = z.readonly(baseSchema);
}
// Apply `default` so it wraps the fully-composed schema. This ensures `parse(undefined) -> default` works regardless of which branch of `convertBaseSchema` produced the inner schema (enum/const/not/typed/etc.).
if (schema.default !== undefined) {
baseSchema = baseSchema.default(schema.default);
}
// Collect non-description annotation metadata into the user-supplied registry. Description is handled separately below via `.describe()` to preserve the contract that `schema.description` reads from globalRegistry.
const extraMeta = {};
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
for (const key of coreMetadataKeys) {
if (key in schema) {
extraMeta[key] = schema[key];
}
}
const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
for (const key of contentMetadataKeys) {
if (key in schema) {
extraMeta[key] = schema[key];
}
}
// `propertyNames` and `contains` are enforced by a guard, which `toJSONSchema` cannot infer, so the original keyword is carried as metadata to keep the round-trip lossless. Only where it was actually applied: on any other type it is inert, and on a `$ref` the metadata would land on the target every reference shares. A carried subschema is copied verbatim while the root `$defs` stay behind, so one holding a `$ref` is dropped rather than emitted as a dangling reference.
if (schema.type === "object" && schema.$ref === undefined) {
if (schema.propertyNames !== undefined && !containsRef(schema.propertyNames)) {
extraMeta.propertyNames = schema.propertyNames;
}
for (const key of ["minProperties", "maxProperties"]) {
if (schema[key] !== undefined)
extraMeta[key] = schema[key];
}
}
if (schema.type === "array" && schema.$ref === undefined) {
if (schema.contains !== undefined && !containsRef(schema.contains)) {
extraMeta.contains = schema.contains;
}
for (const key of ["uniqueItems", "minContains", "maxContains"]) {
if (schema[key] !== undefined)
extraMeta[key] = schema[key];
}
}
for (const key of Object.keys(schema)) {
if (!RECOGNIZED_KEYS.has(key)) {
assignProp(extraMeta, key, schema[key]);
}
}
if (Object.keys(extraMeta).length > 0) {
ctx.registry.add(baseSchema, extraMeta);
}
// Apply description last. `.describe()` clones the schema and sets `_zod.parent` on the clone, so registry lookups on the returned reference still resolve `extraMeta` via parent inheritance.
if (schema.description) {
baseSchema = baseSchema.describe(schema.description);
}
return baseSchema;
}
/**
* Converts a JSON Schema to a Zod schema. This function should be considered semi-experimental. It's behavior is liable to change. */
export function fromJSONSchema(schema, params) {
// Handle boolean schemas
if (typeof schema === "boolean") {
return schema ? z.any() : z.never();
}
// Normalize input via a JSON round-trip. This guarantees the converter walks a plain, finite, JSON-valid object graph: cyclic inputs fail here, getter/Proxy-based properties are materialized into static values, and class instances collapse to plain objects.
let normalized;
try {
normalized = JSON.parse(JSON.stringify(schema));
}
catch {
throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas");
}
const version = detectVersion(normalized, params?.defaultTarget);
const defs = (normalized.$defs || normalized.definitions || {});
const ctx = {
version,
defs,
refs: new Map(),
processing: new Set(),
rootSchema: normalized,
registry: params?.registry ?? globalRegistry,
};
return convertSchema(normalized, ctx);
}
@@ -0,0 +1,82 @@
"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;
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getProjectConfigFiles = getProjectConfigFiles;
const debug_1 = __importDefault(require("debug"));
const fs = __importStar(require("node:fs"));
const path = __importStar(require("node:path"));
const log = (0, debug_1.default)('typescript-eslint:typescript-estree:parseSettings:getProjectConfigFiles');
/**
* Checks for a matching TSConfig to a file including its parent directories,
* permanently caching results under each directory it checks.
*
* @remarks
* We don't (yet!) have a way to attach file watchers on disk, but still need to
* cache file checks for rapid subsequent calls to fs.existsSync. See discussion
* in https://github.com/typescript-eslint/typescript-eslint/issues/101.
*/
function getProjectConfigFiles(parseSettings, project) {
if (project !== true) {
if (project == null || project === false) {
return null;
}
if (Array.isArray(project)) {
return project;
}
return [project];
}
log('Looking for tsconfig.json at or above file: %s', parseSettings.filePath);
let directory = path.dirname(parseSettings.filePath);
const checkedDirectories = [directory];
do {
log('Checking tsconfig.json path: %s', directory);
const tsconfigPath = path.join(directory, 'tsconfig.json');
const cached = parseSettings.tsconfigMatchCache.get(directory) ??
(fs.existsSync(tsconfigPath) && tsconfigPath);
if (cached) {
for (const directory of checkedDirectories) {
parseSettings.tsconfigMatchCache.set(directory, cached);
}
return [cached];
}
directory = path.dirname(directory);
checkedDirectories.push(directory);
} while (directory.length > 1 &&
directory.length >= parseSettings.tsconfigRootDir.length);
throw new Error(`project was set to \`true\` but couldn't find any tsconfig.json relative to '${parseSettings.filePath}' within '${parseSettings.tsconfigRootDir}'.`);
}
@@ -0,0 +1,22 @@
/**
* @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 CloudSunRain = createLucideIcon("CloudSunRain", [
["path", { d: "M12 2v2", key: "tus03m" }],
["path", { d: "m4.93 4.93 1.41 1.41", key: "149t6j" }],
["path", { d: "M20 12h2", key: "1q8mjw" }],
["path", { d: "m19.07 4.93-1.41 1.41", key: "1shlcs" }],
["path", { d: "M15.947 12.65a4 4 0 0 0-5.925-4.128", key: "dpwdj0" }],
["path", { d: "M3 20a5 5 0 1 1 8.9-4H13a3 3 0 0 1 2 5.24", key: "1qmrp3" }],
["path", { d: "M11 20v2", key: "174qtz" }],
["path", { d: "M7 19v2", key: "12npes" }]
]);
export { CloudSunRain as default };
//# sourceMappingURL=cloud-sun-rain.js.map