docs: 仓库链接指向本镜像仓库
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s

This commit is contained in:
TanTan committed 2026-11-13 09:25:58 +08:00
1 parent f954252a34
commit e311ca3275
35554 files changed
+6229626 -4

No files matched your search

@@ -0,0 +1 @@
{"version":3,"file":"unsafe.d.ts","sourceRoot":"","sources":["unsafe.js"],"names":[],"mappings":"AAqBA,4BAA4B;AAC5B,qBADW,KAAK,CAAC,MAAM,CAAC,CA4HvB;4BAhJuC,wBAAwB"}
@@ -0,0 +1,67 @@
{
"name": "@heroui/table",
"version": "2.2.27",
"description": "Tables are used to display tabular data using rows and columns. ",
"keywords": [
"table"
],
"author": "HeroUI <support@heroui.com>",
"homepage": "https://heroui.com",
"license": "MIT",
"main": "dist/index.js",
"sideEffects": false,
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/heroui-inc/heroui.git",
"directory": "packages/components/table"
},
"bugs": {
"url": "https://github.com/heroui-inc/heroui/issues"
},
"peerDependencies": {
"react": ">=18 || >=19.0.0-rc.0",
"react-dom": ">=18 || >=19.0.0-rc.0",
"@heroui/theme": ">=2.4.17",
"@heroui/system": ">=2.4.18"
},
"dependencies": {
"@react-aria/focus": "3.21.2",
"@react-aria/interactions": "3.25.6",
"@react-aria/table": "3.17.8",
"@react-aria/visually-hidden": "3.8.28",
"@react-stately/table": "3.15.1",
"@react-stately/virtualizer": "4.4.4",
"@react-types/grid": "3.3.6",
"@react-types/table": "3.13.4",
"@tanstack/react-virtual": "3.11.3",
"@heroui/checkbox": "2.3.27",
"@heroui/react-utils": "2.1.14",
"@heroui/shared-icons": "2.1.10",
"@heroui/shared-utils": "2.1.12",
"@heroui/spacer": "2.2.21"
},
"clean-package": "../../../clean-package.config.json",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},
"./package.json": "./package.json"
},
"scripts": {
"build": "tsup src --dts",
"build:fast": "tsup src",
"dev": "pnpm build:fast --watch",
"clean": "rimraf dist .turbo",
"typecheck": "tsc --noEmit"
}
}
@@ -0,0 +1,780 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _buffer = require("./buffer.js");
var _index = require("./node/index.js");
var n = _index;
var _t = require("@babel/types");
var _tokenMap = require("./token-map.js");
var generatorFunctions = require("./generators/index.js");
var _deprecated = require("./generators/deprecated.js");
const {
isExpression,
isFunction,
isStatement,
isClassBody,
isTSInterfaceBody,
isTSEnumMember
} = _t;
const SCIENTIFIC_NOTATION = /e/i;
const ZERO_DECIMAL_INTEGER = /\.0+$/;
const HAS_NEWLINE = /[\n\r\u2028\u2029]/;
const HAS_NEWLINE_OR_BlOCK_COMMENT_END = /[\n\r\u2028\u2029]|\*\//;
function commentIsNewline(c) {
return c.type === "CommentLine" || HAS_NEWLINE.test(c.value);
}
const {
needsParens
} = n;
class Printer {
constructor(format, map, tokens = null, originalCode = null) {
this.tokenContext = _index.TokenContext.normal;
this._tokens = null;
this._originalCode = null;
this._currentNode = null;
this._indent = 0;
this._indentRepeat = 0;
this._insideAux = false;
this._noLineTerminator = false;
this._noLineTerminatorAfterNode = null;
this._printAuxAfterOnNextUserNode = false;
this._printedComments = new Set();
this._endsWithInteger = false;
this._endsWithWord = false;
this._endsWithDiv = false;
this._lastCommentLine = 0;
this._endsWithInnerRaw = false;
this._indentInnerComments = true;
this.tokenMap = null;
this._boundGetRawIdentifier = this._getRawIdentifier.bind(this);
this._printSemicolonBeforeNextNode = -1;
this._printSemicolonBeforeNextToken = -1;
this.format = format;
this._tokens = tokens;
this._originalCode = originalCode;
this._indentRepeat = format.indent.style.length;
this._inputMap = (map == null ? void 0 : map._inputMap) || null;
this._buf = new _buffer.default(map, format.indent.style[0]);
}
enterForStatementInit() {
this.tokenContext |= _index.TokenContext.forInitHead | _index.TokenContext.forInOrInitHeadAccumulate;
return () => this.tokenContext = _index.TokenContext.normal;
}
enterForXStatementInit(isForOf) {
if (isForOf) {
this.tokenContext |= _index.TokenContext.forOfHead;
return null;
} else {
this.tokenContext |= _index.TokenContext.forInHead | _index.TokenContext.forInOrInitHeadAccumulate;
return () => this.tokenContext = _index.TokenContext.normal;
}
}
enterDelimited() {
const oldTokenContext = this.tokenContext;
const oldNoLineTerminatorAfterNode = this._noLineTerminatorAfterNode;
if (!(oldTokenContext & _index.TokenContext.forInOrInitHeadAccumulate) && oldNoLineTerminatorAfterNode === null) {
return () => {};
}
this._noLineTerminatorAfterNode = null;
this.tokenContext = _index.TokenContext.normal;
return () => {
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
this.tokenContext = oldTokenContext;
};
}
generate(ast) {
if (this.format.preserveFormat) {
this.tokenMap = new _tokenMap.TokenMap(ast, this._tokens, this._originalCode);
}
this.print(ast);
this._maybeAddAuxComment();
return this._buf.get();
}
indent() {
const {
format
} = this;
if (format.preserveFormat || format.compact || format.concise) {
return;
}
this._indent++;
}
dedent() {
const {
format
} = this;
if (format.preserveFormat || format.compact || format.concise) {
return;
}
this._indent--;
}
semicolon(force = false) {
this._maybeAddAuxComment();
if (force) {
this._appendChar(59);
this._noLineTerminator = false;
return;
}
if (this.tokenMap) {
const node = this._currentNode;
if (node.start != null && node.end != null) {
if (!this.tokenMap.endMatches(node, ";")) {
this._printSemicolonBeforeNextNode = this._buf.getCurrentLine();
return;
}
const indexes = this.tokenMap.getIndexes(this._currentNode);
this._catchUpTo(this._tokens[indexes[indexes.length - 1]].loc.start);
}
}
this._queue(59);
this._noLineTerminator = false;
}
rightBrace(node) {
if (this.format.minified) {
this._buf.removeLastSemicolon();
}
this.sourceWithOffset("end", node.loc, -1);
this.tokenChar(125);
}
rightParens(node) {
this.sourceWithOffset("end", node.loc, -1);
this.tokenChar(41);
}
space(force = false) {
const {
format
} = this;
if (format.compact || format.preserveFormat) return;
if (force) {
this._space();
} else if (this._buf.hasContent()) {
const lastCp = this.getLastChar();
if (lastCp !== 32 && lastCp !== 10) {
this._space();
}
}
}
word(str, noLineTerminatorAfter = false) {
this.tokenContext &= _index.TokenContext.forInOrInitHeadAccumulatePassThroughMask;
this._maybePrintInnerComments(str);
this._maybeAddAuxComment();
if (this.tokenMap) this._catchUpToCurrentToken(str);
if (this._endsWithWord || this._endsWithDiv && str.charCodeAt(0) === 47) {
this._space();
}
this._append(str, false);
this._endsWithWord = true;
this._noLineTerminator = noLineTerminatorAfter;
}
number(str, number) {
function isNonDecimalLiteral(str) {
if (str.length > 2 && str.charCodeAt(0) === 48) {
const secondChar = str.charCodeAt(1);
return secondChar === 98 || secondChar === 111 || secondChar === 120;
}
return false;
}
this.word(str);
this._endsWithInteger = Number.isInteger(number) && !isNonDecimalLiteral(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str.charCodeAt(str.length - 1) !== 46;
}
token(str, maybeNewline = false, occurrenceCount = 0) {
this.tokenContext &= _index.TokenContext.forInOrInitHeadAccumulatePassThroughMask;
this._maybePrintInnerComments(str, occurrenceCount);
this._maybeAddAuxComment();
if (this.tokenMap) this._catchUpToCurrentToken(str, occurrenceCount);
const lastChar = this.getLastChar();
const strFirst = str.charCodeAt(0);
if (lastChar === 33 && (str === "--" || strFirst === 61) || strFirst === 43 && lastChar === 43 || strFirst === 45 && lastChar === 45 || strFirst === 46 && this._endsWithInteger) {
this._space();
}
this._append(str, maybeNewline);
this._noLineTerminator = false;
}
tokenChar(char) {
this.tokenContext &= _index.TokenContext.forInOrInitHeadAccumulatePassThroughMask;
const str = String.fromCharCode(char);
this._maybePrintInnerComments(str);
this._maybeAddAuxComment();
if (this.tokenMap) this._catchUpToCurrentToken(str);
const lastChar = this.getLastChar();
if (char === 43 && lastChar === 43 || char === 45 && lastChar === 45 || char === 46 && this._endsWithInteger) {
this._space();
}
this._appendChar(char);
this._noLineTerminator = false;
}
newline(i = 1, force) {
if (i <= 0) return;
if (!force) {
if (this.format.retainLines || this.format.compact) return;
if (this.format.concise) {
this.space();
return;
}
}
if (i > 2) i = 2;
i -= this._buf.getNewlineCount();
for (let j = 0; j < i; j++) {
this._newline();
}
return;
}
endsWith(char) {
return this.getLastChar() === char;
}
getLastChar() {
return this._buf.getLastChar();
}
endsWithCharAndNewline() {
return this._buf.endsWithCharAndNewline();
}
removeTrailingNewline() {
this._buf.removeTrailingNewline();
}
exactSource(loc, cb) {
if (!loc) {
cb();
return;
}
this._catchUp("start", loc);
this._buf.exactSource(loc, cb);
}
source(prop, loc) {
if (!loc) return;
this._catchUp(prop, loc);
this._buf.source(prop, loc);
}
sourceWithOffset(prop, loc, columnOffset) {
if (!loc || this.format.preserveFormat) return;
this._catchUp(prop, loc);
this._buf.sourceWithOffset(prop, loc, columnOffset);
}
sourceIdentifierName(identifierName, pos) {
if (!this._buf._canMarkIdName) return;
const sourcePosition = this._buf._sourcePosition;
sourcePosition.identifierNamePos = pos;
sourcePosition.identifierName = identifierName;
}
_space() {
this._queue(32);
}
_newline() {
this._queue(10);
}
_catchUpToCurrentToken(str, occurrenceCount = 0) {
const token = this.tokenMap.findMatching(this._currentNode, str, occurrenceCount);
if (token) this._catchUpTo(token.loc.start);
if (this._printSemicolonBeforeNextToken !== -1 && this._printSemicolonBeforeNextToken === this._buf.getCurrentLine()) {
this._buf.appendChar(59);
this._endsWithWord = false;
this._endsWithInteger = false;
this._endsWithDiv = false;
}
this._printSemicolonBeforeNextToken = -1;
this._printSemicolonBeforeNextNode = -1;
}
_append(str, maybeNewline) {
this._maybeIndent(str.charCodeAt(0));
this._buf.append(str, maybeNewline);
this._endsWithWord = false;
this._endsWithInteger = false;
this._endsWithDiv = false;
}
_appendChar(char) {
this._maybeIndent(char);
this._buf.appendChar(char);
this._endsWithWord = false;
this._endsWithInteger = false;
this._endsWithDiv = false;
}
_queue(char) {
this._maybeIndent(char);
this._buf.queue(char);
this._endsWithWord = false;
this._endsWithInteger = false;
}
_maybeIndent(firstChar) {
if (this._indent && firstChar !== 10 && this.endsWith(10)) {
this._buf.queueIndentation(this._getIndent());
}
}
_shouldIndent(firstChar) {
if (this._indent && firstChar !== 10 && this.endsWith(10)) {
return true;
}
}
catchUp(line) {
if (!this.format.retainLines) return;
const count = line - this._buf.getCurrentLine();
for (let i = 0; i < count; i++) {
this._newline();
}
}
_catchUp(prop, loc) {
const {
format
} = this;
if (!format.preserveFormat) {
if (format.retainLines && loc != null && loc[prop]) {
this.catchUp(loc[prop].line);
}
return;
}
const pos = loc == null ? void 0 : loc[prop];
if (pos != null) this._catchUpTo(pos);
}
_catchUpTo({
line,
column,
index
}) {
const count = line - this._buf.getCurrentLine();
if (count > 0 && this._noLineTerminator) {
return;
}
for (let i = 0; i < count; i++) {
this._newline();
}
const spacesCount = count > 0 ? column : column - this._buf.getCurrentColumn();
if (spacesCount > 0) {
const spaces = this._originalCode ? this._originalCode.slice(index - spacesCount, index).replace(/[^\t\x0B\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]/gu, " ") : " ".repeat(spacesCount);
this._append(spaces, false);
}
}
_getIndent() {
return this._indentRepeat * this._indent;
}
printTerminatorless(node) {
this._noLineTerminator = true;
this.print(node);
}
print(node, noLineTerminatorAfter = false, trailingCommentsLineOffset) {
var _node$extra, _node$leadingComments, _node$leadingComments2;
if (!node) return;
this._endsWithInnerRaw = false;
const nodeType = node.type;
const format = this.format;
const oldConcise = format.concise;
if (node._compact) {
format.concise = true;
}
const printMethod = this[nodeType];
if (printMethod === undefined) {
throw new ReferenceError(`unknown node of type ${JSON.stringify(nodeType)} with constructor ${JSON.stringify(node.constructor.name)}`);
}
const parent = this._currentNode;
this._currentNode = node;
if (this.tokenMap) {
this._printSemicolonBeforeNextToken = this._printSemicolonBeforeNextNode;
}
const oldInAux = this._insideAux;
this._insideAux = node.loc == null;
this._maybeAddAuxComment(this._insideAux && !oldInAux);
const parenthesized = (_node$extra = node.extra) == null ? void 0 : _node$extra.parenthesized;
let shouldPrintParens = parenthesized && format.preserveFormat || parenthesized && format.retainFunctionParens && nodeType === "FunctionExpression" || needsParens(node, parent, this.tokenContext, format.preserveFormat ? this._boundGetRawIdentifier : undefined);
if (!shouldPrintParens && parenthesized && (_node$leadingComments = node.leadingComments) != null && _node$leadingComments.length && node.leadingComments[0].type === "CommentBlock") {
const parentType = parent == null ? void 0 : parent.type;
switch (parentType) {
case "ExpressionStatement":
case "VariableDeclarator":
case "AssignmentExpression":
case "ReturnStatement":
break;
case "CallExpression":
case "OptionalCallExpression":
case "NewExpression":
if (parent.callee !== node) break;
default:
shouldPrintParens = true;
}
}
let indentParenthesized = false;
if (!shouldPrintParens && this._noLineTerminator && ((_node$leadingComments2 = node.leadingComments) != null && _node$leadingComments2.some(commentIsNewline) || this.format.retainLines && node.loc && node.loc.start.line > this._buf.getCurrentLine())) {
shouldPrintParens = true;
indentParenthesized = true;
}
let oldNoLineTerminatorAfterNode;
let oldTokenContext;
if (!shouldPrintParens) {
noLineTerminatorAfter || (noLineTerminatorAfter = !!parent && this._noLineTerminatorAfterNode === parent && n.isLastChild(parent, node));
if (noLineTerminatorAfter) {
var _node$trailingComment;
if ((_node$trailingComment = node.trailingComments) != null && _node$trailingComment.some(commentIsNewline)) {
if (isExpression(node)) shouldPrintParens = true;
} else {
oldNoLineTerminatorAfterNode = this._noLineTerminatorAfterNode;
this._noLineTerminatorAfterNode = node;
}
}
}
if (shouldPrintParens) {
this.tokenChar(40);
if (indentParenthesized) this.indent();
this._endsWithInnerRaw = false;
if (this.tokenContext & _index.TokenContext.forInOrInitHeadAccumulate) {
oldTokenContext = this.tokenContext;
this.tokenContext = _index.TokenContext.normal;
}
oldNoLineTerminatorAfterNode = this._noLineTerminatorAfterNode;
this._noLineTerminatorAfterNode = null;
}
this._lastCommentLine = 0;
this._printLeadingComments(node, parent);
const loc = nodeType === "Program" || nodeType === "File" ? null : node.loc;
this.exactSource(loc, printMethod.bind(this, node, parent));
if (shouldPrintParens) {
this._printTrailingComments(node, parent);
if (indentParenthesized) {
this.dedent();
this.newline();
}
this.tokenChar(41);
this._noLineTerminator = noLineTerminatorAfter;
if (oldTokenContext) this.tokenContext = oldTokenContext;
} else if (noLineTerminatorAfter && !this._noLineTerminator) {
this._noLineTerminator = true;
this._printTrailingComments(node, parent);
} else {
this._printTrailingComments(node, parent, trailingCommentsLineOffset);
}
this._currentNode = parent;
format.concise = oldConcise;
this._insideAux = oldInAux;
if (oldNoLineTerminatorAfterNode !== undefined) {
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
}
this._endsWithInnerRaw = false;
}
_maybeAddAuxComment(enteredPositionlessNode) {
if (enteredPositionlessNode) this._printAuxBeforeComment();
if (!this._insideAux) this._printAuxAfterComment();
}
_printAuxBeforeComment() {
if (this._printAuxAfterOnNextUserNode) return;
this._printAuxAfterOnNextUserNode = true;
const comment = this.format.auxiliaryCommentBefore;
if (comment) {
this._printComment({
type: "CommentBlock",
value: comment
}, 0);
}
}
_printAuxAfterComment() {
if (!this._printAuxAfterOnNextUserNode) return;
this._printAuxAfterOnNextUserNode = false;
const comment = this.format.auxiliaryCommentAfter;
if (comment) {
this._printComment({
type: "CommentBlock",
value: comment
}, 0);
}
}
getPossibleRaw(node) {
const extra = node.extra;
if ((extra == null ? void 0 : extra.raw) != null && extra.rawValue != null && node.value === extra.rawValue) {
return extra.raw;
}
}
printJoin(nodes, statement, indent, separator, printTrailingSeparator, iterator, trailingCommentsLineOffset) {
if (!(nodes != null && nodes.length)) return;
if (indent == null && this.format.retainLines) {
var _nodes$0$loc;
const startLine = (_nodes$0$loc = nodes[0].loc) == null ? void 0 : _nodes$0$loc.start.line;
if (startLine != null && startLine !== this._buf.getCurrentLine()) {
indent = true;
}
}
if (indent) this.indent();
const newlineOpts = {
nextNodeStartLine: 0
};
const boundSeparator = separator == null ? void 0 : separator.bind(this);
const len = nodes.length;
for (let i = 0; i < len; i++) {
const node = nodes[i];
if (!node) continue;
if (statement) this._printNewline(i === 0, newlineOpts);
this.print(node, undefined, trailingCommentsLineOffset || 0);
iterator == null || iterator(node, i);
if (boundSeparator != null) {
if (i < len - 1) boundSeparator(i, false);else if (printTrailingSeparator) boundSeparator(i, true);
}
if (statement) {
var _node$trailingComment2;
if (!((_node$trailingComment2 = node.trailingComments) != null && _node$trailingComment2.length)) {
this._lastCommentLine = 0;
}
if (i + 1 === len) {
this.newline(1);
} else {
var _nextNode$loc;
const nextNode = nodes[i + 1];
newlineOpts.nextNodeStartLine = ((_nextNode$loc = nextNode.loc) == null ? void 0 : _nextNode$loc.start.line) || 0;
this._printNewline(true, newlineOpts);
}
}
}
if (indent) this.dedent();
}
printAndIndentOnComments(node) {
const indent = node.leadingComments && node.leadingComments.length > 0;
if (indent) this.indent();
this.print(node);
if (indent) this.dedent();
}
printBlock(parent) {
const node = parent.body;
if (node.type !== "EmptyStatement") {
this.space();
}
this.print(node);
}
_printTrailingComments(node, parent, lineOffset) {
const {
innerComments,
trailingComments
} = node;
if (innerComments != null && innerComments.length) {
this._printComments(2, innerComments, node, parent, lineOffset);
}
if (trailingComments != null && trailingComments.length) {
this._printComments(2, trailingComments, node, parent, lineOffset);
}
}
_printLeadingComments(node, parent) {
const comments = node.leadingComments;
if (!(comments != null && comments.length)) return;
this._printComments(0, comments, node, parent);
}
_maybePrintInnerComments(nextTokenStr, nextTokenOccurrenceCount) {
if (this._endsWithInnerRaw) {
var _this$tokenMap;
this.printInnerComments((_this$tokenMap = this.tokenMap) == null ? void 0 : _this$tokenMap.findMatching(this._currentNode, nextTokenStr, nextTokenOccurrenceCount));
}
this._endsWithInnerRaw = true;
this._indentInnerComments = true;
}
printInnerComments(nextToken) {
const node = this._currentNode;
const comments = node.innerComments;
if (!(comments != null && comments.length)) return;
const hasSpace = this.endsWith(32);
const indent = this._indentInnerComments;
const printedCommentsCount = this._printedComments.size;
if (indent) this.indent();
this._printComments(1, comments, node, undefined, undefined, nextToken);
if (hasSpace && printedCommentsCount !== this._printedComments.size) {
this.space();
}
if (indent) this.dedent();
}
noIndentInnerCommentsHere() {
this._indentInnerComments = false;
}
printSequence(nodes, indent, trailingCommentsLineOffset) {
this.printJoin(nodes, true, indent != null ? indent : false, undefined, undefined, undefined, trailingCommentsLineOffset);
}
printList(items, printTrailingSeparator, statement, indent, separator, iterator) {
this.printJoin(items, statement, indent, separator != null ? separator : commaSeparator, printTrailingSeparator, iterator);
}
shouldPrintTrailingComma(listEnd) {
if (!this.tokenMap) return null;
const listEndIndex = this.tokenMap.findLastIndex(this._currentNode, token => this.tokenMap.matchesOriginal(token, listEnd));
if (listEndIndex <= 0) return null;
return this.tokenMap.matchesOriginal(this._tokens[listEndIndex - 1], ",");
}
_printNewline(newLine, opts) {
const format = this.format;
if (format.retainLines || format.compact) return;
if (format.concise) {
this.space();
return;
}
if (!newLine) {
return;
}
const startLine = opts.nextNodeStartLine;
const lastCommentLine = this._lastCommentLine;
if (startLine > 0 && lastCommentLine > 0) {
const offset = startLine - lastCommentLine;
if (offset >= 0) {
this.newline(offset || 1);
return;
}
}
if (this._buf.hasContent()) {
this.newline(1);
}
}
_shouldPrintComment(comment, nextToken) {
if (comment.ignore) return 0;
if (this._printedComments.has(comment)) return 0;
if (this._noLineTerminator && HAS_NEWLINE_OR_BlOCK_COMMENT_END.test(comment.value)) {
return 2;
}
if (nextToken && this.tokenMap) {
const commentTok = this.tokenMap.find(this._currentNode, token => token.value === comment.value);
if (commentTok && commentTok.start > nextToken.start) {
return 2;
}
}
this._printedComments.add(comment);
if (!this.format.shouldPrintComment(comment.value)) {
return 0;
}
return 1;
}
_printComment(comment, skipNewLines) {
const noLineTerminator = this._noLineTerminator;
const isBlockComment = comment.type === "CommentBlock";
const printNewLines = isBlockComment && skipNewLines !== 1 && !this._noLineTerminator;
if (printNewLines && this._buf.hasContent() && skipNewLines !== 2) {
this.newline(1);
}
const lastCharCode = this.getLastChar();
if (lastCharCode !== 91 && lastCharCode !== 123 && lastCharCode !== 40) {
this.space();
}
let val;
if (isBlockComment) {
val = `/*${comment.value}*/`;
if (this.format.indent.adjustMultilineComment) {
var _comment$loc;
const offset = (_comment$loc = comment.loc) == null ? void 0 : _comment$loc.start.column;
if (offset) {
const newlineRegex = new RegExp("\\n\\s{1," + offset + "}", "g");
val = val.replace(newlineRegex, "\n");
}
if (this.format.concise) {
val = val.replace(/\n(?!$)/g, `\n`);
} else {
let indentSize = this.format.retainLines ? 0 : this._buf.getCurrentColumn();
if (this._shouldIndent(47) || this.format.retainLines) {
indentSize += this._getIndent();
}
val = val.replace(/\n(?!$)/g, `\n${" ".repeat(indentSize)}`);
}
}
} else if (!noLineTerminator) {
val = `//${comment.value}`;
} else {
val = `/*${comment.value}*/`;
}
if (this._endsWithDiv) this._space();
if (this.tokenMap) {
const {
_printSemicolonBeforeNextToken,
_printSemicolonBeforeNextNode
} = this;
this._printSemicolonBeforeNextToken = -1;
this._printSemicolonBeforeNextNode = -1;
this.source("start", comment.loc);
this._append(val, isBlockComment);
this._printSemicolonBeforeNextNode = _printSemicolonBeforeNextNode;
this._printSemicolonBeforeNextToken = _printSemicolonBeforeNextToken;
} else {
this.source("start", comment.loc);
this._append(val, isBlockComment);
}
if (!isBlockComment && !noLineTerminator) {
this.newline(1, true);
}
if (printNewLines && skipNewLines !== 3) {
this.newline(1);
}
}
_printComments(type, comments, node, parent, lineOffset = 0, nextToken) {
const nodeLoc = node.loc;
const len = comments.length;
let hasLoc = !!nodeLoc;
const nodeStartLine = hasLoc ? nodeLoc.start.line : 0;
const nodeEndLine = hasLoc ? nodeLoc.end.line : 0;
let lastLine = 0;
let leadingCommentNewline = 0;
const maybeNewline = this._noLineTerminator ? function () {} : this.newline.bind(this);
for (let i = 0; i < len; i++) {
const comment = comments[i];
const shouldPrint = this._shouldPrintComment(comment, nextToken);
if (shouldPrint === 2) {
hasLoc = false;
break;
}
if (hasLoc && comment.loc && shouldPrint === 1) {
const commentStartLine = comment.loc.start.line;
const commentEndLine = comment.loc.end.line;
if (type === 0) {
let offset = 0;
if (i === 0) {
if (this._buf.hasContent() && (comment.type === "CommentLine" || commentStartLine !== commentEndLine)) {
offset = leadingCommentNewline = 1;
}
} else {
offset = commentStartLine - lastLine;
}
lastLine = commentEndLine;
maybeNewline(offset);
this._printComment(comment, 1);
if (i + 1 === len) {
maybeNewline(Math.max(nodeStartLine - lastLine, leadingCommentNewline));
lastLine = nodeStartLine;
}
} else if (type === 1) {
const offset = commentStartLine - (i === 0 ? nodeStartLine : lastLine);
lastLine = commentEndLine;
maybeNewline(offset);
this._printComment(comment, 1);
if (i + 1 === len) {
maybeNewline(Math.min(1, nodeEndLine - lastLine));
lastLine = nodeEndLine;
}
} else {
const offset = commentStartLine - (i === 0 ? nodeEndLine - lineOffset : lastLine);
lastLine = commentEndLine;
maybeNewline(offset);
this._printComment(comment, 1);
}
} else {
hasLoc = false;
if (shouldPrint !== 1) {
continue;
}
if (len === 1) {
const singleLine = comment.loc ? comment.loc.start.line === comment.loc.end.line : !HAS_NEWLINE.test(comment.value);
const shouldSkipNewline = singleLine && !isStatement(node) && !isClassBody(parent) && !isTSInterfaceBody(parent) && !isTSEnumMember(node);
if (type === 0) {
this._printComment(comment, shouldSkipNewline && node.type !== "ObjectExpression" || singleLine && isFunction(parent, {
body: node
}) ? 1 : 0);
} else if (shouldSkipNewline && type === 2) {
this._printComment(comment, 1);
} else {
this._printComment(comment, 0);
}
} else if (type === 1 && !(node.type === "ObjectExpression" && node.properties.length > 1) && node.type !== "ClassBody" && node.type !== "TSInterfaceBody") {
this._printComment(comment, i === 0 ? 2 : i === len - 1 ? 3 : 0);
} else {
this._printComment(comment, 0);
}
}
}
if (type === 2 && hasLoc && lastLine) {
this._lastCommentLine = lastLine;
}
}
}
Object.assign(Printer.prototype, generatorFunctions);
{
(0, _deprecated.addDeprecatedGenerators)(Printer);
}
var _default = exports.default = Printer;
function commaSeparator(occurrenceCount, last) {
this.token(",", false, occurrenceCount);
if (!last) this.space();
}
//# sourceMappingURL=printer.js.map
@@ -0,0 +1,64 @@
#!/usr/bin/env python3
import argparse
import os
import shutil
import subprocess
import tarfile
import tempfile
import urllib.request
BASE_URL = "https://github.com/nodejs/gyp-next/archive/"
CHECKOUT_PATH = os.path.dirname(os.path.realpath(__file__))
CHECKOUT_GYP_PATH = os.path.join(CHECKOUT_PATH, "gyp")
parser = argparse.ArgumentParser()
parser.add_argument("tag", help="gyp tag to update to")
args = parser.parse_args()
tar_url = BASE_URL + args.tag + ".tar.gz"
changed_files = subprocess.check_output(["git", "diff", "--name-only"]).strip()
if changed_files:
raise Exception("Can't update gyp while you have uncommitted changes in node-gyp")
with tempfile.TemporaryDirectory() as tmp_dir:
tar_file = os.path.join(tmp_dir, "gyp.tar.gz")
unzip_target = os.path.join(tmp_dir, "gyp")
with open(tar_file, "wb") as f:
print("Downloading gyp-next@" + args.tag + " into temporary directory...")
print("From: " + tar_url)
with urllib.request.urlopen(tar_url) as in_file:
f.write(in_file.read())
print("Unzipping...")
with tarfile.open(tar_file, "r:gz") as tar_ref:
def is_within_directory(directory, target):
abs_directory = os.path.abspath(directory)
abs_target = os.path.abspath(target)
prefix = os.path.commonprefix([abs_directory, abs_target])
return prefix == abs_directory
def safe_extract(tar, path=".", members=None, *, numeric_owner=False):
for member in tar.getmembers():
member_path = os.path.join(path, member.name)
if not is_within_directory(path, member_path):
raise Exception("Attempted Path Traversal in Tar File")
tar.extractall(path, members, numeric_owner=numeric_owner)
safe_extract(tar_ref, unzip_target)
print("Moving to current checkout (" + CHECKOUT_PATH + ")...")
if os.path.exists(CHECKOUT_GYP_PATH):
shutil.rmtree(CHECKOUT_GYP_PATH)
shutil.move(
os.path.join(unzip_target, os.listdir(unzip_target)[0]), CHECKOUT_GYP_PATH
)
subprocess.check_output(["git", "add", "gyp"], cwd=CHECKOUT_PATH)
subprocess.check_output(["git", "commit", "-m", "feat(gyp): update gyp to " + args.tag])
@@ -0,0 +1,7 @@
export { default as Divider, DividerProps } from './divider.js';
export { useDivider } from './use-divider.js';
import '@heroui/system-rsc';
import '@heroui/theme';
import 'react';
import './use-separator.js';
import '@react-types/shared';
@@ -0,0 +1 @@
{"version":3,"file":"overloaded-parameters.js","sourceRoot":"","sources":["../src/overloaded-parameters.ts"],"names":[],"mappings":""}
@@ -0,0 +1,86 @@
'use strict';var _minimatch = require('minimatch');var _minimatch2 = _interopRequireDefault(_minimatch);
var _path = require('path');var _path2 = _interopRequireDefault(_path);
var _contextCompat = require('eslint-module-utils/contextCompat');
var _pkgUp = require('eslint-module-utils/pkgUp');var _pkgUp2 = _interopRequireDefault(_pkgUp);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
function getEntryPoint(context) {
var pkgPath = (0, _pkgUp2['default'])({ cwd: (0, _contextCompat.getPhysicalFilename)(context) });
try {
return require.resolve(_path2['default'].dirname(pkgPath));
} catch (error) {
// Assume the package has no entrypoint (e.g. CLI packages)
// in which case require.resolve would throw.
return null;
}
}
function findScope(context, identifier) {var _getSourceCode =
(0, _contextCompat.getSourceCode)(context),scopeManager = _getSourceCode.scopeManager;
return scopeManager && scopeManager.scopes.slice().reverse().find(function (scope) {return scope.variables.some(function (variable) {return variable.identifiers.some(function (node) {return node.name === identifier;});});});
}
function findDefinition(objectScope, identifier) {
var variable = objectScope.variables.find(function (variable) {return variable.name === identifier;});
return variable.defs.find(function (def) {return def.name.name === identifier;});
}
module.exports = {
meta: {
type: 'problem',
docs: {
category: 'Module systems',
description: 'Forbid import statements with CommonJS module.exports.',
recommended: true },
fixable: 'code',
schema: [
{
type: 'object',
properties: {
exceptions: { type: 'array' } },
additionalProperties: false }] },
create: function () {function create(context) {
var importDeclarations = [];
var entryPoint = getEntryPoint(context);
var options = context.options[0] || {};
var alreadyReported = false;
function report(node) {
var fileName = (0, _contextCompat.getPhysicalFilename)(context);
var isEntryPoint = entryPoint === fileName;
var isIdentifier = node.object.type === 'Identifier';
var hasKeywords = /^(module|exports)$/.test(node.object.name);
var objectScope = hasKeywords && findScope(context, node.object.name);
var variableDefinition = objectScope && findDefinition(objectScope, node.object.name);
var isImportBinding = variableDefinition && variableDefinition.type === 'ImportBinding';
var hasCJSExportReference = hasKeywords && (!objectScope || objectScope.type === 'module');
var isException = !!options.exceptions && options.exceptions.some(function (glob) {return (0, _minimatch2['default'])(fileName, glob);});
if (isIdentifier && hasCJSExportReference && !isEntryPoint && !isException && !isImportBinding) {
importDeclarations.forEach(function (importDeclaration) {
context.report({
node: importDeclaration,
message: 'Cannot use import declarations in modules that export using CommonJS (module.exports = \'foo\' or exports.bar = \'hi\')' });
});
alreadyReported = true;
}
}
return {
ImportDeclaration: function () {function ImportDeclaration(node) {
importDeclarations.push(node);
}return ImportDeclaration;}(),
MemberExpression: function () {function MemberExpression(node) {
if (!alreadyReported) {
report(node);
}
}return MemberExpression;}() };
}return create;}() };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1pbXBvcnQtbW9kdWxlLWV4cG9ydHMuanMiXSwibmFtZXMiOlsiZ2V0RW50cnlQb2ludCIsImNvbnRleHQiLCJwa2dQYXRoIiwiY3dkIiwicmVxdWlyZSIsInJlc29sdmUiLCJwYXRoIiwiZGlybmFtZSIsImVycm9yIiwiZmluZFNjb3BlIiwiaWRlbnRpZmllciIsInNjb3BlTWFuYWdlciIsInNjb3BlcyIsInNsaWNlIiwicmV2ZXJzZSIsImZpbmQiLCJzY29wZSIsInZhcmlhYmxlcyIsInNvbWUiLCJ2YXJpYWJsZSIsImlkZW50aWZpZXJzIiwibm9kZSIsIm5hbWUiLCJmaW5kRGVmaW5pdGlvbiIsIm9iamVjdFNjb3BlIiwiZGVmcyIsImRlZiIsIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJjYXRlZ29yeSIsImRlc2NyaXB0aW9uIiwicmVjb21tZW5kZWQiLCJmaXhhYmxlIiwic2NoZW1hIiwicHJvcGVydGllcyIsImV4Y2VwdGlvbnMiLCJhZGRpdGlvbmFsUHJvcGVydGllcyIsImNyZWF0ZSIsImltcG9ydERlY2xhcmF0aW9ucyIsImVudHJ5UG9pbnQiLCJvcHRpb25zIiwiYWxyZWFkeVJlcG9ydGVkIiwicmVwb3J0IiwiZmlsZU5hbWUiLCJpc0VudHJ5UG9pbnQiLCJpc0lkZW50aWZpZXIiLCJvYmplY3QiLCJoYXNLZXl3b3JkcyIsInRlc3QiLCJ2YXJpYWJsZURlZmluaXRpb24iLCJpc0ltcG9ydEJpbmRpbmciLCJoYXNDSlNFeHBvcnRSZWZlcmVuY2UiLCJpc0V4Y2VwdGlvbiIsImdsb2IiLCJmb3JFYWNoIiwiaW1wb3J0RGVjbGFyYXRpb24iLCJtZXNzYWdlIiwiSW1wb3J0RGVjbGFyYXRpb24iLCJwdXNoIiwiTWVtYmVyRXhwcmVzc2lvbiJdLCJtYXBwaW5ncyI6ImFBQUEsc0M7QUFDQSw0QjtBQUNBO0FBQ0Esa0Q7O0FBRUEsU0FBU0EsYUFBVCxDQUF1QkMsT0FBdkIsRUFBZ0M7QUFDOUIsTUFBTUMsVUFBVSx3QkFBTSxFQUFFQyxLQUFLLHdDQUFvQkYsT0FBcEIsQ0FBUCxFQUFOLENBQWhCO0FBQ0EsTUFBSTtBQUNGLFdBQU9HLFFBQVFDLE9BQVIsQ0FBZ0JDLGtCQUFLQyxPQUFMLENBQWFMLE9BQWIsQ0FBaEIsQ0FBUDtBQUNELEdBRkQsQ0FFRSxPQUFPTSxLQUFQLEVBQWM7QUFDZDtBQUNBO0FBQ0EsV0FBTyxJQUFQO0FBQ0Q7QUFDRjs7QUFFRCxTQUFTQyxTQUFULENBQW1CUixPQUFuQixFQUE0QlMsVUFBNUIsRUFBd0M7QUFDYixvQ0FBY1QsT0FBZCxDQURhLENBQzlCVSxZQUQ4QixrQkFDOUJBLFlBRDhCOztBQUd0QyxTQUFPQSxnQkFBZ0JBLGFBQWFDLE1BQWIsQ0FBb0JDLEtBQXBCLEdBQTRCQyxPQUE1QixHQUFzQ0MsSUFBdEMsQ0FBMkMsVUFBQ0MsS0FBRCxVQUFXQSxNQUFNQyxTQUFOLENBQWdCQyxJQUFoQixDQUFxQixVQUFDQyxRQUFELFVBQWNBLFNBQVNDLFdBQVQsQ0FBcUJGLElBQXJCLENBQTBCLFVBQUNHLElBQUQsVUFBVUEsS0FBS0MsSUFBTCxLQUFjWixVQUF4QixFQUExQixDQUFkLEVBQXJCLENBQVgsRUFBM0MsQ0FBdkI7QUFDRDs7QUFFRCxTQUFTYSxjQUFULENBQXdCQyxXQUF4QixFQUFxQ2QsVUFBckMsRUFBaUQ7QUFDL0MsTUFBTVMsV0FBV0ssWUFBWVAsU0FBWixDQUFzQkYsSUFBdEIsQ0FBMkIsVUFBQ0ksUUFBRCxVQUFjQSxTQUFTRyxJQUFULEtBQWtCWixVQUFoQyxFQUEzQixDQUFqQjtBQUNBLFNBQU9TLFNBQVNNLElBQVQsQ0FBY1YsSUFBZCxDQUFtQixVQUFDVyxHQUFELFVBQVNBLElBQUlKLElBQUosQ0FBU0EsSUFBVCxLQUFrQlosVUFBM0IsRUFBbkIsQ0FBUDtBQUNEOztBQUVEaUIsT0FBT0MsT0FBUCxHQUFpQjtBQUNmQyxRQUFNO0FBQ0pDLFVBQU0sU0FERjtBQUVKQyxVQUFNO0FBQ0pDLGdCQUFVLGdCQUROO0FBRUpDLG1CQUFhLHdEQUZUO0FBR0pDLG1CQUFhLElBSFQsRUFGRjs7QUFPSkMsYUFBUyxNQVBMO0FBUUpDLFlBQVE7QUFDTjtBQUNFTixZQUFNLFFBRFI7QUFFRU8sa0JBQVk7QUFDVkMsb0JBQVksRUFBRVIsTUFBTSxPQUFSLEVBREYsRUFGZDs7QUFLRVMsNEJBQXNCLEtBTHhCLEVBRE0sQ0FSSixFQURTOzs7O0FBbUJmQyxRQW5CZSwrQkFtQlJ2QyxPQW5CUSxFQW1CQztBQUNkLFVBQU13QyxxQkFBcUIsRUFBM0I7QUFDQSxVQUFNQyxhQUFhMUMsY0FBY0MsT0FBZCxDQUFuQjtBQUNBLFVBQU0wQyxVQUFVMUMsUUFBUTBDLE9BQVIsQ0FBZ0IsQ0FBaEIsS0FBc0IsRUFBdEM7QUFDQSxVQUFJQyxrQkFBa0IsS0FBdEI7O0FBRUEsZUFBU0MsTUFBVCxDQUFnQnhCLElBQWhCLEVBQXNCO0FBQ3BCLFlBQU15QixXQUFXLHdDQUFvQjdDLE9BQXBCLENBQWpCO0FBQ0EsWUFBTThDLGVBQWVMLGVBQWVJLFFBQXBDO0FBQ0EsWUFBTUUsZUFBZTNCLEtBQUs0QixNQUFMLENBQVluQixJQUFaLEtBQXFCLFlBQTFDO0FBQ0EsWUFBTW9CLGNBQWUsb0JBQUQsQ0FBdUJDLElBQXZCLENBQTRCOUIsS0FBSzRCLE1BQUwsQ0FBWTNCLElBQXhDLENBQXBCO0FBQ0EsWUFBTUUsY0FBYzBCLGVBQWV6QyxVQUFVUixPQUFWLEVBQW1Cb0IsS0FBSzRCLE1BQUwsQ0FBWTNCLElBQS9CLENBQW5DO0FBQ0EsWUFBTThCLHFCQUFxQjVCLGVBQWVELGVBQWVDLFdBQWYsRUFBNEJILEtBQUs0QixNQUFMLENBQVkzQixJQUF4QyxDQUExQztBQUNBLFlBQU0rQixrQkFBa0JELHNCQUFzQkEsbUJBQW1CdEIsSUFBbkIsS0FBNEIsZUFBMUU7QUFDQSxZQUFNd0Isd0JBQXdCSixnQkFBZ0IsQ0FBQzFCLFdBQUQsSUFBZ0JBLFlBQVlNLElBQVosS0FBcUIsUUFBckQsQ0FBOUI7QUFDQSxZQUFNeUIsY0FBYyxDQUFDLENBQUNaLFFBQVFMLFVBQVYsSUFBd0JLLFFBQVFMLFVBQVIsQ0FBbUJwQixJQUFuQixDQUF3QixVQUFDc0MsSUFBRCxVQUFVLDRCQUFVVixRQUFWLEVBQW9CVSxJQUFwQixDQUFWLEVBQXhCLENBQTVDOztBQUVBLFlBQUlSLGdCQUFnQk0scUJBQWhCLElBQXlDLENBQUNQLFlBQTFDLElBQTBELENBQUNRLFdBQTNELElBQTBFLENBQUNGLGVBQS9FLEVBQWdHO0FBQzlGWiw2QkFBbUJnQixPQUFuQixDQUEyQixVQUFDQyxpQkFBRCxFQUF1QjtBQUNoRHpELG9CQUFRNEMsTUFBUixDQUFlO0FBQ2J4QixvQkFBTXFDLGlCQURPO0FBRWJDLGdKQUZhLEVBQWY7O0FBSUQsV0FMRDtBQU1BZiw0QkFBa0IsSUFBbEI7QUFDRDtBQUNGOztBQUVELGFBQU87QUFDTGdCLHlCQURLLDBDQUNhdkMsSUFEYixFQUNtQjtBQUN0Qm9CLCtCQUFtQm9CLElBQW5CLENBQXdCeEMsSUFBeEI7QUFDRCxXQUhJO0FBSUx5Qyx3QkFKSyx5Q0FJWXpDLElBSlosRUFJa0I7QUFDckIsZ0JBQUksQ0FBQ3VCLGVBQUwsRUFBc0I7QUFDcEJDLHFCQUFPeEIsSUFBUDtBQUNEO0FBQ0YsV0FSSSw2QkFBUDs7QUFVRCxLQXpEYyxtQkFBakIiLCJmaWxlIjoibm8taW1wb3J0LW1vZHVsZS1leHBvcnRzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IG1pbmltYXRjaCBmcm9tICdtaW5pbWF0Y2gnO1xuaW1wb3J0IHBhdGggZnJvbSAncGF0aCc7XG5pbXBvcnQgeyBnZXRQaHlzaWNhbEZpbGVuYW1lLCBnZXRTb3VyY2VDb2RlIH0gZnJvbSAnZXNsaW50LW1vZHVsZS11dGlscy9jb250ZXh0Q29tcGF0JztcbmltcG9ydCBwa2dVcCBmcm9tICdlc2xpbnQtbW9kdWxlLXV0aWxzL3BrZ1VwJztcblxuZnVuY3Rpb24gZ2V0RW50cnlQb2ludChjb250ZXh0KSB7XG4gIGNvbnN0IHBrZ1BhdGggPSBwa2dVcCh7IGN3ZDogZ2V0UGh5c2ljYWxGaWxlbmFtZShjb250ZXh0KSB9KTtcbiAgdHJ5IHtcbiAgICByZXR1cm4gcmVxdWlyZS5yZXNvbHZlKHBhdGguZGlybmFtZShwa2dQYXRoKSk7XG4gIH0gY2F0Y2ggKGVycm9yKSB7XG4gICAgLy8gQXNzdW1lIHRoZSBwYWNrYWdLine truncated
@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _tdzError;
function _tdzError(name) {
throw new ReferenceError(name + " is not defined - temporal dead zone");
}
//# sourceMappingURL=tdz.js.map
@@ -0,0 +1,37 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.isoUint8Array = exports.isoCrypto = exports.isoCBOR = exports.isoBase64URL = void 0;
/**
* A collection of methods for isomorphic manipulation of trickier data types
*
* The goal with these is to make it easier to replace dependencies later that might not play well
* with specific server-like runtimes that expose global Web APIs (CloudFlare Workers, Deno, Bun,
* etc...), while also supporting execution in Node.
*/
exports.isoBase64URL = __importStar(require("./isoBase64URL.js"));
exports.isoCBOR = __importStar(require("./isoCBOR.js"));
exports.isoCrypto = __importStar(require("./isoCrypto/index.js"));
exports.isoUint8Array = __importStar(require("./isoUint8Array.js"));
@@ -0,0 +1,96 @@
import { DecodingMode } from "./decode.js";
/** The level of entities to support. */
export declare enum EntityLevel {
/** Support only XML entities. */
XML = 0,
/** Support HTML entities, which are a superset of XML entities. */
HTML = 1
}
export declare enum EncodingMode {
/**
* The output is UTF-8 encoded. Only characters that need escaping within
* XML will be escaped.
*/
UTF8 = 0,
/**
* The output consists only of ASCII characters. Characters that need
* escaping within HTML, and characters that aren't ASCII characters will
* be escaped.
*/
ASCII = 1,
/**
* Encode all characters that have an equivalent entity, as well as all
* characters that are not ASCII characters.
*/
Extensive = 2,
/**
* Encode all characters that have to be escaped in HTML attributes,
* following {@link https://html.spec.whatwg.org/multipage/parsing.html#escapingString}.
*/
Attribute = 3,
/**
* Encode all characters that have to be escaped in HTML text,
* following {@link https://html.spec.whatwg.org/multipage/parsing.html#escapingString}.
*/
Text = 4
}
export interface DecodingOptions {
/**
* The level of entities to support.
* @default {@link EntityLevel.XML}
*/
level?: EntityLevel;
/**
* Decoding mode. If `Legacy`, will support legacy entities not terminated
* with a semicolon (`;`).
*
* Always `Strict` for XML. For HTML, set this to `true` if you are parsing
* an attribute value.
*
* The deprecated `decodeStrict` function defaults this to `Strict`.
*
* @default {@link DecodingMode.Legacy}
*/
mode?: DecodingMode | undefined;
}
/**
* Decodes a string with entities.
*
* @param input String to decode.
* @param options Decoding options.
*/
export declare function decode(input: string, options?: DecodingOptions | EntityLevel): string;
/**
* Decodes a string with entities. Does not allow missing trailing semicolons for entities.
*
* @param input String to decode.
* @param options Decoding options.
* @deprecated Use `decode` with the `mode` set to `Strict`.
*/
export declare function decodeStrict(input: string, options?: DecodingOptions | EntityLevel): string;
/**
* Options for `encode`.
*/
export interface EncodingOptions {
/**
* The level of entities to support.
* @default {@link EntityLevel.XML}
*/
level?: EntityLevel;
/**
* Output format.
* @default {@link EncodingMode.Extensive}
*/
mode?: EncodingMode;
}
/**
* Encodes a string with entities.
*
* @param input String to encode.
* @param options Encoding options.
*/
export declare function encode(input: string, options?: EncodingOptions | EntityLevel): string;
export { encodeXML, escape, escapeUTF8, escapeAttribute, escapeText, } from "./escape.js";
export { encodeHTML, encodeNonAsciiHTML, encodeHTML as encodeHTML4, encodeHTML as encodeHTML5, } from "./encode.js";
export { EntityDecoder, DecodingMode, decodeXML, decodeHTML, decodeHTMLStrict, decodeHTMLAttribute, decodeHTML as decodeHTML4, decodeHTML as decodeHTML5, decodeHTMLStrict as decodeHTML4Strict, decodeHTMLStrict as decodeHTML5Strict, decodeXML as decodeXMLStrict, } from "./decode.js";
//# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,133 @@
export var util;
(function (util) {
util.assertEqual = (_) => { };
function assertIs(_arg) { }
util.assertIs = assertIs;
function assertNever(_x) {
throw new Error();
}
util.assertNever = assertNever;
util.arrayToEnum = (items) => {
const obj = {};
for (const item of items) {
obj[item] = item;
}
return obj;
};
util.getValidEnumValues = (obj) => {
const validKeys = util.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
const filtered = {};
for (const k of validKeys) {
filtered[k] = obj[k];
}
return util.objectValues(filtered);
};
util.objectValues = (obj) => {
return util.objectKeys(obj).map(function (e) {
return obj[e];
});
};
util.objectKeys = typeof Object.keys === "function" // eslint-disable-line ban/ban
? (obj) => Object.keys(obj) // eslint-disable-line ban/ban
: (object) => {
const keys = [];
for (const key in object) {
if (Object.prototype.hasOwnProperty.call(object, key)) {
keys.push(key);
}
}
return keys;
};
util.find = (arr, checker) => {
for (const item of arr) {
if (checker(item))
return item;
}
return undefined;
};
util.isInteger = typeof Number.isInteger === "function"
? (val) => Number.isInteger(val) // eslint-disable-line ban/ban
: (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
function joinValues(array, separator = " | ") {
return array.map((val) => (typeof val === "string" ? `'${val}'` : val)).join(separator);
}
util.joinValues = joinValues;
util.jsonStringifyReplacer = (_, value) => {
if (typeof value === "bigint") {
return value.toString();
}
return value;
};
})(util || (util = {}));
export var objectUtil;
(function (objectUtil) {
objectUtil.mergeShapes = (first, second) => {
return {
...first,
...second, // second overwrites first
};
};
})(objectUtil || (objectUtil = {}));
export const ZodParsedType = util.arrayToEnum([
"string",
"nan",
"number",
"integer",
"float",
"boolean",
"date",
"bigint",
"symbol",
"function",
"undefined",
"null",
"array",
"object",
"unknown",
"promise",
"void",
"never",
"map",
"set",
]);
export const getParsedType = (data) => {
const t = typeof data;
switch (t) {
case "undefined":
return ZodParsedType.undefined;
case "string":
return ZodParsedType.string;
case "number":
return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
case "boolean":
return ZodParsedType.boolean;
case "function":
return ZodParsedType.function;
case "bigint":
return ZodParsedType.bigint;
case "symbol":
return ZodParsedType.symbol;
case "object":
if (Array.isArray(data)) {
return ZodParsedType.array;
}
if (data === null) {
return ZodParsedType.null;
}
if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
return ZodParsedType.promise;
}
if (typeof Map !== "undefined" && data instanceof Map) {
return ZodParsedType.map;
}
if (typeof Set !== "undefined" && data instanceof Set) {
return ZodParsedType.set;
}
if (typeof Date !== "undefined" && data instanceof Date) {
return ZodParsedType.date;
}
return ZodParsedType.object;
default:
return ZodParsedType.unknown;
}
};
@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=property_injection.int.spec.d.ts.map
@@ -0,0 +1,58 @@
import * as C from './constant';
var padStart = function padStart(string, length, pad) {
var s = String(string);
if (!s || s.length >= length) return string;
return "" + Array(length + 1 - s.length).join(pad) + string;
};
var padZoneStr = function padZoneStr(instance) {
var negMinutes = -instance.utcOffset();
var minutes = Math.abs(negMinutes);
var hourOffset = Math.floor(minutes / 60);
var minuteOffset = minutes % 60;
return "" + (negMinutes <= 0 ? '+' : '-') + padStart(hourOffset, 2, '0') + ":" + padStart(minuteOffset, 2, '0');
};
var monthDiff = function monthDiff(a, b) {
// function from moment.js in order to keep the same result
if (a.date() < b.date()) return -monthDiff(b, a);
var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month());
var anchor = a.clone().add(wholeMonthDiff, C.M);
var c = b - anchor < 0;
var anchor2 = a.clone().add(wholeMonthDiff + (c ? -1 : 1), C.M);
return +(-(wholeMonthDiff + (b - anchor) / (c ? anchor - anchor2 : anchor2 - anchor)) || 0);
};
var absFloor = function absFloor(n) {
return n < 0 ? Math.ceil(n) || 0 : Math.floor(n);
};
var prettyUnit = function prettyUnit(u) {
var special = {
M: C.M,
y: C.Y,
w: C.W,
d: C.D,
D: C.DATE,
h: C.H,
m: C.MIN,
s: C.S,
ms: C.MS,
Q: C.Q
};
return special[u] || String(u || '').toLowerCase().replace(/s$/, '');
};
var isUndefined = function isUndefined(s) {
return s === undefined;
};
export default {
s: padStart,
z: padZoneStr,
m: monthDiff,
a: absFloor,
p: prettyUnit,
u: isUndefined
};
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2012 vic99999@yandex.ru
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,32 @@
import { Parser } from "./Parser.js";
/*
* NOTE: If either of these two imports produces a type error,
* please update your @types/node dependency!
*/
import { Writable } from "node:stream";
import { StringDecoder } from "node:string_decoder";
// Following the example in https://nodejs.org/api/stream.html#stream_decoding_buffers_in_a_writable_stream
function isBuffer(_chunk, encoding) {
return encoding === "buffer";
}
/**
* WritableStream makes the `Parser` interface available as a NodeJS stream.
*
* @see Parser
*/
export class WritableStream extends Writable {
constructor(cbs, options) {
super({ decodeStrings: false });
this._decoder = new StringDecoder();
this._parser = new Parser(cbs, options);
}
_write(chunk, encoding, callback) {
this._parser.write(isBuffer(chunk, encoding) ? this._decoder.write(chunk) : chunk);
callback();
}
_final(callback) {
this._parser.end(this._decoder.end());
callback();
}
}
//# sourceMappingURL=WritableStream.js.map
@@ -0,0 +1,7 @@
import * as react_jsx_runtime from 'react/jsx-runtime';
import { IconSvgProps } from './types.js';
import 'react';
declare const EyeFilledIcon: (props: IconSvgProps) => react_jsx_runtime.JSX.Element;
export { EyeFilledIcon };
@@ -0,0 +1,20 @@
/**
* Checks if a given date is in a leap year.
* 检查给定的日期是否在闰年。
*
* @param date - The date to check. (要检查的日期。)
* @returns A boolean indicating whether the given date is in a leap year. (布尔值,表示给定的日期是否在闰年。)
* @example
* ```ts
* // Checking if a date is in a leap year (检查一个日期是否在闰年)
* const date1 = new Date('2024-01-01');
* const isLeap = isLeapYear(date1);
* console.log(isLeap); // Outputs: true (输出: true)
*
* // Checking if a date is not in a leap year (检查一个日期是否不在闰年)
* const date2 = new Date('2023-01-01');
* const isNotLeap = isLeapYear(date2);
* console.log(isNotLeap); // Outputs: false (输出: false)
* ```
*/
export default function isLeapYear(date: Date): boolean;
@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var get_import_nodes_1 = require("../get-import-nodes");
var get_sorted_import_specifiers_1 = require("../get-sorted-import-specifiers");
var get_sorted_nodes_modules_names_1 = require("../get-sorted-nodes-modules-names");
test('should return correct sorted nodes', function () {
var code = "import { filter, reduce, eventHandler } from '@server/z';";
var importNode = (0, get_import_nodes_1.getImportNodes)(code)[0];
var sortedImportSpecifiers = (0, get_sorted_import_specifiers_1.getSortedImportSpecifiers)(importNode);
var specifiersList = (0, get_sorted_nodes_modules_names_1.getSortedNodesModulesNames)(sortedImportSpecifiers.specifiers);
expect(specifiersList).toEqual(['eventHandler', 'filter', 'reduce']);
});
test('should return correct sorted nodes with default import', function () {
var code = "import Component, { filter, reduce, eventHandler } from '@server/z';";
var importNode = (0, get_import_nodes_1.getImportNodes)(code)[0];
var sortedImportSpecifiers = (0, get_sorted_import_specifiers_1.getSortedImportSpecifiers)(importNode);
var specifiersList = (0, get_sorted_nodes_modules_names_1.getSortedNodesModulesNames)(sortedImportSpecifiers.specifiers);
expect(specifiersList).toEqual([
'Component',
'eventHandler',
'filter',
'reduce',
]);
});
@@ -0,0 +1,26 @@
/** Used to compose unicode character classes. */
var rsAstralRange = '\\ud800-\\udfff',
rsComboMarksRange = '\\u0300-\\u036f',
reComboHalfMarksRange = '\\ufe20-\\ufe2f',
rsComboSymbolsRange = '\\u20d0-\\u20ff',
rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
rsVarRange = '\\ufe0e\\ufe0f';
/** Used to compose unicode capture groups. */
var rsZWJ = '\\u200d';
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
/**
* Checks if `string` contains Unicode symbols.
*
* @private
* @param {string} string The string to inspect.
* @returns {boolean} Returns `true` if a symbol is found, else `false`.
*/
function hasUnicode(string) {
return reHasUnicode.test(string);
}
export default hasUnicode;
@@ -0,0 +1,6 @@
export * from "./algorithms";
export * from "./ec_parameters";
export * from "./ec_private_key";
export * from "./ec_signature_value";
export * from "./object_identifiers";
export * from "./rfc3279";
@@ -0,0 +1,14 @@
<svg viewbox="0 0 18 18">
<rect class="ql-stroke" height="12" width="12" x="3" y="3"></rect>
<rect class="ql-fill" height="12" width="1" x="5" y="3"></rect>
<rect class="ql-fill" height="12" width="1" x="12" y="3"></rect>
<rect class="ql-fill" height="2" width="8" x="5" y="8"></rect>
<rect class="ql-fill" height="1" width="3" x="3" y="5"></rect>
<rect class="ql-fill" height="1" width="3" x="3" y="7"></rect>
<rect class="ql-fill" height="1" width="3" x="3" y="10"></rect>
<rect class="ql-fill" height="1" width="3" x="3" y="12"></rect>
<rect class="ql-fill" height="1" width="3" x="12" y="5"></rect>
<rect class="ql-fill" height="1" width="3" x="12" y="7"></rect>
<rect class="ql-fill" height="1" width="3" x="12" y="10"></rect>
<rect class="ql-fill" height="1" width="3" x="12" y="12"></rect>
</svg>

After

Width:  |  Height:  |  Size: 827 B

@@ -0,0 +1,165 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
elementSelectorParser: function() {
return elementSelectorParser;
},
default: function() {
return resolveDefaultsAtRules;
}
});
const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
const _postcssselectorparser = /*#__PURE__*/ _interop_require_default(require("postcss-selector-parser"));
const _featureFlags = require("../featureFlags");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
let getNode = {
id (node) {
return _postcssselectorparser.default.attribute({
attribute: "id",
operator: "=",
value: node.value,
quoteMark: '"'
});
}
};
function minimumImpactSelector(nodes) {
let rest = nodes.filter((node)=>{
// Keep non-pseudo nodes
if (node.type !== "pseudo") return true;
// Keep pseudo nodes that have subnodes
// E.g.: `:not()` contains subnodes inside the parentheses
if (node.nodes.length > 0) return true;
// Keep pseudo `elements`
// This implicitly means that we ignore pseudo `classes`
return node.value.startsWith("::") || [
":before",
":after",
":first-line",
":first-letter"
].includes(node.value);
}).reverse();
let searchFor = new Set([
"tag",
"class",
"id",
"attribute"
]);
let splitPointIdx = rest.findIndex((n)=>searchFor.has(n.type));
if (splitPointIdx === -1) return rest.reverse().join("").trim();
let node = rest[splitPointIdx];
let bestNode = getNode[node.type] ? getNode[node.type](node) : node;
rest = rest.slice(0, splitPointIdx);
let combinatorIdx = rest.findIndex((n)=>n.type === "combinator" && n.value === ">");
if (combinatorIdx !== -1) {
rest.splice(0, combinatorIdx);
rest.unshift(_postcssselectorparser.default.universal());
}
return [
bestNode,
...rest.reverse()
].join("").trim();
}
let elementSelectorParser = (0, _postcssselectorparser.default)((selectors)=>{
return selectors.map((s)=>{
let nodes = s.split((n)=>n.type === "combinator" && n.value === " ").pop();
return minimumImpactSelector(nodes);
});
});
let cache = new Map();
function extractElementSelector(selector) {
if (!cache.has(selector)) {
cache.set(selector, elementSelectorParser.transformSync(selector));
}
return cache.get(selector);
}
function resolveDefaultsAtRules({ tailwindConfig }) {
return (root)=>{
let variableNodeMap = new Map();
/** @type {Set<import('postcss').AtRule>} */ let universals = new Set();
root.walkAtRules("defaults", (rule)=>{
if (rule.nodes && rule.nodes.length > 0) {
universals.add(rule);
return;
}
let variable = rule.params;
if (!variableNodeMap.has(variable)) {
variableNodeMap.set(variable, new Set());
}
variableNodeMap.get(variable).add(rule.parent);
rule.remove();
});
if ((0, _featureFlags.flagEnabled)(tailwindConfig, "optimizeUniversalDefaults")) {
for (let universal of universals){
/** @type {Map<string, Set<string>>} */ let selectorGroups = new Map();
var _variableNodeMap_get;
let rules = (_variableNodeMap_get = variableNodeMap.get(universal.params)) !== null && _variableNodeMap_get !== void 0 ? _variableNodeMap_get : [];
for (let rule of rules){
for (let selector of extractElementSelector(rule.selector)){
// If selector contains a vendor prefix after a pseudo element or class,
// we consider them separately because merging the declarations into
// a single rule will cause browsers that do not understand the
// vendor prefix to throw out the whole rule
// Additionally if a selector contains `:has` we also consider
// it separately because FF only recently gained support for it
let selectorGroupName = selector.includes(":-") || selector.includes("::-") || selector.includes(":has") ? selector : "__DEFAULT__";
var _selectorGroups_get;
let selectors = (_selectorGroups_get = selectorGroups.get(selectorGroupName)) !== null && _selectorGroups_get !== void 0 ? _selectorGroups_get : new Set();
selectorGroups.set(selectorGroupName, selectors);
selectors.add(selector);
}
}
if (selectorGroups.size === 0) {
universal.remove();
continue;
}
for (let [, selectors] of selectorGroups){
let universalRule = _postcss.default.rule({
source: universal.source
});
universalRule.selectors = [
...selectors
];
universalRule.append(universal.nodes.map((node)=>node.clone()));
universal.before(universalRule);
}
universal.remove();
}
} else if (universals.size) {
let universalRule = _postcss.default.rule({
selectors: [
"*",
"::before",
"::after"
]
});
for (let universal of universals){
universalRule.append(universal.nodes);
if (!universalRule.parent) {
universal.before(universalRule);
}
if (!universalRule.source) {
universalRule.source = universal.source;
}
universal.remove();
}
let backdropRule = universalRule.clone({
selectors: [
"::backdrop"
]
});
universalRule.after(backdropRule);
}
};
}
@@ -0,0 +1,81 @@
{
"name": "fast-glob",
"version": "3.3.3",
"description": "It's a very fast and efficient glob library for Node.js",
"license": "MIT",
"repository": "mrmlnc/fast-glob",
"author": {
"name": "Denis Malinochkin",
"url": "https://mrmlnc.com"
},
"engines": {
"node": ">=8.6.0"
},
"main": "out/index.js",
"typings": "out/index.d.ts",
"files": [
"out",
"!out/{benchmark,tests}",
"!out/**/*.map",
"!out/**/*.spec.*"
],
"keywords": [
"glob",
"patterns",
"fast",
"implementation"
],
"devDependencies": {
"@nodelib/fs.macchiato": "^1.0.1",
"@types/glob-parent": "^5.1.0",
"@types/merge2": "^1.1.4",
"@types/micromatch": "^4.0.0",
"@types/mocha": "^5.2.7",
"@types/node": "^14.18.53",
"@types/picomatch": "^2.3.0",
"@types/sinon": "^7.5.0",
"bencho": "^0.1.1",
"eslint": "^6.5.1",
"eslint-config-mrmlnc": "^1.1.0",
"execa": "^7.1.1",
"fast-glob": "^3.0.4",
"fdir": "6.0.1",
"glob": "^10.0.0",
"hereby": "^1.8.1",
"mocha": "^6.2.1",
"rimraf": "^5.0.0",
"sinon": "^7.5.0",
"snap-shot-it": "^7.9.10",
"typescript": "^4.9.5"
},
"dependencies": {
"@nodelib/fs.stat": "^2.0.2",
"@nodelib/fs.walk": "^1.2.3",
"glob-parent": "^5.1.2",
"merge2": "^1.3.0",
"micromatch": "^4.0.8"
},
"scripts": {
"clean": "rimraf out",
"lint": "eslint \"src/**/*.ts\" --cache",
"compile": "tsc",
"test": "mocha \"out/**/*.spec.js\" -s 0",
"test:e2e": "mocha \"out/**/*.e2e.js\" -s 0",
"test:e2e:sync": "mocha \"out/**/*.e2e.js\" -s 0 --grep \"\\(sync\\)\"",
"test:e2e:async": "mocha \"out/**/*.e2e.js\" -s 0 --grep \"\\(async\\)\"",
"test:e2e:stream": "mocha \"out/**/*.e2e.js\" -s 0 --grep \"\\(stream\\)\"",
"build": "npm run clean && npm run compile && npm run lint && npm test",
"watch": "npm run clean && npm run compile -- -- --sourceMap --watch",
"bench:async": "npm run bench:product:async && npm run bench:regression:async",
"bench:stream": "npm run bench:product:stream && npm run bench:regression:stream",
"bench:sync": "npm run bench:product:sync && npm run bench:regression:sync",
"bench:product": "npm run bench:product:async && npm run bench:product:sync && npm run bench:product:stream",
"bench:product:async": "hereby bench:product:async",
"bench:product:sync": "hereby bench:product:sync",
"bench:product:stream": "hereby bench:product:stream",
"bench:regression": "npm run bench:regression:async && npm run bench:regression:sync && npm run bench:regression:stream",
"bench:regression:async": "hereby bench:regression:async",
"bench:regression:sync": "hereby bench:regression:sync",
"bench:regression:stream": "hereby bench:regression:stream"
}
}
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F A B wC"},B:{"1":"GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I","2":"C L M G N O P Q H R S T U V W X Y Z a b","132":"0 1 2 3 4 5 c d e f g h i j k l m n o p q r s t u v w x y z"},C:{"2":"0 1 2 3 4 5 6 7 8 9 xC TC J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC 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 GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC yC zC 0C 1C"},D:{"1":"GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC","2":"6 7 8 9 J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R S T U V W X Y Z a b","132":"0 1 2 3 4 5 c d e f g h i j k l m n o p q r s t u v w x y z"},E:{"2":"J ZB K D E F A B C L M G 2C ZC 3C 4C 5C 6C aC NC OC 7C 8C 9C bC cC PC AD QC dC eC fC gC hC BD RC iC jC kC lC mC CD SC nC oC pC qC rC sC tC DD ED"},F:{"16":"0 1 2 3 4 5 6 7 8 9 F B C G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC 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 FD GD HD ID NC uC JD OC"},G:{"2":"E ZC KD vC LD MD ND OD PD QD RD SD TD UD VD WD XD YD ZD aD bD cD dD bC cC PC eD QC dC eC fC gC hC fD RC iC jC kC lC mC gD SC nC oC pC qC rC sC tC"},H:{"2":"hD"},I:{"2":"TC J I iD jD kD lD vC mD nD"},J:{"2":"D A"},K:{"2":"A B C H NC uC OC"},L:{"194":"I"},M:{"2":"MC"},N:{"2":"A B"},O:{"2":"PC"},P:{"2":"6 7 8 9 J AB BB CB DB EB FB oD pD qD rD sD aC tD uD vD wD xD QC RC SC yD"},Q:{"2":"zD"},R:{"2":"0D"},S:{"2":"1D 2D"}},B:1,C:"CSS Module Scripts",D:false};
@@ -0,0 +1,169 @@
/**
* @import {
* Code,
* Effects,
* State,
* TokenType
* } from 'micromark-util-types'
*/
import {factorySpace} from 'micromark-factory-space'
import {markdownLineEnding} from 'micromark-util-character'
import {codes, constants, types} from 'micromark-util-symbol'
/**
* Parse titles.
*
* ###### Examples
*
* ```markdown
* "a"
* 'b'
* (c)
* "a
* b"
* 'a
* b'
* (a\)b)
* ```
*
* @param {Effects} effects
* Context.
* @param {State} ok
* State switched to when successful.
* @param {State} nok
* State switched to when unsuccessful.
* @param {TokenType} type
* Type of the whole title (`"a"`, `'b'`, `(c)`).
* @param {TokenType} markerType
* Type for the markers (`"`, `'`, `(`, and `)`).
* @param {TokenType} stringType
* Type for the value (`a`).
* @returns {State}
* Start state.
*/
export function factoryTitle(effects, ok, nok, type, markerType, stringType) {
/** @type {NonNullable<Code>} */
let marker
return start
/**
* Start of title.
*
* ```markdown
* > | "a"
* ^
* ```
*
* @type {State}
*/
function start(code) {
if (
code === codes.quotationMark ||
code === codes.apostrophe ||
code === codes.leftParenthesis
) {
effects.enter(type)
effects.enter(markerType)
effects.consume(code)
effects.exit(markerType)
marker = code === codes.leftParenthesis ? codes.rightParenthesis : code
return begin
}
return nok(code)
}
/**
* After opening marker.
*
* This is also used at the closing marker.
*
* ```markdown
* > | "a"
* ^
* ```
*
* @type {State}
*/
function begin(code) {
if (code === marker) {
effects.enter(markerType)
effects.consume(code)
effects.exit(markerType)
effects.exit(type)
return ok
}
effects.enter(stringType)
return atBreak(code)
}
/**
* At something, before something else.
*
* ```markdown
* > | "a"
* ^
* ```
*
* @type {State}
*/
function atBreak(code) {
if (code === marker) {
effects.exit(stringType)
return begin(marker)
}
if (code === codes.eof) {
return nok(code)
}
// Note: blank lines can’t exist in content.
if (markdownLineEnding(code)) {
// To do: use `space_or_tab_eol_with_options`, connect.
effects.enter(types.lineEnding)
effects.consume(code)
effects.exit(types.lineEnding)
return factorySpace(effects, atBreak, types.linePrefix)
}
effects.enter(types.chunkString, {contentType: constants.contentTypeString})
return inside(code)
}
/**
*
*
* @type {State}
*/
function inside(code) {
if (code === marker || code === codes.eof || markdownLineEnding(code)) {
effects.exit(types.chunkString)
return atBreak(code)
}
effects.consume(code)
return code === codes.backslash ? escape : inside
}
/**
* After `\`, at a special character.
*
* ```markdown
* > | "a\*b"
* ^
* ```
*
* @type {State}
*/
function escape(code) {
if (code === marker || code === codes.backslash) {
effects.consume(code)
return inside
}
return inside(code)
}
}
@@ -0,0 +1,48 @@
/**
* This splits a string on a top-level character.
*
* Regex doesn't support recursion (at least not the JS-flavored version).
* So we have to use a tiny state machine to keep track of paren placement.
*
* Expected behavior using commas:
* var(--a, 0 0 1px rgb(0, 0, 0)), 0 0 1px rgb(0, 0, 0)
* ─┬─ ┬ ┬ ┬
* x x x ╰──────── Split because top-level
* ╰──────────────┴──┴───────────── Ignored b/c inside >= 1 levels of parens
*
* @param {string} input
* @param {string} separator
*/
export function splitAtTopLevelOnly(input, separator) {
let stack = []
let parts = []
let lastPos = 0
let isEscaped = false
for (let idx = 0; idx < input.length; idx++) {
let char = input[idx]
if (stack.length === 0 && char === separator[0] && !isEscaped) {
if (separator.length === 1 || input.slice(idx, idx + separator.length) === separator) {
parts.push(input.slice(lastPos, idx))
lastPos = idx + separator.length
}
}
isEscaped = isEscaped ? false : char === '\\'
if (char === '(' || char === '[' || char === '{') {
stack.push(char)
} else if (
(char === ')' && stack[stack.length - 1] === '(') ||
(char === ']' && stack[stack.length - 1] === '[') ||
(char === '}' && stack[stack.length - 1] === '{')
) {
stack.pop()
}
}
parts.push(input.slice(lastPos))
return parts
}
@@ -0,0 +1 @@
{"version":3,"file":"msWord.js","names":["ignoreRegexp","idRegexp","indentRegexp","parseListItem","element","html","style","getAttribute","idMatch","match","id","Number","indentMatch","indent","typeRegexp","RegExp","typeMatch","type","normalizeListItem","doc","msoList","Array","from","querySelectorAll","ignored","others","forEach","node","shouldIgnore","push","parentNode","removeChild","documentElement","innerHTML","listItems","map","filter","parsed","length","childListItems","current","shift","nextElementSibling","ul","document","createElement","listItem","li","setAttribute","appendChild","replaceChild","slice","_ref","e","normalize"],"sources":["../../../../src/modules/normalizeExternalHTML/normalizers/msWord.ts"],"sourcesContent":["const ignoreRegexp = /\\bmso-list:[^;]*ignore/i;\nconst idRegexp = /\\bmso-list:[^;]*\\bl(\\d+)/i;\nconst indentRegexp = /\\bmso-list:[^;]*\\blevel(\\d+)/i;\n\nconst parseListItem = (element: Element, html: string) => {\n const style = element.getAttribute('style');\n const idMatch = style?.match(idRegexp);\n if (!idMatch) {\n return null;\n }\n const id = Number(idMatch[1]);\n\n const indentMatch = style?.match(indentRegexp);\n const indent = indentMatch ? Number(indentMatch[1]) : 1;\n\n const typeRegexp = new RegExp(\n `@list l${id}:level${indent}\\\\s*\\\\{[^\\\\}]*mso-level-number-format:\\\\s*([\\\\w-]+)`,\n 'i',\n );\n const typeMatch = html.match(typeRegexp);\n const type = typeMatch && typeMatch[1] === 'bullet' ? 'bullet' : 'ordered';\n\n return { id, indent, type, element };\n};\n\n// list items are represented as `p` tags with styles like `mso-list: l0 level1` where:\n// 1. \"0\" in \"l0\" means the list item id;\n// 2. \"1\" in \"level1\" means the indent level, starting from 1.\nconst normalizeListItem = (doc: Document) => {\n const msoList = Array.from(doc.querySelectorAll('[style*=mso-list]'));\n const ignored: Element[] = [];\n const others: Element[] = [];\n msoList.forEach((node) => {\n const shouldIgnore = (node.getAttribute('style') || '').match(ignoreRegexp);\n if (shouldIgnore) {\n ignored.push(node);\n } else {\n others.push(node);\n }\n });\n\n // Each list item contains a marker wrapped with \"mso-list: Ignore\".\n ignored.forEach((node) => node.parentNode?.removeChild(node));\n\n // The list stype is not defined inline with the tag, instead, it's in the\n // style tag so we need to pass the html as a string.\n const html = doc.documentElement.innerHTML;\n const listItems = others\n .map((element) => parseListItem(element, html))\n .filter((parsed) => parsed);\n\n while (listItems.length) {\n const childListItems = [];\n\n let current = listItems.shift();\n // Group continuous items into the same group (aka \"ul\")\n while (current) {\n childListItems.push(current);\n current =\n listItems.length &&\n listItems[0]?.element === current.element.nextElementSibling &&\n // Different id means the next item doesn't belong to this group.\n listItems[0].id === current.id\n ? listItems.shift()\n : null;\n }\n\n const ul = document.createElement('ul');\n childListItems.forEach((listItem) => {\n const li = document.createElement('li');\n li.setAttribute('data-list', listItem.type);\n if (listItem.indent > 1) {\n li.setAttribute('class', `ql-indent-${listItem.indent - 1}`);\n }\n li.innerHTML = listItem.element.innerHTML;\n ul.appendChild(li);\n });\n\n const element = childListItems[0]?.element;\n const { parentNode } = element ?? {};\n if (element) {\n parentNode?.replaceChild(ul, element);\n }\n childListItems.slice(1).forEach(({ element: e }) => {\n parentNode?.removeChild(e);\n });\n }\n};\n\nexport default function normalize(doc: Document) {\n if (\n doc.documentElement.getAttribute('xmlns:w') ===\n 'urn:schemas-microsoft-com:office:word'\n ) {\n normalizeListItem(doc);\n }\n}\n"],"mappings":"AAAA,MAAMA,YAAY,GAAG,yBAAyB;AAC9C,MAAMC,QAAQ,GAAG,2BAA2B;AAC5C,MAAMC,YAAY,GAAG,+BAA+B;AAEpD,MAAMC,aAAa,GAAGA,CAACC,OAAgB,EAAEC,IAAY,KAAK;EACxD,MAAMC,KAAK,GAAGF,OAAO,CAACG,YAAY,CAAC,OAAO,CAAC;EAC3C,MAAMC,OAAO,GAAGF,KAAK,EAAEG,KAAK,CAACR,QAAQ,CAAC;EACtC,IAAI,CAACO,OAAO,EAAE;IACZ,OAAO,IAAI;EACb;EACA,MAAME,EAAE,GAAGC,MAAM,CAACH,OAAO,CAAC,CAAC,CAAC,CAAC;EAE7B,MAAMI,WAAW,GAAGN,KAAK,EAAEG,KAAK,CAACP,YAAY,CAAC;EAC9C,MAAMW,MAAM,GAAGD,WAAW,GAAGD,MAAM,CAACC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;EAEvD,MAAME,UAAU,GAAG,IAAIC,MAAM,CAC1B,UAASL,EAAG,SAAQG,MAAO,qDAAoD,EAChF,GACF,CAAC;EACD,MAAMG,SAAS,GAAGX,IAAI,CAACI,KAAK,CAACK,UAAU,CAAC;EACxC,MAAMG,IAAI,GAAGD,SAAS,IAAIA,SAAS,CAAC,CAAC,CAAC,KAAK,QAAQ,GAAG,QAAQ,GAAG,SAAS;EAE1E,OAAO;IAAEN,EAAE;IAAEG,MAAM;IAAEI,IAAI;IAAEb;EAAQ,CAAC;AACtC,CAAC;;AAED;AACA;AACA;AACA,MAAMc,iBAAiB,GAAIC,GAAa,IAAK;EAC3C,MAAMC,OAAO,GAAGC,KAAK,CAACC,IAAI,CAACH,GAAG,CAACI,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;EACrE,MAAMC,OAAkB,GAAG,EAAE;EAC7B,MAAMC,MAAiB,GAAG,EAAELine truncated
@@ -0,0 +1,23 @@
'use strict';
var test = require('tape');
var availableTypedArrays = require('available-typed-arrays')();
var forEach = require('for-each');
var v = require('es-value-fixtures');
var inspect = require('object-inspect');
var typedArrayBuffer = require('../');
test('typedArrayBuffer', function (t) {
// @ts-expect-error TS sucks at concat
forEach([].concat(v.primitives, v.objects), function (nonTA) {
t['throws'](function () { typedArrayBuffer(nonTA); }, TypeError, inspect(nonTA) + ' is not a Typed Array');
});
forEach(availableTypedArrays, function (TA) {
var ta = new global[TA](0);
t.equal(typedArrayBuffer(ta), ta.buffer, inspect(ta) + ' has the same buffer as its own buffer property');
});
t.end();
});
@@ -0,0 +1,135 @@
import {Split} from './utilities';
import {StringDigit} from '../source/utilities';
/**
Like the `Get` type but receives an array of strings as a path parameter.
*/
type GetWithPath<BaseType, Keys extends readonly string[]> =
Keys extends []
? BaseType
: Keys extends [infer Head, ...infer Tail]
? GetWithPath<PropertyOf<BaseType, Extract<Head, string>>, Extract<Tail, string[]>>
: never;
/**
Splits a dot-prop style path into a tuple comprised of the properties in the path. Handles square-bracket notation.
@example
```
ToPath<'foo.bar.baz'>
//=> ['foo', 'bar', 'baz']
ToPath<'foo[0].bar.baz'>
//=> ['foo', '0', 'bar', 'baz']
```
*/
type ToPath<S extends string> = Split<FixPathSquareBrackets<S>, '.'>;
/**
Replaces square-bracketed dot notation with dots, for example, `foo[0].bar` -> `foo.0.bar`.
*/
type FixPathSquareBrackets<Path extends string> =
Path extends `${infer Head}[${infer Middle}]${infer Tail}`
? `${Head}.${Middle}${FixPathSquareBrackets<Tail>}`
: Path;
/**
Returns true if `LongString` is made up out of `Substring` repeated 0 or more times.
@example
```
ConsistsOnlyOf<'aaa', 'a'> //=> true
ConsistsOnlyOf<'ababab', 'ab'> //=> true
ConsistsOnlyOf<'aBa', 'a'> //=> false
ConsistsOnlyOf<'', 'a'> //=> true
```
*/
type ConsistsOnlyOf<LongString extends string, Substring extends string> =
LongString extends ''
? true
: LongString extends `${Substring}${infer Tail}`
? ConsistsOnlyOf<Tail, Substring>
: false;
/**
Convert a type which may have number keys to one with string keys, making it possible to index using strings retrieved from template types.
@example
```
type WithNumbers = {foo: string; 0: boolean};
type WithStrings = WithStringKeys<WithNumbers>;
type WithNumbersKeys = keyof WithNumbers;
//=> 'foo' | 0
type WithStringsKeys = keyof WithStrings;
//=> 'foo' | '0'
```
*/
type WithStringKeys<BaseType extends Record<string | number, any>> = {
[Key in `${Extract<keyof BaseType, string | number>}`]: BaseType[Key]
};
/**
Get a property of an object or array. Works when indexing arrays using number-literal-strings, for example, `PropertyOf<number[], '0'> = number`, and when indexing objects with number keys.
Note:
- Returns `unknown` if `Key` is not a property of `BaseType`, since TypeScript uses structural typing, and it cannot be guaranteed that extra properties unknown to the type system will exist at runtime.
- Returns `undefined` from nullish values, to match the behaviour of most deep-key libraries like `lodash`, `dot-prop`, etc.
*/
type PropertyOf<BaseType, Key extends string> =
BaseType extends null | undefined
? undefined
: Key extends keyof BaseType
? BaseType[Key]
: BaseType extends [] | [unknown, ...unknown[]]
? unknown // It's a tuple, but `Key` did not extend `keyof BaseType`. So the index is out of bounds.
: BaseType extends {
[n: number]: infer Item;
length: number; // Note: This is needed to avoid being too lax with records types using number keys like `{0: string; 1: boolean}`.
}
? (
ConsistsOnlyOf<Key, StringDigit> extends true
? Item
: unknown
)
: Key extends keyof WithStringKeys<BaseType>
? WithStringKeys<BaseType>[Key]
: unknown;
// This works by first splitting the path based on `.` and `[...]` characters into a tuple of string keys. Then it recursively uses the head key to get the next property of the current object, until there are no keys left. Number keys extract the item type from arrays, or are converted to strings to extract types from tuples and dictionaries with number keys.
/**
Get a deeply-nested property from an object using a key path, like Lodash's `.get()` function.
Use-case: Retrieve a property from deep inside an API response or some other complex object.
@example
```
import {Get} from 'type-fest';
import * as lodash from 'lodash';
const get = <BaseType, Path extends string>(object: BaseType, path: Path): Get<BaseType, Path> =>
lodash.get(object, path);
interface ApiResponse {
hits: {
hits: Array<{
_id: string
_source: {
name: Array<{
given: string[]
family: string
}>
birthDate: string
}
}>
}
}
const getName = (apiResponse: ApiResponse) =>
get(apiResponse, 'hits.hits[0]._source.name');
//=> Array<{given: string[]; family: string}>
```
@category Template Literals
*/
export type Get<BaseType, Path extends string> = GetWithPath<BaseType, ToPath<Path>>;
@@ -0,0 +1,20 @@
/**
* The base implementation of `_.times` without support for iteratee shorthands
* or max array length checks.
*
* @private
* @param {number} n The number of times to invoke `iteratee`.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the array of results.
*/
function baseTimes(n, iteratee) {
var index = -1,
result = Array(n);
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
module.exports = baseTimes;
@@ -0,0 +1,33 @@
"use strict";
var AuthorityInfoAccessSyntax_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthorityInfoAccessSyntax = exports.AccessDescription = exports.id_pe_authorityInfoAccess = void 0;
const tslib_1 = require("tslib");
const asn1_schema_1 = require("@peculiar/asn1-schema");
const general_name_1 = require("../general_name");
const object_identifiers_1 = require("../object_identifiers");
exports.id_pe_authorityInfoAccess = `${object_identifiers_1.id_pe}.1`;
class AccessDescription {
constructor(params = {}) {
this.accessMethod = "";
this.accessLocation = new general_name_1.GeneralName();
Object.assign(this, params);
}
}
exports.AccessDescription = AccessDescription;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.ObjectIdentifier })
], AccessDescription.prototype, "accessMethod", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: general_name_1.GeneralName })
], AccessDescription.prototype, "accessLocation", void 0);
let AuthorityInfoAccessSyntax = AuthorityInfoAccessSyntax_1 = class AuthorityInfoAccessSyntax extends asn1_schema_1.AsnArray {
constructor(items) {
super(items);
Object.setPrototypeOf(this, AuthorityInfoAccessSyntax_1.prototype);
}
};
exports.AuthorityInfoAccessSyntax = AuthorityInfoAccessSyntax;
exports.AuthorityInfoAccessSyntax = AuthorityInfoAccessSyntax = AuthorityInfoAccessSyntax_1 = tslib_1.__decorate([
(0, asn1_schema_1.AsnType)({ type: asn1_schema_1.AsnTypeTypes.Sequence, itemType: AccessDescription })
], AuthorityInfoAccessSyntax);
@@ -0,0 +1,15 @@
# Installation
> `npm install --save @types/estree-jsx`
# Summary
This package contains type definitions for estree-jsx (https://github.com/facebook/jsx).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree-jsx.
### Additional Details
* Last updated: Fri, 23 Feb 2024 02:11:41 GMT
* Dependencies: [@types/estree](https://npmjs.com/package/@types/estree)
# Credits
These definitions were written by [Tony Ross](https://github.com/antross).
@@ -0,0 +1,75 @@
'use strict';
var isWindows = process.platform === 'win32';
// Regex to split a windows path into into [dir, root, basename, name, ext]
var splitWindowsRe =
/^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/;
var win32 = {};
function win32SplitPath(filename) {
return splitWindowsRe.exec(filename).slice(1);
}
win32.parse = function(pathString) {
if (typeof pathString !== 'string') {
throw new TypeError(
"Parameter 'pathString' must be a string, not " + typeof pathString
);
}
var allParts = win32SplitPath(pathString);
if (!allParts || allParts.length !== 5) {
throw new TypeError("Invalid path '" + pathString + "'");
}
return {
root: allParts[1],
dir: allParts[0] === allParts[1] ? allParts[0] : allParts[0].slice(0, -1),
base: allParts[2],
ext: allParts[4],
name: allParts[3]
};
};
// Split a filename into [dir, root, basename, name, ext], unix version
// 'root' is just a slash, or nothing.
var splitPathRe =
/^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/;
var posix = {};
function posixSplitPath(filename) {
return splitPathRe.exec(filename).slice(1);
}
posix.parse = function(pathString) {
if (typeof pathString !== 'string') {
throw new TypeError(
"Parameter 'pathString' must be a string, not " + typeof pathString
);
}
var allParts = posixSplitPath(pathString);
if (!allParts || allParts.length !== 5) {
throw new TypeError("Invalid path '" + pathString + "'");
}
return {
root: allParts[1],
dir: allParts[0].slice(0, -1),
base: allParts[2],
ext: allParts[4],
name: allParts[3],
};
};
if (isWindows)
module.exports = win32.parse;
else /* posix */
module.exports = posix.parse;
module.exports.posix = posix.parse;
module.exports.win32 = win32.parse;
@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
function isWhat(value, type, comparingType) {
return type === comparingType;
}
exports.isWhat = isWhat;
@@ -0,0 +1,59 @@
'use strict';
var test = require('tape');
var debug = require('object-inspect');
var forEach = require('for-each');
var isMap = require('..');
test('non-collections', function (t) {
forEach([
null,
undefined,
true,
false,
42,
0,
-0,
NaN,
Infinity,
'',
'foo',
/a/g,
[],
{},
function () {}
], function (nonCollection) {
t.equal(isMap(nonCollection), false, debug(nonCollection) + ' is not a Map');
});
t.end();
});
test('Maps', { skip: typeof Map !== 'function' }, function (t) {
var m = new Map();
t.equal(isMap(m), true, debug(m) + ' is a Map');
t.end();
});
test('Sets', { skip: typeof Set !== 'function' }, function (t) {
var s = new Set();
t.equal(isMap(s), false, debug(s) + ' is not a Map');
t.end();
});
test('WeakMaps', { skip: typeof WeakMap !== 'function' }, function (t) {
var wm = new WeakMap();
t.equal(isMap(wm), false, debug(wm) + ' is not a Map');
t.end();
});
test('WeakSets', { skip: typeof WeakSet !== 'function' }, function (t) {
var ws = new WeakSet();
t.equal(isMap(ws), false, debug(ws) + ' is not a Map');
t.end();
});
@@ -0,0 +1 @@
{"mappings":"AAAA,iBAAiB;IAAG,WAAW,CAAC,SAAM,CAAC;AACvC","sources":["packages/@react-aria/overlays/intl/et-EE.json"],"sourcesContent":["{\n \"dismiss\": \"Lõpeta\"\n}\n"],"names":[],"version":3,"file":"et-EE.main.js.map"}
@@ -0,0 +1,44 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.matchExpectedRPID = matchExpectedRPID;
const toHash_js_1 = require("./toHash.js");
const index_js_1 = require("./iso/index.js");
/**
* Go through each expected RP ID and try to find one that matches. Returns the unhashed RP ID
* that matched the hash in the response.
*
* Raises an `UnexpectedRPIDHash` error if no match is found
*/
async function matchExpectedRPID(rpIDHash, expectedRPIDs) {
try {
const matchedRPID = await Promise.any(expectedRPIDs.map((expected) => {
return new Promise((resolve, reject) => {
(0, toHash_js_1.toHash)(index_js_1.isoUint8Array.fromASCIIString(expected)).then((expectedRPIDHash) => {
if (index_js_1.isoUint8Array.areEqual(rpIDHash, expectedRPIDHash)) {
resolve(expected);
}
else {
reject();
}
});
});
}));
return matchedRPID;
}
catch (err) {
const _err = err;
// This means no matches were found
if (_err.name === 'AggregateError') {
throw new UnexpectedRPIDHash();
}
// An unexpected error occurred
throw err;
}
}
class UnexpectedRPIDHash extends Error {
constructor() {
const message = 'Unexpected RP ID hash';
super(message);
this.name = 'UnexpectedRPIDHash';
}
}
@@ -0,0 +1,297 @@
/**
* @author Toru Nagashima
* See LICENSE file in root directory for full license.
*/
"use strict"
/*istanbul ignore next */
/**
* This function is copied from https://github.com/eslint/eslint/blob/2355f8d0de1d6732605420d15ddd4f1eee3c37b6/lib/ast-utils.js#L648-L684
*
* @param {ASTNode} node - The node to get.
* @returns {string|null} The property name if static. Otherwise, null.
* @private
*/
function getStaticPropertyName(node) {
let prop = null
switch (node && node.type) {
case "Property":
case "MethodDefinition":
prop = node.key
break
case "MemberExpression":
prop = node.property
break
// no default
}
switch (prop && prop.type) {
case "Literal":
return String(prop.value)
case "TemplateLiteral":
if (prop.expressions.length === 0 && prop.quasis.length === 1) {
return prop.quasis[0].value.cooked
}
break
case "Identifier":
if (!node.computed) {
return prop.name
}
break
// no default
}
return null
}
/**
* Checks whether the given node is assignee or not.
*
* @param {ASTNode} node - The node to check.
* @returns {boolean} `true` if the node is assignee.
*/
function isAssignee(node) {
return (
node.parent.type === "AssignmentExpression" && node.parent.left === node
)
}
/**
* Gets the top assignment expression node if the given node is an assignee.
*
* This is used to distinguish 2 assignees belong to the same assignment.
* If the node is not an assignee, this returns null.
*
* @param {ASTNode} leafNode - The node to get.
* @returns {ASTNode|null} The top assignment expression node, or null.
*/
function getTopAssignment(leafNode) {
let node = leafNode
// Skip MemberExpressions.
while (
node.parent.type === "MemberExpression" &&
node.parent.object === node
) {
node = node.parent
}
// Check assignments.
if (!isAssignee(node)) {
return null
}
// Find the top.
while (node.parent.type === "AssignmentExpression") {
node = node.parent
}
return node
}
/**
* Gets top assignment nodes of the given node list.
*
* @param {ASTNode[]} nodes - The node list to get.
* @returns {ASTNode[]} Gotten top assignment nodes.
*/
function createAssignmentList(nodes) {
return nodes.map(getTopAssignment).filter(Boolean)
}
/**
* Gets the reference of `module.exports` from the given scope.
*
* @param {escope.Scope} scope - The scope to get.
* @returns {ASTNode[]} Gotten MemberExpression node list.
*/
function getModuleExportsNodes(scope) {
const variable = scope.set.get("module")
if (variable == null) {
return []
}
return variable.references
.map(reference => reference.identifier.parent)
.filter(
node =>
node.type === "MemberExpression" &&
getStaticPropertyName(node) === "exports"
)
}
/**
* Gets the reference of `exports` from the given scope.
*
* @param {escope.Scope} scope - The scope to get.
* @returns {ASTNode[]} Gotten Identifier node list.
*/
function getExportsNodes(scope) {
const variable = scope.set.get("exports")
if (variable == null) {
return []
}
return variable.references.map(reference => reference.identifier)
}
module.exports = {
meta: {
docs: {
description: "enforce either `module.exports` or `exports`",
category: "Stylistic Issues",
recommended: false,
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/exports-style.md",
},
type: "suggestion",
fixable: null,
schema: [
{
//
enum: ["module.exports", "exports"],
},
{
type: "object",
properties: { allowBatchAssign: { type: "boolean" } },
additionalProperties: false,
},
],
},
create(context) {
const mode = context.options[0] || "module.exports"
const batchAssignAllowed = Boolean(
context.options[1] != null && context.options[1].allowBatchAssign
)
const sourceCode = context.getSourceCode()
/**
* Gets the location info of reports.
*
* exports = foo
* ^^^^^^^^^
*
* module.exports = foo
* ^^^^^^^^^^^^^^^^
*
* @param {ASTNode} node - The node of `exports`/`module.exports`.
* @returns {Location} The location info of reports.
*/
function getLocation(node) {
const token = sourceCode.getTokenAfter(node)
return {
start: node.loc.start,
end: token.loc.end,
}
}
/**
* Enforces `module.exports`.
* This warns references of `exports`.
*
* @returns {void}
*/
function enforceModuleExports() {
const globalScope = context.getScope()
const exportsNodes = getExportsNodes(globalScope)
const assignList = batchAssignAllowed
? createAssignmentList(getModuleExportsNodes(globalScope))
: []
for (const node of exportsNodes) {
// Skip if it's a batch assignment.
if (
assignList.length > 0 &&
assignList.indexOf(getTopAssignment(node)) !== -1
) {
continue
}
// Report.
context.report({
node,
loc: getLocation(node),
message:
"Unexpected access to 'exports'. Use 'module.exports' instead.",
})
}
}
/**
* Enforces `exports`.
* This warns references of `module.exports`.
*
* @returns {void}
*/
function enforceExports() {
const globalScope = context.getScope()
const exportsNodes = getExportsNodes(globalScope)
const moduleExportsNodes = getModuleExportsNodes(globalScope)
const assignList = batchAssignAllowed
? createAssignmentList(exportsNodes)
: []
const batchAssignList = []
for (const node of moduleExportsNodes) {
// Skip if it's a batch assignment.
if (assignList.length > 0) {
const found = assignList.indexOf(getTopAssignment(node))
if (found !== -1) {
batchAssignList.push(assignList[found])
assignList.splice(found, 1)
continue
}
}
// Report.
context.report({
node,
loc: getLocation(node),
message:
"Unexpected access to 'module.exports'. Use 'exports' instead.",
})
}
// Disallow direct assignment to `exports`.
for (const node of exportsNodes) {
// Skip if it's not assignee.
if (!isAssignee(node)) {
continue
}
// Check if it's a batch assignment.
if (batchAssignList.indexOf(getTopAssignment(node)) !== -1) {
continue
}
// Report.
context.report({
node,
loc: getLocation(node),
message:
"Unexpected assignment to 'exports'. Don't modify 'exports' itself.",
})
}
}
return {
"Program:exit"() {
switch (mode) {
case "module.exports":
enforceModuleExports()
break
case "exports":
enforceExports()
break
// no default
}
},
}
},
}
@@ -0,0 +1,4 @@
interface Transform<TIn, TOut> {
transform: (incoming: TIn, ...args: any[]) => TOut;
}
export default Transform;
@@ -0,0 +1,42 @@
// English (Trinidad & Tobago) [en-tt]
import dayjs from '../index';
var locale = {
name: 'en-tt',
weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
weekStart: 1,
yearStart: 4,
relativeTime: {
future: 'in %s',
past: '%s ago',
s: 'a few seconds',
m: 'a minute',
mm: '%d minutes',
h: 'an hour',
hh: '%d hours',
d: 'a day',
dd: '%d days',
M: 'a month',
MM: '%d months',
y: 'a year',
yy: '%d years'
},
formats: {
LT: 'HH:mm',
LTS: 'HH:mm:ss',
L: 'DD/MM/YYYY',
LL: 'D MMMM YYYY',
LLL: 'D MMMM YYYY HH:mm',
LLLL: 'dddd, D MMMM YYYY HH:mm'
},
ordinal: function ordinal(n) {
var s = ['th', 'st', 'nd', 'rd'];
var v = n % 100;
return "[" + n + (s[(v - 20) % 10] || s[v] || s[0]) + "]";
}
};
dayjs.locale(locale, null, true);
export default locale;
@@ -0,0 +1,101 @@
{
"name": "function.prototype.name",
"version": "1.1.8",
"author": "Jordan Harband <ljharb@gmail.com>",
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"description": "An ES2015 spec-compliant `Function.prototype.name` shim",
"license": "MIT",
"main": "index.js",
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepublish": "not-in-publish || npm run prepublishOnly",
"prepublishOnly": "safe-publish-latest",
"pretest": "npm run lint",
"test": "npm run --silent tests-only",
"posttest": "npx npm@'>=10.2' audit --production",
"tests-only": "nyc tape 'test/**/*.js'",
"prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')",
"lint": "eslint --ext=js,mjs .",
"postlint": "es-shim-api --bound",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"repository": {
"type": "git",
"url": "git://github.com/es-shims/Function.prototype.name.git"
},
"keywords": [
"Function.prototype.name",
"function",
"name",
"ES6",
"ES2015",
"shim",
"polyfill",
"es-shim API"
],
"dependencies": {
"call-bind": "^1.0.8",
"call-bound": "^1.0.3",
"define-properties": "^1.2.1",
"functions-have-names": "^1.2.3",
"hasown": "^2.0.2",
"is-callable": "^1.2.7"
},
"devDependencies": {
"@es-shims/api": "^2.5.1",
"@ljharb/eslint-config": "^21.1.1",
"auto-changelog": "^2.5.0",
"eclint": "^2.8.1",
"encoding": "^0.1.13",
"eslint": "=8.8.0",
"for-each": "^0.3.3",
"has-strict-mode": "^1.0.1",
"in-publish": "^2.0.1",
"make-arrow-function": "^1.2.0",
"make-async-function": "^1.0.0",
"make-generator-function": "^2.0.0",
"npmignore": "^0.3.1",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.9.0",
"uglify-register": "^1.0.1"
},
"testling": {
"files": "test/index.js",
"browsers": [
"iexplore/9.0..latest",
"firefox/4.0..6.0",
"firefox/15.0..latest",
"firefox/nightly",
"chrome/4.0..10.0",
"chrome/20.0..latest",
"chrome/canary",
"opera/11.6..latest",
"opera/next",
"safari/5.0..latest",
"ipad/6.0..latest",
"iphone/6.0..latest",
"android-browser/4.2"
]
},
"engines": {
"node": ">= 0.4"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true,
"startingVersion": "v1.1.6"
},
"publishConfig": {
"ignore": [
".github/workflows"
]
}
}
@@ -0,0 +1,4 @@
import type { Pair } from './Pair';
import type { ToJSContext } from './toJS';
import type { MapLike } from './YAMLMap';
export declare function addPairToJSMap(ctx: ToJSContext | undefined, map: MapLike, { key, value }: Pair): MapLike;
@@ -0,0 +1,515 @@
# micromark-extension-gfm-table
[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]
[![Sponsors][sponsors-badge]][collective]
[![Backers][backers-badge]][collective]
[![Chat][chat-badge]][chat]
[micromark][] extensions to support GFM [tables][].
## Contents
* [What is this?](#what-is-this)
* [When to use this](#when-to-use-this)
* [Install](#install)
* [Use](#use)
* [API](#api)
* [`gfmTable()`](#gfmtable)
* [`gfmTableHtml()`](#gfmtablehtml)
* [Bugs](#bugs)
* [Authoring](#authoring)
* [HTML](#html)
* [CSS](#css)
* [Syntax](#syntax)
* [Types](#types)
* [Compatibility](#compatibility)
* [Security](#security)
* [Related](#related)
* [Contribute](#contribute)
* [License](#license)
## What is this?
This package contains extensions that add support for the table syntax enabled
by GFM to [`micromark`][micromark].
These extensions match github.com.
## When to use this
This project is useful when you want to support tables in markdown.
You can use these extensions when you are working with [`micromark`][micromark].
To support all GFM features, use
[`micromark-extension-gfm`][micromark-extension-gfm] instead.
When you need a syntax tree, combine this package with
[`mdast-util-gfm-table`][mdast-util-gfm-table].
All these packages are used in [`remark-gfm`][remark-gfm], which focusses on
making it easier to transform content by abstracting these internals away.
## Install
This package is [ESM only][esm].
In Node.js (version 16+), install with [npm][]:
```sh
npm install micromark-extension-gfm-table
```
In Deno with [`esm.sh`][esmsh]:
```js
import {gfmTable, gfmTableHtml} from 'https://esm.sh/micromark-extension-gfm-table@2'
```
In browsers with [`esm.sh`][esmsh]:
```html
<script type="module">
import {gfmTable, gfmTableHtml} from 'https://esm.sh/micromark-extension-gfm-table@2?bundle'
</script>
```
## Use
```js
import {micromark} from 'micromark'
import {gfmTable, gfmTableHtml} from 'micromark-extension-gfm-table'
const output = micromark('| a |\n| - |', {
extensions: [gfmTable()],
htmlExtensions: [gfmTableHtml()]
})
console.log(output)
```
Yields:
```html
<table>
<thead>
<tr>
<th>a</th>
</tr>
</thead>
</table>
```
## API
This package exports the identifiers [`gfmTable`][api-gfm-table] and
[`gfmTableHtml`][api-gfm-table-html].
There is no default export.
The export map supports the [`development` condition][development].
Run `node --conditions development module.js` to get instrumented dev code.
Without this condition, production code is loaded.
### `gfmTable()`
Create an HTML extension for `micromark` to support GitHub tables syntax.
###### Returns
Extension for `micromark` that can be passed in `extensions` to enable GFM
table syntax ([`Extension`][micromark-extension]).
### `gfmTableHtml()`
Create an HTML extension for `micromark` to support GitHub tables when
serializing to HTML.
###### Returns
Extension for `micromark` that can be passed in `htmlExtensions` to support
GFM tables when serializing to HTML
([`HtmlExtension`][micromark-html-extension]).
## Bugs
GitHub’s own algorithm to parse tables contains a bug.
This bug is not present in this project.
The issue relating to tables is:
* [GFM tables: escaped escapes are incorrectly treated as
escapes](https://github.com/github/cmark-gfm/issues/277)
## Authoring
When authoring markdown with GFM tables, it’s recommended to *always* put
pipes around cells.
Without them, it can be hard to infer whether the table will work, how many
columns there are, and which column you are currently editing.
It is recommended to not use many columns, as it results in very long lines,
making it hard to infer which column you are currently editing.
For larger tables, particularly when cells vary in size, it is recommended
*not* to manually “pad” cell text.
While it can look better, it results in a lot of time spent realigning
everything when a new, longer cell is added or the longest cell removed, as
every row then must be changed.
Other than costing time, it also causes large diffs in Git.
To illustrate, when authoring large tables, it is discouraged to pad cells
like this:
```markdown
| Alpha bravo charlie | delta |
| ------------------- | -----------------: |
| Echo | Foxtrot golf hotel |
```
Instead, use single spaces (and single filler dashes):
```markdown
| Alpha bravo charlie | delta |
| - | -: |
| Echo | Foxtrot golf hotel |
```
## HTML
GFM tables relate to several HTML elements: `<table>`, `<tbody>`, `<td>`,
`<th>`, `<thead>`, and `<tr>`.
See
[*§ 4.9.1 The `table` element*][html-table],
[*§ 4.9.5 The `tbody` element*][html-tbody],
[*§ 4.9.9 The `td` element*][html-td],
[*§ 4.9.10 The `th` element*][html-th],
[*§ 4.9.6 The `thead` element*][html-thead], and
[*§ 4.9.8 The `tr` element*][html-tr]
in the HTML spec for more info.
If the alignment of a column is left, right, or center, a deprecated
`align` attribute is added to each `<th>` and `<td>` element belonging to
that column.
That attribute is interpreted by browsers as if a CSS `text-align` property
was included, with its value set to that same keyword.
## CSS
The following CSS is needed to make tables look a bit like GitHub.
For the complete actual CSS see
[`sindresorhus/github-markdown-css`][github-markdown-css]
```css
/* Light theme. */
:root {
--color-canvas-default: #ffffff;
--color-canvas-subtle: #f6f8fa;
--color-border-default: #d0d7de;
--color-border-muted: hsla(210, 18%, 87%, 1);
}
/* Dark theme. */
@media (prefers-color-scheme: dark) {
:root {
--color-canvas-default: #0d1117;
--color-canvas-subtle: #161b22;
--color-border-default: #30363d;
--color-border-muted: #21262d;
}
}
table {
border-spacing: 0;
border-collapse: collapse;
display: block;
margin-top: 0;
margin-bottom: 16px;
width: max-content;
max-width: 100%;
overflow: auto;
}
tr {
background-color: var(--color-canvas-default);
border-top: 1px solid var(--color-border-muted);
}
tr:nth-child(2n) {
background-color: var(--color-canvas-subtle);
}
td,
th {
padding: 6px 13px;
border: 1px solid var(--color-border-default);
}
th {
font-weight: 600;
}
table img {
background-color: transparent;
}
```
## Syntax
Tables form with the following BNF:
```abnf
gfmTable ::= gfmTableHead 0*(eol gfmTableBodyRow)
; Restriction: both rows must have the same number of cells.
gfmTableHead ::= gfmTableRow eol gfmTableDelimiterRow
gfmTableRow ::= ["|"] gfmTableCell 0*("|" gfmTableCell) ["|"] *spaceOrTab
gfmTableCell ::= *spaceOrTab gfmTableText *spaceOrTab
gfmTableText ::= 0*(line - "\\" - "|" / "\\" ["\\" / "|"])
gfmTableDelimiterRow ::= ["|"] gfmTableDelimiterCell 0*("|" gfmTableDelimiterCell) ["|"] *spaceOrTab
gfmTableDelimiterCell ::= *spaceOrTab gfmTableDelimiterValue *spaceOrTab
gfmTableDelimiterValue ::= [":"] 1*"-" [":"]
```
As this construct occurs in flow, like all flow constructs, it must be
followed by an eol (line ending) or eof (end of file).
The above grammar shows that basically anything can be a cell or a row.
The main thing that makes something a row, is that it occurs directly before
or after a delimiter row, or after another row.
It is not required for a table to have a body: it can end right after the
delimiter row.
Each column can be marked with an alignment.
The alignment marker is a colon (`:`) used before and/or after delimiter row
filler.
To illustrate:
```markdown
| none | left | right | center |
| ---- | :--- | ----: | :----: |
```
The number of cells in the delimiter row, is the number of columns of the
table.
Only the head row is required to have the same number of cells.
Body rows are not required to have a certain number of cells.
For body rows that have less cells than the number of columns of the table,
empty cells are injected.
When a row has more cells than the number of columns of the table, the
superfluous cells are dropped.
To illustrate:
```markdown
| a | b |
| - | - |
| c |
| d | e | f |
```
Yields:
```html
<table>
<thead>
<tr>
<th>a</th>
<th>b</th>
</tr>
</thead>
<tbody>
<tr>
<td>c</td>
<td></td>
</tr>
<tr>
<td>d</td>
<td>e</td>
</tr>
</tbody>
</table>
```
Each cell’s text is interpreted as the [text][micromark-content-type] content
type.
That means that it can include constructs such as attention (emphasis, strong).
The grammar for cells prohibits the use of `|` in them.
To use pipes in cells, encode them as a character reference or character
escape: `&vert;` (or `&VerticalLine;`, `&verbar;`, `&#124;`, `&#x7c;`) or
`\|`.
Escapes will typically work, but they are not supported in
code (text) (and the math (text) extension).
To work around this, GitHub came up with a rather weird “trick”.
When inside a table cell *and* inside code, escaped pipes *are* decoded.
To illustrate:
```markdown
| Name | Character |
| - | - |
| Left curly brace | `{` |
| Pipe | `\|` |
| Right curly brace | `}` |
```
Yields:
```html
<table>
<thead>
<tr>
<th>Name</th>
<th>Character</th>
</tr>
</thead>
<tbody>
<tr>
<td>Left curly brace</td>
<td><code>{</code></td>
</tr>
<tr>
<td>Pipe</td>
<td><code>|</code></td>
</tr>
<tr>
<td>Right curly brace</td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
```
> 👉 **Note**: no other character can be escaped like this.
> Escaping pipes in code does not work when not inside a table, either.
## Types
This package is fully typed with [TypeScript][].
It exports no additional types.
## Compatibility
Projects maintained by the unified collective are compatible with maintained
versions of Node.js.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line,
`micromark-extension-gfm-table@^2`, compatible with Node.js 16.
This package works with `micromark` version `3` and later.
## Security
This package is safe.
## Related
* [`micromark-extension-gfm`][micromark-extension-gfm]
— support all of GFM
* [`mdast-util-gfm-table`][mdast-util-gfm-table]
— support all of GFM in mdast
* [`mdast-util-gfm`][mdast-util-gfm]
— support all of GFM in mdast
* [`remark-gfm`][remark-gfm]
— support all of GFM in remark
## Contribute
See [`contributing.md` in `micromark/.github`][contributing] for ways to get
started.
See [`support.md`][support] for ways to get help.
This project has a [code of conduct][coc].
By interacting with this repository, organization, or community you agree to
abide by its terms.
## License
[MIT][license] © [Titus Wormer][author]
<!-- Definitions -->
[build-badge]: https://github.com/micromark/micromark-extension-gfm-table/workflows/main/badge.svg
[build]: https://github.com/micromark/micromark-extension-gfm-table/actions
[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark-extension-gfm-table.svg
[coverage]: https://codecov.io/github/micromark/micromark-extension-gfm-table
[downloads-badge]: https://img.shields.io/npm/dm/micromark-extension-gfm-table.svg
[downloads]: https://www.npmjs.com/package/micromark-extension-gfm-table
[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-extension-gfm-table
[size]: https://bundlejs.com/?q=micromark-extension-gfm-table
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
[collective]: https://opencollective.com/unified
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
[chat]: https://github.com/micromark/micromark/discussions
[npm]: https://docs.npmjs.com/cli/install
[esmsh]: https://esm.sh
[license]: license
[author]: https://wooorm.com
[contributing]: https://github.com/micromark/.github/blob/main/contributing.md
[support]: https://github.com/micromark/.github/blob/main/support.md
[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[typescript]: https://www.typescriptlang.org
[development]: https://nodejs.org/api/packages.html#packages_resolving_user_conditions
[micromark]: https://github.com/micromark/micromark
[micromark-extension]: https://github.com/micromark/micromark#syntaxextension
[micromark-html-extension]: https://github.com/micromark/micromark#htmlextension
[micromark-content-type]: https://github.com/micromark/micromark#content-types
[micromark-extension-gfm]: https://github.com/micromark/micromark-extension-gfm
[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm
[mdast-util-gfm-table]: https://github.com/syntax-tree/mdast-util-gfm-table
[remark-gfm]: https://github.com/remarkjs/remark-gfm
[tables]: https://github.github.com/gfm/#tables-extension-
[html-table]: https://html.spec.whatwg.org/multipage/tables.html#the-table-element
[html-tbody]: https://html.spec.whatwg.org/multipage/tables.html#the-tbody-element
[html-thead]: https://html.spec.whatwg.org/multipage/tables.html#the-thead-element
[html-tr]: https://html.spec.whatwg.org/multipage/tables.html#the-tr-element
[html-td]: https://html.spec.whatwg.org/multipage/tables.html#the-td-element
[html-th]: https://html.spec.whatwg.org/multipage/tables.html#the-th-element
[github-markdown-css]: https://github.com/sindresorhus/github-markdown-css
[api-gfm-table]: #gfmtable
[api-gfm-table-html]: #gfmtablehtml
@@ -0,0 +1,68 @@
import baseRest from './_baseRest.js';
import createWrap from './_createWrap.js';
import getHolder from './_getHolder.js';
import replaceHolders from './_replaceHolders.js';
/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG = 1,
WRAP_BIND_KEY_FLAG = 2,
WRAP_PARTIAL_FLAG = 32;
/**
* Creates a function that invokes the method at `object[key]` with `partials`
* prepended to the arguments it receives.
*
* This method differs from `_.bind` by allowing bound functions to reference
* methods that may be redefined or don't yet exist. See
* [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
* for more details.
*
* The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
* builds, may be used as a placeholder for partially applied arguments.
*
* @static
* @memberOf _
* @since 0.10.0
* @category Function
* @param {Object} object The object to invoke the method on.
* @param {string} key The key of the method.
* @param {...*} [partials] The arguments to be partially applied.
* @returns {Function} Returns the new bound function.
* @example
*
* var object = {
* 'user': 'fred',
* 'greet': function(greeting, punctuation) {
* return greeting + ' ' + this.user + punctuation;
* }
* };
*
* var bound = _.bindKey(object, 'greet', 'hi');
* bound('!');
* // => 'hi fred!'
*
* object.greet = function(greeting, punctuation) {
* return greeting + 'ya ' + this.user + punctuation;
* };
*
* bound('!');
* // => 'hiya fred!'
*
* // Bound with placeholders.
* var bound = _.bindKey(object, 'greet', _, '!');
* bound('hi');
* // => 'hiya fred!'
*/
var bindKey = baseRest(function(object, key, partials) {
var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
if (partials.length) {
var holders = replaceHolders(partials, getHolder(bindKey));
bitmask |= WRAP_PARTIAL_FLAG;
}
return createWrap(key, bitmask, object, partials, holders);
});
// Assign default placeholders.
bindKey.placeholder = {};
export default bindKey;
@@ -0,0 +1,17 @@
## History
### 1.1.0 - 16th Aug 2017
- [f4576e3](https://github.com/darsain/remove-trailing-separator/commit/f4576e3638c39b794998b533fffb27854dcbee01) Implement faster slash slicing
### 1.0.2 - 07th Jun 2017
- [8e13ecb](https://github.com/darsain/remove-trailing-separator/commit/8e13ecbfd7b9f5fdf97c5d5ff923e4718b874e31) ES5 compatibility
### 1.0.1 - 25th Sep 2016
- [b78606d](https://github.com/darsain/remove-trailing-separator/commit/af90b4e153a4527894741af6c7005acaeb78606d) Remove backslash only on win32 systems
### 1.0.0 - 24th Sep 2016
Initial release.
@@ -0,0 +1,48 @@
var LazyWrapper = require('./_LazyWrapper'),
LodashWrapper = require('./_LodashWrapper'),
baseAt = require('./_baseAt'),
flatRest = require('./_flatRest'),
isIndex = require('./_isIndex'),
thru = require('./thru');
/**
* This method is the wrapper version of `_.at`.
*
* @name at
* @memberOf _
* @since 1.0.0
* @category Seq
* @param {...(string|string[])} [paths] The property paths to pick.
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
*
* _(object).at(['a[0].b.c', 'a[1]']).value();
* // => [3, 4]
*/
var wrapperAt = flatRest(function(paths) {
var length = paths.length,
start = length ? paths[0] : 0,
value = this.__wrapped__,
interceptor = function(object) { return baseAt(object, paths); };
if (length > 1 || this.__actions__.length ||
!(value instanceof LazyWrapper) || !isIndex(start)) {
return this.thru(interceptor);
}
value = value.slice(start, +start + (length ? 1 : 0));
value.__actions__.push({
'func': thru,
'args': [interceptor],
'thisArg': undefined
});
return new LodashWrapper(value, this.__chain__).thru(function(array) {
if (length && !array.length) {
array.push(undefined);
}
return array;
});
});
module.exports = wrapperAt;
@@ -0,0 +1,997 @@
/*!
* send
* Copyright(c) 2012 TJ Holowaychuk
* Copyright(c) 2014-2022 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict'
/**
* Module dependencies.
* @private
*/
var createError = require('http-errors')
var debug = require('debug')('send')
var encodeUrl = require('encodeurl')
var escapeHtml = require('escape-html')
var etag = require('etag')
var fresh = require('fresh')
var fs = require('fs')
var mime = require('mime-types')
var ms = require('ms')
var onFinished = require('on-finished')
var parseRange = require('range-parser')
var path = require('path')
var statuses = require('statuses')
var Stream = require('stream')
var util = require('util')
/**
* Path function references.
* @private
*/
var extname = path.extname
var join = path.join
var normalize = path.normalize
var resolve = path.resolve
var sep = path.sep
/**
* Regular expression for identifying a bytes Range header.
* @private
*/
var BYTES_RANGE_REGEXP = /^ *bytes=/
/**
* Maximum value allowed for the max age.
* @private
*/
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1000 // 1 year
/**
* Regular expression to match a path with a directory up component.
* @private
*/
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/
/**
* Module exports.
* @public
*/
module.exports = send
/**
* Return a `SendStream` for `req` and `path`.
*
* @param {object} req
* @param {string} path
* @param {object} [options]
* @return {SendStream}
* @public
*/
function send (req, path, options) {
return new SendStream(req, path, options)
}
/**
* Initialize a `SendStream` with the given `path`.
*
* @param {Request} req
* @param {String} path
* @param {object} [options]
* @private
*/
function SendStream (req, path, options) {
Stream.call(this)
var opts = options || {}
this.options = opts
this.path = path
this.req = req
this._acceptRanges = opts.acceptRanges !== undefined
? Boolean(opts.acceptRanges)
: true
this._cacheControl = opts.cacheControl !== undefined
? Boolean(opts.cacheControl)
: true
this._etag = opts.etag !== undefined
? Boolean(opts.etag)
: true
this._dotfiles = opts.dotfiles !== undefined
? opts.dotfiles
: 'ignore'
if (this._dotfiles !== 'ignore' && this._dotfiles !== 'allow' && this._dotfiles !== 'deny') {
throw new TypeError('dotfiles option must be "allow", "deny", or "ignore"')
}
this._extensions = opts.extensions !== undefined
? normalizeList(opts.extensions, 'extensions option')
: []
this._immutable = opts.immutable !== undefined
? Boolean(opts.immutable)
: false
this._index = opts.index !== undefined
? normalizeList(opts.index, 'index option')
: ['index.html']
this._lastModified = opts.lastModified !== undefined
? Boolean(opts.lastModified)
: true
this._maxage = opts.maxAge || opts.maxage
this._maxage = typeof this._maxage === 'string'
? ms(this._maxage)
: Number(this._maxage)
this._maxage = !isNaN(this._maxage)
? Math.min(Math.max(0, this._maxage), MAX_MAXAGE)
: 0
this._root = opts.root
? resolve(opts.root)
: null
}
/**
* Inherits from `Stream`.
*/
util.inherits(SendStream, Stream)
/**
* Emit error with `status`.
*
* @param {number} status
* @param {Error} [err]
* @private
*/
SendStream.prototype.error = function error (status, err) {
// emit if listeners instead of responding
if (hasListeners(this, 'error')) {
return this.emit('error', createHttpError(status, err))
}
var res = this.res
var msg = statuses.message[status] || String(status)
var doc = createHtmlDocument('Error', escapeHtml(msg))
// clear existing headers
clearHeaders(res)
// add error headers
if (err && err.headers) {
setHeaders(res, err.headers)
}
// send basic response
res.statusCode = status
res.setHeader('Content-Type', 'text/html; charset=UTF-8')
res.setHeader('Content-Length', Buffer.byteLength(doc))
res.setHeader('Content-Security-Policy', "default-src 'none'")
res.setHeader('X-Content-Type-Options', 'nosniff')
res.end(doc)
}
/**
* Check if the pathname ends with "/".
*
* @return {boolean}
* @private
*/
SendStream.prototype.hasTrailingSlash = function hasTrailingSlash () {
return this.path[this.path.length - 1] === '/'
}
/**
* Check if this is a conditional GET request.
*
* @return {Boolean}
* @api private
*/
SendStream.prototype.isConditionalGET = function isConditionalGET () {
return this.req.headers['if-match'] ||
this.req.headers['if-unmodified-since'] ||
this.req.headers['if-none-match'] ||
this.req.headers['if-modified-since']
}
/**
* Check if the request preconditions failed.
*
* @return {boolean}
* @private
*/
SendStream.prototype.isPreconditionFailure = function isPreconditionFailure () {
var req = this.req
var res = this.res
// if-match
var match = req.headers['if-match']
if (match) {
var etag = res.getHeader('ETag')
return !etag || (match !== '*' && parseTokenList(match).every(function (match) {
return match !== etag && match !== 'W/' + etag && 'W/' + match !== etag
}))
}
// if-unmodified-since
var unmodifiedSince = parseHttpDate(req.headers['if-unmodified-since'])
if (!isNaN(unmodifiedSince)) {
var lastModified = parseHttpDate(res.getHeader('Last-Modified'))
return isNaN(lastModified) || lastModified > unmodifiedSince
}
return false
}
/**
* Strip various content header fields for a change in entity.
*
* @private
*/
SendStream.prototype.removeContentHeaderFields = function removeContentHeaderFields () {
var res = this.res
res.removeHeader('Content-Encoding')
res.removeHeader('Content-Language')
res.removeHeader('Content-Length')
res.removeHeader('Content-Range')
res.removeHeader('Content-Type')
}
/**
* Respond with 304 not modified.
*
* @api private
*/
SendStream.prototype.notModified = function notModified () {
var res = this.res
debug('not modified')
this.removeContentHeaderFields()
res.statusCode = 304
res.end()
}
/**
* Raise error that headers already sent.
*
* @api private
*/
SendStream.prototype.headersAlreadySent = function headersAlreadySent () {
var err = new Error('Can\'t set headers after they are sent.')
debug('headers already sent')
this.error(500, err)
}
/**
* Check if the request is cacheable, aka
* responded with 2xx or 304 (see RFC 2616 section 14.2{5,6}).
*
* @return {Boolean}
* @api private
*/
SendStream.prototype.isCachable = function isCachable () {
var statusCode = this.res.statusCode
return (statusCode >= 200 && statusCode < 300) ||
statusCode === 304
}
/**
* Handle stat() error.
*
* @param {Error} error
* @private
*/
SendStream.prototype.onStatError = function onStatError (error) {
switch (error.code) {
case 'ENAMETOOLONG':
case 'ENOENT':
case 'ENOTDIR':
this.error(404, error)
break
default:
this.error(500, error)
break
}
}
/**
* Check if the cache is fresh.
*
* @return {Boolean}
* @api private
*/
SendStream.prototype.isFresh = function isFresh () {
return fresh(this.req.headers, {
etag: this.res.getHeader('ETag'),
'last-modified': this.res.getHeader('Last-Modified')
})
}
/**
* Check if the range is fresh.
*
* @return {Boolean}
* @api private
*/
SendStream.prototype.isRangeFresh = function isRangeFresh () {
var ifRange = this.req.headers['if-range']
if (!ifRange) {
return true
}
// if-range as etag
if (ifRange.indexOf('"') !== -1) {
var etag = this.res.getHeader('ETag')
return Boolean(etag && ifRange.indexOf(etag) !== -1)
}
// if-range as modified date
var lastModified = this.res.getHeader('Last-Modified')
return parseHttpDate(lastModified) <= parseHttpDate(ifRange)
}
/**
* Redirect to path.
*
* @param {string} path
* @private
*/
SendStream.prototype.redirect = function redirect (path) {
var res = this.res
if (hasListeners(this, 'directory')) {
this.emit('directory', res, path)
return
}
if (this.hasTrailingSlash()) {
this.error(403)
return
}
var loc = encodeUrl(collapseLeadingSlashes(this.path + '/'))
var doc = createHtmlDocument('Redirecting', 'Redirecting to ' + escapeHtml(loc))
// redirect
res.statusCode = 301
res.setHeader('Content-Type', 'text/html; charset=UTF-8')
res.setHeader('Content-Length', Buffer.byteLength(doc))
res.setHeader('Content-Security-Policy', "default-src 'none'")
res.setHeader('X-Content-Type-Options', 'nosniff')
res.setHeader('Location', loc)
res.end(doc)
}
/**
* Pipe to `res.
*
* @param {Stream} res
* @return {Stream} res
* @api public
*/
SendStream.prototype.pipe = function pipe (res) {
// root path
var root = this._root
// references
this.res = res
// decode the path
var path = decode(this.path)
if (path === -1) {
this.error(400)
return res
}
// null byte(s)
if (~path.indexOf('\0')) {
this.error(400)
return res
}
var parts
if (root !== null) {
// normalize
if (path) {
path = normalize('.' + sep + path)
}
// malicious path
if (UP_PATH_REGEXP.test(path)) {
debug('malicious path "%s"', path)
this.error(403)
return res
}
// explode path parts
parts = path.split(sep)
// join / normalize from optional root dir
path = normalize(join(root, path))
} else {
// ".." is malicious without "root"
if (UP_PATH_REGEXP.test(path)) {
debug('malicious path "%s"', path)
this.error(403)
return res
}
// explode path parts
parts = normalize(path).split(sep)
// resolve the path
path = resolve(path)
}
// dotfile handling
if (containsDotFile(parts)) {
debug('%s dotfile "%s"', this._dotfiles, path)
switch (this._dotfiles) {
case 'allow':
break
case 'deny':
this.error(403)
return res
case 'ignore':
default:
this.error(404)
return res
}
}
// index file support
if (this._index.length && this.hasTrailingSlash()) {
this.sendIndex(path)
return res
}
this.sendFile(path)
return res
}
/**
* Transfer `path`.
*
* @param {String} path
* @api public
*/
SendStream.prototype.send = function send (path, stat) {
var len = stat.size
var options = this.options
var opts = {}
var res = this.res
var req = this.req
var ranges = req.headers.range
var offset = options.start || 0
if (res.headersSent) {
// impossible to send now
this.headersAlreadySent()
return
}
debug('pipe "%s"', path)
// set header fields
this.setHeader(path, stat)
// set content-type
this.type(path)
// conditional GET support
if (this.isConditionalGET()) {
if (this.isPreconditionFailure()) {
this.error(412)
return
}
if (this.isCachable() && this.isFresh()) {
this.notModified()
return
}
}
// adjust len to start/end options
len = Math.max(0, len - offset)
if (options.end !== undefined) {
var bytes = options.end - offset + 1
if (len > bytes) len = bytes
}
// Range support
if (this._acceptRanges && BYTES_RANGE_REGEXP.test(ranges)) {
// parse
ranges = parseRange(len, ranges, {
combine: true
})
// If-Range support
if (!this.isRangeFresh()) {
debug('range stale')
ranges = -2
}
// unsatisfiable
if (ranges === -1) {
debug('range unsatisfiable')
// Content-Range
res.setHeader('Content-Range', contentRange('bytes', len))
// 416 Requested Range Not Satisfiable
return this.error(416, {
headers: { 'Content-Range': res.getHeader('Content-Range') }
})
}
// valid (syntactically invalid/multiple ranges are treated as a regular response)
if (ranges !== -2 && ranges.length === 1) {
debug('range %j', ranges)
// Content-Range
res.statusCode = 206
res.setHeader('Content-Range', contentRange('bytes', len, ranges[0]))
// adjust for requested range
offset += ranges[0].start
len = ranges[0].end - ranges[0].start + 1
}
}
// clone options
for (var prop in options) {
opts[prop] = options[prop]
}
// set read options
opts.start = offset
opts.end = Math.max(offset, offset + len - 1)
// content-length
res.setHeader('Content-Length', len)
// HEAD support
if (req.method === 'HEAD') {
res.end()
return
}
this.stream(path, opts)
}
/**
* Transfer file for `path`.
*
* @param {String} path
* @api private
*/
SendStream.prototype.sendFile = function sendFile (path) {
var i = 0
var self = this
debug('stat "%s"', path)
fs.stat(path, function onstat (err, stat) {
var pathEndsWithSep = path[path.length - 1] === sep
if (err && err.code === 'ENOENT' && !extname(path) && !pathEndsWithSep) {
// not found, check extensions
return next(err)
}
if (err) return self.onStatError(err)
if (stat.isDirectory()) return self.redirect(path)
if (pathEndsWithSep) return self.error(404)
self.emit('file', path, stat)
self.send(path, stat)
})
function next (err) {
if (self._extensions.length <= i) {
return err
? self.onStatError(err)
: self.error(404)
}
var p = path + '.' + self._extensions[i++]
debug('stat "%s"', p)
fs.stat(p, function (err, stat) {
if (err) return next(err)
if (stat.isDirectory()) return next()
self.emit('file', p, stat)
self.send(p, stat)
})
}
}
/**
* Transfer index for `path`.
*
* @param {String} path
* @api private
*/
SendStream.prototype.sendIndex = function sendIndex (path) {
var i = -1
var self = this
function next (err) {
if (++i >= self._index.length) {
if (err) return self.onStatError(err)
return self.error(404)
}
var p = join(path, self._index[i])
debug('stat "%s"', p)
fs.stat(p, function (err, stat) {
if (err) return next(err)
if (stat.isDirectory()) return next()
self.emit('file', p, stat)
self.send(p, stat)
})
}
next()
}
/**
* Stream `path` to the response.
*
* @param {String} path
* @param {Object} options
* @api private
*/
SendStream.prototype.stream = function stream (path, options) {
var self = this
var res = this.res
// pipe
var stream = fs.createReadStream(path, options)
this.emit('stream', stream)
stream.pipe(res)
// cleanup
function cleanup () {
stream.destroy()
}
// response finished, cleanup
onFinished(res, cleanup)
// error handling
stream.on('error', function onerror (err) {
// clean up stream early
cleanup()
// error
self.onStatError(err)
})
// end
stream.on('end', function onend () {
self.emit('end')
})
}
/**
* Set content-type based on `path`
* if it hasn't been explicitly set.
*
* @param {String} path
* @api private
*/
SendStream.prototype.type = function type (path) {
var res = this.res
if (res.getHeader('Content-Type')) return
var ext = extname(path)
var type = mime.contentType(ext) || 'application/octet-stream'
debug('content-type %s', type)
res.setHeader('Content-Type', type)
}
/**
* Set response header fields, most
* fields may be pre-defined.
*
* @param {String} path
* @param {Object} stat
* @api private
*/
SendStream.prototype.setHeader = function setHeader (path, stat) {
var res = this.res
this.emit('headers', res, path, stat)
if (this._acceptRanges && !res.getHeader('Accept-Ranges')) {
debug('accept ranges')
res.setHeader('Accept-Ranges', 'bytes')
}
if (this._cacheControl && !res.getHeader('Cache-Control')) {
var cacheControl = 'public, max-age=' + Math.floor(this._maxage / 1000)
if (this._immutable) {
cacheControl += ', immutable'
}
debug('cache-control %s', cacheControl)
res.setHeader('Cache-Control', cacheControl)
}
if (this._lastModified && !res.getHeader('Last-Modified')) {
var modified = stat.mtime.toUTCString()
debug('modified %s', modified)
res.setHeader('Last-Modified', modified)
}
if (this._etag && !res.getHeader('ETag')) {
var val = etag(stat)
debug('etag %s', val)
res.setHeader('ETag', val)
}
}
/**
* Clear all headers from a response.
*
* @param {object} res
* @private
*/
function clearHeaders (res) {
for (const header of res.getHeaderNames()) {
res.removeHeader(header)
}
}
/**
* Collapse all leading slashes into a single slash
*
* @param {string} str
* @private
*/
function collapseLeadingSlashes (str) {
for (var i = 0; i < str.length; i++) {
if (str[i] !== '/') {
break
}
}
return i > 1
? '/' + str.substr(i)
: str
}
/**
* Determine if path parts contain a dotfile.
*
* @api private
*/
function containsDotFile (parts) {
for (var i = 0; i < parts.length; i++) {
var part = parts[i]
if (part.length > 1 && part[0] === '.') {
return true
}
}
return false
}
/**
* Create a Content-Range header.
*
* @param {string} type
* @param {number} size
* @param {array} [range]
*/
function contentRange (type, size, range) {
return type + ' ' + (range ? range.start + '-' + range.end : '*') + '/' + size
}
/**
* Create a minimal HTML document.
*
* @param {string} title
* @param {string} body
* @private
*/
function createHtmlDocument (title, body) {
return '<!DOCTYPE html>\n' +
'<html lang="en">\n' +
'<head>\n' +
'<meta charset="utf-8">\n' +
'<title>' + title + '</title>\n' +
'</head>\n' +
'<body>\n' +
'<pre>' + body + '</pre>\n' +
'</body>\n' +
'</html>\n'
}
/**
* Create a HttpError object from simple arguments.
*
* @param {number} status
* @param {Error|object} err
* @private
*/
function createHttpError (status, err) {
if (!err) {
return createError(status)
}
return err instanceof Error
? createError(status, err, { expose: false })
: createError(status, err)
}
/**
* decodeURIComponent.
*
* Allows V8 to only deoptimize this fn instead of all
* of send().
*
* @param {String} path
* @api private
*/
function decode (path) {
try {
return decodeURIComponent(path)
} catch (err) {
return -1
}
}
/**
* Determine if emitter has listeners of a given type.
*
* The way to do this check is done three different ways in Node.js >= 0.10
* so this consolidates them into a minimal set using instance methods.
*
* @param {EventEmitter} emitter
* @param {string} type
* @returns {boolean}
* @private
*/
function hasListeners (emitter, type) {
var count = typeof emitter.listenerCount !== 'function'
? emitter.listeners(type).length
: emitter.listenerCount(type)
return count > 0
}
/**
* Normalize the index option into an array.
*
* @param {boolean|string|array} val
* @param {string} name
* @private
*/
function normalizeList (val, name) {
var list = [].concat(val || [])
for (var i = 0; i < list.length; i++) {
if (typeof list[i] !== 'string') {
throw new TypeError(name + ' must be array of strings or false')
}
}
return list
}
/**
* Parse an HTTP Date into a number.
*
* @param {string} date
* @private
*/
function parseHttpDate (date) {
var timestamp = date && Date.parse(date)
return typeof timestamp === 'number'
? timestamp
: NaN
}
/**
* Parse a HTTP token list.
*
* @param {string} str
* @private
*/
function parseTokenList (str) {
var end = 0
var list = []
var start = 0
// gather tokens
for (var i = 0, len = str.length; i < len; i++) {
switch (str.charCodeAt(i)) {
case 0x20: /* */
if (start === end) {
start = end = i + 1
}
break
case 0x2c: /* , */
if (start !== end) {
list.push(str.substring(start, end))
}
start = end = i + 1
break
default:
end = i + 1
break
}
}
// final token
if (start !== end) {
list.push(str.substring(start, end))
}
return list
}
/**
* Set an object of headers on a response.
*
* @param {object} res
* @param {object} headers
* @private
*/
function setHeaders (res, headers) {
var keys = Object.keys(headers)
for (var i = 0; i < keys.length; i++) {
var key = keys[i]
res.setHeader(key, headers[key])
}
}
@@ -0,0 +1,238 @@
import {dequal} from 'dequal'
/**
* @type {Set<string>}
*/
const codesWarned = new Set()
class AssertionError extends Error {
name = /** @type {const} */ ('Assertion')
code = /** @type {const} */ ('ERR_ASSERTION')
/**
* Create an assertion error.
*
* @param {string} message
* Message explaining error.
* @param {unknown} actual
* Value.
* @param {unknown} expected
* Baseline.
* @param {string} operator
* Name of equality operation.
* @param {boolean} generated
* Whether `message` is a custom message or not
* @returns
* Instance.
*/
// eslint-disable-next-line max-params
constructor(message, actual, expected, operator, generated) {
super(message)
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor)
}
/**
* @type {unknown}
*/
this.actual = actual
/**
* @type {unknown}
*/
this.expected = expected
/**
* @type {boolean}
*/
this.generated = generated
/**
* @type {string}
*/
this.operator = operator
}
}
class DeprecationError extends Error {
name = /** @type {const} */ ('DeprecationWarning')
/**
* Create a deprecation message.
*
* @param {string} message
* Message explaining deprecation.
* @param {string | undefined} code
* Deprecation identifier; deprecation messages will be generated only once per code.
* @returns
* Instance.
*/
constructor(message, code) {
super(message)
/**
* @type {string | undefined}
*/
this.code = code
}
}
/**
* Wrap a function or class to show a deprecation message when first called.
*
* > 👉 **Important**: only shows a message when the `development` condition is
* > used, does nothing in production.
*
* When the resulting wrapped `fn` is called, emits a warning once to
* `console.error` (`stderr`).
* If a code is given, one warning message will be emitted in total per code.
*
* @template {Function} T
* Function or class kind.
* @param {T} fn
* Function or class.
* @param {string} message
* Message explaining deprecation.
* @param {string | null | undefined} [code]
* Deprecation identifier (optional); deprecation messages will be generated
* only once per code.
* @returns {T}
* Wrapped `fn`.
*/
export function deprecate(fn, message, code) {
let warned = false
// The wrapper will keep the same prototype as fn to maintain prototype chain
Object.setPrototypeOf(deprecated, fn)
// @ts-expect-error: it’s perfect, typescript…
return deprecated
/**
* @this {unknown}
* @param {...Array<unknown>} args
* @returns {unknown}
*/
function deprecated(...args) {
if (!warned) {
warned = true
if (typeof code === 'string' && codesWarned.has(code)) {
// Empty.
} else {
console.error(new DeprecationError(message, code || undefined))
if (typeof code === 'string') codesWarned.add(code)
}
}
return new.target
? Reflect.construct(fn, args, new.target)
: Reflect.apply(fn, this, args)
}
}
/**
* Assert deep strict equivalence.
*
* > 👉 **Important**: only asserts when the `development` condition is used,
* > does nothing in production.
*
* @template {unknown} T
* Expected kind.
* @param {unknown} actual
* Value.
* @param {T} expected
* Baseline.
* @param {Error | string | null | undefined} [message]
* Message for assertion error (default: `'Expected values to be deeply equal'`).
* @returns {asserts actual is T}
* Nothing; throws when `actual` is not deep strict equal to `expected`.
* @throws {AssertionError}
* Throws when `actual` is not deep strict equal to `expected`.
*/
export function equal(actual, expected, message) {
assert(
dequal(actual, expected),
actual,
expected,
'equal',
'Expected values to be deeply equal',
message
)
}
/**
* Assert if `value` is truthy.
*
* > 👉 **Important**: only asserts when the `development` condition is used,
* > does nothing in production.
*
* @param {unknown} value
* Value to assert.
* @param {Error | string | null | undefined} [message]
* Message for assertion error (default: `'Expected value to be truthy'`).
* @returns {asserts value}
* Nothing; throws when `value` is falsey.
* @throws {AssertionError}
* Throws when `value` is falsey.
*/
export function ok(value, message) {
assert(
Boolean(value),
false,
true,
'ok',
'Expected value to be truthy',
message
)
}
/**
* Assert that a code path never happens.
*
* > 👉 **Important**: only asserts when the `development` condition is used,
* > does nothing in production.
*
* @param {Error | string | null | undefined} [message]
* Message for assertion error (default: `'Unreachable'`).
* @returns {never}
* Nothing; always throws.
* @throws {AssertionError}
* Throws when `value` is falsey.
*/
export function unreachable(message) {
assert(false, false, true, 'ok', 'Unreachable', message)
}
/**
* @param {boolean} bool
* Whether to skip this operation.
* @param {unknown} actual
* Actual value.
* @param {unknown} expected
* Expected value.
* @param {string} operator
* Operator.
* @param {string} defaultMessage
* Default message for operation.
* @param {Error | string | null | undefined} userMessage
* User-provided message.
* @returns {asserts bool}
* Nothing; throws when falsey.
*/
// eslint-disable-next-line max-params
function assert(bool, actual, expected, operator, defaultMessage, userMessage) {
if (!bool) {
throw userMessage instanceof Error
? userMessage
: new AssertionError(
userMessage || defaultMessage,
actual,
expected,
operator,
!userMessage
)
}
}
@@ -0,0 +1,20 @@
'use strict';
var flat = require('../implementation');
var callBind = require('call-bind');
var test = require('tape');
var hasStrictMode = require('has-strict-mode')();
var runTests = require('./tests');
test('as a function', function (t) {
t.test('bad array/this value', { skip: !hasStrictMode }, function (st) {
/* eslint no-useless-call: 0 */
st['throws'](function () { flat.call(undefined); }, TypeError, 'undefined is not an object');
st['throws'](function () { flat.call(null); }, TypeError, 'null is not an object');
st.end();
});
runTests(callBind(flat), t);
t.end();
});
@@ -0,0 +1,24 @@
# @heroui/react-rsc-utils
A Quick description of the component
> This is an internal utility, not intended for public usage.
## Installation
```sh
yarn add @heroui/react-rsc-utils
# or
npm i @heroui/react-rsc-utils
```
## Contribution
Yes please! See the
[contributing guidelines](https://github.com/frontio-ai/heroui/blob/master/CONTRIBUTING.md)
for details.
## License
This project is licensed under the terms of the
[MIT license](https://github.com/frontio-ai/heroui/blob/master/LICENSE).
@@ -0,0 +1 @@
module.exports={C:{"52":0.03062,"54":0.0051,"59":0.01021,"68":0.0051,"78":0.01531,"105":0.01021,"115":0.30114,"119":0.01531,"125":0.0051,"127":0.0051,"128":0.14802,"132":0.0051,"133":0.28072,"134":0.01531,"135":0.02042,"136":0.02042,"137":0.01531,"138":0.01021,"139":0.01531,"140":0.11229,"141":0.02552,"142":0.06635,"143":1.48526,"144":1.34746,_:"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 55 56 57 58 60 61 62 63 64 65 66 67 69 70 71 72 73 74 75 76 77 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 106 107 108 109 110 111 112 113 114 116 117 118 120 121 122 123 124 126 129 130 131 145 146 147 3.5 3.6"},D:{"39":0.0051,"40":0.0051,"41":0.01531,"42":0.01021,"43":0.0051,"44":0.0051,"45":0.01531,"46":0.0051,"47":0.01021,"48":0.01531,"49":0.02042,"50":0.0051,"51":0.01021,"52":0.01531,"53":0.01021,"54":0.0051,"55":0.01021,"56":0.01021,"57":0.01021,"58":0.01021,"59":0.01021,"60":0.0051,"66":0.05104,"68":0.01021,"70":0.04594,"74":0.0051,"79":0.04083,"80":0.0051,"81":0.0051,"85":0.01021,"87":0.03062,"88":0.02042,"91":0.03573,"92":0.05614,"93":0.0051,"97":0.01021,"98":0.06635,"99":0.0051,"100":0.01531,"102":0.02552,"103":0.04594,"104":0.03573,"106":0.01021,"107":0.0051,"108":0.02042,"109":0.7707,"111":0.02552,"112":0.36238,"113":0.0051,"114":0.02552,"115":0.01021,"116":0.09187,"117":0.01531,"118":0.15822,"119":0.04083,"120":0.08677,"121":0.02042,"122":0.08166,"123":0.05614,"124":0.05104,"125":1.17902,"126":0.27051,"127":0.04083,"128":0.07146,"129":0.03062,"130":0.61758,"131":0.2552,"132":0.14291,"133":0.06635,"134":0.26541,"135":0.08677,"136":0.1225,"137":0.14291,"138":0.41853,"139":0.90851,"140":6.7577,"141":14.2963,"142":0.18885,_:"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 61 62 63 64 65 67 69 71 72 73 75 76 77 78 83 84 86 89 90 94 95 96 101 105 110 143 144 145"},F:{"31":0.0051,"40":0.01021,"46":0.01531,"91":0.02552,"92":0.05104,"95":0.07656,"114":0.0051,"119":0.0051,"120":0.19395,"121":0.2603,"122":2.10285,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 32 33 34 35 36 37 38 39 41 42 43 44 45 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 93 94 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 115 116 117 118 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"17":0.0051,"96":0.0051,"109":0.05104,"114":0.01021,"120":0.0051,"121":0.01531,"122":0.04594,"126":0.0051,"131":0.01531,"132":0.01021,"133":0.01021,"134":0.03573,"135":0.01021,"136":0.01531,"137":0.01531,"138":0.04083,"139":0.05104,"140":1.1535,"141":5.06827,"142":0.01021,_:"12 13 14 15 16 18 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 115 116 117 118 119 123 124 125 127 128 129 130"},E:{"14":0.01021,_:"0 4 5 6 7 8 9 10 11 12 13 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 15.2-15.3 26.2","11.1":0.01021,"12.1":0.0051,"13.1":0.03062,"14.1":0.03573,"15.1":0.02042,"15.4":0.0051,"15.5":0.01021,"15.6":0.15312,"16.0":0.01021,"16.1":0.01531,"16.2":0.01531,"16.3":0.02552,"16.4":0.01021,"16.5":0.01531,"16.6":0.21437,"17.0":0.01021,"17.1":0.15822,"17.2":0.01531,"17.3":0.02042,"17.4":0.03573,"17.5":0.06125,"17.6":0.19906,"18.0":0.02042,"18.1":0.04083,"18.2":0.02042,"18.3":0.08166,"18.4":0.04083,"18.5-18.6":0.18374,"26.0":0.57675,"26.1":0.02042},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0,"7.0-7.1":0,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.02131,"10.0-10.2":0.00304,"10.3":0.0274,"11.0-11.2":0.27861,"11.3-11.4":0.01218,"12.0-12.1":0.00152,"12.2-12.5":0.07156,"13.0-13.1":0,"13.2":0.00152,"13.3":0,"13.4-13.7":0.00152,"14.0-14.4":0.00457,"14.5-14.8":0.00761,"15.0-15.1":0.01066,"15.2-15.3":0.01066,"15.4":0.01218,"15.5":0.01218,"15.6-15.8":0.27861,"16.0":0.03349,"16.1":0.0746,"16.2":0.03197,"16.3":0.06851,"16.4":0.00913,"16.5":0.02284,"16.6-16.7":0.41868,"17.0":0.02436,"17.1":0.03502,"17.2":0.01979,"17.3":0.03045,"17.4":0.04872,"17.5":0.12789,"17.6-17.7":0.36844,"18.0":0.06851,"18.1":0.15986,"18.2":0.06699,"18.3":0.2847,"18.4":0.13246,"18.5-18.6":8.97044,"26.0":1.03985,"26.1":0.03197},P:{"4":0.01071,"21":0.02142,"22":0.02142,"23":0.02142,"24":0.02142,"25":0.02142,"26":0.05354,"27":0.06425,"28":2.75198,"29":0.21416,_:"20 5.0-5.4 6.2-6.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0","7.2-7.4":0.01071},I:{"0":0.02934,"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.00002},K:{"0":0.47991,_:"10 11 12 11.1 11.5 12.1"},A:{"8":0.01148,"9":0.02871,"11":0.05168,_:"6 7 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.50929},Q:{_:"14.9"},O:{"0":0.06366},H:{"0":0},L:{"0":31.76172}};
@@ -0,0 +1,7 @@
import isBrowser from '../../../utils/isBrowser';
export default function isDocumentVisible() {
if (isBrowser) {
return document.visibilityState !== 'hidden';
}
return true;
}
@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isTokenProvider = void 0;
function isTokenProvider(provider) {
return !!provider.useToken;
}
exports.isTokenProvider = isTokenProvider;
@@ -0,0 +1,176 @@
import { _array, _tuple, _unknown } from "./api.js";
import type * as core from "./core.js";
import { parse, parseAsync } from "./parse.js";
import * as schemas from "./schemas.js";
import { $ZodTuple } from "./schemas.js";
import type * as util from "./util.js";
//////////////////////////////////////////
//////////////////////////////////////////
////////// //////////
////////// $ZodFunction //////////
////////// //////////
//////////////////////////////////////////
//////////////////////////////////////////
export interface $ZodFunctionDef<
In extends $ZodFunctionIn = $ZodFunctionIn,
Out extends $ZodFunctionOut = $ZodFunctionOut,
> {
type: "function";
input: In;
output: Out;
}
export type $ZodFunctionArgs = schemas.$ZodType<unknown[], unknown[]>;
export type $ZodFunctionIn = $ZodFunctionArgs;
export type $ZodFunctionOut = schemas.$ZodType;
export type $InferInnerFunctionType<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (
...args: $ZodFunctionIn extends Args ? never[] : core.output<Args>
) => core.input<Returns>;
export type $InferInnerFunctionTypeAsync<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (
...args: $ZodFunctionIn extends Args ? never[] : core.output<Args>
) => util.MaybeAsync<core.input<Returns>>;
export type $InferOuterFunctionType<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (
...args: $ZodFunctionIn extends Args ? never[] : core.input<Args>
) => core.output<Returns>;
export type $InferOuterFunctionTypeAsync<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (
...args: $ZodFunctionIn extends Args ? never[] : core.input<Args>
) => util.MaybeAsync<core.output<Returns>>;
export class $ZodFunction<
Args extends $ZodFunctionIn = $ZodFunctionIn,
Returns extends $ZodFunctionOut = $ZodFunctionOut,
> {
def: $ZodFunctionDef<Args, Returns>;
/** @deprecated */
_def!: $ZodFunctionDef<Args, Returns>;
_input!: $InferInnerFunctionType<Args, Returns>;
_output!: $InferOuterFunctionType<Args, Returns>;
constructor(def: $ZodFunctionDef<Args, Returns>) {
this._def = def;
this.def = def;
}
implement<F extends $InferInnerFunctionType<Args, Returns>>(
func: F
): // allow for return type inference
(
...args: Parameters<this["_output"]>
) => ReturnType<F> extends ReturnType<this["_output"]> ? ReturnType<F> : ReturnType<this["_output"]> {
if (typeof func !== "function") {
throw new Error("implement() must be called with a function");
}
const impl = ((...args: any[]) => {
const parsedArgs = this._def.input ? parse(this._def.input, args, undefined, { callee: impl }) : args;
if (!Array.isArray(parsedArgs)) {
throw new Error("Invalid arguments schema: not an array or tuple schema.");
}
const output = func(...(parsedArgs as any));
return this._def.output ? parse(this._def.output, output, undefined, { callee: impl }) : output;
}) as any;
return impl;
}
implementAsync<F extends $InferInnerFunctionTypeAsync<Args, Returns>>(
func: F
): F extends $InferOuterFunctionTypeAsync<Args, Returns> ? F : $InferOuterFunctionTypeAsync<Args, Returns> {
if (typeof func !== "function") {
throw new Error("implement() must be called with a function");
}
const impl = (async (...args: any[]) => {
const parsedArgs = this._def.input ? await parseAsync(this._def.input, args, undefined, { callee: impl }) : args;
if (!Array.isArray(parsedArgs)) {
throw new Error("Invalid arguments schema: not an array or tuple schema.");
}
const output = await func(...(parsedArgs as any));
return this._def.output ? parseAsync(this._def.output, output, undefined, { callee: impl }) : output;
}) as any;
return impl;
}
input<const Items extends util.TupleItems, const Rest extends $ZodFunctionOut = $ZodFunctionOut>(
args: Items,
rest?: Rest
): $ZodFunction<schemas.$ZodTuple<Items, Rest>, Returns>;
input<NewArgs extends $ZodFunctionIn>(args: NewArgs): $ZodFunction<NewArgs, Returns>;
input(...args: any[]): $ZodFunction<any, Returns> {
const F: any = this.constructor;
if (Array.isArray(args[0])) {
return new F({
type: "function",
input: new $ZodTuple({
type: "tuple",
items: args[0],
rest: args[1],
}),
output: this._def.output,
});
}
return new F({
type: "function",
input: args[0],
output: this._def.output,
});
}
output<NewReturns extends schemas.$ZodType>(output: NewReturns): $ZodFunction<Args, NewReturns> {
const F: any = this.constructor;
return new F({
type: "function",
input: this._def.input,
output,
});
}
}
export interface $ZodFunctionParams<I extends $ZodFunctionIn, O extends schemas.$ZodType> {
input?: I;
output?: O;
}
function _function(): $ZodFunction;
function _function<const In extends Array<schemas.$ZodType> = Array<schemas.$ZodType>>(params: {
input: In;
}): $ZodFunction<$ZodTuple<In, null>, $ZodFunctionOut>;
function _function<
const In extends Array<schemas.$ZodType> = Array<schemas.$ZodType>,
const Out extends $ZodFunctionOut = $ZodFunctionOut,
>(params: {
input: In;
output: Out;
}): $ZodFunction<$ZodTuple<In, null>, Out>;
function _function<const In extends $ZodFunctionIn = $ZodFunctionIn>(params: {
input: In;
}): $ZodFunction<In, $ZodFunctionOut>;
function _function<const Out extends $ZodFunctionOut = $ZodFunctionOut>(params: {
output: Out;
}): $ZodFunction<$ZodFunctionIn, Out>;
function _function<
In extends $ZodFunctionIn = $ZodFunctionIn,
Out extends schemas.$ZodType = schemas.$ZodType,
>(params?: {
input: In;
output: Out;
}): $ZodFunction<In, Out>;
function _function(params?: {
output?: schemas.$ZodType;
input?: $ZodFunctionArgs | Array<schemas.$ZodType>;
}): any {
return new $ZodFunction({
type: "function",
input: Array.isArray(params?.input)
? _tuple(schemas.$ZodTuple, params?.input as any)
: (params?.input ?? _array(schemas.$ZodArray, _unknown(schemas.$ZodUnknown))),
output: params?.output ?? _unknown(schemas.$ZodUnknown),
});
}
export { _function as function };
@@ -0,0 +1 @@
export { CBORTag, decodeCBOR, decodePartialCBOR, encodeCBOR, } from "./cbor/cbor.js";
@@ -0,0 +1,142 @@
// @ts-ignore TS6133
import { expect, test } from "vitest";
import * as z from "zod/v3";
import { ZodIssueCode } from "zod/v3";
import { util } from "../helpers/util.js";
const stringSet = z.set(z.string());
type stringSet = z.infer<typeof stringSet>;
const minTwo = z.set(z.string()).min(2);
const maxTwo = z.set(z.string()).max(2);
const justTwo = z.set(z.string()).size(2);
const nonEmpty = z.set(z.string()).nonempty();
const nonEmptyMax = z.set(z.string()).nonempty().max(2);
test("type inference", () => {
util.assertEqual<stringSet, Set<string>>(true);
});
test("valid parse", () => {
const result = stringSet.safeParse(new Set(["first", "second"]));
expect(result.success).toEqual(true);
if (result.success) {
expect(result.data.has("first")).toEqual(true);
expect(result.data.has("second")).toEqual(true);
expect(result.data.has("third")).toEqual(false);
}
expect(() => {
minTwo.parse(new Set(["a", "b"]));
minTwo.parse(new Set(["a", "b", "c"]));
maxTwo.parse(new Set(["a", "b"]));
maxTwo.parse(new Set(["a"]));
justTwo.parse(new Set(["a", "b"]));
nonEmpty.parse(new Set(["a"]));
nonEmptyMax.parse(new Set(["a"]));
}).not.toThrow();
});
test("valid parse async", async () => {
const result = await stringSet.spa(new Set(["first", "second"]));
expect(result.success).toEqual(true);
if (result.success) {
expect(result.data.has("first")).toEqual(true);
expect(result.data.has("second")).toEqual(true);
expect(result.data.has("third")).toEqual(false);
}
const asyncResult = await stringSet.safeParse(new Set(["first", "second"]));
expect(asyncResult.success).toEqual(true);
if (asyncResult.success) {
expect(asyncResult.data.has("first")).toEqual(true);
expect(asyncResult.data.has("second")).toEqual(true);
expect(asyncResult.data.has("third")).toEqual(false);
}
});
test("valid parse: size-related methods", () => {
expect(() => {
minTwo.parse(new Set(["a", "b"]));
minTwo.parse(new Set(["a", "b", "c"]));
maxTwo.parse(new Set(["a", "b"]));
maxTwo.parse(new Set(["a"]));
justTwo.parse(new Set(["a", "b"]));
nonEmpty.parse(new Set(["a"]));
nonEmptyMax.parse(new Set(["a"]));
}).not.toThrow();
const sizeZeroResult = stringSet.parse(new Set());
expect(sizeZeroResult.size).toBe(0);
const sizeTwoResult = minTwo.parse(new Set(["a", "b"]));
expect(sizeTwoResult.size).toBe(2);
});
test("failing when parsing empty set in nonempty ", () => {
const result = nonEmpty.safeParse(new Set());
expect(result.success).toEqual(false);
if (result.success === false) {
expect(result.error.issues.length).toEqual(1);
expect(result.error.issues[0].code).toEqual(ZodIssueCode.too_small);
}
});
test("failing when set is smaller than min() ", () => {
const result = minTwo.safeParse(new Set(["just_one"]));
expect(result.success).toEqual(false);
if (result.success === false) {
expect(result.error.issues.length).toEqual(1);
expect(result.error.issues[0].code).toEqual(ZodIssueCode.too_small);
}
});
test("failing when set is bigger than max() ", () => {
const result = maxTwo.safeParse(new Set(["one", "two", "three"]));
expect(result.success).toEqual(false);
if (result.success === false) {
expect(result.error.issues.length).toEqual(1);
expect(result.error.issues[0].code).toEqual(ZodIssueCode.too_big);
}
});
test("doesn’t throw when an empty set is given", () => {
const result = stringSet.safeParse(new Set([]));
expect(result.success).toEqual(true);
});
test("throws when a Map is given", () => {
const result = stringSet.safeParse(new Map([]));
expect(result.success).toEqual(false);
if (result.success === false) {
expect(result.error.issues.length).toEqual(1);
expect(result.error.issues[0].code).toEqual(ZodIssueCode.invalid_type);
}
});
test("throws when the given set has invalid input", () => {
const result = stringSet.safeParse(new Set([Symbol()]));
expect(result.success).toEqual(false);
if (result.success === false) {
expect(result.error.issues.length).toEqual(1);
expect(result.error.issues[0].code).toEqual(ZodIssueCode.invalid_type);
expect(result.error.issues[0].path).toEqual([0]);
}
});
test("throws when the given set has multiple invalid entries", () => {
const result = stringSet.safeParse(new Set([1, 2] as any[]) as Set<any>);
expect(result.success).toEqual(false);
if (result.success === false) {
expect(result.error.issues.length).toEqual(2);
expect(result.error.issues[0].code).toEqual(ZodIssueCode.invalid_type);
expect(result.error.issues[0].path).toEqual([0]);
expect(result.error.issues[1].code).toEqual(ZodIssueCode.invalid_type);
expect(result.error.issues[1].path).toEqual([1]);
}
});
@@ -0,0 +1,8 @@
"use client";
import { useEffect } from 'react';
function useUnmountEffect(callback) {
return useEffect(() => () => callback(), []);
}
export { useUnmountEffect };
@@ -0,0 +1,28 @@
var createCompounder = require('./_createCompounder');
/**
* Converts `string` to
* [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the kebab cased string.
* @example
*
* _.kebabCase('Foo Bar');
* // => 'foo-bar'
*
* _.kebabCase('fooBar');
* // => 'foo-bar'
*
* _.kebabCase('__FOO_BAR__');
* // => 'foo-bar'
*/
var kebabCase = createCompounder(function(result, word, index) {
return result + (index ? '-' : '') + word.toLowerCase();
});
module.exports = kebabCase;
@@ -0,0 +1 @@
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/schemes/http.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAoB;IAChC,MAAM,EAAG,MAAM;IAEf,UAAU,EAAG,IAAI;IAEjB,KAAK,EAAG,UAAU,UAAwB,EAAE,OAAkB;QAC7D,qBAAqB;QACrB,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;YACrB,UAAU,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,6BAA6B,CAAC;SACrE;QAED,OAAO,UAAU,CAAC;IACnB,CAAC;IAED,SAAS,EAAG,UAAU,UAAwB,EAAE,OAAkB;QACjE,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC;QAEnE,4BAA4B;QAC5B,IAAI,UAAU,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,UAAU,CAAC,IAAI,KAAK,EAAE,EAAE;YACtE,UAAU,CAAC,IAAI,GAAG,SAAS,CAAC;SAC5B;QAED,0BAA0B;QAC1B,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;YACrB,UAAU,CAAC,IAAI,GAAG,GAAG,CAAC;SACtB;QAED,mDAAmD;QACnD,oEAAoE;QACpE,wBAAwB;QAExB,OAAO,UAAU,CAAC;IACnB,CAAC;CACD,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -0,0 +1,6 @@
import { CreateType } from '../create/type.mjs';
import { Kind } from '../symbols/index.mjs';
/** `[Json]` Creates an Unknown type */
export function Unknown(options) {
return CreateType({ [Kind]: 'Unknown' }, options);
}
@@ -0,0 +1,135 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/object.ts
var object_exports = {};
__export(object_exports, {
arrayToObject: () => arrayToObject,
cleanObject: () => cleanObject,
cleanObjectKeys: () => cleanObjectKeys,
compact: () => compact,
copyObject: () => copyObject,
getKeyValue: () => getKeyValue,
getProp: () => getProp,
omitObject: () => omitObject,
renameProp: () => renameProp
});
module.exports = __toCommonJS(object_exports);
// src/assertion.ts
var __DEV__ = process.env.NODE_ENV !== "production";
var __TEST__ = process.env.NODE_ENV === "test";
function isArray(value) {
return Array.isArray(value);
}
function isObject(value) {
const type = typeof value;
return value != null && (type === "object" || type === "function") && !isArray(value);
}
// src/object.ts
var renameProp = (oldProp, newProp, { [oldProp]: old, ...others }) => ({
[newProp]: old,
...others
});
var copyObject = (obj) => {
if (!isObject(obj))
return obj;
if (obj instanceof Array)
return [...obj];
return { ...obj };
};
var omitObject = (obj, omitKeys) => {
if (!isObject(obj))
return obj;
if (obj instanceof Array)
return [...obj];
const newObj = { ...obj };
omitKeys.forEach((key) => newObj[key] && delete newObj[key]);
return newObj;
};
var cleanObject = (obj) => {
if (!isObject(obj))
return obj;
if (obj instanceof Array)
return [...obj];
const newObj = { ...obj };
Object.keys(newObj).forEach((key) => {
if (newObj[key] === void 0 || newObj[key] === null) {
delete newObj[key];
}
});
return newObj;
};
var cleanObjectKeys = (obj, keys = []) => {
if (!isObject(obj))
return obj;
if (obj instanceof Array)
return [...obj];
const newObj = { ...obj };
keys.forEach((key) => {
if (newObj[key]) {
delete newObj[key];
}
});
return newObj;
};
var getKeyValue = (obj, key) => {
if (!isObject(obj))
return obj;
if (obj instanceof Array)
return [...obj];
return obj[key];
};
var getProp = (obj, path, fallback, index) => {
const key = typeof path === "string" ? path.split(".") : [path];
for (index = 0; index < key.length; index += 1) {
if (!obj)
break;
obj = obj[key[index]];
}
return obj === void 0 ? fallback : obj;
};
var arrayToObject = (arr) => {
if (!arr.length || !Array.isArray(arr))
return {};
return arr.reduce((acc, item) => {
return { ...acc, ...item };
}, {});
};
function compact(object) {
const clone = Object.assign({}, object);
for (let key in clone) {
if (clone[key] === void 0)
delete clone[key];
}
return clone;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
arrayToObject,
cleanObject,
cleanObjectKeys,
compact,
copyObject,
getKeyValue,
getProp,
omitObject,
renameProp
});
@@ -0,0 +1,10 @@
/**
* @param {Record<string, string>} attributes
* Attributes.
* @param {string} property
* Property.
* @returns {string}
* Transformed property.
*/
export function caseInsensitiveTransform(attributes: Record<string, string>, property: string): string;
//# sourceMappingURL=case-insensitive-transform.d.ts.map
@@ -0,0 +1,6 @@
import {
EditIcon
} from "./chunk-6SIT7J74.mjs";
export {
EditIcon
};
@@ -0,0 +1 @@
{"version":3,"file":"unescape.d.ts","sourceRoot":"","sources":["../../src/unescape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ,MAChB,MAAM,8BAGN,KAAK,gBAAgB,EAAE,sBAAsB,CAAC,WAKlD,CAAA"}
@@ -0,0 +1 @@
{"name":"dom-serializer","version":"2.0.0","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532125770,"integrity":"sha512-Qvmpt/uLMUPGLbcVxvurcmniKH7c+uSYrmMYHUdIvm/w2rrXEXm4aa2FkI1T9XGTy9IeDTLTwabg9JbXDgs3NQ==","mode":420,"size":1098},"lib/esm/foreignNames.js":{"checkedAt":1794532125770,"integrity":"sha512-aBRXwwsSQWDC0pV//UpmyCF5ElFv9HEMwx5ISQz5HPmQC3bori3ty/n82ANw8vjJ1f566poaFYwgRWf/YReY0Q==","mode":420,"size":2047},"lib/foreignNames.js":{"checkedAt":1794532125770,"integrity":"sha512-0IzxzmM/awZWXYnTAb1CnIrLpwJq3sC3Azswfi/2HbJNnFDrp0mpNotdJnvH3HwiahvkC+rZ614fcZbZFInRLA==","mode":420,"size":2206},"lib/esm/index.js":{"checkedAt":1794532125770,"integrity":"sha512-6TnLRSc1wYTjvyV3MZ2RoOC2VdFZVPowCX2XsDElxqldKDWg7DqUxxDykx/aernklt+k4Au3sU/srr1hsHvs5g==","mode":420,"size":5381},"lib/index.js":{"checkedAt":1794532125771,"integrity":"sha512-/RSL7mOD7oT0B+qTctXBWTcV95S9FBU+Ipy9u9FFrG5cnv79Ruc09byBkfJOp9+ZNs/swTodOFDlp6bD/yGAJQ==","mode":420,"size":7122},"lib/esm/package.json":{"checkedAt":1794532100338,"integrity":"sha512-yJaw9MUXdELVmz7z3SYVp2blYklya3nL3pU6DnmPcM5rDXeD26fLnxMcB3WmvAQ/Uq9woAMNLTYvYRv/3m6T8Q==","mode":420,"size":18},"package.json":{"checkedAt":1794532125771,"integrity":"sha512-L32wC7qo0udbA8qq1JavUMG3xOBGqvVjjkEGMxt9+Fpduzhp150MKsmnosjxtZc7efwv4ssqrveuSKWS3RJlMg==","mode":420,"size":2019},"lib/esm/foreignNames.d.ts.map":{"checkedAt":1794532125771,"integrity":"sha512-u+zi2uQ3in3CHu61hOtWUm4dYHAxVNgm21QkOLbArMD115bAtfdzcSf6BWDs8q089nUwuWL0UKVs5b6Qvyel7g==","mode":420,"size":186},"lib/foreignNames.d.ts.map":{"checkedAt":1794532125771,"integrity":"sha512-iwIbl8eB+STvmeXDDlcoUiz+eleQTET85boRCy8eZ+tJN9BIuLDtcXAAg9Tlbouxoj9Oi7wUwWXCLxhwDgeyZQ==","mode":420,"size":183},"lib/esm/index.d.ts.map":{"checkedAt":1794532125771,"integrity":"sha512-cqpenfet/UmM8a8rlDM5cqQqiw+wuX7fa2UraPxNyb4m6n+bkHH0nblfKOdzcM2dTQHq5lC6E6C4NDauElb5aw==","mode":420,"size":567},"lib/index.d.ts.map":{"checkedAt":1794532125771,"integrity":"sha512-YEet3HTqa2PXzydvKf0sHisoP+w4HY4D88faBNJ2Z2NL/dMmMwf+fRNrqqGUCgB2Tq3Tqgl+MxB+3WyH73Ub8A==","mode":420,"size":564},"README.md":{"checkedAt":1794532125771,"integrity":"sha512-Ql8f8S1tVr0miSZYD1BTZqCysfLA8a4VaFV21DctDACXl4OXz0UAzHylBH4k0zmk2ntN+zjFtwgkrQjvl64Z6A==","mode":420,"size":3458},"lib/esm/foreignNames.d.ts":{"checkedAt":1794532125772,"integrity":"sha512-iR7Tt+HW09OpWKYYPosWcAC88vyjt6V87jYww9wa5wZFcvFXMeqWRL2o7b5PkHstTesNcNKJGFjCwKFeM1eOCA==","mode":420,"size":156},"lib/foreignNames.d.ts":{"checkedAt":1794532125772,"integrity":"sha512-iR7Tt+HW09OpWKYYPosWcAC88vyjt6V87jYww9wa5wZFcvFXMeqWRL2o7b5PkHstTesNcNKJGFjCwKFeM1eOCA==","mode":420,"size":156},"lib/esm/index.d.ts":{"checkedAt":1794532125772,"integrity":"sha512-yoB9h/uG5HrGqSpbEbwze1EB9TvxEmn+kd91G0sw8EWRqtNLk9YbGWUQWxl0ye3UxF4appnoFNyukoQtwqs+8w==","mode":420,"size":1826},"lib/index.d.ts":{"checkedAt":1794532125772,"integrity":"sha512-yoB9h/uG5HrGqSpbEbwze1EB9TvxEmn+kd91G0sw8EWRqtNLk9YbGWUQWxl0ye3UxF4appnoFNyukoQtwqs+8w==","mode":420,"size":1826}}}
@@ -0,0 +1,25 @@
import * as react_jsx_runtime from 'react/jsx-runtime';
import { ScrollShadowProps } from '@heroui/scroll-shadow';
import { VirtualizationProps } from './listbox.js';
import { UseListboxReturn } from './use-listbox.js';
import 'react';
import 'tailwind-variants';
import '@heroui/system';
import '@react-types/shared';
import '@react-aria/listbox';
import '@heroui/theme';
import '@react-stately/list';
import '@heroui/react-utils';
import './listbox-item.js';
import './use-listbox-item.js';
import './base/listbox-item-base.js';
import '@heroui/aria-utils';
interface Props extends UseListboxReturn {
isVirtualized?: boolean;
virtualization?: VirtualizationProps;
scrollShadowProps?: Partial<ScrollShadowProps>;
}
declare const VirtualizedListbox: (props: Props) => react_jsx_runtime.JSX.Element;
export { VirtualizedListbox as default };
@@ -0,0 +1,38 @@
{
"name": "toidentifier",
"description": "Convert a string of words to a JavaScript identifier",
"version": "1.0.1",
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
"contributors": [
"Douglas Christopher Wilson <doug@somethingdoug.com>",
"Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)"
],
"repository": "component/toidentifier",
"devDependencies": {
"eslint": "7.32.0",
"eslint-config-standard": "14.1.1",
"eslint-plugin-import": "2.25.3",
"eslint-plugin-markdown": "2.2.1",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "4.3.1",
"eslint-plugin-standard": "4.1.0",
"mocha": "9.1.3",
"nyc": "15.1.0"
},
"engines": {
"node": ">=0.6"
},
"license": "MIT",
"files": [
"HISTORY.md",
"LICENSE",
"index.js"
],
"scripts": {
"lint": "eslint .",
"test": "mocha --reporter spec --bail --check-leaks test/",
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
"test-cov": "nyc --reporter=html --reporter=text npm test",
"version": "node scripts/version-history.js && git add HISTORY.md"
}
}
@@ -0,0 +1,22 @@
/**
* @import {State} from 'mdast-util-to-markdown'
* @import {Code} from 'mdast'
*/
/**
* @param {Code} node
* @param {State} state
* @returns {boolean}
*/
export function formatCodeAsIndented(node, state) {
return Boolean(
state.options.fences === false &&
node.value &&
// If there’s no info…
!node.lang &&
// And there’s a non-whitespace character…
/[^ \r\n]/.test(node.value) &&
// And the value doesn’t start or end in a blank…
!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(node.value)
)
}
@@ -0,0 +1,732 @@
import {focusSafely as $6a99195332edec8b$export$80f3e147d781571c} from "./focusSafely.module.js";
import {isElementVisible as $645f2e67b85a24c9$export$e989c0fffaa6b27a} from "./isElementVisible.module.js";
import {useLayoutEffect as $cgawC$useLayoutEffect, getOwnerDocument as $cgawC$getOwnerDocument} from "@react-aria/utils";
import $cgawC$react, {useRef as $cgawC$useRef, useContext as $cgawC$useContext, useMemo as $cgawC$useMemo, useEffect as $cgawC$useEffect} from "react";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
const $9bf71ea28793e738$var$FocusContext = /*#__PURE__*/ (0, $cgawC$react).createContext(null);
const $9bf71ea28793e738$var$RESTORE_FOCUS_EVENT = 'react-aria-focus-scope-restore';
let $9bf71ea28793e738$var$activeScope = null;
function $9bf71ea28793e738$export$20e40289641fbbb6(props) {
let { children: children, contain: contain, restoreFocus: restoreFocus, autoFocus: autoFocus } = props;
let startRef = (0, $cgawC$useRef)(null);
let endRef = (0, $cgawC$useRef)(null);
let scopeRef = (0, $cgawC$useRef)([]);
let { parentNode: parentNode } = (0, $cgawC$useContext)($9bf71ea28793e738$var$FocusContext) || {};
// Create a tree node here so we can add children to it even before it is added to the tree.
let node = (0, $cgawC$useMemo)(()=>new $9bf71ea28793e738$var$TreeNode({
scopeRef: scopeRef
}), [
scopeRef
]);
(0, $cgawC$useLayoutEffect)(()=>{
// If a new scope mounts outside the active scope, (e.g. DialogContainer launched from a menu),
// use the active scope as the parent instead of the parent from context. Layout effects run bottom
// up, so if the parent is not yet added to the tree, don't do this. Only the outer-most FocusScope
// that is being added should get the activeScope as its parent.
let parent = parentNode || $9bf71ea28793e738$export$d06fae2ee68b101e.root;
if ($9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(parent.scopeRef) && $9bf71ea28793e738$var$activeScope && !$9bf71ea28793e738$var$isAncestorScope($9bf71ea28793e738$var$activeScope, parent.scopeRef)) {
let activeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode($9bf71ea28793e738$var$activeScope);
if (activeNode) parent = activeNode;
}
// Add the node to the parent, and to the tree.
parent.addChild(node);
$9bf71ea28793e738$export$d06fae2ee68b101e.addNode(node);
}, [
node,
parentNode
]);
(0, $cgawC$useLayoutEffect)(()=>{
let node = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
if (node) node.contain = !!contain;
}, [
contain
]);
(0, $cgawC$useLayoutEffect)(()=>{
var _startRef_current;
// Find all rendered nodes between the sentinels and add them to the scope.
let node = (_startRef_current = startRef.current) === null || _startRef_current === void 0 ? void 0 : _startRef_current.nextSibling;
let nodes = [];
let stopPropagation = (e)=>e.stopPropagation();
while(node && node !== endRef.current){
nodes.push(node);
// Stop custom restore focus event from propagating to parent focus scopes.
node.addEventListener($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT, stopPropagation);
node = node.nextSibling;
}
scopeRef.current = nodes;
return ()=>{
for (let node of nodes)node.removeEventListener($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT, stopPropagation);
};
}, [
children
]);
$9bf71ea28793e738$var$useActiveScopeTracker(scopeRef, restoreFocus, contain);
$9bf71ea28793e738$var$useFocusContainment(scopeRef, contain);
$9bf71ea28793e738$var$useRestoreFocus(scopeRef, restoreFocus, contain);
$9bf71ea28793e738$var$useAutoFocus(scopeRef, autoFocus);
// This needs to be an effect so that activeScope is updated after the FocusScope tree is complete.
// It cannot be a useLayoutEffect because the parent of this node hasn't been attached in the tree yet.
(0, $cgawC$useEffect)(()=>{
const activeElement = (0, $cgawC$getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined).activeElement;
let scope = null;
if ($9bf71ea28793e738$var$isElementInScope(activeElement, scopeRef.current)) {
// We need to traverse the focusScope tree and find the bottom most scope that
// contains the active element and set that as the activeScope.
for (let node of $9bf71ea28793e738$export$d06fae2ee68b101e.traverse())if (node.scopeRef && $9bf71ea28793e738$var$isElementInScope(activeElement, node.scopeRef.current)) scope = node;
if (scope === $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef)) $9bf71ea28793e738$var$activeScope = scope.scopeRef;
}
}, [
scopeRef
]);
// This layout effect cleanup is so that the tree node is removed synchronously with react before the RAF
// in useRestoreFocus cleanup runs.
(0, $cgawC$useLayoutEffect)(()=>{
return ()=>{
var _focusScopeTree_getTreeNode_parent, _focusScopeTree_getTreeNode;
var _focusScopeTree_getTreeNode_parent_scopeRef;
// Scope may have been re-parented.
let parentScope = (_focusScopeTree_getTreeNode_parent_scopeRef = (_focusScopeTree_getTreeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef)) === null || _focusScopeTree_getTreeNode === void 0 ? void 0 : (_focusScopeTree_getTreeNode_parent = _focusScopeTree_getTreeNode.parent) === null || _focusScopeTree_getTreeNode_parent === void 0 ? void 0 : _focusScopeTree_getTreeNode_parent.scopeRef) !== null && _focusScopeTree_getTreeNode_parent_scopeRef !== void 0 ? _focusScopeTree_getTreeNode_parent_scopeRef : null;
if ((scopeRef === $9bf71ea28793e738$var$activeScope || $9bf71ea28793e738$var$isAncestorScope(scopeRef, $9bf71ea28793e738$var$activeScope)) && (!parentScope || $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(parentScope))) $9bf71ea28793e738$var$activeScope = parentScope;
$9bf71ea28793e738$export$d06fae2ee68b101e.removeTreeNode(scopeRef);
};
}, [
scopeRef
]);
let focusManager = (0, $cgawC$useMemo)(()=>$9bf71ea28793e738$var$createFocusManagerForScope(scopeRef), []);
let value = (0, $cgawC$useMemo)(()=>({
focusManager: focusManager,
parentNode: node
}), [
node,
focusManager
]);
return /*#__PURE__*/ (0, $cgawC$react).createElement($9bf71ea28793e738$var$FocusContext.Provider, {
value: value
}, /*#__PURE__*/ (0, $cgawC$react).createElement("span", {
"data-focus-scope-start": true,
hidden: true,
ref: startRef
}), children, /*#__PURE__*/ (0, $cgawC$react).createElement("span", {
"data-focus-scope-end": true,
hidden: true,
ref: endRef
}));
}
function $9bf71ea28793e738$export$10c5169755ce7bd7() {
var _useContext;
return (_useContext = (0, $cgawC$useContext)($9bf71ea28793e738$var$FocusContext)) === null || _useContext === void 0 ? void 0 : _useContext.focusManager;
}
function $9bf71ea28793e738$var$createFocusManagerForScope(scopeRef) {
return {
focusNext (opts = {}) {
let scope = scopeRef.current;
let { from: from, tabbable: tabbable, wrap: wrap, accept: accept } = opts;
let node = from || (0, $cgawC$getOwnerDocument)(scope[0]).activeElement;
let sentinel = scope[0].previousElementSibling;
let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(scopeRoot, {
tabbable: tabbable,
accept: accept
}, scope);
walker.currentNode = $9bf71ea28793e738$var$isElementInScope(node, scope) ? node : sentinel;
let nextNode = walker.nextNode();
if (!nextNode && wrap) {
walker.currentNode = sentinel;
nextNode = walker.nextNode();
}
if (nextNode) $9bf71ea28793e738$var$focusElement(nextNode, true);
return nextNode;
},
focusPrevious (opts = {}) {
let scope = scopeRef.current;
let { from: from, tabbable: tabbable, wrap: wrap, accept: accept } = opts;
let node = from || (0, $cgawC$getOwnerDocument)(scope[0]).activeElement;
let sentinel = scope[scope.length - 1].nextElementSibling;
let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(scopeRoot, {
tabbable: tabbable,
accept: accept
}, scope);
walker.currentNode = $9bf71ea28793e738$var$isElementInScope(node, scope) ? node : sentinel;
let previousNode = walker.previousNode();
if (!previousNode && wrap) {
walker.currentNode = sentinel;
previousNode = walker.previousNode();
}
if (previousNode) $9bf71ea28793e738$var$focusElement(previousNode, true);
return previousNode;
},
focusFirst (opts = {}) {
let scope = scopeRef.current;
let { tabbable: tabbable, accept: accept } = opts;
let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(scopeRoot, {
tabbable: tabbable,
accept: accept
}, scope);
walker.currentNode = scope[0].previousElementSibling;
let nextNode = walker.nextNode();
if (nextNode) $9bf71ea28793e738$var$focusElement(nextNode, true);
return nextNode;
},
focusLast (opts = {}) {
let scope = scopeRef.current;
let { tabbable: tabbable, accept: accept } = opts;
let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(scopeRoot, {
tabbable: tabbable,
accept: accept
}, scope);
walker.currentNode = scope[scope.length - 1].nextElementSibling;
let previousNode = walker.previousNode();
if (previousNode) $9bf71ea28793e738$var$focusElement(previousNode, true);
return previousNode;
}
};
}
const $9bf71ea28793e738$var$focusableElements = [
'input:not([disabled]):not([type=hidden])',
'select:not([disabled])',
'textarea:not([disabled])',
'button:not([disabled])',
'a[href]',
'area[href]',
'summary',
'iframe',
'object',
'embed',
'audio[controls]',
'video[controls]',
'[contenteditable]'
];
const $9bf71ea28793e738$var$FOCUSABLE_ELEMENT_SELECTOR = $9bf71ea28793e738$var$focusableElements.join(':not([hidden]),') + ',[tabindex]:not([disabled]):not([hidden])';
$9bf71ea28793e738$var$focusableElements.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
const $9bf71ea28793e738$var$TABBABLE_ELEMENT_SELECTOR = $9bf71ea28793e738$var$focusableElements.join(':not([hidden]):not([tabindex="-1"]),');
function $9bf71ea28793e738$export$4c063cf1350e6fed(element) {
return element.matches($9bf71ea28793e738$var$FOCUSABLE_ELEMENT_SELECTOR);
}
function $9bf71ea28793e738$var$getScopeRoot(scope) {
return scope[0].parentElement;
}
function $9bf71ea28793e738$var$shouldContainFocus(scopeRef) {
let scope = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode($9bf71ea28793e738$var$activeScope);
while(scope && scope.scopeRef !== scopeRef){
if (scope.contain) return false;
scope = scope.parent;
}
return true;
}
function $9bf71ea28793e738$var$useFocusContainment(scopeRef, contain) {
let focusedNode = (0, $cgawC$useRef)(undefined);
let raf = (0, $cgawC$useRef)(undefined);
(0, $cgawC$useLayoutEffect)(()=>{
let scope = scopeRef.current;
if (!contain) {
// if contain was changed, then we should cancel any ongoing waits to pull focus back into containment
if (raf.current) {
cancelAnimationFrame(raf.current);
raf.current = undefined;
}
return;
}
const ownerDocument = (0, $cgawC$getOwnerDocument)(scope ? scope[0] : undefined);
// Handle the Tab key to contain focus within the scope
let onKeyDown = (e)=>{
if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey || !$9bf71ea28793e738$var$shouldContainFocus(scopeRef) || e.isComposing) return;
let focusedElement = ownerDocument.activeElement;
let scope = scopeRef.current;
if (!scope || !$9bf71ea28793e738$var$isElementInScope(focusedElement, scope)) return;
let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(scopeRoot, {
tabbable: true
}, scope);
if (!focusedElement) return;
walker.currentNode = focusedElement;
let nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();
if (!nextElement) {
walker.currentNode = e.shiftKey ? scope[scope.length - 1].nextElementSibling : scope[0].previousElementSibling;
nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();
}
e.preventDefault();
if (nextElement) $9bf71ea28793e738$var$focusElement(nextElement, true);
};
let onFocus = (e)=>{
// If focusing an element in a child scope of the currently active scope, the child becomes active.
// Moving out of the active scope to an ancestor is not allowed.
if ((!$9bf71ea28793e738$var$activeScope || $9bf71ea28793e738$var$isAncestorScope($9bf71ea28793e738$var$activeScope, scopeRef)) && $9bf71ea28793e738$var$isElementInScope(e.target, scopeRef.current)) {
$9bf71ea28793e738$var$activeScope = scopeRef;
focusedNode.current = e.target;
} else if ($9bf71ea28793e738$var$shouldContainFocus(scopeRef) && !$9bf71ea28793e738$var$isElementInChildScope(e.target, scopeRef)) {
// If a focus event occurs outside the active scope (e.g. user tabs from browser location bar),
// restore focus to the previously focused node or the first tabbable element in the active scope.
if (focusedNode.current) focusedNode.current.focus();
else if ($9bf71ea28793e738$var$activeScope && $9bf71ea28793e738$var$activeScope.current) $9bf71ea28793e738$var$focusFirstInScope($9bf71ea28793e738$var$activeScope.current);
} else if ($9bf71ea28793e738$var$shouldContainFocus(scopeRef)) focusedNode.current = e.target;
};
let onBlur = (e)=>{
// Firefox doesn't shift focus back to the Dialog properly without this
if (raf.current) cancelAnimationFrame(raf.current);
raf.current = requestAnimationFrame(()=>{
// Use document.activeElement instead of e.relatedTarget so we can tell if user clicked into iframe
if (ownerDocument.activeElement && $9bf71ea28793e738$var$shouldContainFocus(scopeRef) && !$9bf71ea28793e738$var$isElementInChildScope(ownerDocument.activeElement, scopeRef)) {
$9bf71ea28793e738$var$activeScope = scopeRef;
if (ownerDocument.body.contains(e.target)) {
var _focusedNode_current;
focusedNode.current = e.target;
(_focusedNode_current = focusedNode.current) === null || _focusedNode_current === void 0 ? void 0 : _focusedNode_current.focus();
} else if ($9bf71ea28793e738$var$activeScope.current) $9bf71ea28793e738$var$focusFirstInScope($9bf71ea28793e738$var$activeScope.current);
}
});
};
ownerDocument.addEventListener('keydown', onKeyDown, false);
ownerDocument.addEventListener('focusin', onFocus, false);
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.addEventListener('focusin', onFocus, false));
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.addEventListener('focusout', onBlur, false));
return ()=>{
ownerDocument.removeEventListener('keydown', onKeyDown, false);
ownerDocument.removeEventListener('focusin', onFocus, false);
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.removeEventListener('focusin', onFocus, false));
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.removeEventListener('focusout', onBlur, false));
};
}, [
scopeRef,
contain
]);
// This is a useLayoutEffect so it is guaranteed to run before our async synthetic blur
(0, $cgawC$useLayoutEffect)(()=>{
return ()=>{
if (raf.current) cancelAnimationFrame(raf.current);
};
}, [
raf
]);
}
function $9bf71ea28793e738$var$isElementInAnyScope(element) {
return $9bf71ea28793e738$var$isElementInChildScope(element);
}
function $9bf71ea28793e738$var$isElementInScope(element, scope) {
if (!element) return false;
if (!scope) return false;
return scope.some((node)=>node.contains(element));
}
function $9bf71ea28793e738$var$isElementInChildScope(element, scope = null) {
// If the element is within a top layer element (e.g. toasts), always allow moving focus there.
if (element instanceof Element && element.closest('[data-react-aria-top-layer]')) return true;
// node.contains in isElementInScope covers child scopes that are also DOM children,
// but does not cover child scopes in portals.
for (let { scopeRef: s } of $9bf71ea28793e738$export$d06fae2ee68b101e.traverse($9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scope))){
if (s && $9bf71ea28793e738$var$isElementInScope(element, s.current)) return true;
}
return false;
}
function $9bf71ea28793e738$export$1258395f99bf9cbf(element) {
return $9bf71ea28793e738$var$isElementInChildScope(element, $9bf71ea28793e738$var$activeScope);
}
function $9bf71ea28793e738$var$isAncestorScope(ancestor, scope) {
var _focusScopeTree_getTreeNode;
let parent = (_focusScopeTree_getTreeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scope)) === null || _focusScopeTree_getTreeNode === void 0 ? void 0 : _focusScopeTree_getTreeNode.parent;
while(parent){
if (parent.scopeRef === ancestor) return true;
parent = parent.parent;
}
return false;
}
function $9bf71ea28793e738$var$focusElement(element, scroll = false) {
if (element != null && !scroll) try {
(0, $6a99195332edec8b$export$80f3e147d781571c)(element);
} catch {
// ignore
}
else if (element != null) try {
element.focus();
} catch {
// ignore
}
}
function $9bf71ea28793e738$var$getFirstInScope(scope, tabbable = true) {
let sentinel = scope[0].previousElementSibling;
let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(scopeRoot, {
tabbable: tabbable
}, scope);
walker.currentNode = sentinel;
let nextNode = walker.nextNode();
// If the scope does not contain a tabbable element, use the first focusable element.
if (tabbable && !nextNode) {
scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(scopeRoot, {
tabbable: false
}, scope);
walker.currentNode = sentinel;
nextNode = walker.nextNode();
}
return nextNode;
}
function $9bf71ea28793e738$var$focusFirstInScope(scope, tabbable = true) {
$9bf71ea28793e738$var$focusElement($9bf71ea28793e738$var$getFirstInScope(scope, tabbable));
}
function $9bf71ea28793e738$var$useAutoFocus(scopeRef, autoFocus) {
const autoFocusRef = (0, $cgawC$react).useRef(autoFocus);
(0, $cgawC$useEffect)(()=>{
if (autoFocusRef.current) {
$9bf71ea28793e738$var$activeScope = scopeRef;
const ownerDocument = (0, $cgawC$getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined);
if (!$9bf71ea28793e738$var$isElementInScope(ownerDocument.activeElement, $9bf71ea28793e738$var$activeScope.current) && scopeRef.current) $9bf71ea28793e738$var$focusFirstInScope(scopeRef.current);
}
autoFocusRef.current = false;
}, [
scopeRef
]);
}
function $9bf71ea28793e738$var$useActiveScopeTracker(scopeRef, restore, contain) {
// tracks the active scope, in case restore and contain are both false.
// if either are true, this is tracked in useRestoreFocus or useFocusContainment.
(0, $cgawC$useLayoutEffect)(()=>{
if (restore || contain) return;
let scope = scopeRef.current;
const ownerDocument = (0, $cgawC$getOwnerDocument)(scope ? scope[0] : undefined);
let onFocus = (e)=>{
let target = e.target;
if ($9bf71ea28793e738$var$isElementInScope(target, scopeRef.current)) $9bf71ea28793e738$var$activeScope = scopeRef;
else if (!$9bf71ea28793e738$var$isElementInAnyScope(target)) $9bf71ea28793e738$var$activeScope = null;
};
ownerDocument.addEventListener('focusin', onFocus, false);
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.addEventListener('focusin', onFocus, false));
return ()=>{
ownerDocument.removeEventListener('focusin', onFocus, false);
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.removeEventListener('focusin', onFocus, false));
};
}, [
scopeRef,
restore,
contain
]);
}
function $9bf71ea28793e738$var$shouldRestoreFocus(scopeRef) {
let scope = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode($9bf71ea28793e738$var$activeScope);
while(scope && scope.scopeRef !== scopeRef){
if (scope.nodeToRestore) return false;
scope = scope.parent;
}
return (scope === null || scope === void 0 ? void 0 : scope.scopeRef) === scopeRef;
}
function $9bf71ea28793e738$var$useRestoreFocus(scopeRef, restoreFocus, contain) {
// create a ref during render instead of useLayoutEffect so the active element is saved before a child with autoFocus=true mounts.
// eslint-disable-next-line no-restricted-globals
const nodeToRestoreRef = (0, $cgawC$useRef)(typeof document !== 'undefined' ? (0, $cgawC$getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined).activeElement : null);
// restoring scopes should all track if they are active regardless of contain, but contain already tracks it plus logic to contain the focus
// restoring-non-containing scopes should only care if they become active so they can perform the restore
(0, $cgawC$useLayoutEffect)(()=>{
let scope = scopeRef.current;
const ownerDocument = (0, $cgawC$getOwnerDocument)(scope ? scope[0] : undefined);
if (!restoreFocus || contain) return;
let onFocus = ()=>{
// If focusing an element in a child scope of the currently active scope, the child becomes active.
// Moving out of the active scope to an ancestor is not allowed.
if ((!$9bf71ea28793e738$var$activeScope || $9bf71ea28793e738$var$isAncestorScope($9bf71ea28793e738$var$activeScope, scopeRef)) && $9bf71ea28793e738$var$isElementInScope(ownerDocument.activeElement, scopeRef.current)) $9bf71ea28793e738$var$activeScope = scopeRef;
};
ownerDocument.addEventListener('focusin', onFocus, false);
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.addEventListener('focusin', onFocus, false));
return ()=>{
ownerDocument.removeEventListener('focusin', onFocus, false);
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.removeEventListener('focusin', onFocus, false));
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
scopeRef,
contain
]);
(0, $cgawC$useLayoutEffect)(()=>{
const ownerDocument = (0, $cgawC$getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined);
if (!restoreFocus) return;
// Handle the Tab key so that tabbing out of the scope goes to the next element
// after the node that had focus when the scope mounted. This is important when
// using portals for overlays, so that focus goes to the expected element when
// tabbing out of the overlay.
let onKeyDown = (e)=>{
if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey || !$9bf71ea28793e738$var$shouldContainFocus(scopeRef) || e.isComposing) return;
let focusedElement = ownerDocument.activeElement;
if (!$9bf71ea28793e738$var$isElementInChildScope(focusedElement, scopeRef) || !$9bf71ea28793e738$var$shouldRestoreFocus(scopeRef)) return;
let treeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
if (!treeNode) return;
let nodeToRestore = treeNode.nodeToRestore;
// Create a DOM tree walker that matches all tabbable elements
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(ownerDocument.body, {
tabbable: true
});
// Find the next tabbable element after the currently focused element
walker.currentNode = focusedElement;
let nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();
if (!nodeToRestore || !ownerDocument.body.contains(nodeToRestore) || nodeToRestore === ownerDocument.body) {
nodeToRestore = undefined;
treeNode.nodeToRestore = undefined;
}
// If there is no next element, or it is outside the current scope, move focus to the
// next element after the node to restore to instead.
if ((!nextElement || !$9bf71ea28793e738$var$isElementInChildScope(nextElement, scopeRef)) && nodeToRestore) {
walker.currentNode = nodeToRestore;
// Skip over elements within the scope, in case the scope immediately follows the node to restore.
do nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();
while ($9bf71ea28793e738$var$isElementInChildScope(nextElement, scopeRef));
e.preventDefault();
e.stopPropagation();
if (nextElement) $9bf71ea28793e738$var$focusElement(nextElement, true);
else // If there is no next element and the nodeToRestore isn't within a FocusScope (i.e. we are leaving the top level focus scope)
// then move focus to the body.
// Otherwise restore focus to the nodeToRestore (e.g menu within a popover -> tabbing to close the menu should move focus to menu trigger)
if (!$9bf71ea28793e738$var$isElementInAnyScope(nodeToRestore)) focusedElement.blur();
else $9bf71ea28793e738$var$focusElement(nodeToRestore, true);
}
};
if (!contain) ownerDocument.addEventListener('keydown', onKeyDown, true);
return ()=>{
if (!contain) ownerDocument.removeEventListener('keydown', onKeyDown, true);
};
}, [
scopeRef,
restoreFocus,
contain
]);
// useLayoutEffect instead of useEffect so the active element is saved synchronously instead of asynchronously.
(0, $cgawC$useLayoutEffect)(()=>{
const ownerDocument = (0, $cgawC$getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined);
if (!restoreFocus) return;
let treeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
if (!treeNode) return;
var _nodeToRestoreRef_current;
treeNode.nodeToRestore = (_nodeToRestoreRef_current = nodeToRestoreRef.current) !== null && _nodeToRestoreRef_current !== void 0 ? _nodeToRestoreRef_current : undefined;
return ()=>{
let treeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
if (!treeNode) return;
let nodeToRestore = treeNode.nodeToRestore;
// if we already lost focus to the body and this was the active scope, then we should attempt to restore
if (restoreFocus && nodeToRestore && (ownerDocument.activeElement && $9bf71ea28793e738$var$isElementInChildScope(ownerDocument.activeElement, scopeRef) || ownerDocument.activeElement === ownerDocument.body && $9bf71ea28793e738$var$shouldRestoreFocus(scopeRef))) {
// freeze the focusScopeTree so it persists after the raf, otherwise during unmount nodes are removed from it
let clonedTree = $9bf71ea28793e738$export$d06fae2ee68b101e.clone();
requestAnimationFrame(()=>{
// Only restore focus if we've lost focus to the body, the alternative is that focus has been purposefully moved elsewhere
if (ownerDocument.activeElement === ownerDocument.body) {
// look up the tree starting with our scope to find a nodeToRestore still in the DOM
let treeNode = clonedTree.getTreeNode(scopeRef);
while(treeNode){
if (treeNode.nodeToRestore && treeNode.nodeToRestore.isConnected) {
$9bf71ea28793e738$var$restoreFocusToElement(treeNode.nodeToRestore);
return;
}
treeNode = treeNode.parent;
}
// If no nodeToRestore was found, focus the first element in the nearest
// ancestor scope that is still in the tree.
treeNode = clonedTree.getTreeNode(scopeRef);
while(treeNode){
if (treeNode.scopeRef && treeNode.scopeRef.current && $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(treeNode.scopeRef)) {
let node = $9bf71ea28793e738$var$getFirstInScope(treeNode.scopeRef.current, true);
$9bf71ea28793e738$var$restoreFocusToElement(node);
return;
}
treeNode = treeNode.parent;
}
}
});
}
};
}, [
scopeRef,
restoreFocus
]);
}
function $9bf71ea28793e738$var$restoreFocusToElement(node) {
// Dispatch a custom event that parent elements can intercept to customize focus restoration.
// For example, virtualized collection components reuse DOM elements, so the original element
// might still exist in the DOM but representing a different item.
if (node.dispatchEvent(new CustomEvent($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT, {
bubbles: true,
cancelable: true
}))) $9bf71ea28793e738$var$focusElement(node);
}
function $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, opts, scope) {
let selector = (opts === null || opts === void 0 ? void 0 : opts.tabbable) ? $9bf71ea28793e738$var$TABBABLE_ELEMENT_SELECTOR : $9bf71ea28793e738$var$FOCUSABLE_ELEMENT_SELECTOR;
let walker = (0, $cgawC$getOwnerDocument)(root).createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
acceptNode (node) {
var _opts_from;
// Skip nodes inside the starting node.
if (opts === null || opts === void 0 ? void 0 : (_opts_from = opts.from) === null || _opts_from === void 0 ? void 0 : _opts_from.contains(node)) return NodeFilter.FILTER_REJECT;
if (node.matches(selector) && (0, $645f2e67b85a24c9$export$e989c0fffaa6b27a)(node) && (!scope || $9bf71ea28793e738$var$isElementInScope(node, scope)) && (!(opts === null || opts === void 0 ? void 0 : opts.accept) || opts.accept(node))) return NodeFilter.FILTER_ACCEPT;
return NodeFilter.FILTER_SKIP;
}
});
if (opts === null || opts === void 0 ? void 0 : opts.from) walker.currentNode = opts.from;
return walker;
}
function $9bf71ea28793e738$export$c5251b9e124bf29(ref, defaultOptions = {}) {
return {
focusNext (opts = {}) {
let root = ref.current;
if (!root) return null;
let { from: from, tabbable: tabbable = defaultOptions.tabbable, wrap: wrap = defaultOptions.wrap, accept: accept = defaultOptions.accept } = opts;
let node = from || (0, $cgawC$getOwnerDocument)(root).activeElement;
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
tabbable: tabbable,
accept: accept
});
if (root.contains(node)) walker.currentNode = node;
let nextNode = walker.nextNode();
if (!nextNode && wrap) {
walker.currentNode = root;
nextNode = walker.nextNode();
}
if (nextNode) $9bf71ea28793e738$var$focusElement(nextNode, true);
return nextNode;
},
focusPrevious (opts = defaultOptions) {
let root = ref.current;
if (!root) return null;
let { from: from, tabbable: tabbable = defaultOptions.tabbable, wrap: wrap = defaultOptions.wrap, accept: accept = defaultOptions.accept } = opts;
let node = from || (0, $cgawC$getOwnerDocument)(root).activeElement;
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
tabbable: tabbable,
accept: accept
});
if (root.contains(node)) walker.currentNode = node;
else {
let next = $9bf71ea28793e738$var$last(walker);
if (next) $9bf71ea28793e738$var$focusElement(next, true);
return next !== null && next !== void 0 ? next : null;
}
let previousNode = walker.previousNode();
if (!previousNode && wrap) {
walker.currentNode = root;
let lastNode = $9bf71ea28793e738$var$last(walker);
if (!lastNode) // couldn't wrap
return null;
previousNode = lastNode;
}
if (previousNode) $9bf71ea28793e738$var$focusElement(previousNode, true);
return previousNode !== null && previousNode !== void 0 ? previousNode : null;
},
focusFirst (opts = defaultOptions) {
let root = ref.current;
if (!root) return null;
let { tabbable: tabbable = defaultOptions.tabbable, accept: accept = defaultOptions.accept } = opts;
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
tabbable: tabbable,
accept: accept
});
let nextNode = walker.nextNode();
if (nextNode) $9bf71ea28793e738$var$focusElement(nextNode, true);
return nextNode;
},
focusLast (opts = defaultOptions) {
let root = ref.current;
if (!root) return null;
let { tabbable: tabbable = defaultOptions.tabbable, accept: accept = defaultOptions.accept } = opts;
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
tabbable: tabbable,
accept: accept
});
let next = $9bf71ea28793e738$var$last(walker);
if (next) $9bf71ea28793e738$var$focusElement(next, true);
return next !== null && next !== void 0 ? next : null;
}
};
}
function $9bf71ea28793e738$var$last(walker) {
let next = undefined;
let last;
do {
last = walker.lastChild();
if (last) next = last;
}while (last);
return next;
}
class $9bf71ea28793e738$var$Tree {
get size() {
return this.fastMap.size;
}
getTreeNode(data) {
return this.fastMap.get(data);
}
addTreeNode(scopeRef, parent, nodeToRestore) {
let parentNode = this.fastMap.get(parent !== null && parent !== void 0 ? parent : null);
if (!parentNode) return;
let node = new $9bf71ea28793e738$var$TreeNode({
scopeRef: scopeRef
});
parentNode.addChild(node);
node.parent = parentNode;
this.fastMap.set(scopeRef, node);
if (nodeToRestore) node.nodeToRestore = nodeToRestore;
}
addNode(node) {
this.fastMap.set(node.scopeRef, node);
}
removeTreeNode(scopeRef) {
// never remove the root
if (scopeRef === null) return;
let node = this.fastMap.get(scopeRef);
if (!node) return;
let parentNode = node.parent;
// when we remove a scope, check if any sibling scopes are trying to restore focus to something inside the scope we're removing
// if we are, then replace the siblings restore with the restore from the scope we're removing
for (let current of this.traverse())if (current !== node && node.nodeToRestore && current.nodeToRestore && node.scopeRef && node.scopeRef.current && $9bf71ea28793e738$var$isElementInScope(current.nodeToRestore, node.scopeRef.current)) current.nodeToRestore = node.nodeToRestore;
let children = node.children;
if (parentNode) {
parentNode.removeChild(node);
if (children.size > 0) children.forEach((child)=>parentNode && parentNode.addChild(child));
}
this.fastMap.delete(node.scopeRef);
}
// Pre Order Depth First
*traverse(node = this.root) {
if (node.scopeRef != null) yield node;
if (node.children.size > 0) for (let child of node.children)yield* this.traverse(child);
}
clone() {
var _node_parent;
let newTree = new $9bf71ea28793e738$var$Tree();
var _node_parent_scopeRef;
for (let node of this.traverse())newTree.addTreeNode(node.scopeRef, (_node_parent_scopeRef = (_node_parent = node.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.scopeRef) !== null && _node_parent_scopeRef !== void 0 ? _node_parent_scopeRef : null, node.nodeToRestore);
return newTree;
}
constructor(){
this.fastMap = new Map();
this.root = new $9bf71ea28793e738$var$TreeNode({
scopeRef: null
});
this.fastMap.set(null, this.root);
}
}
class $9bf71ea28793e738$var$TreeNode {
addChild(node) {
this.children.add(node);
node.parent = this;
}
removeChild(node) {
this.children.delete(node);
node.parent = undefined;
}
constructor(props){
this.children = new Set();
this.contain = false;
this.scopeRef = props.scopeRef;
}
}
let $9bf71ea28793e738$export$d06fae2ee68b101e = new $9bf71ea28793e738$var$Tree();
export {$9bf71ea28793e738$export$20e40289641fbbb6 as FocusScope, $9bf71ea28793e738$export$d06fae2ee68b101e as focusScopeTree, $9bf71ea28793e738$export$10c5169755ce7bd7 as useFocusManager, $9bf71ea28793e738$export$2d6ec8fc375ceafa as getFocusableTreeWalker, $9bf71ea28793e738$export$4c063cf1350e6fed as isFocusable, $9bf71ea28793e738$export$1258395f99bf9cbf as isElementInChildOfActiveScope, $9bf71ea28793e738$export$c5251b9e124bf29 as createFocusManager};
//# sourceMappingURL=FocusScope.module.js.map
@@ -0,0 +1,78 @@
/**
* @fileoverview Serialization utils.
* @author Bryan Mishkin
*/
"use strict";
/**
* Check if a value is a primitive or plain object created by the Object constructor.
* @param {any} val the value to check
* @returns {boolean} true if so
* @private
*/
function isSerializablePrimitiveOrPlainObject(val) {
return (
val === null ||
typeof val === "string" ||
typeof val === "boolean" ||
typeof val === "number" ||
(typeof val === "object" && val.constructor === Object) ||
Array.isArray(val)
);
}
/**
* Check if a value is serializable.
* Functions or objects like RegExp cannot be serialized by JSON.stringify().
* Inspired by: https://stackoverflow.com/questions/30579940/reliable-way-to-check-if-objects-is-serializable-in-javascript
* @param {any} val The value
* @param {Set<Object>} seenObjects Objects already seen in this path from the root object.
* @returns {boolean} `true` if the value is serializable
*/
function isSerializable(val, seenObjects = new Set()) {
if (!isSerializablePrimitiveOrPlainObject(val)) {
return false;
}
if (typeof val === "object" && val !== null) {
if (seenObjects.has(val)) {
/*
* Since this is a depth-first traversal, encountering
* the same object again means there is a circular reference.
* Objects with circular references are not serializable.
*/
return false;
}
for (const property in val) {
if (Object.hasOwn(val, property)) {
if (!isSerializablePrimitiveOrPlainObject(val[property])) {
return false;
}
if (
typeof val[property] === "object" &&
val[property] !== null
) {
if (
/*
* We're creating a new Set of seen objects because we want to
* ensure that `val` doesn't appear again in this path, but it can appear
* in other paths. This allows for reusing objects in the graph, as long as
* there are no cycles.
*/
!isSerializable(
val[property],
new Set([...seenObjects, val]),
)
) {
return false;
}
}
}
}
}
return true;
}
module.exports = {
isSerializable,
};
@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _objectSpread;
var _defineProperty = require("./defineProperty.js");
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? Object(arguments[i]) : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function (key) {
(0, _defineProperty.default)(target, key, source[key]);
});
}
return target;
}
//# sourceMappingURL=objectSpread.js.map
@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('words', require('../words'));
func.placeholder = require('./placeholder');
module.exports = func;
@@ -0,0 +1,62 @@
var assert = require('assert'),
nodeuuid = require('../'),
uuidjs = require('uuid-js'),
util = require('util'),
exec = require('child_process').exec,
os = require('os');
// On Mac Os X / macports there's only the ossp-uuid package that provides uuid
// On Linux there's uuid-runtime which provides uuidgen
var uuidCmd = os.type() === 'Darwin' ? 'uuid -1' : 'uuidgen -t';
function compare(ids) {
console.log(ids);
for (var i = 0; i < ids.length; i++) {
var id = ids[i].split('-');
id = [id[2], id[1], id[0]].join('');
ids[i] = id;
}
var sorted = ([].concat(ids)).sort();
if (sorted.toString() !== ids.toString()) {
console.log('Warning: sorted !== ids');
} else {
console.log('everything in order!');
}
}
// Test time order of v1 uuids
var ids = [];
while (ids.length < 10e3) ids.push(nodeuuid.v1());
var max = 10;
console.log('node-uuid:');
ids = [];
for (var i = 0; i < max; i++) ids.push(nodeuuid.v1());
compare(ids);
console.log('');
console.log('uuidjs:');
ids = [];
for (var i = 0; i < max; i++) ids.push(uuidjs.create(1).toString());
compare(ids);
console.log('');
console.log('libuuid:');
ids = [];
var count = 0;
var last = function() {
compare(ids);
}
var cb = function(err, stdout, stderr) {
ids.push(stdout.substring(0, stdout.length-1));
count++;
if (count < max) {
return next();
}
last();
};
var next = function() {
exec(uuidCmd, cb);
};
next();
@@ -0,0 +1,191 @@
Copyright 2024 Misha Kaletsky
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
@@ -0,0 +1,152 @@
"use client";
// src/use-card.ts
import { card } from "@heroui/theme";
import { useCallback, useMemo } from "react";
import { chain, mergeProps } from "@react-aria/utils";
import { useFocusRing } from "@react-aria/focus";
import { useHover } from "@react-aria/interactions";
import { useAriaButton } from "@heroui/use-aria-button";
import { mapPropsVariants, useProviderContext } from "@heroui/system";
import { clsx, dataAttr, objectToDeps } from "@heroui/shared-utils";
import { filterDOMProps } from "@heroui/react-utils";
import { useDOMRef } from "@heroui/react-utils";
import { useRipple } from "@heroui/ripple";
function useCard(originalProps) {
var _a, _b, _c, _d;
const globalContext = useProviderContext();
const [props, variantProps] = mapPropsVariants(originalProps, card.variantKeys);
const {
ref,
as,
children,
onClick,
onPress,
autoFocus,
className,
classNames,
allowTextSelectionOnPress = true,
...otherProps
} = props;
const domRef = useDOMRef(ref);
const Component = as || (originalProps.isPressable ? "button" : "div");
const shouldFilterDOMProps = typeof Component === "string";
const disableAnimation = (_b = (_a = originalProps.disableAnimation) != null ? _a : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b : false;
const disableRipple = (_d = (_c = originalProps.disableRipple) != null ? _c : globalContext == null ? void 0 : globalContext.disableRipple) != null ? _d : false;
const baseStyles = clsx(classNames == null ? void 0 : classNames.base, className);
const { onClear: onClearRipple, onPress: onRipplePressHandler, ripples } = useRipple();
const handlePress = useCallback(
(e) => {
if (disableRipple || disableAnimation)
return;
domRef.current && onRipplePressHandler(e);
},
[disableRipple, disableAnimation, domRef, onRipplePressHandler]
);
const { buttonProps, isPressed } = useAriaButton(
{
onPress: chain(onPress, handlePress),
elementType: as,
isDisabled: !originalProps.isPressable,
onClick,
allowTextSelectionOnPress,
...otherProps
},
domRef
);
const { hoverProps, isHovered } = useHover({
isDisabled: !originalProps.isHoverable,
...otherProps
});
const { isFocusVisible, isFocused, focusProps } = useFocusRing({
autoFocus
});
const slots = useMemo(
() => card({
...variantProps,
disableAnimation
}),
[objectToDeps(variantProps), disableAnimation]
);
const context = useMemo(
() => ({
slots,
classNames,
disableAnimation,
isDisabled: originalProps.isDisabled,
isFooterBlurred: originalProps.isFooterBlurred,
fullWidth: originalProps.fullWidth
}),
[
slots,
classNames,
originalProps.isDisabled,
originalProps.isFooterBlurred,
disableAnimation,
originalProps.fullWidth
]
);
const getCardProps = useCallback(
(props2 = {}) => {
return {
ref: domRef,
className: slots.base({ class: baseStyles }),
tabIndex: originalProps.isPressable ? 0 : -1,
"data-hover": dataAttr(isHovered),
"data-pressed": dataAttr(isPressed),
"data-focus": dataAttr(isFocused),
"data-focus-visible": dataAttr(isFocusVisible),
"data-disabled": dataAttr(originalProps.isDisabled),
...mergeProps(
originalProps.isPressable ? { ...buttonProps, ...focusProps, role: "button" } : {},
originalProps.isHoverable ? hoverProps : {},
filterDOMProps(otherProps, {
enabled: shouldFilterDOMProps
}),
filterDOMProps(props2)
)
};
},
[
domRef,
slots,
baseStyles,
shouldFilterDOMProps,
originalProps.isPressable,
originalProps.isHoverable,
originalProps.isDisabled,
isHovered,
isPressed,
isFocusVisible,
buttonProps,
focusProps,
hoverProps,
otherProps
]
);
const getRippleProps = useCallback(
() => ({ ripples, onClear: onClearRipple }),
[ripples, onClearRipple]
);
return {
context,
domRef,
Component,
classNames,
children,
isHovered,
isPressed,
disableAnimation,
isPressable: originalProps.isPressable,
isHoverable: originalProps.isHoverable,
disableRipple,
handlePress,
isFocusVisible,
getCardProps,
getRippleProps
};
}
export {
useCard
};
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"wC","8":"K D E","260":"F A B"},B:{"1":"0 1 2 3 4 5 C L M G N O P Q H 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 GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I"},C:{"1":"0 1 2 3 4 5 7 8 9 AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC 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 GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC yC zC","2":"xC","132":"TC 0C 1C","260":"6 J ZB K D E F A B C L M G N O P aB"},D:{"1":"0 1 2 3 4 5 CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H 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 GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC","132":"J ZB","260":"6 7 8 9 K D E F A B C L M G N O P aB AB BB"},E:{"1":"D E F A B C L M G 4C 5C 6C aC NC OC 7C 8C 9C bC cC PC AD QC dC eC fC gC hC BD RC iC jC kC lC mC CD SC nC oC pC qC rC sC tC DD ED","132":"J 2C ZC","260":"ZB K 3C"},F:{"1":"0 1 2 3 4 5 6 7 8 9 G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC 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","132":"F B FD GD HD ID","260":"C NC uC JD OC"},G:{"1":"E ND OD PD QD RD SD TD UD VD WD XD YD ZD aD bD cD dD bC cC PC eD QC dC eC fC gC hC fD RC iC jC kC lC mC gD SC nC oC pC qC rC sC tC","132":"ZC","260":"KD vC LD MD"},H:{"132":"hD"},I:{"1":"I mD nD","132":"iD","260":"TC J jD kD lD vC"},J:{"260":"D A"},K:{"1":"H","132":"A","260":"B C NC uC OC"},L:{"1":"I"},M:{"1":"MC"},N:{"260":"A B"},O:{"1":"PC"},P:{"1":"6 7 8 9 J AB BB CB DB EB FB oD pD qD rD sD aC tD uD vD wD xD QC RC SC yD"},Q:{"1":"zD"},R:{"1":"0D"},S:{"1":"1D 2D"}},B:1,C:"HTML5 semantic elements",D:true};
@@ -0,0 +1,4 @@
declare const getScrollTop: (el: Document | Element) => number;
declare const getScrollHeight: (el: Document | Element) => number;
declare const getClientHeight: (el: Document | Element) => number;
export { getScrollTop, getScrollHeight, getClientHeight };
@@ -0,0 +1,41 @@
import type { TSchema, SchemaOptions } from '../schema/index.mjs';
import { Kind } from '../symbols/index.mjs';
import { TUnsafe } from '../unsafe/index.mjs';
import { Static } from '../static/index.mjs';
export interface TRef<Ref extends string = string> extends TSchema {
[Kind]: 'Ref';
static: unknown;
$ref: Ref;
}
export type TRefUnsafe<Type extends TSchema> = TUnsafe<Static<Type>>;
/** `[Json]` Creates a Ref type.*/
export declare function Ref<Ref extends string>($ref: Ref, options?: SchemaOptions): TRef<Ref>;
/**
* @deprecated `[Json]` Creates a Ref type. This signature was deprecated in 0.34.0 where Ref requires callers to pass
* a `string` value for the reference (and not a schema).
*
* To adhere to the 0.34.0 signature, Ref implementations should be updated to the following.
*
* ```typescript
* // pre-0.34.0
*
* const T = Type.String({ $id: 'T' })
*
* const R = Type.Ref(T)
* ```
* should be changed to the following
*
* ```typescript
* // post-0.34.0
*
* const T = Type.String({ $id: 'T' })
*
* const R = Type.Unsafe<Static<typeof T>>(Type.Ref('T'))
* ```
* You can also create a generic function to replicate the pre-0.34.0 signature if required
*
* ```typescript
* const LegacyRef = <T extends TSchema>(schema: T) => Type.Unsafe<Static<T>>(Type.Ref(schema.$id!))
* ```
*/
export declare function Ref<Type extends TSchema>(type: Type, options?: SchemaOptions): TRefUnsafe<Type>;
@@ -0,0 +1,26 @@
import { MappedResult } from '../mapped/index.mjs';
import { Intrinsic } from './intrinsic.mjs';
import { Literal } from '../literal/index.mjs';
import { Clone } from '../clone/value.mjs';
// prettier-ignore
function MappedIntrinsicPropertyKey(K, M, options) {
return {
[K]: Intrinsic(Literal(K), M, Clone(options))
};
}
// prettier-ignore
function MappedIntrinsicPropertyKeys(K, M, options) {
const result = K.reduce((Acc, L) => {
return { ...Acc, ...MappedIntrinsicPropertyKey(L, M, options) };
}, {});
return result;
}
// prettier-ignore
function MappedIntrinsicProperties(T, M, options) {
return MappedIntrinsicPropertyKeys(T['keys'], M, options);
}
// prettier-ignore
export function IntrinsicFromMappedKey(T, M, options) {
const P = MappedIntrinsicProperties(T, M, options);
return MappedResult(P);
}
@@ -0,0 +1,10 @@
import {
datePicker,
dateRangePicker
} from "../chunk-QFGVVQRM.mjs";
import "../chunk-UWE6H66T.mjs";
import "../chunk-GIXI35A3.mjs";
export {
datePicker,
dateRangePicker
};
@@ -0,0 +1,35 @@
# is-plain-obj [![Build Status](https://travis-ci.org/sindresorhus/is-plain-obj.svg?branch=master)](https://travis-ci.org/sindresorhus/is-plain-obj)
> Check if a value is a plain object
An object is plain if it's created by either `{}`, `new Object()` or `Object.create(null)`.
## Install
```
$ npm install --save is-plain-obj
```
## Usage
```js
var isPlainObj = require('is-plain-obj');
isPlainObj({foo: 'bar'});
//=> true
isPlainObj([1, 2, 3]);
//=> false
```
## Related
- [is-obj](https://github.com/sindresorhus/is-obj) - Check if a value is an object
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _ariaQuery = require("aria-query");
/**
* Returns boolean indicating whether the given element is a DOM element.
*/
var isDOMElement = function isDOMElement(tagName) {
return _ariaQuery.dom.has(tagName);
};
var _default = exports["default"] = isDOMElement;
module.exports = exports.default;
@@ -0,0 +1,19 @@
import { MappedResult } from '../mapped/index.mjs';
import { Pick } from './pick.mjs';
import { Clone } from '../clone/value.mjs';
// prettier-ignore
function FromProperties(properties, propertyKeys, options) {
const result = {};
for (const K2 of globalThis.Object.getOwnPropertyNames(properties))
result[K2] = Pick(properties[K2], propertyKeys, Clone(options));
return result;
}
// prettier-ignore
function FromMappedResult(mappedResult, propertyKeys, options) {
return FromProperties(mappedResult.properties, propertyKeys, options);
}
// prettier-ignore
export function PickFromMappedResult(mappedResult, propertyKeys, options) {
const properties = FromMappedResult(mappedResult, propertyKeys, options);
return MappedResult(properties);
}
@@ -0,0 +1,96 @@
'use strict';
var utils = require('../utils.js');
require('eslint-visitor-keys');
require('espree');
require('estraverse');
var noMultiSpaces = utils.createRule({
name: "no-multi-spaces",
package: "js",
meta: {
type: "layout",
docs: {
description: "Disallow multiple spaces"
},
fixable: "whitespace",
schema: [
{
type: "object",
properties: {
exceptions: {
type: "object",
patternProperties: {
"^([A-Z][a-z]*)+$": {
type: "boolean"
}
},
additionalProperties: false
},
ignoreEOLComments: {
type: "boolean",
default: false
},
includeTabs: {
type: "boolean",
default: true
}
},
additionalProperties: false
}
],
messages: {
multipleSpaces: "Multiple spaces found before '{{displayValue}}'."
}
},
create(context) {
const sourceCode = context.sourceCode;
const options = context.options[0] || {};
const ignoreEOLComments = options.ignoreEOLComments;
const exceptions = Object.assign({ Property: true, ImportAttribute: true }, options.exceptions);
const hasExceptions = Object.keys(exceptions).some((key) => exceptions[key]);
const spacesRe = options.includeTabs === false ? / {2}/ : /[ \t]{2}/;
function formatReportedCommentValue(token) {
const valueLines = token.value.split("\n");
const value = valueLines[0];
const formattedValue = `${value.slice(0, 12)}...`;
return valueLines.length === 1 && value.length <= 12 ? value : formattedValue;
}
return {
Program() {
sourceCode.tokensAndComments.forEach((leftToken, leftIndex, tokensAndComments) => {
if (leftIndex === tokensAndComments.length - 1)
return;
const rightToken = tokensAndComments[leftIndex + 1];
if (!spacesRe.test(sourceCode.text.slice(leftToken.range[1], rightToken.range[0])) || leftToken.loc.end.line < rightToken.loc.start.line) {
return;
}
if (ignoreEOLComments && utils.isCommentToken(rightToken) && (leftIndex === tokensAndComments.length - 2 || rightToken.loc.end.line < tokensAndComments[leftIndex + 2].loc.start.line)) {
return;
}
if (hasExceptions) {
const parentNode = sourceCode.getNodeByRangeIndex(rightToken.range[0] - 1);
if (parentNode && exceptions[parentNode.type])
return;
}
let displayValue;
if (rightToken.type === "Block")
displayValue = `/*${formatReportedCommentValue(rightToken)}*/`;
else if (rightToken.type === "Line")
displayValue = `//${formatReportedCommentValue(rightToken)}`;
else
displayValue = rightToken.value;
context.report({
node: rightToken,
loc: { start: leftToken.loc.end, end: rightToken.loc.start },
messageId: "multipleSpaces",
data: { displayValue },
fix: (fixer) => fixer.replaceTextRange([leftToken.range[1], rightToken.range[0]], " ")
});
});
}
};
}
});
module.exports = noMultiSpaces;
@@ -0,0 +1,2 @@
import type { LibDefinition } from '../variable';
export declare const dom_iterable: LibDefinition;
@@ -0,0 +1,87 @@
{
"name": "array.prototype.tosorted",
"version": "1.1.4",
"description": "An ESnext spec-compliant `Array.prototype.toSorted` shim/polyfill/replacement that works as far down as ES3.",
"main": "index.js",
"exports": {
".": "./index.js",
"./auto": "./auto.js",
"./polyfill": "./polyfill.js",
"./implementation": "./implementation.js",
"./shim": "./shim.js",
"./package.json": "./package.json"
},
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepublish": "not-in-publish || npm run prepublishOnly",
"prepublishOnly": "safe-publish-latest",
"lint": "eslint --ext=js,mjs .",
"postlint": "es-shim-api --bound && evalmd README.md",
"pretest": "npm run --silent lint",
"test": "npm run tests-only",
"posttest": "aud --production",
"tests-only": "nyc tape 'test/**/*.js'",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"repository": {
"type": "git",
"url": "git+https://github.com/es-shims/Array.prototype.toSorted.git"
},
"keywords": [
"javascript",
"ecmascript",
"shim",
"polyfill",
"es-shim API",
"array",
"sort",
"sorted",
"toSorted"
],
"author": "Jordan Harband <ljharb@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/es-shims/Array.prototype.toSorted/issues"
},
"homepage": "https://github.com/es-shims/Array.prototype.toSorted#readme",
"dependencies": {
"call-bind": "^1.0.7",
"define-properties": "^1.2.1",
"es-abstract": "^1.23.3",
"es-errors": "^1.3.0",
"es-shim-unscopables": "^1.0.2"
},
"devDependencies": {
"@es-shims/api": "^2.5.0",
"@ljharb/eslint-config": "^21.1.1",
"aud": "^2.0.4",
"auto-changelog": "^2.4.0",
"eslint": "=8.8.0",
"evalmd": "^0.0.19",
"functions-have-names": "^1.2.3",
"has-strict-mode": "^1.0.1",
"hasown": "^2.0.2",
"in-publish": "^2.0.1",
"npmignore": "^0.3.1",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.7.5"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"publishConfig": {
"ignore": [
".github/workflows"
]
},
"engines": {
"node": ">= 0.4"
}
}
@@ -0,0 +1 @@
{"name":"string-width","version":"4.2.3","requiresBuild":false,"files":{"license":{"checkedAt":1794532105650,"integrity":"sha512-nIst73auX/5NY2Fmv5Y116vWnNrEv4GaIUX3lpZG05rpXJY2S8EX+fpUS5hRjClCM0VdT2Za9DDHXXB5jdSrEw==","mode":420,"size":1109},"index.js":{"checkedAt":1794532105650,"integrity":"sha512-8K0p/JnLN557yymVwYpV2pramFJFbo2nUuzGeeDK89D5idVYul8EG7ArwC+4iowviufxpSSioEG1TsVjfHHBIQ==","mode":420,"size":923},"package.json":{"checkedAt":1794532105651,"integrity":"sha512-PkPX1lbuECmr1dxtqCfbgZB9mdYAMREddH65tzVBReAmLBE6Bh/jQ9QCCjy6Qfr8Yg19nyfNLYA1oq8yt+6rng==","mode":420,"size":941},"readme.md":{"checkedAt":1794532105651,"integrity":"sha512-bQhgcN8/iOJdRcgspTTFsjeElzfqZ1KCzULTF8ppshMa+p7QF3FZNQ16xvqcm9vZU6TbEz7gLySFIRgtjBfusg==","mode":420,"size":1396},"index.d.ts":{"checkedAt":1794532105651,"integrity":"sha512-qvL60DCqLB3SS59BasyEV7fR8EqUL/i8Jv1Inc7yCCIMpfvoaDxHJSBfOw7CUbTqkSV5kfmQ/LQG3RUDHA7FYA==","mode":420,"size":792}}}
@@ -0,0 +1,60 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/bulk/add-note.tsx
var add_note_exports = {};
__export(add_note_exports, {
AddNoteBulkIcon: () => AddNoteBulkIcon
});
module.exports = __toCommonJS(add_note_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var AddNoteBulkIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
"svg",
{
"aria-hidden": "true",
fill: "none",
focusable: "false",
height: "1em",
role: "presentation",
viewBox: "0 0 24 24",
width: "1em",
...props,
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"path",
{
d: "M7.37 22h9.25a4.87 4.87 0 0 0 4.87-4.87V8.37a4.87 4.87 0 0 0-4.87-4.87H7.37A4.87 4.87 0 0 0 2.5 8.37v8.75c0 2.7 2.18 4.88 4.87 4.88Z",
fill: "currentColor",
opacity: 0.4
}
),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"path",
{
d: "M8.29 6.29c-.42 0-.75-.34-.75-.75V2.75a.749.749 0 1 1 1.5 0v2.78c0 .42-.33.76-.75.76ZM15.71 6.29c-.42 0-.75-.34-.75-.75V2.75a.749.749 0 1 1 1.5 0v2.78c0 .42-.33.76-.75.76ZM12 14.75h-1.69V13c0-.41-.34-.75-.75-.75s-.75.34-.75.75v1.75H7c-.41 0-.75.34-.75.75s.34.75.75.75h1.81V18c0 .41.34.75.75.75s.75-.34.75-.75v-1.75H12c.41 0 .75-.34.75-.75s-.34-.75-.75-.75Z",
fill: "currentColor"
}
)
]
}
);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
AddNoteBulkIcon
});
@@ -0,0 +1,35 @@
### Changelog
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
#### [v1.1.0](https://github.com/ljharb/es-shim-unscopables/compare/v1.0.2...v1.1.0)
> 11 February 2025
- [New] add types [`2b94d6d`](https://github.com/ljharb/es-shim-unscopables/commit/2b94d6da58c272944de33f7e5b601a56dbb025fe)
- [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `es-value-fixtures`, `for-each`, `npmignore`, `object-inspect`, `tape` [`bc42bcf`](https://github.com/ljharb/es-shim-unscopables/commit/bc42bcf1901ad9c3e6427c8f39d1ac22e7e98310)
- [meta] add missing `engines.node` [`9ffcc49`](https://github.com/ljharb/es-shim-unscopables/commit/9ffcc491132ae0f7681694630910e1c4eb2cd548)
#### [v1.0.2](https://github.com/ljharb/es-shim-unscopables/compare/v1.0.1...v1.0.2)
> 20 October 2023
- [Deps] remove unused `has` [`f9fc3ba`](https://github.com/ljharb/es-shim-unscopables/commit/f9fc3bad9a291450ef1d1470347d0faffc937e14)
#### [v1.0.1](https://github.com/ljharb/es-shim-unscopables/compare/v1.0.0...v1.0.1)
> 20 October 2023
- [meta] use `npmignore` to autogenerate an npmignore file [`4f29eb9`](https://github.com/ljharb/es-shim-unscopables/commit/4f29eb9cfa28cbc08519446027accf8f7e3c472e)
- [Refactor] use `hasown` instead of `has` [`9d2577b`](https://github.com/ljharb/es-shim-unscopables/commit/9d2577b8bf6354d68111a8c20f020303370ef85f)
- [actions] update checkout action [`4525257`](https://github.com/ljharb/es-shim-unscopables/commit/45252572bf21dc5aab948c99ae0397e90f357718)
#### v1.0.0
> 11 April 2022
- Initial implementation, tests [`0313267`](https://github.com/ljharb/es-shim-unscopables/commit/03132672560a06df8a36685c1688793d445ea034)
- Initial commit [`5a68e27`](https://github.com/ljharb/es-shim-unscopables/commit/5a68e27e8f11d8b453c00e9239b35ec8795c850e)
- [meta] do not publish workflow files [`4e29785`](https://github.com/ljharb/es-shim-unscopables/commit/4e2978541c25ce590589d5f23f311af6ca3618a7)
@@ -0,0 +1,21 @@
/**
* @import {Options, State} from 'mdast-util-to-markdown'
*/
/**
* @param {State} state
* @returns {Exclude<Options['bullet'], null | undefined>}
*/
export function checkBullet(state) {
const marker = state.options.bullet || '*'
if (marker !== '*' && marker !== '+' && marker !== '-') {
throw new Error(
'Cannot serialize items with `' +
marker +
'` for `options.bullet`, expected `*`, `+`, or `-`'
)
}
return marker
}
@@ -0,0 +1,32 @@
import mapCacheClear from './_mapCacheClear.js';
import mapCacheDelete from './_mapCacheDelete.js';
import mapCacheGet from './_mapCacheGet.js';
import mapCacheHas from './_mapCacheHas.js';
import mapCacheSet from './_mapCacheSet.js';
/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
export default MapCache;
@@ -0,0 +1,12 @@
import type { SchemaOptions } from '../schema/index.mjs';
import type { Ensure, Evaluate } from '../helpers/index.mjs';
import type { TProperties } from '../object/index.mjs';
import { type TMappedResult } from '../mapped/index.mjs';
import { type TOmit } from './omit.mjs';
type TFromProperties<Properties extends TProperties, PropertyKeys extends PropertyKey[]> = ({
[K2 in keyof Properties]: TOmit<Properties[K2], PropertyKeys>;
});
type TFromMappedResult<MappedResult extends TMappedResult, PropertyKeys extends PropertyKey[]> = (Evaluate<TFromProperties<MappedResult['properties'], PropertyKeys>>);
export type TOmitFromMappedResult<MappedResult extends TMappedResult, PropertyKeys extends PropertyKey[], Properties extends TProperties = TFromMappedResult<MappedResult, PropertyKeys>> = (Ensure<TMappedResult<Properties>>);
export declare function OmitFromMappedResult<MappedResult extends TMappedResult, PropertyKeys extends PropertyKey[], Properties extends TProperties = TFromMappedResult<MappedResult, PropertyKeys>>(mappedResult: MappedResult, propertyKeys: [...PropertyKeys], options?: SchemaOptions): TMappedResult<Properties>;
export {};
@@ -0,0 +1 @@
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["list.js"],"names":[],"mappings":"AAUA;;;;;;GAMG;AACH,2BANW,IAAI,UACJ,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CAoFlB;0BAjG+B,OAAO;6BAAP,OAAO;2BADT,wBAAwB;0BAAxB,wBAAwB"}
@@ -0,0 +1,152 @@
'use strict';
const { isUtf8 } = require('buffer');
const { hasBlob } = require('./constants');
//
// Allowed token characters:
//
// '!', '#', '$', '%', '&', ''', '*', '+', '-',
// '.', 0-9, A-Z, '^', '_', '`', a-z, '|', '~'
//
// tokenChars[32] === 0 // ' '
// tokenChars[33] === 1 // '!'
// tokenChars[34] === 0 // '"'
// ...
//
// prettier-ignore
const tokenChars = [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 15
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16 - 31
0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, // 32 - 47
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 48 - 63
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 64 - 79
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, // 80 - 95
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 96 - 111
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0 // 112 - 127
];
/**
* Checks if a status code is allowed in a close frame.
*
* @param {Number} code The status code
* @return {Boolean} `true` if the status code is valid, else `false`
* @public
*/
function isValidStatusCode(code) {
return (
(code >= 1000 &&
code <= 1014 &&
code !== 1004 &&
code !== 1005 &&
code !== 1006) ||
(code >= 3000 && code <= 4999)
);
}
/**
* Checks if a given buffer contains only correct UTF-8.
* Ported from https://www.cl.cam.ac.uk/%7Emgk25/ucs/utf8_check.c by
* Markus Kuhn.
*
* @param {Buffer} buf The buffer to check
* @return {Boolean} `true` if `buf` contains only correct UTF-8, else `false`
* @public
*/
function _isValidUTF8(buf) {
const len = buf.length;
let i = 0;
while (i < len) {
if ((buf[i] & 0x80) === 0) {
// 0xxxxxxx
i++;
} else if ((buf[i] & 0xe0) === 0xc0) {
// 110xxxxx 10xxxxxx
if (
i + 1 === len ||
(buf[i + 1] & 0xc0) !== 0x80 ||
(buf[i] & 0xfe) === 0xc0 // Overlong
) {
return false;
}
i += 2;
} else if ((buf[i] & 0xf0) === 0xe0) {
// 1110xxxx 10xxxxxx 10xxxxxx
if (
i + 2 >= len ||
(buf[i + 1] & 0xc0) !== 0x80 ||
(buf[i + 2] & 0xc0) !== 0x80 ||
(buf[i] === 0xe0 && (buf[i + 1] & 0xe0) === 0x80) || // Overlong
(buf[i] === 0xed && (buf[i + 1] & 0xe0) === 0xa0) // Surrogate (U+D800 - U+DFFF)
) {
return false;
}
i += 3;
} else if ((buf[i] & 0xf8) === 0xf0) {
// 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
if (
i + 3 >= len ||
(buf[i + 1] & 0xc0) !== 0x80 ||
(buf[i + 2] & 0xc0) !== 0x80 ||
(buf[i + 3] & 0xc0) !== 0x80 ||
(buf[i] === 0xf0 && (buf[i + 1] & 0xf0) === 0x80) || // Overlong
(buf[i] === 0xf4 && buf[i + 1] > 0x8f) ||
buf[i] > 0xf4 // > U+10FFFF
) {
return false;
}
i += 4;
} else {
return false;
}
}
return true;
}
/**
* Determines whether a value is a `Blob`.
*
* @param {*} value The value to be tested
* @return {Boolean} `true` if `value` is a `Blob`, else `false`
* @private
*/
function isBlob(value) {
return (
hasBlob &&
typeof value === 'object' &&
typeof value.arrayBuffer === 'function' &&
typeof value.type === 'string' &&
typeof value.stream === 'function' &&
(value[Symbol.toStringTag] === 'Blob' ||
value[Symbol.toStringTag] === 'File')
);
}
module.exports = {
isBlob,
isValidStatusCode,
isValidUTF8: _isValidUTF8,
tokenChars
};
if (isUtf8) {
module.exports.isValidUTF8 = function (buf) {
return buf.length < 24 ? _isValidUTF8(buf) : isUtf8(buf);
};
} /* istanbul ignore else */ else if (!process.env.WS_NO_UTF_8_VALIDATE) {
try {
const isValidUTF8 = require('utf-8-validate');
module.exports.isValidUTF8 = function (buf) {
return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf);
};
} catch (e) {
// Continue regardless of the error.
}
}
@@ -0,0 +1,21 @@
/**
* @import {Options, State} from 'mdast-util-to-markdown'
*/
/**
* @param {State} state
* @returns {Exclude<Options['rule'], null | undefined>}
*/
export function checkRule(state) {
const marker = state.options.rule || '*'
if (marker !== '*' && marker !== '-' && marker !== '_') {
throw new Error(
'Cannot serialize rules with `' +
marker +
'` for `options.rule`, expected `*`, `-`, or `_`'
)
}
return marker
}
@@ -0,0 +1 @@
{"version":3,"file":"provider.int.spec.d.ts","sourceRoot":"","sources":["../../../../src/test/features/provider.int.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
{"version":3,"names":["_index","require","_index2","cleanJSXElementLiteralChild","child","args","lines","value","split","lastNonEmptyLine","i","length","exec","str","line","isFirstLine","isLastLine","isLastNonEmptyLine","trimmedLine","replace","push","inherits","stringLiteral"],"sources":["../../../src/utils/react/cleanJSXElementLiteralChild.ts"],"sourcesContent":["import { stringLiteral } from \"../../builders/generated/index.ts\";\nimport type * as t from \"../../index.ts\";\nimport { inherits } from \"../../index.ts\";\n\nexport default function cleanJSXElementLiteralChild(\n child: t.JSXText,\n args: Array<t.Node>,\n) {\n const lines = child.value.split(/\\r\\n|\\n|\\r/);\n\n let lastNonEmptyLine = 0;\n\n for (let i = 0; i < lines.length; i++) {\n if (/[^ \\t]/.exec(lines[i])) {\n lastNonEmptyLine = i;\n }\n }\n\n let str = \"\";\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n\n const isFirstLine = i === 0;\n const isLastLine = i === lines.length - 1;\n const isLastNonEmptyLine = i === lastNonEmptyLine;\n\n // replace rendered whitespace tabs with spaces\n let trimmedLine = line.replace(/\\t/g, \" \");\n\n // trim whitespace touching a newline\n if (!isFirstLine) {\n trimmedLine = trimmedLine.replace(/^ +/, \"\");\n }\n\n // trim whitespace touching an endline\n if (!isLastLine) {\n trimmedLine = trimmedLine.replace(/ +$/, \"\");\n }\n\n if (trimmedLine) {\n if (!isLastNonEmptyLine) {\n trimmedLine += \" \";\n }\n\n str += trimmedLine;\n }\n }\n\n if (str) args.push(inherits(stringLiteral(str), child));\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAEe,SAASE,2BAA2BA,CACjDC,KAAgB,EAChBC,IAAmB,EACnB;EACA,MAAMC,KAAK,GAAGF,KAAK,CAACG,KAAK,CAACC,KAAK,CAAC,YAAY,CAAC;EAE7C,IAAIC,gBAAgB,GAAG,CAAC;EAExB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGJ,KAAK,CAACK,MAAM,EAAED,CAAC,EAAE,EAAE;IACrC,IAAI,QAAQ,CAACE,IAAI,CAACN,KAAK,CAACI,CAAC,CAAC,CAAC,EAAE;MAC3BD,gBAAgB,GAAGC,CAAC;IACtB;EACF;EAEA,IAAIG,GAAG,GAAG,EAAE;EAEZ,KAAK,IAAIH,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGJ,KAAK,CAACK,MAAM,EAAED,CAAC,EAAE,EAAE;IACrC,MAAMI,IAAI,GAAGR,KAAK,CAACI,CAAC,CAAC;IAErB,MAAMK,WAAW,GAAGL,CAAC,KAAK,CAAC;IAC3B,MAAMM,UAAU,GAAGN,CAAC,KAAKJ,KAAK,CAACK,MAAM,GAAG,CAAC;IACzC,MAAMM,kBAAkB,GAAGP,CAAC,KAAKD,gBAAgB;IAGjD,IAAIS,WAAW,GAAGJ,IAAI,CAACK,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;IAG1C,IAAI,CAACJ,WAAW,EAAE;MAChBG,WAAW,GAAGA,WAAW,CAACC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;IAC9C;IAGA,IAAI,CAACH,UAAU,EAAE;MACfE,WAAW,GAAGA,WAAW,CAACC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;IAC9C;IAEA,IAAID,WAAW,EAAE;MACf,IAAI,CAACD,kBAAkB,EAAE;QACvBC,WAAW,IAAI,GAAG;MACpB;MAEAL,GAAG,IAAIK,WAAW;IACpB;EACF;EAEA,IAAIL,GAAG,EAAER,IAAI,CAACe,IAAI,CAAC,IAAAC,gBAAQ,EAAC,IAAAC,oBAAa,EAACT,GAAG,CAAC,EAAET,KAAK,CAAC,CAAC;AACzD","ignoreList":[]}
@@ -0,0 +1,2 @@
import type { LibDefinition } from '../variable';
export declare const es2021_promise: LibDefinition;
Loaded 100 of 35554 files, more files were not shown because too many files have changed in this diff. Show more