update
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
'use strict';
|
||||
|
||||
// do not edit .js files directly - edit src/index.jst
|
||||
|
||||
|
||||
|
||||
module.exports = function equal(a, b) {
|
||||
if (a === b) return true;
|
||||
|
||||
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
||||
if (a.constructor !== b.constructor) return false;
|
||||
|
||||
var length, i, keys;
|
||||
if (Array.isArray(a)) {
|
||||
length = a.length;
|
||||
if (length != b.length) return false;
|
||||
for (i = length; i-- !== 0;)
|
||||
if (!equal(a[i], b[i])) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
||||
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
||||
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
||||
|
||||
keys = Object.keys(a);
|
||||
length = keys.length;
|
||||
if (length !== Object.keys(b).length) return false;
|
||||
|
||||
for (i = length; i-- !== 0;)
|
||||
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
||||
|
||||
for (i = length; i-- !== 0;) {
|
||||
var key = keys[i];
|
||||
|
||||
if (key === '_owner' && a.$$typeof) {
|
||||
// React-specific: avoid traversing React elements' _owner.
|
||||
// _owner contains circular references
|
||||
// and is not needed when comparing the actual elements (and not their owners)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!equal(a[key], b[key])) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// true if both NaN, false otherwise
|
||||
return a!==a && b!==b;
|
||||
};
|
||||
@@ -0,0 +1,210 @@
|
||||
{
|
||||
"name": "@types/react",
|
||||
"version": "19.1.0",
|
||||
"description": "TypeScript definitions for react",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Asana",
|
||||
"url": "https://asana.com"
|
||||
},
|
||||
{
|
||||
"name": "AssureSign",
|
||||
"url": "http://www.assuresign.com"
|
||||
},
|
||||
{
|
||||
"name": "Microsoft",
|
||||
"url": "https://microsoft.com"
|
||||
},
|
||||
{
|
||||
"name": "John Reilly",
|
||||
"githubUsername": "johnnyreilly",
|
||||
"url": "https://github.com/johnnyreilly"
|
||||
},
|
||||
{
|
||||
"name": "Benoit Benezech",
|
||||
"githubUsername": "bbenezech",
|
||||
"url": "https://github.com/bbenezech"
|
||||
},
|
||||
{
|
||||
"name": "Patricio Zavolinsky",
|
||||
"githubUsername": "pzavolinsky",
|
||||
"url": "https://github.com/pzavolinsky"
|
||||
},
|
||||
{
|
||||
"name": "Eric Anderson",
|
||||
"githubUsername": "ericanderson",
|
||||
"url": "https://github.com/ericanderson"
|
||||
},
|
||||
{
|
||||
"name": "Dovydas Navickas",
|
||||
"githubUsername": "DovydasNavickas",
|
||||
"url": "https://github.com/DovydasNavickas"
|
||||
},
|
||||
{
|
||||
"name": "Josh Rutherford",
|
||||
"githubUsername": "theruther4d",
|
||||
"url": "https://github.com/theruther4d"
|
||||
},
|
||||
{
|
||||
"name": "Guilherme Hübner",
|
||||
"githubUsername": "guilhermehubner",
|
||||
"url": "https://github.com/guilhermehubner"
|
||||
},
|
||||
{
|
||||
"name": "Ferdy Budhidharma",
|
||||
"githubUsername": "ferdaber",
|
||||
"url": "https://github.com/ferdaber"
|
||||
},
|
||||
{
|
||||
"name": "Johann Rakotoharisoa",
|
||||
"githubUsername": "jrakotoharisoa",
|
||||
"url": "https://github.com/jrakotoharisoa"
|
||||
},
|
||||
{
|
||||
"name": "Olivier Pascal",
|
||||
"githubUsername": "pascaloliv",
|
||||
"url": "https://github.com/pascaloliv"
|
||||
},
|
||||
{
|
||||
"name": "Martin Hochel",
|
||||
"githubUsername": "hotell",
|
||||
"url": "https://github.com/hotell"
|
||||
},
|
||||
{
|
||||
"name": "Frank Li",
|
||||
"githubUsername": "franklixuefei",
|
||||
"url": "https://github.com/franklixuefei"
|
||||
},
|
||||
{
|
||||
"name": "Jessica Franco",
|
||||
"githubUsername": "Jessidhia",
|
||||
"url": "https://github.com/Jessidhia"
|
||||
},
|
||||
{
|
||||
"name": "Saransh Kataria",
|
||||
"githubUsername": "saranshkataria",
|
||||
"url": "https://github.com/saranshkataria"
|
||||
},
|
||||
{
|
||||
"name": "Kanitkorn Sujautra",
|
||||
"githubUsername": "lukyth",
|
||||
"url": "https://github.com/lukyth"
|
||||
},
|
||||
{
|
||||
"name": "Sebastian Silbermann",
|
||||
"githubUsername": "eps1lon",
|
||||
"url": "https://github.com/eps1lon"
|
||||
},
|
||||
{
|
||||
"name": "Kyle Scully",
|
||||
"githubUsername": "zieka",
|
||||
"url": "https://github.com/zieka"
|
||||
},
|
||||
{
|
||||
"name": "Cong Zhang",
|
||||
"githubUsername": "dancerphil",
|
||||
"url": "https://github.com/dancerphil"
|
||||
},
|
||||
{
|
||||
"name": "Dimitri Mitropoulos",
|
||||
"githubUsername": "dimitropoulos",
|
||||
"url": "https://github.com/dimitropoulos"
|
||||
},
|
||||
{
|
||||
"name": "JongChan Choi",
|
||||
"githubUsername": "disjukr",
|
||||
"url": "https://github.com/disjukr"
|
||||
},
|
||||
{
|
||||
"name": "Victor Magalhães",
|
||||
"githubUsername": "vhfmag",
|
||||
"url": "https://github.com/vhfmag"
|
||||
},
|
||||
{
|
||||
"name": "Priyanshu Rav",
|
||||
"githubUsername": "priyanshurav",
|
||||
"url": "https://github.com/priyanshurav"
|
||||
},
|
||||
{
|
||||
"name": "Dmitry Semigradsky",
|
||||
"githubUsername": "Semigradsky",
|
||||
"url": "https://github.com/Semigradsky"
|
||||
},
|
||||
{
|
||||
"name": "Matt Pocock",
|
||||
"githubUsername": "mattpocock",
|
||||
"url": "https://github.com/mattpocock"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"typesVersions": {
|
||||
"<=5.0": {
|
||||
"*": [
|
||||
"ts5.0/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"types@<=5.0": {
|
||||
"default": "./ts5.0/index.d.ts"
|
||||
},
|
||||
"types": {
|
||||
"default": "./index.d.ts"
|
||||
}
|
||||
},
|
||||
"./canary": {
|
||||
"types@<=5.0": {
|
||||
"default": "./ts5.0/canary.d.ts"
|
||||
},
|
||||
"types": {
|
||||
"default": "./canary.d.ts"
|
||||
}
|
||||
},
|
||||
"./compiler-runtime": {
|
||||
"types": {
|
||||
"default": "./compiler-runtime.d.ts"
|
||||
}
|
||||
},
|
||||
"./experimental": {
|
||||
"types@<=5.0": {
|
||||
"default": "./ts5.0/experimental.d.ts"
|
||||
},
|
||||
"types": {
|
||||
"default": "./experimental.d.ts"
|
||||
}
|
||||
},
|
||||
"./jsx-runtime": {
|
||||
"types@<=5.0": {
|
||||
"default": "./ts5.0/jsx-runtime.d.ts"
|
||||
},
|
||||
"types": {
|
||||
"default": "./jsx-runtime.d.ts"
|
||||
}
|
||||
},
|
||||
"./jsx-dev-runtime": {
|
||||
"types@<=5.0": {
|
||||
"default": "./ts5.0/jsx-dev-runtime.d.ts"
|
||||
},
|
||||
"types": {
|
||||
"default": "./jsx-dev-runtime.d.ts"
|
||||
}
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/react"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {
|
||||
"csstype": "^3.0.2"
|
||||
},
|
||||
"peerDependencies": {},
|
||||
"typesPublisherContentHash": "045855bc6d5c9b02e38d720a00155e1b47f4bbcadcbbdaa2b3da3bd9ae7c88a3",
|
||||
"typeScriptVersion": "5.1"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"42":0.00597,"52":0.00597,"59":0.00199,"88":0.00398,"113":0.00398,"115":0.1393,"125":0.00199,"127":0.00398,"128":0.02985,"129":0.00199,"130":0.00199,"131":0.00199,"132":0.00199,"133":0.00398,"134":0.00597,"135":0.12139,"136":0.42586,"137":0.01194,_:"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 43 44 45 46 47 48 49 50 51 53 54 55 56 57 58 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 114 116 117 118 119 120 121 122 123 124 126 138 139 140 3.5 3.6"},D:{"49":0.00398,"52":0.00398,"55":0.00199,"58":0.00199,"66":0.00995,"68":0.00199,"69":0.00199,"70":0.00199,"71":0.00199,"73":0.00199,"74":0.00199,"78":0.00199,"79":0.00597,"80":0.00199,"81":0.00398,"83":0.00199,"85":0.00199,"86":0.00199,"87":0.01791,"88":0.00199,"89":0.00199,"90":0.00199,"91":0.00398,"92":0.00199,"93":0.00199,"94":0.00398,"95":0.00199,"96":0.00199,"97":0.00199,"99":0.00199,"100":0.00199,"101":0.00796,"102":0.00199,"103":0.01393,"104":0.00995,"105":0.00398,"106":0.00995,"107":0.00796,"108":0.01194,"109":1.24574,"110":0.00597,"111":0.00995,"112":0.00796,"113":0.00398,"114":0.00796,"115":0.00398,"116":0.01592,"117":0.00796,"118":0.00597,"119":0.02786,"120":0.01592,"121":0.01194,"122":0.03184,"123":0.01393,"124":0.02587,"125":0.04378,"126":0.06766,"127":0.04179,"128":0.04975,"129":0.03582,"130":0.05771,"131":0.20696,"132":0.19502,"133":4.18696,"134":7.82667,"135":0.01791,"136":0.00398,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 50 51 53 54 56 57 59 60 61 62 63 64 65 67 72 75 76 77 84 98 137 138"},F:{"79":0.00199,"85":0.00199,"86":0.00199,"87":0.06368,"88":0.0199,"95":0.01393,"114":0.00199,"116":0.01791,"117":0.18308,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 80 81 82 83 84 89 90 91 92 93 94 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 115 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"17":0.00199,"18":0.00199,"92":0.00597,"100":0.00199,"107":0.00199,"108":0.00199,"109":0.00995,"114":0.00796,"120":0.00398,"122":0.00199,"124":0.00199,"126":0.00398,"127":0.00199,"128":0.00199,"129":0.00199,"130":0.00398,"131":0.01592,"132":0.01592,"133":0.32835,"134":0.75421,_:"12 13 14 15 16 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 101 102 103 104 105 106 110 111 112 113 115 116 117 118 119 121 123 125"},E:{"14":0.00199,_:"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 12.1 15.2-15.3 15.4","11.1":0.00199,"13.1":0.00199,"14.1":0.00398,"15.1":0.00398,"15.5":0.00199,"15.6":0.00995,"16.0":0.00199,"16.1":0.00199,"16.2":0.00199,"16.3":0.00199,"16.4":0.00199,"16.5":0.00199,"16.6":0.01194,"17.0":0.00199,"17.1":0.00398,"17.2":0.00199,"17.3":0.00199,"17.4":0.00796,"17.5":0.01194,"17.6":0.02189,"18.0":0.00796,"18.1":0.01592,"18.2":0.01393,"18.3":0.1393,"18.4":0.00398},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00047,"5.0-5.1":0,"6.0-6.1":0.00142,"7.0-7.1":0.00095,"8.1-8.4":0,"9.0-9.2":0.00071,"9.3":0.00332,"10.0-10.2":0.00024,"10.3":0.00545,"11.0-11.2":0.02513,"11.3-11.4":0.00166,"12.0-12.1":0.00095,"12.2-12.5":0.02347,"13.0-13.1":0.00047,"13.2":0.00071,"13.3":0.00095,"13.4-13.7":0.00332,"14.0-14.4":0.0083,"14.5-14.8":0.00996,"15.0-15.1":0.00545,"15.2-15.3":0.00545,"15.4":0.00664,"15.5":0.00759,"15.6-15.8":0.09342,"16.0":0.01328,"16.1":0.02727,"16.2":0.01423,"16.3":0.02466,"16.4":0.00545,"16.5":0.0102,"16.6-16.7":0.11072,"17.0":0.00664,"17.1":0.01185,"17.2":0.00901,"17.3":0.01257,"17.4":0.02513,"17.5":0.05595,"17.6-17.7":0.16241,"18.0":0.04552,"18.1":0.1489,"18.2":0.06662,"18.3":1.39246,"18.4":0.02063},P:{"4":0.02158,"21":0.01079,"22":0.01079,"23":0.03237,"24":0.02158,"25":0.03237,"26":0.04317,"27":0.57194,_:"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 18.0 19.0","7.2-7.4":0.02158,"17.0":0.01079},I:{"0":0.01599,"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":3.06992,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.01592,_:"6 7 8 9 10 5.5"},S:{"2.5":0.08811,_:"3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.15219},Q:{_:"14.9"},O:{"0":1.49787},H:{"0":0.07},L:{"0":74.50162}};
|
||||
@@ -0,0 +1,40 @@
|
||||
[](https://www.npmjs.com/package/make-event-props)  [](https://github.com/wojtekmaj/make-event-props/actions)
|
||||
|
||||
# Make-Event-Props
|
||||
|
||||
A function that, given props, returns an object of event callback props optionally curried with additional arguments.
|
||||
|
||||
This package allows you to pass event callback props to a rendered DOM element without the risk of applying any invalid props that could cause unwanted side effects.
|
||||
|
||||
## tl;dr
|
||||
|
||||
- Install by executing `npm install make-event-props` or `yarn add make-event-props`.
|
||||
- Import by adding `import makeEventProps from 'make-event-props'`.
|
||||
- Create your event props object:
|
||||
```ts
|
||||
const eventProps = useMemo(
|
||||
() => makeEventProps(props, (eventName) => additionalArgs),
|
||||
[additionalArgs],
|
||||
);
|
||||
```
|
||||
- Use your event props:
|
||||
```tsx
|
||||
return <div {...eventProps} />;
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
The MIT License.
|
||||
|
||||
## Author
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td >
|
||||
<img src="https://avatars.githubusercontent.com/u/5426427?v=4&s=128" width="64" height="64" alt="Wojciech Maj">
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://github.com/wojtekmaj">Wojciech Maj</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -0,0 +1,631 @@
|
||||
'use client';
|
||||
|
||||
import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
||||
import makeEventProps from 'make-event-props';
|
||||
import makeCancellable from 'make-cancellable-promise';
|
||||
import clsx from 'clsx';
|
||||
import invariant from 'tiny-invariant';
|
||||
import warning from 'warning';
|
||||
import { dequal } from 'dequal';
|
||||
import * as pdfjs from 'pdfjs-dist';
|
||||
|
||||
import DocumentContext from './DocumentContext.js';
|
||||
|
||||
import Message from './Message.js';
|
||||
|
||||
import LinkService from './LinkService.js';
|
||||
import PasswordResponses from './PasswordResponses.js';
|
||||
|
||||
import {
|
||||
cancelRunningTask,
|
||||
dataURItoByteString,
|
||||
displayCORSWarning,
|
||||
isArrayBuffer,
|
||||
isBlob,
|
||||
isBrowser,
|
||||
isDataURI,
|
||||
loadFromFile,
|
||||
} from './shared/utils.js';
|
||||
|
||||
import useResolver from './shared/hooks/useResolver.js';
|
||||
|
||||
import type { PDFDocumentProxy } from 'pdfjs-dist';
|
||||
import type { DocumentInitParameters } from 'pdfjs-dist/types/src/display/api.js';
|
||||
import type { EventProps } from 'make-event-props';
|
||||
import type {
|
||||
ClassName,
|
||||
DocumentCallback,
|
||||
ExternalLinkRel,
|
||||
ExternalLinkTarget,
|
||||
File,
|
||||
ImageResourcesPath,
|
||||
NodeOrRenderer,
|
||||
OnDocumentLoadError,
|
||||
OnDocumentLoadProgress,
|
||||
OnDocumentLoadSuccess,
|
||||
OnError,
|
||||
OnItemClickArgs,
|
||||
OnPasswordCallback,
|
||||
Options,
|
||||
PasswordResponse,
|
||||
RenderMode,
|
||||
ScrollPageIntoViewArgs,
|
||||
Source,
|
||||
} from './shared/types.js';
|
||||
|
||||
const { PDFDataRangeTransport } = pdfjs;
|
||||
|
||||
type OnItemClick = (args: OnItemClickArgs) => void;
|
||||
|
||||
type OnPassword = (callback: OnPasswordCallback, reason: PasswordResponse) => void;
|
||||
|
||||
type OnSourceError = OnError;
|
||||
|
||||
type OnSourceSuccess = () => void;
|
||||
|
||||
export type DocumentProps = {
|
||||
children?: React.ReactNode;
|
||||
/**
|
||||
* Class name(s) that will be added to rendered element along with the default `react-pdf__Document`.
|
||||
*
|
||||
* @example 'custom-class-name-1 custom-class-name-2'
|
||||
* @example ['custom-class-name-1', 'custom-class-name-2']
|
||||
*/
|
||||
className?: ClassName;
|
||||
/**
|
||||
* What the component should display in case of an error.
|
||||
*
|
||||
* @default 'Failed to load PDF file.'
|
||||
* @example 'An error occurred!'
|
||||
* @example <p>An error occurred!</p>
|
||||
* @example {this.renderError}
|
||||
*/
|
||||
error?: NodeOrRenderer;
|
||||
/**
|
||||
* Link rel for links rendered in annotations.
|
||||
*
|
||||
* @default 'noopener noreferrer nofollow'
|
||||
*/
|
||||
externalLinkRel?: ExternalLinkRel;
|
||||
/**
|
||||
* Link target for external links rendered in annotations.
|
||||
*/
|
||||
externalLinkTarget?: ExternalLinkTarget;
|
||||
/**
|
||||
* What PDF should be displayed.
|
||||
*
|
||||
* Its value can be an URL, a file (imported using `import … from …` or from file input form element), or an object with parameters (`url` - URL; `data` - data, preferably Uint8Array; `range` - PDFDataRangeTransport.
|
||||
*
|
||||
* **Warning**: Since equality check (`===`) is used to determine if `file` object has changed, it must be memoized by setting it in component's state, `useMemo` or other similar technique.
|
||||
*
|
||||
* @example 'https://example.com/sample.pdf'
|
||||
* @example importedPdf
|
||||
* @example { url: 'https://example.com/sample.pdf' }
|
||||
*/
|
||||
file?: File;
|
||||
/**
|
||||
* The path used to prefix the src attributes of annotation SVGs.
|
||||
*
|
||||
* @default ''
|
||||
* @example '/public/images/'
|
||||
*/
|
||||
imageResourcesPath?: ImageResourcesPath;
|
||||
/**
|
||||
* A prop that behaves like [ref](https://reactjs.org/docs/refs-and-the-dom.html), but it's passed to main `<div>` rendered by `<Document>` component.
|
||||
*
|
||||
* @example (ref) => { this.myDocument = ref; }
|
||||
* @example this.ref
|
||||
* @example ref
|
||||
*/
|
||||
inputRef?: React.Ref<HTMLDivElement | null>;
|
||||
/**
|
||||
* What the component should display while loading.
|
||||
*
|
||||
* @default 'Loading PDF…'
|
||||
* @example 'Please wait!'
|
||||
* @example <p>Please wait!</p>
|
||||
* @example {this.renderLoader}
|
||||
*/
|
||||
loading?: NodeOrRenderer;
|
||||
/**
|
||||
* What the component should display in case of no data.
|
||||
*
|
||||
* @default 'No PDF file specified.'
|
||||
* @example 'Please select a file.'
|
||||
* @example <p>Please select a file.</p>
|
||||
* @example {this.renderNoData}
|
||||
*/
|
||||
noData?: NodeOrRenderer;
|
||||
/**
|
||||
* Function called when an outline item or a thumbnail has been clicked. Usually, you would like to use this callback to move the user wherever they requested to.
|
||||
*
|
||||
* @example ({ dest, pageIndex, pageNumber }) => alert('Clicked an item from page ' + pageNumber + '!')
|
||||
*/
|
||||
onItemClick?: OnItemClick;
|
||||
/**
|
||||
* Function called in case of an error while loading a document.
|
||||
*
|
||||
* @example (error) => alert('Error while loading document! ' + error.message)
|
||||
*/
|
||||
onLoadError?: OnDocumentLoadError;
|
||||
/**
|
||||
* Function called, potentially multiple times, as the loading progresses.
|
||||
*
|
||||
* @example ({ loaded, total }) => alert('Loading a document: ' + (loaded / total) * 100 + '%')
|
||||
*/
|
||||
onLoadProgress?: OnDocumentLoadProgress;
|
||||
/**
|
||||
* Function called when the document is successfully loaded.
|
||||
*
|
||||
* @example (pdf) => alert('Loaded a file with ' + pdf.numPages + ' pages!')
|
||||
*/
|
||||
onLoadSuccess?: OnDocumentLoadSuccess;
|
||||
/**
|
||||
* Function called when a password-protected PDF is loaded.
|
||||
*
|
||||
* @example (callback) => callback('s3cr3t_p4ssw0rd')
|
||||
*/
|
||||
onPassword?: OnPassword;
|
||||
/**
|
||||
* Function called in case of an error while retrieving document source from `file` prop.
|
||||
*
|
||||
* @example (error) => alert('Error while retrieving document source! ' + error.message)
|
||||
*/
|
||||
onSourceError?: OnSourceError;
|
||||
/**
|
||||
* Function called when document source is successfully retrieved from `file` prop.
|
||||
*
|
||||
* @example () => alert('Document source retrieved!')
|
||||
*/
|
||||
onSourceSuccess?: OnSourceSuccess;
|
||||
/**
|
||||
* An object in which additional parameters to be passed to PDF.js can be defined. Most notably:
|
||||
* - `cMapUrl`;
|
||||
* - `httpHeaders` - custom request headers, e.g. for authorization);
|
||||
* - `withCredentials` - a boolean to indicate whether or not to include cookies in the request (defaults to `false`)
|
||||
*
|
||||
* For a full list of possible parameters, check [PDF.js documentation on DocumentInitParameters](https://mozilla.github.io/pdf.js/api/draft/module-pdfjsLib.html#~DocumentInitParameters).
|
||||
*
|
||||
* **Note**: Make sure to define options object outside of your React component, and use `useMemo` if you can't.
|
||||
*
|
||||
* @example { cMapUrl: '/cmaps/' }
|
||||
*/
|
||||
options?: Options;
|
||||
/**
|
||||
* Rendering mode of the document. Can be `"canvas"`, `"custom"` or `"none"``. If set to `"custom"`, `customRenderer` must also be provided.
|
||||
*
|
||||
* @default 'canvas'
|
||||
* @example 'custom'
|
||||
*/
|
||||
renderMode?: RenderMode;
|
||||
/**
|
||||
* Rotation of the document in degrees. If provided, will change rotation globally, even for the pages which were given `rotate` prop of their own. `90` = rotated to the right, `180` = upside down, `270` = rotated to the left.
|
||||
*
|
||||
* @example 90
|
||||
*/
|
||||
rotate?: number | null;
|
||||
} & EventProps<DocumentCallback | false | undefined>;
|
||||
|
||||
const defaultOnPassword: OnPassword = (callback, reason) => {
|
||||
switch (reason) {
|
||||
case PasswordResponses.NEED_PASSWORD: {
|
||||
const password = prompt('Enter the password to open this PDF file.');
|
||||
callback(password);
|
||||
break;
|
||||
}
|
||||
case PasswordResponses.INCORRECT_PASSWORD: {
|
||||
const password = prompt('Invalid password. Please try again.');
|
||||
callback(password);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
}
|
||||
};
|
||||
|
||||
function isParameterObject(file: File): file is Source {
|
||||
return (
|
||||
typeof file === 'object' &&
|
||||
file !== null &&
|
||||
('data' in file || 'range' in file || 'url' in file)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a document passed using `file` prop.
|
||||
*/
|
||||
const Document: React.ForwardRefExoticComponent<
|
||||
DocumentProps &
|
||||
React.RefAttributes<{
|
||||
linkService: React.RefObject<LinkService>;
|
||||
pages: React.RefObject<HTMLDivElement[]>;
|
||||
viewer: React.RefObject<{ scrollPageIntoView: (args: ScrollPageIntoViewArgs) => void }>;
|
||||
}>
|
||||
> = forwardRef(function Document(
|
||||
{
|
||||
children,
|
||||
className,
|
||||
error = 'Failed to load PDF file.',
|
||||
externalLinkRel,
|
||||
externalLinkTarget,
|
||||
file,
|
||||
inputRef,
|
||||
imageResourcesPath,
|
||||
loading = 'Loading PDF…',
|
||||
noData = 'No PDF file specified.',
|
||||
onItemClick,
|
||||
onLoadError: onLoadErrorProps,
|
||||
onLoadProgress,
|
||||
onLoadSuccess: onLoadSuccessProps,
|
||||
onPassword = defaultOnPassword,
|
||||
onSourceError: onSourceErrorProps,
|
||||
onSourceSuccess: onSourceSuccessProps,
|
||||
options,
|
||||
renderMode,
|
||||
rotate,
|
||||
...otherProps
|
||||
},
|
||||
ref,
|
||||
) {
|
||||
const [sourceState, sourceDispatch] = useResolver<Source | null>();
|
||||
const { value: source, error: sourceError } = sourceState;
|
||||
const [pdfState, pdfDispatch] = useResolver<PDFDocumentProxy>();
|
||||
const { value: pdf, error: pdfError } = pdfState;
|
||||
|
||||
const linkService = useRef(new LinkService());
|
||||
|
||||
const pages = useRef<HTMLDivElement[]>([]);
|
||||
|
||||
const prevFile = useRef<File | undefined>(undefined);
|
||||
const prevOptions = useRef<Options | undefined>(undefined);
|
||||
|
||||
if (file && file !== prevFile.current && isParameterObject(file)) {
|
||||
warning(
|
||||
!dequal(file, prevFile.current),
|
||||
`File prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.`,
|
||||
);
|
||||
|
||||
prevFile.current = file;
|
||||
}
|
||||
|
||||
// Detect non-memoized changes in options prop
|
||||
if (options && options !== prevOptions.current) {
|
||||
warning(
|
||||
!dequal(options, prevOptions.current),
|
||||
`Options prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.`,
|
||||
);
|
||||
|
||||
prevOptions.current = options;
|
||||
}
|
||||
|
||||
const viewer = useRef({
|
||||
// Handling jumping to internal links target
|
||||
scrollPageIntoView: (args: ScrollPageIntoViewArgs) => {
|
||||
const { dest, pageNumber, pageIndex = pageNumber - 1 } = args;
|
||||
|
||||
// First, check if custom handling of onItemClick was provided
|
||||
if (onItemClick) {
|
||||
onItemClick({ dest, pageIndex, pageNumber });
|
||||
return;
|
||||
}
|
||||
|
||||
// If not, try to look for target page within the <Document>.
|
||||
const page = pages.current[pageIndex];
|
||||
|
||||
if (page) {
|
||||
// Scroll to the page automatically
|
||||
page.scrollIntoView();
|
||||
return;
|
||||
}
|
||||
|
||||
warning(
|
||||
false,
|
||||
`An internal link leading to page ${pageNumber} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>.`,
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
useImperativeHandle(
|
||||
ref,
|
||||
() => ({
|
||||
linkService,
|
||||
pages,
|
||||
viewer,
|
||||
}),
|
||||
[],
|
||||
);
|
||||
|
||||
/**
|
||||
* Called when a document source is resolved correctly
|
||||
*/
|
||||
function onSourceSuccess() {
|
||||
if (onSourceSuccessProps) {
|
||||
onSourceSuccessProps();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a document source failed to be resolved correctly
|
||||
*/
|
||||
function onSourceError() {
|
||||
if (!sourceError) {
|
||||
// Impossible, but TypeScript doesn't know that
|
||||
return;
|
||||
}
|
||||
|
||||
warning(false, sourceError.toString());
|
||||
|
||||
if (onSourceErrorProps) {
|
||||
onSourceErrorProps(sourceError);
|
||||
}
|
||||
}
|
||||
|
||||
function resetSource() {
|
||||
sourceDispatch({ type: 'RESET' });
|
||||
}
|
||||
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: See https://github.com/biomejs/biome/issues/3080
|
||||
useEffect(resetSource, [file, sourceDispatch]);
|
||||
|
||||
const findDocumentSource = useCallback(async (): Promise<Source | null> => {
|
||||
if (!file) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// File is a string
|
||||
if (typeof file === 'string') {
|
||||
if (isDataURI(file)) {
|
||||
const fileByteString = dataURItoByteString(file);
|
||||
return { data: fileByteString };
|
||||
}
|
||||
|
||||
displayCORSWarning();
|
||||
return { url: file };
|
||||
}
|
||||
|
||||
// File is PDFDataRangeTransport
|
||||
if (file instanceof PDFDataRangeTransport) {
|
||||
return { range: file };
|
||||
}
|
||||
|
||||
// File is an ArrayBuffer
|
||||
if (isArrayBuffer(file)) {
|
||||
return { data: file };
|
||||
}
|
||||
|
||||
/**
|
||||
* The cases below are browser-only.
|
||||
* If you're running on a non-browser environment, these cases will be of no use.
|
||||
*/
|
||||
if (isBrowser) {
|
||||
// File is a Blob
|
||||
if (isBlob(file)) {
|
||||
const data = await loadFromFile(file);
|
||||
|
||||
return { data };
|
||||
}
|
||||
}
|
||||
|
||||
// At this point, file must be an object
|
||||
invariant(
|
||||
typeof file === 'object',
|
||||
'Invalid parameter in file, need either Uint8Array, string or a parameter object',
|
||||
);
|
||||
|
||||
invariant(
|
||||
isParameterObject(file),
|
||||
'Invalid parameter object: need either .data, .range or .url',
|
||||
);
|
||||
|
||||
// File .url is a string
|
||||
if ('url' in file && typeof file.url === 'string') {
|
||||
if (isDataURI(file.url)) {
|
||||
const { url, ...otherParams } = file;
|
||||
const fileByteString = dataURItoByteString(url);
|
||||
return { data: fileByteString, ...otherParams };
|
||||
}
|
||||
|
||||
displayCORSWarning();
|
||||
}
|
||||
|
||||
return file;
|
||||
}, [file]);
|
||||
|
||||
useEffect(() => {
|
||||
const cancellable = makeCancellable(findDocumentSource());
|
||||
|
||||
cancellable.promise
|
||||
.then((nextSource) => {
|
||||
sourceDispatch({ type: 'RESOLVE', value: nextSource });
|
||||
})
|
||||
.catch((error) => {
|
||||
sourceDispatch({ type: 'REJECT', error });
|
||||
});
|
||||
|
||||
return () => {
|
||||
cancelRunningTask(cancellable);
|
||||
};
|
||||
}, [findDocumentSource, sourceDispatch]);
|
||||
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: Ommitted callbacks so they are not called every time they change
|
||||
useEffect(() => {
|
||||
if (typeof source === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (source === false) {
|
||||
onSourceError();
|
||||
return;
|
||||
}
|
||||
|
||||
onSourceSuccess();
|
||||
}, [source]);
|
||||
|
||||
/**
|
||||
* Called when a document is read successfully
|
||||
*/
|
||||
function onLoadSuccess() {
|
||||
if (!pdf) {
|
||||
// Impossible, but TypeScript doesn't know that
|
||||
return;
|
||||
}
|
||||
|
||||
if (onLoadSuccessProps) {
|
||||
onLoadSuccessProps(pdf);
|
||||
}
|
||||
|
||||
pages.current = new Array(pdf.numPages);
|
||||
linkService.current.setDocument(pdf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a document failed to read successfully
|
||||
*/
|
||||
function onLoadError() {
|
||||
if (!pdfError) {
|
||||
// Impossible, but TypeScript doesn't know that
|
||||
return;
|
||||
}
|
||||
|
||||
warning(false, pdfError.toString());
|
||||
|
||||
if (onLoadErrorProps) {
|
||||
onLoadErrorProps(pdfError);
|
||||
}
|
||||
}
|
||||
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: useEffect intentionally triggered on source change
|
||||
useEffect(
|
||||
function resetDocument() {
|
||||
pdfDispatch({ type: 'RESET' });
|
||||
},
|
||||
[pdfDispatch, source],
|
||||
);
|
||||
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: Ommitted callbacks so they are not called every time they change
|
||||
useEffect(
|
||||
function loadDocument() {
|
||||
if (!source) {
|
||||
return;
|
||||
}
|
||||
|
||||
const documentInitParams: DocumentInitParameters = options
|
||||
? { ...source, ...options }
|
||||
: source;
|
||||
|
||||
const destroyable = pdfjs.getDocument(documentInitParams);
|
||||
if (onLoadProgress) {
|
||||
destroyable.onProgress = onLoadProgress;
|
||||
}
|
||||
if (onPassword) {
|
||||
destroyable.onPassword = onPassword;
|
||||
}
|
||||
const loadingTask = destroyable;
|
||||
|
||||
const loadingPromise = loadingTask.promise
|
||||
.then((nextPdf) => {
|
||||
pdfDispatch({ type: 'RESOLVE', value: nextPdf });
|
||||
})
|
||||
.catch((error) => {
|
||||
if (loadingTask.destroyed) {
|
||||
return;
|
||||
}
|
||||
|
||||
pdfDispatch({ type: 'REJECT', error });
|
||||
});
|
||||
|
||||
return () => {
|
||||
loadingPromise.finally(() => loadingTask.destroy());
|
||||
};
|
||||
},
|
||||
[options, pdfDispatch, source],
|
||||
);
|
||||
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: Ommitted callbacks so they are not called every time they change
|
||||
useEffect(() => {
|
||||
if (typeof pdf === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pdf === false) {
|
||||
onLoadError();
|
||||
return;
|
||||
}
|
||||
|
||||
onLoadSuccess();
|
||||
}, [pdf]);
|
||||
|
||||
useEffect(
|
||||
function setupLinkService() {
|
||||
linkService.current.setViewer(viewer.current);
|
||||
linkService.current.setExternalLinkRel(externalLinkRel);
|
||||
linkService.current.setExternalLinkTarget(externalLinkTarget);
|
||||
},
|
||||
[externalLinkRel, externalLinkTarget],
|
||||
);
|
||||
|
||||
const registerPage = useCallback((pageIndex: number, ref: HTMLDivElement) => {
|
||||
pages.current[pageIndex] = ref;
|
||||
}, []);
|
||||
|
||||
const unregisterPage = useCallback((pageIndex: number) => {
|
||||
delete pages.current[pageIndex];
|
||||
}, []);
|
||||
|
||||
const childContext = useMemo(
|
||||
() => ({
|
||||
imageResourcesPath,
|
||||
linkService: linkService.current,
|
||||
onItemClick,
|
||||
pdf,
|
||||
registerPage,
|
||||
renderMode,
|
||||
rotate,
|
||||
unregisterPage,
|
||||
}),
|
||||
[imageResourcesPath, onItemClick, pdf, registerPage, renderMode, rotate, unregisterPage],
|
||||
);
|
||||
|
||||
const eventProps = useMemo(
|
||||
() => makeEventProps(otherProps, () => pdf),
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: FIXME
|
||||
[otherProps, pdf],
|
||||
);
|
||||
|
||||
function renderChildren() {
|
||||
return <DocumentContext.Provider value={childContext}>{children}</DocumentContext.Provider>;
|
||||
}
|
||||
|
||||
function renderContent() {
|
||||
if (!file) {
|
||||
return <Message type="no-data">{typeof noData === 'function' ? noData() : noData}</Message>;
|
||||
}
|
||||
|
||||
if (pdf === undefined || pdf === null) {
|
||||
return (
|
||||
<Message type="loading">{typeof loading === 'function' ? loading() : loading}</Message>
|
||||
);
|
||||
}
|
||||
|
||||
if (pdf === false) {
|
||||
return <Message type="error">{typeof error === 'function' ? error() : error}</Message>;
|
||||
}
|
||||
|
||||
return renderChildren();
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className={clsx('react-pdf__Document', className)}
|
||||
// Assertion is needed for React 18 compatibility
|
||||
ref={inputRef as React.Ref<HTMLDivElement>}
|
||||
style={{
|
||||
['--scale-factor' as string]: '1',
|
||||
}}
|
||||
{...eventProps}
|
||||
>
|
||||
{renderContent()}
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
export default Document;
|
||||
@@ -0,0 +1,171 @@
|
||||
/**
|
||||
* @fileoverview Rule to enforce a particular function style
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
defaultOptions: [
|
||||
"expression",
|
||||
{
|
||||
allowArrowFunctions: false,
|
||||
overrides: {},
|
||||
},
|
||||
],
|
||||
|
||||
docs: {
|
||||
description:
|
||||
"Enforce the consistent use of either `function` declarations or expressions assigned to variables",
|
||||
recommended: false,
|
||||
frozen: true,
|
||||
url: "https://eslint.org/docs/latest/rules/func-style",
|
||||
},
|
||||
|
||||
schema: [
|
||||
{
|
||||
enum: ["declaration", "expression"],
|
||||
},
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
allowArrowFunctions: {
|
||||
type: "boolean",
|
||||
},
|
||||
overrides: {
|
||||
type: "object",
|
||||
properties: {
|
||||
namedExports: {
|
||||
enum: ["declaration", "expression", "ignore"],
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
|
||||
messages: {
|
||||
expression: "Expected a function expression.",
|
||||
declaration: "Expected a function declaration.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const [style, { allowArrowFunctions, overrides }] = context.options;
|
||||
const enforceDeclarations = style === "declaration";
|
||||
const { namedExports: exportFunctionStyle } = overrides;
|
||||
const stack = [];
|
||||
|
||||
const nodesToCheck = {
|
||||
FunctionDeclaration(node) {
|
||||
stack.push(false);
|
||||
|
||||
if (
|
||||
!enforceDeclarations &&
|
||||
node.parent.type !== "ExportDefaultDeclaration" &&
|
||||
(typeof exportFunctionStyle === "undefined" ||
|
||||
node.parent.type !== "ExportNamedDeclaration")
|
||||
) {
|
||||
context.report({ node, messageId: "expression" });
|
||||
}
|
||||
|
||||
if (
|
||||
node.parent.type === "ExportNamedDeclaration" &&
|
||||
exportFunctionStyle === "expression"
|
||||
) {
|
||||
context.report({ node, messageId: "expression" });
|
||||
}
|
||||
},
|
||||
"FunctionDeclaration:exit"() {
|
||||
stack.pop();
|
||||
},
|
||||
|
||||
FunctionExpression(node) {
|
||||
stack.push(false);
|
||||
|
||||
if (
|
||||
enforceDeclarations &&
|
||||
node.parent.type === "VariableDeclarator" &&
|
||||
(typeof exportFunctionStyle === "undefined" ||
|
||||
node.parent.parent.parent.type !==
|
||||
"ExportNamedDeclaration")
|
||||
) {
|
||||
context.report({
|
||||
node: node.parent,
|
||||
messageId: "declaration",
|
||||
});
|
||||
}
|
||||
|
||||
if (
|
||||
node.parent.type === "VariableDeclarator" &&
|
||||
node.parent.parent.parent.type ===
|
||||
"ExportNamedDeclaration" &&
|
||||
exportFunctionStyle === "declaration"
|
||||
) {
|
||||
context.report({
|
||||
node: node.parent,
|
||||
messageId: "declaration",
|
||||
});
|
||||
}
|
||||
},
|
||||
"FunctionExpression:exit"() {
|
||||
stack.pop();
|
||||
},
|
||||
|
||||
"ThisExpression, Super"() {
|
||||
if (stack.length > 0) {
|
||||
stack[stack.length - 1] = true;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
if (!allowArrowFunctions) {
|
||||
nodesToCheck.ArrowFunctionExpression = function () {
|
||||
stack.push(false);
|
||||
};
|
||||
|
||||
nodesToCheck["ArrowFunctionExpression:exit"] = function (node) {
|
||||
const hasThisOrSuperExpr = stack.pop();
|
||||
|
||||
if (
|
||||
!hasThisOrSuperExpr &&
|
||||
node.parent.type === "VariableDeclarator"
|
||||
) {
|
||||
if (
|
||||
enforceDeclarations &&
|
||||
(typeof exportFunctionStyle === "undefined" ||
|
||||
node.parent.parent.parent.type !==
|
||||
"ExportNamedDeclaration")
|
||||
) {
|
||||
context.report({
|
||||
node: node.parent,
|
||||
messageId: "declaration",
|
||||
});
|
||||
}
|
||||
|
||||
if (
|
||||
node.parent.parent.parent.type ===
|
||||
"ExportNamedDeclaration" &&
|
||||
exportFunctionStyle === "declaration"
|
||||
) {
|
||||
context.report({
|
||||
node: node.parent,
|
||||
messageId: "declaration",
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return nodesToCheck;
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,76 @@
|
||||
/**
|
||||
* @fileoverview A rule to disallow calls to the Object constructor
|
||||
* @author Matt DuVall <http://www.mattduvall.com/>
|
||||
* @deprecated in ESLint v8.50.0
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const astUtils = require("./utils/ast-utils");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
docs: {
|
||||
description: "Disallow `Object` constructors",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/no-new-object",
|
||||
},
|
||||
|
||||
deprecated: {
|
||||
message:
|
||||
"The new rule flags more situations where object literal syntax can be used, and it does not report a problem when the `Object` constructor is invoked with an argument.",
|
||||
url: "https://eslint.org/blog/2023/09/eslint-v8.50.0-released/",
|
||||
deprecatedSince: "8.50.0",
|
||||
availableUntil: null,
|
||||
replacedBy: [
|
||||
{
|
||||
rule: {
|
||||
name: "no-object-constructor",
|
||||
url: "https://eslint.org/docs/rules/no-object-constructor",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
schema: [],
|
||||
|
||||
messages: {
|
||||
preferLiteral: "The object literal notation {} is preferable.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
return {
|
||||
NewExpression(node) {
|
||||
const variable = astUtils.getVariableByName(
|
||||
sourceCode.getScope(node),
|
||||
node.callee.name,
|
||||
);
|
||||
|
||||
if (variable && variable.identifiers.length > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (node.callee.name === "Object") {
|
||||
context.report({
|
||||
node,
|
||||
messageId: "preferLiteral",
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "fast-levenshtein",
|
||||
"version": "2.0.6",
|
||||
"description": "Efficient implementation of Levenshtein algorithm with locale-specific collator support.",
|
||||
"main": "levenshtein.js",
|
||||
"files": [
|
||||
"levenshtein.js"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "grunt build",
|
||||
"prepublish": "npm run build",
|
||||
"benchmark": "grunt benchmark",
|
||||
"test": "mocha"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "~1.5.0",
|
||||
"grunt": "~0.4.1",
|
||||
"grunt-benchmark": "~0.2.0",
|
||||
"grunt-cli": "^1.2.0",
|
||||
"grunt-contrib-jshint": "~0.4.3",
|
||||
"grunt-contrib-uglify": "~0.2.0",
|
||||
"grunt-mocha-test": "~0.2.2",
|
||||
"grunt-npm-install": "~0.1.0",
|
||||
"load-grunt-tasks": "~0.6.0",
|
||||
"lodash": "^4.0.1",
|
||||
"mocha": "~1.9.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/hiddentao/fast-levenshtein.git"
|
||||
},
|
||||
"keywords": [
|
||||
"levenshtein",
|
||||
"distance",
|
||||
"string"
|
||||
],
|
||||
"author": "Ramesh Nair <ram@hiddentao.com> (http://www.hiddentao.com/)",
|
||||
"license": "MIT"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"F A B","2":"K D E mC"},B:{"1":"0 9 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 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I"},C:{"1":"0 1 2 3 4 5 6 7 8 9 G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC 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 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"nC LC J PB K D E F A B C L M qC rC"},D:{"1":"0 9 TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC 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 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"1 2 3 4 5 6 7 8 J PB K D E F A B C L M G N O P QB RB SB"},E:{"1":"B C L M G TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","2":"J PB K D E F A sC SC tC uC vC wC"},F:{"1":"0 1 2 3 4 5 6 7 8 O P QB RB SB TB UB VB WB XB YB ZB aB 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 Q H R OC 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 GC","2":"F B G N 4C 5C 6C 7C FC kC 8C","16":"C"},G:{"1":"HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","2":"E SC 9C lC AD BD CD DD ED FD GD"},H:{"2":"WD"},I:{"1":"I bD cD","2":"LC J XD YD ZD aD lC"},J:{"2":"D A"},K:{"1":"H GC","2":"A B FC kC","16":"C"},L:{"1":"I"},M:{"1":"EC"},N:{"1":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"qD rD"}},B:5,C:"KeyboardEvent.getModifierState()",D:true};
|
||||
@@ -0,0 +1,235 @@
|
||||
// This file is auto-generated! Do not modify it directly.
|
||||
// Run `yarn gulp bundle-dts` to re-generate it.
|
||||
/* eslint-disable @typescript-eslint/consistent-type-imports, @typescript-eslint/no-redundant-type-constituents */
|
||||
import { File, Expression } from '@babel/types';
|
||||
|
||||
type BABEL_8_BREAKING = false;
|
||||
type IF_BABEL_7<V> = false extends BABEL_8_BREAKING ? V : never;
|
||||
|
||||
type Plugin$1 =
|
||||
| "asyncDoExpressions"
|
||||
| IF_BABEL_7<"asyncGenerators">
|
||||
| IF_BABEL_7<"bigInt">
|
||||
| IF_BABEL_7<"classPrivateMethods">
|
||||
| IF_BABEL_7<"classPrivateProperties">
|
||||
| IF_BABEL_7<"classProperties">
|
||||
| IF_BABEL_7<"classStaticBlock">
|
||||
| IF_BABEL_7<"decimal">
|
||||
| "decorators-legacy"
|
||||
| "deferredImportEvaluation"
|
||||
| "decoratorAutoAccessors"
|
||||
| "destructuringPrivate"
|
||||
| "deprecatedImportAssert"
|
||||
| "doExpressions"
|
||||
| IF_BABEL_7<"dynamicImport">
|
||||
| "explicitResourceManagement"
|
||||
| "exportDefaultFrom"
|
||||
| IF_BABEL_7<"exportNamespaceFrom">
|
||||
| "flow"
|
||||
| "flowComments"
|
||||
| "functionBind"
|
||||
| "functionSent"
|
||||
| "importMeta"
|
||||
| "jsx"
|
||||
| IF_BABEL_7<"jsonStrings">
|
||||
| IF_BABEL_7<"logicalAssignment">
|
||||
| IF_BABEL_7<"importAssertions">
|
||||
| IF_BABEL_7<"importReflection">
|
||||
| "moduleBlocks"
|
||||
| IF_BABEL_7<"moduleStringNames">
|
||||
| IF_BABEL_7<"nullishCoalescingOperator">
|
||||
| IF_BABEL_7<"numericSeparator">
|
||||
| IF_BABEL_7<"objectRestSpread">
|
||||
| IF_BABEL_7<"optionalCatchBinding">
|
||||
| IF_BABEL_7<"optionalChaining">
|
||||
| "partialApplication"
|
||||
| "placeholders"
|
||||
| IF_BABEL_7<"privateIn">
|
||||
| IF_BABEL_7<"regexpUnicodeSets">
|
||||
| "sourcePhaseImports"
|
||||
| "throwExpressions"
|
||||
| IF_BABEL_7<"topLevelAwait">
|
||||
| "v8intrinsic"
|
||||
| ParserPluginWithOptions[0];
|
||||
|
||||
type ParserPluginWithOptions =
|
||||
| ["decorators", DecoratorsPluginOptions]
|
||||
| ["estree", { classFeatures?: boolean }]
|
||||
| IF_BABEL_7<["importAttributes", { deprecatedAssertSyntax: boolean }]>
|
||||
| IF_BABEL_7<["moduleAttributes", { version: "may-2020" }]>
|
||||
| ["optionalChainingAssign", { version: "2023-07" }]
|
||||
| ["pipelineOperator", PipelineOperatorPluginOptions]
|
||||
| ["recordAndTuple", RecordAndTuplePluginOptions]
|
||||
| ["flow", FlowPluginOptions]
|
||||
| ["typescript", TypeScriptPluginOptions];
|
||||
|
||||
type PluginConfig = Plugin$1 | ParserPluginWithOptions;
|
||||
|
||||
interface DecoratorsPluginOptions {
|
||||
decoratorsBeforeExport?: boolean;
|
||||
allowCallParenthesized?: boolean;
|
||||
}
|
||||
|
||||
interface PipelineOperatorPluginOptions {
|
||||
proposal: BABEL_8_BREAKING extends false
|
||||
? "minimal" | "fsharp" | "hack" | "smart"
|
||||
: "fsharp" | "hack";
|
||||
topicToken?: "%" | "#" | "@@" | "^^" | "^";
|
||||
}
|
||||
|
||||
interface RecordAndTuplePluginOptions {
|
||||
syntaxType: "bar" | "hash";
|
||||
}
|
||||
|
||||
type FlowPluginOptions = BABEL_8_BREAKING extends true
|
||||
? {
|
||||
all?: boolean;
|
||||
enums?: boolean;
|
||||
}
|
||||
: {
|
||||
all?: boolean;
|
||||
};
|
||||
|
||||
interface TypeScriptPluginOptions {
|
||||
dts?: boolean;
|
||||
disallowAmbiguousJSXLike?: boolean;
|
||||
}
|
||||
|
||||
type Plugin = PluginConfig;
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* By default, import and export declarations can only appear at a program's top level.
|
||||
* Setting this option to true allows them anywhere where a statement is allowed.
|
||||
*/
|
||||
allowImportExportEverywhere?: boolean;
|
||||
/**
|
||||
* By default, await use is not allowed outside of an async function.
|
||||
* Set this to true to accept such code.
|
||||
*/
|
||||
allowAwaitOutsideFunction?: boolean;
|
||||
/**
|
||||
* By default, a return statement at the top level raises an error.
|
||||
* Set this to true to accept such code.
|
||||
*/
|
||||
allowReturnOutsideFunction?: boolean;
|
||||
/**
|
||||
* By default, new.target use is not allowed outside of a function or class.
|
||||
* Set this to true to accept such code.
|
||||
*/
|
||||
allowNewTargetOutsideFunction?: boolean;
|
||||
allowSuperOutsideMethod?: boolean;
|
||||
/**
|
||||
* By default, exported identifiers must refer to a declared variable.
|
||||
* Set this to true to allow export statements to reference undeclared variables.
|
||||
*/
|
||||
allowUndeclaredExports?: boolean;
|
||||
/**
|
||||
* By default, yield use is not allowed outside of a generator function.
|
||||
* Set this to true to accept such code.
|
||||
*/
|
||||
allowYieldOutsideFunction?: boolean;
|
||||
/**
|
||||
* By default, Babel parser JavaScript code according to Annex B syntax.
|
||||
* Set this to `false` to disable such behavior.
|
||||
*/
|
||||
annexB?: boolean;
|
||||
/**
|
||||
* By default, Babel attaches comments to adjacent AST nodes.
|
||||
* When this option is set to false, comments are not attached.
|
||||
* It can provide up to 30% performance improvement when the input code has many comments.
|
||||
* @babel/eslint-parser will set it for you.
|
||||
* It is not recommended to use attachComment: false with Babel transform,
|
||||
* as doing so removes all the comments in output code, and renders annotations such as
|
||||
* /* istanbul ignore next *\/ nonfunctional.
|
||||
*/
|
||||
attachComment?: boolean;
|
||||
/**
|
||||
* By default, Babel always throws an error when it finds some invalid code.
|
||||
* When this option is set to true, it will store the parsing error and
|
||||
* try to continue parsing the invalid input file.
|
||||
*/
|
||||
errorRecovery?: boolean;
|
||||
/**
|
||||
* Indicate the mode the code should be parsed in.
|
||||
* Can be one of "script", "module", or "unambiguous". Defaults to "script".
|
||||
* "unambiguous" will make @babel/parser attempt to guess, based on the presence
|
||||
* of ES6 import or export statements.
|
||||
* Files with ES6 imports and exports are considered "module" and are otherwise "script".
|
||||
*/
|
||||
sourceType?: "script" | "module" | "unambiguous";
|
||||
/**
|
||||
* Correlate output AST nodes with their source filename.
|
||||
* Useful when generating code and source maps from the ASTs of multiple input files.
|
||||
*/
|
||||
sourceFilename?: string;
|
||||
/**
|
||||
* By default, all source indexes start from 0.
|
||||
* You can provide a start index to alternatively start with.
|
||||
* Useful for integration with other source tools.
|
||||
*/
|
||||
startIndex?: number;
|
||||
/**
|
||||
* By default, the first line of code parsed is treated as line 1.
|
||||
* You can provide a line number to alternatively start with.
|
||||
* Useful for integration with other source tools.
|
||||
*/
|
||||
startLine?: number;
|
||||
/**
|
||||
* By default, the parsed code is treated as if it starts from line 1, column 0.
|
||||
* You can provide a column number to alternatively start with.
|
||||
* Useful for integration with other source tools.
|
||||
*/
|
||||
startColumn?: number;
|
||||
/**
|
||||
* Array containing the plugins that you want to enable.
|
||||
*/
|
||||
plugins?: Plugin[];
|
||||
/**
|
||||
* Should the parser work in strict mode.
|
||||
* Defaults to true if sourceType === 'module'. Otherwise, false.
|
||||
*/
|
||||
strictMode?: boolean;
|
||||
/**
|
||||
* Adds a ranges property to each node: [node.start, node.end]
|
||||
*/
|
||||
ranges?: boolean;
|
||||
/**
|
||||
* Adds all parsed tokens to a tokens property on the File node.
|
||||
*/
|
||||
tokens?: boolean;
|
||||
/**
|
||||
* By default, the parser adds information about parentheses by setting
|
||||
* `extra.parenthesized` to `true` as needed.
|
||||
* When this option is `true` the parser creates `ParenthesizedExpression`
|
||||
* AST nodes instead of using the `extra` property.
|
||||
*/
|
||||
createParenthesizedExpressions?: boolean;
|
||||
/**
|
||||
* The default is false in Babel 7 and true in Babel 8
|
||||
* Set this to true to parse it as an `ImportExpression` node.
|
||||
* Otherwise `import(foo)` is parsed as `CallExpression(Import, [Identifier(foo)])`.
|
||||
*/
|
||||
createImportExpressions?: boolean;
|
||||
}
|
||||
|
||||
type ParserOptions = Partial<Options>;
|
||||
interface ParseError {
|
||||
code: string;
|
||||
reasonCode: string;
|
||||
}
|
||||
type ParseResult<Result extends File | Expression = File> = Result & {
|
||||
errors: null | ParseError[];
|
||||
};
|
||||
/**
|
||||
* Parse the provided code as an entire ECMAScript program.
|
||||
*/
|
||||
declare function parse(input: string, options?: ParserOptions): ParseResult<File>;
|
||||
declare function parseExpression(input: string, options?: ParserOptions): ParseResult<Expression>;
|
||||
|
||||
declare const tokTypes: {
|
||||
// todo(flow->ts) real token type
|
||||
[name: string]: any;
|
||||
};
|
||||
|
||||
export { DecoratorsPluginOptions, FlowPluginOptions, ParseError, ParseResult, ParserOptions, PluginConfig as ParserPlugin, ParserPluginWithOptions, PipelineOperatorPluginOptions, RecordAndTuplePluginOptions, TypeScriptPluginOptions, parse, parseExpression, tokTypes };
|
||||
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* @fileoverview Defines a storage for rules.
|
||||
* @author Nicholas C. Zakas
|
||||
* @author aladdin-add
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const builtInRules = require("../rules");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Typedefs
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @typedef {import("../shared/types").Rule} Rule */
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* A storage for rules.
|
||||
*/
|
||||
class Rules {
|
||||
constructor() {
|
||||
this._rules = Object.create(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a rule module for rule id in storage.
|
||||
* @param {string} ruleId Rule id (file name).
|
||||
* @param {Rule} rule Rule object.
|
||||
* @returns {void}
|
||||
*/
|
||||
define(ruleId, rule) {
|
||||
this._rules[ruleId] = rule;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access rule handler by id (file name).
|
||||
* @param {string} ruleId Rule id (file name).
|
||||
* @returns {Rule} Rule object.
|
||||
*/
|
||||
get(ruleId) {
|
||||
if (typeof this._rules[ruleId] === "string") {
|
||||
this.define(ruleId, require(this._rules[ruleId]));
|
||||
}
|
||||
if (this._rules[ruleId]) {
|
||||
return this._rules[ruleId];
|
||||
}
|
||||
if (builtInRules.has(ruleId)) {
|
||||
return builtInRules.get(ruleId);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
*[Symbol.iterator]() {
|
||||
yield* builtInRules;
|
||||
|
||||
for (const ruleId of Object.keys(this._rules)) {
|
||||
yield [ruleId, this.get(ruleId)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Rules;
|
||||
@@ -0,0 +1,21 @@
|
||||
Copyright (c) 2011-2016 Heather Arthur <fayearthur@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"useNavigate.cjs","sources":["../../src/useNavigate.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useRouter } from './useRouter'\nimport type {\n AnyRouter,\n FromPathOption,\n NavigateOptions,\n RegisteredRouter,\n UseNavigateResult,\n} from '@tanstack/router-core'\n\nexport function useNavigate<\n TRouter extends AnyRouter = RegisteredRouter,\n TDefaultFrom extends string = string,\n>(_defaultOpts?: {\n from?: FromPathOption<TRouter, TDefaultFrom>\n}): UseNavigateResult<TDefaultFrom> {\n const { navigate } = useRouter()\n\n return React.useCallback(\n (options: NavigateOptions) => {\n return navigate({\n from: _defaultOpts?.from,\n ...options,\n })\n },\n [_defaultOpts?.from, navigate],\n ) as UseNavigateResult<TDefaultFrom>\n}\n\nexport function Navigate<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(props: NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): null {\n const router = useRouter()\n\n const previousPropsRef = React.useRef<NavigateOptions<\n TRouter,\n TFrom,\n TTo,\n TMaskFrom,\n TMaskTo\n > | null>(null)\n React.useEffect(() => {\n if (previousPropsRef.current !== props) {\n router.navigate({\n ...props,\n })\n previousPropsRef.current = props\n }\n }, [router, props])\n return null\n}\n"],"names":["useRouter","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAUO,SAAS,YAGd,cAEkC;AAC5B,QAAA,EAAE,SAAS,IAAIA,oBAAU;AAE/B,SAAOC,iBAAM;AAAA,IACX,CAAC,YAA6B;AAC5B,aAAO,SAAS;AAAA,QACd,MAAM,6CAAc;AAAA,QACpB,GAAG;AAAA,MAAA,CACJ;AAAA,IACH;AAAA,IACA,CAAC,6CAAc,MAAM,QAAQ;AAAA,EAC/B;AACF;AAEO,SAAS,SAMd,OAAuE;AACvE,QAAM,SAASD,UAAAA,UAAU;AAEnB,QAAA,mBAAmBC,iBAAM,OAMrB,IAAI;AACdA,mBAAM,UAAU,MAAM;AAChB,QAAA,iBAAiB,YAAY,OAAO;AACtC,aAAO,SAAS;AAAA,QACd,GAAG;AAAA,MAAA,CACJ;AACD,uBAAiB,UAAU;AAAA,IAAA;AAAA,EAC7B,GACC,CAAC,QAAQ,KAAK,CAAC;AACX,SAAA;AACT;;;"}
|
||||
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
/**
|
||||
* PDF.js worker entry file.
|
||||
*
|
||||
* This file is identical to Mozilla's pdf.worker.entry.js, with one exception being placed inside
|
||||
* this bundle, not theirs.
|
||||
*/
|
||||
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 });
|
||||
(typeof window !== 'undefined' ? window : {}).pdfjsWorker =
|
||||
// @ts-expect-error - pdfjs-dist does not ship with types
|
||||
await Promise.resolve().then(() => __importStar(require('pdfjs-dist/build/pdf.worker.mjs')));
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"4":0.27492,"30":0.00404,"35":0.01213,"43":0.00404,"52":0.15363,"65":0.00404,"88":0.01617,"109":0.00404,"115":0.14555,"123":0.00404,"127":0.00404,"128":0.08086,"129":0.00404,"130":0.00809,"131":0.00404,"132":0.00404,"133":0.00404,"134":0.02426,"135":0.33153,"136":1.23312,"137":0.00404,_:"2 3 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 31 32 33 34 36 37 38 39 40 41 42 44 45 46 47 48 49 50 51 53 54 55 56 57 58 59 60 61 62 63 64 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 114 116 117 118 119 120 121 122 124 125 126 138 139 140 3.5 3.6"},D:{"39":0.00809,"40":0.01213,"41":0.01213,"42":0.01213,"43":0.01213,"44":0.01213,"45":0.01213,"46":0.00809,"47":0.01617,"48":0.01213,"49":0.14959,"50":0.01213,"51":0.01213,"52":0.01213,"53":0.00809,"54":0.01213,"55":0.01213,"56":0.01213,"57":0.01213,"58":0.01617,"59":0.01213,"60":0.01213,"64":0.01213,"65":0.02426,"66":0.00404,"69":0.11725,"73":0.02022,"75":0.02426,"76":0.00404,"79":0.03639,"83":0.00809,"84":0.00404,"85":0.00404,"87":1.2412,"88":0.00404,"90":0.00404,"91":0.03639,"94":0.04447,"98":0.00809,"99":0.00809,"100":0.00404,"101":0.00404,"102":0.0283,"103":0.02426,"104":0.06065,"106":0.01617,"108":0.00404,"109":1.38675,"110":0.02022,"111":0.02426,"112":0.00404,"113":0.01213,"114":0.01617,"115":0.00404,"116":0.02426,"119":0.02022,"120":0.01213,"121":0.01617,"122":0.09703,"123":0.02426,"124":0.06065,"125":0.30727,"126":0.08086,"127":0.03639,"128":0.10916,"129":0.69135,"130":0.06873,"131":0.25875,"132":0.24662,"133":6.59413,"134":16.16391,"135":0.01213,"136":0.00809,_:"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 67 68 70 71 72 74 77 78 80 81 86 89 92 93 95 96 97 105 107 117 118 137 138"},F:{"36":0.00404,"46":0.06065,"82":0.00404,"87":0.01617,"95":0.01213,"114":0.0283,"116":0.48112,"117":1.24524,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40 41 42 43 44 45 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 83 84 85 86 88 89 90 91 92 93 94 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 115 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"89":0.00404,"90":0.00404,"92":0.01617,"100":0.00404,"101":0.01213,"105":0.00809,"109":0.02022,"112":0.00809,"113":0.00404,"114":0.0283,"122":0.00809,"124":0.00404,"125":0.00404,"126":0.00404,"127":0.00404,"128":0.01213,"129":0.02426,"130":0.03234,"131":0.07277,"132":0.06873,"133":1.14821,"134":3.57806,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 91 93 94 95 96 97 98 99 102 103 104 106 107 108 110 111 115 116 117 118 119 120 121 123"},E:{_:"0 4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 6.1 7.1 9.1 10.1 11.1 12.1 15.1 15.2-15.3 15.5 16.0 16.1 16.3 16.4 17.0","5.1":0.00809,"13.1":0.00404,"14.1":0.00404,"15.4":0.00404,"15.6":0.01213,"16.2":0.00404,"16.5":0.00404,"16.6":0.04447,"17.1":0.01617,"17.2":0.00404,"17.3":0.00404,"17.4":0.00809,"17.5":0.02022,"17.6":0.08895,"18.0":0.02426,"18.1":0.03234,"18.2":0.01213,"18.3":0.29514,"18.4":0.00404},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00168,"5.0-5.1":0,"6.0-6.1":0.00505,"7.0-7.1":0.00337,"8.1-8.4":0,"9.0-9.2":0.00253,"9.3":0.01179,"10.0-10.2":0.00084,"10.3":0.01937,"11.0-11.2":0.08929,"11.3-11.4":0.0059,"12.0-12.1":0.00337,"12.2-12.5":0.08339,"13.0-13.1":0.00168,"13.2":0.00253,"13.3":0.00337,"13.4-13.7":0.01179,"14.0-14.4":0.02948,"14.5-14.8":0.03538,"15.0-15.1":0.01937,"15.2-15.3":0.01937,"15.4":0.02358,"15.5":0.02695,"15.6-15.8":0.33187,"16.0":0.04717,"16.1":0.09687,"16.2":0.05054,"16.3":0.0876,"16.4":0.01937,"16.5":0.03622,"16.6-16.7":0.39336,"17.0":0.02358,"17.1":0.04212,"17.2":0.03201,"17.3":0.04464,"17.4":0.08929,"17.5":0.19879,"17.6-17.7":0.57699,"18.0":0.16173,"18.1":0.52898,"18.2":0.23669,"18.3":4.94694,"18.4":0.07328},P:{"4":0.49127,"20":0.02047,"21":0.0307,"22":0.06141,"23":0.06141,"24":0.11258,"25":0.09211,"26":0.2354,"27":2.82479,"5.0-5.4":0.01023,"6.2-6.4":0.01023,"7.2-7.4":0.22516,"8.2":0.01023,"9.2":0.01023,_:"10.1 12.0 15.0 18.0","11.1-11.2":0.02047,"13.0":0.02047,"14.0":0.01023,"16.0":0.09211,"17.0":0.60385,"19.0":0.02047},I:{"0":0.03567,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00001,"4.4":0,"4.4.3-4.4.4":0.00004},K:{"0":0.4289,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.00404,_:"6 7 8 9 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.23232},Q:{_:"14.9"},O:{"0":0.0834},H:{"0":0},L:{"0":46.25062}};
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "isexe",
|
||||
"version": "2.0.0",
|
||||
"description": "Minimal module to check if a file is executable.",
|
||||
"main": "index.js",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mkdirp": "^0.5.1",
|
||||
"rimraf": "^2.5.0",
|
||||
"tap": "^10.3.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js --100",
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"postpublish": "git push origin --all; git push origin --tags"
|
||||
},
|
||||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
||||
"license": "ISC",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/isaacs/isexe.git"
|
||||
},
|
||||
"keywords": [],
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/isexe/issues"
|
||||
},
|
||||
"homepage": "https://github.com/isaacs/isexe#readme"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
class Ref {
|
||||
constructor({ num, gen }) {
|
||||
this.num = num;
|
||||
this.gen = gen;
|
||||
}
|
||||
toString() {
|
||||
let str = `${this.num}R`;
|
||||
if (this.gen !== 0) {
|
||||
str += this.gen;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
}
|
||||
exports.default = Ref;
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"40":0.00392,"41":0.00392,"48":0.01569,"52":0.00392,"78":0.00784,"82":0.00392,"89":0.00392,"93":0.00392,"106":0.00784,"115":0.20787,"120":0.00392,"128":0.00392,"129":0.00392,"133":0.00392,"134":0.00784,"135":0.28238,"136":0.89814,"137":0.00784,_:"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 42 43 44 45 46 47 49 50 51 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 79 80 81 83 84 85 86 87 88 90 91 92 94 95 96 97 98 99 100 101 102 103 104 105 107 108 109 110 111 112 113 114 116 117 118 119 121 122 123 124 125 126 127 130 131 132 138 139 140 3.5 3.6"},D:{"46":0.00392,"47":0.00392,"49":0.00392,"56":0.00392,"58":0.00392,"62":0.00392,"65":0.00392,"67":0.00392,"68":0.00392,"70":0.00392,"75":0.01177,"79":0.02353,"83":0.0353,"87":0.02353,"88":0.00784,"91":0.02353,"93":0.00392,"94":0.02745,"98":0.00784,"99":0.00392,"103":0.08628,"106":0.00392,"108":0.00784,"109":0.90206,"110":0.00392,"111":0.00784,"112":0.00392,"114":0.01569,"115":0.00392,"116":0.06667,"117":0.01177,"119":0.04706,"120":0.0706,"121":0.04314,"122":0.08236,"123":0.04314,"124":0.05883,"125":0.05099,"126":0.05491,"127":0.01961,"128":0.08628,"129":0.02353,"130":0.1255,"131":0.60399,"132":0.52947,"133":7.26354,"134":14.84085,"135":0.05099,_:"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 48 50 51 52 53 54 55 57 59 60 61 63 64 66 69 71 72 73 74 76 77 78 80 81 84 85 86 89 90 92 95 96 97 100 101 102 104 105 107 113 118 136 137 138"},F:{"85":0.00392,"87":0.09413,"88":0.04314,"95":0.01177,"116":0.53339,"117":1.46683,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 86 89 90 91 92 93 94 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"15":0.00392,"18":0.00392,"94":0.00392,"109":0.01177,"114":0.01569,"118":0.00392,"120":0.02745,"121":0.00392,"122":0.00392,"125":0.00392,"126":0.00392,"127":0.00784,"129":0.00392,"130":0.00392,"131":0.04706,"132":0.04314,"133":1.2472,"134":2.27084,_:"12 13 14 16 17 79 80 81 83 84 85 86 87 88 89 90 91 92 93 95 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 115 116 117 119 123 124 128"},E:{"14":0.00392,_:"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 11.1","12.1":0.00392,"13.1":0.00784,"14.1":0.07452,"15.1":0.02353,"15.2-15.3":0.00784,"15.4":0.00392,"15.5":0.01569,"15.6":0.13335,"16.0":0.01961,"16.1":0.04706,"16.2":0.02353,"16.3":0.03922,"16.4":0.03922,"16.5":0.04314,"16.6":0.27062,"17.0":0.14904,"17.1":0.14904,"17.2":0.02353,"17.3":0.06667,"17.4":0.12158,"17.5":0.12158,"17.6":0.51378,"18.0":0.09805,"18.1":0.11374,"18.2":0.05883,"18.3":1.72176,"18.4":0.01961},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00326,"5.0-5.1":0,"6.0-6.1":0.00978,"7.0-7.1":0.00652,"8.1-8.4":0,"9.0-9.2":0.00489,"9.3":0.02281,"10.0-10.2":0.00163,"10.3":0.03747,"11.0-11.2":0.1727,"11.3-11.4":0.0114,"12.0-12.1":0.00652,"12.2-12.5":0.1613,"13.0-13.1":0.00326,"13.2":0.00489,"13.3":0.00652,"13.4-13.7":0.02281,"14.0-14.4":0.05702,"14.5-14.8":0.06843,"15.0-15.1":0.03747,"15.2-15.3":0.03747,"15.4":0.04562,"15.5":0.05214,"15.6-15.8":0.64192,"16.0":0.09124,"16.1":0.18736,"16.2":0.09775,"16.3":0.16944,"16.4":0.03747,"16.5":0.07006,"16.6-16.7":0.76086,"17.0":0.04562,"17.1":0.08146,"17.2":0.06191,"17.3":0.08635,"17.4":0.1727,"17.5":0.3845,"17.6-17.7":1.11603,"18.0":0.31281,"18.1":1.02317,"18.2":0.45782,"18.3":9.56855,"18.4":0.14174},P:{"4":0.0313,"20":0.01043,"21":0.01043,"23":0.01043,"24":0.01043,"25":0.05217,"26":0.0313,"27":1.42938,_:"22 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","5.0-5.4":0.01043,"7.2-7.4":0.13563},I:{"0":0.04245,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00001,"4.4":0,"4.4.3-4.4.4":0.00005},K:{"0":2.01149,_:"10 11 12 11.1 11.5 12.1"},A:{_:"6 7 8 9 10 11 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.17016},Q:{"14.9":0.00608},O:{"0":2.20595},H:{"0":0},L:{"0":40.18972}};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_assertClassBrand","require","_classPrivateGetter","privateMap","receiver","getter","assertClassBrand"],"sources":["../../src/helpers/classPrivateGetter.ts"],"sourcesContent":["/* @minVersion 7.24.0 */\n\nimport assertClassBrand from \"./assertClassBrand.ts\";\n\nexport default function _classPrivateGetter(\n privateMap: WeakMap<any, any> | WeakSet<any>,\n receiver: any,\n getter: Function,\n) {\n return getter(assertClassBrand(privateMap, receiver));\n}\n"],"mappings":";;;;;;AAEA,IAAAA,iBAAA,GAAAC,OAAA;AAEe,SAASC,mBAAmBA,CACzCC,UAA4C,EAC5CC,QAAa,EACbC,MAAgB,EAChB;EACA,OAAOA,MAAM,CAAC,IAAAC,yBAAgB,EAACH,UAAU,EAAEC,QAAQ,CAAC,CAAC;AACvD","ignoreList":[]}
|
||||
@@ -0,0 +1,365 @@
|
||||
/**
|
||||
* @fileoverview disallow assignments that can lead to race conditions due to usage of `await` or `yield`
|
||||
* @author Teddy Katz
|
||||
* @author Toru Nagashima
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Make the map from identifiers to each reference.
|
||||
* @param {escope.Scope} scope The scope to get references.
|
||||
* @param {Map<Identifier, escope.Reference>} [outReferenceMap] The map from identifier nodes to each reference object.
|
||||
* @returns {Map<Identifier, escope.Reference>} `referenceMap`.
|
||||
*/
|
||||
function createReferenceMap(scope, outReferenceMap = new Map()) {
|
||||
for (const reference of scope.references) {
|
||||
if (reference.resolved === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
outReferenceMap.set(reference.identifier, reference);
|
||||
}
|
||||
for (const childScope of scope.childScopes) {
|
||||
if (childScope.type !== "function") {
|
||||
createReferenceMap(childScope, outReferenceMap);
|
||||
}
|
||||
}
|
||||
|
||||
return outReferenceMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get `reference.writeExpr` of a given reference.
|
||||
* If it's the read reference of MemberExpression in LHS, returns RHS in order to address `a.b = await a`
|
||||
* @param {escope.Reference} reference The reference to get.
|
||||
* @returns {Expression|null} The `reference.writeExpr`.
|
||||
*/
|
||||
function getWriteExpr(reference) {
|
||||
if (reference.writeExpr) {
|
||||
return reference.writeExpr;
|
||||
}
|
||||
let node = reference.identifier;
|
||||
|
||||
while (node) {
|
||||
const t = node.parent.type;
|
||||
|
||||
if (t === "AssignmentExpression" && node.parent.left === node) {
|
||||
return node.parent.right;
|
||||
}
|
||||
if (t === "MemberExpression" && node.parent.object === node) {
|
||||
node = node.parent;
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an expression is a variable that can only be observed within the given function.
|
||||
* @param {Variable|null} variable The variable to check
|
||||
* @param {boolean} isMemberAccess If `true` then this is a member access.
|
||||
* @returns {boolean} `true` if the variable is local to the given function, and is never referenced in a closure.
|
||||
*/
|
||||
function isLocalVariableWithoutEscape(variable, isMemberAccess) {
|
||||
if (!variable) {
|
||||
return false; // A global variable which was not defined.
|
||||
}
|
||||
|
||||
// If the reference is a property access and the variable is a parameter, it handles the variable is not local.
|
||||
if (isMemberAccess && variable.defs.some(d => d.type === "Parameter")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const functionScope = variable.scope.variableScope;
|
||||
|
||||
return variable.references.every(
|
||||
reference => reference.from.variableScope === functionScope,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents segment information.
|
||||
*/
|
||||
class SegmentInfo {
|
||||
constructor() {
|
||||
this.info = new WeakMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the segment information.
|
||||
* @param {PathSegment} segment The segment to initialize.
|
||||
* @returns {void}
|
||||
*/
|
||||
initialize(segment) {
|
||||
const outdatedReadVariables = new Set();
|
||||
const freshReadVariables = new Set();
|
||||
|
||||
for (const prevSegment of segment.prevSegments) {
|
||||
const info = this.info.get(prevSegment);
|
||||
|
||||
if (info) {
|
||||
info.outdatedReadVariables.forEach(
|
||||
Set.prototype.add,
|
||||
outdatedReadVariables,
|
||||
);
|
||||
info.freshReadVariables.forEach(
|
||||
Set.prototype.add,
|
||||
freshReadVariables,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
this.info.set(segment, { outdatedReadVariables, freshReadVariables });
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark a given variable as read on given segments.
|
||||
* @param {PathSegment[]} segments The segments that it read the variable on.
|
||||
* @param {Variable} variable The variable to be read.
|
||||
* @returns {void}
|
||||
*/
|
||||
markAsRead(segments, variable) {
|
||||
for (const segment of segments) {
|
||||
const info = this.info.get(segment);
|
||||
|
||||
if (info) {
|
||||
info.freshReadVariables.add(variable);
|
||||
|
||||
// If a variable is freshly read again, then it's no more out-dated.
|
||||
info.outdatedReadVariables.delete(variable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move `freshReadVariables` to `outdatedReadVariables`.
|
||||
* @param {PathSegment[]} segments The segments to process.
|
||||
* @returns {void}
|
||||
*/
|
||||
makeOutdated(segments) {
|
||||
for (const segment of segments) {
|
||||
const info = this.info.get(segment);
|
||||
|
||||
if (info) {
|
||||
info.freshReadVariables.forEach(
|
||||
Set.prototype.add,
|
||||
info.outdatedReadVariables,
|
||||
);
|
||||
info.freshReadVariables.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given variable is outdated on the current segments.
|
||||
* @param {PathSegment[]} segments The current segments.
|
||||
* @param {Variable} variable The variable to check.
|
||||
* @returns {boolean} `true` if the variable is outdated on the segments.
|
||||
*/
|
||||
isOutdated(segments, variable) {
|
||||
for (const segment of segments) {
|
||||
const info = this.info.get(segment);
|
||||
|
||||
if (info && info.outdatedReadVariables.has(variable)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "problem",
|
||||
|
||||
defaultOptions: [
|
||||
{
|
||||
allowProperties: false,
|
||||
},
|
||||
],
|
||||
|
||||
docs: {
|
||||
description:
|
||||
"Disallow assignments that can lead to race conditions due to usage of `await` or `yield`",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/require-atomic-updates",
|
||||
},
|
||||
|
||||
fixable: null,
|
||||
|
||||
schema: [
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
allowProperties: {
|
||||
type: "boolean",
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
|
||||
messages: {
|
||||
nonAtomicUpdate:
|
||||
"Possible race condition: `{{value}}` might be reassigned based on an outdated value of `{{value}}`.",
|
||||
nonAtomicObjectUpdate:
|
||||
"Possible race condition: `{{value}}` might be assigned based on an outdated state of `{{object}}`.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const [{ allowProperties }] = context.options;
|
||||
|
||||
const sourceCode = context.sourceCode;
|
||||
const assignmentReferences = new Map();
|
||||
const segmentInfo = new SegmentInfo();
|
||||
let stack = null;
|
||||
|
||||
return {
|
||||
onCodePathStart(codePath, node) {
|
||||
const scope = sourceCode.getScope(node);
|
||||
const shouldVerify =
|
||||
scope.type === "function" &&
|
||||
(scope.block.async || scope.block.generator);
|
||||
|
||||
stack = {
|
||||
upper: stack,
|
||||
codePath,
|
||||
referenceMap: shouldVerify
|
||||
? createReferenceMap(scope)
|
||||
: null,
|
||||
currentSegments: new Set(),
|
||||
};
|
||||
},
|
||||
onCodePathEnd() {
|
||||
stack = stack.upper;
|
||||
},
|
||||
|
||||
// Initialize the segment information.
|
||||
onCodePathSegmentStart(segment) {
|
||||
segmentInfo.initialize(segment);
|
||||
stack.currentSegments.add(segment);
|
||||
},
|
||||
|
||||
onUnreachableCodePathSegmentStart(segment) {
|
||||
stack.currentSegments.add(segment);
|
||||
},
|
||||
|
||||
onUnreachableCodePathSegmentEnd(segment) {
|
||||
stack.currentSegments.delete(segment);
|
||||
},
|
||||
|
||||
onCodePathSegmentEnd(segment) {
|
||||
stack.currentSegments.delete(segment);
|
||||
},
|
||||
|
||||
// Handle references to prepare verification.
|
||||
Identifier(node) {
|
||||
const { referenceMap } = stack;
|
||||
const reference = referenceMap && referenceMap.get(node);
|
||||
|
||||
// Ignore if this is not a valid variable reference.
|
||||
if (!reference) {
|
||||
return;
|
||||
}
|
||||
const variable = reference.resolved;
|
||||
const writeExpr = getWriteExpr(reference);
|
||||
const isMemberAccess =
|
||||
reference.identifier.parent.type === "MemberExpression";
|
||||
|
||||
// Add a fresh read variable.
|
||||
if (
|
||||
reference.isRead() &&
|
||||
!(writeExpr && writeExpr.parent.operator === "=")
|
||||
) {
|
||||
segmentInfo.markAsRead(stack.currentSegments, variable);
|
||||
}
|
||||
|
||||
/*
|
||||
* Register the variable to verify after ESLint traversed the `writeExpr` node
|
||||
* if this reference is an assignment to a variable which is referred from other closure.
|
||||
*/
|
||||
if (
|
||||
writeExpr &&
|
||||
writeExpr.parent.right === writeExpr && // ← exclude variable declarations.
|
||||
!isLocalVariableWithoutEscape(variable, isMemberAccess)
|
||||
) {
|
||||
let refs = assignmentReferences.get(writeExpr);
|
||||
|
||||
if (!refs) {
|
||||
refs = [];
|
||||
assignmentReferences.set(writeExpr, refs);
|
||||
}
|
||||
|
||||
refs.push(reference);
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* Verify assignments.
|
||||
* If the reference exists in `outdatedReadVariables` list, report it.
|
||||
*/
|
||||
":expression:exit"(node) {
|
||||
// referenceMap exists if this is in a resumable function scope.
|
||||
if (!stack.referenceMap) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Mark the read variables on this code path as outdated.
|
||||
if (
|
||||
node.type === "AwaitExpression" ||
|
||||
node.type === "YieldExpression"
|
||||
) {
|
||||
segmentInfo.makeOutdated(stack.currentSegments);
|
||||
}
|
||||
|
||||
// Verify.
|
||||
const references = assignmentReferences.get(node);
|
||||
|
||||
if (references) {
|
||||
assignmentReferences.delete(node);
|
||||
|
||||
for (const reference of references) {
|
||||
const variable = reference.resolved;
|
||||
|
||||
if (
|
||||
segmentInfo.isOutdated(
|
||||
stack.currentSegments,
|
||||
variable,
|
||||
)
|
||||
) {
|
||||
if (node.parent.left === reference.identifier) {
|
||||
context.report({
|
||||
node: node.parent,
|
||||
messageId: "nonAtomicUpdate",
|
||||
data: {
|
||||
value: variable.name,
|
||||
},
|
||||
});
|
||||
} else if (!allowProperties) {
|
||||
context.report({
|
||||
node: node.parent,
|
||||
messageId: "nonAtomicObjectUpdate",
|
||||
data: {
|
||||
value: sourceCode.getText(
|
||||
node.parent.left,
|
||||
),
|
||||
object: variable.name,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"1":"0 9 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 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I","2":"C L M G","260":"N O P"},C:{"1":"0 9 ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC 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 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"1 2 3 4 5 6 7 8 nC LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB qC rC"},D:{"1":"0 9 VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC 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 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"1 2 3 4 5 6 7 8 J PB K D E F A B C L M G N O P QB RB SB TB UB"},E:{"1":"A B C L M G TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","2":"J PB K D sC SC tC uC","132":"E F vC wC"},F:{"1":"0 1 2 3 4 5 6 7 8 QB RB SB TB UB VB WB XB YB ZB aB 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 Q H R OC 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","2":"F G N O P 4C 5C 6C","33":"B C 7C FC kC 8C GC"},G:{"1":"GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","2":"SC 9C lC AD BD CD","132":"E DD ED FD"},H:{"33":"WD"},I:{"1":"I cD","2":"LC J XD YD ZD aD lC bD"},J:{"2":"D A"},K:{"1":"H","2":"A","33":"B C FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"2":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"qD rD"}},B:4,C:"CSS3 object-fit/object-position",D:true};
|
||||
@@ -0,0 +1,112 @@
|
||||
'use client';
|
||||
|
||||
import clsx from 'clsx';
|
||||
import invariant from 'tiny-invariant';
|
||||
|
||||
import Page from './Page.js';
|
||||
|
||||
import { isProvided } from './shared/utils.js';
|
||||
|
||||
import useDocumentContext from './shared/hooks/useDocumentContext.js';
|
||||
|
||||
import type { PageProps } from './Page.js';
|
||||
import type { ClassName, OnItemClickArgs } from './shared/types.js';
|
||||
|
||||
export type ThumbnailProps = Omit<
|
||||
PageProps,
|
||||
| 'className'
|
||||
| 'customTextRenderer'
|
||||
| 'onGetAnnotationsError'
|
||||
| 'onGetAnnotationsSuccess'
|
||||
| 'onGetTextError'
|
||||
| 'onGetTextSuccess'
|
||||
| 'onRenderAnnotationLayerError'
|
||||
| 'onRenderAnnotationLayerSuccess'
|
||||
| 'onRenderTextLayerError'
|
||||
| 'onRenderTextLayerSuccess'
|
||||
| 'renderAnnotationLayer'
|
||||
| 'renderForms'
|
||||
| 'renderTextLayer'
|
||||
> & {
|
||||
/**
|
||||
* Class name(s) that will be added to rendered element along with the default `react-pdf__Thumbnail`.
|
||||
*
|
||||
* @example 'custom-class-name-1 custom-class-name-2'
|
||||
* @example ['custom-class-name-1', 'custom-class-name-2']
|
||||
*/
|
||||
className?: ClassName;
|
||||
/**
|
||||
* Function called when a thumbnail has been clicked. Usually, you would like to use this callback to move the user wherever they requested to.
|
||||
*
|
||||
* @example ({ dest, pageIndex, pageNumber }) => alert('Clicked an item from page ' + pageNumber + '!')
|
||||
*/
|
||||
onItemClick?: (args: OnItemClickArgs) => void;
|
||||
};
|
||||
|
||||
/**
|
||||
* Displays a thumbnail of a page. Does not render the annotation layer or the text layer. Does not register itself as a link target, so the user will not be scrolled to a Thumbnail component when clicked on an internal link (e.g. in Table of Contents). When clicked, attempts to navigate to the page clicked (similarly to a link in Outline).
|
||||
*
|
||||
* Should be placed inside `<Document />`. Alternatively, it can have `pdf` prop passed, which can be obtained from `<Document />`'s `onLoadSuccess` callback function.
|
||||
*/
|
||||
export default function Thumbnail(props: ThumbnailProps): React.ReactElement {
|
||||
const documentContext = useDocumentContext();
|
||||
|
||||
const mergedProps = { ...documentContext, ...props };
|
||||
const {
|
||||
className,
|
||||
linkService,
|
||||
onItemClick,
|
||||
pageIndex: pageIndexProps,
|
||||
pageNumber: pageNumberProps,
|
||||
pdf,
|
||||
} = mergedProps;
|
||||
|
||||
invariant(
|
||||
pdf,
|
||||
'Attempted to load a thumbnail, but no document was specified. Wrap <Thumbnail /> in a <Document /> or pass explicit `pdf` prop.',
|
||||
);
|
||||
|
||||
const pageIndex = isProvided(pageNumberProps) ? pageNumberProps - 1 : (pageIndexProps ?? null);
|
||||
|
||||
const pageNumber = pageNumberProps ?? (isProvided(pageIndexProps) ? pageIndexProps + 1 : null);
|
||||
|
||||
function onClick(event: React.MouseEvent<HTMLAnchorElement>) {
|
||||
event.preventDefault();
|
||||
|
||||
if (!isProvided(pageIndex) || !pageNumber) {
|
||||
return;
|
||||
}
|
||||
|
||||
invariant(
|
||||
onItemClick || linkService,
|
||||
'Either onItemClick callback or linkService must be defined in order to navigate to an outline item.',
|
||||
);
|
||||
|
||||
if (onItemClick) {
|
||||
onItemClick({
|
||||
pageIndex,
|
||||
pageNumber,
|
||||
});
|
||||
} else if (linkService) {
|
||||
linkService.goToPage(pageNumber);
|
||||
}
|
||||
}
|
||||
|
||||
const { className: classNameProps, onItemClick: onItemClickProps, ...pageProps } = props;
|
||||
|
||||
return (
|
||||
<a
|
||||
className={clsx('react-pdf__Thumbnail', className)}
|
||||
href={pageNumber ? '#' : undefined}
|
||||
onClick={onClick}
|
||||
>
|
||||
<Page
|
||||
{...pageProps}
|
||||
_className="react-pdf__Thumbnail__page"
|
||||
_enableRegisterUnregisterPage={false}
|
||||
renderAnnotationLayer={false}
|
||||
renderTextLayer={false}
|
||||
/>
|
||||
</a>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,428 @@
|
||||
/**
|
||||
* @fileoverview A rule to suggest using arrow functions as callbacks.
|
||||
* @author Toru Nagashima
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const astUtils = require("./utils/ast-utils");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Checks whether or not a given variable is a function name.
|
||||
* @param {eslint-scope.Variable} variable A variable to check.
|
||||
* @returns {boolean} `true` if the variable is a function name.
|
||||
*/
|
||||
function isFunctionName(variable) {
|
||||
return variable && variable.defs[0].type === "FunctionName";
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether or not a given MetaProperty node equals to a given value.
|
||||
* @param {ASTNode} node A MetaProperty node to check.
|
||||
* @param {string} metaName The name of `MetaProperty.meta`.
|
||||
* @param {string} propertyName The name of `MetaProperty.property`.
|
||||
* @returns {boolean} `true` if the node is the specific value.
|
||||
*/
|
||||
function checkMetaProperty(node, metaName, propertyName) {
|
||||
return node.meta.name === metaName && node.property.name === propertyName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the variable object of `arguments` which is defined implicitly.
|
||||
* @param {eslint-scope.Scope} scope A scope to get.
|
||||
* @returns {eslint-scope.Variable} The found variable object.
|
||||
*/
|
||||
function getVariableOfArguments(scope) {
|
||||
const variables = scope.variables;
|
||||
|
||||
for (let i = 0; i < variables.length; ++i) {
|
||||
const variable = variables[i];
|
||||
|
||||
if (variable.name === "arguments") {
|
||||
/*
|
||||
* If there was a parameter which is named "arguments", the
|
||||
* implicit "arguments" is not defined.
|
||||
* So does fast return with null.
|
||||
*/
|
||||
return variable.identifiers.length === 0 ? variable : null;
|
||||
}
|
||||
}
|
||||
|
||||
/* c8 ignore next */
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether or not a given node is a callback.
|
||||
* @param {ASTNode} node A node to check.
|
||||
* @throws {Error} (Unreachable.)
|
||||
* @returns {Object}
|
||||
* {boolean} retv.isCallback - `true` if the node is a callback.
|
||||
* {boolean} retv.isLexicalThis - `true` if the node is with `.bind(this)`.
|
||||
*/
|
||||
function getCallbackInfo(node) {
|
||||
const retv = { isCallback: false, isLexicalThis: false };
|
||||
let currentNode = node;
|
||||
let parent = node.parent;
|
||||
let bound = false;
|
||||
|
||||
while (currentNode) {
|
||||
switch (parent.type) {
|
||||
// Checks parents recursively.
|
||||
|
||||
case "LogicalExpression":
|
||||
case "ChainExpression":
|
||||
case "ConditionalExpression":
|
||||
break;
|
||||
|
||||
// Checks whether the parent node is `.bind(this)` call.
|
||||
case "MemberExpression":
|
||||
if (
|
||||
parent.object === currentNode &&
|
||||
!parent.property.computed &&
|
||||
parent.property.type === "Identifier" &&
|
||||
parent.property.name === "bind"
|
||||
) {
|
||||
const maybeCallee =
|
||||
parent.parent.type === "ChainExpression"
|
||||
? parent.parent
|
||||
: parent;
|
||||
|
||||
if (astUtils.isCallee(maybeCallee)) {
|
||||
if (!bound) {
|
||||
bound = true; // Use only the first `.bind()` to make `isLexicalThis` value.
|
||||
retv.isLexicalThis =
|
||||
maybeCallee.parent.arguments.length === 1 &&
|
||||
maybeCallee.parent.arguments[0].type ===
|
||||
"ThisExpression";
|
||||
}
|
||||
parent = maybeCallee.parent;
|
||||
} else {
|
||||
return retv;
|
||||
}
|
||||
} else {
|
||||
return retv;
|
||||
}
|
||||
break;
|
||||
|
||||
// Checks whether the node is a callback.
|
||||
case "CallExpression":
|
||||
case "NewExpression":
|
||||
if (parent.callee !== currentNode) {
|
||||
retv.isCallback = true;
|
||||
}
|
||||
return retv;
|
||||
|
||||
default:
|
||||
return retv;
|
||||
}
|
||||
|
||||
currentNode = parent;
|
||||
parent = parent.parent;
|
||||
}
|
||||
|
||||
/* c8 ignore next */
|
||||
throw new Error("unreachable");
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a simple list of parameters contains any duplicates. This does not handle complex
|
||||
* parameter lists (e.g. with destructuring), since complex parameter lists are a SyntaxError with duplicate
|
||||
* parameter names anyway. Instead, it always returns `false` for complex parameter lists.
|
||||
* @param {ASTNode[]} paramsList The list of parameters for a function
|
||||
* @returns {boolean} `true` if the list of parameters contains any duplicates
|
||||
*/
|
||||
function hasDuplicateParams(paramsList) {
|
||||
return (
|
||||
paramsList.every(param => param.type === "Identifier") &&
|
||||
paramsList.length !== new Set(paramsList.map(param => param.name)).size
|
||||
);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
defaultOptions: [
|
||||
{ allowNamedFunctions: false, allowUnboundThis: true },
|
||||
],
|
||||
|
||||
docs: {
|
||||
description: "Require using arrow functions for callbacks",
|
||||
recommended: false,
|
||||
frozen: true,
|
||||
url: "https://eslint.org/docs/latest/rules/prefer-arrow-callback",
|
||||
},
|
||||
|
||||
schema: [
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
allowNamedFunctions: {
|
||||
type: "boolean",
|
||||
},
|
||||
allowUnboundThis: {
|
||||
type: "boolean",
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
|
||||
fixable: "code",
|
||||
|
||||
messages: {
|
||||
preferArrowCallback: "Unexpected function expression.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const [{ allowNamedFunctions, allowUnboundThis }] = context.options;
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
/*
|
||||
* {Array<{this: boolean, super: boolean, meta: boolean}>}
|
||||
* - this - A flag which shows there are one or more ThisExpression.
|
||||
* - super - A flag which shows there are one or more Super.
|
||||
* - meta - A flag which shows there are one or more MethProperty.
|
||||
*/
|
||||
let stack = [];
|
||||
|
||||
/**
|
||||
* Pushes new function scope with all `false` flags.
|
||||
* @returns {void}
|
||||
*/
|
||||
function enterScope() {
|
||||
stack.push({ this: false, super: false, meta: false });
|
||||
}
|
||||
|
||||
/**
|
||||
* Pops a function scope from the stack.
|
||||
* @returns {{this: boolean, super: boolean, meta: boolean}} The information of the last scope.
|
||||
*/
|
||||
function exitScope() {
|
||||
return stack.pop();
|
||||
}
|
||||
|
||||
return {
|
||||
// Reset internal state.
|
||||
Program() {
|
||||
stack = [];
|
||||
},
|
||||
|
||||
// If there are below, it cannot replace with arrow functions merely.
|
||||
ThisExpression() {
|
||||
const info = stack.at(-1);
|
||||
|
||||
if (info) {
|
||||
info.this = true;
|
||||
}
|
||||
},
|
||||
|
||||
Super() {
|
||||
const info = stack.at(-1);
|
||||
|
||||
if (info) {
|
||||
info.super = true;
|
||||
}
|
||||
},
|
||||
|
||||
MetaProperty(node) {
|
||||
const info = stack.at(-1);
|
||||
|
||||
if (info && checkMetaProperty(node, "new", "target")) {
|
||||
info.meta = true;
|
||||
}
|
||||
},
|
||||
|
||||
// To skip nested scopes.
|
||||
FunctionDeclaration: enterScope,
|
||||
"FunctionDeclaration:exit": exitScope,
|
||||
|
||||
// Main.
|
||||
FunctionExpression: enterScope,
|
||||
"FunctionExpression:exit"(node) {
|
||||
const scopeInfo = exitScope();
|
||||
|
||||
// Skip named function expressions
|
||||
if (allowNamedFunctions && node.id && node.id.name) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip generators.
|
||||
if (node.generator) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip recursive functions.
|
||||
const nameVar = sourceCode.getDeclaredVariables(node)[0];
|
||||
|
||||
if (isFunctionName(nameVar) && nameVar.references.length > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip if it's using arguments.
|
||||
const variable = getVariableOfArguments(
|
||||
sourceCode.getScope(node),
|
||||
);
|
||||
|
||||
if (variable && variable.references.length > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Reports if it's a callback which can replace with arrows.
|
||||
const callbackInfo = getCallbackInfo(node);
|
||||
|
||||
if (
|
||||
callbackInfo.isCallback &&
|
||||
(!allowUnboundThis ||
|
||||
!scopeInfo.this ||
|
||||
callbackInfo.isLexicalThis) &&
|
||||
!scopeInfo.super &&
|
||||
!scopeInfo.meta
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: "preferArrowCallback",
|
||||
*fix(fixer) {
|
||||
if (
|
||||
(!callbackInfo.isLexicalThis &&
|
||||
scopeInfo.this) ||
|
||||
hasDuplicateParams(node.params)
|
||||
) {
|
||||
/*
|
||||
* If the callback function does not have .bind(this) and contains a reference to `this`, there
|
||||
* is no way to determine what `this` should be, so don't perform any fixes.
|
||||
* If the callback function has duplicates in its list of parameters (possible in sloppy mode),
|
||||
* don't replace it with an arrow function, because this is a SyntaxError with arrow functions.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove `.bind(this)` if exists.
|
||||
if (callbackInfo.isLexicalThis) {
|
||||
const memberNode = node.parent;
|
||||
|
||||
/*
|
||||
* If `.bind(this)` exists but the parent is not `.bind(this)`, don't remove it automatically.
|
||||
* E.g. `(foo || function(){}).bind(this)`
|
||||
*/
|
||||
if (memberNode.type !== "MemberExpression") {
|
||||
return;
|
||||
}
|
||||
|
||||
const callNode = memberNode.parent;
|
||||
const firstTokenToRemove =
|
||||
sourceCode.getTokenAfter(
|
||||
memberNode.object,
|
||||
astUtils.isNotClosingParenToken,
|
||||
);
|
||||
const lastTokenToRemove =
|
||||
sourceCode.getLastToken(callNode);
|
||||
|
||||
/*
|
||||
* If the member expression is parenthesized, don't remove the right paren.
|
||||
* E.g. `(function(){}.bind)(this)`
|
||||
* ^^^^^^^^^^^^
|
||||
*/
|
||||
if (
|
||||
astUtils.isParenthesised(
|
||||
sourceCode,
|
||||
memberNode,
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If comments exist in the `.bind(this)`, don't remove those.
|
||||
if (
|
||||
sourceCode.commentsExistBetween(
|
||||
firstTokenToRemove,
|
||||
lastTokenToRemove,
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
yield fixer.removeRange([
|
||||
firstTokenToRemove.range[0],
|
||||
lastTokenToRemove.range[1],
|
||||
]);
|
||||
}
|
||||
|
||||
// Convert the function expression to an arrow function.
|
||||
const functionToken = sourceCode.getFirstToken(
|
||||
node,
|
||||
node.async ? 1 : 0,
|
||||
);
|
||||
const leftParenToken = sourceCode.getTokenAfter(
|
||||
functionToken,
|
||||
astUtils.isOpeningParenToken,
|
||||
);
|
||||
const tokenBeforeBody = sourceCode.getTokenBefore(
|
||||
node.body,
|
||||
);
|
||||
|
||||
if (
|
||||
sourceCode.commentsExistBetween(
|
||||
functionToken,
|
||||
leftParenToken,
|
||||
)
|
||||
) {
|
||||
// Remove only extra tokens to keep comments.
|
||||
yield fixer.remove(functionToken);
|
||||
if (node.id) {
|
||||
yield fixer.remove(node.id);
|
||||
}
|
||||
} else {
|
||||
// Remove extra tokens and spaces.
|
||||
yield fixer.removeRange([
|
||||
functionToken.range[0],
|
||||
leftParenToken.range[0],
|
||||
]);
|
||||
}
|
||||
yield fixer.insertTextAfter(tokenBeforeBody, " =>");
|
||||
|
||||
// Get the node that will become the new arrow function.
|
||||
let replacedNode = callbackInfo.isLexicalThis
|
||||
? node.parent.parent
|
||||
: node;
|
||||
|
||||
if (replacedNode.type === "ChainExpression") {
|
||||
replacedNode = replacedNode.parent;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the replaced node is part of a BinaryExpression, LogicalExpression, or MemberExpression, then
|
||||
* the arrow function needs to be parenthesized, because `foo || () => {}` is invalid syntax even
|
||||
* though `foo || function() {}` is valid.
|
||||
*/
|
||||
if (
|
||||
replacedNode.parent.type !== "CallExpression" &&
|
||||
replacedNode.parent.type !==
|
||||
"ConditionalExpression" &&
|
||||
!astUtils.isParenthesised(
|
||||
sourceCode,
|
||||
replacedNode,
|
||||
) &&
|
||||
!astUtils.isParenthesised(sourceCode, node)
|
||||
) {
|
||||
yield fixer.insertTextBefore(replacedNode, "(");
|
||||
yield fixer.insertTextAfter(replacedNode, ")");
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,385 @@
|
||||
/**
|
||||
* @license React
|
||||
* react-jsx-dev-runtime.react-server.development.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
"production" !== process.env.NODE_ENV &&
|
||||
(function () {
|
||||
function getComponentNameFromType(type) {
|
||||
if (null == type) return null;
|
||||
if ("function" === typeof type)
|
||||
return type.$$typeof === REACT_CLIENT_REFERENCE
|
||||
? null
|
||||
: type.displayName || type.name || null;
|
||||
if ("string" === typeof type) return type;
|
||||
switch (type) {
|
||||
case REACT_FRAGMENT_TYPE:
|
||||
return "Fragment";
|
||||
case REACT_PROFILER_TYPE:
|
||||
return "Profiler";
|
||||
case REACT_STRICT_MODE_TYPE:
|
||||
return "StrictMode";
|
||||
case REACT_SUSPENSE_TYPE:
|
||||
return "Suspense";
|
||||
case REACT_SUSPENSE_LIST_TYPE:
|
||||
return "SuspenseList";
|
||||
case REACT_ACTIVITY_TYPE:
|
||||
return "Activity";
|
||||
}
|
||||
if ("object" === typeof type)
|
||||
switch (
|
||||
("number" === typeof type.tag &&
|
||||
console.error(
|
||||
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
||||
),
|
||||
type.$$typeof)
|
||||
) {
|
||||
case REACT_PORTAL_TYPE:
|
||||
return "Portal";
|
||||
case REACT_CONTEXT_TYPE:
|
||||
return (type.displayName || "Context") + ".Provider";
|
||||
case REACT_CONSUMER_TYPE:
|
||||
return (type._context.displayName || "Context") + ".Consumer";
|
||||
case REACT_FORWARD_REF_TYPE:
|
||||
var innerType = type.render;
|
||||
type = type.displayName;
|
||||
type ||
|
||||
((type = innerType.displayName || innerType.name || ""),
|
||||
(type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
|
||||
return type;
|
||||
case REACT_MEMO_TYPE:
|
||||
return (
|
||||
(innerType = type.displayName || null),
|
||||
null !== innerType
|
||||
? innerType
|
||||
: getComponentNameFromType(type.type) || "Memo"
|
||||
);
|
||||
case REACT_LAZY_TYPE:
|
||||
innerType = type._payload;
|
||||
type = type._init;
|
||||
try {
|
||||
return getComponentNameFromType(type(innerType));
|
||||
} catch (x) {}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function testStringCoercion(value) {
|
||||
return "" + value;
|
||||
}
|
||||
function checkKeyStringCoercion(value) {
|
||||
try {
|
||||
testStringCoercion(value);
|
||||
var JSCompiler_inline_result = !1;
|
||||
} catch (e) {
|
||||
JSCompiler_inline_result = !0;
|
||||
}
|
||||
if (JSCompiler_inline_result) {
|
||||
JSCompiler_inline_result = console;
|
||||
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
||||
var JSCompiler_inline_result$jscomp$0 =
|
||||
("function" === typeof Symbol &&
|
||||
Symbol.toStringTag &&
|
||||
value[Symbol.toStringTag]) ||
|
||||
value.constructor.name ||
|
||||
"Object";
|
||||
JSCompiler_temp_const.call(
|
||||
JSCompiler_inline_result,
|
||||
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
||||
JSCompiler_inline_result$jscomp$0
|
||||
);
|
||||
return testStringCoercion(value);
|
||||
}
|
||||
}
|
||||
function getTaskName(type) {
|
||||
if (type === REACT_FRAGMENT_TYPE) return "<>";
|
||||
if (
|
||||
"object" === typeof type &&
|
||||
null !== type &&
|
||||
type.$$typeof === REACT_LAZY_TYPE
|
||||
)
|
||||
return "<...>";
|
||||
try {
|
||||
var name = getComponentNameFromType(type);
|
||||
return name ? "<" + name + ">" : "<...>";
|
||||
} catch (x) {
|
||||
return "<...>";
|
||||
}
|
||||
}
|
||||
function getOwner() {
|
||||
var dispatcher = ReactSharedInternalsServer.A;
|
||||
return null === dispatcher ? null : dispatcher.getOwner();
|
||||
}
|
||||
function UnknownOwner() {
|
||||
return Error("react-stack-top-frame");
|
||||
}
|
||||
function hasValidKey(config) {
|
||||
if (hasOwnProperty.call(config, "key")) {
|
||||
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
||||
if (getter && getter.isReactWarning) return !1;
|
||||
}
|
||||
return void 0 !== config.key;
|
||||
}
|
||||
function defineKeyPropWarningGetter(props, displayName) {
|
||||
function warnAboutAccessingKey() {
|
||||
specialPropKeyWarningShown ||
|
||||
((specialPropKeyWarningShown = !0),
|
||||
console.error(
|
||||
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
||||
displayName
|
||||
));
|
||||
}
|
||||
warnAboutAccessingKey.isReactWarning = !0;
|
||||
Object.defineProperty(props, "key", {
|
||||
get: warnAboutAccessingKey,
|
||||
configurable: !0
|
||||
});
|
||||
}
|
||||
function elementRefGetterWithDeprecationWarning() {
|
||||
var componentName = getComponentNameFromType(this.type);
|
||||
didWarnAboutElementRef[componentName] ||
|
||||
((didWarnAboutElementRef[componentName] = !0),
|
||||
console.error(
|
||||
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
||||
));
|
||||
componentName = this.props.ref;
|
||||
return void 0 !== componentName ? componentName : null;
|
||||
}
|
||||
function ReactElement(
|
||||
type,
|
||||
key,
|
||||
self,
|
||||
source,
|
||||
owner,
|
||||
props,
|
||||
debugStack,
|
||||
debugTask
|
||||
) {
|
||||
self = props.ref;
|
||||
type = {
|
||||
$$typeof: REACT_ELEMENT_TYPE,
|
||||
type: type,
|
||||
key: key,
|
||||
props: props,
|
||||
_owner: owner
|
||||
};
|
||||
null !== (void 0 !== self ? self : null)
|
||||
? Object.defineProperty(type, "ref", {
|
||||
enumerable: !1,
|
||||
get: elementRefGetterWithDeprecationWarning
|
||||
})
|
||||
: Object.defineProperty(type, "ref", { enumerable: !1, value: null });
|
||||
type._store = {};
|
||||
Object.defineProperty(type._store, "validated", {
|
||||
configurable: !1,
|
||||
enumerable: !1,
|
||||
writable: !0,
|
||||
value: 0
|
||||
});
|
||||
Object.defineProperty(type, "_debugInfo", {
|
||||
configurable: !1,
|
||||
enumerable: !1,
|
||||
writable: !0,
|
||||
value: null
|
||||
});
|
||||
Object.defineProperty(type, "_debugStack", {
|
||||
configurable: !1,
|
||||
enumerable: !1,
|
||||
writable: !0,
|
||||
value: debugStack
|
||||
});
|
||||
Object.defineProperty(type, "_debugTask", {
|
||||
configurable: !1,
|
||||
enumerable: !1,
|
||||
writable: !0,
|
||||
value: debugTask
|
||||
});
|
||||
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
||||
return type;
|
||||
}
|
||||
function jsxDEVImpl(
|
||||
type,
|
||||
config,
|
||||
maybeKey,
|
||||
isStaticChildren,
|
||||
source,
|
||||
self,
|
||||
debugStack,
|
||||
debugTask
|
||||
) {
|
||||
var children = config.children;
|
||||
if (void 0 !== children)
|
||||
if (isStaticChildren)
|
||||
if (isArrayImpl(children)) {
|
||||
for (
|
||||
isStaticChildren = 0;
|
||||
isStaticChildren < children.length;
|
||||
isStaticChildren++
|
||||
)
|
||||
validateChildKeys(children[isStaticChildren]);
|
||||
Object.freeze && Object.freeze(children);
|
||||
} else
|
||||
console.error(
|
||||
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
||||
);
|
||||
else validateChildKeys(children);
|
||||
if (hasOwnProperty.call(config, "key")) {
|
||||
children = getComponentNameFromType(type);
|
||||
var keys = Object.keys(config).filter(function (k) {
|
||||
return "key" !== k;
|
||||
});
|
||||
isStaticChildren =
|
||||
0 < keys.length
|
||||
? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
|
||||
: "{key: someKey}";
|
||||
didWarnAboutKeySpread[children + isStaticChildren] ||
|
||||
((keys =
|
||||
0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
|
||||
console.error(
|
||||
'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
|
||||
isStaticChildren,
|
||||
children,
|
||||
keys,
|
||||
children
|
||||
),
|
||||
(didWarnAboutKeySpread[children + isStaticChildren] = !0));
|
||||
}
|
||||
children = null;
|
||||
void 0 !== maybeKey &&
|
||||
(checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
|
||||
hasValidKey(config) &&
|
||||
(checkKeyStringCoercion(config.key), (children = "" + config.key));
|
||||
if ("key" in config) {
|
||||
maybeKey = {};
|
||||
for (var propName in config)
|
||||
"key" !== propName && (maybeKey[propName] = config[propName]);
|
||||
} else maybeKey = config;
|
||||
children &&
|
||||
defineKeyPropWarningGetter(
|
||||
maybeKey,
|
||||
"function" === typeof type
|
||||
? type.displayName || type.name || "Unknown"
|
||||
: type
|
||||
);
|
||||
return ReactElement(
|
||||
type,
|
||||
children,
|
||||
self,
|
||||
source,
|
||||
getOwner(),
|
||||
maybeKey,
|
||||
debugStack,
|
||||
debugTask
|
||||
);
|
||||
}
|
||||
function validateChildKeys(node) {
|
||||
"object" === typeof node &&
|
||||
null !== node &&
|
||||
node.$$typeof === REACT_ELEMENT_TYPE &&
|
||||
node._store &&
|
||||
(node._store.validated = 1);
|
||||
}
|
||||
var React = require("react"),
|
||||
REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
||||
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
||||
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
||||
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
||||
REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
||||
Symbol.for("react.provider");
|
||||
var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
|
||||
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
||||
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
||||
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
||||
REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
|
||||
REACT_MEMO_TYPE = Symbol.for("react.memo"),
|
||||
REACT_LAZY_TYPE = Symbol.for("react.lazy"),
|
||||
REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
|
||||
REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
|
||||
ReactSharedInternalsServer =
|
||||
React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
||||
if (!ReactSharedInternalsServer)
|
||||
throw Error(
|
||||
'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.'
|
||||
);
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty,
|
||||
isArrayImpl = Array.isArray,
|
||||
createTask = console.createTask
|
||||
? console.createTask
|
||||
: function () {
|
||||
return null;
|
||||
};
|
||||
React = {
|
||||
"react-stack-bottom-frame": function (callStackForError) {
|
||||
return callStackForError();
|
||||
}
|
||||
};
|
||||
var specialPropKeyWarningShown;
|
||||
var didWarnAboutElementRef = {};
|
||||
var unknownOwnerDebugStack = React["react-stack-bottom-frame"].bind(
|
||||
React,
|
||||
UnknownOwner
|
||||
)();
|
||||
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
||||
var didWarnAboutKeySpread = {};
|
||||
exports.Fragment = REACT_FRAGMENT_TYPE;
|
||||
exports.jsx = function (type, config, maybeKey, source, self) {
|
||||
var trackActualOwner =
|
||||
1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++;
|
||||
return jsxDEVImpl(
|
||||
type,
|
||||
config,
|
||||
maybeKey,
|
||||
!1,
|
||||
source,
|
||||
self,
|
||||
trackActualOwner
|
||||
? Error("react-stack-top-frame")
|
||||
: unknownOwnerDebugStack,
|
||||
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
||||
);
|
||||
};
|
||||
exports.jsxDEV = function (
|
||||
type,
|
||||
config,
|
||||
maybeKey,
|
||||
isStaticChildren,
|
||||
source,
|
||||
self
|
||||
) {
|
||||
var trackActualOwner =
|
||||
1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++;
|
||||
return jsxDEVImpl(
|
||||
type,
|
||||
config,
|
||||
maybeKey,
|
||||
isStaticChildren,
|
||||
source,
|
||||
self,
|
||||
trackActualOwner
|
||||
? Error("react-stack-top-frame")
|
||||
: unknownOwnerDebugStack,
|
||||
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
||||
);
|
||||
};
|
||||
exports.jsxs = function (type, config, maybeKey, source, self) {
|
||||
var trackActualOwner =
|
||||
1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++;
|
||||
return jsxDEVImpl(
|
||||
type,
|
||||
config,
|
||||
maybeKey,
|
||||
!0,
|
||||
source,
|
||||
self,
|
||||
trackActualOwner
|
||||
? Error("react-stack-top-frame")
|
||||
: unknownOwnerDebugStack,
|
||||
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
||||
);
|
||||
};
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"4":1.31335,"52":0.07658,"60":0.00383,"64":0.00383,"68":0.00766,"72":0.00383,"75":0.00383,"78":0.00383,"88":0.00383,"91":0.00383,"95":0.00383,"100":0.00383,"101":0.00383,"102":0.00383,"106":0.00383,"113":0.01149,"115":0.53989,"118":0.00383,"120":0.00383,"122":0.00766,"123":0.02297,"125":0.01149,"127":0.00383,"128":0.06126,"129":0.00383,"130":0.00383,"131":0.00383,"132":0.00383,"133":0.01149,"134":0.03829,"135":0.27186,"136":0.92662,"137":0.00383,_:"2 3 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 54 55 56 57 58 59 61 62 63 65 66 67 69 70 71 73 74 76 77 79 80 81 82 83 84 85 86 87 89 90 92 93 94 96 97 98 99 103 104 105 107 108 109 110 111 112 114 116 117 119 121 124 126 138 139 140 3.5 3.6"},D:{"39":0.00383,"40":0.00383,"41":0.00383,"42":0.00383,"43":0.00383,"44":0.00766,"45":0.00383,"46":0.00383,"47":0.01149,"48":0.00383,"49":0.08041,"50":0.00766,"51":0.00383,"52":0.00383,"53":0.00383,"54":0.00766,"55":0.00383,"56":0.00766,"57":0.00383,"58":0.00383,"59":0.00383,"60":0.00383,"63":0.00383,"64":0.00383,"65":0.00766,"66":0.00766,"69":0.02297,"70":0.00766,"71":0.00766,"72":0.00766,"73":0.02297,"74":0.00383,"75":0.00766,"76":0.00766,"77":0.00383,"78":0.00383,"79":0.02297,"80":0.00383,"81":0.01532,"83":0.01149,"84":0.00383,"85":0.03063,"86":0.00383,"87":0.03063,"88":0.00766,"89":0.00383,"90":0.01149,"91":0.01149,"92":0.01915,"93":0.03829,"94":0.01915,"95":0.00766,"96":0.00383,"97":0.00766,"98":0.0268,"99":0.06509,"100":0.01149,"101":0.0268,"102":0.01532,"103":0.06509,"104":0.07658,"105":0.01149,"106":0.0268,"107":0.03829,"108":0.04978,"109":3.57246,"110":0.03829,"111":0.02297,"112":0.01915,"113":0.00383,"114":0.01915,"115":0.00383,"116":0.10338,"117":0.01149,"118":0.01149,"119":0.02297,"120":0.0268,"121":0.04212,"122":0.06509,"123":0.03446,"124":0.06509,"125":0.28335,"126":0.06126,"127":0.03829,"128":0.07658,"129":0.03446,"130":0.07275,"131":0.27952,"132":0.24123,"133":5.1232,"134":10.83607,"135":0.00383,"136":0.00383,_:"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 67 68 137 138"},F:{"79":0.00383,"85":0.00383,"87":0.03446,"88":0.01149,"95":0.17231,"102":0.00766,"107":0.00383,"111":0.00383,"112":0.00383,"114":0.00766,"116":0.49777,"117":1.59286,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 80 81 82 83 84 86 89 90 91 92 93 94 96 97 98 99 100 101 103 104 105 106 108 109 110 113 115 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"18":0.00383,"85":0.00766,"89":0.00383,"92":0.04212,"100":0.00383,"102":0.00766,"105":0.00383,"108":0.00766,"109":0.06126,"114":0.03063,"116":0.00383,"121":0.01149,"122":0.01915,"124":0.01532,"125":0.00383,"126":0.00766,"127":0.00383,"128":0.00383,"129":0.01532,"130":0.00766,"131":0.06126,"132":0.08424,"133":0.94959,"134":2.17487,_:"12 13 14 15 16 17 79 80 81 83 84 86 87 88 90 91 93 94 95 96 97 98 99 101 103 104 106 107 110 111 112 113 115 117 118 119 120 123"},E:{"14":0.00766,_:"0 4 5 6 7 8 9 10 11 12 13 15 3.1 3.2 6.1 7.1 9.1 10.1 15.2-15.3 16.2 16.4","5.1":0.01915,"11.1":0.00383,"12.1":0.00383,"13.1":0.01149,"14.1":0.01149,"15.1":0.00383,"15.4":0.01149,"15.5":0.00383,"15.6":0.03446,"16.0":0.00383,"16.1":0.00383,"16.3":0.00766,"16.5":0.00383,"16.6":0.04595,"17.0":0.00383,"17.1":0.01532,"17.2":0.00383,"17.3":0.01149,"17.4":0.01149,"17.5":0.01532,"17.6":0.04595,"18.0":0.00383,"18.1":0.02297,"18.2":0.00766,"18.3":0.20294,"18.4":0.00383},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.0008,"5.0-5.1":0,"6.0-6.1":0.00241,"7.0-7.1":0.00161,"8.1-8.4":0,"9.0-9.2":0.00121,"9.3":0.00563,"10.0-10.2":0.0004,"10.3":0.00925,"11.0-11.2":0.04265,"11.3-11.4":0.00282,"12.0-12.1":0.00161,"12.2-12.5":0.03983,"13.0-13.1":0.0008,"13.2":0.00121,"13.3":0.00161,"13.4-13.7":0.00563,"14.0-14.4":0.01408,"14.5-14.8":0.0169,"15.0-15.1":0.00925,"15.2-15.3":0.00925,"15.4":0.01127,"15.5":0.01288,"15.6-15.8":0.15853,"16.0":0.02253,"16.1":0.04627,"16.2":0.02414,"16.3":0.04184,"16.4":0.00925,"16.5":0.0173,"16.6-16.7":0.1879,"17.0":0.01127,"17.1":0.02012,"17.2":0.01529,"17.3":0.02132,"17.4":0.04265,"17.5":0.09495,"17.6-17.7":0.27561,"18.0":0.07725,"18.1":0.25268,"18.2":0.11306,"18.3":2.363,"18.4":0.035},P:{"4":0.07246,"21":0.01035,"22":0.01035,"23":0.03105,"24":0.0207,"25":0.0207,"26":0.04141,"27":0.53827,_:"20 5.0-5.4 6.2-6.4 8.2 9.2 10.1 11.1-11.2 12.0 15.0 18.0 19.0","7.2-7.4":0.09316,"13.0":0.0207,"14.0":0.01035,"16.0":0.06211,"17.0":0.03105},I:{"0":0.01847,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00001,"4.4":0,"4.4.3-4.4.4":0.00002},K:{"0":0.46283,_:"10 11 12 11.1 11.5 12.1"},A:{"9":0.00425,"11":0.03404,_:"6 7 8 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.17896},Q:{_:"14.9"},O:{"0":0.03086},H:{"0":0},L:{"0":61.27741}};
|
||||
Reference in New Issue
Block a user