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,3 @@
export declare const GLOBAL_TSR = "$_TSR";
export declare const GLOBAL_SEROVAL: '$R';
export declare const TSR_SCRIPT_BARRIER_ID = "$tsr-stream-barrier";
@@ -0,0 +1 @@
{"version":3,"file":"briefcase-medical.js","sources":["../../../src/icons/briefcase-medical.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name BriefcaseMedical\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTIgMTF2NCIgLz4KICA8cGF0aCBkPSJNMTQgMTNoLTQiIC8+CiAgPHBhdGggZD0iTTE2IDZWNGEyIDIgMCAwIDAtMi0yaC00YTIgMiAwIDAgMC0yIDJ2MiIgLz4KICA8cGF0aCBkPSJNMTggNnYxNCIgLz4KICA8cGF0aCBkPSJNNiA2djE0IiAvPgogIDxyZWN0IHdpZHRoPSIyMCIgaGVpZ2h0PSIxNCIgeD0iMiIgeT0iNiIgcng9IjIiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/briefcase-medical\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 BriefcaseMedical = createLucideIcon('BriefcaseMedical', [\n ['path', { d: 'M12 11v4', key: 'a6ujw6' }],\n ['path', { d: 'M14 13h-4', key: '1pl8zg' }],\n ['path', { d: 'M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2', key: '1ksdt3' }],\n ['path', { d: 'M18 6v14', key: '1mu4gy' }],\n ['path', { d: 'M6 6v14', key: '1s15cj' }],\n ['rect', { width: '20', height: '14', x: '2', y: '6', rx: '2', key: 'i6l2r4' }],\n]);\n\nexport default BriefcaseMedical;\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,CAAmB,iBAAiB,kBAAoB,CAAA,CAAA,CAAA;AAAA,CAAA,CAC5D,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,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,CAA4C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzE,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,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;AAChF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,154 @@
{
"name": "undici",
"version": "8.12.2",
"description": "An HTTP/1.1 client, written from scratch for Node.js",
"homepage": "https://undici.nodejs.org",
"bugs": {
"url": "https://github.com/nodejs/undici/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/nodejs/undici.git"
},
"license": "MIT",
"contributors": [
{
"name": "Daniele Belardi",
"url": "https://github.com/dnlup",
"author": true
},
{
"name": "Ethan Arrowood",
"url": "https://github.com/ethan-arrowood",
"author": true
},
{
"name": "Matteo Collina",
"url": "https://github.com/mcollina",
"author": true
},
{
"name": "Matthew Aitken",
"url": "https://github.com/KhafraDev",
"author": true
},
{
"name": "Robert Nagy",
"url": "https://github.com/ronag",
"author": true
},
{
"name": "Szymon Marczak",
"url": "https://github.com/szmarczak",
"author": true
},
{
"name": "Tomas Della Vedova",
"url": "https://github.com/delvedor",
"author": true
}
],
"keywords": [
"fetch",
"http",
"https",
"promise",
"request",
"curl",
"wget",
"xhr",
"whatwg"
],
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"build:node": "esbuild index-fetch.js --bundle --platform=node --outfile=undici-fetch.js --define:esbuildDetection=1 --keep-names && node scripts/strip-comments.js",
"build:milo": "node build/milo.js",
"build:llhttp": "node build/llhttp.js --docker",
"build:wasm": "node build/llhttp.js --docker",
"generate-pem": "node scripts/generate-pem.js",
"lint": "eslint --cache",
"lint:fix": "eslint --fix --cache",
"test": "npm run test:javascript && cross-env NODE_V8_COVERAGE= npm run test:typescript",
"test:javascript": "npm run test:javascript:no-jest && npm run test:jest",
"test:javascript:no-jest": "npm run generate-pem && npm run test:unit && npm run test:fetch && npm run test:node-fetch && npm run test:infra && npm run test:cache && npm run test:cache-interceptor && npm run test:interceptors && npm run test:cookies && npm run test:eventsource && npm run test:subresource-integrity && npm run test:websocket && npm run test:node-test && npm run test:cache-tests",
"test:javascript:without-intl": "npm run test:javascript:no-jest",
"test:busboy": "borp --timeout 180000 -p \"test/busboy/*.js\"",
"test:cache": "borp --timeout 180000 -p \"test/cache/*.js\"",
"test:cache-interceptor": "borp --timeout 180000 -p \"test/cache-interceptor/*.js\"",
"test:cache-interceptor:sqlite": "cross-env NODE_OPTIONS=--experimental-sqlite npm run test:cache-interceptor",
"test:cookies": "borp --timeout 180000 -p \"test/cookie/*.js\"",
"test:eventsource": "npm run build:node && borp --timeout 180000 --expose-gc -p \"test/eventsource/*.js\"",
"test:fuzzing": "node test/fuzzing/fuzzing.test.js",
"test:fetch": "npm run build:node && borp --timeout 180000 --expose-gc --concurrency 1 -p \"test/fetch/*.js\" && npm run test:webidl && npm run test:busboy",
"test:subresource-integrity": "borp --timeout 180000 -p \"test/subresource-integrity/*.js\"",
"test:h2": "npm run test:h2:core && npm run test:h2:fetch",
"test:h2:core": "borp --timeout 180000 -p \"test/+(http2|h2)*.js\"",
"test:h2:fetch": "npm run build:node && borp --timeout 180000 -p \"test/fetch/http2*.js\"",
"test:infra": "borp --timeout 180000 -p \"test/infra/*.js\"",
"test:interceptors": "borp --timeout 180000 -p \"test/interceptors/*.js\"",
"test:jest": "cross-env NODE_V8_COVERAGE= jest",
"test:unit": "borp --timeout 180000 --expose-gc -p \"test/*.js\"",
"test:node-fetch": "borp --timeout 180000 -p \"test/node-fetch/**/*.js\"",
"test:node-test": "borp --timeout 180000 -p \"test/node-test/**/*.js\"",
"test:tdd": "borp --timeout 180000 --expose-gc -p \"test/*.js\"",
"test:tdd:node-test": "borp --timeout 180000 -p \"test/node-test/**/*.js\" -w",
"test:typescript": "tsd && tsc test/imports/undici-import.ts --typeRoots ./types --noEmit && tsc ./types/*.d.ts --noEmit --typeRoots ./types",
"test:webidl": "borp --timeout 180000 -p \"test/webidl/*.js\"",
"test:websocket": "borp --timeout 180000 -p \"test/websocket/**/*.js\"",
"test:websocket:autobahn": "node test/autobahn/client.js",
"test:websocket:autobahn:report": "node test/autobahn/report.js",
"test:wpt:setup": "node test/web-platform-tests/wpt-runner.mjs setup",
"test:wpt": "npm run test:wpt:setup && node test/web-platform-tests/wpt-runner.mjs run /fetch /mimesniff /xhr /websockets /eventsource /service-workers",
"test:cache-tests": "node test/cache-interceptor/cache-tests.mjs --ci",
"coverage": "npm run coverage:clean && cross-env NODE_V8_COVERAGE=./coverage/tmp npm run test:javascript && npm run coverage:report",
"coverage:ci": "npm run coverage:clean && cross-env NODE_V8_COVERAGE=./coverage/tmp npm run test:javascript && npm run coverage:report:ci",
"coverage:clean": "node ./scripts/clean-coverage.js",
"coverage:report": "cross-env NODE_V8_COVERAGE= c8 report",
"coverage:report:ci": "c8 report",
"bench": "echo \"Error: Benchmarks have been moved to '/benchmarks'\" && exit 1",
"serve:website": "echo \"Error: Documentation has been moved to '/docs'\" && exit 1",
"prepare": "husky && node ./scripts/platform-shell.js"
},
"devDependencies": {
"@fastify/busboy": "3.2.3",
"@matteo.collina/tspl": "^0.2.0",
"@metcoder95/https-pem": "^1.0.0",
"@sinonjs/fake-timers": "^12.0.0",
"@types/node": "^22.0.0",
"abort-controller": "^3.0.0",
"borp": "^1.0.0",
"c8": "^12.0.0",
"cross-env": "^10.0.0",
"dns-packet": "^5.4.0",
"esbuild": "^0.28.0",
"eslint": "^9.9.0",
"fast-check": "^4.1.1",
"husky": "^9.0.7",
"jest": "^30.0.5",
"jsondiffpatch": "^0.7.3",
"neostandard": "^0.13.0",
"node-forge": "^1.3.1",
"proxy": "^4.0.0",
"tsd": "^0.33.0",
"typescript": "^6.0.2",
"ws": "^8.11.0"
},
"engines": {
"node": ">=22.19.0"
},
"tsd": {
"directory": "test/types",
"compilerOptions": {
"esModuleInterop": true,
"lib": [
"esnext"
]
}
},
"jest": {
"testMatch": [
"<rootDir>/test/jest/**"
]
}
}
@@ -0,0 +1,53 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const util_1 = require("../util");
// tslint regex
// https://github.com/palantir/tslint/blob/95d9d958833fd9dc0002d18cbe34db20d0fbf437/src/enableDisableRules.ts#L32
const ENABLE_DISABLE_REGEX = /^\s*tslint:(enable|disable)(?:-(line|next-line))?(:|\s|$)/;
const toText = (text, type) => type === utils_1.AST_TOKEN_TYPES.Line
? ['//', text.trim()].join(' ')
: ['/*', text.trim(), '*/'].join(' ');
exports.default = (0, util_1.createRule)({
name: 'ban-tslint-comment',
meta: {
type: 'suggestion',
docs: {
description: 'Disallow `// tslint:<rule-flag>` comments',
recommended: 'stylistic',
},
fixable: 'code',
messages: {
commentDetected: 'tslint comment detected: "{{ text }}"',
},
schema: [],
},
defaultOptions: [],
create: context => {
return {
Program() {
const comments = context.sourceCode.getAllComments();
comments.forEach(c => {
if (ENABLE_DISABLE_REGEX.test(c.value)) {
context.report({
node: c,
messageId: 'commentDetected',
data: { text: toText(c.value, c.type) },
fix(fixer) {
const rangeStart = context.sourceCode.getIndexFromLoc({
column: c.loc.start.column > 0 ? c.loc.start.column - 1 : 0,
line: c.loc.start.line,
});
const rangeEnd = context.sourceCode.getIndexFromLoc({
column: c.loc.end.column,
line: c.loc.end.line,
});
return fixer.removeRange([rangeStart, rangeEnd + 1]);
},
});
}
});
},
};
},
});
@@ -0,0 +1,2 @@
import type { LibDefinition } from '../variable';
export declare const es2015_iterable: LibDefinition;
@@ -0,0 +1,424 @@
flf2a? 4 3 9 0 12 0 64 0
Name : Heart Left
Author : LG Beard
Date : 2004/1/15 15:41:27
Version: 1.0
-------------------------------------------------
-------------------------------------------------
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.

.-.-. 
'._.' 

.-.-. 
( ! .' 
`.( 

.-.-. 
( " .' 
'.( 

.-.-. 
( # .' 
'.( 

.-.-. 
( $ .' 
'.( 

.-.-. 
( % .' 
'.( 

.-.-. 
( & .' 
'.( 

.-.-. 
( ' .' 
'.( 

.-.-. 
( ( .' 
'.( 

.-.-. 
( ) .' 
'.( 

.-.-. 
( * .' 
'.( 

.-.-. 
( + .' 
'.( 

.-.-. 
( , .' 
'.( 

.-.-. 
( - .' 
'.( 

.-.-. 
( . .' 
'.( 

.-.-. 
( / .' 
'.( 

.-.-. 
( 0 .' 
`.( 

.-.-. 
( 1 .' 
`.( 

.-.-. 
( 2 .' 
`.( 

.-.-. 
( 3 .' 
`.( 

.-.-. 
( 4 .' 
`.( 

.-.-. 
( 5 .' 
`.( 

.-.-. 
( 6 .' 
`.( 

.-.-. 
( 7 .' 
`.( 

.-.-. 
( 8 .' 
`.( 

.-.-. 
( 9 .' 
`.( 

.-.-. 
( : .' 
'.( 

.-.-. 
( ; .' 
'.( 

.-.-. 
( < .' 
'.( 

.-.-. 
( = .' 
'.( 

.-.-. 
( > .' 
'.( 

.-.-. 
( ? .' 
`.( 

.-.-. 
( @ .' 
`.( 

.-.-. 
( A .' 
`.( 

.-.-. 
( B .' 
`.( 

.-.-. 
( C .' 
`.( 

.-.-. 
( D .' 
`.( 

.-.-. 
( E .' 
`.( 

.-.-. 
( F .' 
`.( 

.-.-. 
( G .' 
`.( 

.-.-. 
( H .' 
`.( 

.-.-. 
( I .' 
`.( 

.-.-. 
( J .' 
`.( 

.-.-. 
( K .' 
`.( 

.-.-. 
( L .' 
`.( 

.-.-. 
( M .' 
`.( 

.-.-. 
( N .' 
`.( 

.-.-. 
( O .' 
`.( 

.-.-. 
( P .' 
`.( 

.-.-. 
( Q .' 
`.( 

.-.-. 
( R .' 
`.( 

.-.-. 
( S .' 
`.( 

.-.-. 
( T .' 
`.( 

.-.-. 
( U .' 
`.( 

.-.-. 
( V .' 
`.( 

.-.-. 
( W .' 
`.( 

.-.-. 
( X .' 
`.( 

.-.-. 
( Y .' 
`.( 

.-.-. 
( Z .' 
`.( 

.-.-. 
( [ .' 
'.( 

.-.-. 
( \ .' 
'.( 

.-.-. 
( ] .' 
'.( 

.-.-. 
( ^ .' 
'.( 

.-.-. 
( _ .' 
'.( 

.-.-. 
( ` .' 
'.( 

.-.-. 
( a .' 
`.( 

.-.-. 
( b .' 
`.( 

.-.-. 
( c .' 
`.( 

.-.-. 
( d .' 
`.( 

.-.-. 
( e .' 
`.( 

.-.-. 
( f .' 
`.( 

.-.-. 
( g .' 
`.( 

.-.-. 
( h .' 
`.( 

.-.-. 
( i .' 
`.( 

.-.-. 
( j .' 
`.( 

.-.-. 
( k .' 
`.( 

.-.-. 
( l .' 
`.( 

.-.-. 
( m .' 
`.( 

.-.-. 
( n .' 
`.( 

.-.-. 
( o .' 
`.( 

.-.-. 
( p .' 
`.( 

.-.-. 
( q .' 
`.( 

.-.-. 
( r .' 
`.( 

.-.-. 
( s .' 
`.( 

.-.-. 
( t .' 
`.( 

.-.-. 
( u .' 
`.( 

.-.-. 
( v .' 
`.( 

.-.-. 
( w .' 
`.( 

.-.-. 
( x .' 
`.( 

.-.-. 
( y .' 
`.( 

.-.-. 
( z .' 
`.( 

.-.-. 
( { .' 
'.( 

.-.-. 
( | .' 
'.( 

.-.-. 
( } .' 
'.( 

.-.-. 
( ~ .' 
'.( 

.-.-. 
( A .' 
`.( 

.-.-. 
( O .' 
`.( 

.-.-. 
( U .' 
`.( 

.-.-. 
( a .' 
`.( 

.-.-. 
( o .' 
`.( 

.-.-. 
( u .' 
`.( 


.-.-. 
'._.' 

@@ -0,0 +1,15 @@
ISC License
Copyright (c) 2021-2024 Oleksii Raspopov, Kostiantyn Denysov, Anton Verinov
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1 @@
module.exports={C:{"52":0.00217,"95":0.00217,"113":0.00217,"115":0.08877,"120":0.09093,"121":0.18186,"123":0.00217,"124":0.00433,"125":0.00217,"127":0.00217,"136":0.01083,"140":0.01949,"141":0.00217,"143":0.00217,"144":0.00217,"145":0.00217,"146":0.00217,"147":0.01083,"148":0.00217,"149":0.00433,"150":0.00433,"151":0.00433,"152":0.01083,"153":0.02598,"154":0.07145,"155":0.20784,"156":0.23166,"157":0.00866,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 114 116 117 118 119 122 126 128 129 130 131 132 133 134 135 137 138 139 142 158 159 160 3.5 3.6"},D:{"68":0.00217,"69":0.00217,"70":0.00217,"71":0.00217,"73":0.00217,"74":0.00217,"79":0.00217,"81":0.00217,"83":0.00217,"86":0.00217,"87":0.00217,"92":0.00217,"93":0.00217,"95":0.00217,"99":0.00217,"101":0.00433,"102":0.00217,"103":0.01949,"104":0.01083,"105":0.01083,"106":0.01083,"107":0.01083,"108":0.01299,"109":0.77291,"110":0.01083,"111":0.01299,"112":0.01516,"113":0.00217,"114":0.00217,"116":0.03031,"117":0.01299,"118":0.14073,"119":0.18403,"120":0.21867,"121":0.0065,"122":0.00866,"123":0.01083,"124":0.02598,"125":0.01083,"126":0.01083,"127":0.0065,"128":0.01083,"129":0.00433,"130":0.0065,"131":0.0433,"132":0.0065,"133":0.05846,"134":0.0433,"135":0.04114,"136":0.06712,"137":0.05196,"138":0.08877,"139":0.05413,"140":0.06928,"141":0.05196,"142":0.14506,"143":0.03248,"144":0.03031,"145":0.02815,"146":0.05629,"147":0.04114,"148":0.08011,"149":0.09526,"150":0.25331,"151":1.11498,"152":5.44065,"153":5.0228,"154":1.29467,"155":0.02598,"156":0.00217,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 72 75 76 77 78 80 84 85 88 89 90 91 94 96 97 98 100 115 157"},F:{"95":0.0065,"100":0.00866,"101":0.02382,"102":0.00433,"105":0.00217,"106":0.00217,"107":0.00217,"133":0.00217,"134":0.0433,"135":0.23815,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 96 97 98 99 103 104 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 131 132 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"18":0.00217,"92":0.0065,"101":0.00217,"109":0.00433,"114":0.01299,"119":0.08877,"120":0.09093,"122":0.00433,"124":0.00217,"131":0.00217,"132":0.00217,"135":0.00217,"138":0.00217,"139":0.00217,"140":0.00433,"141":0.00217,"142":0.00433,"143":0.0065,"144":0.00433,"145":0.00433,"146":0.00433,"147":0.0065,"148":0.0065,"149":0.01083,"150":0.02382,"151":0.06712,"152":0.59971,"153":0.65167,"154":0.19269,_:"12 13 14 15 16 17 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 100 102 103 104 105 106 107 108 110 111 112 113 115 116 117 118 121 123 125 126 127 128 129 130 133 134 136 137"},E:{"27":0.03248,_:"4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 13.1 14.1 15.1 15.4 15.5 16.0 16.1 16.2 16.3 16.4 16.5 17.0 18.0 18.4 27.1 TP","15.2-15.3":0.00217,"15.6":0.0065,"16.6":0.00866,"17.1":0.00433,"17.2":0.00217,"17.3":0.00217,"17.4":0.00217,"17.5":0.00217,"17.6":0.01083,"18.1":0.00217,"18.2":0.00217,"18.3":0.00433,"18.5-18.7":0.0065,"26.0":0.00217,"26.1":0.00217,"26.2":0.0065,"26.3":0.00866,"26.4":0.0065,"26.5":0.0433,"26.6":0.11258,"27.2":0.00217},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00028,"5.0-5.1":0.00028,"6.0-6.1":0,"7.0-7.1":0.00056,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.00278,"11.0-11.2":0.00028,"11.3-11.4":0.00056,"12.0-12.1":0,"12.2-12.5":0.00723,"13.0-13.1":0,"13.2":0.00139,"13.3":0,"13.4-13.7":0.00028,"14.0-14.4":0.00111,"14.5-14.8":0.00167,"15.0-15.1":0.00167,"15.2-15.3":0.00111,"15.4":0.00139,"15.5":0.00167,"15.6-15.8":0.03616,"16.0":0.00278,"16.1":0.00501,"16.2":0.00278,"16.3":0.00612,"16.4":0.00139,"16.5":0.00223,"16.6-16.7":0.05034,"17.0":0.00195,"17.1":0.00278,"17.2":0.00278,"17.3":0.00417,"17.4":0.00584,"17.5":0.0114,"17.6-17.7":0.02948,"18.0":0.00612,"18.1":0.01224,"18.2":0.01669,"18.3":0.02893,"18.4":0.01808,"18.5-18.7":0.37355,"26.0":0.01808,"26.1":0.01836,"26.2":0.04784,"26.3":0.05173,"26.4":0.03783,"26.5":0.25339,"26.6":1.56344,"27.0":0.11988,"27.1":0,"27.2":0.00306},P:{"23":0.00928,"24":0.00928,"26":0.01856,"27":0.00928,"28":0.02784,"29":0.04641,"30":0.46407,_:"4 20 21 22 25 5.0-5.4 6.2-6.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0","7.2-7.4":0.01856},I:{"0":0.01566,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.00001},K:{"0":2.77359,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.00217,_:"6 7 8 9 10 5.5"},S:{"2.5":0.03134,_:"3.0-3.1"},J:{_:"7 10"},N:{_:"1Line truncated
@@ -0,0 +1,390 @@
# Zod to Json Schema
[![NPM Version](https://img.shields.io/npm/v/zod-to-json-schema.svg)](https://npmjs.org/package/zod-to-json-schema)
[![NPM Downloads](https://img.shields.io/npm/dw/zod-to-json-schema.svg)](https://npmjs.org/package/zod-to-json-schema)
## Notice of deprecation
As of November 2025, this project will no longer be actively maintained. [Zod v4 natively supports generating JSON schemas](https://zod.dev/json-schema#ztojsonschema), so I recommend you switch to the new major.
Thank you to all the contributors and sponsors throughout the years! So long, and thanks for all the fish.
## Summary
Does what it says on the tin; converts [Zod schemas](https://github.com/colinhacks/zod) into [JSON schemas](https://json-schema.org/)!
- Supports all relevant schema types, basic string, number and array length validations and string patterns.
- Resolves recursive and recurring schemas with internal `$ref`s.
- Supports targeting legacy Open API 3.0 specification (3.1 supports regular Json Schema).
- Supports Open AI strict mode schemas (Optional object properties are replaced with required but nullable ones).
- As of v3.25 you can use Zod v4 as a peer-dependency, so long as you still provide v3-schemas.
_Looking for the exact opposite? Check out [json-schema-to-zod](https://npmjs.org/package/json-schema-to-zod)_
## Sponsors
As this project will no longer be receiving updates I am no longer accepting new partnerships. Huge shout-out to CodeRabbit for keeping it real to the end <3
<table align="center" style="justify-content: center;align-items: center;display: flex;">
<tr>
<td align="center">
<p></p>
<p>
<div style="background-color: white; padding: 4px; padding-bottom: 8px;" alt="stainless">
<a href="https://www.coderabbit.ai/">
<picture height="45px">
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/user-attachments/assets/eea24edb-ff20-4532-b57c-e8719f455d6d">
<img alt="CodeRabbit logo" height="45px" src="https://github.com/user-attachments/assets/d791bc7d-dc60-4d55-9c31-97779839cb74">
</picture>
</a>
</div>
<br />
Cut code review time & bugs in half
<br/>
<a href="https://www.coderabbit.ai/" style="text-decoration:none;">coderabbit.ai</a>
</p>
<p></p>
</td>
</tr>
</table>
## Usage
### Basic example
```typescript
import { z } from "zod"; // Or, using v3.25 or v4, "zod/v3"
import { zodToJsonSchema } from "zod-to-json-schema";
const mySchema = z
.object({
myString: z.string().min(5),
myUnion: z.union([z.number(), z.boolean()]),
})
.describe("My neat object schema");
const jsonSchema = zodToJsonSchema(mySchema, "mySchema");
```
#### Expected output
```json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/mySchema",
"definitions": {
"mySchema": {
"description": "My neat object schema",
"type": "object",
"properties": {
"myString": {
"type": "string",
"minLength": 5
},
"myUnion": {
"type": ["number", "boolean"]
}
},
"additionalProperties": false,
"required": ["myString", "myUnion"]
}
}
}
```
## Options
### Schema name
You can pass a string as the second parameter of the main zodToJsonSchema function. If you do, your schema will end up inside a definitions object property on the root and referenced from there. Alternatively, you can pass the name as the `name` property of the options object (see below).
### Options object
Instead of the schema name (or nothing), you can pass an options object as the second parameter. The following options are available:
| Option | Effect |
| ---------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **name**?: _string_ | As described above. |
| **nameStrategy**?: "ref" \| "title" | Adds name as "title" meta instead of as a ref as described above |
| **basePath**?: string[] | The base path of the root reference builder. Defaults to ["#"]. |
| **$refStrategy**?: "root" \| "relative" \| "seen" \| "none" | The reference builder strategy; <ul><li>**"root"** resolves $refs from the root up, ie: "#/definitions/mySchema".</li><li>**"relative"** uses [relative JSON pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). _See known issues!_</li><li>**"seen"** reuses the output of any "seen" Zod schema. In theory it's a more performant version of "none", but in practice this behaviour can cause issues with nested schemas and has now gotten its own option.</li> <li>**"none"** ignores referencing all together, creating a new schema branch even on "seen" schemas. Recursive references defaults to "any", ie `{}`.</li></ul> Defaults to "root". |
| **effectStrategy**?: "input" \| "any" | The effects output strategy. Defaults to "input". _See known issues!_ |
| **dateStrategy**?: "format:date" \| "format:date-time" \| "string" \| "integer" | Date strategy, integer allow to specify in unix-time min and max values. "format:date" creates a string schema with format: "date". "format:date-time" creates a string schema with format: "date-time". "string" is intepreted as "format:date-time". "integer" creates an integer schema with format "unix-time" (unless target "openApi3" is used min max checks are also respected) |
| |
| **emailStrategy**?: "format:email" \| "format:idn-email" \| "pattern:zod" | Choose how to handle the email string check. Defaults to "format:email". |
| **base64Strategy**?: "format:binary" \| "contentEnconding:base64" \| "pattern:zod" | Choose how to handle the base64 string check. Defaults to "contentEncoding:base64" as described [here](https://json-schema.org/understanding-json-schema/reference/non_json_data#contentencoding). Note that "format:binary" is not represented in the output type as it's not part of the JSON Schema spec and only intended to be used when targeting OpenAPI 3.0. Later versions of OpenAPI support contentEncoding. |
| **definitionPath**?: "definitions" \| "$defs" | The name of the definitions property when name is passed. Defaults to "definitions". |
| **target**?: "jsonSchema7" \| "jsonSchema2019-09" \| "openApi3" \| "openAi" | Which spec to target. Defaults to "jsonSchema7" |
| **strictUnions**?: boolean | Scrubs unions of any-like json schemas, like `{}` or `true`. Multiple zod types may result in these out of necessity, such as z.instanceof() |
| **definitions**?: Record<string, ZodSchema> | See separate section below |
| **errorMessages**?: boolean | Include custom error messages created via chained function checks for supported zod types. See section below |
| **markdownDescription**?: boolean | Copies the `description` meta to `markdownDescription` |
| **patternStrategy**?: "escape" \| "preserve" | The Zod string validations `.includes()`, `.startsWith()`, and `.endsWith()` must be converted to regex to be compatible with JSON Schema's `pattern`. For safety, all non-alphanumeric characters are `escape`d by default (consider `z.string().includes(".")`), but this can occasionally cause problems with Unicode-flagged regex parsers. Use `preserve` to prevent this escaping behaviour and preserve the exact string written, even if it results in an inaccurate regex. |
| **applyRegexFlags**?: boolean | JSON Schema's `pattern` doesn't support RegExp flags, but Zod's `z.string().regex()` does. When this option is true (default false), a best-effort is made to transform regexes into a flag-independent form (e.g. `/x/i => /[xX]/` ). Supported flags: `i` (basic Latin only), `m`, `s`. |
| **pipeStrategy**?: "all" \| "input" \| "output" | Decide which types should be included when using `z.pipe`, for example `z.string().pipe(z.number())` would return both `string` and `number` by default, only `string` for "input" and only `number` for "output". |
| **removeAdditionalStrategy**?: "passthrough" \| "strict" | Decide when `additionalProperties` should be allowed. See the section on additional properties for details. |
| **allowedAdditionalProperties**?: `true` \| `undefined` | What value to give `additionalProperties` when allowed. See the section on additional properties for details. |
| **rejectedAdditionalProperties**?: `false` \| `undefined` | What value to give `additionalProperties` when rejected. See the section on additional properties for details. |
| **override**?: callback | See section |
| **postProcess**?: callback | See section |
| **openAiAnyTypeName**?: string | Decides the name of a Json schema used to allow semi-arbitrary values in Open AI structured output. If any value in the Zod-schema resolves to any "any"-type schema it will reference a definition of this name. If no such definition is provided a default Json schema will be used. Defaults to "OpenAiAnyType" |
### Definitions
The definitions option lets you manually add recurring schemas into definitions for cleaner outputs. It's fully compatible with named schemas, changed definitions path and base path. Here's a simple example:
```typescript
const myRecurringSchema = z.string();
const myObjectSchema = z.object({ a: myRecurringSchema, b: myRecurringSchema });
const myJsonSchema = zodToJsonSchema(myObjectSchema, {
definitions: { myRecurringSchema },
});
```
#### Result
```json
{
"type": "object",
"properties": {
"a": {
"$ref": "#/definitions/myRecurringSchema"
},
"b": {
"$ref": "#/definitions/myRecurringSchema"
}
},
"definitions": {
"myRecurringSchema": {
"type": "string"
}
}
}
```
### Error Messages
This feature allows optionally including error messages created via chained function calls for supported zod types:
```ts
// string schema with additional chained function call checks
const EmailSchema = z.string().email("Invalid email").min(5, "Too short");
const jsonSchema = zodToJsonSchema(EmailSchema, { errorMessages: true });
```
#### Result
```json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "string",
"format": "email",
"minLength": 5,
"errorMessage": {
"format": "Invalid email",
"minLength": "Too short"
}
}
```
This allows for field specific, validation step specific error messages which can be useful for building forms and such. This format is accepted by `react-hook-form`'s ajv resolver (and therefor `ajv-errors` which it uses under the hood). Note that if using AJV with this format will require [enabling `ajv-errors`](https://ajv.js.org/packages/ajv-errors.html#usage) as vanilla AJV does not accept this format by default.
#### Custom Error Message Support
- ZodString
- regex
- min, max
- email, cuid, uuid, url
- endsWith, startsWith
- ZodNumber
- min, max, lt, lte, gt, gte,
- int
- multipleOf
- ZodSet
- min, max
- ZodArray
- min, max
### Additional properties
By default, Zod removes undeclared properties when parsing object schemas. In order to replicate the expected output of this behaviour, the default for behaviour of zodToJsonSchema is to set `"additionalProperties"` to `false` (although the correctness of this can be debated). If you wish to allow undeclared properties you can either:
- Set `removeAdditionalStrategy` to `"strict"`. This will allow additional properties for any object schema that is not declared with `.strict()`.
- Leave `removeAdditionalStrategy` set to its default value of `"passthrough"`, and add `.passtrough()` to your object schema.
#### Removing the `additionalProperties` keyword using the `allowedAdditionalProperties` and/or `rejectedAdditionalProperties` options.
Some schema definitions (like Googles Gen AI API for instance) does not allow the `additionalProperties` keyword at all. Luckily the JSON Schema spec allows for this: leaving the keyword undefined _should_ have the same effect as setting it to true (as per usual YMMV). To enable this behaviour, set the option `allowedAdditionalProperties` to `undefined`.
To exclude the keyword even when additional properties are _not_ allowed, set the `rejectedAdditionalProperties` to `undefined` as well.
_Heads up ⚠️: Both of these options will be ignored if your schema is declared with `.catchall(...)` as the provided schema will be used instead (if valid)._
#### Expected outputs
| `z.object({})` + option | `"additionalProperties"` value |
| ------------------------- | ----------------------------------------------------------- |
| `.strip()` (default) | `false` if strategy is `"passtrough"`, `true` if `"strict"` |
| `.passtrough()` | `true` |
| `.strict()` | `false` |
| `.catchall(z.string())` | `{ "type": "string" }` |
| `.catchall(z.function())` | `undefined` (function schemas are not currently parseable) |
Substitute `true` and `false` for `undefined` according to `allowedAdditionalProperties` and/or `rejectedAdditionalProperties` respectively.
### `override`
This options takes a callback receiving a Zod schema definition, the current reference object (containing the current ref path and other options), an argument containing inforation about wether or not the schema has been encountered before, and a forceResolution argument.
Important: if you don't want to override the current item you have to return the `ignoreOverride` symbol exported from the index. This is because `undefined` is a valid option to return when you want the property to be excluded from the resulting JSON schema.
```typescript
import zodToJsonSchema, { ignoreOverride } from "zod-to-json-schema";
zodToJsonSchema(
z.object({
ignoreThis: z.string(),
overrideThis: z.string(),
removeThis: z.string(),
}),
{
override: (def, refs) => {
const path = refs.currentPath.join("/");
if (path === "#/properties/overrideThis") {
return {
type: "integer",
};
}
if (path === "#/properties/removeThis") {
return undefined;
}
// Important! Do not return `undefined` or void unless you want to remove the property from the resulting schema completely.
return ignoreOverride;
},
},
);
```
Expected output:
```json
{
"type": "object",
"required": ["ignoreThis", "overrideThis"],
"properties": {
"ignoreThis": {
"type": "string"
},
"overrideThis": {
"type": "integer"
}
},
"additionalProperties": false
}
```
### `postProcess`
Besided receiving all arguments of the `override` callback, the `postProcess` callback also receives the generated schema. It should always return a JSON Schema, or `undefined` if you wish to filter it out. Unlike the `override` callback you do not have to return `ignoreOverride` if you are happy with the produced schema; simply return it unchanged.
```typescript
import zodToJsonSchema, { PostProcessCallback } from "zod-to-json-schema";
// Define the callback to be used to process the output using the PostProcessCallback type:
const postProcess: PostProcessCallback = (
// The original output produced by the package itself:
jsonSchema,
// The ZodSchema def used to produce the original schema:
def,
// The refs object containing the current path, passed options, etc.
refs,
) => {
if (!jsonSchema) {
return jsonSchema;
}
// Try to expand description as JSON meta:
if (jsonSchema.description) {
try {
jsonSchema = {
...jsonSchema,
...JSON.parse(jsonSchema.description),
};
} catch {}
}
// Make all numbers nullable:
if ("type" in jsonSchema! && jsonSchema.type === "number") {
jsonSchema.type = ["number", "null"];
}
// Add the refs path, just because
(jsonSchema as any).path = refs.currentPath;
return jsonSchema;
};
const jsonSchema = zodToJsonSchema(zodSchema, { postProcess });
```
#### Using `postProcess` for including examples and other meta
Adding support for examples and other JSON Schema meta keys are among the most commonly requested features for this project. Unfortunately the current Zod major (3) has pretty anemic support for this, so some userland hacking is required. Since this is such a common usecase I've included a helper function that simply tries to parse any description as JSON and expand it into the resulting schema.
Simply stringify whatever you want added to the output schema as the description, then import and use `jsonDescription` as the postProcess option:
```typescript
import zodToJsonSchema, { jsonDescription } from "zod-to-json-schema";
const zodSchema = z.string().describe(
JSON.stringify({
title: "My string",
description: "My description",
examples: ["Foo", "Bar"],
whatever: 123,
}),
);
const jsonSchema = zodToJsonSchema(zodSchema, {
postProcess: jsonDescription,
});
```
Expected output:
```json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "string",
"title": "My string",
"description": "My description",
"examples": ["Foo", "Bar"],
"whatever": 123
}
```
## Known issues
- The OpenAI target should be considered experimental for now, as some combination of options may break the compatibility.
- When using `.transform`, the return type is inferred from the supplied function. In other words, there is no schema for the return type, and there is no way to convert it in runtime. Currently the JSON schema will therefore reflect the input side of the Zod schema and not necessarily the output (the latter aka. `z.infer`). If this causes problems with your schema, consider using the effectStrategy "any", which will allow any type of output.
- JSON Schemas does not support any other key type than strings for objects. When using `z.record` with any other key type, this will be ignored. An exception to this rule is `z.enum` as is supported since 3.11.3
- Relative JSON pointers, while published alongside [JSON schema draft 2020-12](https://json-schema.org/specification.html), is not technically a part of it. Currently, most resolvers do not handle them at all.
- Since v3, the Object parser uses `.isOptional()` to check if a property should be included in `required` or not. This has the potentially dangerous behavior of calling `.safeParse` with `undefined`. To work around this, make sure your `preprocess` and other effects callbacks are pure and not liable to throw errors. An issue has been logged in the Zod repo and can be [tracked here](https://github.com/colinhacks/zod/issues/1460).
- JSON Schema version 2020-12 is not yet officially supported. However, you should be able to use this library to obtain a compatible schema for the 2020-12 format just by changing the returned schema's `$schema` field to: "https://json-schema.org/draft/2020-12/schema#"
## Versioning
This package _does not_ follow semantic versioning. The major and minor versions of this package instead reflects feature parity with the [Zod package](http://npmjs.com/package/zod).
I will do my best to keep API-breaking changes to an absolute minimum, but new features may appear as "patches", such as introducing the options pattern in 3.9.1.
While v3.25 supports Zod v4 as a peer-dependency, it does _not_ mean it supports v4 schemas. Use `import { z } from "zod/v3"` and refer to the Zod documentation.
## Changelog
https://github.com/StefanTerdell/zod-to-json-schema/blob/master/changelog.md
@@ -0,0 +1,5 @@
export default function readInputSourceMapFile(): never {
throw new Error(
"Reading input source map files is not supported in browsers",
);
}
@@ -0,0 +1,9 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
export { default } from './square-dashed-mouse-pointer.js';
//# sourceMappingURL=mouse-pointer-square-dashed.js.map
@@ -0,0 +1,176 @@
export { AsyncMotionValueAnimation } from './animation/AsyncMotionValueAnimation.mjs';
export { GroupAnimation } from './animation/GroupAnimation.mjs';
export { GroupAnimationWithThen } from './animation/GroupAnimationWithThen.mjs';
export { JSAnimation, animateValue } from './animation/JSAnimation.mjs';
export { NativeAnimation } from './animation/NativeAnimation.mjs';
export { NativeAnimationExtended } from './animation/NativeAnimationExtended.mjs';
export { NativeAnimationWrapper } from './animation/NativeAnimationWrapper.mjs';
export { animationMapKey, getAnimationMap } from './animation/utils/active-animations.mjs';
export { calcChildStagger } from './animation/utils/calc-child-stagger.mjs';
export { getVariableValue, parseCSSVariable } from './animation/utils/css-variables-conversion.mjs';
export { getDefaultTransition } from './animation/utils/default-transitions.mjs';
export { getFinalKeyframe } from './animation/keyframes/get-final.mjs';
export { getValueTransition } from './animation/utils/get-value-transition.mjs';
export { resolveTransition } from './animation/utils/resolve-transition.mjs';
export { containsCSSVariable, isCSSVariableName, isCSSVariableToken } from './animation/utils/is-css-variable.mjs';
export { isTransitionDefined } from './animation/utils/is-transition-defined.mjs';
export { makeAnimationInstant } from './animation/utils/make-animation-instant.mjs';
export { animateMotionValue } from './animation/interfaces/motion-value.mjs';
export { animateVisualElement } from './animation/interfaces/visual-element.mjs';
export { animateTarget } from './animation/interfaces/visual-element-target.mjs';
export { animateVariant } from './animation/interfaces/visual-element-variant.mjs';
export { optimizedAppearDataAttribute, optimizedAppearDataId } from './animation/optimized-appear/data-id.mjs';
export { getOptimisedAppearId } from './animation/optimized-appear/get-appear-id.mjs';
export { inertia } from './animation/generators/inertia.mjs';
export { defaultEasing, keyframes } from './animation/generators/keyframes.mjs';
export { spring } from './animation/generators/spring.mjs';
export { calcGeneratorDuration, maxGeneratorDuration } from './animation/generators/utils/calc-duration.mjs';
export { createGeneratorEasing } from './animation/generators/utils/create-generator-easing.mjs';
export { isGenerator } from './animation/generators/utils/is-generator.mjs';
export { DOMKeyframesResolver } from './animation/keyframes/DOMKeyframesResolver.mjs';
export { KeyframeResolver, flushKeyframeResolvers } from './animation/keyframes/KeyframesResolver.mjs';
export { defaultOffset } from './animation/keyframes/offsets/default.mjs';
export { fillOffset } from './animation/keyframes/offsets/fill.mjs';
export { convertOffsetToTimes } from './animation/keyframes/offsets/time.mjs';
export { applyPxDefaults } from './animation/keyframes/utils/apply-px-defaults.mjs';
export { fillWildcards } from './animation/keyframes/utils/fill-wildcards.mjs';
export { cubicBezierAsString } from './animation/waapi/easing/cubic-bezier.mjs';
export { isWaapiSupportedEasing } from './animation/waapi/easing/is-supported.mjs';
export { mapEasingToNativeEasing } from './animation/waapi/easing/map-easing.mjs';
export { supportedWaapiEasing } from './animation/waapi/easing/supported.mjs';
export { startWaapiAnimation } from './animation/waapi/start-waapi-animation.mjs';
export { supportsPartialKeyframes } from './animation/waapi/supports/partial-keyframes.mjs';
export { supportsBrowserAnimation } from './animation/waapi/supports/waapi.mjs';
export { acceleratedValues } from './animation/waapi/utils/accelerated-values.mjs';
export { applyGeneratorOptions } from './animation/waapi/utils/apply-generator.mjs';
export { generateLinearEasing } from './animation/waapi/utils/linear.mjs';
export { addAttrValue, attrEffect } from './effects/attr/index.mjs';
export { propEffect } from './effects/prop/index.mjs';
export { addStyleValue, styleEffect } from './effects/style/index.mjs';
export { svgEffect } from './effects/svg/index.mjs';
export { createRenderBatcher } from './frameloop/batcher.mjs';
export { cancelMicrotask, microtask } from './frameloop/microtask.mjs';
export { time } from './frameloop/sync-time.mjs';
export { isDragActive, isDragging } from './gestures/drag/state/is-active.mjs';
export { setDragLock } from './gestures/drag/state/set-active.mjs';
export { hover } from './gestures/hover.mjs';
export { press } from './gestures/press/index.mjs';
export { isElementKeyboardAccessible, isElementTextInput } from './gestures/press/utils/is-keyboard-accessible.mjs';
export { isNodeOrChild } from './gestures/utils/is-node-or-child.mjs';
export { isPrimaryPointer } from './gestures/utils/is-primary-pointer.mjs';
export { defaultTransformValue, parseValueFromTransform, readTransformValue } from './render/dom/parse-transform.mjs';
export { getComputedStyle } from './render/dom/style-computed.mjs';
export { setStyle } from './render/dom/style-set.mjs';
export { isKeyframesTarget } from './render/utils/is-keyframes-target.mjs';
export { positionalKeys } from './render/utils/keys-position.mjs';
export { transformPropOrder, transformProps } from './render/utils/keys-transform.mjs';
export { resize } from './resize/index.mjs';
export { observeTimeline } from './scroll/observe.mjs';
export { recordStats } from './stats/index.mjs';
export { activeAnimations } from './stats/animation-count.mjs';
export { statsBuffer } from './stats/buffer.mjs';
export { interpolate } from './utils/interpolate.mjs';
export { isHTMLElement } from './utils/is-html-element.mjs';
export { isSVGElement } from './utils/is-svg-element.mjs';
export { isSVGSVGElement } from './utils/is-svg-svg-element.mjs';
export { mix } from './utils/mix/index.mjs';
export { mixColor, mixLinearColor } from './utils/mix/color.mjs';
export { getMixer, mixArray, mixComplex, mixObject } from './utils/mix/complex.mjs';
export { mixImmediate } from './utils/mix/immediate.mjs';
export { mixNumber } from './utils/mix/number.mjs';
export { invisibleValues, mixVisibility } from './utils/mix/visibility.mjs';
export { resolveElements } from './utils/resolve-elements.mjs';
export { getOriginIndex, stagger } from './utils/stagger.mjs';
export { supportsFlags } from './utils/supports/flags.mjs';
export { supportsLinearEasing } from './utils/supports/linear-easing.mjs';
export { supportsScrollTimeline, supportsViewTimeline } from './utils/supports/scroll-timeline.mjs';
export { transform } from './utils/transform.mjs';
export { MotionValue, collectMotionValues, motionValue } from './value/index.mjs';
export { attachFollow, followValue } from './value/follow-value.mjs';
export { mapValue } from './value/map-value.mjs';
export { attachSpring, springValue } from './value/spring-value.mjs';
export { transformValue } from './value/transform-value.mjs';
export { color } from './value/types/color/index.mjs';
export { hex } from './value/types/color/hex.mjs';
export { hsla } from './value/types/color/hsla.mjs';
export { hslaToRgba } from './value/types/color/hsla-to-rgba.mjs';
export { rgbUnit, rgba } from './value/types/color/rgba.mjs';
export { analyseComplexValue, complex } from './value/types/complex/index.mjs';
export { dimensionValueTypes, findDimensionValueType } from './value/types/dimensions.mjs';
export { defaultValueTypes, getDefaultValueType } from './value/types/maps/defaults.mjs';
export { numberValueTypes } from './value/types/maps/number.mjs';
export { transformValueTypes } from './value/types/maps/transform.mjs';
export { alpha, number, scale } from './value/types/numbers/index.mjs';
export { degrees, percent, progressPercentage, px, vh, vw } from './value/types/numbers/units.mjs';
export { testValueType } from './value/types/test.mjs';
export { getAnimatableNone } from './value/types/utils/animatable-none.mjs';
export { findValueType } from './value/types/utils/find.mjs';
export { getValueAsType } from './value/types/utils/get-as-type.mjs';
export { isMotionValue } from './value/utils/is-motion-value.mjs';
export { addValueToWillChange } from './value/will-change/add-will-change.mjs';
export { isWillChangeMotionValue } from './value/will-change/is.mjs';
export { ViewTransitionBuilder, animateView } from './view/index.mjs';
export { getViewAnimationLayerInfo } from './view/utils/get-layer-info.mjs';
export { getViewAnimations } from './view/utils/get-view-animations.mjs';
export { DOMVisualElement } from './render/dom/DOMVisualElement.mjs';
export { Feature } from './render/Feature.mjs';
export { HTMLVisualElement } from './render/html/HTMLVisualElement.mjs';
export { ObjectVisualElement } from './render/object/ObjectVisualElement.mjs';
export { visualElementStore } from './render/store.mjs';
export { SVGVisualElement } from './render/svg/SVGVisualElement.mjs';
export { VisualElement, getFeatureDefinitions, setFeatureDefinitions } from './render/VisualElement.mjs';
export { checkVariantsDidChange, createAnimationState } from './render/utils/animation-state.mjs';
export { getVariantContext } from './render/utils/get-variant-context.mjs';
export { isAnimationControls } from './render/utils/is-animation-controls.mjs';
export { isControllingVariants, isVariantNode } from './render/utils/is-controlling-variants.mjs';
export { isForcedMotionValue } from './render/utils/is-forced-motion-value.mjs';
export { isVariantLabel } from './render/utils/is-variant-label.mjs';
export { updateMotionValuesFromProps } from './render/utils/motion-values.mjs';
export { resolveVariant } from './render/utils/resolve-dynamic-variants.mjs';
export { resolveVariantFromProps } from './render/utils/resolve-variants.mjs';
export { setTarget } from './render/utils/setters.mjs';
export { variantPriorityOrder, variantProps } from './render/utils/variant-props.mjs';
export { initPrefersReducedMotion } from './render/utils/reduced-motion/index.mjs';
export { convertBoundingBoxToBox, convertBoxToBoundingBox, transformBoxPoints } from './projection/geometry/conversion.mjs';
export { copyAxisDeltaInto, copyAxisInto, copyBoxInto } from './projection/geometry/copy.mjs';
export { applyAxisDelta, applyBoxDelta, applyPointDelta, applyTreeDeltas, scalePoint, transformAxis, transformBox, translateAxis } from './projection/geometry/delta-apply.mjs';
export { calcAxisDelta, calcBoxDelta, calcLength, calcRelativeAxis, calcRelativeAxisPosition, calcRelativeBox, calcRelativePosition, isNear } from './projection/geometry/delta-calc.mjs';
export { removeAxisDelta, removeAxisTransforms, removeBoxTransforms, removePointDelta } from './projection/geometry/delta-remove.mjs';
export { createAxis, createAxisDelta, createBox, createDelta } from './projection/geometry/models.mjs';
export { aspectRatio, axisDeltaEquals, axisEquals, axisEqualsRounded, boxEquals, boxEqualsRounded, isDeltaZero } from './projection/geometry/utils.mjs';
export { eachAxis } from './projection/utils/each-axis.mjs';
export { has2DTranslate, hasScale, hasTransform } from './projection/utils/has-transform.mjs';
export { measurePageBox, measureViewportBox } from './projection/utils/measure.mjs';
export { correctBorderRadius, pixelsToPercent } from './projection/styles/scale-border-radius.mjs';
export { correctBoxShadow } from './projection/styles/scale-box-shadow.mjs';
export { buildProjectionTransform } from './projection/styles/transform.mjs';
export { mixValues } from './projection/animation/mix-values.mjs';
export { animateSingleValue } from './animation/animate/single-value.mjs';
export { addDomEvent } from './events/add-dom-event.mjs';
export { compareByDepth } from './projection/utils/compare-by-depth.mjs';
export { FlatTree } from './projection/utils/flat-tree.mjs';
export { delay, delayInSeconds } from './utils/delay.mjs';
export { resolveMotionValue } from './value/utils/resolve-motion-value.mjs';
export { cleanDirtyNodes, createProjectionNode, propagateDirtyNodes } from './projection/node/create-projection-node.mjs';
export { DocumentProjectionNode } from './projection/node/DocumentProjectionNode.mjs';
export { nodeGroup } from './projection/node/group.mjs';
export { HTMLProjectionNode, rootProjectionNode } from './projection/node/HTMLProjectionNode.mjs';
export { globalProjectionState } from './projection/node/state.mjs';
export { NodeStack } from './projection/shared/stack.mjs';
export { camelToDash } from './render/dom/utils/camel-to-dash.mjs';
export { buildHTMLStyles } from './render/html/utils/build-styles.mjs';
export { buildTransform } from './render/html/utils/build-transform.mjs';
export { renderHTML } from './render/html/utils/render.mjs';
export { scrapeMotionValuesFromProps as scrapeHTMLMotionValuesFromProps } from './render/html/utils/scrape-motion-values.mjs';
export { buildSVGAttrs } from './render/svg/utils/build-attrs.mjs';
export { camelCaseAttributes } from './render/svg/utils/camel-case-attrs.mjs';
export { isSVGTag } from './render/svg/utils/is-svg-tag.mjs';
export { buildSVGPath } from './render/svg/utils/path.mjs';
export { renderSVG } from './render/svg/utils/render.mjs';
export { scrapeMotionValuesFromProps as scrapeSVGMotionValuesFromProps } from './render/svg/utils/scrape-motion-values.mjs';
export { LayoutAnimationBuilder, parseAnimateLayoutArgs } from './layout/LayoutAnimationBuilder.mjs';
export { cancelSync, sync } from './frameloop/index-legacy.mjs';
export { addScaleCorrector, scaleCorrectors } from './projection/styles/scale-correction.mjs';
export { cancelFrame, frame, frameData, frameSteps } from './frameloop/frame.mjs';
export { hasReducedMotionListener, prefersReducedMotion } from './render/utils/reduced-motion/state.mjs';
//# sourceMappingURL=index.mjs.map
@@ -0,0 +1,17 @@
/**
* Concatenates two arrays faster than the array spread operator.
*/
export const concatArrays = <T, U>(
array1: readonly T[],
array2: readonly U[],
): readonly (T | U)[] => {
// Pre-allocate for better V8 optimization
const combinedArray: (T | U)[] = new Array(array1.length + array2.length)
for (let i = 0; i < array1.length; i++) {
combinedArray[i] = array1[i]!
}
for (let i = 0; i < array2.length; i++) {
combinedArray[array1.length + i] = array2[i]!
}
return combinedArray
}
@@ -0,0 +1,58 @@
/** Default upper bound, in bytes, on a request body read by the HTTP entry points (4 MiB). */
export const DEFAULT_MAX_REQUEST_BODY_SIZE = 4 * 1024 * 1024;
/** Upper bound on the number of messages accepted in one JSON-RPC batch array. */
export const MAX_BATCH_SIZE = 100;
/** The message answered with 413 for a request body over `maxBytes`. */
export function requestBodyTooLargeMessage(maxBytes) {
return `Payload Too Large: Request body must not exceed ${maxBytes} bytes`;
}
/**
* Resolves a `maxRequestBodySize` option to the bound to apply: the default when
* omitted, otherwise the value itself, which must be a positive finite number of
* bytes (a `RangeError` is thrown at configuration time for anything else).
*/
export function resolveMaxRequestBodySize(value) {
if (value === undefined) {
return DEFAULT_MAX_REQUEST_BODY_SIZE;
}
if (typeof value !== 'number' || !Number.isFinite(value) || value <= 0) {
throw new RangeError(`maxRequestBodySize must be a positive number of bytes, got ${String(value)}`);
}
return value;
}
/**
* Reads a request body as text, up to `maxBytes` (default
* {@linkcode DEFAULT_MAX_REQUEST_BODY_SIZE}). A declared `Content-Length` over the
* limit is refused without reading anything; otherwise the read stops as soon as
* more than the limit has arrived. Stream failures propagate.
*/
export async function readRequestBody(request, maxBytes = DEFAULT_MAX_REQUEST_BODY_SIZE) {
if (Number(request.headers.get('content-length')) > maxBytes) {
return { tooLarge: true };
}
if (request.body === null) {
return { tooLarge: false, text: '' };
}
const reader = request.body.getReader();
const decoder = new TextDecoder();
let received = 0;
let text = '';
try {
for (;;) {
const { done, value } = await reader.read();
if (done) {
break;
}
received += value.byteLength;
if (received > maxBytes) {
return { tooLarge: true };
}
text += decoder.decode(value, { stream: true });
}
}
finally {
reader.releaseLock();
}
return { tooLarge: false, text: text + decoder.decode() };
}
//# sourceMappingURL=requestBody.js.map
@@ -0,0 +1,540 @@
'use strict'
const { RequestAbortedError } = require('../core/errors')
/**
* @typedef {import('../../types/dispatcher.d.ts').default.DispatchHandler} DispatchHandler
*/
const DEFAULT_MAX_BUFFER_SIZE = 5 * 1024 * 1024
/**
* @typedef {Object} WaitingHandler
* @property {DispatchHandler} handler
* @property {import('../../types/dispatcher.d.ts').default.DispatchController} controller
* @property {Buffer[]} bufferedChunks
* @property {number} bufferedBytes
* @property {object | null} pendingTrailers
* @property {boolean} done
* @property {boolean} [pendingStart] onRequestStart deferred until the primary request's context is known
*/
/**
* Handler that forwards response events to multiple waiting handlers.
* Used for request deduplication.
*
* @implements {DispatchHandler}
*/
class DeduplicationHandler {
/**
* @type {DispatchHandler}
*/
#primaryHandler
/**
* Whether the primary request has started (onRequestStart received). Until
* then the request context is unknown and cannot be given to waiting handlers.
* @type {boolean}
*/
#requestStarted = false
/**
* The primary request context, replayed to waiting handlers so they observe
* the same redirect history as the primary.
* @type {any}
*/
#context = null
/**
* @type {WaitingHandler[]}
*/
#waitingHandlers = []
/**
* @type {number}
*/
#maxBufferSize = DEFAULT_MAX_BUFFER_SIZE
/**
* @type {number}
*/
#statusCode = 0
/**
* @type {Record<string, string | string[]>}
*/
#headers = {}
/**
* @type {string}
*/
#statusMessage = ''
/**
* @type {boolean}
*/
#aborted = false
/**
* @type {boolean}
*/
#responseStarted = false
/**
* @type {boolean}
*/
#responseDataStarted = false
/**
* @type {boolean}
*/
#completed = false
/**
* @type {import('../../types/dispatcher.d.ts').default.DispatchController | null}
*/
#controller = null
/**
* @type {(() => void) | null}
*/
#onComplete = null
/**
* @param {DispatchHandler} primaryHandler The primary handler
* @param {() => void} onComplete Callback when request completes
* @param {number} [maxBufferSize] Maximum paused buffer size per waiting handler
*/
constructor (primaryHandler, onComplete, maxBufferSize = DEFAULT_MAX_BUFFER_SIZE) {
this.#primaryHandler = primaryHandler
this.#onComplete = onComplete
this.#maxBufferSize = maxBufferSize
}
/**
* Add a waiting handler that will receive response events.
* Returns false if deduplication can no longer safely attach this handler.
*
* @param {DispatchHandler} handler
* @returns {boolean}
*/
addWaitingHandler (handler) {
if (this.#completed || this.#responseDataStarted) {
return false
}
const waitingHandler = this.#createWaitingHandler(handler)
const waitingController = waitingHandler.controller
try {
if (this.#requestStarted) {
// The primary request has started, so its context (including the
// redirect history) is known and can be delivered immediately.
handler.onRequestStart?.(waitingController, this.#context)
if (waitingController.aborted) {
waitingHandler.done = true
return true
}
if (this.#responseStarted) {
handler.onResponseStart?.(
waitingController,
this.#statusCode,
this.#headers,
this.#statusMessage
)
}
} else {
// The primary request has not started yet. Defer onRequestStart until
// its context is known, so the waiting handler observes the same
// redirect history as the primary (a cache handler relies on it to
// reject cross-origin redirect responses).
waitingHandler.pendingStart = true
}
} catch {
// Ignore errors from waiting handlers
waitingHandler.done = true
return true
}
if (!waitingController.aborted) {
this.#waitingHandlers.push(waitingHandler)
}
return true
}
/**
* @param {import('../../types/dispatcher.d.ts').default.DispatchController} controller
* @param {any} context
*/
onRequestStart (controller, context) {
this.#controller = controller
if (!this.#requestStarted) {
this.#requestStarted = true
this.#context = context
// Deliver the now-known context to handlers that joined before the
// primary request started.
for (const waitingHandler of this.#waitingHandlers) {
if (waitingHandler.pendingStart && !waitingHandler.done && !waitingHandler.controller.aborted) {
waitingHandler.pendingStart = false
try {
waitingHandler.handler.onRequestStart?.(waitingHandler.controller, context)
} catch {
// Ignore errors from waiting handlers
waitingHandler.done = true
}
}
}
this.#pruneDoneWaitingHandlers()
}
this.#primaryHandler.onRequestStart?.(controller, context)
}
/**
* @param {import('../../types/dispatcher.d.ts').default.DispatchController} controller
* @param {number} statusCode
* @param {import('../../types/header.d.ts').IncomingHttpHeaders} headers
* @param {Socket} socket
*/
onRequestUpgrade (controller, statusCode, headers, socket) {
this.#primaryHandler.onRequestUpgrade?.(controller, statusCode, headers, socket)
}
/**
* @param {import('../../types/dispatcher.d.ts').default.DispatchController} controller
* @param {number} statusCode
* @param {Record<string, string | string[]>} headers
* @param {string} statusMessage
*/
onResponseStart (controller, statusCode, headers, statusMessage) {
this.#responseStarted = true
this.#statusCode = statusCode
this.#headers = headers
this.#statusMessage = statusMessage
this.#primaryHandler.onResponseStart?.(controller, statusCode, headers, statusMessage)
for (const waitingHandler of this.#waitingHandlers) {
const { handler, controller: waitingController } = waitingHandler
if (waitingHandler.done || waitingController.aborted) {
waitingHandler.done = true
continue
}
try {
handler.onResponseStart?.(
waitingController,
statusCode,
headers,
statusMessage
)
} catch {
// Ignore errors from waiting handlers
}
if (waitingController.aborted) {
waitingHandler.done = true
}
}
this.#pruneDoneWaitingHandlers()
}
/**
* @param {import('../../types/dispatcher.d.ts').default.DispatchController} controller
* @param {Buffer} chunk
*/
onResponseData (controller, chunk) {
if (this.#aborted || this.#completed) {
return
}
this.#responseDataStarted = true
this.#primaryHandler.onResponseData?.(controller, chunk)
for (const waitingHandler of this.#waitingHandlers) {
const { handler, controller: waitingController } = waitingHandler
if (waitingHandler.done || waitingController.aborted) {
waitingHandler.done = true
continue
}
if (waitingController.paused) {
this.#bufferWaitingChunk(waitingHandler, chunk)
continue
}
try {
handler.onResponseData?.(waitingController, chunk)
} catch {
// Ignore errors from waiting handlers
}
if (waitingController.aborted) {
waitingHandler.done = true
waitingHandler.bufferedChunks = []
waitingHandler.bufferedBytes = 0
}
}
this.#pruneDoneWaitingHandlers()
}
/**
* @param {import('../../types/dispatcher.d.ts').default.DispatchController} controller
* @param {object} trailers
*/
onResponseEnd (controller, trailers) {
if (this.#aborted || this.#completed) {
return
}
this.#completed = true
// Remove the completed request before callbacks can redispatch into this
// interceptor. Cleanup must not depend on downstream handlers succeeding.
this.#cleanup()
try {
this.#primaryHandler.onResponseEnd?.(controller, trailers)
} catch (err) {
// Completion callbacks may throw to initiate a retry. The transport's
// error callback would be ignored now that this handler is completed.
this.#primaryHandler.onResponseError?.(controller, err)
} finally {
for (const waitingHandler of this.#waitingHandlers) {
if (waitingHandler.done || waitingHandler.controller.aborted) {
waitingHandler.done = true
continue
}
this.#flushWaitingHandler(waitingHandler)
if (waitingHandler.done || waitingHandler.controller.aborted) {
waitingHandler.done = true
continue
}
if (waitingHandler.controller.paused) {
waitingHandler.pendingTrailers = trailers
continue
}
this.#endWaitingHandler(waitingHandler, trailers)
}
this.#pruneDoneWaitingHandlers()
}
}
/**
* @param {import('../../types/dispatcher.d.ts').default.DispatchController} controller
* @param {Error} err
*/
onResponseError (controller, err) {
if (this.#completed) {
return
}
this.#aborted = true
this.#completed = true
this.#cleanup()
try {
this.#primaryHandler.onResponseError?.(controller, err)
} finally {
for (const waitingHandler of this.#waitingHandlers) {
this.#errorWaitingHandler(waitingHandler, err)
}
this.#waitingHandlers = []
}
}
#cleanup () {
const onComplete = this.#onComplete
this.#onComplete = null
onComplete?.()
}
/**
* @param {DispatchHandler} handler
* @returns {WaitingHandler}
*/
#createWaitingHandler (handler) {
/** @type {WaitingHandler} */
const waitingHandler = {
handler,
controller: null,
bufferedChunks: [],
bufferedBytes: 0,
pendingTrailers: null,
done: false,
pendingStart: false
}
const state = {
aborted: false,
paused: false,
reason: null
}
waitingHandler.controller = {
resume: () => {
if (state.aborted) {
return
}
state.paused = false
this.#flushWaitingHandler(waitingHandler)
if (
this.#completed &&
waitingHandler.pendingTrailers &&
waitingHandler.bufferedChunks.length === 0 &&
!state.paused &&
!state.aborted
) {
this.#endWaitingHandler(waitingHandler, waitingHandler.pendingTrailers)
}
this.#pruneDoneWaitingHandlers()
},
pause: () => {
if (!state.aborted) {
state.paused = true
}
},
get paused () { return state.paused },
get aborted () { return state.aborted },
get reason () { return state.reason },
abort: (reason) => {
if (state.aborted) {
return
}
state.aborted = true
state.reason = reason ?? null
waitingHandler.done = true
waitingHandler.pendingTrailers = null
waitingHandler.bufferedChunks = []
waitingHandler.bufferedBytes = 0
try {
handler.onResponseError?.(waitingHandler.controller, state.reason ?? new RequestAbortedError())
} catch {
// Ignore errors from waiting handlers
}
}
}
return waitingHandler
}
/**
* @param {WaitingHandler} waitingHandler
* @param {Buffer} chunk
*/
#bufferWaitingChunk (waitingHandler, chunk) {
if (waitingHandler.done || waitingHandler.controller.aborted) {
waitingHandler.done = true
waitingHandler.bufferedChunks = []
waitingHandler.bufferedBytes = 0
return
}
const bufferedChunk = Buffer.from(chunk)
waitingHandler.bufferedChunks.push(bufferedChunk)
waitingHandler.bufferedBytes += bufferedChunk.length
if (waitingHandler.bufferedBytes > this.#maxBufferSize) {
const err = new RequestAbortedError(`Deduplicated waiting handler exceeded maxBufferSize (${this.#maxBufferSize} bytes) while paused`)
waitingHandler.controller.abort(err)
}
}
/**
* @param {WaitingHandler} waitingHandler
*/
#flushWaitingHandler (waitingHandler) {
const { handler, controller } = waitingHandler
while (
!waitingHandler.done &&
!controller.aborted &&
!controller.paused &&
waitingHandler.bufferedChunks.length > 0
) {
const bufferedChunk = waitingHandler.bufferedChunks.shift()
waitingHandler.bufferedBytes -= bufferedChunk.length
try {
handler.onResponseData?.(controller, bufferedChunk)
} catch {
// Ignore errors from waiting handlers
}
if (controller.aborted) {
waitingHandler.done = true
waitingHandler.pendingTrailers = null
waitingHandler.bufferedChunks = []
waitingHandler.bufferedBytes = 0
break
}
}
}
/**
* @param {WaitingHandler} waitingHandler
* @param {object} trailers
*/
#endWaitingHandler (waitingHandler, trailers) {
waitingHandler.done = true
waitingHandler.pendingTrailers = null
try {
waitingHandler.handler.onResponseEnd?.(waitingHandler.controller, trailers)
} catch (err) {
// This is a response failure, not a consumer abort. Aborting the waiting
// controller here would prevent downstream handlers from retrying.
try {
waitingHandler.handler.onResponseError?.(waitingHandler.controller, err)
} catch {
// An error callback must not prevent other waiting handlers completing.
}
}
}
/**
* @param {WaitingHandler} waitingHandler
* @param {Error} err
*/
#errorWaitingHandler (waitingHandler, err) {
if (waitingHandler.done) {
return
}
waitingHandler.done = true
waitingHandler.pendingTrailers = null
waitingHandler.bufferedChunks = []
waitingHandler.bufferedBytes = 0
// A response failure is not a consumer abort: retry handlers must be able
// to retry it just as they would a failure of the primary request.
try {
waitingHandler.handler.onResponseError?.(waitingHandler.controller, err)
} catch {
// Ignore errors from waiting handlers
}
}
#pruneDoneWaitingHandlers () {
this.#waitingHandlers = this.#waitingHandlers.filter(waitingHandler => waitingHandler.done === false)
}
}
module.exports = DeduplicationHandler
@@ -0,0 +1 @@
{"version":3,"file":"clipboard-pen.js","sources":["../../../src/icons/clipboard-pen.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ClipboardPen\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iOCIgaGVpZ2h0PSI0IiB4PSI4IiB5PSIyIiByeD0iMSIgLz4KICA8cGF0aCBkPSJNMTYgNGgyYTIgMiAwIDAgMSAyIDJ2MTRhMiAyIDAgMCAxLTIgMmgtNS41IiAvPgogIDxwYXRoIGQ9Ik00IDEzLjVWNmEyIDIgMCAwIDEgMi0yaDIiIC8+CiAgPHBhdGggZD0iTTEzLjM3OCAxNS42MjZhMSAxIDAgMSAwLTMuMDA0LTMuMDA0bC01LjAxIDUuMDEyYTIgMiAwIDAgMC0uNTA2Ljg1NGwtLjgzNyAyLjg3YS41LjUgMCAwIDAgLjYyLjYybDIuODctLjgzN2EyIDIgMCAwIDAgLjg1NC0uNTA2eiIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/clipboard-pen\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 ClipboardPen = createLucideIcon('ClipboardPen', [\n ['rect', { width: '8', height: '4', x: '8', y: '2', rx: '1', key: '1oijnt' }],\n ['path', { d: 'M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-5.5', key: 'cereej' }],\n ['path', { d: 'M4 13.5V6a2 2 0 0 1 2-2h2', key: '5ua5vh' }],\n [\n 'path',\n {\n d: 'M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z',\n key: '1y4qbx',\n },\n ],\n]);\n\nexport default ClipboardPen;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,iBAAiB,cAAgB,CAAA,CAAA,CAAA;AAAA,CAAA,CACpD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,KAAK,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC5E,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA+C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA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AA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA;AACF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,8 @@
#!/bin/sh
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
set -e
base=$(dirname "$0")
exec python "${base}/gyp_main.py" "$@"
@@ -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 RouteOff = createLucideIcon("RouteOff", [
["circle", { cx: "6", cy: "19", r: "3", key: "1kj8tv" }],
["path", { d: "M9 19h8.5c.4 0 .9-.1 1.3-.2", key: "1effex" }],
["path", { d: "M5.2 5.2A3.5 3.53 0 0 0 6.5 12H12", key: "k9y2ds" }],
["path", { d: "m2 2 20 20", key: "1ooewy" }],
["path", { d: "M21 15.3a3.5 3.5 0 0 0-3.3-3.3", key: "11nlu2" }],
["path", { d: "M15 5h-4.3", key: "6537je" }],
["circle", { cx: "18", cy: "5", r: "3", key: "gq8acd" }]
]);
export { RouteOff as default };
//# sourceMappingURL=route-off.js.map
@@ -0,0 +1 @@
{"version":3,"file":"feedback.mjs","sources":["../../../src/matcher/regex/feedback.ts"],"sourcesContent":[null],"names":["options","match","regexName","warning","translations","warnings","recentYears","suggestions","associatedYears"],"mappings":"AAGA,mBAAe,CAACA,OAAgB,EAAEC,KAAqB,KAAI;AACzD,EAAA,IAAIA,KAAK,CAACC,SAAS,KAAK,YAAY,EAAE;IACpC,OAAO;AACLC,MAAAA,OAAO,EAAEH,OAAO,CAACI,YAAY,CAACC,QAAQ,CAACC,WAAW;AAClDC,MAAAA,WAAW,EAAE,CACXP,OAAO,CAACI,YAAY,CAACG,WAAW,CAACD,WAAW,EAC5CN,OAAO,CAACI,YAAY,CAACG,WAAW,CAACC,eAAe;KAEnD;AACH,EAAA;EACA,OAAO;AACLL,IAAAA,OAAO,EAAE,IAAI;AACbI,IAAAA,WAAW,EAAE;GACd;AACH,CAAC;;;;"}
@@ -0,0 +1 @@
{"version":3,"file":"message-circle-reply.js","sources":["../../../src/icons/message-circle-reply.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name MessageCircleReply\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNNy45IDIwQTkgOSAwIDEgMCA0IDE2LjFMMiAyMloiIC8+CiAgPHBhdGggZD0ibTEwIDE1LTMtMyAzLTMiIC8+CiAgPHBhdGggZD0iTTcgMTJoN2EyIDIgMCAwIDEgMiAydjEiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/message-circle-reply\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 MessageCircleReply = createLucideIcon('MessageCircleReply', [\n ['path', { d: 'M7.9 20A9 9 0 1 0 4 16.1L2 22Z', key: 'vv11sd' }],\n ['path', { d: 'm10 15-3-3 3-3', key: '1pgupc' }],\n ['path', { d: 'M7 12h7a2 2 0 0 1 2 2v1', key: '1gheu4' }],\n]);\n\nexport default MessageCircleReply;\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,CAAqB,iBAAiB,oBAAsB,CAAA,CAAA,CAAA;AAAA,CAAA,CAChE,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAkC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC/D,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC/C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA2B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC1D,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"file":"definitions.mjs","sources":["../../../../src/motion/features/definitions.ts"],"sourcesContent":["import { getFeatureDefinitions, setFeatureDefinitions } from \"motion-dom\"\nimport { MotionProps } from \"../types\"\nimport { FeatureDefinitions } from \"./types\"\n\nconst featureProps = {\n animation: [\n \"animate\",\n \"variants\",\n \"whileHover\",\n \"whileTap\",\n \"exit\",\n \"whileInView\",\n \"whileFocus\",\n \"whileDrag\",\n ],\n exit: [\"exit\"],\n drag: [\"drag\", \"dragControls\"],\n focus: [\"whileFocus\"],\n hover: [\"whileHover\", \"onHoverStart\", \"onHoverEnd\"],\n tap: [\"whileTap\", \"onTap\", \"onTapStart\", \"onTapCancel\"],\n pan: [\"onPan\", \"onPanStart\", \"onPanSessionStart\", \"onPanEnd\"],\n inView: [\"whileInView\", \"onViewportEnter\", \"onViewportLeave\"],\n layout: [\"layout\", \"layoutId\"],\n}\n\nlet isInitialized = false\n\n/**\n * Initialize feature definitions with isEnabled checks.\n * This must be called before any motion components are rendered.\n */\nexport function initFeatureDefinitions() {\n if (isInitialized) return\n\n const initialFeatureDefinitions: Partial<FeatureDefinitions> = {}\n\n for (const key in featureProps) {\n initialFeatureDefinitions[\n key as keyof typeof initialFeatureDefinitions\n ] = {\n isEnabled: (props: MotionProps) =>\n featureProps[key as keyof typeof featureProps].some(\n (name: string) => !!props[name as keyof typeof props]\n ),\n }\n }\n\n setFeatureDefinitions(initialFeatureDefinitions)\n isInitialized = true\n}\n\n/**\n * Get the current feature definitions, initializing if needed.\n */\nexport function getInitializedFeatureDefinitions(): Partial<FeatureDefinitions> {\n initFeatureDefinitions()\n return getFeatureDefinitions()\n}\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/utils/color-regex.ts"],"sourcesContent":["export const colorRegex =\n /(?:#[\\da-f]{3,8}|(?:rgb|hsl)a?\\((?:-?[\\d.]+%?[,\\s]+){2}-?[\\d.]+%?\\s*(?:[,/]\\s*)?(?:\\b\\d+(?:\\.\\d+)?|\\.\\d+)?%?\\))/giu\n"],"names":[],"mappings":"AAAO,MAAM,UAAU,GACnB;;;;"}
@@ -0,0 +1,3 @@
import { RemoveScrollType } from './types';
declare const ReactRemoveScroll: RemoveScrollType;
export default ReactRemoveScroll;
@@ -0,0 +1 @@
{"version":3,"file":"monitor-up.js","sources":["../../../src/icons/monitor-up.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name MonitorUp\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtOSAxMCAzLTMgMyAzIiAvPgogIDxwYXRoIGQ9Ik0xMiAxM1Y3IiAvPgogIDxyZWN0IHdpZHRoPSIyMCIgaGVpZ2h0PSIxNCIgeD0iMiIgeT0iMyIgcng9IjIiIC8+CiAgPHBhdGggZD0iTTEyIDE3djQiIC8+CiAgPHBhdGggZD0iTTggMjFoOCIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/monitor-up\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 MonitorUp = createLucideIcon('MonitorUp', [\n ['path', { d: 'm9 10 3-3 3 3', key: '11gsxs' }],\n ['path', { d: 'M12 13V7', key: 'h0r20n' }],\n ['rect', { width: '20', height: '14', x: '2', y: '3', rx: '2', key: '48i651' }],\n ['path', { d: 'M12 17v4', key: '1riwvh' }],\n ['path', { d: 'M8 21h8', key: '1ev6f3' }],\n]);\n\nexport default MonitorUp;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,iBAAiB,WAAa,CAAA,CAAA,CAAA;AAAA,CAAA,CAC9C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC9C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,MAAM,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC9E,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC1C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,66 @@
'use strict';
module.exports = function generate_enum(it, $keyword, $ruleType) {
var out = ' ';
var $lvl = it.level;
var $dataLvl = it.dataLevel;
var $schema = it.schema[$keyword];
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
var $breakOnError = !it.opts.allErrors;
var $data = 'data' + ($dataLvl || '');
var $valid = 'valid' + $lvl;
var $isData = it.opts.$data && $schema && $schema.$data,
$schemaValue;
if ($isData) {
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
$schemaValue = 'schema' + $lvl;
} else {
$schemaValue = $schema;
}
var $i = 'i' + $lvl,
$vSchema = 'schema' + $lvl;
if (!$isData) {
out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + ';';
}
out += 'var ' + ($valid) + ';';
if ($isData) {
out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {';
}
out += '' + ($valid) + ' = false;for (var ' + ($i) + '=0; ' + ($i) + '<' + ($vSchema) + '.length; ' + ($i) + '++) if (equal(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + '])) { ' + ($valid) + ' = true; break; }';
if ($isData) {
out += ' } ';
}
out += ' if (!' + ($valid) + ') { ';
var $$outStack = $$outStack || [];
$$outStack.push(out);
out = ''; /* istanbul ignore else */
if (it.createErrors !== false) {
out += ' { keyword: \'' + ('enum') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValues: schema' + ($lvl) + ' } ';
if (it.opts.messages !== false) {
out += ' , message: \'should be equal to one of the allowed values\' ';
}
if (it.opts.verbose) {
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
}
out += ' } ';
} else {
out += ' {} ';
}
var __err = out;
out = $$outStack.pop();
if (!it.compositeRule && $breakOnError) {
/* istanbul ignore if */
if (it.async) {
out += ' throw new ValidationError([' + (__err) + ']); ';
} else {
out += ' validate.errors = [' + (__err) + ']; return false; ';
}
} else {
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
}
out += ' }';
if ($breakOnError) {
out += ' else { ';
}
return out;
}
@@ -0,0 +1,22 @@
import * as core from "../core/index.cjs";
import * as schemas from "./schemas.cjs";
export interface ZodMiniISODateTime extends schemas.ZodMiniStringFormat<"datetime"> {
_zod: core.$ZodISODateTimeInternals;
}
export declare const ZodMiniISODateTime: core.$constructor<ZodMiniISODateTime>;
export declare function datetime(params?: string | core.$ZodISODateTimeParams): ZodMiniISODateTime;
export interface ZodMiniISODate extends schemas.ZodMiniStringFormat<"date"> {
_zod: core.$ZodISODateInternals;
}
export declare const ZodMiniISODate: core.$constructor<ZodMiniISODate>;
export declare function date(params?: string | core.$ZodISODateParams): ZodMiniISODate;
export interface ZodMiniISOTime extends schemas.ZodMiniStringFormat<"time"> {
_zod: core.$ZodISOTimeInternals;
}
export declare const ZodMiniISOTime: core.$constructor<ZodMiniISOTime>;
export declare function time(params?: string | core.$ZodISOTimeParams): ZodMiniISOTime;
export interface ZodMiniISODuration extends schemas.ZodMiniStringFormat<"duration"> {
_zod: core.$ZodISODurationInternals;
}
export declare const ZodMiniISODuration: core.$constructor<ZodMiniISODuration>;
export declare function duration(params?: string | core.$ZodISODurationParams): ZodMiniISODuration;
@@ -0,0 +1,176 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
const HELPERS = {
require: `
import {createRequire as CREATE_REQUIRE_NAME} from "module";
const require = CREATE_REQUIRE_NAME(import.meta.url);
`,
interopRequireWildcard: `
function interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
return newObj;
}
}
`,
interopRequireDefault: `
function interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
`,
createNamedExportFrom: `
function createNamedExportFrom(obj, localName, importedName) {
Object.defineProperty(exports, localName, {enumerable: true, configurable: true, get: () => obj[importedName]});
}
`,
// Note that TypeScript and Babel do this differently; TypeScript does a simple existence
// check in the exports object and does a plain assignment, whereas Babel uses
// defineProperty and builds an object of explicitly-exported names so that star exports can
// always take lower precedence. For now, we do the easier TypeScript thing.
createStarExport: `
function createStarExport(obj) {
Object.keys(obj)
.filter((key) => key !== "default" && key !== "__esModule")
.forEach((key) => {
if (exports.hasOwnProperty(key)) {
return;
}
Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]});
});
}
`,
nullishCoalesce: `
function nullishCoalesce(lhs, rhsFn) {
if (lhs != null) {
return lhs;
} else {
return rhsFn();
}
}
`,
asyncNullishCoalesce: `
async function asyncNullishCoalesce(lhs, rhsFn) {
if (lhs != null) {
return lhs;
} else {
return await rhsFn();
}
}
`,
optionalChain: `
function optionalChain(ops) {
let lastAccessLHS = undefined;
let value = ops[0];
let i = 1;
while (i < ops.length) {
const op = ops[i];
const fn = ops[i + 1];
i += 2;
if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
return undefined;
}
if (op === 'access' || op === 'optionalAccess') {
lastAccessLHS = value;
value = fn(value);
} else if (op === 'call' || op === 'optionalCall') {
value = fn((...args) => value.call(lastAccessLHS, ...args));
lastAccessLHS = undefined;
}
}
return value;
}
`,
asyncOptionalChain: `
async function asyncOptionalChain(ops) {
let lastAccessLHS = undefined;
let value = ops[0];
let i = 1;
while (i < ops.length) {
const op = ops[i];
const fn = ops[i + 1];
i += 2;
if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
return undefined;
}
if (op === 'access' || op === 'optionalAccess') {
lastAccessLHS = value;
value = await fn(value);
} else if (op === 'call' || op === 'optionalCall') {
value = await fn((...args) => value.call(lastAccessLHS, ...args));
lastAccessLHS = undefined;
}
}
return value;
}
`,
optionalChainDelete: `
function optionalChainDelete(ops) {
const result = OPTIONAL_CHAIN_NAME(ops);
return result == null ? true : result;
}
`,
asyncOptionalChainDelete: `
async function asyncOptionalChainDelete(ops) {
const result = await ASYNC_OPTIONAL_CHAIN_NAME(ops);
return result == null ? true : result;
}
`,
};
class HelperManager {
__init() {this.helperNames = {}}
__init2() {this.createRequireName = null}
constructor( nameManager) {;this.nameManager = nameManager;HelperManager.prototype.__init.call(this);HelperManager.prototype.__init2.call(this);}
getHelperName(baseName) {
let helperName = this.helperNames[baseName];
if (helperName) {
return helperName;
}
helperName = this.nameManager.claimFreeName(`_${baseName}`);
this.helperNames[baseName] = helperName;
return helperName;
}
emitHelpers() {
let resultCode = "";
if (this.helperNames.optionalChainDelete) {
this.getHelperName("optionalChain");
}
if (this.helperNames.asyncOptionalChainDelete) {
this.getHelperName("asyncOptionalChain");
}
for (const [baseName, helperCodeTemplate] of Object.entries(HELPERS)) {
const helperName = this.helperNames[baseName];
let helperCode = helperCodeTemplate;
if (baseName === "optionalChainDelete") {
helperCode = helperCode.replace("OPTIONAL_CHAIN_NAME", this.helperNames.optionalChain);
} else if (baseName === "asyncOptionalChainDelete") {
helperCode = helperCode.replace(
"ASYNC_OPTIONAL_CHAIN_NAME",
this.helperNames.asyncOptionalChain,
);
} else if (baseName === "require") {
if (this.createRequireName === null) {
this.createRequireName = this.nameManager.claimFreeName("_createRequire");
}
helperCode = helperCode.replace(/CREATE_REQUIRE_NAME/g, this.createRequireName);
}
if (helperName) {
resultCode += " ";
resultCode += helperCode.replace(baseName, helperName).replace(/\s+/g, " ").trim();
}
}
return resultCode;
}
} exports.HelperManager = HelperManager;
@@ -0,0 +1,3 @@
# Security
Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report.
@@ -0,0 +1,19 @@
Copyright (c) 2014 Forbes Lindesay
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
@@ -0,0 +1,332 @@
/**
* @fileoverview Prefer destructuring from arrays and objects
* @author Alex LaFroscia
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
const PRECEDENCE_OF_ASSIGNMENT_EXPR = astUtils.getPrecedence({
type: "AssignmentExpression",
});
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "Require destructuring from arrays and/or objects",
recommended: false,
frozen: true,
url: "https://eslint.org/docs/latest/rules/prefer-destructuring",
},
fixable: "code",
schema: [
{
/*
* old support {array: Boolean, object: Boolean}
* new support {VariableDeclarator: {}, AssignmentExpression: {}}
*/
oneOf: [
{
type: "object",
properties: {
VariableDeclarator: {
type: "object",
properties: {
array: {
type: "boolean",
},
object: {
type: "boolean",
},
},
additionalProperties: false,
},
AssignmentExpression: {
type: "object",
properties: {
array: {
type: "boolean",
},
object: {
type: "boolean",
},
},
additionalProperties: false,
},
},
additionalProperties: false,
},
{
type: "object",
properties: {
array: {
type: "boolean",
},
object: {
type: "boolean",
},
},
additionalProperties: false,
},
],
},
{
type: "object",
properties: {
enforceForRenamedProperties: {
type: "boolean",
},
},
additionalProperties: false,
},
],
messages: {
preferDestructuring: "Use {{type}} destructuring.",
},
},
create(context) {
const enabledTypes = context.options[0];
const enforceForRenamedProperties =
context.options[1] &&
context.options[1].enforceForRenamedProperties;
let normalizedOptions = {
VariableDeclarator: { array: true, object: true },
AssignmentExpression: { array: true, object: true },
};
if (enabledTypes) {
normalizedOptions =
typeof enabledTypes.array !== "undefined" ||
typeof enabledTypes.object !== "undefined"
? {
VariableDeclarator: enabledTypes,
AssignmentExpression: enabledTypes,
}
: enabledTypes;
}
//--------------------------------------------------------------------------
// Helpers
//--------------------------------------------------------------------------
/**
* Checks if destructuring type should be checked.
* @param {string} nodeType "AssignmentExpression" or "VariableDeclarator"
* @param {string} destructuringType "array" or "object"
* @returns {boolean} `true` if the destructuring type should be checked for the given node
*/
function shouldCheck(nodeType, destructuringType) {
return (
normalizedOptions &&
normalizedOptions[nodeType] &&
normalizedOptions[nodeType][destructuringType]
);
}
/**
* Determines if the given node is accessing an array index
*
* This is used to differentiate array index access from object property
* access.
* @param {ASTNode} node the node to evaluate
* @returns {boolean} whether or not the node is an integer
*/
function isArrayIndexAccess(node) {
return Number.isInteger(node.property.value);
}
/**
* Report that the given node should use destructuring
* @param {ASTNode} reportNode the node to report
* @param {string} type the type of destructuring that should have been done
* @param {Function|null} fix the fix function or null to pass to context.report
* @returns {void}
*/
function report(reportNode, type, fix) {
context.report({
node: reportNode,
messageId: "preferDestructuring",
data: { type },
fix,
});
}
/**
* Determines if a node should be fixed into object destructuring
*
* The fixer only fixes the simplest case of object destructuring,
* like: `let x = a.x`;
*
* Assignment expression is not fixed.
* Array destructuring is not fixed.
* Renamed property is not fixed.
* @param {ASTNode} node the node to evaluate
* @returns {boolean} whether or not the node should be fixed
*/
function shouldFix(node) {
return (
node.type === "VariableDeclarator" &&
node.id.type === "Identifier" &&
node.init.type === "MemberExpression" &&
!node.init.computed &&
node.init.property.type === "Identifier" &&
node.id.name === node.init.property.name
);
}
/**
* Fix a node into object destructuring.
* This function only handles the simplest case of object destructuring,
* see {@link shouldFix}.
* @param {SourceCodeFixer} fixer the fixer object
* @param {ASTNode} node the node to be fixed.
* @returns {Object} a fix for the node
*/
function fixIntoObjectDestructuring(fixer, node) {
const rightNode = node.init;
const sourceCode = context.sourceCode;
// Don't fix if that would remove any comments. Only comments inside `rightNode.object` can be preserved.
if (
sourceCode.getCommentsInside(node).length >
sourceCode.getCommentsInside(rightNode.object).length
) {
return null;
}
let objectText = sourceCode.getText(rightNode.object);
if (
astUtils.getPrecedence(rightNode.object) <
PRECEDENCE_OF_ASSIGNMENT_EXPR
) {
objectText = `(${objectText})`;
}
return fixer.replaceText(
node,
`{${rightNode.property.name}} = ${objectText}`,
);
}
/**
* Check that the `prefer-destructuring` rules are followed based on the
* given left- and right-hand side of the assignment.
*
* Pulled out into a separate method so that VariableDeclarators and
* AssignmentExpressions can share the same verification logic.
* @param {ASTNode} leftNode the left-hand side of the assignment
* @param {ASTNode} rightNode the right-hand side of the assignment
* @param {ASTNode} reportNode the node to report the error on
* @returns {void}
*/
function performCheck(leftNode, rightNode, reportNode) {
if (
rightNode.type !== "MemberExpression" ||
rightNode.object.type === "Super" ||
rightNode.property.type === "PrivateIdentifier"
) {
return;
}
if (isArrayIndexAccess(rightNode)) {
if (shouldCheck(reportNode.type, "array")) {
report(reportNode, "array", null);
}
return;
}
const fix = shouldFix(reportNode)
? fixer => fixIntoObjectDestructuring(fixer, reportNode)
: null;
if (
shouldCheck(reportNode.type, "object") &&
enforceForRenamedProperties
) {
report(reportNode, "object", fix);
return;
}
if (shouldCheck(reportNode.type, "object")) {
const property = rightNode.property;
if (
(property.type === "Literal" &&
leftNode.name === property.value) ||
(property.type === "Identifier" &&
leftNode.name === property.name &&
!rightNode.computed)
) {
report(reportNode, "object", fix);
}
}
}
/**
* Check if a given variable declarator is coming from an property access
* that should be using destructuring instead
* @param {ASTNode} node the variable declarator to check
* @returns {void}
*/
function checkVariableDeclarator(node) {
// Skip if variable is declared without assignment
if (!node.init) {
return;
}
// Variable declarations using explicit resource management cannot use destructuring (parse error)
if (
node.parent.kind === "using" ||
node.parent.kind === "await using"
) {
return;
}
// We only care about member expressions past this point
if (node.init.type !== "MemberExpression") {
return;
}
performCheck(node.id, node.init, node);
}
/**
* Run the `prefer-destructuring` check on an AssignmentExpression
* @param {ASTNode} node the AssignmentExpression node
* @returns {void}
*/
function checkAssignmentExpression(node) {
if (node.operator === "=") {
performCheck(node.left, node.right, node);
}
}
//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
return {
VariableDeclarator: checkVariableDeclarator,
AssignmentExpression: checkAssignmentExpression,
};
},
};
@@ -0,0 +1,90 @@
import { PassThrough } from 'node:stream'
import ReactDOMServer from 'react-dom/server'
import { isbot } from 'isbot'
import {
transformPipeableStreamWithRouter,
transformReadableStreamWithRouter,
} from '@tanstack/router-core/ssr/server'
import type { AnyRouter } from '@tanstack/router-core'
import type { ReadableStream } from 'node:stream/web'
import type { ReactNode } from 'react'
export const renderRouterToStream = async ({
request,
router,
responseHeaders,
children,
}: {
request: Request
router: AnyRouter
responseHeaders: Headers
children: ReactNode
}) => {
if (typeof ReactDOMServer.renderToReadableStream === 'function') {
const stream = await ReactDOMServer.renderToReadableStream(children, {
signal: request.signal,
nonce: router.options.ssr?.nonce,
progressiveChunkSize: Number.POSITIVE_INFINITY,
})
if (isbot(request.headers.get('User-Agent'))) {
await stream.allReady
}
const responseStream = transformReadableStreamWithRouter(
router,
stream as unknown as ReadableStream,
)
return new Response(responseStream as any, {
status: router.stores.statusCode.get(),
headers: responseHeaders,
})
}
if (typeof ReactDOMServer.renderToPipeableStream === 'function') {
const reactAppPassthrough = new PassThrough()
try {
const pipeable = ReactDOMServer.renderToPipeableStream(children, {
nonce: router.options.ssr?.nonce,
progressiveChunkSize: Number.POSITIVE_INFINITY,
...(isbot(request.headers.get('User-Agent'))
? {
onAllReady() {
pipeable.pipe(reactAppPassthrough)
},
}
: {
onShellReady() {
pipeable.pipe(reactAppPassthrough)
},
}),
onError: (error, info) => {
console.error('Error in renderToPipeableStream:', error, info)
// Destroy the passthrough stream on error
if (!reactAppPassthrough.destroyed) {
reactAppPassthrough.destroy(
error instanceof Error ? error : new Error(String(error)),
)
}
},
})
} catch (e) {
console.error('Error in renderToPipeableStream:', e)
reactAppPassthrough.destroy(e instanceof Error ? e : new Error(String(e)))
}
const responseStream = transformPipeableStreamWithRouter(
router,
reactAppPassthrough,
)
return new Response(responseStream as any, {
status: router.stores.statusCode.get(),
headers: responseHeaders,
})
}
throw new Error(
'No renderToReadableStream or renderToPipeableStream found in react-dom/server. Ensure you are using a version of react-dom that supports streaming.',
)
}
@@ -0,0 +1,2 @@
export * from "./dist/json5";
export { default } from "./dist/json5";
@@ -0,0 +1 @@
{"version":3,"file":"encode-html.js","sourceRoot":"","sources":["../../../src/generated/encode-html.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAM9C,SAAS,WAAW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CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,OAAO,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CALine truncated
@@ -0,0 +1,167 @@
import { HTTPException } from "../../http-exception.js";
import { convertIPv4MappedIPv6ToIPv4, convertIPv4ToBinary, convertIPv6BinaryToString, convertIPv6ToBinary, distinctRemoteAddr, isIPv4MappedIPv6 } from "../../utils/ipaddr.js";
//#region src/middleware/ip-restriction/index.ts
const IS_CIDR_NOTATION_REGEX = /\/[^/]*$/;
const parseCidrPrefix = (rule, prefix, max) => {
if (!/^[0-9]{1,3}$/.test(prefix)) throw new TypeError(`Invalid rule: ${rule}`);
const parsedPrefix = parseInt(prefix);
if (parsedPrefix > max) throw new TypeError(`Invalid rule: ${rule}`);
return parsedPrefix;
};
const buildMatcher = (rules) => {
const functionRules = [];
const staticRules = /* @__PURE__ */ new Set();
const staticIPv4Rules = /* @__PURE__ */ new Set();
const staticIPv6Rules = /* @__PURE__ */ new Set();
const cidrRules = [];
const registerStaticRule = (rule) => {
const type = distinctRemoteAddr(rule);
if (type === void 0) throw new TypeError(`Invalid rule: ${rule}`);
if (type === "IPv4") {
const ipv4binary = convertIPv4ToBinary(rule);
staticRules.add(rule);
staticRules.add(`::ffff:${rule}`);
staticIPv4Rules.add(ipv4binary);
staticIPv6Rules.add(65535n << 32n | ipv4binary);
} else {
const ipv6binary = convertIPv6ToBinary(rule);
const ipv6Addr = convertIPv6BinaryToString(ipv6binary);
staticRules.add(ipv6Addr);
staticIPv6Rules.add(ipv6binary);
if (isIPv4MappedIPv6(ipv6binary)) {
staticRules.add(ipv6Addr.substring(7));
staticIPv4Rules.add(convertIPv4MappedIPv6ToIPv4(ipv6binary));
}
}
};
for (let rule of rules) if (rule === "*") return () => true;
else if (typeof rule === "function") functionRules.push(rule);
else {
if (IS_CIDR_NOTATION_REGEX.test(rule)) {
const separatedRule = rule.split("/");
const addrStr = separatedRule[0];
const type = distinctRemoteAddr(addrStr);
if (type === void 0) throw new TypeError(`Invalid rule: ${rule}`);
let isIPv4 = type === "IPv4";
let prefix = parseCidrPrefix(rule, separatedRule[1], isIPv4 ? 32 : 128);
if (isIPv4 ? prefix === 32 : prefix === 128) rule = addrStr;
else {
let addr = (isIPv4 ? convertIPv4ToBinary : convertIPv6ToBinary)(addrStr);
if (type === "IPv6" && isIPv4MappedIPv6(addr) && prefix >= 96) {
isIPv4 = true;
addr = convertIPv4MappedIPv6ToIPv4(addr);
prefix -= 96;
}
const mask = (1n << BigInt(prefix)) - 1n << BigInt((isIPv4 ? 32 : 128) - prefix);
cidrRules.push([
isIPv4,
addr & mask,
mask
]);
continue;
}
}
registerStaticRule(rule);
}
return (remote) => {
if (staticRules.has(remote.addr)) return true;
const remoteAddr = remote.binaryAddr ||= (remote.isIPv4 ? convertIPv4ToBinary : convertIPv6ToBinary)(remote.addr);
const remoteIPv4Addr = remote.isIPv4 || isIPv4MappedIPv6(remoteAddr) ? remote.isIPv4 ? remoteAddr : convertIPv4MappedIPv6ToIPv4(remoteAddr) : void 0;
if ((remote.isIPv4 ? staticIPv4Rules : staticIPv6Rules).has(remoteAddr)) return true;
for (const [isIPv4, addr, mask] of cidrRules) {
if (isIPv4) {
if (remoteIPv4Addr === void 0) continue;
if ((remoteIPv4Addr & mask) === addr) return true;
continue;
}
if (remote.isIPv4) continue;
if ((remoteAddr & mask) === addr) return true;
}
for (const rule of functionRules) if (rule({
addr: remote.addr,
type: remote.type
})) return true;
return false;
};
};
/**
* IP Restriction Middleware for Hono.
*
* @see {@link https://hono.dev/docs/middleware/builtin/ip-restriction}
*
* @param {GetConnInfo | ((c: Context) => string)} getIP - A function to retrieve the client IP address. Use `getConnInfo` from the appropriate runtime adapter.
* @param {IPRestrictionRules} rules - An object with optional `denyList` and `allowList` arrays of IP rules. Each rule can be a static IP, a CIDR range, or a custom function.
* @param {(remote: { addr: string; type: AddressType }, c: Context) => Response | Promise<Response>} [onError] - Optional custom handler invoked when a request is blocked. Defaults to returning a 403 Forbidden response.
* @returns {MiddlewareHandler} The middleware handler function.
*
* @example
* ```ts
* import { Hono } from 'hono'
* import { ipRestriction } from 'hono/ip-restriction'
* import { getConnInfo } from 'hono/cloudflare-workers'
*
* const app = new Hono()
*
* app.use(
* '*',
* ipRestriction(getConnInfo, {
* // Block a specific IP and an entire subnet
* denyList: ['192.168.0.5', '10.0.0.0/8'],
* // Only allow requests from localhost and a private range
* allowList: ['127.0.0.1', '::1', '192.168.1.0/24'],
* })
* )
*
* // With a custom error handler
* app.use(
* '/admin/*',
* ipRestriction(
* getConnInfo,
* { allowList: ['203.0.113.0/24'] },
* (remote, c) => c.text(`Access denied for ${remote.addr}`, 403)
* )
* )
*
* app.get('/', (c) => c.text('Hello!'))
* ```
*/
const ipRestriction = (getIP, { denyList = [], allowList = [] }, onError) => {
const allowLength = allowList.length;
const denyMatcher = buildMatcher(denyList);
const allowMatcher = buildMatcher(allowList);
const blockError = (c) => new HTTPException(403, { res: c.text("Forbidden", { status: 403 }) });
return async function ipRestriction(c, next) {
const connInfo = getIP(c);
const addr = typeof connInfo === "string" ? connInfo : connInfo.remote.address;
if (!addr) throw blockError(c);
const type = typeof connInfo !== "string" && connInfo.remote.addressType || distinctRemoteAddr(addr);
const remoteData = {
addr,
type,
isIPv4: type === "IPv4"
};
try {
if (denyMatcher(remoteData)) {
if (onError) return onError({
addr,
type
}, c);
throw blockError(c);
}
if (allowMatcher(remoteData)) return await next();
} catch (e) {
if (e instanceof TypeError && e.code === "ERR_INVALID_IP_ADDRESS") throw blockError(c);
throw e;
}
if (allowLength === 0) return await next();
else {
if (onError) return await onError({
addr,
type
}, c);
throw blockError(c);
}
};
};
//#endregion
export { ipRestriction };
@@ -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 EqualApproximately = createLucideIcon("EqualApproximately", [
["path", { d: "M5 15a6.5 6.5 0 0 1 7 0 6.5 6.5 0 0 0 7 0", key: "yrdkhy" }],
["path", { d: "M5 9a6.5 6.5 0 0 1 7 0 6.5 6.5 0 0 0 7 0", key: "gzkvyz" }]
]);
export { EqualApproximately as default };
//# sourceMappingURL=equal-approximately.js.map
@@ -0,0 +1 @@
{"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":[null],"names":["time","Date","getTime","ZxcvbnFactory","constructor","options","customMatchers","Options","scoring","Scoring","matching","Matching","feedback","Feedback","timeEstimates","TimeEstimates","estimateAttackTimes","guesses","getFeedback","score","sequence","createReturnValue","resolvedMatches","password","start","matchSequence","mostGuessableMatchSequence","calcTime","attackTimes","main","userInputs","userInputsOptions","getUserInputsOptions","match","check","reducedPassword","substring","maxLength","matches","Promise","Error","checkAsync"],"mappings":";;;;;;;;;;AAcA,MAAMA,IAAI,GAAGA,MAAM,IAAIC,IAAI,EAAE,CAACC,OAAO,EAAE;AAEvC,MAAMC,aAAa,CAAA;EAWjBC,WAAAA,CACEC,OAAA,GAAuB,EAAE,EACzBC,cAAA,GAA0C,EAAE,EAAA;IAE5C,IAAI,CAACD,OAAO,GAAG,IAAIE,OAAO,CAACF,OAAO,EAAEC,cAAc,CAAC;IACnD,IAAI,CAACE,OAAO,GAAG,IAAIC,KAAO,CAAC,IAAI,CAACJ,OAAO,CAAC;IACxC,IAAI,CAACK,QAAQ,GAAG,IAAIC,QAAQ,CAAC,IAAI,CAACN,OAAO,CAAC;IAC1C,IAAI,CAACO,QAAQ,GAAG,IAAIC,QAAQ,CAAC,IAAI,CAACR,OAAO,CAAC;IAC1C,IAAI,CAACS,aAAa,GAAG,IAAIC,2BAAa,CAAC,IAAI,CAACV,OAAO,CAAC;AACtD,EAAA;EAEQW,mBAAmBA,CAACC,OAAe,EAAA;AACzC,IAAA,OAAO,IAAI,CAACH,aAAa,CAACE,mBAAmB,CAACC,OAAO,CAAC;AACxD,EAAA;AAEQC,EAAAA,WAAWA,CAACC,KAAa,EAAEC,QAA0B,EAAA;IAC3D,OAAO,IAAI,CAACR,QAAQ,CAACM,WAAW,CAACC,KAAK,EAAEC,QAAQ,CAAC;AACnD,EAAA;AAEQC,EAAAA,iBAAiBA,CACvBC,eAAgC,EAChCC,QAAgB,EAChBC,KAAa,EAAA;IAEb,MAAMC,aAAa,GAAG,IAAI,CAACjB,OAAO,CAACkB,0BAA0B,CAC3DH,QAAQ,EACRD,eAAe,CAChB;AACD,IAAA,MAAMK,QAAQ,GAAG3B,IAAI,EAAE,GAAGwB,KAAK;IAC/B,MAAMI,WAAW,GAAG,IAAI,CAACZ,mBAAmB,CAACS,aAAa,CAACR,OAAO,CAAC;I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AED,0EAA0E;AAC1E,gFAAgF;AAChF,2EAA2E;AAC3E,gFAAgF;AAChF,iCAAiC;AACjC,SAAS,OAAO,CACd,GAAa,EACb,GAAW,EACX,MAAgB,EAChB,GAAW,EACX,SAAiB,EACjB,WAAoB;IAEpB,MAAM,GAAG,GAAa,EAAE,CAAA;IACxB,IAAI,MAAM,GAAG,CAAC,CAAA;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACvC,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG;gBAAE,OAAO,GAAG,CAAA;YACjC,MAAM,SAAS,GAAI,GAAG,CAAC,CAAC,CAAY,GAAG,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;YACtD,yEAAyE;YACzE,+DAA+D;YAC/D,IAAI,WAAW,IAAI,CAAC,SAAS;gBAAE,SAAQ;YACvC,IAAI,MAAM,GAAG,SAAS,CAAC,MAAM,GAAG,SAAS;gBAAE,OAAO,GAAG,CAAA;YACrD,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YACnB,MAAM,IAAI,SAAS,CAAC,MAAM,CAAA;QAC5B,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,8EAA8E;AAC9E,iBAAiB;AACjB,SAAS,cAAc,CACrB,IAAY,EACZ,eAAwB,EACxB,GAAW,EACX,SAAiBLine truncated
@@ -0,0 +1,21 @@
import { StructuralSharingOption, ValidateSelected } from './structuralSharing.cjs';
import { AnyRouter, RegisteredRouter, ResolveUseParams, StrictOrFrom, ThrowConstraint, ThrowOrOptional, UseParamsResult } from '@tanstack/router-core';
export interface UseParamsBaseOptions<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TThrow extends boolean, TSelected, TStructuralSharing> {
select?: (params: ResolveUseParams<TRouter, TFrom, TStrict>) => ValidateSelected<TRouter, TSelected, TStructuralSharing>;
shouldThrow?: TThrow;
}
export type UseParamsOptions<TRouter extends AnyRouter, TFrom extends string | undefined, TStrict extends boolean, TThrow extends boolean, TSelected, TStructuralSharing> = StrictOrFrom<TRouter, TFrom, TStrict> & UseParamsBaseOptions<TRouter, TFrom, TStrict, TThrow, TSelected, TStructuralSharing> & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>;
export type UseParamsRoute<out TFrom> = <TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts?: UseParamsBaseOptions<TRouter, TFrom, true, true, TSelected, TStructuralSharing> & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>) => UseParamsResult<TRouter, TFrom, true, TSelected>;
/**
* Access the current route's path parameters with type-safety.
*
* Options:
* - `from`/`strict`: Specify the matched route and whether to enforce strict typing
* - `select`: Project the params object to a derived value for memoized renders
* - `structuralSharing`: Enable structural sharing for stable references
* - `shouldThrow`: Throw if the route is not found in strict contexts
*
* @returns The params object (or selected value) for the matched route.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useParamsHook
*/
export declare function useParams<TRouter extends AnyRouter = RegisteredRouter, const TFrom extends string | undefined = undefined, TStrict extends boolean = true, TThrow extends boolean = true, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts: UseParamsOptions<TRouter, TFrom, TStrict, ThrowConstraint<TStrict, TThrow>, TSelected, TStructuralSharing>): ThrowOrOptional<UseParamsResult<TRouter, TFrom, TStrict, TSelected>, TThrow>;
@@ -0,0 +1 @@
{"version":3,"file":"transform.mjs","sources":["../../../../../src/value/types/maps/transform.ts"],"sourcesContent":["import { alpha, scale } from \"../numbers\"\nimport { degrees, progressPercentage, px } from \"../numbers/units\"\nimport { ValueTypeMap } from \"./types\"\n\nexport const transformValueTypes: ValueTypeMap = {\n rotate: degrees,\n rotateX: degrees,\n rotateY: degrees,\n rotateZ: degrees,\n scale,\n scaleX: scale,\n scaleY: scale,\n scaleZ: scale,\n skew: degrees,\n skewX: degrees,\n skewY: degrees,\n distance: px,\n translateX: px,\n translateY: px,\n translateZ: px,\n x: px,\n y: px,\n z: px,\n perspective: px,\n transformPerspective: px,\n opacity: alpha,\n originX: progressPercentage,\n originY: progressPercentage,\n originZ: px,\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,mBAAmB,GAAiB;AAC7C,IAAA,MAAM,EAAE,OAAO;AACf,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,OAAO,EAAE,OAAO;IAChB,KAAK;AACL,IAAA,MAAM,EAAE,KAAK;AACb,IAAA,MAAM,EAAE,KAAK;AACb,IAAA,MAAM,EAAE,KAAK;AACb,IAAA,IAAI,EAAE,OAAO;AACb,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,QAAQ,EAAE,EAAE;AACZ,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,CAAC,EAAE,EAAE;AACL,IAAA,CAAC,EAAE,EAAE;AACL,IAAA,CAAC,EAAE,EAAE;AACL,IAAA,WAAW,EAAE,EAAE;AACf,IAAA,oBAAoB,EAAE,EAAE;AACxB,IAAA,OAAO,EAAE,KAAK;AACd,IAAA,OAAO,EAAE,kBAAkB;AAC3B,IAAA,OAAO,EAAE,kBAAkB;AAC3B,IAAA,OAAO,EAAE,EAAE;;;;;"}
@@ -0,0 +1,225 @@
import type { $ZodCheck, $ZodStringFormats } from "./checks.cjs";
import { $constructor } from "./core.cjs";
import type { $ZodType } from "./schemas.cjs";
import type { StandardSchemaV1 } from "./standard-schema.cjs";
import * as util from "./util.cjs";
export interface $ZodIssueBase {
readonly code?: string;
readonly input?: unknown;
readonly path: PropertyKey[];
readonly message: string;
}
export type $ZodInvalidTypeExpected = "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "undefined" | "null" | "never" | "void" | "date" | "array" | "object" | "tuple" | "record" | "map" | "set" | "file" | "nonoptional" | "nan" | "function" | (string & {});
export interface $ZodIssueInvalidType<Input = unknown> extends $ZodIssueBase {
readonly code: "invalid_type";
readonly expected: $ZodInvalidTypeExpected;
readonly input?: Input;
}
export interface $ZodIssueTooBig<Input = unknown> extends $ZodIssueBase {
readonly code: "too_big";
readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
readonly maximum: number | bigint;
readonly inclusive?: boolean;
readonly exact?: boolean;
readonly input?: Input;
}
export interface $ZodIssueTooSmall<Input = unknown> extends $ZodIssueBase {
readonly code: "too_small";
readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
readonly minimum: number | bigint;
/** True if the allowable range includes the minimum */
readonly inclusive?: boolean;
/** True if the allowed value is fixed (e.g.` z.length(5)`), not a range (`z.minLength(5)`) */
readonly exact?: boolean;
readonly input?: Input;
}
export interface $ZodIssueInvalidStringFormat extends $ZodIssueBase {
readonly code: "invalid_format";
readonly format: $ZodStringFormats | (string & {});
readonly pattern?: string;
readonly input?: string;
}
export interface $ZodIssueNotMultipleOf<Input extends number | bigint = number | bigint> extends $ZodIssueBase {
readonly code: "not_multiple_of";
readonly divisor: number;
readonly input?: Input;
}
export interface $ZodIssueUnrecognizedKeys extends $ZodIssueBase {
readonly code: "unrecognized_keys";
readonly keys: string[];
readonly input?: Record<string, unknown>;
}
interface $ZodIssueInvalidUnionNoMatch extends $ZodIssueBase {
readonly code: "invalid_union";
readonly errors: $ZodIssue[][];
readonly input?: unknown;
readonly discriminator?: string | undefined;
readonly options?: util.Primitive[];
readonly inclusive?: true;
}
interface $ZodIssueInvalidUnionMultipleMatch extends $ZodIssueBase {
readonly code: "invalid_union";
readonly errors: [];
readonly input?: unknown;
readonly discriminator?: string | undefined;
readonly inclusive: false;
/** Indices of the options that matched */
readonly matches: number[];
}
export type $ZodIssueInvalidUnion = $ZodIssueInvalidUnionNoMatch | $ZodIssueInvalidUnionMultipleMatch;
export interface $ZodIssueInvalidKey<Input = unknown> extends $ZodIssueBase {
readonly code: "invalid_key";
readonly origin: "map" | "record";
readonly issues: $ZodIssue[];
readonly input?: Input;
}
export interface $ZodIssueInvalidElement<Input = unknown> extends $ZodIssueBase {
readonly code: "invalid_element";
readonly origin: "map" | "set";
readonly key: unknown;
readonly issues: $ZodIssue[];
readonly input?: Input;
}
export interface $ZodIssueInvalidValue<Input = unknown> extends $ZodIssueBase {
readonly code: "invalid_value";
readonly values: util.Primitive[];
readonly input?: Input;
}
export interface $ZodIssueCustom extends $ZodIssueBase {
readonly code: "custom";
readonly params?: Record<string, any> | undefined;
readonly input?: unknown;
}
export interface $ZodIssueStringCommonFormats extends $ZodIssueInvalidStringFormat {
format: Exclude<$ZodStringFormats, "regex" | "jwt" | "starts_with" | "ends_with" | "includes">;
}
export interface $ZodIssueStringInvalidRegex extends $ZodIssueInvalidStringFormat {
format: "regex";
pattern: string;
}
export interface $ZodIssueStringInvalidJWT extends $ZodIssueInvalidStringFormat {
format: "jwt";
algorithm?: string;
}
export interface $ZodIssueStringStartsWith extends $ZodIssueInvalidStringFormat {
format: "starts_with";
prefix: string;
}
export interface $ZodIssueStringEndsWith extends $ZodIssueInvalidStringFormat {
format: "ends_with";
suffix: string;
}
export interface $ZodIssueStringIncludes extends $ZodIssueInvalidStringFormat {
format: "includes";
includes: string;
}
export type $ZodStringFormatIssues = $ZodIssueStringCommonFormats | $ZodIssueStringInvalidRegex | $ZodIssueStringInvalidJWT | $ZodIssueStringStartsWith | $ZodIssueStringEndsWith | $ZodIssueStringIncludes;
export type $ZodIssue = $ZodIssueInvalidType | $ZodIssueTooBig | $ZodIssueTooSmall | $ZodIssueInvalidStringFormat | $ZodIssueNotMultipleOf | $ZodIssueUnrecognizedKeys | $ZodIssueInvalidUnion | $ZodIssueInvalidKey | $ZodIssueInvalidElement | $ZodIssueInvalidValue | $ZodIssueCustom;
export type $ZodIssueCode = $ZodIssue["code"];
export type $ZodInternalIssue<T extends $ZodIssueBase = $ZodIssue> = T extends any ? RawIssue<T> : never;
type RawIssue<T extends $ZodIssueBase> = T extends any ? util.Flatten<util.MakePartial<T, "message" | "path"> & {
/** The input data */
readonly input: unknown;
/** The schema or check that originated this issue. */
readonly inst?: $ZodType | $ZodCheck;
/** The schema that owns the issue. Equal to `inst` when a schema originated the issue, and the schema the check was attached to when a check did. */
readonly schema?: $ZodType | undefined;
/** If `true`, Zod will continue executing checks/refinements after this issue. */
readonly continue?: boolean | undefined;
} & Record<string, unknown>> : never;
export type $ZodRawIssue<T extends $ZodIssueBase = $ZodIssue> = $ZodInternalIssue<T>;
export interface $ZodErrorMap<T extends $ZodIssueBase = $ZodIssue> {
(issue: $ZodRawIssue<T>): {
message: string;
} | string | undefined | null;
}
export interface $ZodError<T = unknown> extends Error {
type: T;
issues: $ZodIssue[];
_zod: {
output: T;
def: $ZodIssue[];
};
stack?: string;
name: string;
}
export declare const $ZodError: $constructor<$ZodError>;
interface $ZodRealError<T = any> extends $ZodError<T> {
}
export declare const $ZodRealError: $constructor<$ZodRealError>;
export type $ZodFlattenedError<T, U = string> = _FlattenedError<T, U>;
type _FlattenedError<T, U = string> = {
formErrors: U[];
fieldErrors: {
[P in keyof T]?: U[];
};
};
export declare function flattenError<T>(error: $ZodError<T>): _FlattenedError<T>;
export declare function flattenError<T, U>(error: $ZodError<T>, mapper?: (issue: $ZodIssue) => U): _FlattenedError<T, U>;
type _ZodFormattedError<T, U = string> = T extends [any, ...any[]] ? {
[K in keyof T]?: $ZodFormattedError<T[K], U>;
} : T extends any[] ? {
[k: number]: $ZodFormattedError<T[number], U>;
} : T extends object ? util.Flatten<{
[K in keyof T]?: $ZodFormattedError<T[K], U>;
}> : any;
export type $ZodFormattedError<T, U = string> = {
_errors: U[];
} & util.Flatten<_ZodFormattedError<T, U>>;
export declare function formatError<T>(error: $ZodError<T>): $ZodFormattedError<T>;
export declare function formatError<T, U>(error: $ZodError<T>, mapper?: (issue: $ZodIssue) => U): $ZodFormattedError<T, U>;
export type $ZodErrorTree<T, U = string> = T extends util.Primitive ? {
errors: U[];
} : T extends [any, ...any[]] ? {
errors: U[];
items?: {
[K in keyof T]?: $ZodErrorTree<T[K], U>;
};
} : T extends any[] ? {
errors: U[];
items?: Array<$ZodErrorTree<T[number], U>>;
} : T extends object ? {
errors: U[];
properties?: {
[K in keyof T]?: $ZodErrorTree<T[K], U>;
};
} : {
errors: U[];
};
export declare function treeifyError<T>(error: $ZodError<T>): $ZodErrorTree<T>;
export declare function treeifyError<T, U>(error: $ZodError<T>, mapper?: (issue: $ZodIssue) => U): $ZodErrorTree<T, U>;
/** Format a ZodError as a human-readable string in the following form.
*
* From
*
* ```ts
* ZodError {
* issues: [
* {
* expected: 'string',
* code: 'invalid_type',
* path: [ 'username' ],
* message: 'Invalid input: expected string'
* },
* {
* expected: 'number',
* code: 'invalid_type',
* path: [ 'favoriteNumbers', 1 ],
* message: 'Invalid input: expected number'
* }
* ];
* }
* ```
*
* to
*
* ```
* username
* ✖ Expected number, received string at "username
* favoriteNumbers[0]
* ✖ Invalid input: expected number
* ```
*/
export declare function toDotPath(_path: readonly (string | number | symbol | StandardSchemaV1.PathSegment)[]): string;
export declare function prettifyError(error: StandardSchemaV1.FailureResult): string;
export {};
@@ -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 Monitor = createLucideIcon("Monitor", [
["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
]);
export { Monitor as default };
//# sourceMappingURL=monitor.js.map
@@ -0,0 +1,30 @@
// This file is an augmentation to the built-in ImportMeta interface
// Thus cannot contain any top-level imports
// <https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation>
// This is tested in `packages/vite/src/node/__tests_dts__/typeOptions.ts`
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- to allow extending by users
interface ViteTypeOptions {
// strictImportMetaEnv: unknown
}
type ImportMetaEnvFallbackKey =
'strictImportMetaEnv' extends keyof ViteTypeOptions ? never : string
interface ImportMetaEnv extends Record<ImportMetaEnvFallbackKey, any> {
BASE_URL: string
MODE: string
DEV: boolean
PROD: boolean
SSR: boolean
}
interface ImportMeta {
url: string
readonly hot?: import('./hot.js').ViteHotContext
readonly env: ImportMetaEnv
glob: import('./importGlob.js').ImportGlobFunction
}
@@ -0,0 +1 @@
{"version":3,"file":"clipboard-minus.js","sources":["../../../src/icons/clipboard-minus.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ClipboardMinus\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iOCIgaGVpZ2h0PSI0IiB4PSI4IiB5PSIyIiByeD0iMSIgcnk9IjEiIC8+CiAgPHBhdGggZD0iTTE2IDRoMmEyIDIgMCAwIDEgMiAydjE0YTIgMiAwIDAgMS0yIDJINmEyIDIgMCAwIDEtMi0yVjZhMiAyIDAgMCAxIDItMmgyIiAvPgogIDxwYXRoIGQ9Ik05IDE0aDYiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/clipboard-minus\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 ClipboardMinus = createLucideIcon('ClipboardMinus', [\n ['rect', { width: '8', height: '4', x: '8', y: '2', rx: '1', ry: '1', key: 'tgr4d6' }],\n [\n 'path',\n {\n d: 'M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2',\n key: '116196',\n },\n ],\n ['path', { d: 'M9 14h6', key: '159ibu' }],\n]);\n\nexport default ClipboardMinus;\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,CAAiB,iBAAiB,gBAAkB,CAAA,CAAA,CAAA;AAAA,CAAA,CACxD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,KAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAQ,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,EAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,KAAK,CAAI,CAAA,CAAA,CAAA,GAAA,CAAK,CAAA,CAAA,EAAI,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAU,CAAA,CAAA;AAAA,CACrF,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA;AAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC1C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"names":["isDigit","code","forbiddenNumericSeparatorSiblings","decBinOct","Set","hex","isAllowedNumericSeparatorSibling","bin","ch","oct","dec","readStringContents","type","input","pos","lineStart","curLine","errors","initialPos","initialLineStart","initialCurLine","out","firstInvalidLoc","chunkStart","length","unterminated","slice","charCodeAt","isStringEnd","res","readEscapedChar","str","containsInvalid","inTemplate","throwOnInvalid","readHexChar","String","fromCharCode","readCodePoint","fromCodePoint","strictNumericEscape","startPos","match","exec","octalStr","octal","parseInt","next","len","forceLen","n","readInt","invalidEscapeSequence","radix","allowNumSeparator","bailOnError","start","forbiddenSiblings","isAllowedSibling","invalid","total","i","e","Infinity","val","prev","numericSeparatorInEscapeSequence","Number","isNaN","has","unexpectedNumericSeparator","_isDigit","invalidDigit","indexOf","invalidCodePoint"],"sources":["../src/index.ts"],"sourcesContent":["// We inline this package\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as charCodes from \"charcodes\";\n\n// The following character codes are forbidden from being\n// an immediate sibling of NumericLiteralSeparator _\nconst forbiddenNumericSeparatorSiblings = {\n decBinOct: new Set<number>([\n charCodes.dot,\n charCodes.uppercaseB,\n charCodes.uppercaseE,\n charCodes.uppercaseO,\n charCodes.underscore, // multiple separators are not allowed\n charCodes.lowercaseB,\n charCodes.lowercaseE,\n charCodes.lowercaseO,\n ]),\n hex: new Set<number>([\n charCodes.dot,\n charCodes.uppercaseX,\n charCodes.underscore, // multiple separators are not allowed\n charCodes.lowercaseX,\n ]),\n};\n\nconst isAllowedNumericSeparatorSibling = {\n // 0 - 1\n bin: (ch: number) => ch === charCodes.digit0 || ch === charCodes.digit1,\n\n // 0 - 7\n oct: (ch: number) => ch >= charCodes.digit0 && ch <= charCodes.digit7,\n\n // 0 - 9\n dec: (ch: number) => ch >= charCodes.digit0 && ch <= charCodes.digit9,\n\n // 0 - 9, A - F, a - f,\n hex: (ch: number) =>\n (ch >= charCodes.digit0 && ch <= charCodes.digit9) ||\n (ch >= charCodes.uppercaseA && ch <= charCodes.uppercaseF) ||\n (ch >= charCodes.lowercaseA && ch <= charCodes.lowercaseF),\n};\n\nexport type StringContentsErrorHandlers = EscapedCharErrorHandlers & {\n unterminated(\n initialPos: number,\n initialLineStart: number,\n initialCurLine: number,\n ): void;\n};\n\nexport function readStringContents(\n type: \"single\" | \"double\" | \"template\",\n input: string,\n pos: number,\n lineStart: number,\n curLine: number,\n errors: StringContentsErrorHandlers,\n) {\n const initialPos = pos;\n const initialLineStart = lineStart;\n const initialCurLine = curLine;\n\n let out = \"\";\n let firstInvalidLoc = null;\n let chunkStart = pos;\n const { length } = input;\n for (;;) {\n if (pos >= length) {\n errors.unterminated(initialPos, initialLineStart, initialCurLine);\n out += input.slice(chunkStart, pos);\n break;\n }\n const ch = input.charCodeAt(pos);\n if (isStringEnd(type, ch, input, pos)) {\n out += input.slice(chunkStart, pos);\n break;\n }\n if (ch === charCodes.backslash) {\n out += input.slice(chunkStart, pos);\n const res = readEscapedChar(\n input,\n pos,\n lineStart,\n curLine,\n type === \"template\",\n errors,\n );\n if (res.ch === null && !firstInvalidLoc) {\n firstInvalidLoc = { pos, lineStart, curLine };\n } else {\n out += res.ch;\n }\n ({ pos, lineStart, curLine } = res);\n chunkStart = pos;\n } else if (\n ch === charCodes.lineSeparator ||\n ch === charCodes.paragraphSeparator\n ) {\n ++pos;\n ++curLine;\n lineStart = pos;\n } else if (ch === charCodes.lineFeed || ch === charCodes.carriageReturn) {\n if (type === \"template\") {\n out += input.slice(chunkStart, pos) + \"\\n\";\n ++pos;\n if (\n ch === charCodes.carriageReturn &&\n input.charCodeAt(pos) === charCodes.lineFeed\n ) {\n ++pos;\n }\n ++curLine;\n chunkStart = lineStart = pos;\n } else {\n errors.unterminated(initialPos, initialLineStart, initialCurLine);\n }\n } else {\n ++pos;\n }\n }\n return process.env.BABEL_8_BREAKING\n ? { pos, str: out, firstInvalidLoc, lineStart, curLine }\n : {\n pos,\n str: out,\n firstInvalidLoc,\n lineStart,\n curLine,\n containsInvalid: !!firstInvalidLoc,\n };\n}\n\nfunction isStringEnd(\n type: \"single\" | \"double\" | \"template\",\n ch: number,\n input: string,\n pos: number,\n) {\n if (type === \"template\") {\n return (\n ch === charCodes.graveAccent ||\n (ch === charCodes.dollarSign &&\n input.charCodeAt(pos + 1) === charCodes.leftCuLine truncated
@@ -0,0 +1,34 @@
//#region ../core-internal/src/validators/dialects.ts
/**
* Canonical `$schema` URIs per supported dialect (http + https variants, trailing-`#` stripped).
*/
const DRAFT_2020_12_URIS = new Set(["https://json-schema.org/draft/2020-12/schema", "http://json-schema.org/draft/2020-12/schema"]);
const DRAFT_2019_09_URIS = new Set(["https://json-schema.org/draft/2019-09/schema", "http://json-schema.org/draft/2019-09/schema"]);
const DRAFT_07_URIS = new Set(["https://json-schema.org/draft-07/schema", "http://json-schema.org/draft-07/schema"]);
const DRAFT_06_URIS = new Set(["https://json-schema.org/draft-06/schema", "http://json-schema.org/draft-06/schema"]);
/**
* Whether a `$schema` value declares the 2019-09 dialect — the only supported dialect with
* `$recursiveRef`/`$recursiveAnchor`. Non-throwing (unlike {@linkcode declaredDialect}) so
* wire-layer callers can consult it for documents whose dialect may be unsupported.
*/
function declares2019Dialect($schema) {
return typeof $schema === "string" && DRAFT_2019_09_URIS.has($schema.replace(/#$/, ""));
}
/**
* Classify a schema's declared `$schema` dialect. No `$schema` (or a non-string one) means
* 2020-12. Any other dialect throws a plain `Error` with a clear message rather than letting the
* engine crash on an opaque internal error or silently mis-validate; `remedy` names the calling
* provider's escape hatch in that message.
*/
function declaredDialect(schema, remedy) {
if (!("$schema" in schema) || typeof schema.$schema !== "string") return "2020-12";
const declared = schema.$schema.replace(/#$/, "");
if (DRAFT_2020_12_URIS.has(declared)) return "2020-12";
if (DRAFT_2019_09_URIS.has(declared)) return "2019-09";
if (DRAFT_07_URIS.has(declared) || DRAFT_06_URIS.has(declared)) return "draft-7";
throw new Error(`JSON Schema declares an unsupported dialect ("$schema": "${schema.$schema.slice(0, 200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${remedy}`);
}
//#endregion
export { declares2019Dialect as n, declaredDialect as t };
//# sourceMappingURL=dialects-BOhdv1Fc.mjs.map
@@ -0,0 +1,80 @@
import CacheHandler from './cache-interceptor'
import Dispatcher from './dispatcher'
import RetryHandler from './retry-handler'
import { LookupOptions } from 'node:dns'
export default Interceptors
declare namespace Interceptors {
export type DumpInterceptorOpts = { maxSize?: number }
export type RetryInterceptorOpts = RetryHandler.RetryOptions
export type RedirectInterceptorOpts = { maxRedirections?: number }
export type DecompressInterceptorOpts = {
skipErrorResponses?: boolean
skipStatusCodes?: number[]
}
export type ResponseErrorInterceptorOpts = { throwOnError: boolean }
export type CacheInterceptorOpts = CacheHandler.CacheOptions
// DNS interceptor
export type DNSInterceptorRecord = { address: string, ttl: number, family: 4 | 6 }
export type DNSInterceptorOriginRecords = { records: { 4: { ips: DNSInterceptorRecord[] } | null, 6: { ips: DNSInterceptorRecord[] } | null } }
export type DNSStorage = {
size: number
get(origin: string): DNSInterceptorOriginRecords | null
set(origin: string, records: DNSInterceptorOriginRecords | null, options: { ttl: number }): void
delete(origin: string): void
full(): boolean
}
export type DNSInterceptorOpts = {
maxTTL?: number
maxItems?: number
lookup?: (origin: URL, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, addresses: DNSInterceptorRecord[]) => void) => void
pick?: (origin: URL, records: DNSInterceptorOriginRecords, affinity: 4 | 6) => DNSInterceptorRecord
dualStack?: boolean
affinity?: 4 | 6
storage?: DNSStorage
}
// Deduplicate interceptor
export type DeduplicateMethods = 'GET' | 'HEAD' | 'OPTIONS' | 'TRACE'
export type DeduplicateInterceptorOpts = {
/**
* The HTTP methods to deduplicate.
* Note: Only safe HTTP methods can be deduplicated.
* @default ['GET']
*/
methods?: DeduplicateMethods[]
/**
* Header names that, if present in a request, will cause the request to skip deduplication.
* Header name matching is case-insensitive.
* @default []
*/
skipHeaderNames?: string[]
/**
* Header names to exclude from the deduplication key.
* Requests with different values for these headers will still be deduplicated together.
* Useful for headers like `x-request-id` that vary per request but shouldn't affect deduplication.
* Header name matching is case-insensitive.
* @default []
*/
excludeHeaderNames?: string[]
/**
* Maximum bytes buffered per paused waiting deduplicated handler.
* If a waiting handler remains paused and exceeds this threshold,
* it is failed with an abort error to prevent unbounded memory growth.
* @default 5 * 1024 * 1024
*/
maxBufferSize?: number
}
export function dump (opts?: DumpInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
export function retry (opts?: RetryInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
export function redirect (opts?: RedirectInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
export function decompress (opts?: DecompressInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
export function responseError (opts?: ResponseErrorInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
export function dns (opts?: DNSInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
export function cache (opts?: CacheInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
export function deduplicate (opts?: DeduplicateInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
}
@@ -0,0 +1,22 @@
export {};
import * as webstreams from "stream/web";
type _CompressionStream = typeof globalThis extends { onmessage: any } ? {} : webstreams.CompressionStream;
type _DecompressionStream = typeof globalThis extends { onmessage: any } ? {} : webstreams.DecompressionStream;
declare global {
interface CompressionStream extends _CompressionStream {}
var CompressionStream: typeof globalThis extends {
onmessage: any;
CompressionStream: infer T;
} ? T
: typeof webstreams.CompressionStream;
interface DecompressionStream extends _DecompressionStream {}
var DecompressionStream: typeof globalThis extends {
onmessage: any;
DecompressionStream: infer T;
} ? T
: typeof webstreams.DecompressionStream;
}
@@ -0,0 +1,99 @@
import { HTTPException } from "../../http-exception.js";
import { timingSafeEqual } from "../../utils/buffer.js";
import { auth } from "../../utils/basic-auth.js";
//#region src/middleware/basic-auth/index.ts
/**
* Basic Auth Middleware for Hono.
*
* @see {@link https://hono.dev/docs/middleware/builtin/basic-auth}
*
* @param {BasicAuthOptions} options - The options for the basic authentication middleware.
* @param {string} options.username - The username for authentication.
* @param {string} options.password - The password for authentication.
* @param {string} [options.realm="Secure Area"] - The realm attribute for the WWW-Authenticate header.
* @param {Function} [options.hashFunction] - The hash function used for secure comparison.
* @param {Function} [options.verifyUser] - The function to verify user credentials.
* @param {string | object | MessageFunction} [options.invalidUserMessage="Unauthorized"] - The invalid user message.
* @param {Function} [options.onAuthSuccess] - Callback function called on successful authentication.
* @returns {MiddlewareHandler} The middleware handler function.
* @throws {HTTPException} If neither "username and password" nor "verifyUser" options are provided.
*
* @example
* ```ts
* const app = new Hono()
*
* app.use(
* '/auth/*',
* basicAuth({
* username: 'hono',
* password: 'ahotproject',
* })
* )
*
* app.get('/auth/page', (c) => {
* return c.text('You are authorized')
* })
* ```
*
* @example
* ```ts
* // With onAuthSuccess callback
* app.use(
* '/auth/*',
* basicAuth({
* username: 'hono',
* password: 'ahotproject',
* onAuthSuccess: (c, username) => {
* c.set('user', { name: username, role: 'admin' })
* console.log(`User ${username} authenticated`)
* },
* })
* )
* ```
*/
const basicAuth = (options, ...users) => {
const usernamePasswordInOptions = "username" in options && "password" in options;
const verifyUserInOptions = "verifyUser" in options;
if (!(usernamePasswordInOptions || verifyUserInOptions)) throw new Error("basic auth middleware requires options for \"username and password\" or \"verifyUser\"");
if (!options.realm) options.realm = "Secure Area";
if (!options.invalidUserMessage) options.invalidUserMessage = "Unauthorized";
if (usernamePasswordInOptions) users.unshift({
username: options.username,
password: options.password
});
return async function basicAuth(ctx, next) {
const requestUser = auth(ctx.req.raw);
if (requestUser) {
if (verifyUserInOptions) {
if (await options.verifyUser(requestUser.username, requestUser.password, ctx)) {
if (options.onAuthSuccess) await options.onAuthSuccess(ctx, requestUser.username);
await next();
return;
}
} else for (const user of users) {
const [usernameEqual, passwordEqual] = await Promise.all([timingSafeEqual(user.username, requestUser.username, options.hashFunction), timingSafeEqual(user.password, requestUser.password, options.hashFunction)]);
if (usernameEqual && passwordEqual) {
if (options.onAuthSuccess) await options.onAuthSuccess(ctx, requestUser.username);
await next();
return;
}
}
}
const status = 401;
const headers = { "WWW-Authenticate": "Basic realm=\"" + options.realm?.replace(/"/g, "\\\"") + "\"" };
const responseMessage = typeof options.invalidUserMessage === "function" ? await options.invalidUserMessage(ctx) : options.invalidUserMessage;
const res = typeof responseMessage === "string" ? new Response(responseMessage, {
status,
headers
}) : new Response(JSON.stringify(responseMessage), {
status,
headers: {
...headers,
"content-type": "application/json"
}
});
throw new HTTPException(status, { res });
};
};
//#endregion
export { basicAuth };
@@ -0,0 +1,74 @@
import { MIN_SUBMATCH_GUESSES_SINGLE_CHAR, MIN_SUBMATCH_GUESSES_MULTI_CHAR } from '../data/const.mjs';
import utils from './utils.mjs';
import bruteforceMatcher from '../matcher/bruteforce/scoring.mjs';
import dateMatcher from '../matcher/date/scoring.mjs';
import dictionaryMatcher from '../matcher/dictionary/scoring.mjs';
import regexMatcher from '../matcher/regex/scoring.mjs';
import repeatMatcher from '../matcher/repeat/scoring.mjs';
import sequenceMatcher from '../matcher/sequence/scoring.mjs';
import spatialMatcher from '../matcher/spatial/scoring.mjs';
import separatorMatcher from '../matcher/separator/scoring.mjs';
import wordSequenceMatcher from '../matcher/wordSequence/scoring.mjs';
const getMinGuesses = (match, password) => {
let minGuesses = 1;
if (match.token.length < password.length) {
if (match.token.length === 1) {
minGuesses = MIN_SUBMATCH_GUESSES_SINGLE_CHAR;
} else {
minGuesses = MIN_SUBMATCH_GUESSES_MULTI_CHAR;
}
}
return minGuesses;
};
const matchers = {
bruteforce: bruteforceMatcher,
date: dateMatcher,
dictionary: dictionaryMatcher,
regex: regexMatcher,
repeat: repeatMatcher,
sequence: sequenceMatcher,
spatial: spatialMatcher,
separator: separatorMatcher,
wordSequence: wordSequenceMatcher
};
const getScoring = (options, name, match) => {
if (matchers[name]) {
return matchers[name](match, options);
}
if (options.matchers[name] && 'scoring' in options.matchers[name]) {
return options.matchers[name].scoring(match, options);
}
return 0;
};
// ------------------------------------------------------------------------------
// guess estimation -- one function per match pattern ---------------------------
// ------------------------------------------------------------------------------
var estimateGuesses = (options, match, password) => {
const extraData = {};
// a match's guess estimate doesn't change. cache it.
if ('guesses' in match && match.guesses != null) {
return match;
}
const minGuesses = getMinGuesses(match, password);
const estimationResult = getScoring(options, match.pattern, match);
let guesses = 0;
if (typeof estimationResult === 'number') {
guesses = estimationResult;
} else if (match.pattern === 'dictionary') {
guesses = estimationResult.calculation;
extraData.baseGuesses = estimationResult.baseGuesses;
extraData.uppercaseVariations = estimationResult.uppercaseVariations;
extraData.l33tVariations = estimationResult.l33tVariations;
}
const matchGuesses = Math.max(guesses, minGuesses);
return {
...match,
...extraData,
guesses: matchGuesses,
guessesLog10: utils.log10(matchGuesses)
};
};
export { estimateGuesses as default };
//# sourceMappingURL=estimate.mjs.map
@@ -0,0 +1,41 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
//#region src/middleware/pretty-json/index.ts
const jsonContentTypeRegex = /^application\/(?:[a-z0-9._-]+\+)?json(?=$|[;\s])/i;
/**
* Pretty JSON Middleware for Hono.
*
* @see {@link https://hono.dev/docs/middleware/builtin/pretty-json}
*
* @param options - The options for the pretty JSON middleware.
* @returns {MiddlewareHandler} The middleware handler function.
*
* @example
* ```ts
* const app = new Hono()
*
* app.use(prettyJSON()) // With options: prettyJSON({ space: 4 })
* app.get('/', (c) => {
* return c.json({ message: 'Hono!' })
* })
* ```
*/
const prettyJSON = (options) => {
const targetQuery = options?.query ?? "pretty";
return async function prettyJSON(c, next) {
const pretty = options?.force || c.req.query(targetQuery) || c.req.query(targetQuery) === "";
await next();
const contentType = c.res.headers.get("Content-Type");
if (pretty && contentType && jsonContentTypeRegex.test(contentType)) {
let obj;
try {
obj = await c.res.clone().json();
} catch {
return;
}
c.res = new Response(JSON.stringify(obj, null, options?.space ?? 2), c.res);
c.res.headers.delete("Content-Length");
}
};
};
//#endregion
exports.prettyJSON = prettyJSON;
@@ -0,0 +1,247 @@
import { FilePosition } from './input.js'
declare namespace CssSyntaxError {
/**
* A position that is part of a range.
*/
export interface RangePosition {
/**
* The column number in the input.
*/
column: number
/**
* The line number in the input.
*/
line: number
}
export { CssSyntaxError_ as default }
}
/**
* The CSS parser throws this error for broken CSS.
*
* Custom parsers can throw this error for broken custom syntax using
* the `Node#error` method.
*
* PostCSS will use the input source map to detect the original error location.
* If you wrote a Sass file, compiled it to CSS and then parsed it with PostCSS,
* PostCSS will show the original position in the Sass file.
*
* If you need the position in the PostCSS input
* (e.g., to debug the previous compiler), use `error.input.file`.
*
* ```js
* // Raising error from plugin
* throw node.error('Unknown variable', { plugin: 'postcss-vars' })
* ```
*
* ```js
* // Catching and checking syntax error
* try {
* postcss.parse('a{')
* } catch (error) {
* if (error.name === 'CssSyntaxError') {
* error //=> CssSyntaxError
* }
* }
* ```
*/
declare class CssSyntaxError_ extends Error {
/**
* Source column of the error.
*
* ```js
* error.column //=> 1
* error.input.column //=> 4
* ```
*
* PostCSS will use the input source map to detect the original location.
* If you need the position in the PostCSS input, use `error.input.column`.
*/
column?: number
/**
* Source column of the error's end, exclusive. Provided if the error pertains
* to a range.
*
* ```js
* error.endColumn //=> 1
* error.input.endColumn //=> 4
* ```
*
* PostCSS will use the input source map to detect the original location.
* If you need the position in the PostCSS input, use `error.input.endColumn`.
*/
endColumn?: number
/**
* Source line of the error's end, exclusive. Provided if the error pertains
* to a range.
*
* ```js
* error.endLine //=> 3
* error.input.endLine //=> 4
* ```
*
* PostCSS will use the input source map to detect the original location.
* If you need the position in the PostCSS input, use `error.input.endLine`.
*/
endLine?: number
/**
* Absolute path to the broken file.
*
* ```js
* error.file //=> 'a.sass'
* error.input.file //=> 'a.css'
* ```
*
* PostCSS will use the input source map to detect the original location.
* If you need the position in the PostCSS input, use `error.input.file`.
*/
file?: string
/**
* Input object with PostCSS internal information
* about input file. If input has source map
* from previous tool, PostCSS will use origin
* (for example, Sass) source. You can use this
* object to get PostCSS input source.
*
* ```js
* error.input.file //=> 'a.css'
* error.file //=> 'a.sass'
* ```
*/
input?: FilePosition
/**
* Source line of the error.
*
* ```js
* error.line //=> 2
* error.input.line //=> 4
* ```
*
* PostCSS will use the input source map to detect the original location.
* If you need the position in the PostCSS input, use `error.input.line`.
*/
line?: number
/**
* Full error text in the GNU error format
* with plugin, file, line and column.
*
* ```js
* error.message //=> 'a.css:1:1: Unclosed block'
* ```
*/
message: string
/**
* Always equal to `'CssSyntaxError'`. You should always check error type
* by `error.name === 'CssSyntaxError'`
* instead of `error instanceof CssSyntaxError`,
* because npm could have several PostCSS versions.
*
* ```js
* if (error.name === 'CssSyntaxError') {
* error //=> CssSyntaxError
* }
* ```
*/
name: 'CssSyntaxError'
/**
* Plugin name, if error came from plugin.
*
* ```js
* error.plugin //=> 'postcss-vars'
* ```
*/
plugin?: string
/**
* Error message.
*
* ```js
* error.message //=> 'Unclosed block'
* ```
*/
reason: string
/**
* Source code of the broken file.
*
* ```js
* error.source //=> 'a { b {} }'
* error.input.source //=> 'a b { }'
* ```
*/
source?: string
stack: string
/**
* Instantiates a CSS syntax error. Can be instantiated for a single position
* or for a range.
* @param message Error message.
* @param lineOrStartPos If for a single position, the line number, or if for
* a range, the inclusive start position of the error.
* @param columnOrEndPos If for a single position, the column number, or if for
* a range, the exclusive end position of the error.
* @param source Source code of the broken file.
* @param file Absolute path to the broken file.
* @param plugin PostCSS plugin name, if error came from plugin.
*/
constructor(
message: string,
lineOrStartPos?: CssSyntaxError.RangePosition | number,
columnOrEndPos?: CssSyntaxError.RangePosition | number,
source?: string,
file?: string,
plugin?: string
)
/**
* Returns a few lines of CSS source that caused the error.
*
* If the CSS has an input source map without `sourceContent`,
* this method will return an empty string.
*
* ```js
* error.showSourceCode() //=> " 4 | }
* // 5 | a {
* // > 6 | bad
* // | ^
* // 7 | }
* // 8 | b {"
* ```
*
* @param color Whether arrow will be colored red by terminal
* color codes. By default, PostCSS will detect
* color support by `process.stdout.isTTY`
* and `process.env.NODE_DISABLE_COLORS`.
* @return Few lines of CSS source that caused the error.
*/
showSourceCode(color?: boolean): string
/**
* Returns error position, message and source code of the broken part.
*
* ```js
* error.toString() //=> "CssSyntaxError: app.css:1:1: Unclosed block
* // > 1 | a {
* // | ^"
* ```
*
* @return Error position, message and source code.
*/
toString(): string
}
declare class CssSyntaxError extends CssSyntaxError_ {}
export = CssSyntaxError
@@ -0,0 +1,11 @@
'use strict';
var $isNaN = require('./isNaN');
/** @type {import('./sign')} */
module.exports = function sign(number) {
if ($isNaN(number) || number === 0) {
return number;
}
return number < 0 ? -1 : +1;
};
@@ -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 BringToFront = createLucideIcon("BringToFront", [
["rect", { x: "8", y: "8", width: "8", height: "8", rx: "2", key: "yj20xf" }],
["path", { d: "M4 10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2", key: "1ltk23" }],
["path", { d: "M14 20a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2", key: "1q24h9" }]
]);
export { BringToFront as default };
//# sourceMappingURL=bring-to-front.js.map
@@ -0,0 +1 @@
{"version":3,"file":"bean.js","sources":["../../../src/icons/bean.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Bean\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTAuMTY1IDYuNTk4QzkuOTU0IDcuNDc4IDkuNjQgOC4zNiA5IDljLS42NC42NC0xLjUyMS45NTQtMi40MDIgMS4xNjVBNiA2IDAgMCAwIDggMjJjNy43MzIgMCAxNC02LjI2OCAxNC0xNGE2IDYgMCAwIDAtMTEuODM1LTEuNDAyWiIgLz4KICA8cGF0aCBkPSJNNS4zNDEgMTAuNjJhNCA0IDAgMSAwIDUuMjc5LTUuMjgiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/bean\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 Bean = createLucideIcon('Bean', [\n [\n 'path',\n {\n d: 'M10.165 6.598C9.954 7.478 9.64 8.36 9 9c-.64.64-1.521.954-2.402 1.165A6 6 0 0 0 8 22c7.732 0 14-6.268 14-14a6 6 0 0 0-11.835-1.402Z',\n key: '1tvzk7',\n },\n ],\n ['path', { d: 'M5.341 10.62a4 4 0 1 0 5.279-5.28', key: '2cyri2' }],\n]);\n\nexport default Bean;\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,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA;AAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAqC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AACpE,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"file":"flask-round.js","sources":["../../../src/icons/flask-round.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name FlaskRound\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTAgMnY2LjI5MmE3IDcgMCAxIDAgNCAwVjIiIC8+CiAgPHBhdGggZD0iTTUgMTVoMTQiIC8+CiAgPHBhdGggZD0iTTguNSAyaDciIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/flask-round\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 FlaskRound = createLucideIcon('FlaskRound', [\n ['path', { d: 'M10 2v6.292a7 7 0 1 0 4 0V2', key: '1s42pc' }],\n ['path', { d: 'M5 15h14', key: 'm0yey3' }],\n ['path', { d: 'M8.5 2h7', key: 'csnxdl' }],\n]);\n\nexport default FlaskRound;\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,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA+B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC5D,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC3C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,624 @@
flf2a$ 6 4 20 0 11
Based on cursive(6) by Jan Wolter <janc@crim.eecs.umich.edu> on 24 Jul 1985
Figlet-ized and by Wendell Hicken <whicken@parasoft.com> on 5 Mar 1994
Added missing punctuation and numbers
Ammended by Jerrad Pierce <jpierce@cpan.org> on 8 Aug 2002
Underscore and dash have been updated to more closely match cursive(6)
The '_' character is treated in a special way. It may be
inserted in the text anywhere you wish to lengthen a con-
necting line between two letters.
$$@
$$@
$$@
$$@
$$@
$$@@
@
/@
/ @
' @
o @
@@
@
o o@
' '@
@
@
@@
/ /@
-/-/-@
-/-/- @
/ / @
@
@@
,-/-@
(_/ @
/ ) @
-/-' @
@
@@
() /@
/ @
/ @
/ ()@
@
@@
() @
/\ @
( X @
\/ \@
@
@@
@
o@
'@
@
@
@@
_/@
/ @
/ @
/ @
@
@@
/@
/@
_/ @
/ @
@
@@
@
\ / @
--X--@
/ \ @
@
@@
@
/ @
--/--@
/ @
@
@@
@
@
@
o@
'@
@@
$$$@
$$$@
---@
$$$@
$$$@
$$@@
@
@
@
o@
@
@@
/@
/ @
/ @
/ @
@
@@
__ @
/ )@
/ / @
(__/ @
@
@@
_@
/@
/ @
/ @
@
@@
__ @
)@
.--' @
(__ @
@
@@
__ @
)@
-/ @
___/ @
@
@@
@
/ /@
'--/ @
/ @
@
@@
___@
/ @
'--. @
___) @
@
@@
@
/ @
/_ @
(__)@
@
@@
___@
/@
-/-@
/ @
@
@@
__ @
( )@
./' @
(__) @
@
@@
__ @
(__)@
/ @
/ @
@
@@
@
@
o@
@
o @
@@
@
@
o@
@
o @
' @@
/@
/ @
\ @
\@
@
@@
@
@
---@
---@
@
@@
\ @
\@
/@
/ @
@
@@
__ @
__)@
/ @
o @
@
@@
@
_ @
/o\ @
(____@
@
@@
__ @
/ )@
/--/ @
/ (_ @
@
@@
__ @
/ )@
/--< @
/___/_@
@
@@
__ @
/ )@
/ @
(__/ @
@
@@
__ @
/ )@
/ / @
/__/_ @
@
@@
__ @
/ `@
/-- @
(___, @
@
@@
_____@
/ '@
,-/-, @
(_/ @
@
@@
() ,@
/`-'|@
/ / @
/__-<_ @
@
@@
_ ,@
' ) / @
/--/ @
/ (_ @
@
@@
_ @
| )@
,---|/ @
\_/ \_@
@
@@
___ @
( >@
__/_@
/ / @
<_/ @
@@
_ ,@
' ) / @
/-< @
/ ) @
@
@@
_@
_//@
/ @
/___@
@
@@
_ _ _ @
' ) ) )@
/ / / @
/ ' (_ @
@
@@
_ __ @
' ) )@
/ / @
/ (_ @
@
@@
__ @
/ ')@
/ / @
(__/ @
@
@@
_ __ @
' ) )@
/--' @
/ @
@
@@
__ @
/ )@
/ / @
(_\/ @
` @
@@
_ __ @
' ) )@
/--' @
/ \_ @
@
@@
() @
/\ @
/ ) @
/__/__@
@
@@
______@
/ @
--/ @
(_/ @
@
@@
_ __@
' ) / @
/ / @
(__/ @
@
@@
_ _@
' ) / @
( / @
\/ @
@
@@
_ _@
' ) / @
/ / / @
(_(_/ @
@
@@
_ ,@
' \ / @
X @
/ \_@
@
@@
_ ,@
' ) / @
/ / @
(__/_ @
// @
(/ @@
___@
/@
/ @
/__@
@
@@
_@
/ @
/ @
/_ @
@
@@
\ @
\ @
\ @
\@
@
@@
_@
/@
/ @
_/ @
@
@@
/\@
@
@
@
@
@@
@
@
@
_@
@
@@
@
o@
`@
@
@
@@
@
@
__. @
(_/|_@
@
@@
@
/ @
/__@
/_) @
@
@@
@
@
_.@
(__@
@
@@
@
/@
__/ @
(_/_ @
@
@@
@
@
_ @
</_@
@
@@
@
/)@
// @
//_ @
/> @
</ @@
@
@
_, @
(_)_@
/| @
|/ @@
@
/ @
/_ @
/ /_@
@
@@
@
@
o@
<_@
@
@@
@
@
o@
/_@
/ @
-' @@
@
/ @
/_ @
/ <_@
@
@@
_@
//@
// @
</_ @
@
@@
@
@
______ @
/ / / <_@
@
@@
@
@
____ @
/ / <_@
@
@@
@
@
__@
(_)@
@
@@
@
@
_ @
/_)_@
/ @
' @@
@
@
_, @
(_)_@
/> @
|/ @@
@
@
__ @
/ (_@
@
@@
@
@
_ @
/_)_@
@
@@
@
_/_@
/ @
<__ @
@
@@
@
@
. .@
(_/_@
@
@@
@
@
, _@
\/ @
@
@@
@
@
, , ,@
(_(_/_@
@
@@
@
@
_., @
/ /\_@
@
@@
@
@
__ ,@
/ (_/_@
/ @
' @@
@
@
__. @
/ |_@
(| @
@@
_/@
_/ @
/ @
/ @
@
@@
/@
/ @
/ @
/ @
@
@@
/ @
/_@
_/ @
/ @
@
@@
_ @
/ \_/@
@
@
@
@@
o__o@
/ )@
/--/ @
/ (_ @
@
@@
o__o@
/ ')@
/ / @
(__/ @
@
@@
_o o__@
' ) / @
/ / @
(__/ @
@
@@
@
o o @
__. @
(_/|_@
@
@@
@
o o@
__@
(_)@
@
@@
@
o o@
. .@
(_/_@
@
@@
__ @
/ )@
/--< @
_/___/_@
/ @
@@
@@ -0,0 +1,316 @@
"use strict";
"use client";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var index_exports = {};
__export(index_exports, {
Checkbox: () => Checkbox,
CheckboxIndicator: () => CheckboxIndicator,
Indicator: () => CheckboxIndicator,
Root: () => Checkbox,
createCheckboxScope: () => createCheckboxScope,
unstable_BubbleInput: () => CheckboxBubbleInput,
unstable_CheckboxBubbleInput: () => CheckboxBubbleInput,
unstable_CheckboxProvider: () => CheckboxProvider,
unstable_CheckboxTrigger: () => CheckboxTrigger,
unstable_Provider: () => CheckboxProvider,
unstable_Trigger: () => CheckboxTrigger
});
module.exports = __toCommonJS(index_exports);
// src/checkbox.tsx
var React = __toESM(require("react"));
var import_react_compose_refs = require("@radix-ui/react-compose-refs");
var import_react_context = require("@radix-ui/react-context");
var import_primitive = require("@radix-ui/primitive");
var import_react_use_controllable_state = require("@radix-ui/react-use-controllable-state");
var import_react_use_previous = require("@radix-ui/react-use-previous");
var import_react_use_size = require("@radix-ui/react-use-size");
var import_react_presence = require("@radix-ui/react-presence");
var import_react_primitive = require("@radix-ui/react-primitive");
var import_jsx_runtime = require("react/jsx-runtime");
var CHECKBOX_NAME = "Checkbox";
var [createCheckboxContext, createCheckboxScope] = (0, import_react_context.createContextScope)(CHECKBOX_NAME);
var [CheckboxProviderImpl, useCheckboxContext] = createCheckboxContext(CHECKBOX_NAME);
function CheckboxProvider(props) {
const {
__scopeCheckbox,
checked: checkedProp,
children,
defaultChecked,
disabled,
form,
name,
onCheckedChange,
required,
value = "on",
// @ts-expect-error
internal_do_not_use_render
} = props;
const [checked, setChecked] = (0, import_react_use_controllable_state.useControllableState)({
prop: checkedProp,
defaultProp: defaultChecked ?? false,
onChange: onCheckedChange,
caller: CHECKBOX_NAME
});
const [control, setControl] = React.useState(null);
const [bubbleInput, setBubbleInput] = React.useState(null);
const hasConsumerStoppedPropagationRef = React.useRef(false);
const isFormControl = control ? !!form || !!control.closest("form") : (
// We set this to true by default so that events bubble to forms without JS (SSR)
true
);
const context = {
checked,
disabled,
setChecked,
control,
setControl,
name,
form,
value,
hasConsumerStoppedPropagationRef,
required,
defaultChecked: isIndeterminate(defaultChecked) ? false : defaultChecked,
isFormControl,
bubbleInput,
setBubbleInput
};
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
CheckboxProviderImpl,
{
scope: __scopeCheckbox,
...context,
children: isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children
}
);
}
var TRIGGER_NAME = "CheckboxTrigger";
var CheckboxTrigger = React.forwardRef(
({ __scopeCheckbox, onKeyDown, onClick, ...checkboxProps }, forwardedRef) => {
const {
control,
value,
disabled,
checked,
required,
setControl,
setChecked,
hasConsumerStoppedPropagationRef,
isFormControl,
bubbleInput
} = useCheckboxContext(TRIGGER_NAME, __scopeCheckbox);
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, setControl);
const initialCheckedStateRef = React.useRef(checked);
React.useEffect(() => {
const form = control?.form;
if (form) {
const reset = () => setChecked(initialCheckedStateRef.current);
form.addEventListener("reset", reset);
return () => form.removeEventListener("reset", reset);
}
}, [control, setChecked]);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_primitive.Primitive.button,
{
type: "button",
role: "checkbox",
"aria-checked": isIndeterminate(checked) ? "mixed" : checked,
"aria-required": required,
"data-state": getState(checked),
"data-disabled": disabled ? "" : void 0,
disabled,
value,
...checkboxProps,
ref: composedRefs,
onKeyDown: (0, import_primitive.composeEventHandlers)(onKeyDown, (event) => {
if (event.key === "Enter") event.preventDefault();
}),
onClick: (0, import_primitive.composeEventHandlers)(onClick, (event) => {
setChecked((prevChecked) => isIndeterminate(prevChecked) ? true : !prevChecked);
if (bubbleInput && isFormControl) {
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
}
})
}
);
}
);
CheckboxTrigger.displayName = TRIGGER_NAME;
var Checkbox = React.forwardRef(
(props, forwardedRef) => {
const {
__scopeCheckbox,
name,
checked,
defaultChecked,
required,
disabled,
value,
onCheckedChange,
form,
...checkboxProps
} = props;
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
CheckboxProvider,
{
__scopeCheckbox,
checked,
defaultChecked,
disabled,
required,
onCheckedChange,
name,
form,
value,
internal_do_not_use_render: ({ isFormControl }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
CheckboxTrigger,
{
...checkboxProps,
ref: forwardedRef,
__scopeCheckbox
}
),
isFormControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
CheckboxBubbleInput,
{
__scopeCheckbox
}
)
] })
}
);
}
);
Checkbox.displayName = CHECKBOX_NAME;
var INDICATOR_NAME = "CheckboxIndicator";
var CheckboxIndicator = React.forwardRef(
(props, forwardedRef) => {
const { __scopeCheckbox, forceMount, ...indicatorProps } = props;
const context = useCheckboxContext(INDICATOR_NAME, __scopeCheckbox);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_presence.Presence,
{
present: forceMount || isIndeterminate(context.checked) || context.checked === true,
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_primitive.Primitive.span,
{
"data-state": getState(context.checked),
"data-disabled": context.disabled ? "" : void 0,
...indicatorProps,
ref: forwardedRef,
style: { pointerEvents: "none", ...props.style }
}
)
}
);
}
);
CheckboxIndicator.displayName = INDICATOR_NAME;
var BUBBLE_INPUT_NAME = "CheckboxBubbleInput";
var CheckboxBubbleInput = React.forwardRef(
({ __scopeCheckbox, ...props }, forwardedRef) => {
const {
control,
hasConsumerStoppedPropagationRef,
checked,
defaultChecked,
required,
disabled,
name,
value,
form,
bubbleInput,
setBubbleInput
} = useCheckboxContext(BUBBLE_INPUT_NAME, __scopeCheckbox);
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, setBubbleInput);
const prevChecked = (0, import_react_use_previous.usePrevious)(checked);
const controlSize = (0, import_react_use_size.useSize)(control);
React.useEffect(() => {
const input = bubbleInput;
if (!input) return;
const inputProto = window.HTMLInputElement.prototype;
const descriptor = Object.getOwnPropertyDescriptor(
inputProto,
"checked"
);
const setChecked = descriptor.set;
const bubbles = !hasConsumerStoppedPropagationRef.current;
if (prevChecked !== checked && setChecked) {
const event = new Event("click", { bubbles });
input.indeterminate = isIndeterminate(checked);
setChecked.call(input, isIndeterminate(checked) ? false : checked);
input.dispatchEvent(event);
}
}, [bubbleInput, prevChecked, checked, hasConsumerStoppedPropagationRef]);
const defaultCheckedRef = React.useRef(isIndeterminate(checked) ? false : checked);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_primitive.Primitive.input,
{
type: "checkbox",
"aria-hidden": true,
defaultChecked: defaultChecked ?? defaultCheckedRef.current,
required,
disabled,
name,
value,
form,
...props,
tabIndex: -1,
ref: composedRefs,
style: {
...props.style,
...controlSize,
position: "absolute",
pointerEvents: "none",
opacity: 0,
margin: 0,
// We transform because the input is absolutely positioned but we have
// rendered it **after** the button. This pulls it back to sit on top
// of the button.
transform: "translateX(-100%)"
}
}
);
}
);
CheckboxBubbleInput.displayName = BUBBLE_INPUT_NAME;
function isFunction(value) {
return typeof value === "function";
}
function isIndeterminate(checked) {
return checked === "indeterminate";
}
function getState(checked) {
return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
}
//# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
import type * as React from 'react'
declare module '@tanstack/router-core' {
export interface SerializerExtensions {
ReadableStream: React.JSX.Element
}
}
@@ -0,0 +1 @@
{"version":3,"names":["_regenerator","require","_regeneratorAsyncIterator","_regeneratorAsyncGen","innerFn","outerFn","self","tryLocsList","PromiseImpl","regeneratorAsyncIterator","regenerator","w","Promise"],"sources":["../../src/helpers/regeneratorAsyncGen.ts"],"sourcesContent":["/* @minVersion 7.27.0 */\n/* @mangleFns */\n\nimport regenerator from \"./regenerator.ts\";\nimport regeneratorAsyncIterator from \"./regeneratorAsyncIterator.ts\";\n\nexport default /* @no-mangle */ function _regeneratorAsyncGen(\n innerFn: Function,\n outerFn: Function,\n self: any,\n tryLocsList: any[],\n PromiseImpl: PromiseConstructor | undefined,\n) {\n return new (regeneratorAsyncIterator as any)(\n regenerator().w(innerFn as any, outerFn, self, tryLocsList),\n PromiseImpl || Promise,\n );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,yBAAA,GAAAD,OAAA;AAEgC,SAASE,oBAAoBA,CAC3DC,OAAiB,EACjBC,OAAiB,EACjBC,IAAS,EACTC,WAAkB,EAClBC,WAA2C,EAC3C;EACA,OAAO,IAAKC,iCAAwB,CAClC,IAAAC,oBAAW,EAAC,CAAC,CAACC,CAAC,CAACP,OAAO,EAASC,OAAO,EAAEC,IAAI,EAAEC,WAAW,CAAC,EAC3DC,WAAW,IAAII,OACjB,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1 @@
module.exports={A:{A:{"1":"_A","2":"_Z"},B:{"1":"_J"},C:{"1":"_FI","2":"_OC","33":"_FC LD"},D:{"1":"_NF","2":"_UC","33":"_oD _WF"},E:{"1":"_jB","2":"_4","33":"_iG"},F:{"1":"_yF","2":"_QD","33":"C cD","36":"_tB"},G:{"1":"_2","2":"_d","33":"_xC"},H:{"2":"1D"},I:{"1":"_X","2":"_LB","33":"_oF"},J:{"1":"A","2":"D"},K:{"1":"_ZB","2":"_A","33":"C","36":"_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 Repeating Gradients",D:true};
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_K","2":"_I"},C:{"1":"_4P _p","2":"_f","33":"_hE _nD _WB _MB","164":"_LO"},D:{"1":"_LJ _KE","2":"_vF","132":"_6B _8G yB"},E:{"1":"_bE","2":"_4C","132":"_iC _oJ _zB _kL"},F:{"1":"_XO","2":"_1G","132":"_qK","164":"_6 _2K"},G:{"1":"_TD","2":"_r","132":"_JC _EJ _QH"},H:{"164":"1D"},I:{"1":"I","2":"_W","132":"_y"},J:{"132":"_B"},K:{"1":"H","2":"A","164":"_bD"},L:{"1":"I"},M:{"1":"YC"},N:{"2":"_A"},O:{"1":"bC"},P:{"1":"_F"},Q:{"1":"JE"},R:{"1":"KE"},S:{"164":"_C"}},B:4,C:"CSS3 tab-size",D:true};
@@ -0,0 +1,37 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @noformat
*/
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getVisitorKeys = getVisitorKeys;
exports.isNode = isNode;
var _ESTreeVisitorKeys = _interopRequireDefault(require("../generated/ESTreeVisitorKeys"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function isNode(thing)
/*: implies thing is {+[string]: mixed} */
{
return typeof thing === 'object' && thing != null && typeof thing.type === 'string';
}
function getVisitorKeys(node, visitorKeys) {
const keys = (visitorKeys != null ? visitorKeys : _ESTreeVisitorKeys.default)[node.type];
if (keys == null) {
throw new Error(`No visitor keys found for node type "${node.type}".`);
} // $FlowExpectedError[prop-missing]
return keys;
}
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 Evgeny Poberezkin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,17 @@
import uri, { URIComponents, URIComponent, Options, options } from '..'
import { expectDeprecated, expectType } from 'tsd'
const parsed = uri.parse('foo')
expectType<URIComponents>(parsed)
const parsed2 = uri.parse('foo', {
domainHost: true,
scheme: 'https',
unicodeSupport: false
})
expectType<URIComponents>(parsed2)
expectType<URIComponent>({} as URIComponents)
expectDeprecated({} as URIComponents)
expectType<Options>({} as options)
expectDeprecated({} as options)
@@ -0,0 +1,7 @@
import * as core from "../core/index.cjs";
import * as schemas from "./schemas.cjs";
export declare function string<T = unknown>(params?: string | core.$ZodStringParams): schemas.ZodMiniString<T>;
export declare function number<T = unknown>(params?: string | core.$ZodNumberParams): schemas.ZodMiniNumber<T>;
export declare function boolean<T = unknown>(params?: string | core.$ZodBooleanParams): schemas.ZodMiniBoolean<T>;
export declare function bigint<T = unknown>(params?: string | core.$ZodBigIntParams): schemas.ZodMiniBigInt<T>;
export declare function date<T = unknown>(params?: string | core.$ZodDateParams): schemas.ZodMiniDate<T>;