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,523 @@
flf2a$ 5 4 8 -1 12
"infopowr.flf"
Based on a 12 letter font From: "Answers to Frequently Asked Questions
About Today's Cryptography," v2.0 draft 2f, 9/20/93, by Paul Fahn,
copyright 1993, RSA Laboratories
Specifically, the ASCII lettering from the "DISTRIBUTION:" section:
"_ _, _ ___ _, __, _, _ _, ___ _ _, _, _ _ _, __, _, _ _ ___ __, "
| |\ | |_ / \ |_) |\/| / \ | | / \ |\ | | (_ |_) / \ | | |_ | )
| | \| | \ / | \ | | |~| | | \ / | \| | , ) | \ / |/\| | |~\
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~~ ~ ~
Additional characters & figlet conversion by:
Kent Nassen, kentn@cyberspace.org, 8/16/94
$$@
$$@
$$@
$$@
$$@@
,@
|@
|@
.@
$@@
,,@
''@
$@
$@
$@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
,@
'@
$@
$@
$@@
/@
|@
|@
\@
$@@
\@
|@
|@
/@
$@@
@
@
@
@
@@
@
@
@
@
@@
$@
$@
,@
'@
$@@
$@
$@
~~@
$@
$@@
$@
$@
,@
~@
$@@
$@
/@
/ @
$@
$@@
_$@
/ \@
\ /@
~ @
$@@
,@
|@
|@
~@
$@@
_,@
~ )@
/ @
~~~@
$@@
_,@
~_)@
)@
~~ @
$@@
,@
/ |@
~~|@
~@
$@@
_,@
|_ @
)@
~~ @
$@@
_,@
/_ @
\ )@
~ @
$@@
__,@
_/ @
/~ @
@
$@@
_,@
(_)@
( )@
~ @
$@@
_,@
(_/@
/ @
' @
$@@
$@
.@
.@
$@
$@@
$@
.@
,@
'@
$@@
/@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@
_, @
| @
| ,@
~~~@
$@@
_, _@
|\/|@
| |@
~ ~@
$@@
_, _@
|\ |@
| \|@
~ ~@
$@@
_,@
/ \@
\ /@
~ @
$@@
__,@
|_)@
| @
~ @
$@@
_,@
/ \@
\\/@
~`@
$@@
__,@
|_)@
| \@
~ ~@
$@@
_,@
(_ @
, )@
~ @
$@@
___@
| @
| @
~ @
$@@
_,_@
| |@
| |@
`~'@
$@@
_,_@
| /@
|/ @
~ @
$@@
_ _@
| |@
|/\|@
~ ~@
$@@
_ ,@
'\/ @
/\ @
~ ~@
$@@
, _@
\ |@
\|@
)@
~'@@
___,@
` / @
/ @
~~~ @
$@@
@
@
@
@
@@
.@
|@
|@
|@
$@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@@ -0,0 +1 @@
{"version":3,"file":"line-chart.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1 @@
{"version":3,"file":"receipt-pound-sterling.js","sources":["../../../src/icons/receipt-pound-sterling.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ReceiptPoundSterling\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNNCAydjIwbDItMSAyIDEgMi0xIDIgMSAyLTEgMiAxIDItMSAyIDFWMmwtMiAxLTItMS0yIDEtMi0xLTIgMS0yLTEtMiAxWiIgLz4KICA8cGF0aCBkPSJNOCAxM2g1IiAvPgogIDxwYXRoIGQ9Ik0xMCAxN1Y5LjVhMi41IDIuNSAwIDAgMSA1IDAiIC8+CiAgPHBhdGggZD0iTTggMTdoNyIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/receipt-pound-sterling\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 ReceiptPoundSterling = createLucideIcon('ReceiptPoundSterling', [\n [\n 'path',\n { d: 'M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z', key: 'q3az6g' },\n ],\n ['path', { d: 'M8 13h5', key: '1k9z8w' }],\n ['path', { d: 'M10 17V9.5a2.5 2.5 0 0 1 5 0', key: '1dzgp0' }],\n ['path', { d: 'M8 17h7', key: '8mjdqu' }],\n]);\n\nexport default ReceiptPoundSterling;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAuB,iBAAiB,sBAAwB,CAAA,CAAA,CAAA;AAAA,CACpE,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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@
/^^ /^^ @
/^^ @
@@
@
@
/^ /^^ @
/^ /^^ @
/^ /^^@
/^^ /^^ @
/^^ @
/^^ @@
@
@
/^^ @
/^ /^^ @
/^ /^^ @
/^^/^^ @
/^^ @
/^^^@@
@
@
/^ /^^^@
/^^ @
/^^ @
/^^ @
/^^^ @
@@
@
@
/^^^^ @
/^^ @
/^^^ @
/^^@
/^^ /^^@
@@
/^^ @
/^^ @
/^/^ /^@
/^^ @
/^^ @
/^^ @
/^^ @
@@
@
@
/^^ /^^@
/^^ /^^@
/^^ /^^@
/^^ /^^@
/^^/^^@
@@
@
@
/^^ /^^@
/^^ /^^ @
/^^ /^^ @
/^/^^ @
/^^ @
@@
@
@
/^^ /^^^@
/^^ ^ /^^@
/^^ /^ /^^@
/^ /^ /^/^^@
/^^^ /^^^@
@@
@
@
/^^ /^^@
/^ /^^ @
/^ @
/^ /^^ @
/^^ /^^@
@@
@
@
/^^ /^^@
/^^ /^^ @
/^^^ @
/^^ @
/^^ @
/^^ @@
@
@
/^^^^ /^^@
/^^ @
/^^ @
/^^ @
/^^^^^^^^@
@@
/^^@
/^^ @
/^^ @
/^^ @
/^^ @
/^^ @
/^^@
@@
/^@
/^@
/^@
@
/^@
/^@
/^@
@@
/^^ @
/^^ @
/^^ @
/^^@
/^^ @
/^^ @
/^^ @
@@
/^^ /^ @
/^ /^^@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
`
@@ -0,0 +1,140 @@
import type { $ZodStringFormats } from "../core/checks.js";
import type * as errors from "../core/errors.js";
import * as util from "../core/util.js";
const error: () => errors.$ZodErrorMap = () => {
const Sizable: Record<string, { unit: string; verb: string }> = {
string: { unit: "پیت", verb: "بێت" },
file: { unit: "بایت", verb: "بێت" },
array: { unit: "دانە", verb: "بێت" },
set: { unit: "دانە", verb: "بێت" },
map: { unit: "دانە", verb: "بێت" },
};
function getSizing(origin: string): { unit: string; verb: string } | null {
return Sizable[origin] ?? null;
}
const FormatDictionary: {
[k in $ZodStringFormats | (string & {})]?: string;
} = {
regex: "regex",
email: "ئیمەیڵ",
url: "بەستەر (URL)",
emoji: "ئیمۆجی",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ڕێکەوت و کات",
date: "ڕێکەوت",
time: "کات",
duration: "ماوە",
ipv4: "ناونیشانی IPv4",
ipv6: "ناونیشانی IPv6",
mac: "ناونیشانی MAC",
cidrv4: "مەودای IPv4",
cidrv6: "مەودای IPv6",
base64: "دەقی base64",
base64url: "دەقی base64url",
json_string: "دەقی JSON",
e164: "ژمارەی E.164",
credit_card: "ژمارەی کارتی کرێدیت",
currency_code: "کۆدی دراو",
iban: "IBAN",
jwt: "JWT",
template_literal: "تێکردە",
};
// type names: missing keys = do not translate (use raw value via ?? fallback)
const TypeDictionary: {
[k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;
} = {
nan: "NaN",
string: "نووسین",
number: "ژمارە",
boolean: "boolean",
array: "array",
object: "object",
date: "ڕێکەوت",
integer: "ژمارە",
float: "ژمارە",
null: "null",
undefined: "undefined",
function: "function",
symbol: "symbol",
unknown: "unknown",
promise: "promise",
void: "void",
never: "never",
map: "map",
set: "set",
};
return (issue) => {
switch (issue.code) {
case "invalid_type": {
const expected = TypeDictionary[issue.expected] ?? issue.expected;
const receivedType = util.parsedType(issue.input);
const received = TypeDictionary[receivedType] ?? receivedType;
const postfix = ["ا", "و", "ۆ", "وو", "ە", "ی", "ێ"].some((p) => received.endsWith(p)) ? "یە" : "ە";
const isEnglish = /^[a-zA-Z]+$/.test(received);
if (receivedType === "null" || receivedType === "undefined") return `داواکراوە`;
return `چاوەڕوانکراوە ${expected} بێت، بەڵام ${received}${isEnglish ? "" : postfix}`;
}
case "invalid_value":
if (issue.values.length === 1)
return `بەهاکە نادرووستە: چاوەڕوانکراوە ${util.stringifyPrimitive(issue.values[0])} بێت`;
return `هەڵبژاردەی نادروست: چاوەڕوانکراوە یەکێک بێت لە ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const sizing = getSizing(issue.origin);
if (sizing) return `پێویستە بە لایەنی زۆرەوە ${issue.maximum.toString()} ${sizing.unit} ${sizing.verb}`;
return `پێویستە بە لایەنی زۆرەوە ${issue.maximum.toString()} بێت`;
}
case "too_small": {
const sizing = getSizing(issue.origin);
if (sizing) return `پێویستە بە لایەنی کەمەوە ${issue.minimum.toString()} ${sizing.unit} ${sizing.verb}`;
return `پێویستە بە لایەنی کەمەوە ${issue.minimum.toString()} بێت`;
}
case "invalid_format": {
const _issue = issue as errors.$ZodStringFormatIssues;
if (_issue.format === "starts_with") {
return `دەقی نادروست: پێویستە دەستپێبکات بە "${_issue.prefix}"`;
}
if (_issue.format === "ends_with") return `دەقی نادروست: پێویستە کۆتاییبێت بە "${_issue.suffix}"`;
if (_issue.format === "includes") return `دەقی نادروست: پێویستە "${_issue.includes}" لەخۆبگرێت`;
if (_issue.format === "regex") return `دەقی نادروست: پێویستە لەگەڵ پاتێرنی ${_issue.pattern} بگونجێت`;
return `بەهای ${FormatDictionary[_issue.format] ?? issue.format} نادروستە`;
}
case "not_multiple_of":
return `ژمارەی نادروست: دەبێت چەند هێندە بێت بۆ ${issue.divisor}`;
case "unrecognized_keys":
return `کلیلی نەناسراو: ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `کلیلی نادروست لە ${issue.origin}`;
case "invalid_union":
if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) {
const opts = issue.options.map((o) => `'${o}'`).join(" | ");
return `بەهای نەناسراو هەیە. بەهای چاوەڕوانکراو: ${opts}`;
}
return "یەکگرتنی نادروست";
case "invalid_element":
return `${issue.origin} بەهاکە نادروستە`;
default:
return `تێکردەی نادروست`;
}
};
};
export default function (): { localeError: errors.$ZodErrorMap } {
return {
localeError: error(),
};
}
@@ -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 FolderOpenDot = createLucideIcon("FolderOpenDot", [
[
"path",
{
d: "m6 14 1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h3.93a2 2 0 0 1 1.66.9l.82 1.2a2 2 0 0 0 1.66.9H18a2 2 0 0 1 2 2v2",
key: "1nmvlm"
}
],
["circle", { cx: "14", cy: "15", r: "1", key: "1gm4qj" }]
]);
export { FolderOpenDot as default };
//# sourceMappingURL=folder-open-dot.js.map
@@ -0,0 +1 @@
{"version":3,"file":"jsonResponseStreamableHttp.js","sourceRoot":"","sources":["../../../../src/examples/server/jsonResponseStreamableHttp.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,6CAAyC;AACzC,gDAAgD;AAChD,sEAA+E;AAC/E,0CAA4B;AAC5B,6CAAqE;AACrE,wDAA8D;AAE9D,mDAAmD;AACnD,MAAM,SAAS,GAAG,GAAG,EAAE;IACnB,MAAM,MAAM,GAAG,IAAI,kBAAS,CACxB;QACI,IAAI,EAAE,sCAAsC;QAC5C,OAAO,EAAE,OAAO;KACnB,EACD;QACI,YAAY,EAAE;YACV,OAAO,EAAE,EAAE;SACd;KACJ,CACJ,CAAC;IAEF,iDAAiD;IACjD,MAAM,CAAC,YAAY,CACf,OAAO,EACP;QACI,WAAW,EAAE,wBAAwB;QACrC,WAAW,EAAE;YACT,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;SAC7C;KACJ,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,EAA2B,EAAE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BAA6B,EAAE,KAAK,CAAC,CAAC;QACpD,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;YACnB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACjB,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE;oBACH,IAAI,EAALine truncated
@@ -0,0 +1,65 @@
import { FromPathOption, NavigateOptions, PathParamOptions, SearchParamOptions, ToPathOption } from './link.cjs';
import { RedirectOptions } from './redirect.cjs';
import { RouteIds } from './routeInfo.cjs';
import { AnyRouter, RegisteredRouter } from './router.cjs';
import { UseParamsResult } from './useParams.cjs';
import { UseSearchResult } from './useSearch.cjs';
import { Constrain, ConstrainLiteral } from './utils.cjs';
export type ValidateFromPath<TRouter extends AnyRouter = RegisteredRouter, TFrom = string> = FromPathOption<TRouter, TFrom>;
export type ValidateToPath<TRouter extends AnyRouter = RegisteredRouter, TTo extends string | undefined = undefined, TFrom extends string = string> = ToPathOption<TRouter, TFrom, TTo>;
export type ValidateSearch<TRouter extends AnyRouter = RegisteredRouter, TTo extends string | undefined = undefined, TFrom extends string = string> = SearchParamOptions<TRouter, TFrom, TTo>;
export type ValidateParams<TRouter extends AnyRouter = RegisteredRouter, TTo extends string | undefined = undefined, TFrom extends string = string> = PathParamOptions<TRouter, TFrom, TTo>;
/**
* @private
*/
export type InferFrom<TOptions, TDefaultFrom extends string = string> = TOptions extends {
from: infer TFrom extends string;
} ? TFrom : TDefaultFrom;
/**
* @private
*/
export type InferTo<TOptions> = TOptions extends {
to: infer TTo extends string;
} ? TTo : undefined;
/**
* @private
*/
export type InferMaskTo<TOptions> = TOptions extends {
mask: {
to: infer TTo extends string;
};
} ? TTo : '';
export type InferMaskFrom<TOptions> = TOptions extends {
mask: {
from: infer TFrom extends string;
};
} ? TFrom : string;
export type ValidateNavigateOptions<TRouter extends AnyRouter = RegisteredRouter, TOptions = unknown, TDefaultFrom extends string = string> = Constrain<TOptions, NavigateOptions<TRouter, InferFrom<TOptions, TDefaultFrom>, InferTo<TOptions>, InferMaskFrom<TOptions>, InferMaskTo<TOptions>>>;
export type ValidateNavigateOptionsArray<TRouter extends AnyRouter = RegisteredRouter, TOptions extends ReadonlyArray<any> = ReadonlyArray<unknown>, TDefaultFrom extends string = string> = {
[K in keyof TOptions]: ValidateNavigateOptions<TRouter, TOptions[K], TDefaultFrom>;
};
export type ValidateRedirectOptions<TRouter extends AnyRouter = RegisteredRouter, TOptions = unknown, TDefaultFrom extends string = string> = Constrain<TOptions, RedirectOptions<TRouter, InferFrom<TOptions, TDefaultFrom>, InferTo<TOptions>, InferMaskFrom<TOptions>, InferMaskTo<TOptions>>>;
export type ValidateRedirectOptionsArray<TRouter extends AnyRouter = RegisteredRouter, TOptions extends ReadonlyArray<any> = ReadonlyArray<unknown>, TDefaultFrom extends string = string> = {
[K in keyof TOptions]: ValidateRedirectOptions<TRouter, TOptions[K], TDefaultFrom>;
};
export type ValidateId<TRouter extends AnyRouter = RegisteredRouter, TId extends string = string> = ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>;
/**
* @private
*/
export type InferStrict<TOptions> = TOptions extends {
strict: infer TStrict extends boolean;
} ? TStrict : true;
/**
* @private
*/
export type InferShouldThrow<TOptions> = TOptions extends {
shouldThrow: infer TShouldThrow extends boolean;
} ? TShouldThrow : true;
/**
* @private
*/
export type InferSelected<TOptions> = TOptions extends {
select: (...args: Array<any>) => infer TSelected;
} ? TSelected : unknown;
export type ValidateUseSearchResult<TOptions, TRouter extends AnyRouter = RegisteredRouter> = UseSearchResult<TRouter, InferFrom<TOptions>, InferStrict<TOptions>, InferSelected<TOptions>>;
export type ValidateUseParamsResult<TOptions, TRouter extends AnyRouter = RegisteredRouter> = Constrain<TOptions, UseParamsResult<TRouter, InferFrom<TOptions>, InferStrict<TOptions>, InferSelected<TOptions>>>;
@@ -0,0 +1 @@
{"version":3,"file":"recursiveRef.js","sourceRoot":"","sources":["../../../lib/vocabularies/dynamic/recursiveRef.ts"],"names":[],"mappings":";;AACA,6CAAuC;AAEvC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,eAAe;IACxB,UAAU,EAAE,QAAQ;IACpB,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,uBAAU,EAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC;CAC3C,CAAA;AAED,kBAAe,GAAG,CAAA"}
@@ -0,0 +1,17 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const CopyCheck = createLucideIcon("CopyCheck", [
["path", { d: "m12 15 2 2 4-4", key: "2c609p" }],
["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
]);
export { CopyCheck as default };
//# sourceMappingURL=copy-check.js.map
@@ -0,0 +1,21 @@
/**
* @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 BriefcaseConveyorBelt = createLucideIcon("BriefcaseConveyorBelt", [
["path", { d: "M10 20v2", key: "1n8e1g" }],
["path", { d: "M14 20v2", key: "1lq872" }],
["path", { d: "M18 20v2", key: "10uadw" }],
["path", { d: "M21 20H3", key: "kdqkdp" }],
["path", { d: "M6 20v2", key: "a9bc87" }],
["path", { d: "M8 16V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v12", key: "17n9tx" }],
["rect", { x: "4", y: "6", width: "16", height: "10", rx: "2", key: "1097i5" }]
]);
export { BriefcaseConveyorBelt as default };
//# sourceMappingURL=briefcase-conveyor-belt.js.map
@@ -0,0 +1 @@
{"version":3,"file":"calculator.js","sources":["../../../src/icons/calculator.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Calculator\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iMTYiIGhlaWdodD0iMjAiIHg9IjQiIHk9IjIiIHJ4PSIyIiAvPgogIDxsaW5lIHgxPSI4IiB4Mj0iMTYiIHkxPSI2IiB5Mj0iNiIgLz4KICA8bGluZSB4MT0iMTYiIHgyPSIxNiIgeTE9IjE0IiB5Mj0iMTgiIC8+CiAgPHBhdGggZD0iTTE2IDEwaC4wMSIgLz4KICA8cGF0aCBkPSJNMTIgMTBoLjAxIiAvPgogIDxwYXRoIGQ9Ik04IDEwaC4wMSIgLz4KICA8cGF0aCBkPSJNMTIgMTRoLjAxIiAvPgogIDxwYXRoIGQ9Ik04IDE0aC4wMSIgLz4KICA8cGF0aCBkPSJNMTIgMThoLjAxIiAvPgogIDxwYXRoIGQ9Ik04IDE4aC4wMSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/calculator\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 Calculator = createLucideIcon('Calculator', [\n ['rect', { width: '16', height: '20', x: '4', y: '2', rx: '2', key: '1nb95v' }],\n ['line', { x1: '8', x2: '16', y1: '6', y2: '6', key: 'x4nwl0' }],\n ['line', { x1: '16', x2: '16', y1: '14', y2: '18', key: 'wjye3r' }],\n ['path', { d: 'M16 10h.01', key: '1m94wz' }],\n ['path', { d: 'M12 10h.01', key: '1nrarc' }],\n ['path', { d: 'M8 10h.01', key: '19clt8' }],\n ['path', { d: 'M12 14h.01', key: '1etili' }],\n ['path', { d: 'M8 14h.01', key: '6423bh' }],\n ['path', { d: 'M12 18h.01', key: 'mhygvu' }],\n ['path', { d: 'M8 18h.01', key: 'lrp35t' }],\n]);\n\nexport default Calculator;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,iBAAiB,YAAc,CAAA,CAAA,CAAA;AAAA,CAAA,CAChD,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,CAC9E,CAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAE,CAAA,CAAA,CAAA,EAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAI,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAC/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,CAAA;AAAA,CAAA,CAC3C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC1C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC3C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC5C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,511 @@
import { expect, expectTypeOf, test } from "vitest";
import * as z from "zod/v4";
test("successful validation", () => {
const testTuple = z.tuple([z.string(), z.number()]);
expectTypeOf<typeof testTuple._output>().toEqualTypeOf<[string, number]>();
const val = testTuple.parse(["asdf", 1234]);
expect(val).toEqual(val);
const r1 = testTuple.safeParse(["asdf", "asdf"]);
expect(r1.success).toEqual(false);
expect(r1.error!).toMatchInlineSnapshot(`
[ZodError: [
{
"expected": "number",
"code": "invalid_type",
"path": [
1
],
"message": "Invalid input: expected number, received string"
}
]]
`);
const r2 = testTuple.safeParse(["asdf", 1234, true]);
expect(r2.success).toEqual(false);
expect(r2.error!).toMatchInlineSnapshot(`
[ZodError: [
{
"code": "too_big",
"maximum": 2,
"inclusive": true,
"origin": "array",
"path": [],
"message": "Too big: expected array to have <=2 items"
}
]]
`);
const r3 = testTuple.safeParse({});
expect(r3.success).toEqual(false);
expect(r3.error!).toMatchInlineSnapshot(`
[ZodError: [
{
"expected": "tuple",
"code": "invalid_type",
"path": [],
"message": "Invalid input: expected tuple, received object"
}
]]
`);
});
test("async validation", async () => {
const testTuple = z
.tuple([z.string().refine(async () => true), z.number().refine(async () => true)])
.refine(async () => true);
expectTypeOf<typeof testTuple._output>().toEqualTypeOf<[string, number]>();
const val = await testTuple.parseAsync(["asdf", 1234]);
expect(val).toEqual(val);
const r1 = await testTuple.safeParseAsync(["asdf", "asdf"]);
expect(r1.success).toEqual(false);
expect(r1.error!).toMatchInlineSnapshot(`
[ZodError: [
{
"expected": "number",
"code": "invalid_type",
"path": [
1
],
"message": "Invalid input: expected number, received string"
}
]]
`);
const r2 = await testTuple.safeParseAsync(["asdf", 1234, true]);
expect(r2.success).toEqual(false);
expect(r2.error!).toMatchInlineSnapshot(`
[ZodError: [
{
"code": "too_big",
"maximum": 2,
"inclusive": true,
"origin": "array",
"path": [],
"message": "Too big: expected array to have <=2 items"
}
]]
`);
const r3 = await testTuple.safeParseAsync({});
expect(r3.success).toEqual(false);
expect(r3.error!).toMatchInlineSnapshot(`
[ZodError: [
{
"expected": "tuple",
"code": "invalid_type",
"path": [],
"message": "Invalid input: expected tuple, received object"
}
]]
`);
});
test("tuple with optional elements", () => {
const myTuple = z.tuple([z.string(), z.number().optional(), z.string().optional()]).rest(z.boolean());
expectTypeOf<typeof myTuple._output>().toEqualTypeOf<
[string, (number | undefined)?, (string | undefined)?, ...boolean[]]
>();
const goodData = [["asdf"], ["asdf", 1234], ["asdf", 1234, "asdf"], ["asdf", 1234, "asdf", true, false, true]];
for (const data of goodData) {
expect(myTuple.parse(data)).toEqual(data);
}
const badData = [
["asdf", "asdf"],
["asdf", 1234, "asdf", "asdf"],
["asdf", 1234, "asdf", true, false, "asdf"],
];
for (const data of badData) {
expect(() => myTuple.parse(data)).toThrow();
}
});
test("tuple with optional elements followed by required", () => {
const myTuple = z.tuple([z.string(), z.number().optional(), z.string()]).rest(z.boolean());
expectTypeOf<typeof myTuple._output>().toEqualTypeOf<[string, number | undefined, string, ...boolean[]]>();
const goodData = [
["asdf", 1234, "asdf"],
["asdf", 1234, "asdf", true, false, true],
];
for (const data of goodData) {
expect(myTuple.parse(data)).toEqual(data);
}
const badData = [
["asdf"],
["asdf", 1234],
["asdf", 1234, "asdf", "asdf"],
["asdf", 1234, "asdf", true, false, "asdf"],
];
for (const data of badData) {
expect(() => myTuple.parse(data)).toThrow();
}
});
test("tuple with all optional elements", () => {
const allOptionalTuple = z.tuple([z.string().optional(), z.number().optional(), z.boolean().optional()]);
expectTypeOf<typeof allOptionalTuple._output>().toEqualTypeOf<
[(string | undefined)?, (number | undefined)?, (boolean | undefined)?]
>();
// Empty array should be valid (all items optional)
expect(allOptionalTuple.parse([])).toEqual([]);
// Partial arrays should be valid
expect(allOptionalTuple.parse(["hello"])).toEqual(["hello"]);
expect(allOptionalTuple.parse(["hello", 42])).toEqual(["hello", 42]);
// Full array should be valid
expect(allOptionalTuple.parse(["hello", 42, true])).toEqual(["hello", 42, true]);
// Array that's too long should fail
expect(() => allOptionalTuple.parse(["hello", 42, true, "extra"])).toThrow();
});
test("tuple fills defaults for missing trailing elements", () => {
// Issue #5229: trailing `.default()`/`.prefault()` elements should be filled in when the input array is shorter than the tuple.
const t = z.tuple([z.string(), z.string().default("bravo")]);
expectTypeOf<typeof t._output>().toEqualTypeOf<[string, string]>();
expectTypeOf<typeof t._input>().toEqualTypeOf<[string, (string | undefined)?]>();
expect(t.parse(["alpha", "charlie"])).toEqual(["alpha", "charlie"]);
expect(t.parse(["alpha"])).toEqual(["alpha", "bravo"]);
// Multiple trailing defaults
const multi = z.tuple([z.string(), z.number().default(42), z.boolean().default(true)]);
expect(multi.parse(["hello"])).toEqual(["hello", 42, true]);
expect(multi.parse(["hello", 100])).toEqual(["hello", 100, true]);
expect(multi.parse(["hello", 100, false])).toEqual(["hello", 100, false]);
// Prefault parity
expect(z.tuple([z.string(), z.string().prefault("delta")]).parse(["alpha"])).toEqual(["alpha", "delta"]);
// Defaults wrapped in modifiers: `optout` propagates through these, so the fix is not type-name specific.
expect(z.tuple([z.string(), z.string().default("x").nullable()]).parse(["alpha"])).toEqual(["alpha", "x"]);
expect(z.tuple([z.string(), z.string().default("x").readonly()]).parse(["alpha"])).toEqual(["alpha", "x"]);
expect(z.tuple([z.string(), z.string().default("x").catch("y")]).parse(["alpha"])).toEqual(["alpha", "x"]);
expect(z.tuple([z.string(), z.string().default("x").pipe(z.string())]).parse(["alpha"])).toEqual(["alpha", "x"]);
});
test("tuple fills defaults under async parse", async () => {
const t = z.tuple([z.string(), z.string().default("zulu")]);
await expect(t.parseAsync(["alpha"])).resolves.toEqual(["alpha", "zulu"]);
});
test("tuple keeps length-1 array for missing `.optional()` elements", () => {
// Backwards compat: a trailing `.optional()` element that is omitted from the input must NOT be filled with `undefined` — the result stays length-1. Only schemas that produce a defined value get materialized.
const t = z.tuple([z.string(), z.string().optional()]);
const out = t.parse(["alpha"]);
expect(out).toEqual(["alpha"]);
expect(out.length).toEqual(1);
// `z.undefined()` is NOT a synonym for `.optional()` — its value type is *must be undefined*, so the slot is required input. Omitting it triggers a single `too_small` (no element-level errors, matching v3's abort semantics); passing explicit `undefined` succeeds and is preserved.
expect(z.tuple([z.string(), z.undefined()]).safeParse(["alpha"]).error!.issues).toMatchInlineSnapshot(`
[
{
"code": "too_small",
"inclusive": true,
"message": "Too small: expected array to have >=2 items",
"minimum": 2,
"origin": "array",
"path": [],
},
]
`);
expect(z.tuple([z.string(), z.undefined()]).parse(["alpha", undefined])).toHaveLength(2);
// `.optional().nullable()` still trims — `.optional()` propagates the
// optin/optout flags through the nullable wrapper.
expect(z.tuple([z.string(), z.string().optional().nullable()]).parse(["alpha"])).toHaveLength(1);
// Multiple trailing optionals trim the same way — we don't fill the tail with literal `undefined`s.
const many = z.tuple([z.string(), z.string().optional(), z.string().optional(), z.string().optional()]);
expect(many.parse(["alpha"])).toEqual(["alpha"]);
expect(many.parse(["alpha", "beta"])).toEqual(["alpha", "beta"]);
// Explicit `undefined` inside `input.length` IS preserved — only slots past the input get trimmed.
const r = many.parse(["alpha", undefined]);
expect(r.length).toEqual(2);
expect(1 in r).toEqual(true);
// Trailing optionals after a default that fires are still trimmed.
expect(
z.tuple([z.string(), z.string().default("d"), z.string().optional(), z.string().optional()]).parse(["alpha"])
).toEqual(["alpha", "d"]);
});
test("tuple result is dense when optional precedes a default", () => {
// `.optional()` before a `.default()` must produce an explicit `undefined`
// (not a sparse hole), otherwise `1 in r`, `JSON.stringify`, `Object.keys`,
// and iteration all behave wrong.
const t = z.tuple([z.string(), z.string().optional(), z.string().default("z")]);
const r = t.parse(["alpha"]);
expect(r).toEqual(["alpha", undefined, "z"]);
expect(r.length).toEqual(3);
expect(1 in r).toEqual(true);
expect(JSON.stringify(r)).toEqual('["alpha",null,"z"]');
// Trailing optional after a default is still dropped (no later default forces it to materialize).
expect(z.tuple([z.string(), z.string().default("d"), z.string().optional()]).parse(["alpha"])).toEqual([
"alpha",
"d",
]);
// Multiple interleaved optional/default — every slot up to the last default must be present and dense.
const interleaved = z.tuple([
z.string(),
z.string().optional(),
z.string().default("d"),
z.string().optional(),
z.string().default("e"),
]);
const out = interleaved.parse(["alpha"]);
expect(out).toEqual(["alpha", undefined, "d", undefined, "e"]);
expect(1 in out && 3 in out).toEqual(true);
});
test("tuple truncates absent optional rejections only when the output tail is optional", () => {
// An absent optional-output slot can only be swallowed when every later output slot is optional too. If a later default would make the output tail required, truncating would violate the tuple's output type.
const refusesUndefined = z
.string()
.optional()
.refine((s) => s !== undefined, "must not be undefined");
const trailingDefault = z.tuple([z.string(), refusesUndefined, z.string().default("d")]);
const r1 = trailingDefault.safeParse(["alpha"]);
expect(r1.success).toBe(false);
expect(r1.error!.issues[0].path).toEqual([1]);
// Optional slots BEFORE the rejected one still cannot hide a later required output slot.
const beforeReject = z.tuple([z.string(), z.string().optional(), refusesUndefined, z.string().default("d")]);
const r2 = beforeReject.safeParse(["alpha"]);
expect(r2.success).toBe(false);
expect(r2.error!.issues[0].path).toEqual([2]);
// No default after — truncate still applies, no spurious issue surfaces.
const noTrailingDefault = z.tuple([z.string(), refusesUndefined]);
const r3 = noTrailingDefault.safeParse(["alpha"]);
expect(r3.success).toBe(true);
expect(r3.data).toEqual(["alpha"]);
});
test("tuple rejects absent optional before required output under async parse", async () => {
const refusesUndefined = z
.string()
.optional()
.refine(async (s) => s !== undefined, "must not be undefined");
const schema = z.tuple([z.string(), refusesUndefined, z.string().default("d")]);
const r = await schema.safeParseAsync(["alpha"]);
expect(r.success).toBe(false);
expect(r.error!.issues[0].path).toEqual([1]);
});
test("tuple rejects absent exact optional before defaulted output", () => {
const schema = z.tuple([z.string(), z.string().exactOptional(), z.string().default("fallback")]);
expectTypeOf<typeof schema._output>().toEqualTypeOf<[string, string, string]>();
const missingExact = schema.safeParse(["alpha"]);
expect(missingExact.success).toBe(false);
expect(missingExact.error!.issues[0].path).toEqual([1]);
expect(schema.parse(["alpha", "bravo"])).toEqual(["alpha", "bravo", "fallback"]);
expect(schema.safeParse(["alpha", undefined]).success).toBe(false);
// With no later required output slot, exact optional still behaves like an omitted tuple tail and truncates cleanly.
expect(z.tuple([z.string(), z.string().exactOptional(), z.string().optional()]).parse(["alpha"])).toEqual(["alpha"]);
});
test("tuple preserves explicit undefined inside input even for optional-out schemas", () => {
// The trim only runs for slots PAST `input.length`. An explicit `undefined`
// value supplied by the caller at index < input.length must survive, even
// when the schema produces undefined as a valid output (e.g.
// `z.string().or(z.undefined())`, `z.string().optional()`, `z.undefined()`).
const orUndefined = z.tuple([z.string(), z.string().or(z.undefined())]);
const r1 = orUndefined.parse(["alpha", undefined]);
expect(r1.length).toEqual(2);
expect(r1[1]).toBeUndefined();
expect(1 in r1).toEqual(true);
expect(JSON.stringify(r1)).toEqual('["alpha",null]');
// Same for `.optional()`.
const opt = z.tuple([z.string(), z.string().optional()]);
const r2 = opt.parse(["alpha", undefined]);
expect(r2.length).toEqual(2);
expect(1 in r2).toEqual(true);
// Same for `z.undefined()` literal.
const lit = z.tuple([z.string(), z.undefined()]);
const r3 = lit.parse(["alpha", undefined]);
expect(r3.length).toEqual(2);
expect(1 in r3).toEqual(true);
// Mid-tuple explicit undefined surrounded by defined values is also kept.
const mid = z.tuple([z.string(), z.string().or(z.undefined()), z.string()]);
const r4 = mid.parse(["alpha", undefined, "gamma"]);
expect(r4).toEqual(["alpha", undefined, "gamma"]);
expect(r4.length).toEqual(3);
expect(1 in r4).toEqual(true);
});
test("tuple does NOT break when a required slot fails past input length", () => {
// A required slot (no `.optional()` chain, so optout !== "optional") past input length must still surface an issue rather than silently swallowing it. Otherwise we'd accept arbitrarily short tuples for required-tail schemas. The precheck collapses this into a single `too_small`.
const schema = z.tuple([z.string(), z.string()]);
expect(schema.safeParse(["alpha"]).error!.issues).toMatchInlineSnapshot(`
[
{
"code": "too_small",
"inclusive": true,
"message": "Too small: expected array to have >=2 items",
"minimum": 2,
"origin": "array",
"path": [],
},
]
`);
});
test("tuple with rest schema", () => {
const myTuple = z.tuple([z.string(), z.number()]).rest(z.boolean());
expect(myTuple.parse(["asdf", 1234, true, false, true])).toEqual(["asdf", 1234, true, false, true]);
expect(myTuple.parse(["asdf", 1234])).toEqual(["asdf", 1234]);
expect(() => myTuple.parse(["asdf", 1234, "asdf"])).toThrow();
type t1 = z.output<typeof myTuple>;
expectTypeOf<t1>().toEqualTypeOf<[string, number, ...boolean[]]>();
});
test("sparse array input", () => {
const schema = z.tuple([z.string(), z.number()]);
expect(() => schema.parse(new Array(2))).toThrow();
});
test("under-length tuple emits a single too_small with optStart minimum", () => {
const allRequired = z.tuple([z.string(), z.string()]);
expect(allRequired.safeParse(["a"]).error!.issues).toMatchInlineSnapshot(`
[
{
"code": "too_small",
"inclusive": true,
"message": "Too small: expected array to have >=2 items",
"minimum": 2,
"origin": "array",
"path": [],
},
]
`);
expect(allRequired.safeParse([]).error!.issues).toMatchInlineSnapshot(`
[
{
"code": "too_small",
"inclusive": true,
"message": "Too small: expected array to have >=2 items",
"minimum": 2,
"origin": "array",
"path": [],
},
]
`);
const trailingOptional = z.tuple([z.string(), z.number().optional()]);
expect(trailingOptional.safeParse([]).error!.issues).toMatchInlineSnapshot(`
[
{
"code": "too_small",
"inclusive": true,
"message": "Too small: expected array to have >=1 items",
"minimum": 1,
"origin": "array",
"path": [],
},
]
`);
const interiorOptional = z.tuple([z.string(), z.number().optional(), z.string()]);
expect(interiorOptional.safeParse(["a", 1]).error!.issues).toMatchInlineSnapshot(`
[
{
"code": "too_small",
"inclusive": true,
"message": "Too small: expected array to have >=3 items",
"minimum": 3,
"origin": "array",
"path": [],
},
]
`);
});
test("too_big tuple still surfaces element-wise type errors for present indices", () => {
const schema = z.tuple([z.string(), z.number()]);
expect(schema.safeParse([1, "x", "extra"]).error!.issues).toMatchInlineSnapshot(`
[
{
"code": "too_big",
"inclusive": true,
"maximum": 2,
"message": "Too big: expected array to have <=2 items",
"origin": "array",
"path": [],
},
{
"code": "invalid_type",
"expected": "string",
"message": "Invalid input: expected string, received number",
"path": [
0,
],
},
{
"code": "invalid_type",
"expected": "number",
"message": "Invalid input: expected number, received string",
"path": [
1,
],
},
]
`);
});
test("partial", () => {
const schema = z.tuple([z.string(), z.number(), z.boolean()]).partial();
expectTypeOf<z.infer<typeof schema>>().toEqualTypeOf<
[(string | undefined)?, (number | undefined)?, (boolean | undefined)?]
>();
expect(schema.parse([])).toEqual([]);
expect(schema.parse(["a"])).toEqual(["a"]);
expect(schema.parse(["a", 1, true])).toEqual(["a", 1, true]);
expect(schema.safeParse(["a", "b"]).success).toEqual(false);
expect(schema.safeParse(["a", 1, true, 4]).success).toEqual(false);
// the arity relaxation has to survive the JSON Schema round trip: `minItems` disappears
expect(z.toJSONSchema(schema)).toEqual(
z.toJSONSchema(z.tuple([z.string().optional(), z.number().optional(), z.boolean().optional()]))
);
});
test("partial leaves rest alone", () => {
const schema = z.tuple([z.string()], z.number()).partial();
expectTypeOf<z.infer<typeof schema>>().toEqualTypeOf<[(string | undefined)?, ...number[]]>();
expect(schema.parse([])).toEqual([]);
expect(schema.parse(["a", 1, 2])).toEqual(["a", 1, 2]);
// discriminating input: `true` only if rest had been wrapped too
expect(schema.safeParse(["a", undefined]).success).toEqual(false);
});
test("partial rejects a tuple carrying refinements", () => {
const schema = z.tuple([z.string(), z.number()]).refine(([a]) => a.length > 0);
expect(() => schema.partial()).toThrow("cannot be used on tuple schemas containing refinements");
});
@@ -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 ToggleRight = createLucideIcon("ToggleRight", [
["rect", { width: "20", height: "12", x: "2", y: "6", rx: "6", ry: "6", key: "f2vt7d" }],
["circle", { cx: "16", cy: "12", r: "2", key: "4ma0v8" }]
]);
export { ToggleRight as default };
//# sourceMappingURL=toggle-right.js.map
@@ -0,0 +1,2 @@
import picocolors from 'picocolors';
export declare const colorful: Record<keyof Omit<typeof picocolors, "createColors">, (...args: any[]) => void>;
@@ -0,0 +1 @@
{"version":3,"names":["_getPrototypeOf","require","_setPrototypeOf","_isNativeFunction","_construct","_wrapNativeSuper","Class","_cache","Map","undefined","exports","default","isNativeFunction","TypeError","has","get","set","Wrapper","construct","arguments","getPrototypeOf","constructor","prototype","Object","create","value","enumerable","writable","configurable","setPrototypeOf"],"sources":["../../src/helpers/wrapNativeSuper.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\n// Based on https://github.com/WebReflection/babel-plugin-transform-builtin-classes\n\nimport getPrototypeOf from \"./getPrototypeOf.ts\";\nimport setPrototypeOf from \"./setPrototypeOf.ts\";\nimport isNativeFunction from \"./isNativeFunction.ts\";\nimport construct from \"./construct.ts\";\n\nexport default function _wrapNativeSuper(Class: Function | null) {\n var _cache = typeof Map === \"function\" ? new Map() : undefined;\n\n // @ts-expect-error -- reuse function id for helper size\n _wrapNativeSuper = function _wrapNativeSuper(Class: Function | null) {\n if (Class === null || !isNativeFunction(Class)) return Class;\n if (typeof Class !== \"function\") {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n if (_cache !== undefined) {\n if (_cache.has(Class)) return _cache.get(Class);\n _cache.set(Class, Wrapper);\n }\n\n function Wrapper() {\n // @ts-expect-error -- we are sure Class is a function here\n return construct(Class, arguments, getPrototypeOf(this).constructor);\n }\n Wrapper.prototype = Object.create(Class.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: false,\n writable: true,\n configurable: true,\n },\n });\n\n return setPrototypeOf(Wrapper, Class);\n };\n\n return _wrapNativeSuper(Class);\n}\n"],"mappings":";;;;;;AAIA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAEe,SAASI,gBAAgBA,CAACC,KAAsB,EAAE;EAC/D,IAAIC,MAAM,GAAG,OAAOC,GAAG,KAAK,UAAU,GAAG,IAAIA,GAAG,CAAC,CAAC,GAAGC,SAAS;EAG9DC,OAAA,CAAAC,OAAA,GAAAN,gBAAgB,GAAG,SAASA,gBAAgBA,CAACC,KAAsB,EAAE;IACnE,IAAIA,KAAK,KAAK,IAAI,IAAI,CAAC,IAAAM,yBAAgB,EAACN,KAAK,CAAC,EAAE,OAAOA,KAAK;IAC5D,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;MAC/B,MAAM,IAAIO,SAAS,CAAC,oDAAoD,CAAC;IAC3E;IACA,IAAIN,MAAM,KAAKE,SAAS,EAAE;MACxB,IAAIF,MAAM,CAACO,GAAG,CAACR,KAAK,CAAC,EAAE,OAAOC,MAAM,CAACQ,GAAG,CAACT,KAAK,CAAC;MAC/CC,MAAM,CAACS,GAAG,CAACV,KAAK,EAAEW,OAAO,CAAC;IAC5B;IAEA,SAASA,OAAOA,CAAA,EAAG;MAEjB,OAAO,IAAAC,kBAAS,EAACZ,KAAK,EAAEa,SAAS,EAAE,IAAAC,uBAAc,EAAC,IAAI,CAAC,CAACC,WAAW,CAAC;IACtE;IACAJ,OAAO,CAACK,SAAS,GAAGC,MAAM,CAACC,MAAM,CAAClB,KAAK,CAACgB,SAAS,EAAE;MACjDD,WAAW,EAAE;QACXI,KAAK,EAAER,OAAO;QACdS,UAAU,EAAE,KAAK;QACjBC,QAAQ,EAAE,IAAI;QACdC,YAAY,EAAE;MAChB;IACF,CAAC,CAAC;IAEF,OAAO,IAAAC,uBAAc,EAACZ,OAAO,EAAEX,KAAK,CAAC;EACvC,CAAC;EAED,OAAOD,gBAAgB,CAACC,KAAK,CAAC;AAChC","ignoreList":[]}
@@ -0,0 +1,381 @@
import { expect, test } from "vitest";
import * as z from "zod/v4";
/// string
const stringSchema = z.string();
test("string async parse", async () => {
const goodData = "XXX";
const badData = 12;
const goodResult = await stringSchema.safeParseAsync(goodData);
expect(goodResult.success).toBe(true);
if (goodResult.success) expect(goodResult.data).toEqual(goodData);
const badResult = await stringSchema.safeParseAsync(badData);
expect(badResult.success).toBe(false);
if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
});
/// number
const numberSchema = z.number();
test("number async parse", async () => {
const goodData = 1234.2353;
const badData = "1234";
const goodResult = await numberSchema.safeParseAsync(goodData);
expect(goodResult.success).toBe(true);
if (goodResult.success) expect(goodResult.data).toEqual(goodData);
const badResult = await numberSchema.safeParseAsync(badData);
expect(badResult.success).toBe(false);
if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
});
/// bigInt
const bigIntSchema = z.bigint();
test("bigInt async parse", async () => {
const goodData = BigInt(145);
const badData = 134;
const goodResult = await bigIntSchema.safeParseAsync(goodData);
expect(goodResult.success).toBe(true);
if (goodResult.success) expect(goodResult.data).toEqual(goodData);
const badResult = await bigIntSchema.safeParseAsync(badData);
expect(badResult.success).toBe(false);
if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
});
/// boolean
const booleanSchema = z.boolean();
test("boolean async parse", async () => {
const goodData = true;
const badData = 1;
const goodResult = await booleanSchema.safeParseAsync(goodData);
expect(goodResult.success).toBe(true);
if (goodResult.success) expect(goodResult.data).toEqual(goodData);
const badResult = await booleanSchema.safeParseAsync(badData);
expect(badResult.success).toBe(false);
if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
});
/// date
const dateSchema = z.date();
test("date async parse", async () => {
const goodData = new Date();
const badData = new Date().toISOString();
const goodResult = await dateSchema.safeParseAsync(goodData);
expect(goodResult.success).toBe(true);
if (goodResult.success) expect(goodResult.data).toEqual(goodData);
const badResult = await dateSchema.safeParseAsync(badData);
expect(badResult.success).toBe(false);
if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
});
/// undefined
const undefinedSchema = z.undefined();
test("undefined async parse", async () => {
const goodData = undefined;
const badData = "XXX";
const goodResult = await undefinedSchema.safeParseAsync(goodData);
expect(goodResult.success).toBe(true);
if (goodResult.success) expect(goodResult.data).toEqual(undefined);
const badResult = await undefinedSchema.safeParseAsync(badData);
expect(badResult.success).toBe(false);
if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
});
/// null
const nullSchema = z.null();
test("null async parse", async () => {
const goodData = null;
const badData = undefined;
const goodResult = await nullSchema.safeParseAsync(goodData);
expect(goodResult.success).toBe(true);
if (goodResult.success) expect(goodResult.data).toEqual(goodData);
const badResult = await nullSchema.safeParseAsync(badData);
expect(badResult.success).toBe(false);
if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
});
/// any
const anySchema = z.any();
test("any async parse", async () => {
const goodData = [{}];
// const badData = 'XXX';
const goodResult = await anySchema.safeParseAsync(goodData);
expect(goodResult.success).toBe(true);
if (goodResult.success) expect(goodResult.data).toEqual(goodData);
// const badResult = await anySchema.safeParseAsync(badData);
// expect(badResult.success).toBe(false);
// if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
});
/// unknown
const unknownSchema = z.unknown();
test("unknown async parse", async () => {
const goodData = ["asdf", 124, () => {}];
// const badData = 'XXX';
const goodResult = await unknownSchema.safeParseAsync(goodData);
expect(goodResult.success).toBe(true);
if (goodResult.success) expect(goodResult.data).toEqual(goodData);
// const badResult = await unknownSchema.safeParseAsync(badData);
// expect(badResult.success).toBe(false);
// if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
});
/// void
const voidSchema = z.void();
test("void async parse", async () => {
const goodData = undefined;
const badData = 0;
const goodResult = await voidSchema.safeParseAsync(goodData);
expect(goodResult.success).toBe(true);
if (goodResult.success) expect(goodResult.data).toEqual(goodData);
const badResult = await voidSchema.safeParseAsync(badData);
expect(badResult.success).toBe(false);
if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
});
/// array
const arraySchema = z.array(z.string());
test("array async parse", async () => {
const goodData = ["XXX"];
const badData = "XXX";
const goodResult = await arraySchema.safeParseAsync(goodData);
expect(goodResult.success).toBe(true);
if (goodResult.success) expect(goodResult.data).toEqual(goodData);
const badResult = await arraySchema.safeParseAsync(badData);
expect(badResult.success).toBe(false);
if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
});
/// object
const objectSchema = z.object({ string: z.string() });
test("object async parse", async () => {
const goodData = { string: "XXX" };
const badData = { string: 12 };
const goodResult = await objectSchema.safeParseAsync(goodData);
expect(goodResult.success).toBe(true);
if (goodResult.success) expect(goodResult.data).toEqual(goodData);
const badResult = await objectSchema.safeParseAsync(badData);
expect(badResult.success).toBe(false);
if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
});
/// union
const unionSchema = z.union([z.string(), z.undefined()]);
test("union async parse", async () => {
const goodData = undefined;
const badData = null;
const goodResult = await unionSchema.safeParseAsync(goodData);
expect(goodResult.success).toBe(true);
if (goodResult.success) expect(goodResult.data).toEqual(goodData);
const badResult = await unionSchema.safeParseAsync(badData);
expect(badResult.success).toBe(false);
if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
});
/// record
const recordSchema = z.record(z.string(), z.object({}));
test("record async parse", async () => {
const goodData = { adsf: {}, asdf: {} };
const badData = [{}];
const goodResult = await recordSchema.safeParseAsync(goodData);
expect(goodResult.success).toBe(true);
if (goodResult.success) expect(goodResult.data).toEqual(goodData);
const badResult = await recordSchema.safeParseAsync(badData);
expect(badResult.success).toBe(false);
if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
});
/// function
// const functionSchema = z.function();
// test("function async parse", async () => {
// const goodData = () => {};
// const badData = "XXX";
// const goodResult = await functionSchema.safeParseAsync(goodData);
// expect(goodResult.success).toBe(true);
// if (goodResult.success) expect(typeof goodResult.data).toEqual("function");
// const badResult = await functionSchema.safeParseAsync(badData);
// expect(badResult.success).toBe(false);
// if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
// });
/// literal
const literalSchema = z.literal("asdf");
test("literal async parse", async () => {
const goodData = "asdf";
const badData = "asdff";
const goodResult = await literalSchema.safeParseAsync(goodData);
expect(goodResult.success).toBe(true);
if (goodResult.success) expect(goodResult.data).toEqual(goodData);
const badResult = await literalSchema.safeParseAsync(badData);
expect(badResult.success).toBe(false);
if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
});
/// enum
const enumSchema = z.enum(["fish", "whale"]);
test("enum async parse", async () => {
const goodData = "whale";
const badData = "leopard";
const goodResult = await enumSchema.safeParseAsync(goodData);
expect(goodResult.success).toBe(true);
if (goodResult.success) expect(goodResult.data).toEqual(goodData);
const badResult = await enumSchema.safeParseAsync(badData);
expect(badResult.success).toBe(false);
if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
});
/// nativeEnum
enum nativeEnumTest {
asdf = "qwer",
}
// @ts-ignore
const nativeEnumSchema = z.nativeEnum(nativeEnumTest);
test("nativeEnum async parse", async () => {
const goodData = nativeEnumTest.asdf;
const badData = "asdf";
const goodResult = await nativeEnumSchema.safeParseAsync(goodData);
expect(goodResult.success).toBe(true);
if (goodResult.success) expect(goodResult.data).toEqual(goodData);
const badResult = await nativeEnumSchema.safeParseAsync(badData);
expect(badResult.success).toBe(false);
if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
});
/// promise
const promiseSchema = z.promise(z.number());
test("promise async parse good", async () => {
const goodData = Promise.resolve(123);
const goodResult = await promiseSchema.safeParseAsync(goodData);
expect(goodResult.success).toBe(true);
expect(typeof goodResult.data).toEqual("number");
expect(goodResult.data).toEqual(123);
});
test("promise async parse bad", async () => {
const badData = Promise.resolve("XXX");
const badResult = await promiseSchema.safeParseAsync(badData);
expect(badResult.success).toBe(false);
expect(badResult.error).toBeInstanceOf(z.ZodError);
});
test("async validation non-empty strings", async () => {
const base = z.object({
hello: z.string().refine((x) => x && x.length > 0),
foo: z.string().refine((x) => x && x.length > 0),
});
const testval = { hello: "", foo: "" };
const result1 = base.safeParse(testval);
const result2 = base.safeParseAsync(testval);
const r1 = result1;
await result2.then((r2) => {
expect(r1.error!.issues.length).toBe(r2.error!.issues.length);
});
});
test("async validation multiple errors 1", async () => {
const base = z.object({
hello: z.string(),
foo: z.number(),
});
const testval = { hello: 3, foo: "hello" };
const result1 = base.safeParse(testval);
const result2 = base.safeParseAsync(testval);
await result2.then((result2) => {
expect(result2.error!.issues.length).toBe(result1.error!.issues.length);
});
});
test("async validation multiple errors 2", async () => {
const base = (is_async?: boolean) =>
z.object({
hello: z.string(),
foo: z.object({
bar: z.number().refine(
is_async
? async () =>
new Promise((resolve) => {
setTimeout(() => resolve(false), 500);
})
: () => false
),
}),
});
const testval = { hello: 3, foo: { bar: 4 } };
const result1 = base().safeParse(testval);
const result2 = base(true).safeParseAsync(testval);
await result2.then((result2) => {
expect(result1.error!.issues.length).toBe(result2.error!.issues.length);
});
});
test("ensure early async failure prevents follow-up refinement checks", async () => {
let count = 0;
const base = z.object({
hello: z.string(),
foo: z
.number()
.refine(async () => {
count++;
return true;
})
.refine(async () => {
count++;
return true;
}, "Good"),
});
const testval = { hello: "bye", foo: 3 };
const result = await base.safeParseAsync(testval);
if (result.success === false) {
expect(result.error.issues.length).toBe(1);
expect(count).toBe(1);
}
// await result.then((r) => {
// if (r.success === false) expect(r.error.issues.length).toBe(1);
// expect(count).toBe(2);
// });
});
@@ -0,0 +1,48 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://json-schema.org/draft/2020-12/meta/applicator",
"$vocabulary": {
"https://json-schema.org/draft/2020-12/vocab/applicator": true
},
"$dynamicAnchor": "meta",
"title": "Applicator vocabulary meta-schema",
"type": ["object", "boolean"],
"properties": {
"prefixItems": {"$ref": "#/$defs/schemaArray"},
"items": {"$dynamicRef": "#meta"},
"contains": {"$dynamicRef": "#meta"},
"additionalProperties": {"$dynamicRef": "#meta"},
"properties": {
"type": "object",
"additionalProperties": {"$dynamicRef": "#meta"},
"default": {}
},
"patternProperties": {
"type": "object",
"additionalProperties": {"$dynamicRef": "#meta"},
"propertyNames": {"format": "regex"},
"default": {}
},
"dependentSchemas": {
"type": "object",
"additionalProperties": {"$dynamicRef": "#meta"},
"default": {}
},
"propertyNames": {"$dynamicRef": "#meta"},
"if": {"$dynamicRef": "#meta"},
"then": {"$dynamicRef": "#meta"},
"else": {"$dynamicRef": "#meta"},
"allOf": {"$ref": "#/$defs/schemaArray"},
"anyOf": {"$ref": "#/$defs/schemaArray"},
"oneOf": {"$ref": "#/$defs/schemaArray"},
"not": {"$dynamicRef": "#meta"}
},
"$defs": {
"schemaArray": {
"type": "array",
"minItems": 1,
"items": {"$dynamicRef": "#meta"}
}
}
}
@@ -0,0 +1,15 @@
import { NativeAnimation } from './NativeAnimation.mjs';
class NativeAnimationWrapper extends NativeAnimation {
constructor(animation) {
super();
this.animation = animation;
animation.onfinish = () => {
this.finishedTime = this.time;
this.notifyFinished();
};
}
}
export { NativeAnimationWrapper };
//# sourceMappingURL=NativeAnimationWrapper.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"unescape.js","sourceRoot":"","sources":["../../src/unescape.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;GAkBG;AAEI,MAAM,QAAQ,GAAG,CACtB,CAAS,EACT,EACE,oBAAoB,GAAG,KAAK,EAC5B,aAAa,GAAG,IAAI,MACgD,EAAE,EACxE,EAAE;IACF,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,oBAAoB,CAAC,CAAC;YACzB,CAAC,CAAC,OAAO,CAAC,eAAe,EAAE,IAAI,CAAC;YAClC,CAAC,CAAC,CAAC;iBACE,OAAO,CAAC,0BAA0B,EAAE,MAAM,CAAC;iBAC3C,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;IACnC,CAAC;IACD,OAAO,oBAAoB,CAAC,CAAC;QACzB,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAAC;QACpC,CAAC,CAAC,CAAC;aACE,OAAO,CAAC,4BAA4B,EAAE,MAAM,CAAC;aAC7C,OAAO,CAAC,aAAa,EAAE,IAAI,CAAC,CAAA;AACrC,CAAC,CAAA;AAnBY,QAAA,QAAQ,YAmBpB","sourcesContent":["import type { MinimatchOptions } from './index.js'\n\n/**\n * Un-escape a string that has been escaped with {@link escape}.\n *\n * If the {@link MinimatchOptions.windowsPathsNoEscape} option is used, then\n * square-bracket escapes are removed, but not backslash escapes.\n *\n * For example, it will turn the string `'[*]'` into `*`, but it will not\n * turn `'\\\\*'` into `'*'`, because `\\` is a path separator in\n * `windowsPathsNoEscape` mode.\n *\n * When `windowsPathsNoEscape` is not set, then both square-bracket escapes and\n * backslash escapes are removed.\n *\n * Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped\n * or unescaped.\n *\n * When `magicalBraces` is not set, escapes of braces (`{` and `}`) will not be\n * unescaped.\n */\n\nexport const unescape = (\n s: string,\n {\n windowsPathsNoEscape = false,\n magicalBraces = true,\n }: Pick<MinimatchOptions, 'windowsPathsNoEscape' | 'magicalBraces'> = {},\n) => {\n if (magicalBraces) {\n return windowsPathsNoEscape ?\n s.replace(/\\[([^/\\\\])\\]/g, '$1')\n : s\n .replace(/((?!\\\\).|^)\\[([^/\\\\])\\]/g, '$1$2')\n .replace(/\\\\([^/])/g, '$1')\n }\n return windowsPathsNoEscape ?\n s.replace(/\\[([^/\\\\{}])\\]/g, '$1')\n : s\n .replace(/((?!\\\\).|^)\\[([^/\\\\{}])\\]/g, '$1$2')\n .replace(/\\\\([^/{}])/g, '$1')\n}\n"]}
@@ -0,0 +1 @@
{"version":3,"file":"disc.js","sources":["../../../src/icons/disc.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Disc\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMCIgLz4KICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIyIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/disc\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 Disc = createLucideIcon('Disc', [\n ['circle', { cx: '12', cy: '12', r: '10', key: '1mglay' }],\n ['circle', { cx: '12', cy: '12', r: '2', key: '1c9p78' }],\n]);\n\nexport default Disc;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,iBAAiB,MAAQ,CAAA,CAAA,CAAA;AAAA,CACpC,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,CAAA,CAAM,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,CAAA;AAAA,CACzD,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;AAC1D,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,323 @@
export default `flf2a$ 3 3 7 -1 16 0 0 0
Author : MikeChat & myflix
Date : 2006/5/29 18:09:53
Version: 1.1
-------------------------------------------------
-------------------------------------------------
This font has been created using JavE's FIGlet font export assistant.
Have a look at: http://www.jave.de
Permission is hereby given to modify this font, as long as the
modifier's name is placed on a comment line.
---
Font modified June 17, 2007 by patorjk
This was to widen the space character.
$ $#
$ $#
$ $##
o-- #
#
##
"#
#
##
##
#
##
$#
#
##
%#
#
##
&#
#
##
'#
#
##
#
,.-.,#
##
#
\`'-'\`#
##
*#
#
##
#
+ #
##
,#
#
##
#
| #
##
#
. #
##
/#
#
##
___ #
(___)#
##
#
____\\#
##
#
|\`._)#
##
#
(_|_)#
##
__#
__|__#
##
_ #
(_| |#
##
___ #
(_) \`#
##
#
____|#
##
_ _ #
(_|_)#
##
_ #
__(_)#
##
:#
#
##
;#
#
##
<#
#
##
=#
#
##
> >#
#
##
#
o-_)#
##
@#
#
##
____ #
__|_)#
##
___ #
(_|_)#
##
___ #
( )#
##
___ #
( )#
\`-' ##
___ #
| ' |#
##
____ #
' |#
##
___ #
( )#
\`| ##
_____#
__|__#
##
|___|#
| |#
##
( #
\`--|#
##
_____#
/\\ #
..' ##
____#
| #
##
_____#
____<#
##
_____#
___/_#
##
.-. #
( )#
\`-' ##
____ #
(_)#
##
___ #
(.__)#
' ##
____ #
_/(_)#
##
_ #
(_/ )#
##
____|#
|#
##
____#
(____#
##
____#
<____#
##
____#
(____#
(____##
_ _#
\\_/ #
_/ \\_##
____/#
\\#
##
_ #
| \\_|#
##
___ #
' '#
##
\\#
#
##
#
,___,#
##
#
> #
##
#
| #
##
\`#
#
##
_ #
_|) #
##
__ #
(_) #
##
_ #
| | #
##
_ #
(_)_#
##
_ #
(|) #
##
__ #
|) #
##
_ #
((_) #
##
___ #
_) #
##
#
--o #
##
#
(__ #
##
___ #
/\\ #
##
___ #
#
##
__ #
__< #
##
__. #
__) #
##
_ #
(_) #
##
__ #
(_) #
##
_ #
_(_) #
##
___ #
) #
##
#
(/) #
##
_,_#
( ' #
##
__ #
(__ #
##
__ #
<__ #
##
__ #
(_ #
(__ ##
\\,/ #
/\`\\ #
##
#
(_/_ #
##
#
|\\| #
##
#
,-'-,#
##
#
#
_ ##
#
\`-.-\`#
##
~#
#
##
�#
#
##
�#
#
##
�#
#
##
�#
#
##
�#
#
##
�#
#
##
�#
#
##`
@@ -0,0 +1,5 @@
/**
* Determines if the current platform is Windows
* @returns true if running on Windows, false otherwise
*/
export declare function isWindows(): boolean;
@@ -0,0 +1,29 @@
{
"name": "detect-node-es",
"version": "1.1.0",
"description": "Detect Node.JS (as opposite to browser environment). ESM modification",
"main": "es5/node.js",
"module": "esm/node.js",
"browser": {
"./es5/node.js": "./es5/browser.js",
"./esm/node.js": "./esm/browser.js"
},
"types": "es5/node.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/thekashey/detect-node"
},
"keywords": [
"detect",
"node"
],
"author": "Ilya Kantor",
"license": "MIT",
"bugs": {
"url": "https://github.com/thekashey/detect-node/issues"
},
"homepage": "https://github.com/thekashey/detect-node"
}
@@ -0,0 +1,270 @@
'use strict';
var URI = require('uri-js')
, equal = require('fast-deep-equal')
, util = require('./util')
, SchemaObject = require('./schema_obj')
, traverse = require('json-schema-traverse');
module.exports = resolve;
resolve.normalizeId = normalizeId;
resolve.fullPath = getFullPath;
resolve.url = resolveUrl;
resolve.ids = resolveIds;
resolve.inlineRef = inlineRef;
resolve.schema = resolveSchema;
/**
* [resolve and compile the references ($ref)]
* @this Ajv
* @param {Function} compile reference to schema compilation funciton (localCompile)
* @param {Object} root object with information about the root schema for the current schema
* @param {String} ref reference to resolve
* @return {Object|Function} schema object (if the schema can be inlined) or validation function
*/
function resolve(compile, root, ref) {
/* jshint validthis: true */
var refVal = this._refs[ref];
if (typeof refVal == 'string') {
if (this._refs[refVal]) refVal = this._refs[refVal];
else return resolve.call(this, compile, root, refVal);
}
refVal = refVal || this._schemas[ref];
if (refVal instanceof SchemaObject) {
return inlineRef(refVal.schema, this._opts.inlineRefs)
? refVal.schema
: refVal.validate || this._compile(refVal);
}
var res = resolveSchema.call(this, root, ref);
var schema, v, baseId;
if (res) {
schema = res.schema;
root = res.root;
baseId = res.baseId;
}
if (schema instanceof SchemaObject) {
v = schema.validate || compile.call(this, schema.schema, root, undefined, baseId);
} else if (schema !== undefined) {
v = inlineRef(schema, this._opts.inlineRefs)
? schema
: compile.call(this, schema, root, undefined, baseId);
}
return v;
}
/**
* Resolve schema, its root and baseId
* @this Ajv
* @param {Object} root root object with properties schema, refVal, refs
* @param {String} ref reference to resolve
* @return {Object} object with properties schema, root, baseId
*/
function resolveSchema(root, ref) {
/* jshint validthis: true */
var p = URI.parse(ref)
, refPath = _getFullPath(p)
, baseId = getFullPath(this._getId(root.schema));
if (Object.keys(root.schema).length === 0 || refPath !== baseId) {
var id = normalizeId(refPath);
var refVal = this._refs[id];
if (typeof refVal == 'string') {
return resolveRecursive.call(this, root, refVal, p);
} else if (refVal instanceof SchemaObject) {
if (!refVal.validate) this._compile(refVal);
root = refVal;
} else {
refVal = this._schemas[id];
if (refVal instanceof SchemaObject) {
if (!refVal.validate) this._compile(refVal);
if (id == normalizeId(ref))
return { schema: refVal, root: root, baseId: baseId };
root = refVal;
} else {
return;
}
}
if (!root.schema) return;
baseId = getFullPath(this._getId(root.schema));
}
return getJsonPointer.call(this, p, baseId, root.schema, root);
}
/* @this Ajv */
function resolveRecursive(root, ref, parsedRef) {
/* jshint validthis: true */
var res = resolveSchema.call(this, root, ref);
if (res) {
var schema = res.schema;
var baseId = res.baseId;
root = res.root;
var id = this._getId(schema);
if (id) baseId = resolveUrl(baseId, id);
return getJsonPointer.call(this, parsedRef, baseId, schema, root);
}
}
var PREVENT_SCOPE_CHANGE = util.toHash(['properties', 'patternProperties', 'enum', 'dependencies', 'definitions']);
/* @this Ajv */
function getJsonPointer(parsedRef, baseId, schema, root) {
/* jshint validthis: true */
parsedRef.fragment = parsedRef.fragment || '';
if (parsedRef.fragment.slice(0,1) != '/') return;
var parts = parsedRef.fragment.split('/');
for (var i = 1; i < parts.length; i++) {
var part = parts[i];
if (part) {
part = util.unescapeFragment(part);
schema = schema[part];
if (schema === undefined) break;
var id;
if (!PREVENT_SCOPE_CHANGE[part]) {
id = this._getId(schema);
if (id) baseId = resolveUrl(baseId, id);
if (schema.$ref) {
var $ref = resolveUrl(baseId, schema.$ref);
var res = resolveSchema.call(this, root, $ref);
if (res) {
schema = res.schema;
root = res.root;
baseId = res.baseId;
}
}
}
}
}
if (schema !== undefined && schema !== root.schema)
return { schema: schema, root: root, baseId: baseId };
}
var SIMPLE_INLINED = util.toHash([
'type', 'format', 'pattern',
'maxLength', 'minLength',
'maxProperties', 'minProperties',
'maxItems', 'minItems',
'maximum', 'minimum',
'uniqueItems', 'multipleOf',
'required', 'enum'
]);
function inlineRef(schema, limit) {
if (limit === false) return false;
if (limit === undefined || limit === true) return checkNoRef(schema);
else if (limit) return countKeys(schema) <= limit;
}
function checkNoRef(schema) {
var item;
if (Array.isArray(schema)) {
for (var i=0; i<schema.length; i++) {
item = schema[i];
if (typeof item == 'object' && !checkNoRef(item)) return false;
}
} else {
for (var key in schema) {
if (key == '$ref') return false;
item = schema[key];
if (typeof item == 'object' && !checkNoRef(item)) return false;
}
}
return true;
}
function countKeys(schema) {
var count = 0, item;
if (Array.isArray(schema)) {
for (var i=0; i<schema.length; i++) {
item = schema[i];
if (typeof item == 'object') count += countKeys(item);
if (count == Infinity) return Infinity;
}
} else {
for (var key in schema) {
if (key == '$ref') return Infinity;
if (SIMPLE_INLINED[key]) {
count++;
} else {
item = schema[key];
if (typeof item == 'object') count += countKeys(item) + 1;
if (count == Infinity) return Infinity;
}
}
}
return count;
}
function getFullPath(id, normalize) {
if (normalize !== false) id = normalizeId(id);
var p = URI.parse(id);
return _getFullPath(p);
}
function _getFullPath(p) {
return URI.serialize(p).split('#')[0] + '#';
}
var TRAILING_SLASH_HASH = /#\/?$/;
function normalizeId(id) {
return id ? id.replace(TRAILING_SLASH_HASH, '') : '';
}
function resolveUrl(baseId, id) {
id = normalizeId(id);
return URI.resolve(baseId, id);
}
/* @this Ajv */
function resolveIds(schema) {
var schemaId = normalizeId(this._getId(schema));
var baseIds = {'': schemaId};
var fullPaths = {'': getFullPath(schemaId, false)};
var localRefs = {};
var self = this;
traverse(schema, {allKeys: true}, function(sch, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
if (jsonPtr === '') return;
var id = self._getId(sch);
var baseId = baseIds[parentJsonPtr];
var fullPath = fullPaths[parentJsonPtr] + '/' + parentKeyword;
if (keyIndex !== undefined)
fullPath += '/' + (typeof keyIndex == 'number' ? keyIndex : util.escapeFragment(keyIndex));
if (typeof id == 'string') {
id = baseId = normalizeId(baseId ? URI.resolve(baseId, id) : id);
var refVal = self._refs[id];
if (typeof refVal == 'string') refVal = self._refs[refVal];
if (refVal && refVal.schema) {
if (!equal(sch, refVal.schema))
throw new Error('id "' + id + '" resolves to more than one schema');
} else if (id != normalizeId(fullPath)) {
if (id[0] == '#') {
if (localRefs[id] && !equal(sch, localRefs[id]))
throw new Error('id "' + id + '" resolves to more than one schema');
localRefs[id] = sch;
} else {
self._refs[id] = fullPath;
}
}
}
baseIds[jsonPtr] = baseId;
fullPaths[jsonPtr] = fullPath;
});
return localRefs;
}
@@ -0,0 +1 @@
{"version":3,"file":"route.js","sources":["../../../src/icons/route.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Route\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSI2IiBjeT0iMTkiIHI9IjMiIC8+CiAgPHBhdGggZD0iTTkgMTloOC41YTMuNSAzLjUgMCAwIDAgMC03aC0xMWEzLjUgMy41IDAgMCAxIDAtN0gxNSIgLz4KICA8Y2lyY2xlIGN4PSIxOCIgY3k9IjUiIHI9IjMiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/route\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 Route = createLucideIcon('Route', [\n ['circle', { cx: '6', cy: '19', r: '3', key: '1kj8tv' }],\n ['path',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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA;AACzD,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,983 @@
'use client'
import * as React from 'react'
import { useStore } from '@tanstack/react-store'
import { flushSync } from 'react-dom'
import {
deepEqual,
exactPathTest,
functionalUpdate,
hasKeys,
isDangerousProtocol,
preloadWarning,
removeTrailingSlash,
} from '@tanstack/router-core'
import { isServer } from '@tanstack/router-core/isServer'
import { useRouter } from './useRouter'
import { useForwardedRef, useIntersectionObserver } from './utils'
import { useHydrated } from './ClientOnly'
import type {
AnyRouter,
Constrain,
LinkOptions,
RegisteredRouter,
RoutePaths,
} from '@tanstack/router-core'
import type { ReactNode } from 'react'
import type {
ValidateLinkOptions,
ValidateLinkOptionsArray,
} from './typePrimitives'
/**
* Build anchor-like props for declarative navigation and preloading.
*
* Returns stable `href`, event handlers and accessibility props derived from
* router options and active state. Used internally by `Link` and custom links.
*
* Options cover `to`, `params`, `search`, `hash`, `state`, `preload`,
* `activeProps`, `inactiveProps`, and more.
*
* @returns React anchor props suitable for `<a>` or custom components.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLinkPropsHook
*/
export function useLinkProps<
TRouter extends AnyRouter = RegisteredRouter,
const TFrom extends string = string,
const TTo extends string | undefined = undefined,
const TMaskFrom extends string = TFrom,
const TMaskTo extends string = '',
>(
options: UseLinkPropsOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,
forwardedRef?: React.ForwardedRef<Element>,
): React.ComponentPropsWithRef<'a'> {
const router = useRouter()
const innerRef = useForwardedRef(forwardedRef)
// Determine if we're on the server - used for tree-shaking client-only code
const _isServer = isServer ?? router.isServer
const {
// custom props
activeProps,
inactiveProps,
activeOptions,
to,
preload: userPreload,
preloadDelay: userPreloadDelay,
preloadIntentProximity: _preloadIntentProximity,
hashScrollIntoView,
replace,
startTransition,
resetScroll,
viewTransition,
// element props
children,
target,
disabled,
style,
className,
onClick,
onBlur,
onFocus,
onMouseEnter,
onMouseLeave,
onTouchStart,
ignoreBlocker,
// prevent these from being returned
params: _params,
search: _search,
hash: _hash,
state: _state,
mask: _mask,
reloadDocument: _reloadDocument,
unsafeRelative: _unsafeRelative,
from: _from,
_fromLocation,
...propsSafeToSpread
} = options
// ==========================================================================
// SERVER EARLY RETURN
// On the server, we return static props without any event handlers,
// effects, or client-side interactivity.
//
// For SSR parity (to avoid hydration errors), we still compute the link's
// active status on the server, but we avoid creating any router-state
// subscriptions by reading from the location store directly.
//
// Note: `location.hash` is not available on the server.
// ==========================================================================
if (_isServer) {
const safeInternal = isSafeInternal(to)
// If `to` is obviously an absolute URL, treat as external and avoid
// computing the internal location via `buildLocation`.
if (
typeof to === 'string' &&
!safeInternal &&
// Quick checks to avoid `new URL` in common internal-like cases
to.indexOf(':') > -1
) {
try {
new URL(to)
if (isDangerousProtocol(to, router.protocolAllowlist)) {
if (process.env.NODE_ENV !== 'production') {
console.warn(`Blocked Link with dangerous protocol: ${to}`)
}
return {
...propsSafeToSpread,
ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],
href: undefined,
...(children && { children }),
...(target && { target }),
...(disabled && { disabled }),
...(style && { style }),
...(className && { className }),
}
}
return {
...propsSafeToSpread,
ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],
href: to,
...(children && { children }),
...(target && { target }),
...(disabled && { disabled }),
...(style && { style }),
...(className && { className }),
}
} catch {
// Not an absolute URL
}
}
const next = router.buildLocation({ ...options, from: options.from } as any)
// Use publicHref - it contains the correct href for display
// When a rewrite changes the origin, publicHref is the full URL
// Otherwise it's the origin-stripped path
// This avoids constructing URL objects in the hot path
const hrefOptionPublicHref = next.maskedLocation
? next.maskedLocation.publicHref
: next.publicHref
const hrefOptionExternal = next.maskedLocation
? next.maskedLocation.external
: next.external
const hrefOption = getHrefOption(
hrefOptionPublicHref,
hrefOptionExternal,
router.history,
disabled,
)
const externalLink = (() => {
if (hrefOption?.external) {
if (isDangerousProtocol(hrefOption.href, router.protocolAllowlist)) {
if (process.env.NODE_ENV !== 'production') {
console.warn(
`Blocked Link with dangerous protocol: ${hrefOption.href}`,
)
}
return undefined
}
return hrefOption.href
}
if (safeInternal) return undefined
// Only attempt URL parsing when it looks like an absolute URL.
if (typeof to === 'string' && to.indexOf(':') > -1) {
try {
new URL(to)
if (isDangerousProtocol(to, router.protocolAllowlist)) {
if (process.env.NODE_ENV !== 'production') {
console.warn(`Blocked Link with dangerous protocol: ${to}`)
}
return undefined
}
return to
} catch {}
}
return undefined
})()
const isActive = (() => {
if (externalLink) return false
const currentLocation = router.stores.location.get()
const exact = activeOptions?.exact ?? false
if (exact) {
const testExact = exactPathTest(
currentLocation.pathname,
next.pathname,
router.basepath,
)
if (!testExact) {
return false
}
} else {
const currentPathSplit = removeTrailingSlash(
currentLocation.pathname,
router.basepath,
)
const nextPathSplit = removeTrailingSlash(
next.pathname,
router.basepath,
)
const pathIsFuzzyEqual =
currentPathSplit.startsWith(nextPathSplit) &&
(currentPathSplit.length === nextPathSplit.length ||
currentPathSplit[nextPathSplit.length] === '/')
if (!pathIsFuzzyEqual) {
return false
}
}
const includeSearch = activeOptions?.includeSearch ?? true
if (includeSearch) {
if (currentLocation.search !== next.search) {
const currentSearchEmpty =
!currentLocation.search ||
(typeof currentLocation.search === 'object' &&
!hasKeys(currentLocation.search))
const nextSearchEmpty =
!next.search ||
(typeof next.search === 'object' &&
!hasKeys(next.search as Record<string, unknown>))
if (!(currentSearchEmpty && nextSearchEmpty)) {
const searchTest = deepEqual(currentLocation.search, next.search, {
partial: !exact,
ignoreUndefined: !activeOptions?.explicitUndefined,
})
if (!searchTest) {
return false
}
}
}
}
// Hash is not available on the server
if (activeOptions?.includeHash) {
return false
}
return true
})()
if (externalLink) {
return {
...propsSafeToSpread,
ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],
href: externalLink,
...(children && { children }),
...(target && { target }),
...(disabled && { disabled }),
...(style && { style }),
...(className && { className }),
}
}
const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> =
isActive
? (functionalUpdate(activeProps as any, {}) ?? STATIC_ACTIVE_OBJECT)
: STATIC_EMPTY_OBJECT
const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =
isActive
? STATIC_EMPTY_OBJECT
: (functionalUpdate(inactiveProps, {}) ?? STATIC_EMPTY_OBJECT)
const resolvedStyle = (() => {
const baseStyle = style
const activeStyle = resolvedActiveProps.style
const inactiveStyle = resolvedInactiveProps.style
if (!baseStyle && !activeStyle && !inactiveStyle) {
return undefined
}
if (baseStyle && !activeStyle && !inactiveStyle) {
return baseStyle
}
if (!baseStyle && activeStyle && !inactiveStyle) {
return activeStyle
}
if (!baseStyle && !activeStyle && inactiveStyle) {
return inactiveStyle
}
return {
...baseStyle,
...activeStyle,
...inactiveStyle,
}
})()
const resolvedClassName = (() => {
const baseClassName = className
const activeClassName = resolvedActiveProps.className
const inactiveClassName = resolvedInactiveProps.className
if (!baseClassName && !activeClassName && !inactiveClassName) {
return ''
}
let out = ''
if (baseClassName) {
out = baseClassName
}
if (activeClassName) {
out = out ? `${out} ${activeClassName}` : activeClassName
}
if (inactiveClassName) {
out = out ? `${out} ${inactiveClassName}` : inactiveClassName
}
return out
})()
return {
...propsSafeToSpread,
...resolvedActiveProps,
...resolvedInactiveProps,
href: hrefOption?.href,
ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],
disabled: !!disabled,
target,
...(resolvedStyle && { style: resolvedStyle }),
...(resolvedClassName && { className: resolvedClassName }),
...(disabled && STATIC_DISABLED_PROPS),
...(isActive && STATIC_ACTIVE_PROPS),
}
}
// ==========================================================================
// CLIENT-ONLY CODE
// Everything below this point only runs on the client. The `isServer` check
// above is a compile-time constant that bundlers use for dead code elimination,
// so this entire section is removed from server bundles.
//
// We disable the rules-of-hooks lint rule because these hooks appear after
// an early return. This is safe because:
// 1. `isServer` is a compile-time constant from conditional exports
// 2. In server bundles, this code is completely eliminated by the bundler
// 3. In client bundles, `isServer` is `false`, so the early return never executes
// ==========================================================================
// eslint-disable-next-line react-hooks/rules-of-hooks
const isHydrated = useHydrated()
// eslint-disable-next-line react-hooks/rules-of-hooks
const _options = React.useMemo(
() => options,
// eslint-disable-next-line react-hooks/exhaustive-deps
[
router,
options.from,
options._fromLocation,
options.hash,
options.to,
options.search,
options.params,
options.state,
options.mask,
options.unsafeRelative,
],
)
// eslint-disable-next-line react-hooks/rules-of-hooks
const currentLocation = useStore(
router.stores.location,
(l) => l,
(prev, next) => prev.href === next.href,
)
// eslint-disable-next-line react-hooks/rules-of-hooks
const next = React.useMemo(() => {
const opts = { _fromLocation: currentLocation, ..._options }
return router.buildLocation(opts as any)
}, [router, currentLocation, _options])
// Use publicHref - it contains the correct href for display
// When a rewrite changes the origin, publicHref is the full URL
// Otherwise it's the origin-stripped path
// This avoids constructing URL objects in the hot path
const hrefOptionPublicHref = next.maskedLocation
? next.maskedLocation.publicHref
: next.publicHref
const hrefOptionExternal = next.maskedLocation
? next.maskedLocation.external
: next.external
// eslint-disable-next-line react-hooks/rules-of-hooks
const hrefOption = React.useMemo(
() =>
getHrefOption(
hrefOptionPublicHref,
hrefOptionExternal,
router.history,
disabled,
),
[disabled, hrefOptionExternal, hrefOptionPublicHref, router.history],
)
// eslint-disable-next-line react-hooks/rules-of-hooks
const externalLink = React.useMemo(() => {
if (hrefOption?.external) {
// Block dangerous protocols for external links
if (isDangerousProtocol(hrefOption.href, router.protocolAllowlist)) {
if (process.env.NODE_ENV !== 'production') {
console.warn(
`Blocked Link with dangerous protocol: ${hrefOption.href}`,
)
}
return undefined
}
return hrefOption.href
}
const safeInternal = isSafeInternal(to)
if (safeInternal) return undefined
if (typeof to !== 'string' || to.indexOf(':') === -1) return undefined
try {
new URL(to as any)
// Block dangerous protocols like javascript:, blob:, data:
if (isDangerousProtocol(to, router.protocolAllowlist)) {
if (process.env.NODE_ENV !== 'production') {
console.warn(`Blocked Link with dangerous protocol: ${to}`)
}
return undefined
}
return to
} catch {}
return undefined
}, [to, hrefOption, router.protocolAllowlist])
// eslint-disable-next-line react-hooks/rules-of-hooks
const isActive = React.useMemo(() => {
if (externalLink) return false
if (activeOptions?.exact) {
const testExact = exactPathTest(
currentLocation.pathname,
next.pathname,
router.basepath,
)
if (!testExact) {
return false
}
} else {
const currentPathSplit = removeTrailingSlash(
currentLocation.pathname,
router.basepath,
)
const nextPathSplit = removeTrailingSlash(next.pathname, router.basepath)
const pathIsFuzzyEqual =
currentPathSplit.startsWith(nextPathSplit) &&
(currentPathSplit.length === nextPathSplit.length ||
currentPathSplit[nextPathSplit.length] === '/')
if (!pathIsFuzzyEqual) {
return false
}
}
if (activeOptions?.includeSearch ?? true) {
const searchTest = deepEqual(currentLocation.search, next.search, {
partial: !activeOptions?.exact,
ignoreUndefined: !activeOptions?.explicitUndefined,
})
if (!searchTest) {
return false
}
}
if (activeOptions?.includeHash) {
return isHydrated && currentLocation.hash === next.hash
}
return true
}, [
activeOptions?.exact,
activeOptions?.explicitUndefined,
activeOptions?.includeHash,
activeOptions?.includeSearch,
currentLocation,
externalLink,
isHydrated,
next.hash,
next.pathname,
next.search,
router.basepath,
])
// Get the active props
const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> = isActive
? (functionalUpdate(activeProps as any, {}) ?? STATIC_ACTIVE_OBJECT)
: STATIC_EMPTY_OBJECT
// Get the inactive props
const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =
isActive
? STATIC_EMPTY_OBJECT
: (functionalUpdate(inactiveProps, {}) ?? STATIC_EMPTY_OBJECT)
const resolvedClassName = [
className,
resolvedActiveProps.className,
resolvedInactiveProps.className,
]
.filter(Boolean)
.join(' ')
const resolvedStyle = (style ||
resolvedActiveProps.style ||
resolvedInactiveProps.style) && {
...style,
...resolvedActiveProps.style,
...resolvedInactiveProps.style,
}
// eslint-disable-next-line react-hooks/rules-of-hooks
const [isTransitioning, setIsTransitioning] = React.useState(false)
// eslint-disable-next-line react-hooks/rules-of-hooks
const hasRenderFetched = React.useRef(false)
const preload =
options.reloadDocument || externalLink
? false
: (userPreload ?? router.options.defaultPreload)
const preloadDelay =
userPreloadDelay ?? router.options.defaultPreloadDelay ?? 0
// eslint-disable-next-line react-hooks/rules-of-hooks
const doPreload = React.useCallback(() => {
router
.preloadRoute({ ..._options, _builtLocation: next } as any)
.catch((err) => {
console.warn(err)
console.warn(preloadWarning)
})
}, [router, _options, next])
// eslint-disable-next-line react-hooks/rules-of-hooks
const preloadViewportIoCallback = React.useCallback(
(entry: IntersectionObserverEntry | undefined) => {
if (entry?.isIntersecting) {
doPreload()
}
},
[doPreload],
)
// eslint-disable-next-line react-hooks/rules-of-hooks
useIntersectionObserver(
innerRef,
preloadViewportIoCallback,
intersectionObserverOptions,
{ disabled: !!disabled || !(preload === 'viewport') },
)
// eslint-disable-next-line react-hooks/rules-of-hooks
React.useEffect(() => {
if (hasRenderFetched.current) {
return
}
if (!disabled && preload === 'render') {
doPreload()
hasRenderFetched.current = true
}
}, [disabled, doPreload, preload])
// The click handler
const handleClick = (e: React.MouseEvent) => {
// Check actual element's target attribute as fallback
const elementTarget = (
e.currentTarget as HTMLAnchorElement | SVGAElement
).getAttribute('target')
const effectiveTarget = target !== undefined ? target : elementTarget
if (
!disabled &&
!isCtrlEvent(e) &&
!e.defaultPrevented &&
(!effectiveTarget || effectiveTarget === '_self') &&
e.button === 0
) {
e.preventDefault()
flushSync(() => {
setIsTransitioning(true)
})
const unsub = router.subscribe('onResolved', () => {
unsub()
setIsTransitioning(false)
})
// All is well? Navigate!
// N.B. we don't call `router.commitLocation(next) here because we want to run `validateSearch` before committing
router.navigate({
..._options,
replace,
resetScroll,
hashScrollIntoView,
startTransition,
viewTransition,
ignoreBlocker,
})
}
}
if (externalLink) {
return {
...propsSafeToSpread,
ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],
href: externalLink,
...(children && { children }),
...(target && { target }),
...(disabled && { disabled }),
...(style && { style }),
...(className && { className }),
...(onClick && { onClick }),
...(onBlur && { onBlur }),
...(onFocus && { onFocus }),
...(onMouseEnter && { onMouseEnter }),
...(onMouseLeave && { onMouseLeave }),
...(onTouchStart && { onTouchStart }),
}
}
const enqueueIntentPreload = (e: React.MouseEvent | React.FocusEvent) => {
if (disabled || preload !== 'intent') return
if (!preloadDelay) {
doPreload()
return
}
const eventTarget = e.currentTarget
if (timeoutMap.has(eventTarget)) {
return
}
const id = setTimeout(() => {
timeoutMap.delete(eventTarget)
doPreload()
}, preloadDelay)
timeoutMap.set(eventTarget, id)
}
const handleTouchStart = (_: React.TouchEvent) => {
if (disabled || preload !== 'intent') return
doPreload()
}
const handleLeave = (e: React.MouseEvent | React.FocusEvent) => {
if (disabled || !preload || !preloadDelay) return
const eventTarget = e.currentTarget
const id = timeoutMap.get(eventTarget)
if (id) {
clearTimeout(id)
timeoutMap.delete(eventTarget)
}
}
return {
...propsSafeToSpread,
...resolvedActiveProps,
...resolvedInactiveProps,
href: hrefOption?.href,
ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],
onClick: composeHandlers([onClick, handleClick]),
onBlur: composeHandlers([onBlur, handleLeave]),
onFocus: composeHandlers([onFocus, enqueueIntentPreload]),
onMouseEnter: composeHandlers([onMouseEnter, enqueueIntentPreload]),
onMouseLeave: composeHandlers([onMouseLeave, handleLeave]),
onTouchStart: composeHandlers([onTouchStart, handleTouchStart]),
disabled: !!disabled,
target,
...(resolvedStyle && { style: resolvedStyle }),
...(resolvedClassName && { className: resolvedClassName }),
...(disabled && STATIC_DISABLED_PROPS),
...(isActive && STATIC_ACTIVE_PROPS),
...(isHydrated && isTransitioning && STATIC_TRANSITIONING_PROPS),
}
}
const STATIC_EMPTY_OBJECT = {}
const STATIC_ACTIVE_OBJECT = { className: 'active' }
const STATIC_DISABLED_PROPS = { role: 'link', 'aria-disabled': true }
const STATIC_ACTIVE_PROPS = { 'data-status': 'active', 'aria-current': 'page' }
const STATIC_TRANSITIONING_PROPS = { 'data-transitioning': 'transitioning' }
const timeoutMap = new WeakMap<EventTarget, ReturnType<typeof setTimeout>>()
const intersectionObserverOptions: IntersectionObserverInit = {
rootMargin: '100px',
}
const composeHandlers =
(handlers: Array<undefined | React.EventHandler<any>>) =>
(e: React.SyntheticEvent) => {
for (const handler of handlers) {
if (!handler) continue
if (e.defaultPrevented) return
handler(e)
}
}
function getHrefOption(
publicHref: string,
external: boolean,
history: AnyRouter['history'],
disabled: boolean | undefined,
) {
if (disabled) return undefined
// Full URL means rewrite changed the origin - treat as external-like
if (external) {
return { href: publicHref, external: true }
}
return {
href: history.createHref(publicHref) || '/',
external: false,
}
}
function isSafeInternal(to: unknown) {
if (typeof to !== 'string') return false
const zero = to.charCodeAt(0)
if (zero === 47) return to.charCodeAt(1) !== 47 // '/' but not '//'
return zero === 46 // '.', '..', './', '../'
}
type UseLinkReactProps<TComp> = TComp extends keyof React.JSX.IntrinsicElements
? React.JSX.IntrinsicElements[TComp]
: TComp extends React.ComponentType<any>
? React.ComponentPropsWithoutRef<TComp> &
React.RefAttributes<React.ComponentRef<TComp>>
: never
export type UseLinkPropsOptions<
TRouter extends AnyRouter = RegisteredRouter,
TFrom extends RoutePaths<TRouter['routeTree']> | string = string,
TTo extends string | undefined = '.',
TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,
TMaskTo extends string = '.',
> = ActiveLinkOptions<'a', TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &
UseLinkReactProps<'a'>
export type ActiveLinkOptions<
TComp = 'a',
TRouter extends AnyRouter = RegisteredRouter,
TFrom extends string = string,
TTo extends string | undefined = '.',
TMaskFrom extends string = TFrom,
TMaskTo extends string = '.',
> = LinkOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &
ActiveLinkOptionProps<TComp>
type ActiveLinkProps<TComp> = Partial<
LinkComponentReactProps<TComp> & {
[key: `data-${string}`]: unknown
}
>
export interface ActiveLinkOptionProps<TComp = 'a'> {
/**
* A function that returns additional props for the `active` state of this link.
* These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)
*/
activeProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)
/**
* A function that returns additional props for the `inactive` state of this link.
* These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)
*/
inactiveProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)
}
export type LinkProps<
TComp = 'a',
TRouter extends AnyRouter = RegisteredRouter,
TFrom extends string = string,
TTo extends string | undefined = '.',
TMaskFrom extends string = TFrom,
TMaskTo extends string = '.',
> = ActiveLinkOptions<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &
LinkPropsChildren
export interface LinkPropsChildren {
// If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns
children?:
| React.ReactNode
| ((state: {
isActive: boolean
isTransitioning: boolean
}) => React.ReactNode)
}
type LinkComponentReactProps<TComp> = Omit<
UseLinkReactProps<TComp>,
keyof CreateLinkProps
>
export type LinkComponentProps<
TComp = 'a',
TRouter extends AnyRouter = RegisteredRouter,
TFrom extends string = string,
TTo extends string | undefined = '.',
TMaskFrom extends string = TFrom,
TMaskTo extends string = '.',
> = LinkComponentReactProps<TComp> &
LinkProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>
export type CreateLinkProps = LinkProps<
any,
any,
string,
string,
string,
string
>
export type LinkComponent<
in out TComp,
in out TDefaultFrom extends string = string,
> = <
TRouter extends AnyRouter = RegisteredRouter,
const TFrom extends string = TDefaultFrom,
const TTo extends string | undefined = undefined,
const TMaskFrom extends string = TFrom,
const TMaskTo extends string = '',
>(
props: LinkComponentProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,
) => React.ReactElement
export interface LinkComponentRoute<
in out TDefaultFrom extends string = string,
> {
defaultFrom: TDefaultFrom;
<
TRouter extends AnyRouter = RegisteredRouter,
const TTo extends string | undefined = undefined,
const TMaskTo extends string = '',
>(
props: LinkComponentProps<
'a',
TRouter,
this['defaultFrom'],
TTo,
this['defaultFrom'],
TMaskTo
>,
): React.ReactElement
}
/**
* Creates a typed Link-like component that preserves TanStack Router's
* navigation semantics and type-safety while delegating rendering to the
* provided host component.
*
* Useful for integrating design system anchors/buttons while keeping
* router-aware props (eg. `to`, `params`, `search`, `preload`).
*
* @param Comp The host component to render (eg. a design-system Link/Button)
* @returns A router-aware component with the same API as `Link`.
* @link https://tanstack.com/router/latest/docs/framework/react/guide/custom-link
*/
export function createLink<const TComp>(
Comp: Constrain<TComp, any, (props: CreateLinkProps) => ReactNode>,
): LinkComponent<TComp> {
return React.forwardRef(function CreatedLink(props, ref) {
return <Link {...(props as any)} _asChild={Comp} ref={ref} />
}) as any
}
/**
* A strongly-typed anchor component for declarative navigation.
* Handles path, search, hash and state updates with optional route preloading
* and active-state styling.
*
* Props:
* - `preload`: Controls route preloading (eg. 'intent', 'render', 'viewport', true/false)
* - `preloadDelay`: Delay in ms before preloading on hover
* - `activeProps`/`inactiveProps`: Additional props merged when link is active/inactive
* - `resetScroll`/`hashScrollIntoView`: Control scroll behavior on navigation
* - `viewTransition`/`startTransition`: Use View Transitions/React transitions for navigation
* - `ignoreBlocker`: Bypass registered blockers
*
* @returns An anchor-like element that navigates without full page reloads.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkComponent
*/
export const Link: LinkComponent<'a'> = React.forwardRef<Element, any>(
(props, ref) => {
const { _asChild, ...rest } = props
const { type: _type, ...linkProps } = useLinkProps(rest as any, ref)
const children =
typeof rest.children === 'function'
? rest.children({
isActive: (linkProps as any)['data-status'] === 'active',
})
: rest.children
if (!_asChild) {
// the ReturnType of useLinkProps returns the correct type for a <a> element, not a general component that has a disabled prop
// @ts-expect-error
const { disabled: _, ...rest } = linkProps
return React.createElement('a', rest, children)
}
return React.createElement(_asChild, linkProps, children)
},
) as any
function isCtrlEvent(e: React.MouseEvent) {
return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)
}
export type LinkOptionsFnOptions<
TOptions,
TComp,
TRouter extends AnyRouter = RegisteredRouter,
> =
TOptions extends ReadonlyArray<any>
? ValidateLinkOptionsArray<TRouter, TOptions, string, TComp>
: ValidateLinkOptions<TRouter, TOptions, string, TComp>
export type LinkOptionsFn<TComp> = <
const TOptions,
TRouter extends AnyRouter = RegisteredRouter,
>(
options: LinkOptionsFnOptions<TOptions, TComp, TRouter>,
) => TOptions
/**
* Validate and reuse navigation options for `Link`, `navigate` or `redirect`.
* Accepts a literal options object and returns it typed for later spreading.
* @example
* const opts = linkOptions({ to: '/dashboard', search: { tab: 'home' } })
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkOptions
*/
export const linkOptions: LinkOptionsFn<'a'> = (options) => {
return options as any
}
/**
* Type-check a literal object for use with `Link`, `navigate` or `redirect`.
* Use to validate and reuse navigation options across your app.
* @example
* const opts = linkOptions({ to: '/dashboard', search: { tab: 'home' } })
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkOptions
*/
@@ -0,0 +1,142 @@
'use strict';
var util = require('./util');
var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
var DAYS = [0,31,28,31,30,31,30,31,31,30,31,30,31];
var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;
var HOSTNAME = /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;
var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1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[1-9][0-9]{0,3}|\*)?)*\})*$/i;
// For the source: https://gist.github.com/dperini/729294
// For test cases: https://mathiasbynens.be/demo/url-regex
// @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983.
// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i;
var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
module.exports = formats;
function formats(mode) {
mode = mode == 'full' ? 'full' : 'fast';
return util.copy(formats[mode]);
}
formats.fast = {
// date: http://tools.ietf.org/html/rfc3339#section-5.6
date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/,
// date-time: http://tools.ietf.org/html/rfc3339#section-5.6
time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,
'date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,
// uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js
uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,
'uri-reference': /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
'uri-template': URITEMPLATE,
url: URL,
// email (sources from jsen validator):
// http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363
// http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'willful violation')
email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,
hostname: HOSTNAME,
// optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html
ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
// optimized http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses
ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,
regex: regex,
// uuid: http://tools.ietf.org/html/rfc4122
uuid: UUID,
// JSON-pointer: https://tools.ietf.org/html/rfc6901
// uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A
'json-pointer': JSON_POINTER,
'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,
// relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00
'relative-json-pointer': RELATIVE_JSON_POINTER
};
formats.full = {
date: date,
time: time,
'date-time': date_time,
uri: uri,
'uri-reference': URIREF,
'uri-template': URITEMPLATE,
url: URL,
email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,
hostname: HOSTNAME,
ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,
regex: regex,
uuid: UUID,
'json-pointer': JSON_POINTER,
'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,
'relative-json-pointer': RELATIVE_JSON_POINTER
};
function isLeapYear(year) {
// https://tools.ietf.org/html/rfc3339#appendix-C
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
}
function date(str) {
// full-date from http://tools.ietf.org/html/rfc3339#section-5.6
var matches = str.match(DATE);
if (!matches) return false;
var year = +matches[1];
var month = +matches[2];
var day = +matches[3];
return month >= 1 && month <= 12 && day >= 1 &&
day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]);
}
function time(str, full) {
var matches = str.match(TIME);
if (!matches) return false;
var hour = matches[1];
var minute = matches[2];
var second = matches[3];
var timeZone = matches[5];
return ((hour <= 23 && minute <= 59 && second <= 59) ||
(hour == 23 && minute == 59 && second == 60)) &&
(!full || timeZone);
}
var DATE_TIME_SEPARATOR = /t|\s/i;
function date_time(str) {
// http://tools.ietf.org/html/rfc3339#section-5.6
var dateTime = str.split(DATE_TIME_SEPARATOR);
return dateTime.length == 2 && date(dateTime[0]) && time(dateTime[1], true);
}
var NOT_URI_FRAGMENT = /\/|:/;
function uri(str) {
// http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "."
return NOT_URI_FRAGMENT.test(str) && URI.test(str);
}
var Z_ANCHOR = /[^\\]\\Z/;
function regex(str) {
if (Z_ANCHOR.test(str)) return false;
try {
new RegExp(str);
return true;
} catch(e) {
return false;
}
}
@@ -0,0 +1,211 @@
# Angular wrapper
The Angular [wrapper component](projects/lib/src/lib/gridstack.component.ts) <gridstack> is a <b>better way to use Gridstack</b>, but alternative raw [ngFor](projects/demo/src/app/ngFor.ts) or [simple](projects/demo/src/app/simple.ts) demos are also given.
Running version can be seen here https://stackblitz.com/edit/gridstack-angular
# Dynamic grid items
this is the recommended way if you are going to have multiple grids (alow drag&drop between) or drag from toolbar to create items, or drag to remove items, etc...
I.E. don't use Angular templating to create grid items as that is harder to sync when gridstack will also add/remove items.
MyComponent HTML
```html
<gridstack [options]="gridOptions"></gridstack>
```
MyComponent CSS
```css
@import "gridstack/dist/gridstack.min.css";
.grid-stack {
background: #fafad2;
}
.grid-stack-item-content {
text-align: center;
background-color: #18bc9c;
}
```
Standalone MyComponent Code
```ts
import { GridStackOptions } from 'gridstack';
import { GridstackComponent, GridstackItemComponent } from 'gridstack/dist/angular';
@Component({
imports: [ // SKIP if doing module import instead (next)
GridstackComponent,
GridstackItemComponent
]
...
})
export class MyComponent {
// sample grid options + items to load...
public gridOptions: GridStackOptions = {
margin: 5,
children: [ // or call load(children) or addWidget(children[0]) with same data
{x:0, y:0, minW:2, content:'Item 1'},
{x:1, y:0, content:'Item 2'},
{x:0, y:1, content:'Item 3'},
]
}
}
```
IF doing module import instead of standalone, you will also need this:
```ts
import { GridstackModule } from 'gridstack/dist/angular';
@NgModule({
imports: [GridstackModule, ...]
...
bootstrap: [AppComponent]
})
export class AppModule { }
```
# More Complete example
In this example (build on previous one) will use your actual custom angular components inside each grid item (instead of dummy html content) and have per component saved settings as well (using BaseWidget).
HTML
```html
<gridstack [options]="gridOptions" (changeCB)="onChange($event)">
<div empty-content>message when grid is empty</div>
</gridstack>
```
Code
```ts
import { Component } from '@angular/core';
import { GridStack, GridStackOptions } from 'gridstack';
import { GridstackComponent, gsCreateNgComponents, NgGridStackWidget, nodesCB, BaseWidget } from 'gridstack/dist/angular';
// some custom components
@Component({
selector: 'app-a',
template: 'Comp A {{text}}',
})
export class AComponent extends BaseWidget implements OnDestroy {
@Input() text: string = 'foo'; // test custom input data
public override serialize(): NgCompInputs | undefined { return this.text ? {text: this.text} : undefined; }
ngOnDestroy() {
console.log('Comp A destroyed'); // test to make sure cleanup happens
}
}
@Component({
selector: 'app-b',
template: 'Comp B',
})
export class BComponent extends BaseWidget {
}
// ...in your module (classic), OR your ng19 app.config provideEnvironmentInitializer call this:
constructor() {
// register all our dynamic components types created by the grid
GridstackComponent.addComponentToSelectorType([AComponent, BComponent]) ;
}
// now our content will use Components instead of dummy html content
public gridOptions: NgGridStackOptions = {
margin: 5,
minRow: 1, // make space for empty message
children: [ // or call load()/addWidget() with same data
{x:0, y:0, minW:2, selector:'app-a'},
{x:1, y:0, minW:2, selector:'app-a', input: { text: 'bar' }}, // custom input that works using BaseWidget.deserialize() Object.assign(this, w.input)
{x:2, y:0, selector:'app-b'},
{x:3, y:0, content:'plain html'},
]
}
// called whenever items change size/position/etc.. see other events
public onChange(data: nodesCB) {
console.log('change ', data.nodes.length > 1 ? data.nodes : data.nodes[0]);
}
```
# ngFor with wrapper
For simple case where you control the children creation (gridstack doesn't do create or re-parenting)
HTML
```html
<gridstack [options]="gridOptions" (changeCB)="onChange($event)">
<!-- Angular 17+ -->
@for (n of items; track n.id) {
<gridstack-item [options]="n">Item {{n.id}}</gridstack-item>
}
<!-- Angular 16 -->
<gridstack-item *ngFor="let n of items; trackBy: identify" [options]="n"> Item {{n.id}} </gridstack-item>
</gridstack>
```
Code
```javascript
import { GridStackOptions, GridStackWidget } from 'gridstack';
import { nodesCB } from 'gridstack/dist/angular';
/** sample grid options and items to load... */
public gridOptions: GridStackOptions = { margin: 5 }
public items: GridStackWidget[] = [
{x:0, y:0, minW:2, id:'1'}, // must have unique id used for trackBy
{x:1, y:0, id:'2'},
{x:0, y:1, id:'3'},
];
// called whenever items change size/position/etc..
public onChange(data: nodesCB) {
console.log('change ', data.nodes.length > 1 ? data.nodes : data.nodes[0]);
}
// ngFor unique node id to have correct match between our items used and GS
public identify(index: number, w: GridStackWidget) {
return w.id; // or use index if no id is set and you only modify at the end...
}
```
## Demo
You can see a fuller example at [app.component.ts](projects/demo/src/app/app.component.ts)
to build the demo, go to [angular/projects/demo](projects/demo/) and run `yarn` + `yarn start` and navigate to `http://localhost:4200/`
Code started shipping with v8.1.2+ in `dist/angular` for people to use directly and is an angular module! (source code under `dist/angular/src`)
## Caveats
- This wrapper needs:
- gridstack v8+ to run as it needs the latest changes (use older version that matches GS versions)
- <b>Angular 14+</b> for dynamic `createComponent()` API and Standalone Components (verified against 19+)
NOTE: if you are on Angular 13 or below: copy the wrapper code over (or patch it - see main page example) and change `createComponent()` calls to use old API instead:
NOTE2: now that we're using standalone, you will also need to remove `standalone: true` and `imports` on each component so you will to copy those locally (or use <11.1.2 version)
```ts
protected resolver: ComponentFactoryResolver,
...
const factory = this.resolver.resolveComponentFactory(GridItemComponent);
const gridItemRef = grid.container.createComponent(factory) as ComponentRef<GridItemComponent>;
// ...do the same for widget selector...
```
## ngFor Caveats
- This wrapper handles well ngFor loops, but if you're using a trackBy function (as I would recommend) and no element id change after an update,
you must manually update the `GridstackItemComponent.option` directly - see [modifyNgFor()](./projects/demo/src/app/app.component.ts#L202) example.
- The original client list of items is not updated to match **content** changes made by gridstack (TBD later), but adding new item or removing (as shown in demo) will update those new items. Client could use change/added/removed events to sync that list if they wish to do so.
Would appreciate getting help doing the same for React and Vue (2 other popular frameworks)
-Alain
@@ -0,0 +1 @@
{"version":3,"file":"is-bezier-definition.mjs","sources":["../../../../src/easing/utils/is-bezier-definition.ts"],"sourcesContent":["import { BezierDefinition, Easing } from \"../types\"\n\nexport const isBezierDefinition = (\n easing: Easing | Easing[]\n): easing is BezierDefinition =>\n Array.isArray(easing) && typeof easing[0] === \"number\"\n"],"names":[],"mappings":"MAEa,kBAAkB,GAAG,CAC9B,MAAyB,KAEzB,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK;;;;"}
@@ -0,0 +1 @@
{"version":3,"file":"package-search.js","sources":["../../../src/icons/package-search.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name PackageSearch\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMjEgMTBWOGEyIDIgMCAwIDAtMS0xLjczbC03LTRhMiAyIDAgMCAwLTIgMGwtNyA0QTIgMiAwIDAgMCAzIDh2OGEyIDIgMCAwIDAgMSAxLjczbDcgNGEyIDIgMCAwIDAgMiAwbDItMS4xNCIgLz4KICA8cGF0aCBkPSJtNy41IDQuMjcgOSA1LjE1IiAvPgogIDxwb2x5bGluZSBwb2ludHM9IjMuMjkgNyAxMiAxMiAyMC43MSA3IiAvPgogIDxsaW5lIHgxPSIxMiIgeDI9IjEyIiB5MT0iMjIiIHkyPSIxMiIgLz4KICA8Y2lyY2xlIGN4PSIxOC41IiBjeT0iMTUuNSIgcj0iMi41IiAvPgogIDxwYXRoIGQ9Ik0yMC4yNyAxNy4yNyAyMiAxOSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/package-search\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst PackageSearch = createLucideIcon('PackageSearch', [\n [\n 'path',\n {\n d: 'M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14',\n key: 'e7tb2h',\n },\n ],\n ['path', { d: 'm7.5 4.27 9 5.15', key: '1c824w' }],\n ['polyline', { points: '3.29 7 12 12 20.71 7', key: 'ousv84' }],\n ['line', { x1: '12', x2: '12', y1: '22', y2: '12', key: 'a4e8g8' }],\n ['circle', { cx: '18.5', cy: '15.5', r: '2.5', key: 'b5zd12' }],\n ['path', { d: 'M20.27 17.27 22 19', key: '1l4muz' }],\n]);\n\nexport default PackageSearch;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CA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AA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AACrD,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,2 @@
import type { LibDefinition } from '../variable';
export declare const esnext_weakref: LibDefinition;
@@ -0,0 +1,173 @@
A pure JavaScript implementation of [Sass][sass]. **Sass makes CSS fun again**.
<table>
<tr>
<td>
<img width="118px" alt="Sass logo" src="https://rawgit.com/sass/sass-site/master/source/assets/img/logos/logo.svg" />
</td>
<td valign="middle">
<a href="https://www.npmjs.com/package/sass"><img width="100%" alt="npm statistics" src="https://nodei.co/npm/sass.png?downloads=true"></a>
</td>
<td valign="middle">
<a href="https://github.com/sass/dart-sass/actions"><img alt="GitHub actions build status" src="https://github.com/sass/dart-sass/workflows/CI/badge.svg"></a>
<br>
<a href="https://ci.appveyor.com/project/nex3/dart-sass"><img alt="Appveyor build status" src="https://ci.appveyor.com/api/projects/status/84rl9hvu8uoecgef?svg=true"></a>
</td>
</tr>
</table>
[sass]: https://sass-lang.com/
This package is a distribution of [Dart Sass][], compiled to pure JavaScript
with no native code or external dependencies. It provides a command-line `sass`
executable and a Node.js API.
[Dart Sass]: https://github.com/sass/dart-sass
* [Usage](#usage)
* [See Also](#see-also)
* [Behavioral Differences from Ruby Sass](#behavioral-differences-from-ruby-sass)
## Usage
You can install Sass globally using `npm install -g sass` which will provide
access to the `sass` executable. You can also add it to your project using
`npm install --save-dev sass`. This provides the executable as well as a
library:
[npm]: https://www.npmjs.com/package/sass
```js
const sass = require('sass');
const result = sass.compile(scssFilename);
// OR
// Note that `compileAsync()` is substantially slower than `compile()`.
const result = await sass.compileAsync(scssFilename);
```
See [the Sass website][js api] for full API documentation.
[js api]: https://sass-lang.com/documentation/js-api
### Legacy API
Dart Sass also supports an older JavaScript API that's fully compatible with
[Node Sass] (with a few exceptions listed below), with support for both the
[`render()`] and [`renderSync()`] functions. This API is considered deprecated
and will be removed in Dart Sass 2.0.0, so it should be avoided in new projects.
[Node Sass]: https://github.com/sass/node-sass
[`render()`]: https://sass-lang.com/documentation/js-api/functions/render
[`renderSync()`]: https://sass-lang.com/documentation/js-api/functions/renderSync
Sass's support for the legacy JavaScript API has the following limitations:
* Only the `"expanded"` and `"compressed"` values of [`outputStyle`] are
supported.
* Dart Sass doesn't support the [`precision`] option. Dart Sass defaults to a
sufficiently high precision for all existing browsers, and making this
customizable would make the code substantially less efficient.
* Dart Sass doesn't support the [`sourceComments`] option. Source maps are the
recommended way of locating the origin of generated selectors.
[`outputStyle`]: https://sass-lang.com/documentation/js-api/interfaces/LegacySharedOptions#outputStyle
[`precision`]: https://github.com/sass/node-sass#precision
[`sourceComments`]: https://github.com/sass/node-sass#sourcecomments
## See Also
* [Dart Sass][], from which this package is compiled, can be used either as a
stand-alone executable or as a Dart library. Running Dart Sass on the Dart VM
is substantially faster than running the pure JavaScript version, so this may
be appropriate for performance-sensitive applications. The Dart API is also
(currently) more user-friendly than the JavaScript API. See
[the Dart Sass README][Using Dart Sass] for details on how to use it.
* [Node Sass][], which is a wrapper around [LibSass][], the C++ implementation
of Sass. Node Sass supports the same API as this package and is also faster
(although it's usually a little slower than Dart Sass). However, it requires a
native library which may be difficult to install, and it's generally slower to
add features and fix bugs.
[Using Dart Sass]: https://github.com/sass/dart-sass#using-dart-sass
[Node Sass]: https://www.npmjs.com/package/node-sass
[LibSass]: https://sass-lang.com/libsass
## Behavioral Differences from Ruby Sass
There are a few intentional behavioral differences between Dart Sass and Ruby
Sass. These are generally places where Ruby Sass has an undesired behavior, and
it's substantially easier to implement the correct behavior than it would be to
implement compatible behavior. These should all have tracking bugs against Ruby
Sass to update the reference behavior.
1. `@extend` only accepts simple selectors, as does the second argument of
`selector-extend()`. See [issue 1599][].
2. Subject selectors are not supported. See [issue 1126][].
3. Pseudo selector arguments are parsed as `<declaration-value>`s rather than
having a more limited custom parsing. See [issue 2120][].
4. The numeric precision is set to 10. See [issue 1122][].
5. The indented syntax parser is more flexible: it doesn't require consistent
indentation across the whole document. See [issue 2176][].
6. Colors do not support channel-by-channel arithmetic. See [issue 2144][].
7. Unitless numbers aren't `==` to unit numbers with the same value. In
addition, map keys follow the same logic as `==`-equality. See
[issue 1496][].
8. `rgba()` and `hsla()` alpha values with percentage units are interpreted as
percentages. Other units are forbidden. See [issue 1525][].
9. Too many variable arguments passed to a function is an error. See
[issue 1408][].
10. Allow `@extend` to reach outside a media query if there's an identical
`@extend` defined outside that query. This isn't tracked explicitly, because
it'll be irrelevant when [issue 1050][] is fixed.
11. Some selector pseudos containing placeholder selectors will be compiled
where they wouldn't be in Ruby Sass. This better matches the semantics of
the selectors in question, and is more efficient. See [issue 2228][].
12. The old-style `:property value` syntax is not supported in the indented
syntax. See [issue 2245][].
13. The reference combinator is not supported. See [issue 303][].
14. Universal selector unification is symmetrical. See [issue 2247][].
15. `@extend` doesn't produce an error if it matches but fails to unify. See
[issue 2250][].
16. Dart Sass currently only supports UTF-8 documents. We'd like to support
more, but Dart currently doesn't support them. See [dart-lang/sdk#11744][],
for example.
[issue 1599]: https://github.com/sass/sass/issues/1599
[issue 1126]: https://github.com/sass/sass/issues/1126
[issue 2120]: https://github.com/sass/sass/issues/2120
[issue 1122]: https://github.com/sass/sass/issues/1122
[issue 2176]: https://github.com/sass/sass/issues/2176
[issue 2144]: https://github.com/sass/sass/issues/2144
[issue 1496]: https://github.com/sass/sass/issues/1496
[issue 1525]: https://github.com/sass/sass/issues/1525
[issue 1408]: https://github.com/sass/sass/issues/1408
[issue 1050]: https://github.com/sass/sass/issues/1050
[issue 2228]: https://github.com/sass/sass/issues/2228
[issue 2245]: https://github.com/sass/sass/issues/2245
[issue 303]: https://github.com/sass/sass/issues/303
[issue 2247]: https://github.com/sass/sass/issues/2247
[issue 2250]: https://github.com/sass/sass/issues/2250
[dart-lang/sdk#11744]: https://github.com/dart-lang/sdk/issues/11744
Disclaimer: this is not an official Google product.
@@ -0,0 +1,291 @@
# Agent
<!--introduced_in=v3.2.0-->
<!--type=module-->
<!-- source_link=lib/dispatcher/agent.js -->
> Stability: 2 - Stable
An `Agent` dispatches requests against multiple different origins, creating and
reusing a per-origin [`Pool`][] (or [`Client`][]) on demand. It is the default
dispatcher used by [`request`][], [`stream`][], and [`fetch`][] when no explicit
dispatcher is supplied.
Requests are not guaranteed to be dispatched in their order of invocation.
```mjs
import { Agent, setGlobalDispatcher } from 'undici'
const agent = new Agent({ connections: 10 })
setGlobalDispatcher(agent)
```
## Class: `Agent`
<!-- YAML
added: v3.2.0
-->
* Extends: {Dispatcher}
`Agent` keeps an internal map of origins to dispatchers. The first request to a
given origin lazily creates a dispatcher through the configured `factory`, and
subsequent requests to the same origin reuse it. Idle dispatchers are closed
automatically once they have no open connections and are no longer busy.
### `new Agent([options])`
<!-- YAML
added: v3.2.0
changes:
- version: v7.16.0
pr-url: https://github.com/nodejs/undici/pull/4365
description: Added the `maxOrigins` option to cap the number of origins.
-->
* `options` {AgentOptions} (optional) Extends {PoolOptions}.
* `factory` {Function} Builds the dispatcher used for a given origin. When the
resolved options contain `connections: 1`, the default factory creates a
{Client}; otherwise it creates a {Pool}. **Default:** `(origin, opts) => new Pool(origin, opts)`.
* `origin` {URL|string} The origin to create a dispatcher for.
* `opts` {Object} The resolved options for the new dispatcher.
* Returns: {Dispatcher}
* `maxOrigins` {number} Limits the total number of distinct origins that may
receive requests at the same time. A {MaxOriginsReachedError} is thrown when
a request targets a new origin once the limit is reached. When set to
`Infinity`, no limit is enforced. Must be a number greater than `0`.
**Default:** `Infinity`.
`Agent` inherits all {PoolOptions} (and therefore all {ClientOptions}). Each
origin gets a separate {Pool}, with `connections` acting as the maximum number
of clients that pool may create.
> [!NOTE]
> For an h2-capable HTTPS origin, the per-origin pool waits for the first TLS
> connection to finish ALPN negotiation. If the server selects h2, concurrent
> requests share that session up to `maxConcurrentStreams`. If it selects
> HTTP/1.1, normal connection fan-out resumes up to `connections`. See
> {PoolOptions} and {ClientOptions} for inherited options such as `allowH2`
> (default `true`) and `maxConcurrentStreams` (default `100`).
### `agent.closed`
<!-- YAML
added: v3.2.0
-->
* Type: {boolean}
`true` after [`agent.close()`][] has been called.
### `agent.destroyed`
<!-- YAML
added: v3.2.0
-->
* Type: {boolean}
`true` after [`agent.destroy()`][] has been called, or after [`agent.close()`][]
has been called and the shutdown has completed.
### `agent.stats`
<!-- YAML
added: v7.9.0
-->
* Type: {Record<string, ClientStats|PoolStats>}
Aggregate statistics for the agent, keyed by origin. Each value is the
[`ClientStats`][] or [`PoolStats`][] object reported by the dispatcher currently
serving that origin. Origins whose dispatcher does not expose `stats` are
omitted.
```mjs
import { Agent } from 'undici'
const agent = new Agent()
await agent.request({ origin: 'http://localhost:3000', path: '/', method: 'GET' })
console.log(agent.stats)
// { 'http://localhost:3000': PoolStats { ... } }
```
### `agent.dispatch(options, handler)`
<!-- YAML
added: v3.2.0
-->
* `options` {AgentDispatchOptions} Extends {DispatchOptions}.
* `origin` {string|URL} The origin to dispatch the request against. Required.
* `handler` {DispatchHandler}
* Returns: {boolean} `false` if the dispatcher is busy and the caller should
wait for the [`'drain'`][] event before dispatching again.
Routes the request to the dispatcher for `options.origin`, creating one through
the `factory` if needed. Throws an {InvalidArgumentError} when `options.origin`
is not a non-empty string or {URL}, and a {MaxOriginsReachedError} when a new
origin would exceed `maxOrigins`. Implements [`Dispatcher.dispatch()`][].
### `agent.close([callback])`
<!-- YAML
added: v3.2.0
-->
* `callback` {Function} (optional) Invoked once every per-origin dispatcher has
closed. When omitted, a {Promise} is returned.
* Returns: {Promise|void}
Gracefully closes the agent and every dispatcher it owns, waiting for in-flight
requests to complete. Implements [`Dispatcher.close()`][].
### `agent.destroy([error[, callback]])`
<!-- YAML
added: v3.2.0
-->
* `error` {Error} (optional) The error to abort pending requests with.
* `callback` {Function} (optional) Invoked once every per-origin dispatcher has
been destroyed. When omitted, a {Promise} is returned.
* Returns: {Promise|void}
Forcefully destroys the agent and every dispatcher it owns, aborting all pending
requests. Implements [`Dispatcher.destroy()`][].
### `agent.connect(options[, callback])`
<!-- YAML
added: v3.2.0
-->
See [`Dispatcher.connect()`][]. The request is routed to the dispatcher for
`options.origin`.
### `agent.pipeline(options, handler)`
<!-- YAML
added: v3.2.0
-->
See [`Dispatcher.pipeline()`][]. The request is routed to the dispatcher for
`options.origin`.
### `agent.request(options[, callback])`
<!-- YAML
added: v3.2.0
-->
See [`Dispatcher.request()`][]. The request is routed to the dispatcher for
`options.origin`.
```mjs
import { Agent } from 'undici'
const agent = new Agent()
const { statusCode, body } = await agent.request({
origin: 'http://localhost:3000',
path: '/',
method: 'GET',
})
console.log('response received', statusCode)
console.log('data', await body.text())
```
### `agent.stream(options, factory[, callback])`
<!-- YAML
added: v3.2.0
-->
See [`Dispatcher.stream()`][]. The request is routed to the dispatcher for
`options.origin`.
### `agent.upgrade(options[, callback])`
<!-- YAML
added: v3.2.0
-->
See [`Dispatcher.upgrade()`][]. The request is routed to the dispatcher for
`options.origin`.
### Event: `'connect'`
<!-- YAML
added: v6.6.0
-->
* `origin` {URL}
* `targets` {Array<Dispatcher>} The dispatchers involved, starting with this
`Agent` followed by the per-origin dispatcher chain.
Emitted when a socket has been created for an origin and is ready to receive
requests. Forwarded from the underlying dispatcher's [`'connect'`][] event.
### Event: `'disconnect'`
<!-- YAML
added: v6.6.0
-->
* `origin` {URL}
* `targets` {Array<Dispatcher>} The dispatchers involved, starting with this
`Agent`.
* `error` {Error}
Emitted when a socket for an origin has disconnected. Forwarded from the
underlying dispatcher's [`'disconnect'`][] event.
### Event: `'connectionError'`
<!-- YAML
added: v6.6.0
-->
* `origin` {URL}
* `targets` {Array<Dispatcher>} The dispatchers involved, starting with this
`Agent`.
* `error` {Error}
Emitted when a connection attempt for an origin fails. Forwarded from the
underlying dispatcher's [`'connectionError'`][] event.
### Event: `'drain'`
<!-- YAML
added: v6.6.0
-->
* `origin` {URL}
* `targets` {Array<Dispatcher>} The dispatchers involved, starting with this
`Agent`.
Emitted when an origin's dispatcher is no longer busy and can accept more
requests. Forwarded from the underlying dispatcher's [`'drain'`][] event.
[`'connect'`]: Dispatcher.md#event-connect
[`'connectionError'`]: Dispatcher.md#event-connectionerror
[`'disconnect'`]: Dispatcher.md#event-disconnect
[`'drain'`]: Dispatcher.md#event-drain
[`Client`]: Client.md#class-client
[`ClientStats`]: ClientStats.md
[`Dispatcher.close()`]: Dispatcher.md#dispatcherclosecallback-promise
[`Dispatcher.connect()`]: Dispatcher.md#dispatcherconnectoptions-callback
[`Dispatcher.destroy()`]: Dispatcher.md#dispatcherdestroyerror-callback-promise
[`Dispatcher.dispatch()`]: Dispatcher.md#dispatcherdispatchoptions-handler
[`Dispatcher.pipeline()`]: Dispatcher.md#dispatcherpipelineoptions-handler
[`Dispatcher.request()`]: Dispatcher.md#dispatcherrequestoptions-callback
[`Dispatcher.stream()`]: Dispatcher.md#dispatcherstreamoptions-factory-callback
[`Dispatcher.upgrade()`]: Dispatcher.md#dispatcherupgradeoptions-callback
[`Pool`]: Pool.md#class-pool
[`PoolStats`]: PoolStats.md
[`agent.close()`]: #agentclosecallback
[`agent.destroy()`]: #agentdestroyerror-callback
[`fetch`]: Fetch.md
[`request`]: Dispatcher.md#dispatcherrequestoptions-callback
[`stream`]: Dispatcher.md#dispatcherstreamoptions-factory-callback
@@ -0,0 +1,10 @@
/**
* @deprecated Use [`Response.json`](https://developer.mozilla.org/en-US/docs/Web/API/Response/json_static) from the standard Web API directly.
*/
export interface JsonResponse<TData> extends Response {
json: () => Promise<TData>;
}
/**
* @deprecated Use [`Response.json`](https://developer.mozilla.org/en-US/docs/Web/API/Response/json_static) from the standard Web API directly.
*/
export declare function json<TData>(payload: TData, init?: ResponseInit): JsonResponse<TData>;
@@ -0,0 +1 @@
["the","of","and","in","was","is","for","as","on","with","by","he","at","from","his","an","were","are","which","doc","https","also","or","has","had","first","one","their","its","after","new","who","they","two","her","she","been","other","when","time","during","into","school","more","may","years","over","only","year","most","would","world","city","some","where","between","later","three","state","such","then","national","used","made","known","under","many","university","united","while","part","season","team","these","american","than","film","second","born","south","became","states","war","through","being","including","both","before","north","high","however","people","family","early","history","album","area","series","against","until","since","district","county","name","work","life","group","music","following","number","company","several","four","called","played","released","career","league","game","government","house","each","based","day","same","won","use","station","club","international","town","located","population","general","college","east","found","age","march","end","september","began","home","public","church","line","june","river","member","system","place","century","band","july","york","january","october","song","august","best","former","british","party","named","held","village","show","local","november","took","service","december","built","another","major","within","along","members","five","single","due","although","small","old","left","final","large","include","building","served","president","received","games","death","february","main","third","set","children","own","order","species","park","law","air","published","road","died","book","men","women","army","often","according","education","central","country","division","english","top","included","development","french","community","among","water","play","side","list","times","near","late","form","original","different","center","power","led","students","german","moved","court","six","land","council","island","u.s.","record","million","research","art","established","award","street","military","television","given","region","support","western","production","non","political","point","cup","period","business","title","started","various","election","using","england","role","produced","become","program","works","field","total","office","class","written","association","radio","union","level","championship","director","few","force","created","department","founded","services","married","though","per","n't","site","open","act","short","society","version","royal","present","northern","worked","professional","full","returned","joined","story","france","european","currently","language","social","california","india","design","st.","further","round","australia","wrote","san","project","control","southern","railway","board","popular","continued","free","battle","considered","video","common","position","living","half","playing","recorded","red","post","described","average","records","special","modern","appeared","announced","areas","rock","release","elected","others","example","term","opened","similar","formed","route","census","current","schools","originally","lake","developed","race","himself","forces","addition","information","upon","province","match","event","songs","result","events","win","eastern","track","lead","teams","science","human","construction","minister","germany","awards","available","throughout","training","style","body","museum","australian","health","seven","signed","chief","eventually","appointed","sea","centre","debut","tour","points","media","light","range","character","across","features","families","largest","indian","network","less","performance","players","refer","europe","sold","festival","usually","taken","despite","designed","committee","process","return","official","episode","institute","stage","followed","performed","japanese","personal","thus","arts","space","low","months","includes","china","study","middle","magazine","leading","japan","groups","aircraft","featured","federal","civil","rights","model","coach","canadian","books","remained","eight","type","independent","completed","capital","academy","instead","kingdom","organization","countries","studies","competition","sports","size","above","section","finished","gold","involved","reported","management","systems","industry","directed","market","fourth","movement","technology","bank","ground","campaign","base","lower","sent","rather","added","provided","coast","grand","historic","valley","conference","bridge","winning","approximately","films","chinese","awarded","degree","russian","shows","native","female","replaced","municipality","square","studio","medical","data","african","successful","mid","bay","attack","previous","operations","spanish","theatre","student","republic","beginning","provide","ship","primary","owned","writing","tournament","culture","introduced","texas","related","natural","parts","governor","reached","ireland","units","senior","decided","italian","whose","higher","africLine truncated
@@ -0,0 +1,2 @@
export { G as GlobalConstructors, M as MockObjectOptions, m as mockObject } from './index.d-B41z0AuW.js';
export { A as AutomockedModule, g as AutomockedModuleSerialized, h as AutospiedModule, i as AutospiedModuleSerialized, j as ManualMockedModule, k as ManualMockedModuleSerialized, a as MockedModule, l as MockedModuleSerialized, d as MockedModuleType, M as MockerRegistry, e as ModuleMockContext, m as ModuleMockFactory, c as ModuleMockFactoryWithHelper, b as ModuleMockOptions, R as RedirectedModule, n as RedirectedModuleSerialized, f as ServerIdResolution, S as ServerMockResolution, T as TestModuleMocker } from './types.d-BjI5eAwu.js';
@@ -0,0 +1,137 @@
export type BuiltInMergeStrategy = $typests.BuiltInMergeStrategy;
export type BuiltInValidationStrategy = $typests.BuiltInValidationStrategy;
export type CustomMergeStrategy = $typests.CustomMergeStrategy;
export type CustomValidationStrategy = $typests.CustomValidationStrategy;
export type ObjectDefinition = $typests.ObjectDefinition;
export type PropertyDefinition = $typests.PropertyDefinition;
export type PropertyDefinitionWithSchema = $typests.PropertyDefinitionWithSchema;
export type PropertyDefinitionWithStrategies = $typests.PropertyDefinitionWithStrategies;
/**
* @fileoverview Merge Strategy
*/
/**
* Container class for several different merge strategies.
*/
export class MergeStrategy {
/**
* Merges two keys by overwriting the first with the second.
* @template TValue1 The type of the value from the first object key.
* @template TValue2 The type of the value from the second object key.
* @param {TValue1} value1 The value from the first object key.
* @param {TValue2} value2 The value from the second object key.
* @returns {TValue2} The second value.
*/
static overwrite<TValue1, TValue2>(value1: TValue1, value2: TValue2): TValue2;
/**
* Merges two keys by replacing the first with the second only if the
* second is defined.
* @template TValue1 The type of the value from the first object key.
* @template TValue2 The type of the value from the second object key.
* @param {TValue1} value1 The value from the first object key.
* @param {TValue2} value2 The value from the second object key.
* @returns {TValue1 | TValue2} The second value if it is defined.
*/
static replace<TValue1, TValue2>(value1: TValue1, value2: TValue2): TValue1 | TValue2;
/**
* Merges two properties by assigning properties from the second to the first.
* @template {Record<string | number | symbol, unknown> | undefined} TValue1 The type of the value from the first object key.
* @template {Record<string | number | symbol, unknown>} TValue2 The type of the value from the second object key.
* @param {TValue1} value1 The value from the first object key.
* @param {TValue2} value2 The value from the second object key.
* @returns {Omit<TValue1, keyof TValue2> & TValue2} A new object containing properties from both value1 and
* value2.
*/
static assign<TValue1 extends Record<string | number | symbol, unknown> | undefined, TValue2 extends Record<string | number | symbol, unknown>>(value1: TValue1, value2: TValue2): Omit<TValue1, keyof TValue2> & TValue2;
}
/**
* Represents an object validation/merging schema.
*/
export class ObjectSchema {
/**
* Creates a new instance.
* @param {ObjectDefinition} definitions The schema definitions.
* @throws {Error} When the definitions are missing or invalid.
*/
constructor(definitions: ObjectDefinition);
/**
* Determines if a strategy has been registered for the given object key.
* @param {string} key The object key to find a strategy for.
* @returns {boolean} True if the key has a strategy registered, false if not.
*/
hasKey(key: string): boolean;
/**
* Merges objects together to create a new object comprised of the keys
* of the all objects. Keys are merged based on the each key's merge
* strategy.
* @param {...Object} objects The objects to merge.
* @returns {Object} A new object with a mix of all objects' keys.
* @throws {TypeError} If any object is invalid.
*/
merge(...objects: any[]): any;
/**
* Validates an object's keys based on the validate strategy for each key.
* @param {Object} object The object to validate.
* @returns {void}
* @throws {Error} When the object is invalid.
*/
validate(object: any): void;
#private;
}
/**
* @fileoverview Validation Strategy
*/
/**
* Container class for several different validation strategies.
*/
export class ValidationStrategy {
/**
* Validates that a value is an array.
* @param {unknown} value The value to validate.
* @returns {void}
* @throws {TypeError} If the value is invalid.
*/
static array(value: unknown): void;
/**
* Validates that a value is a boolean.
* @param {unknown} value The value to validate.
* @returns {void}
* @throws {TypeError} If the value is invalid.
*/
static boolean(value: unknown): void;
/**
* Validates that a value is a number.
* @param {unknown} value The value to validate.
* @returns {void}
* @throws {TypeError} If the value is invalid.
*/
static number(value: unknown): void;
/**
* Validates that a value is an object.
* @param {unknown} value The value to validate.
* @returns {void}
* @throws {TypeError} If the value is invalid.
*/
static object(value: unknown): void;
/**
* Validates that a value is an object or null.
* @param {unknown} value The value to validate.
* @returns {void}
* @throws {TypeError} If the value is invalid.
*/
static "object?"(value: unknown): void;
/**
* Validates that a value is a string.
* @param {unknown} value The value to validate.
* @returns {void}
* @throws {TypeError} If the value is invalid.
*/
static string(value: unknown): void;
/**
* Validates that a value is a non-empty string.
* @param {unknown} value The value to validate.
* @returns {void}
* @throws {TypeError} If the value is invalid.
*/
static "string!"(value: unknown): void;
}
import type * as $typests from "./types.ts";
@@ -0,0 +1,531 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SPECIAL_HEADERS = exports.MINOR = exports.MAJOR = exports.HTAB_SP_VCHAR_OBS_TEXT = exports.QUOTED_STRING = exports.CONNECTION_TOKEN_CHARS = exports.HEADER_CHARS = exports.TOKEN = exports.HEX = exports.URL_CHAR = exports.USERINFO_CHARS = exports.MARK = exports.ALPHANUM = exports.NUM = exports.HEX_MAP = exports.NUM_MAP = exports.ALPHA = exports.STATUSES_HTTP = exports.H_METHOD_MAP = exports.METHOD_MAP = exports.METHODS_RTSP = exports.METHODS_ICE = exports.METHODS_HTTP = exports.HEADER_STATE = exports.FINISH = exports.STATUSES = exports.METHODS = exports.LENIENT_FLAGS = exports.FLAGS = exports.TYPE = exports.ERROR = void 0;
const utils_1 = require("./utils");
// Emums
exports.ERROR = {
OK: 0,
INTERNAL: 1,
STRICT: 2,
CR_EXPECTED: 25,
LF_EXPECTED: 3,
UNEXPECTED_CONTENT_LENGTH: 4,
UNEXPECTED_SPACE: 30,
CLOSED_CONNECTION: 5,
INVALID_METHOD: 6,
INVALID_URL: 7,
INVALID_CONSTANT: 8,
INVALID_VERSION: 9,
INVALID_HEADER_TOKEN: 10,
INVALID_CONTENT_LENGTH: 11,
INVALID_CHUNK_SIZE: 12,
INVALID_STATUS: 13,
INVALID_EOF_STATE: 14,
INVALID_TRANSFER_ENCODING: 15,
CB_MESSAGE_BEGIN: 16,
CB_HEADERS_COMPLETE: 17,
CB_MESSAGE_COMPLETE: 18,
CB_CHUNK_HEADER: 19,
CB_CHUNK_COMPLETE: 20,
PAUSED: 21,
PAUSED_UPGRADE: 22,
PAUSED_H2_UPGRADE: 23,
USER: 24,
CB_URL_COMPLETE: 26,
CB_STATUS_COMPLETE: 27,
CB_METHOD_COMPLETE: 32,
CB_VERSION_COMPLETE: 33,
CB_HEADER_FIELD_COMPLETE: 28,
CB_HEADER_VALUE_COMPLETE: 29,
CB_CHUNK_EXTENSION_NAME_COMPLETE: 34,
CB_CHUNK_EXTENSION_VALUE_COMPLETE: 35,
CB_RESET: 31,
CB_PROTOCOL_COMPLETE: 38,
};
exports.TYPE = {
BOTH: 0, // default
REQUEST: 1,
RESPONSE: 2,
};
exports.FLAGS = {
CONNECTION_KEEP_ALIVE: 1 << 0,
CONNECTION_CLOSE: 1 << 1,
CONNECTION_UPGRADE: 1 << 2,
CHUNKED: 1 << 3,
UPGRADE: 1 << 4,
CONTENT_LENGTH: 1 << 5,
SKIPBODY: 1 << 6,
TRAILING: 1 << 7,
// 1 << 8 is unused
TRANSFER_ENCODING: 1 << 9,
};
exports.LENIENT_FLAGS = {
HEADERS: 1 << 0,
CHUNKED_LENGTH: 1 << 1,
KEEP_ALIVE: 1 << 2,
TRANSFER_ENCODING: 1 << 3,
VERSION: 1 << 4,
DATA_AFTER_CLOSE: 1 << 5,
OPTIONAL_LF_AFTER_CR: 1 << 6,
OPTIONAL_CRLF_AFTER_CHUNK: 1 << 7,
OPTIONAL_CR_BEFORE_LF: 1 << 8,
SPACES_AFTER_CHUNK_SIZE: 1 << 9,
};
exports.METHODS = {
'DELETE': 0,
'GET': 1,
'HEAD': 2,
'POST': 3,
'PUT': 4,
/* pathological */
'CONNECT': 5,
'OPTIONS': 6,
'TRACE': 7,
/* WebDAV */
'COPY': 8,
'LOCK': 9,
'MKCOL': 10,
'MOVE': 11,
'PROPFIND': 12,
'PROPPATCH': 13,
'SEARCH': 14,
'UNLOCK': 15,
'BIND': 16,
'REBIND': 17,
'UNBIND': 18,
'ACL': 19,
/* subversion */
'REPORT': 20,
'MKACTIVITY': 21,
'CHECKOUT': 22,
'MERGE': 23,
/* upnp */
'M-SEARCH': 24,
'NOTIFY': 25,
'SUBSCRIBE': 26,
'UNSUBSCRIBE': 27,
/* RFC-5789 */
'PATCH': 28,
'PURGE': 29,
/* CalDAV */
'MKCALENDAR': 30,
/* RFC-2068, section 19.6.1.2 */
'LINK': 31,
'UNLINK': 32,
/* icecast */
'SOURCE': 33,
/* RFC-7540, section 11.6 */
'PRI': 34,
/* RFC-2326 RTSP */
'DESCRIBE': 35,
'ANNOUNCE': 36,
'SETUP': 37,
'PLAY': 38,
'PAUSE': 39,
'TEARDOWN': 40,
'GET_PARAMETER': 41,
'SET_PARAMETER': 42,
'REDIRECT': 43,
'RECORD': 44,
/* RAOP */
'FLUSH': 45,
/* DRAFT https://www.ietf.org/archive/id/draft-ietf-httpbis-safe-method-w-body-02.html */
'QUERY': 46,
};
exports.STATUSES = {
CONTINUE: 100,
SWITCHING_PROTOCOLS: 101,
PROCESSING: 102,
EARLY_HINTS: 103,
RESPONSE_IS_STALE: 110, // Unofficial
REVALIDATION_FAILED: 111, // Unofficial
DISCONNECTED_OPERATION: 112, // Unofficial
HEURISTIC_EXPIRATION: 113, // Unofficial
MISCELLANEOUS_WARNING: 199, // Unofficial
OK: 200,
CREATED: 201,
ACCEPTED: 202,
NON_AUTHORITATIVE_INFORMATION: 203,
NO_CONTENT: 204,
RESET_CONTENT: 205,
PARTIAL_CONTENT: 206,
MULTI_STATUS: 207,
ALREADY_REPORTED: 208,
TRANSFORMATION_APPLIED: 214, // Unofficial
IM_USED: 226,
MISCELLANEOUS_PERSISTENT_WARNING: 299, // Unofficial
MULTIPLE_CHOICES: 300,
MOVED_PERMANENTLY: 301,
FOUND: 302,
SEE_OTHER: 303,
NOT_MODIFIED: 304,
USE_PROXY: 305,
SWITCH_PROXY: 306, // No longer used
TEMPORARY_REDIRECT: 307,
PERMANENT_REDIRECT: 308,
BAD_REQUEST: 400,
UNAUTHORIZED: 401,
PAYMENT_REQUIRED: 402,
FORBIDDEN: 403,
NOT_FOUND: 404,
METHOD_NOT_ALLOWED: 405,
NOT_ACCEPTABLE: 406,
PROXY_AUTHENTICATION_REQUIRED: 407,
REQUEST_TIMEOUT: 408,
CONFLICT: 409,
GONE: 410,
LENGTH_REQUIRED: 411,
PRECONDITION_FAILED: 412,
PAYLOAD_TOO_LARGE: 413,
URI_TOO_LONG: 414,
UNSUPPORTED_MEDIA_TYPE: 415,
RANGE_NOT_SATISFIABLE: 416,
EXPECTATION_FAILED: 417,
IM_A_TEAPOT: 418,
PAGE_EXPIRED: 419, // Unofficial
ENHANCE_YOUR_CALM: 420, // Unofficial
MISDIRECTED_REQUEST: 421,
UNPROCESSABLE_ENTITY: 422,
LOCKED: 423,
FAILED_DEPENDENCY: 424,
TOO_EARLY: 425,
UPGRADE_REQUIRED: 426,
PRECONDITION_REQUIRED: 428,
TOO_MANY_REQUESTS: 429,
REQUEST_HEADER_FIELDS_TOO_LARGE_UNOFFICIAL: 430, // Unofficial
REQUEST_HEADER_FIELDS_TOO_LARGE: 431,
LOGIN_TIMEOUT: 440, // Unofficial
NO_RESPONSE: 444, // Unofficial
RETRY_WITH: 449, // Unofficial
BLOCKED_BY_PARENTAL_CONTROL: 450, // Unofficial
UNAVAILABLE_FOR_LEGAL_REASONS: 451,
CLIENT_CLOSED_LOAD_BALANCED_REQUEST: 460, // Unofficial
INVALID_X_FORWARDED_FOR: 463, // Unofficial
REQUEST_HEADER_TOO_LARGE: 494, // Unofficial
SSL_CERTIFICATE_ERROR: 495, // Unofficial
SSL_CERTIFICATE_REQUIRED: 496, // Unofficial
HTTP_REQUEST_SENT_TO_HTTPS_PORT: 497, // Unofficial
INVALID_TOKEN: 498, // Unofficial
CLIENT_CLOSED_REQUEST: 499, // Unofficial
INTERNAL_SERVER_ERROR: 500,
NOT_IMPLEMENTED: 501,
BAD_GATEWAY: 502,
SERVICE_UNAVAILABLE: 503,
GATEWAY_TIMEOUT: 504,
HTTP_VERSION_NOT_SUPPORTED: 505,
VARIANT_ALSO_NEGOTIATES: 506,
INSUFFICIENT_STORAGE: 507,
LOOP_DETECTED: 508,
BANDWIDTH_LIMIT_EXCEEDED: 509,
NOT_EXTENDED: 510,
NETWORK_AUTHENTICATION_REQUIRED: 511,
WEB_SERVER_UNKNOWN_ERROR: 520, // Unofficial
WEB_SERVER_IS_DOWN: 521, // Unofficial
CONNECTION_TIMEOUT: 522, // Unofficial
ORIGIN_IS_UNREACHABLE: 523, // Unofficial
TIMEOUT_OCCURED: 524, // Unofficial
SSL_HANDSHAKE_FAILED: 525, // Unofficial
INVALID_SSL_CERTIFICATE: 526, // Unofficial
RAILGUN_ERROR: 527, // Unofficial
SITE_IS_OVERLOADED: 529, // Unofficial
SITE_IS_FROZEN: 530, // Unofficial
IDENTITY_PROVIDER_AUTHENTICATION_ERROR: 561, // Unofficial
NETWORK_READ_TIMEOUT: 598, // Unofficial
NETWORK_CONNECT_TIMEOUT: 599, // Unofficial
};
exports.FINISH = {
SAFE: 0,
SAFE_WITH_CB: 1,
UNSAFE: 2,
};
exports.HEADER_STATE = {
GENERAL: 0,
CONNECTION: 1,
CONTENT_LENGTH: 2,
TRANSFER_ENCODING: 3,
UPGRADE: 4,
CONNECTION_KEEP_ALIVE: 5,
CONNECTION_CLOSE: 6,
CONNECTION_UPGRADE: 7,
TRANSFER_ENCODING_CHUNKED: 8,
};
// C headers
exports.METHODS_HTTP = [
exports.METHODS.DELETE,
exports.METHODS.GET,
exports.METHODS.HEAD,
exports.METHODS.POST,
exports.METHODS.PUT,
exports.METHODS.CONNECT,
exports.METHODS.OPTIONS,
exports.METHODS.TRACE,
exports.METHODS.COPY,
exports.METHODS.LOCK,
exports.METHODS.MKCOL,
exports.METHODS.MOVE,
exports.METHODS.PROPFIND,
exports.METHODS.PROPPATCH,
exports.METHODS.SEARCH,
exports.METHODS.UNLOCK,
exports.METHODS.BIND,
exports.METHODS.REBIND,
exports.METHODS.UNBIND,
exports.METHODS.ACL,
exports.METHODS.REPORT,
exports.METHODS.MKACTIVITY,
exports.METHODS.CHECKOUT,
exports.METHODS.MERGE,
exports.METHODS['M-SEARCH'],
exports.METHODS.NOTIFY,
exports.METHODS.SUBSCRIBE,
exports.METHODS.UNSUBSCRIBE,
exports.METHODS.PATCH,
exports.METHODS.PURGE,
exports.METHODS.MKCALENDAR,
exports.METHODS.LINK,
exports.METHODS.UNLINK,
exports.METHODS.PRI,
// TODO(indutny): should we allow it with HTTP?
exports.METHODS.SOURCE,
exports.METHODS.QUERY,
];
exports.METHODS_ICE = [
exports.METHODS.SOURCE,
];
exports.METHODS_RTSP = [
exports.METHODS.OPTIONS,
exports.METHODS.DESCRIBE,
exports.METHODS.ANNOUNCE,
exports.METHODS.SETUP,
exports.METHODS.PLAY,
exports.METHODS.PAUSE,
exports.METHODS.TEARDOWN,
exports.METHODS.GET_PARAMETER,
exports.METHODS.SET_PARAMETER,
exports.METHODS.REDIRECT,
exports.METHODS.RECORD,
exports.METHODS.FLUSH,
// For AirPlay
exports.METHODS.GET,
exports.METHODS.POST,
];
exports.METHOD_MAP = (0, utils_1.enumToMap)(exports.METHODS);
exports.H_METHOD_MAP = Object.fromEntries(Object.entries(exports.METHODS).filter(([k]) => k.startsWith('H')));
exports.STATUSES_HTTP = [
exports.STATUSES.CONTINUE,
exports.STATUSES.SWITCHING_PROTOCOLS,
exports.STATUSES.PROCESSING,
exports.STATUSES.EARLY_HINTS,
exports.STATUSES.RESPONSE_IS_STALE,
exports.STATUSES.REVALIDATION_FAILED,
exports.STATUSES.DISCONNECTED_OPERATION,
exports.STATUSES.HEURISTIC_EXPIRATION,
exports.STATUSES.MISCELLANEOUS_WARNING,
exports.STATUSES.OK,
exports.STATUSES.CREATED,
exports.STATUSES.ACCEPTED,
exports.STATUSES.NON_AUTHORITATIVE_INFORMATION,
exports.STATUSES.NO_CONTENT,
exports.STATUSES.RESET_CONTENT,
exports.STATUSES.PARTIAL_CONTENT,
exports.STATUSES.MULTI_STATUS,
exports.STATUSES.ALREADY_REPORTED,
exports.STATUSES.TRANSFORMATION_APPLIED,
exports.STATUSES.IM_USED,
exports.STATUSES.MISCELLANEOUS_PERSISTENT_WARNING,
exports.STATUSES.MULTIPLE_CHOICES,
exports.STATUSES.MOVED_PERMANENTLY,
exports.STATUSES.FOUND,
exports.STATUSES.SEE_OTHER,
exports.STATUSES.NOT_MODIFIED,
exports.STATUSES.USE_PROXY,
exports.STATUSES.SWITCH_PROXY,
exports.STATUSES.TEMPORARY_REDIRECT,
exports.STATUSES.PERMANENT_REDIRECT,
exports.STATUSES.BAD_REQUEST,
exports.STATUSES.UNAUTHORIZED,
exports.STATUSES.PAYMENT_REQUIRED,
exports.STATUSES.FORBIDDEN,
exports.STATUSES.NOT_FOUND,
exports.STATUSES.METHOD_NOT_ALLOWED,
exports.STATUSES.NOT_ACCEPTABLE,
exports.STATUSES.PROXY_AUTHENTICATION_REQUIRED,
exports.STATUSES.REQUEST_TIMEOUT,
exports.STATUSES.CONFLICT,
exports.STATUSES.GONE,
exports.STATUSES.LENGTH_REQUIRED,
exports.STATUSES.PRECONDITION_FAILED,
exports.STATUSES.PAYLOAD_TOO_LARGE,
exports.STATUSES.URI_TOO_LONG,
exports.STATUSES.UNSUPPORTED_MEDIA_TYPE,
exports.STATUSES.RANGE_NOT_SATISFIABLE,
exports.STATUSES.EXPECTATION_FAILED,
exports.STATUSES.IM_A_TEAPOT,
exports.STATUSES.PAGE_EXPIRED,
exports.STATUSES.ENHANCE_YOUR_CALM,
exports.STATUSES.MISDIRECTED_REQUEST,
exports.STATUSES.UNPROCESSABLE_ENTITY,
exports.STATUSES.LOCKED,
exports.STATUSES.FAILED_DEPENDENCY,
exports.STATUSES.TOO_EARLY,
exports.STATUSES.UPGRADE_REQUIRED,
exports.STATUSES.PRECONDITION_REQUIRED,
exports.STATUSES.TOO_MANY_REQUESTS,
exports.STATUSES.REQUEST_HEADER_FIELDS_TOO_LARGE_UNOFFICIAL,
exports.STATUSES.REQUEST_HEADER_FIELDS_TOO_LARGE,
exports.STATUSES.LOGIN_TIMEOUT,
exports.STATUSES.NO_RESPONSE,
exports.STATUSES.RETRY_WITH,
exports.STATUSES.BLOCKED_BY_PARENTAL_CONTROL,
exports.STATUSES.UNAVAILABLE_FOR_LEGAL_REASONS,
exports.STATUSES.CLIENT_CLOSED_LOAD_BALANCED_REQUEST,
exports.STATUSES.INVALID_X_FORWARDED_FOR,
exports.STATUSES.REQUEST_HEADER_TOO_LARGE,
exports.STATUSES.SSL_CERTIFICATE_ERROR,
exports.STATUSES.SSL_CERTIFICATE_REQUIRED,
exports.STATUSES.HTTP_REQUEST_SENT_TO_HTTPS_PORT,
exports.STATUSES.INVALID_TOKEN,
exports.STATUSES.CLIENT_CLOSED_REQUEST,
exports.STATUSES.INTERNAL_SERVER_ERROR,
exports.STATUSES.NOT_IMPLEMENTED,
exports.STATUSES.BAD_GATEWAY,
exports.STATUSES.SERVICE_UNAVAILABLE,
exports.STATUSES.GATEWAY_TIMEOUT,
exports.STATUSES.HTTP_VERSION_NOT_SUPPORTED,
exports.STATUSES.VARIANT_ALSO_NEGOTIATES,
exports.STATUSES.INSUFFICIENT_STORAGE,
exports.STATUSES.LOOP_DETECTED,
exports.STATUSES.BANDWIDTH_LIMIT_EXCEEDED,
exports.STATUSES.NOT_EXTENDED,
exports.STATUSES.NETWORK_AUTHENTICATION_REQUIRED,
exports.STATUSES.WEB_SERVER_UNKNOWN_ERROR,
exports.STATUSES.WEB_SERVER_IS_DOWN,
exports.STATUSES.CONNECTION_TIMEOUT,
exports.STATUSES.ORIGIN_IS_UNREACHABLE,
exports.STATUSES.TIMEOUT_OCCURED,
exports.STATUSES.SSL_HANDSHAKE_FAILED,
exports.STATUSES.INVALID_SSL_CERTIFICATE,
exports.STATUSES.RAILGUN_ERROR,
exports.STATUSES.SITE_IS_OVERLOADED,
exports.STATUSES.SITE_IS_FROZEN,
exports.STATUSES.IDENTITY_PROVIDER_AUTHENTICATION_ERROR,
exports.STATUSES.NETWORK_READ_TIMEOUT,
exports.STATUSES.NETWORK_CONNECT_TIMEOUT,
];
exports.ALPHA = [];
for (let i = 'A'.charCodeAt(0); i <= 'Z'.charCodeAt(0); i++) {
// Upper case
exports.ALPHA.push(String.fromCharCode(i));
// Lower case
exports.ALPHA.push(String.fromCharCode(i + 0x20));
}
exports.NUM_MAP = {
0: 0, 1: 1, 2: 2, 3: 3, 4: 4,
5: 5, 6: 6, 7: 7, 8: 8, 9: 9,
};
exports.HEX_MAP = {
0: 0, 1: 1, 2: 2, 3: 3, 4: 4,
5: 5, 6: 6, 7: 7, 8: 8, 9: 9,
A: 0XA, B: 0XB, C: 0XC, D: 0XD, E: 0XE, F: 0XF,
a: 0xa, b: 0xb, c: 0xc, d: 0xd, e: 0xe, f: 0xf,
};
exports.NUM = [
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
];
exports.ALPHANUM = exports.ALPHA.concat(exports.NUM);
exports.MARK = ['-', '_', '.', '!', '~', '*', '\'', '(', ')'];
exports.USERINFO_CHARS = exports.ALPHANUM
.concat(exports.MARK)
.concat(['%', ';', ':', '&', '=', '+', '$', ',']);
// TODO(indutny): use RFC
exports.URL_CHAR = [
'!', '"', '$', '%', '&', '\'',
'(', ')', '*', '+', ',', '-', '.', '/',
':', ';', '<', '=', '>',
'@', '[', '\\', ']', '^', '_',
'`',
'{', '|', '}', '~',
].concat(exports.ALPHANUM);
exports.HEX = exports.NUM.concat(['a', 'b', 'c', 'd', 'e', 'f', 'A', 'B', 'C', 'D', 'E', 'F']);
/* Tokens as defined by rfc 2616. Also lowercases them.
* token = 1*<any CHAR except CTLs or separators>
* separators = "(" | ")" | "<" | ">" | "@"
* | "," | ";" | ":" | "\" | <">
* | "/" | "[" | "]" | "?" | "="
* | "{" | "}" | SP | HT
*/
exports.TOKEN = [
'!', '#', '$', '%', '&', '\'',
'*', '+', '-', '.',
'^', '_', '`',
'|', '~',
].concat(exports.ALPHANUM);
/*
* Verify that a char is a valid visible (printable) US-ASCII
* character or %x80-FF
*/
exports.HEADER_CHARS = ['\t'];
for (let i = 32; i <= 255; i++) {
if (i !== 127) {
exports.HEADER_CHARS.push(i);
}
}
// ',' = \x44
exports.CONNECTION_TOKEN_CHARS = exports.HEADER_CHARS.filter((c) => c !== 44);
exports.QUOTED_STRING = ['\t', ' '];
for (let i = 0x21; i <= 0xff; i++) {
if (i !== 0x22 && i !== 0x5c) { // All characters in ASCII except \ and "
exports.QUOTED_STRING.push(i);
}
}
exports.HTAB_SP_VCHAR_OBS_TEXT = ['\t', ' '];
// VCHAR: https://tools.ietf.org/html/rfc5234#appendix-B.1
for (let i = 0x21; i <= 0x7E; i++) {
exports.HTAB_SP_VCHAR_OBS_TEXT.push(i);
}
// OBS_TEXT: https://datatracker.ietf.org/doc/html/rfc9110#name-collected-abnf
for (let i = 0x80; i <= 0xff; i++) {
exports.HTAB_SP_VCHAR_OBS_TEXT.push(i);
}
exports.MAJOR = exports.NUM_MAP;
exports.MINOR = exports.MAJOR;
exports.SPECIAL_HEADERS = {
'connection': exports.HEADER_STATE.CONNECTION,
'content-length': exports.HEADER_STATE.CONTENT_LENGTH,
'proxy-connection': exports.HEADER_STATE.CONNECTION,
'transfer-encoding': exports.HEADER_STATE.TRANSFER_ENCODING,
'upgrade': exports.HEADER_STATE.UPGRADE,
};
exports.default = {
ERROR: exports.ERROR,
TYPE: exports.TYPE,
FLAGS: exports.FLAGS,
LENIENT_FLAGS: exports.LENIENT_FLAGS,
METHODS: exports.METHODS,
STATUSES: exports.STATUSES,
FINISH: exports.FINISH,
HEADER_STATE: exports.HEADER_STATE,
ALPHA: exports.ALPHA,
NUM_MAP: exports.NUM_MAP,
HEX_MAP: exports.HEX_MAP,
NUM: exports.NUM,
ALPHANUM: exports.ALPHANUM,
MARK: exports.MARK,
USERINFO_CHARS: exports.USERINFO_CHARS,
URL_CHAR: exports.URL_CHAR,
HEX: exports.HEX,
TOKEN: exports.TOKEN,
HEADER_CHARS: exports.HEADER_CHARS,
CONNECTION_TOKEN_CHARS: exports.CONNECTION_TOKEN_CHARS,
QUOTED_STRING: exports.QUOTED_STRING,
HTAB_SP_VCHAR_OBS_TEXT: exports.HTAB_SP_VCHAR_OBS_TEXT,
MAJOR: exports.MAJOR,
MINOR: exports.MINOR,
SPECIAL_HEADERS: exports.SPECIAL_HEADERS,
METHODS_HTTP: exports.METHODS_HTTP,
METHODS_ICE: exports.METHODS_ICE,
METHODS_RTSP: exports.METHODS_RTSP,
METHOD_MAP: exports.METHOD_MAP,
H_METHOD_MAP: exports.H_METHOD_MAP,
STATUSES_HTTP: exports.STATUSES_HTTP,
};
@@ -0,0 +1 @@
{"version":3,"file":"transform-rotated-parent.mjs","sources":["../../../src/utils/transform-rotated-parent.ts"],"sourcesContent":["import type { Point, TransformPoint } from \"motion-utils\"\nimport type { RefObject } from \"react\"\n\n/**\n * Creates a `transformPagePoint` function that corrects pointer coordinates\n * for a parent container with CSS transforms (rotation, scale, skew).\n *\n * When dragging elements inside a transformed parent, pointer coordinates\n * need to be transformed through the inverse of the parent's transform\n * so the drag offset is in local space.\n *\n * Works with both static and continuously animating transforms.\n *\n * @example\n * ```jsx\n * function App() {\n * const ref = useRef(null)\n *\n * return (\n * <motion.div ref={ref} style={{ rotate: 90 }}>\n * <MotionConfig transformPagePoint={correctParentTransform(ref)}>\n * <motion.div drag />\n * </MotionConfig>\n * </motion.div>\n * )\n * }\n * ```\n *\n * @param parentRef - A React ref to the transformed parent element\n * @returns A transformPagePoint function for use with MotionConfig\n *\n * @public\n */\nexport function correctParentTransform(\n parentRef: RefObject<HTMLElement | null>\n): TransformPoint {\n return (point: Point): Point => {\n const parent = parentRef.current\n if (!parent) return point\n\n const inv = getInverseMatrix(parent)\n if (!inv) return point\n\n // Get center of rotation in page space\n const rect = parent.getBoundingClientRect()\n const cx = rect.left + window.scrollX + rect.width / 2\n const cy = rect.top + window.scrollY + rect.height / 2\n\n // Transform (point - center) through inverse, then add center back\n const dx = point.x - cx\n const dy = point.y - cy\n return {\n x: cx + inv.a * dx + inv.c * dy,\n y: cy + inv.b * dx + inv.d * dy,\n }\n }\n}\n\ninterface InverseMatrix {\n a: number\n b: number\n c: number\n d: number\n}\n\nfunction getInverseMatrix(element: HTMLElement): InverseMatrix | null {\n const { transform } = getComputedStyle(element)\n if (!transform || transform === \"none\") return null\n\n const match =\n transform.match(/^matrix3d\\((.*)\\)$/u) ||\n transform.match(/^matrix\\((.*)\\)$/u)\n if (!match) return null\n\n const v = match[1].split(\",\").map(Number)\n const is3d = transform.startsWith(\"matrix3d\")\n const a = v[0],\n b = v[1]\n const c = is3d ? v[4] : v[2]\n const d = is3d ? v[5] : v[3]\n\n const det = a * d - b * c\n if (Math.abs(det) < 1e-10) return null\n\n return { a: d / det, b: -b / det, c: -c / det, d: a / det }\n}\n"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BG;AACG,SAAU,sBAAsB,CAClC,SAAwC,EAAA;IAExC,OAAO,CAAC,KAAY,KAAW;AAC3B,QAAA,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO;AAChC,QAAA,IAAI,CAAC,MAAM;AAAE,YAAA,OAAO,KAAK;AAEzB,QAAA,MAAM,GAAG,GAAG,gBAAgB,CAAC,MAAM,CAAC;AACpC,QAAA,IAAI,CAAC,GAAG;AAAE,YAAA,OAAO,KAAK;;AAGtB,QAAA,MAAM,IAAI,GAAG,MAAM,CAAC,qBAAqB,EAAE;AAC3C,QAAA,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,GAAG,CA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,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAE5B,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC;AACzB,IAAA,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK;AAAE,QAAA,OAAO,IAAI;IAEtC,OAAO,EAAE,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE;AAC/D;;;;"}
@@ -0,0 +1,247 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
const spaceIndents = [];
for (let i = 0; i < 32; i++) {
spaceIndents.push(" ".repeat(i * 2));
}
class Buffer {
constructor(map, indentChar) {
this._map = null;
this._buf = "";
this._str = "";
this._appendCount = 0;
this._last = 0;
this._canMarkIdName = true;
this._indentChar = "";
this._queuedChar = 0;
this._position = {
line: 1,
column: 0
};
this._sourcePosition = {
identifierName: undefined,
identifierNamePos: undefined,
line: undefined,
column: undefined,
filename: undefined
};
this._map = map;
this._indentChar = indentChar;
}
get() {
const {
_map,
_last
} = this;
if (this._queuedChar !== 32) {
this._flush();
}
const code = _last === 10 ? (this._buf + this._str).trimRight() : this._buf + this._str;
if (_map === null) {
return {
code: code,
decodedMap: undefined,
map: null,
rawMappings: undefined
};
}
const result = {
code: code,
decodedMap: _map.getDecoded(),
get __mergedMap() {
return this.map;
},
get map() {
const resultMap = _map.get();
result.map = resultMap;
return resultMap;
},
set map(value) {
Object.defineProperty(result, "map", {
value,
writable: true
});
},
get rawMappings() {
const mappings = _map.getRawMappings();
result.rawMappings = mappings;
return mappings;
},
set rawMappings(value) {
Object.defineProperty(result, "rawMappings", {
value,
writable: true
});
}
};
return result;
}
append(str, maybeNewline, ignoreMapping = false) {
this._flush();
this._append(str, maybeNewline, ignoreMapping);
}
appendChar(char) {
this._flush();
this._appendChar(char, 1, true);
}
queue(char) {
this._flush();
this._queuedChar = char;
}
_flush() {
const queuedChar = this._queuedChar;
if (queuedChar !== 0) {
this._appendChar(queuedChar, 1, true);
this._queuedChar = 0;
}
}
_appendChar(char, repeat, useSourcePos) {
this._last = char;
if (char === -1) {
const indent = repeat >= 64 ? this._indentChar.repeat(repeat) : spaceIndents[repeat / 2];
this._str += indent;
} else {
this._str += repeat > 1 ? String.fromCharCode(char).repeat(repeat) : String.fromCharCode(char);
}
const isSpace = char === 32;
const position = this._position;
if (char !== 10) {
if (this._map) {
const sourcePos = this._sourcePosition;
if (useSourcePos && sourcePos) {
this._map.mark(position, sourcePos.line, sourcePos.column, isSpace ? undefined : sourcePos.identifierName, isSpace ? undefined : sourcePos.identifierNamePos, sourcePos.filename);
if (!isSpace && this._canMarkIdName) {
sourcePos.identifierName = undefined;
sourcePos.identifierNamePos = undefined;
}
} else {
this._map.mark(position);
}
}
position.column += repeat;
} else {
position.line++;
position.column = 0;
}
}
_append(str, maybeNewline, ignoreMapping) {
const len = str.length;
const position = this._position;
const sourcePos = this._sourcePosition;
this._last = -1;
if (++this._appendCount > 4096) {
+this._str;
this._buf += this._str;
this._str = str;
this._appendCount = 0;
} else {
this._str += str;
}
const hasMap = !ignoreMapping && this._map !== null;
if (!maybeNewline && !hasMap) {
position.column += len;
return;
}
const {
column,
identifierName,
identifierNamePos,
filename
} = sourcePos;
let line = sourcePos.line;
if ((identifierName != null || identifierNamePos != null) && this._canMarkIdName) {
sourcePos.identifierName = undefined;
sourcePos.identifierNamePos = undefined;
}
let i = str.indexOf("\n");
let last = 0;
if (hasMap && i !== 0) {
this._map.mark(position, line, column, identifierName, identifierNamePos, filename);
}
while (i !== -1) {
position.line++;
position.column = 0;
last = i + 1;
if (last < len && line !== undefined) {
line++;
if (hasMap) {
this._map.mark(position, line, 0, undefined, undefined, filename);
}
}
i = str.indexOf("\n", last);
}
position.column += len - last;
}
removeLastSemicolon() {
if (this._queuedChar === 59) {
this._queuedChar = 0;
}
}
getLastChar(checkQueue) {
if (!checkQueue) {
return this._last;
}
const queuedChar = this._queuedChar;
return queuedChar !== 0 ? queuedChar : this._last;
}
getNewlineCount() {
return this._queuedChar === 0 && this._last === 10 ? 1 : 0;
}
hasContent() {
return this._last !== 0;
}
exactSource(loc, cb) {
if (!this._map) {
cb();
return;
}
this.source("start", loc);
const identifierName = loc.identifierName;
const sourcePos = this._sourcePosition;
if (identifierName != null) {
this._canMarkIdName = false;
sourcePos.identifierName = identifierName;
}
cb();
if (identifierName != null) {
this._canMarkIdName = true;
sourcePos.identifierName = undefined;
sourcePos.identifierNamePos = undefined;
}
this.source("end", loc);
}
source(prop, loc) {
if (!this._map) return;
this._normalizePosition(prop, loc, 0);
}
sourceWithOffset(prop, loc, columnOffset) {
if (!this._map) return;
this._normalizePosition(prop, loc, columnOffset);
}
_normalizePosition(prop, loc, columnOffset) {
this._flush();
const pos = loc[prop];
if (pos) {
this.setSourcePosition(pos.line, Math.max(pos.column + columnOffset, 0));
this._sourcePosition.filename = loc.filename;
}
}
setSourcePosition(line, column) {
const target = this._sourcePosition;
target.line = line;
target.column = column;
}
getCurrentColumn() {
return this._position.column + (this._queuedChar ? 1 : 0);
}
getCurrentLine() {
return this._position.line;
}
}
exports.default = Buffer;
//# sourceMappingURL=buffer.js.map
@@ -0,0 +1,90 @@
/**
* @deprecated CUID v1 is deprecated by its authors due to information leakage
* (timestamps embedded in the id). Use {@link cuid2} instead.
* See https://github.com/paralleldrive/cuid.
*/
export declare const cuid: RegExp;
export declare const cuid2: RegExp;
export declare const ulid: RegExp;
export declare const xid: RegExp;
export declare const ksuid: RegExp;
export declare const nanoid: RegExp;
export declare function nanoidOfLength(length: number): RegExp;
/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
export declare const duration: RegExp;
/** Implements ISO 8601-2 extensions like explicit +- prefixes, mixing weeks with other units, and fractional/negative components. */
export declare const extendedDuration: RegExp;
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
export declare const guid: RegExp;
/** Returns a regex for validating an RFC 9562/4122 UUID.
*
* @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
export declare const uuid: (version?: number | undefined) => RegExp;
export declare const uuid4: RegExp;
export declare const uuid6: RegExp;
export declare const uuid7: RegExp;
/** Practical email validation */
export declare const email: RegExp;
/** Equivalent to the HTML5 input[type=email] validation implemented by browsers. Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email */
export declare const html5Email: RegExp;
/** The classic emailregex.com regex for RFC 5322-compliant emails */
export declare const rfc5322Email: RegExp;
/** A loose regex that allows Unicode characters, enforces length limits, and that's about it. */
export declare const unicodeEmail: RegExp;
export declare const idnEmail: RegExp;
export declare const browserEmail: RegExp;
export declare function emoji(): RegExp;
export declare const ipv4: RegExp;
export declare const ipv6: RegExp;
export declare const mac: (delimiter?: string) => RegExp;
export declare const cidrv4: RegExp;
export declare const cidrv6: RegExp;
export declare const base64: RegExp;
export declare const base64url: RegExp;
export declare const hostname: RegExp;
export declare const domain: RegExp;
export declare const httpProtocol: RegExp;
export declare const e164: RegExp;
export declare const creditCard: RegExp;
export declare const currencyCode: RegExp;
export declare const iban: RegExp;
export declare const date: RegExp;
export declare function time(args: {
precision?: number | null;
}): RegExp;
export declare function datetime(args: {
precision?: number | null;
offset?: boolean;
local?: boolean;
}): RegExp;
export declare const anyString: RegExp;
export declare const string: (params?: {
minimum?: number | undefined;
maximum?: number | undefined;
}) => RegExp;
export declare const bigint: RegExp;
export declare const integer: RegExp;
export declare const number: RegExp;
export declare const boolean: RegExp;
declare const _null: RegExp;
export { _null as null };
declare const _undefined: RegExp;
export { _undefined as undefined };
export declare const lowercase: RegExp;
export declare const uppercase: RegExp;
export declare const hex: RegExp;
export declare const md5_hex: RegExp;
export declare const md5_base64: RegExp;
export declare const md5_base64url: RegExp;
export declare const sha1_hex: RegExp;
export declare const sha1_base64: RegExp;
export declare const sha1_base64url: RegExp;
export declare const sha256_hex: RegExp;
export declare const sha256_base64: RegExp;
export declare const sha256_base64url: RegExp;
export declare const sha384_hex: RegExp;
export declare const sha384_base64: RegExp;
export declare const sha384_base64url: RegExp;
export declare const sha512_hex: RegExp;
export declare const sha512_base64: RegExp;
export declare const sha512_base64url: RegExp;
@@ -0,0 +1,2 @@
import { detectFromCookie, detectFromHeader, detectFromPath, detectFromQuery, languageDetector } from "./language.js";
export { detectFromCookie, detectFromHeader, detectFromPath, detectFromQuery, languageDetector };
@@ -0,0 +1,10 @@
import { Level } from 'base-log-factory';
export declare const colors: {
[Level.FATAL]: string;
[Level.ERROR]: string;
[Level.WARN]: string;
[Level.INFO]: string;
[Level.DEBUG]: string;
[Level.TRACE]: string;
[Level.OFF]: string;
};
@@ -0,0 +1 @@
{"version":3,"file":"l33t.mjs","sources":["../../../../../src/matcher/dictionary/variants/scoring/l33t.ts"],"sourcesContent":[null],"names":["countSubstring","string","substring","count","pos","indexOf","length","getCounts","sub","token","tokenLower","toLowerCase","subbedCount","substitution","unsubbedCount","letter","l33t","subs","variations","forEach","p","Math","min","possibilities","i","utils","nCk"],"mappings":";;AAcA,MAAMA,cAAc,GAAGA,CAACC,MAAc,EAAEC,SAAiB,KAAI;EAC3D,IAAIC,KAAK,GAAG,CAAC;AACb,EAAA,IAAIC,GAAG,GAAGH,MAAM,CAACI,OAAO,CAACH,SAAS,CAAC;EACnC,OAAOE,GAAG,IAAI,CAAC,EAAE;AACfD,IAAAA,KAAK,IAAI,CAAC;AACVC,IAAAA,GAAG,GAAGH,MAAM,CAACI,OAAO,CAACH,SAAS,EAAEE,GAAG,GAAGF,SAAS,CAACI,MAAM,CAAC;AACzD,EAAA;AACA,EAAA,OAAOH,KAAK;AACd,CAAC;AAED,MAAMI,SAAS,GAAGA,CAAC;EAAEC,GAAG;AAAEC,EAAAA;AAAK,CAAoB,KAAI;AACrD;AACA,EAAA,MAAMC,UAAU,GAAGD,KAAK,CAACE,WAAW,EAAE;AACtC;EACA,MAAMC,WAAW,GAAGZ,cAAc,CAACU,UAAU,EAAEF,GAAG,CAACK,YAAY,CAAC;AAEhE;EACA,MAAMC,aAAa,GAAGd,cAAc,CAACU,UAAU,EAAEF,GAAG,CAACO,MAAM,CAAC;EAC5D,OAAO;IACLH,WAAW;AACXE,IAAAA;GACD;AACH,CAAC;AAED,kBAAe,CAAC;EAAEE,IAAI;EAAEC,IAAI;AAAER,EAAAA;AAAK,CAAe,KAAI;EACpD,IAAI,CAACO,IAAI,EAAE;AACT,IAAA,OAAO,CAAC;AACV,EAAA;EACA,IAAIE,UAAU,GAAG,CAAC;AAClBD,EAAAA,IAAI,CAACE,OAAO,CAAEX,GAAG,IAAI;IACnB,MAAM;MAAEI,WAAW;AAAEE,MAAAA;KAAe,GAAGP,SAAS,CAAC;MAAEC,GAAG;AAAEC,MAAAA;AAAK,KAAE,CAAC;AAEhE,IAAA,IAAIG,WAAW,KAAK,CAAC,IAAIE,aAAa,KAAK,CAAC,EAAE;AAC5C;AACA;AACA;AACAI,MAAAA,UAAU,IAAI,CAAC;AACjB,IAAA,CAAC,MAAM;AACL;AACA;MACA,MAAME,CAAC,GAAGC,IAAI,CAACC,GAAG,CAACR,aAAa,EAAEF,WAAW,CAAC;MAC9C,IAAIW,aAAa,GAAG,CAAC;AACrB,MAAA,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,IAAIJ,CAAC,EAAEI,CAAC,IAAI,CAAC,EAAE;QAC9BD,aAAa,IAAIE,KAAK,CAACC,GAAG,CAACZ,aAAa,GAAGF,WAAW,EAAEY,CAAC,CAAC;AAC5D,MAAA;AACAN,MAAAA,UAAU,IAAIK,aAAa;AAC7B,IAAA;AACF,EAAA,CAAC,CAAC;AACF,EAAA,OAAOL,UAAU;AACnB,CAAC;;;;"}
@@ -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 RefreshCw = createLucideIcon("RefreshCw", [
["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
["path", { d: "M21 3v5h-5", key: "1q7to0" }],
["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
["path", { d: "M8 16H3v5", key: "1cv678" }]
]);
export { RefreshCw as default };
//# sourceMappingURL=refresh-cw.js.map
@@ -0,0 +1,17 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const StarOff = createLucideIcon("StarOff", [
["path", { d: "M8.34 8.34 2 9.27l5 4.87L5.82 21 12 17.77 18.18 21l-.59-3.43", key: "16m0ql" }],
["path", { d: "M18.42 12.76 22 9.27l-6.91-1L12 2l-1.44 2.91", key: "1vt8nq" }],
["line", { x1: "2", x2: "22", y1: "2", y2: "22", key: "a6p6uj" }]
]);
export { StarOff as default };
//# sourceMappingURL=star-off.js.map
@@ -0,0 +1,16 @@
import type { SourceMapInput } from '@jridgewell/trace-mapping';
export type { SourceMapSegment, DecodedSourceMap, EncodedSourceMap, } from '@jridgewell/trace-mapping';
export type { SourceMapInput };
export type LoaderContext = {
readonly importer: string;
readonly depth: number;
source: string;
content: string | null | undefined;
ignore: boolean | undefined;
};
export type SourceMapLoader = (file: string, ctx: LoaderContext) => SourceMapInput | null | undefined | void;
export type Options = {
excludeContent?: boolean;
decodedMappings?: boolean;
};
//# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
module.exports={A:{A:{"1":"_A","2":"_Z"},B:{"1":"_J"},C:{"1":"_CF","2":"_OC","260":"_wL _9D","292":"_FC LD"},D:{"1":"_NF","33":"_oD _WF","548":"_UC"},E:{"1":"_uC","2":"_e","260":"_4R _GR","292":"_iG","804":"_5"},F:{"1":"_yF","2":"_QD","33":"C cD","164":"_tB"},G:{"1":"_7B","260":"_JC _hR _XG","292":"_xC","804":"_d"},H:{"2":"1D"},I:{"1":"_X","33":"_oF","548":"_LB"},J:{"1":"A","548":"D"},K:{"1":"_ZB","2":"_A","33":"C","164":"_tB"},L:{"1":"I"},M:{"1":"YC"},N:{"1":"_A"},O:{"1":"bC"},P:{"1":"_F"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"_C"}},B:4,C:"CSS Gradients",D:true};
@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: [ljharb]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: npm/call-bound
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -0,0 +1,617 @@
export default `flf2a$ 6 5 20 -1 3
Bright Font by Dennis Monk 7/94
Identical to contrast.flf, but with different characters, making it
brighter.
........@
........@
........@
........@
........@
........@@
...##...@
...##...@
...##...@
........@
...##...@
........@@
.##..##.@
.##..##.@
..#..#..@
........@
........@
........@@
..#..#..@
.######.@
..#..#..@
.######.@
..#..#..@
........@@
..#####.@
.##.#...@
..####..@
...#.##.@
.#####..@
........@@
.##..##.@
.#..##..@
...##...@
..##..#.@
.##..##.@
........@@
..#####..@
.##...##.@
..##.##..@
.##.##.#.@
..#####..@
.........@@
...##...@
...##...@
....#...@
........@
........@
........@@
....###.@
..##....@
.#......@
..##....@
....###.@
........@@
.###....@
....##..@
......#.@
....##..@
.###....@
........@@
.#..#..#.@
..#.#.#..@
.#######.@
..#.#.#..@
.#..#..#.@
.........@@
...##...@
...##...@
.######.@
...##...@
...##...@
........@@
........@
........@
...##...@
...##...@
....#...@
........@@
........@
........@
.######.@
........@
........@
........@@
........@
........@
........@
...##...@
...##...@
........@@
.....##.@
....##..@
...##...@
..##....@
.##.....@
........@@
..####..@
.##..##.@
.######.@
.##..##.@
..####..@
........@@
...##...@
..###...@
...##...@
...##...@
.######.@
........@@
..####..@
.....##.@
..####..@
.##.....@
.######.@
........@@
.######.@
....##..@
...###..@
.....##.@
.#####..@
........@@
.....##.@
.##..##.@
.######.@
.....##.@
.....##.@
........@@
.######.@
.##.....@
..####..@
.....##.@
.#####..@
........@@
...##...@
..##....@
.#####..@
.##..##.@
..####..@
........@@
.######.@
....##..@
...##...@
..##....@
.##.....@
........@@
..####..@
.##..##.@
..####..@
.##..##.@
..####..@
........@@
..####..@
.##..##.@
..####..@
...##...@
..##....@
........@@
........@
...##...@
........@
...##...@
........@
........@@
........@
...##...@
........@
...##...@
....#...@
........@@
.....##.@
...##...@
.##.....@
...##...@
.....##.@
........@@
........@
.######.@
........@
.######.@
........@
........@@
.##.....@
...##...@
.....##.@
...##...@
.##.....@
........@@
..####..@
.##..##.@
....##..@
...##...@
...##...@
........@@
..####..@
.#.##.#.@
.#.##.#.@
.#..#.#.@
..####..@
........@@
..####..@
.##..##.@
.######.@
.##..##.@
.##..##.@
........@@
.#####..@
.##..##.@
.#####..@
.##..##.@
.#####..@
........@@
..####..@
.##..##.@
.##.....@
.##..##.@
..####..@
........@@
.#####..@
.##..##.@
.##..##.@
.##..##.@
.#####..@
........@@
.######.@
.##.....@
.####...@
.##.....@
.######.@
........@@
.######.@
.##.....@
.####...@
.##.....@
.##.....@
........@@
..####..@
.##.....@
.##.###.@
.##..##.@
..####..@
........@@
.##..##.@
.##..##.@
.######.@
.##..##.@
.##..##.@
........@@
.######.@
...##...@
...##...@
...##...@
.######.@
........@@
.######.@
.....##.@
.....##.@
.##..##.@
..####..@
........@@
.##..##.@
.##.##..@
.####...@
.##.##..@
.##..##.@
........@@
.##.....@
.##.....@
.##.....@
.##.....@
.######.@
........@@
.##...##.@
.###.###.@
.##.#.##.@
.##...##.@
.##...##.@
.........@@
.##..##.@
.###.##.@
.##.###.@
.##..##.@
.##..##.@
........@@
..####..@
.##..##.@
.##..##.@
.##..##.@
..####..@
........@@
.#####..@
.##..##.@
.#####..@
.##.....@
.##.....@
........@@
..####..@
.##..##.@
.##.###.@
.##..##.@
..#####.@
........@@
.#####..@
.##..##.@
.#####..@
.##..##.@
.##..##.@
........@@
..####..@
.##.....@
..####..@
.....##.@
..####..@
........@@
.######.@
...##...@
...##...@
...##...@
...##...@
........@@
.##..##.@
.##..##.@
.##..##.@
.##..##.@
..####..@
........@@
.##..##.@
.##..##.@
.##..##.@
..####..@
...##...@
........@@
.##...##.@
.##...##.@
.##.#.##.@
.#######.@
..##.##..@
.........@@
.##..##.@
..####..@
...##...@
..####..@
.##..##.@
........@@
.##..##.@
..####..@
...##...@
...##...@
...##...@
........@@
.######.@
....##..@
...##...@
..##....@
.######.@
........@@
.######.@
.##.....@
.##.....@
.##.....@
.######.@
........@@
.##.....@
..##....@
...##...@
....##..@
.....##.@
........@@
.######.@
.....##.@
.....##.@
.....##.@
.######.@
........@@
...##...@
..####..@
.##..##.@
........@
........@
........@@
........@
........@
........@
........@
.######.@
........@@
...##...@
...##...@
...#....@
........@
........@
........@@
..####..@
.##..##.@
.######.@
.##..##.@
.##..##.@
........@@
.#####..@
.##..##.@
.#####..@
.##..##.@
.#####..@
........@@
..####..@
.##..##.@
.##.....@
.##..##.@
..####..@
........@@
.#####..@
.##..##.@
.##..##.@
.##..##.@
.#####..@
........@@
.######.@
.##.....@
.####...@
.##.....@
.######.@
........@@
.######.@
.##.....@
.####...@
.##.....@
.##.....@
........@@
..####..@
.##.....@
.##.###.@
.##..##.@
..####..@
........@@
.##..##.@
.##..##.@
.######.@
.##..##.@
.##..##.@
........@@
.######.@
...##...@
...##...@
...##...@
.######.@
........@@
.######.@
.....##.@
.....##.@
.##..##.@
..####..@
........@@
.##..##.@
.##.##..@
.####...@
.##.##..@
.##..##.@
........@@
.##.....@
.##.....@
.##.....@
.##.....@
.######.@
........@@
.##...##.@
.###.###.@
.##.#.##.@
.##...##.@
.##...##.@
.........@@
.##..##.@
.###.##.@
.##.###.@
.##..##.@
.##..##.@
........@@
..####..@
.##..##.@
.##..##.@
.##..##.@
..####..@
........@@
.#####..@
.##..##.@
.#####..@
.##.....@
.##.....@
........@@
..####..@
.##..##.@
.##.###.@
.##..##.@
..#####.@
........@@
.#####..@
.##..##.@
.#####..@
.##..##.@
.##..##.@
........@@
..####..@
.##.....@
..####..@
.....##.@
..####..@
........@@
.######.@
...##...@
...##...@
...##...@
...##...@
........@@
.##..##.@
.##..##.@
.##..##.@
.##..##.@
..####..@
........@@
.##..##.@
.##..##.@
.##..##.@
..####..@
...##...@
........@@
.##...##.@
.##...##.@
.##.#.##.@
.#######.@
..##.##..@
.........@@
.##..##.@
..####..@
...##...@
..####..@
.##..##.@
........@@
.##..##.@
..####..@
...##...@
...##...@
...##...@
........@@
.######.@
....##..@
...##...@
..##....@
.######.@
........@@
...####.@
...##...@
.###....@
...##...@
...####.@
........@@
...##...@
...##...@
...##...@
...##...@
...##...@
...##...@@
.####...@
...##...@
....###.@
...##...@
.####...@
........@@
..###.#.@
.#.###..@
........@
........@
........@
........@@
.##..##.@
........@
..#####.@
.##..##.@
..#####.@
........@@
.##..##.@
........@
..####..@
.##..##.@
..####..@
........@@
.##..##.@
........@
.##..##.@
.##..##.@
..####..@
........@@
.##..##.@
........@
..#####.@
.##..##.@
..#####.@
........@@
.##..##.@
........@
..####..@
.##..##.@
..####..@
........@@
.##..##.@
........@
.##..##.@
.##..##.@
..####..@
........@@
..#####..@
.##...##.@
.##.###..@
.##...##.@
.##.###..@
.##......@@
`
@@ -0,0 +1,616 @@
export default `flf2a$ 6 5 20 -1 2
Contrast Font by Dennis Monk 7/94
Original font, I think. Maybe inspired by one of Scarecrow's .sigs.
........@
........@
........@
........@
........@
........@@
...%%...@
...%%...@
...%%...@
........@
...%%...@
........@@
.%%..%%.@
.%%..%%.@
..%..%..@
........@
........@
........@@
..%..%..@
.%%%%%%.@
..%..%..@
.%%%%%%.@
..%..%..@
........@@
..%%%%%.@
.%%.%...@
..%%%%..@
...%.%%.@
.%%%%%..@
........@@
.%%..%%.@
.%..%%..@
...%%...@
..%%..%.@
.%%..%%.@
........@@
..%%%%%..@
.%%...%%.@
..%%.%%..@
.%%.%%.%.@
..%%%%%..@
.........@@
...%%...@
...%%...@
....%...@
........@
........@
........@@
....%%%.@
..%%....@
.%......@
..%%....@
....%%%.@
........@@
.%%%....@
....%%..@
......%.@
....%%..@
.%%%....@
........@@
.%..%..%.@
..%.%.%..@
.%%%%%%%.@
..%.%.%..@
.%..%..%.@
.........@@
...%%...@
...%%...@
.%%%%%%.@
...%%...@
...%%...@
........@@
........@
........@
...%%...@
...%%...@
....%...@
........@@
........@
........@
.%%%%%%.@
........@
........@
........@@
........@
........@
........@
...%%...@
...%%...@
........@@
.....%%.@
....%%..@
...%%...@
..%%....@
.%%.....@
........@@
..%%%%..@
.%%..%%.@
.%%%%%%.@
.%%..%%.@
..%%%%..@
........@@
...%%...@
..%%%...@
...%%...@
...%%...@
.%%%%%%.@
........@@
..%%%%..@
.....%%.@
..%%%%..@
.%%.....@
.%%%%%%.@
........@@
.%%%%%%.@
....%%..@
...%%%..@
.....%%.@
.%%%%%..@
........@@
.....%%.@
.%%..%%.@
.%%%%%%.@
.....%%.@
.....%%.@
........@@
.%%%%%%.@
.%%.....@
..%%%%..@
.....%%.@
.%%%%%..@
........@@
...%%...@
..%%....@
.%%%%%..@
.%%..%%.@
..%%%%..@
........@@
.%%%%%%.@
....%%..@
...%%...@
..%%....@
.%%.....@
........@@
..%%%%..@
.%%..%%.@
..%%%%..@
.%%..%%.@
..%%%%..@
........@@
..%%%%..@
.%%..%%.@
..%%%%..@
...%%...@
..%%....@
........@@
........@
...%%...@
........@
...%%...@
........@
........@@
........@
...%%...@
........@
...%%...@
....%...@
........@@
.....%%.@
...%%...@
.%%.....@
...%%...@
.....%%.@
........@@
........@
.%%%%%%.@
........@
.%%%%%%.@
........@
........@@
.%%.....@
...%%...@
.....%%.@
...%%...@
.%%.....@
........@@
..%%%%..@
.%%..%%.@
....%%..@
...%%...@
...%%...@
........@@
..%%%%..@
.%.%%.%.@
.%.%%.%.@
.%..%.%.@
..%%%%..@
........@@
..%%%%..@
.%%..%%.@
.%%%%%%.@
.%%..%%.@
.%%..%%.@
........@@
.%%%%%..@
.%%..%%.@
.%%%%%..@
.%%..%%.@
.%%%%%..@
........@@
..%%%%..@
.%%..%%.@
.%%.....@
.%%..%%.@
..%%%%..@
........@@
.%%%%%..@
.%%..%%.@
.%%..%%.@
.%%..%%.@
.%%%%%..@
........@@
.%%%%%%.@
.%%.....@
.%%%%...@
.%%.....@
.%%%%%%.@
........@@
.%%%%%%.@
.%%.....@
.%%%%...@
.%%.....@
.%%.....@
........@@
..%%%%..@
.%%.....@
.%%.%%%.@
.%%..%%.@
..%%%%..@
........@@
.%%..%%.@
.%%..%%.@
.%%%%%%.@
.%%..%%.@
.%%..%%.@
........@@
.%%%%%%.@
...%%...@
...%%...@
...%%...@
.%%%%%%.@
........@@
.%%%%%%.@
.....%%.@
.....%%.@
.%%..%%.@
..%%%%..@
........@@
.%%..%%.@
.%%.%%..@
.%%%%...@
.%%.%%..@
.%%..%%.@
........@@
.%%.....@
.%%.....@
.%%.....@
.%%.....@
.%%%%%%.@
........@@
.%%...%%.@
.%%%.%%%.@
.%%.%.%%.@
.%%...%%.@
.%%...%%.@
.........@@
.%%..%%.@
.%%%.%%.@
.%%.%%%.@
.%%..%%.@
.%%..%%.@
........@@
..%%%%..@
.%%..%%.@
.%%..%%.@
.%%..%%.@
..%%%%..@
........@@
.%%%%%..@
.%%..%%.@
.%%%%%..@
.%%.....@
.%%.....@
........@@
..%%%%..@
.%%..%%.@
.%%.%%%.@
.%%..%%.@
..%%%%%.@
........@@
.%%%%%..@
.%%..%%.@
.%%%%%..@
.%%..%%.@
.%%..%%.@
........@@
..%%%%..@
.%%.....@
..%%%%..@
.....%%.@
..%%%%..@
........@@
.%%%%%%.@
...%%...@
...%%...@
...%%...@
...%%...@
........@@
.%%..%%.@
.%%..%%.@
.%%..%%.@
.%%..%%.@
..%%%%..@
........@@
.%%..%%.@
.%%..%%.@
.%%..%%.@
..%%%%..@
...%%...@
........@@
.%%...%%.@
.%%...%%.@
.%%.%.%%.@
.%%%%%%%.@
..%%.%%..@
.........@@
.%%..%%.@
..%%%%..@
...%%...@
..%%%%..@
.%%..%%.@
........@@
.%%..%%.@
..%%%%..@
...%%...@
...%%...@
...%%...@
........@@
.%%%%%%.@
....%%..@
...%%...@
..%%....@
.%%%%%%.@
........@@
.%%%%%%.@
.%%.....@
.%%.....@
.%%.....@
.%%%%%%.@
........@@
.%%.....@
..%%....@
...%%...@
....%%..@
.....%%.@
........@@
.%%%%%%.@
.....%%.@
.....%%.@
.....%%.@
.%%%%%%.@
........@@
...%%...@
..%%%%..@
.%%..%%.@
........@
........@
........@@
........@
........@
........@
........@
.%%%%%%.@
........@@
...%%...@
...%%...@
...%....@
........@
........@
........@@
..%%%%..@
.%%..%%.@
.%%%%%%.@
.%%..%%.@
.%%..%%.@
........@@
.%%%%%..@
.%%..%%.@
.%%%%%..@
.%%..%%.@
.%%%%%..@
........@@
..%%%%..@
.%%..%%.@
.%%.....@
.%%..%%.@
..%%%%..@
........@@
.%%%%%..@
.%%..%%.@
.%%..%%.@
.%%..%%.@
.%%%%%..@
........@@
.%%%%%%.@
.%%.....@
.%%%%...@
.%%.....@
.%%%%%%.@
........@@
.%%%%%%.@
.%%.....@
.%%%%...@
.%%.....@
.%%.....@
........@@
..%%%%..@
.%%.....@
.%%.%%%.@
.%%..%%.@
..%%%%..@
........@@
.%%..%%.@
.%%..%%.@
.%%%%%%.@
.%%..%%.@
.%%..%%.@
........@@
.%%%%%%.@
...%%...@
...%%...@
...%%...@
.%%%%%%.@
........@@
.%%%%%%.@
.....%%.@
.....%%.@
.%%..%%.@
..%%%%..@
........@@
.%%..%%.@
.%%.%%..@
.%%%%...@
.%%.%%..@
.%%..%%.@
........@@
.%%.....@
.%%.....@
.%%.....@
.%%.....@
.%%%%%%.@
........@@
.%%...%%.@
.%%%.%%%.@
.%%.%.%%.@
.%%...%%.@
.%%...%%.@
.........@@
.%%..%%.@
.%%%.%%.@
.%%.%%%.@
.%%..%%.@
.%%..%%.@
........@@
..%%%%..@
.%%..%%.@
.%%..%%.@
.%%..%%.@
..%%%%..@
........@@
.%%%%%..@
.%%..%%.@
.%%%%%..@
.%%.....@
.%%.....@
........@@
..%%%%..@
.%%..%%.@
.%%.%%%.@
.%%..%%.@
..%%%%%.@
........@@
.%%%%%..@
.%%..%%.@
.%%%%%..@
.%%..%%.@
.%%..%%.@
........@@
..%%%%..@
.%%.....@
..%%%%..@
.....%%.@
..%%%%..@
........@@
.%%%%%%.@
...%%...@
...%%...@
...%%...@
...%%...@
........@@
.%%..%%.@
.%%..%%.@
.%%..%%.@
.%%..%%.@
..%%%%..@
........@@
.%%..%%.@
.%%..%%.@
.%%..%%.@
..%%%%..@
...%%...@
........@@
.%%...%%.@
.%%...%%.@
.%%.%.%%.@
.%%%%%%%.@
..%%.%%..@
.........@@
.%%..%%.@
..%%%%..@
...%%...@
..%%%%..@
.%%..%%.@
........@@
.%%..%%.@
..%%%%..@
...%%...@
...%%...@
...%%...@
........@@
.%%%%%%.@
....%%..@
...%%...@
..%%....@
.%%%%%%.@
........@@
...%%%%.@
...%%...@
.%%%....@
...%%...@
...%%%%.@
........@@
...%%...@
...%%...@
...%%...@
...%%...@
...%%...@
...%%...@@
.%%%%...@
...%%...@
....%%%.@
...%%...@
.%%%%...@
........@@
..%%%.%.@
.%.%%%..@
........@
........@
........@
........@@
.%%..%%.@
........@
..%%%%%.@
.%%..%%.@
..%%%%%.@
........@@
.%%..%%.@
........@
..%%%%..@
.%%..%%.@
..%%%%..@
........@@
.%%..%%.@
........@
.%%..%%.@
.%%..%%.@
..%%%%..@
........@@
.%%..%%.@
........@
..%%%%%.@
.%%..%%.@
..%%%%%.@
........@@
.%%..%%.@
........@
..%%%%..@
.%%..%%.@
..%%%%..@
........@@
.%%..%%.@
........@
.%%..%%.@
.%%..%%.@
..%%%%..@
........@@
..%%%%%..@
.%%...%%.@
.%%.%%%..@
.%%...%%.@
.%%.%%%..@
.%%......@@
`
@@ -0,0 +1,23 @@
# cookie-signature
Sign and unsign cookies.
## Example
```js
var cookie = require('cookie-signature');
var val = cookie.sign('hello', 'tobiiscool');
val.should.equal('hello.DGDUkGlIkCzPz+C0B064FNgHdEjox7ch8tOBGslZ5QI');
var val = cookie.sign('hello', 'tobiiscool');
cookie.unsign(val, 'tobiiscool').should.equal('hello');
cookie.unsign(val, 'luna').should.be.false;
```
## License
MIT.
See LICENSE file for details.
@@ -0,0 +1,87 @@
import type { NodeWithParent, TSESTree } from '@typescript-eslint/types';
import type { Scope } from '../scope';
import type { Variable } from '../variable';
export declare enum ReferenceFlag {
Read = 1,
Write = 2,
ReadWrite = 3
}
export interface ReferenceImplicitGlobal {
node: NodeWithParent;
pattern: TSESTree.BindingName;
ref?: Reference;
}
export declare enum ReferenceTypeFlag {
Value = 1,
Type = 2
}
/**
* A Reference represents a single occurrence of an identifier in code.
*/
export declare class Reference {
#private;
/**
* A unique ID for this instance - primarily used to help debugging and testing
*/
readonly $id: number;
/**
* Reference to the enclosing Scope.
* @public
*/
readonly from: Scope;
/**
* Identifier syntax node.
* @public
*/
readonly identifier: TSESTree.Identifier | TSESTree.JSXIdentifier;
/**
* `true` if this writing reference is a variable initializer or a default value.
* @public
*/
readonly init?: boolean;
readonly maybeImplicitGlobal?: ReferenceImplicitGlobal | null;
/**
* The {@link Variable} object that this reference refers to. If such variable was not defined, this is `null`.
* @public
*/
resolved: Variable | null;
/**
* If reference is writeable, this is the node being written to it.
* @public
*/
readonly writeExpr?: TSESTree.Node | null;
constructor(identifier: TSESTree.Identifier | TSESTree.JSXIdentifier, scope: Scope, flag: ReferenceFlag, writeExpr?: TSESTree.Node | null, maybeImplicitGlobal?: ReferenceImplicitGlobal | null, init?: boolean, referenceType?: ReferenceTypeFlag);
/**
* True if this reference can reference types
*/
get isTypeReference(): boolean;
/**
* True if this reference can reference values
*/
get isValueReference(): boolean;
/**
* Whether the reference is writeable.
* @public
*/
isWrite(): boolean;
/**
* Whether the reference is readable.
* @public
*/
isRead(): boolean;
/**
* Whether the reference is read-only.
* @public
*/
isReadOnly(): boolean;
/**
* Whether the reference is write-only.
* @public
*/
isWriteOnly(): boolean;
/**
* Whether the reference is read-write.
* @public
*/
isReadWrite(): boolean;
}
@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: [ljharb]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: npm/math-intrinsics
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with a single custom sponsorship URL
@@ -0,0 +1,111 @@
import { f as createRule, g as import_ast_utils } from "../utils.js";
var computed_property_spacing_default = createRule({
name: "computed-property-spacing",
meta: {
type: "layout",
docs: { description: "Enforce consistent spacing inside computed property brackets" },
fixable: "whitespace",
schema: [{
type: "string",
enum: ["always", "never"]
}, {
type: "object",
properties: { enforceForClassMembers: { type: "boolean" } },
additionalProperties: false
}],
defaultOptions: ["never", { enforceForClassMembers: true }],
messages: {
unexpectedSpaceBefore: "There should be no space before '{{tokenValue}}'.",
unexpectedSpaceAfter: "There should be no space after '{{tokenValue}}'.",
missingSpaceBefore: "A space is required before '{{tokenValue}}'.",
missingSpaceAfter: "A space is required after '{{tokenValue}}'."
}
},
create(context, [style, options]) {
const sourceCode = context.sourceCode;
const propertyNameMustBeSpaced = style === "always";
const { enforceForClassMembers } = options;
function reportNoBeginningSpace(node, token, tokenAfter) {
context.report({
node,
loc: {
start: token.loc.end,
end: tokenAfter.loc.start
},
messageId: "unexpectedSpaceAfter",
data: { tokenValue: token.value },
fix(fixer) {
return fixer.removeRange([token.range[1], tokenAfter.range[0]]);
}
});
}
function reportNoEndingSpace(node, token, tokenBefore) {
context.report({
node,
loc: {
start: tokenBefore.loc.end,
end: token.loc.start
},
messageId: "unexpectedSpaceBefore",
data: { tokenValue: token.value },
fix(fixer) {
return fixer.removeRange([tokenBefore.range[1], token.range[0]]);
}
});
}
function reportRequiredBeginningSpace(node, token) {
context.report({
node,
loc: token.loc,
messageId: "missingSpaceAfter",
data: { tokenValue: token.value },
fix(fixer) {
return fixer.insertTextAfter(token, " ");
}
});
}
function reportRequiredEndingSpace(node, token) {
context.report({
node,
loc: token.loc,
messageId: "missingSpaceBefore",
data: { tokenValue: token.value },
fix(fixer) {
return fixer.insertTextBefore(token, " ");
}
});
}
function checkSpacing(propertyName) {
return function(node) {
if (node.type !== "TSIndexedAccessType" && !node.computed) return;
const property = node[propertyName];
const before = sourceCode.getTokenBefore(property, import_ast_utils.isOpeningBracketToken);
const first = sourceCode.getTokenAfter(before, { includeComments: true });
const after = sourceCode.getTokenAfter(property, import_ast_utils.isClosingBracketToken);
const last = sourceCode.getTokenBefore(after, { includeComments: true });
if ((0, import_ast_utils.isTokenOnSameLine)(before, first)) {
if (propertyNameMustBeSpaced) {
if (!sourceCode.isSpaceBetween(before, first) && (0, import_ast_utils.isTokenOnSameLine)(before, first)) reportRequiredBeginningSpace(node, before);
} else if (sourceCode.isSpaceBetween(before, first)) reportNoBeginningSpace(node, before, first);
}
if ((0, import_ast_utils.isTokenOnSameLine)(last, after)) {
if (propertyNameMustBeSpaced) {
if (!sourceCode.isSpaceBetween(last, after) && (0, import_ast_utils.isTokenOnSameLine)(last, after)) reportRequiredEndingSpace(node, after);
} else if (sourceCode.isSpaceBetween(last, after)) reportNoEndingSpace(node, after, last);
}
};
}
const listeners = {
Property: checkSpacing("key"),
MemberExpression: checkSpacing("property"),
TSIndexedAccessType: checkSpacing("indexType")
};
if (enforceForClassMembers) {
listeners.MethodDefinition = checkSpacing("key");
listeners.PropertyDefinition = checkSpacing("key");
listeners.AccessorProperty = checkSpacing("key");
}
return listeners;
}
});
export { computed_property_spacing_default as t };
@@ -0,0 +1 @@
{"version":3,"file":"index.cjs","names":["brandedHasInstance","recordedIssuer: string","currentIssuer: string","brandedHasInstance","OAuthError","url: URL","OAuthErrorResponseSchema","OAuthErrorCode","resourceMetadata: OAuthProtectedResourceMetadata | undefined","authorizationServerUrl: string | URL","metadata: AuthorizationServerMetadata | undefined","freshDiscoveryState: OAuthDiscoveryState | undefined","infoCtx: OAuthClientInformationContext","resource: string | URL | undefined","tokens","newTokens: OAuthTokens | undefined","resourceUrlFromServerUrl","checkResourceAllowed","resourceMetadataUrl: URL | undefined","OAuthProtectedResourceMetadataSchema","fetchWithinOrigin","CORS_IS_POSSIBLE","LATEST_PROTOCOL_VERSION","OAuthMetadataSchema","urlsToTry: { url: URL; type: 'oauth' | 'oidc' }[]","OpenIdProviderDiscoveryMetadataSchema","authorizationServerUrl: string | undefined","authorizationUrl: URL","json: unknown","OAuthTokensSchema","withoutIssuer","tokenRequestParams: URLSearchParams | undefined","registrationUrl: URL","submittedMetadata: OAuthClientMetadata","OAuthClientInformationFullSchema","key: unknown","CAP_EXEMPT_METHODS: ReadonlySet<string>","_store: ResponseCacheStore","_isUserSupplied: boolean","_reportError: (error: unknown) => void","_cachePartition: string","_now: () => number","parsed: unknown","json: string | undefined","SdkError","SdkErrorCode","codecForVersion","MODERN_WIRE_REVISION","UnsupportedProtocolVersionError","modernProtocolVersions","SdkHttpError","parsed: unknown","DEFAULT_VERSION_NEGOTIATION_MODE: VersionNegotiationMode","isModernProtocolVersion","modernProtocolVersions","SUPPORTED_MODERN_PROTOCOL_VERSIONS","legacyProtocolVersions","_transport: Transport","isJSONRPCResultResponse","isJSONRPCErrorResponse","codecForVersion","SdkError","SdkErrorCode","SdkHttpError","verdict: ProbeVerdict","result: NegotiationResult","signalClosed: (() => void) | undefined","SERVER_INFO_META_KEY","isSpecType","DiscoverResultSchema","SdkError","SdkErrorCode","LIST_CHANGED_EVICTIONS: Readonly<Record<string, readonly string[]>>","Protocol","_clientInfo: Implementation","DefaultJsonSchemaValidator","resolveInputRequiredDriverConfig","isModernProtocolVersion","isJSONRPCRequest","runInputRequiredFlow","mergeCapabilities","codecForVersion","ProtocolError","ProtocolErrorCode","legacyProtocolVersions","result: Awaited<ReturnType<typeof negotiateEra>>","DEFAULT_REQUEST_TIMEOUT_MSEC","effective: ListChangedHandlers","filter: SubscriptionFilter","modernProtocolVersions","SUPPORTED_MODERN_PROTOCOL_VERSIONS","scope: CacheScope","scanXMcpHeaderDeclarations","state: 'opening' | 'open' | 'closed'","ackTimer: ReturnType<typeof setTimeout> | undefined","onCallerAbort: (() => void) | undefined","resolveOpening!: (honored: SubscriptionFilter) => void","rejectOpening!: (error: Error) => void","resolveClosed!: (cause: 'local' | 'graceful' | 'remote') => void","jsonrpcRequest: JSONRPCRequest","SUBSCRIPTION_ID_META_KEY","isJSONRPCErrorResponse","scan: XMcpHeaderScanResult | undefined","buildMcpParamHeaders","result: CallToolResult","HEADER_MISMATCH_ERROR_CODE","parseSchema","ListChangedOptionsBaseSchema","fetchWithinOrigin","parseResult","OAuthErrorResponseSchema","IdJagTokenExchangeResponseSchema","OAuthTokensSchema","withoutIssuer","DEFAULT_DPOP_ALG: DpopAlg","keyPair: DpopKeyPair","payload: Record<string, unknown>","defaultLogger: RequestLogger","brandedHasInstance","code: number | undefined","event: ErrorEvent","createFetchWithInit","fetchLeavingRedirects","fetchWithinOrigin","unfollowedRedirect","token: string | undefined","redirect: string | undefined","EventSource","error","SdkHttpError","SdkErrorCode","message: JSONRPCMessage","JSONRPCMessageSchema","SdkError","DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS: StreamableHTTPReconnectionOptions","RESERVED_REQUEST_HEADER_NAMES: ReadonlySet<string>","createFetchWithInit","fetchLeavingRedirects","SdkHttpError","SdkErrorCode","fetchWithinOrigin","unfollowedRedirect","token: string | undefined","isJSONRPCRequest","PROTOCOL_VERSION_META_KEY","mcpNameSource","encodeMcpParamValue","isModernProtocolVersion","lastEventId: string | undefined","EventSourceParserStream","JSONRPCMessageSchema","isJSONRPCResultResponse","isJSONRPCErrorResponse","error","isInitializeRequest","isInitializedNotification","mediaTypeEssence","SdkError","_defaultValidator: jsonSchemaValidator | undefined","coreFromJsonSchema","DefaultJsonSchemaValidator"],"sources":["../src/client/authErrors.ts","../src/client/auth.ts","../src/client/authExtensions.ts","../src/client/responseCache.ts","../src/client/authSeam.ts","../src/client/probeClassifier.ts","../src/client/versionNegotiation.ts","../src/client/client.ts","../src/client/crossAppAccess.ts","../src/client/dpop.ts","../src/client/middleware.ts","../src/client/sse.ts","../src/client/streamableHttp.ts","../src/fromJsonSchema.ts"],"sourcesContent":["/**\n * Error classes thrown by the OAuth client flow ({@linkcode auth} and helpers).\n *\n * Each behavior chanLine truncated
@@ -0,0 +1 @@
{"version":3,"file":"toolWithSampleServer.js","sourceRoot":"","sources":["../../../../src/examples/server/toolWithSampleServer.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAEhE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC;IAC5B,IAAI,EAAE,0BAA0B;IAChC,OAAO,EAAE,OAAO;CACnB,CAAC,CAAC;AAEH,oDAAoD;AACpD,SAAS,CAAC,YAAY,CAClB,WAAW,EACX;IACI,WAAW,EAAE,iCAAiC;IAC9C,WAAW,EAAE;QACT,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC;KACjD;CACJ,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;IACf,oCAAoC;IACpC,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC;QAClD,QAAQ,EAAE;YACN;gBACI,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACL,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,qDAAqD,IAAI,EAAE;iBACpE;aACJ;SACJ;QACD,SAAS,EAAE,GAAG;KACjB,CAAC,CAAC;IAEH,2FAA2F;IAC3F,OAAO;QACH,OAAO,EAAE;YACL;gBACI,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,4BAA4B;aAChG;SACJ;KACJ,CAAC;AACN,CAAC,CACJ,CAAC;AAEF,KAAK,UAAU,IAAI;IACf,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACnC,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;AAC5C,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;IACjB,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,60 @@
import { interpolate, defaultOffset } from 'motion-dom';
import { clamp } from 'motion-utils';
import { calcInset } from './inset.mjs';
import { resolveOffset } from './offset.mjs';
import { ScrollOffset } from './presets.mjs';
const point = { x: 0, y: 0 };
function getTargetSize(target) {
return "getBBox" in target && target.tagName !== "svg"
? target.getBBox()
: { width: target.clientWidth, height: target.clientHeight };
}
function resolveOffsets(container, info, options) {
const { offset: offsetDefinition = ScrollOffset.All } = options;
const { target = container, axis = "y" } = options;
const lengthLabel = axis === "y" ? "height" : "width";
const inset = target !== container ? calcInset(target, container) : point;
/**
* Measure the target and container. If they're the same thing then we
* use the container's scrollWidth/Height as the target, from there
* all other calculations can remain the same.
*/
const targetSize = target === container
? { width: container.scrollWidth, height: container.scrollHeight }
: getTargetSize(target);
const containerSize = {
width: container.clientWidth,
height: container.clientHeight,
};
/**
* Reset the length of the resolved offset array rather than creating a new one.
* TODO: More reusable data structures for targetSize/containerSize would also be good.
*/
info[axis].offset.length = 0;
/**
* Populate the offset array by resolving the user's offset definition into
* a list of pixel scroll offets.
*/
let hasChanged = !info[axis].interpolate;
const numOffsets = offsetDefinition.length;
for (let i = 0; i < numOffsets; i++) {
const offset = resolveOffset(offsetDefinition[i], containerSize[lengthLabel], targetSize[lengthLabel], inset[axis]);
if (!hasChanged && offset !== info[axis].interpolatorOffsets[i]) {
hasChanged = true;
}
info[axis].offset[i] = offset;
}
/**
* If the pixel scroll offsets have changed, create a new interpolator function
* to map scroll value into a progress.
*/
if (hasChanged) {
info[axis].interpolate = interpolate(info[axis].offset, defaultOffset(offsetDefinition), { clamp: false });
info[axis].interpolatorOffsets = [...info[axis].offset];
}
info[axis].progress = clamp(0, 1, info[axis].interpolate(info[axis].current));
}
export { resolveOffsets };
//# sourceMappingURL=index.mjs.map
@@ -0,0 +1,33 @@
{
"name": "once",
"version": "1.4.0",
"description": "Run a function exactly one time",
"main": "once.js",
"directories": {
"test": "test"
},
"dependencies": {
"wrappy": "1"
},
"devDependencies": {
"tap": "^7.0.1"
},
"scripts": {
"test": "tap test/*.js"
},
"files": [
"once.js"
],
"repository": {
"type": "git",
"url": "git://github.com/isaacs/once"
},
"keywords": [
"once",
"function",
"one",
"single"
],
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
"license": "ISC"
}
@@ -0,0 +1,45 @@
/**
* @fileoverview disallow using an async function as a Promise executor
* @author Teddy Katz
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "problem",
docs: {
description:
"Disallow using an async function as a Promise executor",
recommended: true,
url: "https://eslint.org/docs/latest/rules/no-async-promise-executor",
},
fixable: null,
schema: [],
messages: {
async: "Promise executor functions should not be async.",
},
},
create(context) {
return {
"NewExpression[callee.name='Promise'][arguments.0.async=true]"(
node,
) {
context.report({
node: context.sourceCode.getFirstToken(
node.arguments[0],
token => token.value === "async",
),
messageId: "async",
});
},
};
},
};
@@ -0,0 +1,15 @@
import { DateInput } from './types';
/**
* Calculates the difference in days between two dates.
* 计算两个日期之间的天数差
*
* @param date - The first date to compare. (第一个日期)
* @param input - The second date to compare. (第二个日期)
* @param asFloat - Whether to return the result as a float. (是否返回浮点数)
* @returns The difference in days between the two dates. (返回两个日期之间的天数差)
* @example
* ```ts
* diffInDays(new Date(2023, 0, 1), new Date(2023, 0, 2)) // 1
* ```
*/
export default function diffInDays(date: Date, input: DateInput, asFloat?: boolean): number;