flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
7
BACK_BACK/node_modules/data-urls/LICENSE.txt
generated
vendored
Executable file
7
BACK_BACK/node_modules/data-urls/LICENSE.txt
generated
vendored
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
Copyright © 2017–2018 Domenic Denicola <d@domenic.me>
|
||||
|
||||
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.
|
||||
64
BACK_BACK/node_modules/data-urls/README.md
generated
vendored
Executable file
64
BACK_BACK/node_modules/data-urls/README.md
generated
vendored
Executable file
|
|
@ -0,0 +1,64 @@
|
|||
# Parse `data:` URLs
|
||||
|
||||
This package helps you parse `data:` URLs [according to the WHATWG Fetch Standard](https://fetch.spec.whatwg.org/#data-urls):
|
||||
|
||||
```js
|
||||
const parseDataURL = require("data-url");
|
||||
|
||||
const textExample = parseDataURL("data:,Hello%2C%20World!");
|
||||
console.log(textExample.mimeType.toString()); // "text/plain;charset=US-ASCII"
|
||||
console.log(textExample.body.toString()); // "Hello, World!"
|
||||
|
||||
const htmlExample = dataURL("data:text/html,%3Ch1%3EHello%2C%20World!%3C%2Fh1%3E");
|
||||
console.log(htmlExample.mimeType.toString()); // "text/html"
|
||||
console.log(htmlExample.body.toString()); // <h1>Hello, World!</h1>
|
||||
|
||||
const pngExample = parseDataURL("data:image/png;base64,iVBORw0KGgoAAA" +
|
||||
"ANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4" +
|
||||
"//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU" +
|
||||
"5ErkJggg==");
|
||||
console.log(pngExample.mimeType.toString()); // "image/png"
|
||||
console.log(pngExample.body); // <Buffer 89 50 4e 47 0d ... >
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
This package's main module's default export is a function that accepts a string and returns a `{ mimeType, body }` object, or `null` if the result cannot be parsed as a `data:` URL.
|
||||
|
||||
- The `mimeType` property is an instance of [whatwg-mimetype](https://www.npmjs.com/package/whatwg-mimetype)'s `MIMEType` class.
|
||||
- The `body` property is a Node.js [`Buffer`](https://nodejs.org/docs/latest/api/buffer.html) instance.
|
||||
|
||||
As shown in the examples above, both of these have useful `toString()` methods for manipulating them as string values. However…
|
||||
|
||||
### A word of caution on string decoding
|
||||
|
||||
Because Node.js's `Buffer.prototype.toString()` assumes a UTF-8 encoding, simply doing `dataURL.body.toString()` may not work correctly if the `data:` URL's contents were not originally written in UTF-8. This includes if the encoding is "US-ASCII", [aka windows-1252](https://encoding.spec.whatwg.org/#names-and-labels), which is notable for being the default in many cases.
|
||||
|
||||
A more complete decoding example would use the [whatwg-encoding](https://www.npmjs.com/package/whatwg-encoding) package as follows:
|
||||
|
||||
```js
|
||||
const parseDataURL = require("data-url");
|
||||
const { labelToName, decode } = require("whatwg-encoding");
|
||||
|
||||
const dataURL = parseDataURL(arbitraryString);
|
||||
const encodingName = labelToName(dataURL.mimeType.parameters.get("charset"));
|
||||
const bodyDecoded = decode(dataURL.body, encodingName);
|
||||
```
|
||||
|
||||
For example, given an `arbitraryString` of `data:,Hello!`, this will produce a `bodyDecoded` of `"Hello!"`, as expected. But given an `arbitraryString` of `"data:,Héllo!"`, this will correctly produce a `bodyDecoded` of `"Héllo!"`, whereas just doing `dataURL.body.toString()` will give back `"Héllo!"`.
|
||||
|
||||
In summary, only use `dataURL.body.toString()` when you are very certain your data is inside the ASCII range (i.e. code points within the range U+0000 to U+007F).
|
||||
|
||||
### Advanced functionality: parsing from a URL record
|
||||
|
||||
If you are using the [whatwg-url](https://github.com/jsdom/whatwg-url) package, you may already have a "URL record" object on hand, as produced by that package's `parseURL` export. In that case, you can use this package's `fromURLRecord` export to save a bit of work:
|
||||
|
||||
```js
|
||||
const { parseURL } = require("whatwg-url");
|
||||
const dataURLFromURLRecord = require("data-url").fromURLRecord;
|
||||
|
||||
const urlRecord = parseURL("data:,Hello%2C%20World!");
|
||||
const dataURL = dataURLFromURLRecord(urlRecord);
|
||||
```
|
||||
|
||||
In practice, we expect this functionality only to be used by consumers like [jsdom](https://www.npmjs.com/package/jsdom), which are using these packages at a very low level.
|
||||
74
BACK_BACK/node_modules/data-urls/lib/parser.js
generated
vendored
Executable file
74
BACK_BACK/node_modules/data-urls/lib/parser.js
generated
vendored
Executable file
|
|
@ -0,0 +1,74 @@
|
|||
"use strict";
|
||||
const MIMEType = require("whatwg-mimetype");
|
||||
const { parseURL, serializeURL } = require("whatwg-url");
|
||||
const {
|
||||
stripLeadingAndTrailingASCIIWhitespace,
|
||||
stringPercentDecode,
|
||||
isomorphicDecode,
|
||||
forgivingBase64Decode
|
||||
} = require("./utils.js");
|
||||
|
||||
module.exports = stringInput => {
|
||||
const urlRecord = parseURL(stringInput);
|
||||
|
||||
if (urlRecord === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return module.exports.fromURLRecord(urlRecord);
|
||||
};
|
||||
|
||||
module.exports.fromURLRecord = urlRecord => {
|
||||
if (urlRecord.scheme !== "data") {
|
||||
return null;
|
||||
}
|
||||
|
||||
const input = serializeURL(urlRecord, true).substring("data:".length);
|
||||
|
||||
let position = 0;
|
||||
|
||||
let mimeType = "";
|
||||
while (position < input.length && input[position] !== ",") {
|
||||
mimeType += input[position];
|
||||
++position;
|
||||
}
|
||||
mimeType = stripLeadingAndTrailingASCIIWhitespace(mimeType);
|
||||
|
||||
if (position === input.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
++position;
|
||||
|
||||
const encodedBody = input.substring(position);
|
||||
|
||||
let body = stringPercentDecode(encodedBody);
|
||||
|
||||
// Can't use /i regexp flag because it isn't restricted to ASCII.
|
||||
const mimeTypeBase64MatchResult = /(.*); *[Bb][Aa][Ss][Ee]64$/.exec(mimeType);
|
||||
if (mimeTypeBase64MatchResult) {
|
||||
const stringBody = isomorphicDecode(body);
|
||||
body = forgivingBase64Decode(stringBody);
|
||||
|
||||
if (body === null) {
|
||||
return null;
|
||||
}
|
||||
mimeType = mimeTypeBase64MatchResult[1];
|
||||
}
|
||||
|
||||
if (mimeType.startsWith(";")) {
|
||||
mimeType = "text/plain" + mimeType;
|
||||
}
|
||||
|
||||
let mimeTypeRecord;
|
||||
try {
|
||||
mimeTypeRecord = new MIMEType(mimeType);
|
||||
} catch (e) {
|
||||
mimeTypeRecord = new MIMEType("text/plain;charset=US-ASCII");
|
||||
}
|
||||
|
||||
return {
|
||||
mimeType: mimeTypeRecord,
|
||||
body
|
||||
};
|
||||
};
|
||||
23
BACK_BACK/node_modules/data-urls/lib/utils.js
generated
vendored
Executable file
23
BACK_BACK/node_modules/data-urls/lib/utils.js
generated
vendored
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
"use strict";
|
||||
const { percentDecode } = require("whatwg-url");
|
||||
const { atob } = require("abab");
|
||||
|
||||
exports.stripLeadingAndTrailingASCIIWhitespace = string => {
|
||||
return string.replace(/^[ \t\n\f\r]+/, "").replace(/[ \t\n\f\r]+$/, "");
|
||||
};
|
||||
|
||||
exports.stringPercentDecode = input => {
|
||||
return percentDecode(Buffer.from(input, "utf-8"));
|
||||
};
|
||||
|
||||
exports.isomorphicDecode = input => {
|
||||
return input.toString("binary");
|
||||
};
|
||||
|
||||
exports.forgivingBase64Decode = data => {
|
||||
const asString = atob(data);
|
||||
if (asString === null) {
|
||||
return null;
|
||||
}
|
||||
return Buffer.from(asString, "binary");
|
||||
};
|
||||
20
BACK_BACK/node_modules/data-urls/node_modules/punycode/LICENSE-MIT.txt
generated
vendored
Executable file
20
BACK_BACK/node_modules/data-urls/node_modules/punycode/LICENSE-MIT.txt
generated
vendored
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
Copyright Mathias Bynens <https://mathiasbynens.be/>
|
||||
|
||||
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.
|
||||
148
BACK_BACK/node_modules/data-urls/node_modules/punycode/README.md
generated
vendored
Executable file
148
BACK_BACK/node_modules/data-urls/node_modules/punycode/README.md
generated
vendored
Executable file
|
|
@ -0,0 +1,148 @@
|
|||
# Punycode.js [](https://www.npmjs.com/package/punycode) [](https://www.jsdelivr.com/package/npm/punycode)
|
||||
|
||||
Punycode.js is a robust Punycode converter that fully complies to [RFC 3492](https://tools.ietf.org/html/rfc3492) and [RFC 5891](https://tools.ietf.org/html/rfc5891).
|
||||
|
||||
This JavaScript library is the result of comparing, optimizing and documenting different open-source implementations of the Punycode algorithm:
|
||||
|
||||
* [The C example code from RFC 3492](https://tools.ietf.org/html/rfc3492#appendix-C)
|
||||
* [`punycode.c` by _Markus W. Scherer_ (IBM)](http://opensource.apple.com/source/ICU/ICU-400.42/icuSources/common/punycode.c)
|
||||
* [`punycode.c` by _Ben Noordhuis_](https://github.com/bnoordhuis/punycode/blob/master/punycode.c)
|
||||
* [JavaScript implementation by _some_](http://stackoverflow.com/questions/183485/can-anyone-recommend-a-good-free-javascript-for-punycode-to-unicode-conversion/301287#301287)
|
||||
* [`punycode.js` by _Ben Noordhuis_](https://github.com/joyent/node/blob/426298c8c1c0d5b5224ac3658c41e7c2a3fe9377/lib/punycode.js) (note: [not fully compliant](https://github.com/joyent/node/issues/2072))
|
||||
|
||||
This project was [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with Node.js from [v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc) until [v7](https://github.com/nodejs/node/pull/7941) (soft-deprecated).
|
||||
|
||||
This project provides a CommonJS module that uses ES2015+ features and JavaScript module, which work in modern Node.js versions and browsers. For the old Punycode.js version that offers the same functionality in a UMD build with support for older pre-ES2015 runtimes, including Rhino, Ringo, and Narwhal, see [v1.4.1](https://github.com/mathiasbynens/punycode.js/releases/tag/v1.4.1).
|
||||
|
||||
## Installation
|
||||
|
||||
Via [npm](https://www.npmjs.com/):
|
||||
|
||||
```bash
|
||||
npm install punycode --save
|
||||
```
|
||||
|
||||
In [Node.js](https://nodejs.org/):
|
||||
|
||||
> ⚠️ Note that userland modules don't hide core modules.
|
||||
> For example, `require('punycode')` still imports the deprecated core module even if you executed `npm install punycode`.
|
||||
> Use `require('punycode/')` to import userland modules rather than core modules.
|
||||
|
||||
```js
|
||||
const punycode = require('punycode/');
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `punycode.decode(string)`
|
||||
|
||||
Converts a Punycode string of ASCII symbols to a string of Unicode symbols.
|
||||
|
||||
```js
|
||||
// decode domain name parts
|
||||
punycode.decode('maana-pta'); // 'mañana'
|
||||
punycode.decode('--dqo34k'); // '☃-⌘'
|
||||
```
|
||||
|
||||
### `punycode.encode(string)`
|
||||
|
||||
Converts a string of Unicode symbols to a Punycode string of ASCII symbols.
|
||||
|
||||
```js
|
||||
// encode domain name parts
|
||||
punycode.encode('mañana'); // 'maana-pta'
|
||||
punycode.encode('☃-⌘'); // '--dqo34k'
|
||||
```
|
||||
|
||||
### `punycode.toUnicode(input)`
|
||||
|
||||
Converts a Punycode string representing a domain name or an email address to Unicode. Only the Punycoded parts of the input will be converted, i.e. it doesn’t matter if you call it on a string that has already been converted to Unicode.
|
||||
|
||||
```js
|
||||
// decode domain names
|
||||
punycode.toUnicode('xn--maana-pta.com');
|
||||
// → 'mañana.com'
|
||||
punycode.toUnicode('xn----dqo34k.com');
|
||||
// → '☃-⌘.com'
|
||||
|
||||
// decode email addresses
|
||||
punycode.toUnicode('джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq');
|
||||
// → 'джумла@джpумлатест.bрфa'
|
||||
```
|
||||
|
||||
### `punycode.toASCII(input)`
|
||||
|
||||
Converts a lowercased Unicode string representing a domain name or an email address to Punycode. Only the non-ASCII parts of the input will be converted, i.e. it doesn’t matter if you call it with a domain that’s already in ASCII.
|
||||
|
||||
```js
|
||||
// encode domain names
|
||||
punycode.toASCII('mañana.com');
|
||||
// → 'xn--maana-pta.com'
|
||||
punycode.toASCII('☃-⌘.com');
|
||||
// → 'xn----dqo34k.com'
|
||||
|
||||
// encode email addresses
|
||||
punycode.toASCII('джумла@джpумлатест.bрфa');
|
||||
// → 'джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq'
|
||||
```
|
||||
|
||||
### `punycode.ucs2`
|
||||
|
||||
#### `punycode.ucs2.decode(string)`
|
||||
|
||||
Creates an array containing the numeric code point values of each Unicode symbol in the string. While [JavaScript uses UCS-2 internally](https://mathiasbynens.be/notes/javascript-encoding), this function will convert a pair of surrogate halves (each of which UCS-2 exposes as separate characters) into a single code point, matching UTF-16.
|
||||
|
||||
```js
|
||||
punycode.ucs2.decode('abc');
|
||||
// → [0x61, 0x62, 0x63]
|
||||
// surrogate pair for U+1D306 TETRAGRAM FOR CENTRE:
|
||||
punycode.ucs2.decode('\uD834\uDF06');
|
||||
// → [0x1D306]
|
||||
```
|
||||
|
||||
#### `punycode.ucs2.encode(codePoints)`
|
||||
|
||||
Creates a string based on an array of numeric code point values.
|
||||
|
||||
```js
|
||||
punycode.ucs2.encode([0x61, 0x62, 0x63]);
|
||||
// → 'abc'
|
||||
punycode.ucs2.encode([0x1D306]);
|
||||
// → '\uD834\uDF06'
|
||||
```
|
||||
|
||||
### `punycode.version`
|
||||
|
||||
A string representing the current Punycode.js version number.
|
||||
|
||||
## For maintainers
|
||||
|
||||
### How to publish a new release
|
||||
|
||||
1. On the `main` branch, bump the version number in `package.json`:
|
||||
|
||||
```sh
|
||||
npm version patch -m 'Release v%s'
|
||||
```
|
||||
|
||||
Instead of `patch`, use `minor` or `major` [as needed](https://semver.org/).
|
||||
|
||||
Note that this produces a Git commit + tag.
|
||||
|
||||
1. Push the release commit and tag:
|
||||
|
||||
```sh
|
||||
git push && git push --tags
|
||||
```
|
||||
|
||||
Our CI then automatically publishes the new release to npm, under both the [`punycode`](https://www.npmjs.com/package/punycode) and [`punycode.js`](https://www.npmjs.com/package/punycode.js) names.
|
||||
|
||||
## Author
|
||||
|
||||
| [](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## License
|
||||
|
||||
Punycode.js is available under the [MIT](https://mths.be/mit) license.
|
||||
58
BACK_BACK/node_modules/data-urls/node_modules/punycode/package.json
generated
vendored
Executable file
58
BACK_BACK/node_modules/data-urls/node_modules/punycode/package.json
generated
vendored
Executable file
|
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
"name": "punycode",
|
||||
"version": "2.3.1",
|
||||
"description": "A robust Punycode converter that fully complies to RFC 3492 and RFC 5891, and works on nearly all JavaScript platforms.",
|
||||
"homepage": "https://mths.be/punycode",
|
||||
"main": "punycode.js",
|
||||
"jsnext:main": "punycode.es6.js",
|
||||
"module": "punycode.es6.js",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"keywords": [
|
||||
"punycode",
|
||||
"unicode",
|
||||
"idn",
|
||||
"idna",
|
||||
"dns",
|
||||
"url",
|
||||
"domain"
|
||||
],
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Mathias Bynens",
|
||||
"url": "https://mathiasbynens.be/"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Mathias Bynens",
|
||||
"url": "https://mathiasbynens.be/"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mathiasbynens/punycode.js.git"
|
||||
},
|
||||
"bugs": "https://github.com/mathiasbynens/punycode.js/issues",
|
||||
"files": [
|
||||
"LICENSE-MIT.txt",
|
||||
"punycode.js",
|
||||
"punycode.es6.js"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "mocha tests",
|
||||
"build": "node scripts/prepublish.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"codecov": "^3.8.3",
|
||||
"nyc": "^15.1.0",
|
||||
"mocha": "^10.2.0"
|
||||
},
|
||||
"jspm": {
|
||||
"map": {
|
||||
"./punycode.js": {
|
||||
"node": "@node/punycode"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
444
BACK_BACK/node_modules/data-urls/node_modules/punycode/punycode.es6.js
generated
vendored
Executable file
444
BACK_BACK/node_modules/data-urls/node_modules/punycode/punycode.es6.js
generated
vendored
Executable file
|
|
@ -0,0 +1,444 @@
|
|||
'use strict';
|
||||
|
||||
/** Highest positive signed 32-bit float value */
|
||||
const maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
|
||||
|
||||
/** Bootstring parameters */
|
||||
const base = 36;
|
||||
const tMin = 1;
|
||||
const tMax = 26;
|
||||
const skew = 38;
|
||||
const damp = 700;
|
||||
const initialBias = 72;
|
||||
const initialN = 128; // 0x80
|
||||
const delimiter = '-'; // '\x2D'
|
||||
|
||||
/** Regular expressions */
|
||||
const regexPunycode = /^xn--/;
|
||||
const regexNonASCII = /[^\0-\x7F]/; // Note: U+007F DEL is excluded too.
|
||||
const regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
|
||||
|
||||
/** Error messages */
|
||||
const errors = {
|
||||
'overflow': 'Overflow: input needs wider integers to process',
|
||||
'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
||||
'invalid-input': 'Invalid input'
|
||||
};
|
||||
|
||||
/** Convenience shortcuts */
|
||||
const baseMinusTMin = base - tMin;
|
||||
const floor = Math.floor;
|
||||
const stringFromCharCode = String.fromCharCode;
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* A generic error utility function.
|
||||
* @private
|
||||
* @param {String} type The error type.
|
||||
* @returns {Error} Throws a `RangeError` with the applicable error message.
|
||||
*/
|
||||
function error(type) {
|
||||
throw new RangeError(errors[type]);
|
||||
}
|
||||
|
||||
/**
|
||||
* A generic `Array#map` utility function.
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
* @param {Function} callback The function that gets called for every array
|
||||
* item.
|
||||
* @returns {Array} A new array of values returned by the callback function.
|
||||
*/
|
||||
function map(array, callback) {
|
||||
const result = [];
|
||||
let length = array.length;
|
||||
while (length--) {
|
||||
result[length] = callback(array[length]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple `Array#map`-like wrapper to work with domain name strings or email
|
||||
* addresses.
|
||||
* @private
|
||||
* @param {String} domain The domain name or email address.
|
||||
* @param {Function} callback The function that gets called for every
|
||||
* character.
|
||||
* @returns {String} A new string of characters returned by the callback
|
||||
* function.
|
||||
*/
|
||||
function mapDomain(domain, callback) {
|
||||
const parts = domain.split('@');
|
||||
let result = '';
|
||||
if (parts.length > 1) {
|
||||
// In email addresses, only the domain name should be punycoded. Leave
|
||||
// the local part (i.e. everything up to `@`) intact.
|
||||
result = parts[0] + '@';
|
||||
domain = parts[1];
|
||||
}
|
||||
// Avoid `split(regex)` for IE8 compatibility. See #17.
|
||||
domain = domain.replace(regexSeparators, '\x2E');
|
||||
const labels = domain.split('.');
|
||||
const encoded = map(labels, callback).join('.');
|
||||
return result + encoded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an array containing the numeric code points of each Unicode
|
||||
* character in the string. While JavaScript uses UCS-2 internally,
|
||||
* this function will convert a pair of surrogate halves (each of which
|
||||
* UCS-2 exposes as separate characters) into a single code point,
|
||||
* matching UTF-16.
|
||||
* @see `punycode.ucs2.encode`
|
||||
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
||||
* @memberOf punycode.ucs2
|
||||
* @name decode
|
||||
* @param {String} string The Unicode input string (UCS-2).
|
||||
* @returns {Array} The new array of code points.
|
||||
*/
|
||||
function ucs2decode(string) {
|
||||
const output = [];
|
||||
let counter = 0;
|
||||
const length = string.length;
|
||||
while (counter < length) {
|
||||
const value = string.charCodeAt(counter++);
|
||||
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
||||
// It's a high surrogate, and there is a next character.
|
||||
const extra = string.charCodeAt(counter++);
|
||||
if ((extra & 0xFC00) == 0xDC00) { // Low surrogate.
|
||||
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
||||
} else {
|
||||
// It's an unmatched surrogate; only append this code unit, in case the
|
||||
// next code unit is the high surrogate of a surrogate pair.
|
||||
output.push(value);
|
||||
counter--;
|
||||
}
|
||||
} else {
|
||||
output.push(value);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a string based on an array of numeric code points.
|
||||
* @see `punycode.ucs2.decode`
|
||||
* @memberOf punycode.ucs2
|
||||
* @name encode
|
||||
* @param {Array} codePoints The array of numeric code points.
|
||||
* @returns {String} The new Unicode string (UCS-2).
|
||||
*/
|
||||
const ucs2encode = codePoints => String.fromCodePoint(...codePoints);
|
||||
|
||||
/**
|
||||
* Converts a basic code point into a digit/integer.
|
||||
* @see `digitToBasic()`
|
||||
* @private
|
||||
* @param {Number} codePoint The basic numeric code point value.
|
||||
* @returns {Number} The numeric value of a basic code point (for use in
|
||||
* representing integers) in the range `0` to `base - 1`, or `base` if
|
||||
* the code point does not represent a value.
|
||||
*/
|
||||
const basicToDigit = function(codePoint) {
|
||||
if (codePoint >= 0x30 && codePoint < 0x3A) {
|
||||
return 26 + (codePoint - 0x30);
|
||||
}
|
||||
if (codePoint >= 0x41 && codePoint < 0x5B) {
|
||||
return codePoint - 0x41;
|
||||
}
|
||||
if (codePoint >= 0x61 && codePoint < 0x7B) {
|
||||
return codePoint - 0x61;
|
||||
}
|
||||
return base;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a digit/integer into a basic code point.
|
||||
* @see `basicToDigit()`
|
||||
* @private
|
||||
* @param {Number} digit The numeric value of a basic code point.
|
||||
* @returns {Number} The basic code point whose value (when used for
|
||||
* representing integers) is `digit`, which needs to be in the range
|
||||
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
|
||||
* used; else, the lowercase form is used. The behavior is undefined
|
||||
* if `flag` is non-zero and `digit` has no uppercase form.
|
||||
*/
|
||||
const digitToBasic = function(digit, flag) {
|
||||
// 0..25 map to ASCII a..z or A..Z
|
||||
// 26..35 map to ASCII 0..9
|
||||
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
||||
};
|
||||
|
||||
/**
|
||||
* Bias adaptation function as per section 3.4 of RFC 3492.
|
||||
* https://tools.ietf.org/html/rfc3492#section-3.4
|
||||
* @private
|
||||
*/
|
||||
const adapt = function(delta, numPoints, firstTime) {
|
||||
let k = 0;
|
||||
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
||||
delta += floor(delta / numPoints);
|
||||
for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
|
||||
delta = floor(delta / baseMinusTMin);
|
||||
}
|
||||
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a Punycode string of ASCII-only symbols to a string of Unicode
|
||||
* symbols.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The Punycode string of ASCII-only symbols.
|
||||
* @returns {String} The resulting string of Unicode symbols.
|
||||
*/
|
||||
const decode = function(input) {
|
||||
// Don't use UCS-2.
|
||||
const output = [];
|
||||
const inputLength = input.length;
|
||||
let i = 0;
|
||||
let n = initialN;
|
||||
let bias = initialBias;
|
||||
|
||||
// Handle the basic code points: let `basic` be the number of input code
|
||||
// points before the last delimiter, or `0` if there is none, then copy
|
||||
// the first basic code points to the output.
|
||||
|
||||
let basic = input.lastIndexOf(delimiter);
|
||||
if (basic < 0) {
|
||||
basic = 0;
|
||||
}
|
||||
|
||||
for (let j = 0; j < basic; ++j) {
|
||||
// if it's not a basic code point
|
||||
if (input.charCodeAt(j) >= 0x80) {
|
||||
error('not-basic');
|
||||
}
|
||||
output.push(input.charCodeAt(j));
|
||||
}
|
||||
|
||||
// Main decoding loop: start just after the last delimiter if any basic code
|
||||
// points were copied; start at the beginning otherwise.
|
||||
|
||||
for (let index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
|
||||
|
||||
// `index` is the index of the next character to be consumed.
|
||||
// Decode a generalized variable-length integer into `delta`,
|
||||
// which gets added to `i`. The overflow checking is easier
|
||||
// if we increase `i` as we go, then subtract off its starting
|
||||
// value at the end to obtain `delta`.
|
||||
const oldi = i;
|
||||
for (let w = 1, k = base; /* no condition */; k += base) {
|
||||
|
||||
if (index >= inputLength) {
|
||||
error('invalid-input');
|
||||
}
|
||||
|
||||
const digit = basicToDigit(input.charCodeAt(index++));
|
||||
|
||||
if (digit >= base) {
|
||||
error('invalid-input');
|
||||
}
|
||||
if (digit > floor((maxInt - i) / w)) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
i += digit * w;
|
||||
const t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
||||
|
||||
if (digit < t) {
|
||||
break;
|
||||
}
|
||||
|
||||
const baseMinusT = base - t;
|
||||
if (w > floor(maxInt / baseMinusT)) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
w *= baseMinusT;
|
||||
|
||||
}
|
||||
|
||||
const out = output.length + 1;
|
||||
bias = adapt(i - oldi, out, oldi == 0);
|
||||
|
||||
// `i` was supposed to wrap around from `out` to `0`,
|
||||
// incrementing `n` each time, so we'll fix that now:
|
||||
if (floor(i / out) > maxInt - n) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
n += floor(i / out);
|
||||
i %= out;
|
||||
|
||||
// Insert `n` at position `i` of the output.
|
||||
output.splice(i++, 0, n);
|
||||
|
||||
}
|
||||
|
||||
return String.fromCodePoint(...output);
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a string of Unicode symbols (e.g. a domain name label) to a
|
||||
* Punycode string of ASCII-only symbols.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The string of Unicode symbols.
|
||||
* @returns {String} The resulting Punycode string of ASCII-only symbols.
|
||||
*/
|
||||
const encode = function(input) {
|
||||
const output = [];
|
||||
|
||||
// Convert the input in UCS-2 to an array of Unicode code points.
|
||||
input = ucs2decode(input);
|
||||
|
||||
// Cache the length.
|
||||
const inputLength = input.length;
|
||||
|
||||
// Initialize the state.
|
||||
let n = initialN;
|
||||
let delta = 0;
|
||||
let bias = initialBias;
|
||||
|
||||
// Handle the basic code points.
|
||||
for (const currentValue of input) {
|
||||
if (currentValue < 0x80) {
|
||||
output.push(stringFromCharCode(currentValue));
|
||||
}
|
||||
}
|
||||
|
||||
const basicLength = output.length;
|
||||
let handledCPCount = basicLength;
|
||||
|
||||
// `handledCPCount` is the number of code points that have been handled;
|
||||
// `basicLength` is the number of basic code points.
|
||||
|
||||
// Finish the basic string with a delimiter unless it's empty.
|
||||
if (basicLength) {
|
||||
output.push(delimiter);
|
||||
}
|
||||
|
||||
// Main encoding loop:
|
||||
while (handledCPCount < inputLength) {
|
||||
|
||||
// All non-basic code points < n have been handled already. Find the next
|
||||
// larger one:
|
||||
let m = maxInt;
|
||||
for (const currentValue of input) {
|
||||
if (currentValue >= n && currentValue < m) {
|
||||
m = currentValue;
|
||||
}
|
||||
}
|
||||
|
||||
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
|
||||
// but guard against overflow.
|
||||
const handledCPCountPlusOne = handledCPCount + 1;
|
||||
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
delta += (m - n) * handledCPCountPlusOne;
|
||||
n = m;
|
||||
|
||||
for (const currentValue of input) {
|
||||
if (currentValue < n && ++delta > maxInt) {
|
||||
error('overflow');
|
||||
}
|
||||
if (currentValue === n) {
|
||||
// Represent delta as a generalized variable-length integer.
|
||||
let q = delta;
|
||||
for (let k = base; /* no condition */; k += base) {
|
||||
const t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
||||
if (q < t) {
|
||||
break;
|
||||
}
|
||||
const qMinusT = q - t;
|
||||
const baseMinusT = base - t;
|
||||
output.push(
|
||||
stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
|
||||
);
|
||||
q = floor(qMinusT / baseMinusT);
|
||||
}
|
||||
|
||||
output.push(stringFromCharCode(digitToBasic(q, 0)));
|
||||
bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength);
|
||||
delta = 0;
|
||||
++handledCPCount;
|
||||
}
|
||||
}
|
||||
|
||||
++delta;
|
||||
++n;
|
||||
|
||||
}
|
||||
return output.join('');
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a Punycode string representing a domain name or an email address
|
||||
* to Unicode. Only the Punycoded parts of the input will be converted, i.e.
|
||||
* it doesn't matter if you call it on a string that has already been
|
||||
* converted to Unicode.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The Punycoded domain name or email address to
|
||||
* convert to Unicode.
|
||||
* @returns {String} The Unicode representation of the given Punycode
|
||||
* string.
|
||||
*/
|
||||
const toUnicode = function(input) {
|
||||
return mapDomain(input, function(string) {
|
||||
return regexPunycode.test(string)
|
||||
? decode(string.slice(4).toLowerCase())
|
||||
: string;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a Unicode string representing a domain name or an email address to
|
||||
* Punycode. Only the non-ASCII parts of the domain name will be converted,
|
||||
* i.e. it doesn't matter if you call it with a domain that's already in
|
||||
* ASCII.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The domain name or email address to convert, as a
|
||||
* Unicode string.
|
||||
* @returns {String} The Punycode representation of the given domain name or
|
||||
* email address.
|
||||
*/
|
||||
const toASCII = function(input) {
|
||||
return mapDomain(input, function(string) {
|
||||
return regexNonASCII.test(string)
|
||||
? 'xn--' + encode(string)
|
||||
: string;
|
||||
});
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/** Define the public API */
|
||||
const punycode = {
|
||||
/**
|
||||
* A string representing the current Punycode.js version number.
|
||||
* @memberOf punycode
|
||||
* @type String
|
||||
*/
|
||||
'version': '2.3.1',
|
||||
/**
|
||||
* An object of methods to convert from JavaScript's internal character
|
||||
* representation (UCS-2) to Unicode code points, and back.
|
||||
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
||||
* @memberOf punycode
|
||||
* @type Object
|
||||
*/
|
||||
'ucs2': {
|
||||
'decode': ucs2decode,
|
||||
'encode': ucs2encode
|
||||
},
|
||||
'decode': decode,
|
||||
'encode': encode,
|
||||
'toASCII': toASCII,
|
||||
'toUnicode': toUnicode
|
||||
};
|
||||
|
||||
export { ucs2decode, ucs2encode, decode, encode, toASCII, toUnicode };
|
||||
export default punycode;
|
||||
443
BACK_BACK/node_modules/data-urls/node_modules/punycode/punycode.js
generated
vendored
Executable file
443
BACK_BACK/node_modules/data-urls/node_modules/punycode/punycode.js
generated
vendored
Executable file
|
|
@ -0,0 +1,443 @@
|
|||
'use strict';
|
||||
|
||||
/** Highest positive signed 32-bit float value */
|
||||
const maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
|
||||
|
||||
/** Bootstring parameters */
|
||||
const base = 36;
|
||||
const tMin = 1;
|
||||
const tMax = 26;
|
||||
const skew = 38;
|
||||
const damp = 700;
|
||||
const initialBias = 72;
|
||||
const initialN = 128; // 0x80
|
||||
const delimiter = '-'; // '\x2D'
|
||||
|
||||
/** Regular expressions */
|
||||
const regexPunycode = /^xn--/;
|
||||
const regexNonASCII = /[^\0-\x7F]/; // Note: U+007F DEL is excluded too.
|
||||
const regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
|
||||
|
||||
/** Error messages */
|
||||
const errors = {
|
||||
'overflow': 'Overflow: input needs wider integers to process',
|
||||
'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
||||
'invalid-input': 'Invalid input'
|
||||
};
|
||||
|
||||
/** Convenience shortcuts */
|
||||
const baseMinusTMin = base - tMin;
|
||||
const floor = Math.floor;
|
||||
const stringFromCharCode = String.fromCharCode;
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* A generic error utility function.
|
||||
* @private
|
||||
* @param {String} type The error type.
|
||||
* @returns {Error} Throws a `RangeError` with the applicable error message.
|
||||
*/
|
||||
function error(type) {
|
||||
throw new RangeError(errors[type]);
|
||||
}
|
||||
|
||||
/**
|
||||
* A generic `Array#map` utility function.
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
* @param {Function} callback The function that gets called for every array
|
||||
* item.
|
||||
* @returns {Array} A new array of values returned by the callback function.
|
||||
*/
|
||||
function map(array, callback) {
|
||||
const result = [];
|
||||
let length = array.length;
|
||||
while (length--) {
|
||||
result[length] = callback(array[length]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple `Array#map`-like wrapper to work with domain name strings or email
|
||||
* addresses.
|
||||
* @private
|
||||
* @param {String} domain The domain name or email address.
|
||||
* @param {Function} callback The function that gets called for every
|
||||
* character.
|
||||
* @returns {String} A new string of characters returned by the callback
|
||||
* function.
|
||||
*/
|
||||
function mapDomain(domain, callback) {
|
||||
const parts = domain.split('@');
|
||||
let result = '';
|
||||
if (parts.length > 1) {
|
||||
// In email addresses, only the domain name should be punycoded. Leave
|
||||
// the local part (i.e. everything up to `@`) intact.
|
||||
result = parts[0] + '@';
|
||||
domain = parts[1];
|
||||
}
|
||||
// Avoid `split(regex)` for IE8 compatibility. See #17.
|
||||
domain = domain.replace(regexSeparators, '\x2E');
|
||||
const labels = domain.split('.');
|
||||
const encoded = map(labels, callback).join('.');
|
||||
return result + encoded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an array containing the numeric code points of each Unicode
|
||||
* character in the string. While JavaScript uses UCS-2 internally,
|
||||
* this function will convert a pair of surrogate halves (each of which
|
||||
* UCS-2 exposes as separate characters) into a single code point,
|
||||
* matching UTF-16.
|
||||
* @see `punycode.ucs2.encode`
|
||||
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
||||
* @memberOf punycode.ucs2
|
||||
* @name decode
|
||||
* @param {String} string The Unicode input string (UCS-2).
|
||||
* @returns {Array} The new array of code points.
|
||||
*/
|
||||
function ucs2decode(string) {
|
||||
const output = [];
|
||||
let counter = 0;
|
||||
const length = string.length;
|
||||
while (counter < length) {
|
||||
const value = string.charCodeAt(counter++);
|
||||
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
||||
// It's a high surrogate, and there is a next character.
|
||||
const extra = string.charCodeAt(counter++);
|
||||
if ((extra & 0xFC00) == 0xDC00) { // Low surrogate.
|
||||
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
||||
} else {
|
||||
// It's an unmatched surrogate; only append this code unit, in case the
|
||||
// next code unit is the high surrogate of a surrogate pair.
|
||||
output.push(value);
|
||||
counter--;
|
||||
}
|
||||
} else {
|
||||
output.push(value);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a string based on an array of numeric code points.
|
||||
* @see `punycode.ucs2.decode`
|
||||
* @memberOf punycode.ucs2
|
||||
* @name encode
|
||||
* @param {Array} codePoints The array of numeric code points.
|
||||
* @returns {String} The new Unicode string (UCS-2).
|
||||
*/
|
||||
const ucs2encode = codePoints => String.fromCodePoint(...codePoints);
|
||||
|
||||
/**
|
||||
* Converts a basic code point into a digit/integer.
|
||||
* @see `digitToBasic()`
|
||||
* @private
|
||||
* @param {Number} codePoint The basic numeric code point value.
|
||||
* @returns {Number} The numeric value of a basic code point (for use in
|
||||
* representing integers) in the range `0` to `base - 1`, or `base` if
|
||||
* the code point does not represent a value.
|
||||
*/
|
||||
const basicToDigit = function(codePoint) {
|
||||
if (codePoint >= 0x30 && codePoint < 0x3A) {
|
||||
return 26 + (codePoint - 0x30);
|
||||
}
|
||||
if (codePoint >= 0x41 && codePoint < 0x5B) {
|
||||
return codePoint - 0x41;
|
||||
}
|
||||
if (codePoint >= 0x61 && codePoint < 0x7B) {
|
||||
return codePoint - 0x61;
|
||||
}
|
||||
return base;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a digit/integer into a basic code point.
|
||||
* @see `basicToDigit()`
|
||||
* @private
|
||||
* @param {Number} digit The numeric value of a basic code point.
|
||||
* @returns {Number} The basic code point whose value (when used for
|
||||
* representing integers) is `digit`, which needs to be in the range
|
||||
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
|
||||
* used; else, the lowercase form is used. The behavior is undefined
|
||||
* if `flag` is non-zero and `digit` has no uppercase form.
|
||||
*/
|
||||
const digitToBasic = function(digit, flag) {
|
||||
// 0..25 map to ASCII a..z or A..Z
|
||||
// 26..35 map to ASCII 0..9
|
||||
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
||||
};
|
||||
|
||||
/**
|
||||
* Bias adaptation function as per section 3.4 of RFC 3492.
|
||||
* https://tools.ietf.org/html/rfc3492#section-3.4
|
||||
* @private
|
||||
*/
|
||||
const adapt = function(delta, numPoints, firstTime) {
|
||||
let k = 0;
|
||||
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
||||
delta += floor(delta / numPoints);
|
||||
for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
|
||||
delta = floor(delta / baseMinusTMin);
|
||||
}
|
||||
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a Punycode string of ASCII-only symbols to a string of Unicode
|
||||
* symbols.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The Punycode string of ASCII-only symbols.
|
||||
* @returns {String} The resulting string of Unicode symbols.
|
||||
*/
|
||||
const decode = function(input) {
|
||||
// Don't use UCS-2.
|
||||
const output = [];
|
||||
const inputLength = input.length;
|
||||
let i = 0;
|
||||
let n = initialN;
|
||||
let bias = initialBias;
|
||||
|
||||
// Handle the basic code points: let `basic` be the number of input code
|
||||
// points before the last delimiter, or `0` if there is none, then copy
|
||||
// the first basic code points to the output.
|
||||
|
||||
let basic = input.lastIndexOf(delimiter);
|
||||
if (basic < 0) {
|
||||
basic = 0;
|
||||
}
|
||||
|
||||
for (let j = 0; j < basic; ++j) {
|
||||
// if it's not a basic code point
|
||||
if (input.charCodeAt(j) >= 0x80) {
|
||||
error('not-basic');
|
||||
}
|
||||
output.push(input.charCodeAt(j));
|
||||
}
|
||||
|
||||
// Main decoding loop: start just after the last delimiter if any basic code
|
||||
// points were copied; start at the beginning otherwise.
|
||||
|
||||
for (let index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
|
||||
|
||||
// `index` is the index of the next character to be consumed.
|
||||
// Decode a generalized variable-length integer into `delta`,
|
||||
// which gets added to `i`. The overflow checking is easier
|
||||
// if we increase `i` as we go, then subtract off its starting
|
||||
// value at the end to obtain `delta`.
|
||||
const oldi = i;
|
||||
for (let w = 1, k = base; /* no condition */; k += base) {
|
||||
|
||||
if (index >= inputLength) {
|
||||
error('invalid-input');
|
||||
}
|
||||
|
||||
const digit = basicToDigit(input.charCodeAt(index++));
|
||||
|
||||
if (digit >= base) {
|
||||
error('invalid-input');
|
||||
}
|
||||
if (digit > floor((maxInt - i) / w)) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
i += digit * w;
|
||||
const t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
||||
|
||||
if (digit < t) {
|
||||
break;
|
||||
}
|
||||
|
||||
const baseMinusT = base - t;
|
||||
if (w > floor(maxInt / baseMinusT)) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
w *= baseMinusT;
|
||||
|
||||
}
|
||||
|
||||
const out = output.length + 1;
|
||||
bias = adapt(i - oldi, out, oldi == 0);
|
||||
|
||||
// `i` was supposed to wrap around from `out` to `0`,
|
||||
// incrementing `n` each time, so we'll fix that now:
|
||||
if (floor(i / out) > maxInt - n) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
n += floor(i / out);
|
||||
i %= out;
|
||||
|
||||
// Insert `n` at position `i` of the output.
|
||||
output.splice(i++, 0, n);
|
||||
|
||||
}
|
||||
|
||||
return String.fromCodePoint(...output);
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a string of Unicode symbols (e.g. a domain name label) to a
|
||||
* Punycode string of ASCII-only symbols.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The string of Unicode symbols.
|
||||
* @returns {String} The resulting Punycode string of ASCII-only symbols.
|
||||
*/
|
||||
const encode = function(input) {
|
||||
const output = [];
|
||||
|
||||
// Convert the input in UCS-2 to an array of Unicode code points.
|
||||
input = ucs2decode(input);
|
||||
|
||||
// Cache the length.
|
||||
const inputLength = input.length;
|
||||
|
||||
// Initialize the state.
|
||||
let n = initialN;
|
||||
let delta = 0;
|
||||
let bias = initialBias;
|
||||
|
||||
// Handle the basic code points.
|
||||
for (const currentValue of input) {
|
||||
if (currentValue < 0x80) {
|
||||
output.push(stringFromCharCode(currentValue));
|
||||
}
|
||||
}
|
||||
|
||||
const basicLength = output.length;
|
||||
let handledCPCount = basicLength;
|
||||
|
||||
// `handledCPCount` is the number of code points that have been handled;
|
||||
// `basicLength` is the number of basic code points.
|
||||
|
||||
// Finish the basic string with a delimiter unless it's empty.
|
||||
if (basicLength) {
|
||||
output.push(delimiter);
|
||||
}
|
||||
|
||||
// Main encoding loop:
|
||||
while (handledCPCount < inputLength) {
|
||||
|
||||
// All non-basic code points < n have been handled already. Find the next
|
||||
// larger one:
|
||||
let m = maxInt;
|
||||
for (const currentValue of input) {
|
||||
if (currentValue >= n && currentValue < m) {
|
||||
m = currentValue;
|
||||
}
|
||||
}
|
||||
|
||||
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
|
||||
// but guard against overflow.
|
||||
const handledCPCountPlusOne = handledCPCount + 1;
|
||||
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
delta += (m - n) * handledCPCountPlusOne;
|
||||
n = m;
|
||||
|
||||
for (const currentValue of input) {
|
||||
if (currentValue < n && ++delta > maxInt) {
|
||||
error('overflow');
|
||||
}
|
||||
if (currentValue === n) {
|
||||
// Represent delta as a generalized variable-length integer.
|
||||
let q = delta;
|
||||
for (let k = base; /* no condition */; k += base) {
|
||||
const t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
||||
if (q < t) {
|
||||
break;
|
||||
}
|
||||
const qMinusT = q - t;
|
||||
const baseMinusT = base - t;
|
||||
output.push(
|
||||
stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
|
||||
);
|
||||
q = floor(qMinusT / baseMinusT);
|
||||
}
|
||||
|
||||
output.push(stringFromCharCode(digitToBasic(q, 0)));
|
||||
bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength);
|
||||
delta = 0;
|
||||
++handledCPCount;
|
||||
}
|
||||
}
|
||||
|
||||
++delta;
|
||||
++n;
|
||||
|
||||
}
|
||||
return output.join('');
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a Punycode string representing a domain name or an email address
|
||||
* to Unicode. Only the Punycoded parts of the input will be converted, i.e.
|
||||
* it doesn't matter if you call it on a string that has already been
|
||||
* converted to Unicode.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The Punycoded domain name or email address to
|
||||
* convert to Unicode.
|
||||
* @returns {String} The Unicode representation of the given Punycode
|
||||
* string.
|
||||
*/
|
||||
const toUnicode = function(input) {
|
||||
return mapDomain(input, function(string) {
|
||||
return regexPunycode.test(string)
|
||||
? decode(string.slice(4).toLowerCase())
|
||||
: string;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a Unicode string representing a domain name or an email address to
|
||||
* Punycode. Only the non-ASCII parts of the domain name will be converted,
|
||||
* i.e. it doesn't matter if you call it with a domain that's already in
|
||||
* ASCII.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The domain name or email address to convert, as a
|
||||
* Unicode string.
|
||||
* @returns {String} The Punycode representation of the given domain name or
|
||||
* email address.
|
||||
*/
|
||||
const toASCII = function(input) {
|
||||
return mapDomain(input, function(string) {
|
||||
return regexNonASCII.test(string)
|
||||
? 'xn--' + encode(string)
|
||||
: string;
|
||||
});
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/** Define the public API */
|
||||
const punycode = {
|
||||
/**
|
||||
* A string representing the current Punycode.js version number.
|
||||
* @memberOf punycode
|
||||
* @type String
|
||||
*/
|
||||
'version': '2.3.1',
|
||||
/**
|
||||
* An object of methods to convert from JavaScript's internal character
|
||||
* representation (UCS-2) to Unicode code points, and back.
|
||||
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
||||
* @memberOf punycode
|
||||
* @type Object
|
||||
*/
|
||||
'ucs2': {
|
||||
'decode': ucs2decode,
|
||||
'encode': ucs2encode
|
||||
},
|
||||
'decode': decode,
|
||||
'encode': encode,
|
||||
'toASCII': toASCII,
|
||||
'toUnicode': toUnicode
|
||||
};
|
||||
|
||||
module.exports = punycode;
|
||||
21
BACK_BACK/node_modules/data-urls/node_modules/tr46/LICENSE.md
generated
vendored
Executable file
21
BACK_BACK/node_modules/data-urls/node_modules/tr46/LICENSE.md
generated
vendored
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Sebastian Mayr
|
||||
|
||||
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.
|
||||
69
BACK_BACK/node_modules/data-urls/node_modules/tr46/README.md
generated
vendored
Executable file
69
BACK_BACK/node_modules/data-urls/node_modules/tr46/README.md
generated
vendored
Executable file
|
|
@ -0,0 +1,69 @@
|
|||
# tr46.js
|
||||
|
||||
> An implementation of the [Unicode TR46 specification](http://unicode.org/reports/tr46/).
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
[Node.js](http://nodejs.org) `>= 6` is required. To install, type this at the command line:
|
||||
```shell
|
||||
npm install tr46
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### `toASCII(domainName[, options])`
|
||||
|
||||
Converts a string of Unicode symbols to a case-folded Punycode string of ASCII symbols.
|
||||
|
||||
Available options:
|
||||
* [`checkBidi`](#checkBidi)
|
||||
* [`checkHyphens`](#checkHyphens)
|
||||
* [`checkJoiners`](#checkJoiners)
|
||||
* [`processingOption`](#processingOption)
|
||||
* [`useSTD3ASCIIRules`](#useSTD3ASCIIRules)
|
||||
* [`verifyDNSLength`](#verifyDNSLength)
|
||||
|
||||
### `toUnicode(domainName[, options])`
|
||||
|
||||
Converts a case-folded Punycode string of ASCII symbols to a string of Unicode symbols.
|
||||
|
||||
Available options:
|
||||
* [`checkBidi`](#checkBidi)
|
||||
* [`checkHyphens`](#checkHyphens)
|
||||
* [`checkJoiners`](#checkJoiners)
|
||||
* [`useSTD3ASCIIRules`](#useSTD3ASCIIRules)
|
||||
|
||||
|
||||
## Options
|
||||
|
||||
### `checkBidi`
|
||||
Type: `Boolean`
|
||||
Default value: `false`
|
||||
When set to `true`, any bi-directional text within the input will be checked for validation.
|
||||
|
||||
### `checkHyphens`
|
||||
Type: `Boolean`
|
||||
Default value: `false`
|
||||
When set to `true`, the positions of any hyphen characters within the input will be checked for validation.
|
||||
|
||||
### `checkJoiners`
|
||||
Type: `Boolean`
|
||||
Default value: `false`
|
||||
When set to `true`, any word joiner characters within the input will be checked for validation.
|
||||
|
||||
### `processingOption`
|
||||
Type: `String`
|
||||
Default value: `"nontransitional"`
|
||||
When set to `"transitional"`, symbols within the input will be validated according to the older IDNA2003 protocol. When set to `"nontransitional"`, the current IDNA2008 protocol will be used.
|
||||
|
||||
### `useSTD3ASCIIRules`
|
||||
Type: `Boolean`
|
||||
Default value: `false`
|
||||
When set to `true`, input will be validated according to [STD3 Rules](http://unicode.org/reports/tr46/#STD3_Rules).
|
||||
|
||||
### `verifyDNSLength`
|
||||
Type: `Boolean`
|
||||
Default value: `false`
|
||||
When set to `true`, the length of each DNS label within the input will be checked for validation.
|
||||
287
BACK_BACK/node_modules/data-urls/node_modules/tr46/index.js
generated
vendored
Executable file
287
BACK_BACK/node_modules/data-urls/node_modules/tr46/index.js
generated
vendored
Executable file
|
|
@ -0,0 +1,287 @@
|
|||
"use strict";
|
||||
|
||||
const punycode = require("punycode");
|
||||
const regexes = require("./lib/regexes.js");
|
||||
const mappingTable = require("./lib/mappingTable.json");
|
||||
|
||||
function containsNonASCII(str) {
|
||||
return /[^\x00-\x7F]/.test(str);
|
||||
}
|
||||
|
||||
function findStatus(val, { useSTD3ASCIIRules }) {
|
||||
let start = 0;
|
||||
let end = mappingTable.length - 1;
|
||||
|
||||
while (start <= end) {
|
||||
const mid = Math.floor((start + end) / 2);
|
||||
|
||||
const target = mappingTable[mid];
|
||||
if (target[0][0] <= val && target[0][1] >= val) {
|
||||
if (target[1].startsWith("disallowed_STD3_")) {
|
||||
const newStatus = useSTD3ASCIIRules ? "disallowed" : target[1].slice(16);
|
||||
return [newStatus, ...target.slice(2)];
|
||||
}
|
||||
return target.slice(1);
|
||||
} else if (target[0][0] > val) {
|
||||
end = mid - 1;
|
||||
} else {
|
||||
start = mid + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function mapChars(domainName, { useSTD3ASCIIRules, processingOption }) {
|
||||
let hasError = false;
|
||||
let processed = "";
|
||||
|
||||
for (const ch of domainName) {
|
||||
const [status, mapping] = findStatus(ch.codePointAt(0), { useSTD3ASCIIRules });
|
||||
|
||||
switch (status) {
|
||||
case "disallowed":
|
||||
hasError = true;
|
||||
processed += ch;
|
||||
break;
|
||||
case "ignored":
|
||||
break;
|
||||
case "mapped":
|
||||
processed += mapping;
|
||||
break;
|
||||
case "deviation":
|
||||
if (processingOption === "transitional") {
|
||||
processed += mapping;
|
||||
} else {
|
||||
processed += ch;
|
||||
}
|
||||
break;
|
||||
case "valid":
|
||||
processed += ch;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
string: processed,
|
||||
error: hasError
|
||||
};
|
||||
}
|
||||
|
||||
function validateLabel(label, { checkHyphens, checkBidi, checkJoiners, processingOption, useSTD3ASCIIRules }) {
|
||||
if (label.normalize("NFC") !== label) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const codePoints = Array.from(label);
|
||||
|
||||
if (checkHyphens) {
|
||||
if ((codePoints[2] === "-" && codePoints[3] === "-") ||
|
||||
(label.startsWith("-") || label.endsWith("-"))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (label.includes(".") ||
|
||||
(codePoints.length > 0 && regexes.combiningMarks.test(codePoints[0]))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const ch of codePoints) {
|
||||
const [status] = findStatus(ch.codePointAt(0), { useSTD3ASCIIRules });
|
||||
if ((processingOption === "transitional" && status !== "valid") ||
|
||||
(processingOption === "nontransitional" &&
|
||||
status !== "valid" && status !== "deviation")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// https://tools.ietf.org/html/rfc5892#appendix-A
|
||||
if (checkJoiners) {
|
||||
let last = 0;
|
||||
for (const [i, ch] of codePoints.entries()) {
|
||||
if (ch === "\u200C" || ch === "\u200D") {
|
||||
if (i > 0) {
|
||||
if (regexes.combiningClassVirama.test(codePoints[i - 1])) {
|
||||
continue;
|
||||
}
|
||||
if (ch === "\u200C") {
|
||||
// TODO: make this more efficient
|
||||
const next = codePoints.indexOf("\u200C", i + 1);
|
||||
const test = next < 0 ? codePoints.slice(last) : codePoints.slice(last, next);
|
||||
if (regexes.validZWNJ.test(test.join(""))) {
|
||||
last = i + 1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// https://tools.ietf.org/html/rfc5893#section-2
|
||||
if (checkBidi) {
|
||||
let rtl;
|
||||
|
||||
// 1
|
||||
if (regexes.bidiS1LTR.test(codePoints[0])) {
|
||||
rtl = false;
|
||||
} else if (regexes.bidiS1RTL.test(codePoints[0])) {
|
||||
rtl = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (rtl) {
|
||||
// 2-4
|
||||
if (!regexes.bidiS2.test(label) ||
|
||||
!regexes.bidiS3.test(label) ||
|
||||
(regexes.bidiS4EN.test(label) && regexes.bidiS4AN.test(label))) {
|
||||
return false;
|
||||
}
|
||||
} else if (!regexes.bidiS5.test(label) ||
|
||||
!regexes.bidiS6.test(label)) { // 5-6
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function isBidiDomain(labels) {
|
||||
const domain = labels.map(label => {
|
||||
if (label.startsWith("xn--")) {
|
||||
try {
|
||||
return punycode.decode(label.substring(4));
|
||||
} catch (err) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return label;
|
||||
}).join(".");
|
||||
return regexes.bidiDomain.test(domain);
|
||||
}
|
||||
|
||||
function processing(domainName, options) {
|
||||
const { processingOption } = options;
|
||||
|
||||
// 1. Map.
|
||||
let { string, error } = mapChars(domainName, options);
|
||||
|
||||
// 2. Normalize.
|
||||
string = string.normalize("NFC");
|
||||
|
||||
// 3. Break.
|
||||
const labels = string.split(".");
|
||||
const isBidi = isBidiDomain(labels);
|
||||
|
||||
// 4. Convert/Validate.
|
||||
for (const [i, origLabel] of labels.entries()) {
|
||||
let label = origLabel;
|
||||
let curProcessing = processingOption;
|
||||
if (label.startsWith("xn--")) {
|
||||
try {
|
||||
label = punycode.decode(label.substring(4));
|
||||
labels[i] = label;
|
||||
} catch (err) {
|
||||
error = true;
|
||||
continue;
|
||||
}
|
||||
curProcessing = "nontransitional";
|
||||
}
|
||||
|
||||
// No need to validate if we already know there is an error.
|
||||
if (error) {
|
||||
continue;
|
||||
}
|
||||
const validation = validateLabel(label, Object.assign({}, options, {
|
||||
processingOption: curProcessing,
|
||||
checkBidi: options.checkBidi && isBidi
|
||||
}));
|
||||
if (!validation) {
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
string: labels.join("."),
|
||||
error
|
||||
};
|
||||
}
|
||||
|
||||
function toASCII(domainName, {
|
||||
checkHyphens = false,
|
||||
checkBidi = false,
|
||||
checkJoiners = false,
|
||||
useSTD3ASCIIRules = false,
|
||||
processingOption = "nontransitional",
|
||||
verifyDNSLength = false
|
||||
} = {}) {
|
||||
if (processingOption !== "transitional" && processingOption !== "nontransitional") {
|
||||
throw new RangeError("processingOption must be either transitional or nontransitional");
|
||||
}
|
||||
|
||||
const result = processing(domainName, {
|
||||
processingOption,
|
||||
checkHyphens,
|
||||
checkBidi,
|
||||
checkJoiners,
|
||||
useSTD3ASCIIRules
|
||||
});
|
||||
let labels = result.string.split(".");
|
||||
labels = labels.map(l => {
|
||||
if (containsNonASCII(l)) {
|
||||
try {
|
||||
return "xn--" + punycode.encode(l);
|
||||
} catch (e) {
|
||||
result.error = true;
|
||||
}
|
||||
}
|
||||
return l;
|
||||
});
|
||||
|
||||
if (verifyDNSLength) {
|
||||
const total = labels.join(".").length;
|
||||
if (total > 253 || total === 0) {
|
||||
result.error = true;
|
||||
}
|
||||
|
||||
for (let i = 0; i < labels.length; ++i) {
|
||||
if (labels[i].length > 63 || labels[i].length === 0) {
|
||||
result.error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result.error) {
|
||||
return null;
|
||||
}
|
||||
return labels.join(".");
|
||||
}
|
||||
|
||||
function toUnicode(domainName, {
|
||||
checkHyphens = false,
|
||||
checkBidi = false,
|
||||
checkJoiners = false,
|
||||
useSTD3ASCIIRules = false
|
||||
} = {}) {
|
||||
const result = processing(domainName, {
|
||||
processingOption: "nontransitional",
|
||||
checkHyphens,
|
||||
checkBidi,
|
||||
checkJoiners,
|
||||
useSTD3ASCIIRules
|
||||
});
|
||||
|
||||
return {
|
||||
domain: result.string,
|
||||
error: result.error
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
toASCII,
|
||||
toUnicode
|
||||
};
|
||||
1
BACK_BACK/node_modules/data-urls/node_modules/tr46/lib/mappingTable.json
generated
vendored
Executable file
1
BACK_BACK/node_modules/data-urls/node_modules/tr46/lib/mappingTable.json
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
29
BACK_BACK/node_modules/data-urls/node_modules/tr46/lib/regexes.js
generated
vendored
Executable file
29
BACK_BACK/node_modules/data-urls/node_modules/tr46/lib/regexes.js
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
37
BACK_BACK/node_modules/data-urls/node_modules/tr46/package.json
generated
vendored
Executable file
37
BACK_BACK/node_modules/data-urls/node_modules/tr46/package.json
generated
vendored
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"name": "tr46",
|
||||
"version": "1.0.1",
|
||||
"description": "An implementation of the Unicode TR46 spec",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"index.js",
|
||||
"lib/mappingTable.json",
|
||||
"lib/regexes.js"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "mocha",
|
||||
"lint": "eslint .",
|
||||
"pretest": "node scripts/getLatestTests.js",
|
||||
"prepublish": "node scripts/generateMappingTable.js && node scripts/generateRegexes.js"
|
||||
},
|
||||
"repository": "Sebmaster/tr46.js",
|
||||
"keywords": [
|
||||
"unicode",
|
||||
"tr46",
|
||||
"url",
|
||||
"whatwg"
|
||||
],
|
||||
"author": "Sebastian Mayr <npm@smayr.name>",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"punycode": "^2.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^3.13.0",
|
||||
"mocha": "^3.2.0",
|
||||
"regenerate": "^1.3.2",
|
||||
"request": "^2.79.0",
|
||||
"unicode-10.0.0": "^0.7.4"
|
||||
},
|
||||
"unicodeVersion": "10.0.0"
|
||||
}
|
||||
21
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/LICENSE.txt
generated
vendored
Executable file
21
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/LICENSE.txt
generated
vendored
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015–2016 Sebastian Mayr
|
||||
|
||||
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.
|
||||
98
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/README.md
generated
vendored
Executable file
98
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/README.md
generated
vendored
Executable file
|
|
@ -0,0 +1,98 @@
|
|||
# whatwg-url
|
||||
|
||||
whatwg-url is a full implementation of the WHATWG [URL Standard](https://url.spec.whatwg.org/). It can be used standalone, but it also exposes a lot of the internal algorithms that are useful for integrating a URL parser into a project like [jsdom](https://github.com/tmpvar/jsdom).
|
||||
|
||||
## Specification conformance
|
||||
|
||||
whatwg-url is currently up to date with the URL spec up to commit [7ae1c69](https://github.com/whatwg/url/commit/7ae1c691c96f0d82fafa24c33aa1e8df9ffbf2bc).
|
||||
|
||||
For `file:` URLs, whose [origin is left unspecified](https://url.spec.whatwg.org/#concept-url-origin), whatwg-url chooses to use a new opaque origin (which serializes to `"null"`).
|
||||
|
||||
## API
|
||||
|
||||
### The `URL` and `URLSearchParams` classes
|
||||
|
||||
The main API is provided by the [`URL`](https://url.spec.whatwg.org/#url-class) and [`URLSearchParams`](https://url.spec.whatwg.org/#interface-urlsearchparams) exports, which follows the spec's behavior in all ways (including e.g. `USVString` conversion). Most consumers of this library will want to use these.
|
||||
|
||||
### Low-level URL Standard API
|
||||
|
||||
The following methods are exported for use by places like jsdom that need to implement things like [`HTMLHyperlinkElementUtils`](https://html.spec.whatwg.org/#htmlhyperlinkelementutils). They mostly operate on or return an "internal URL" or ["URL record"](https://url.spec.whatwg.org/#concept-url) type.
|
||||
|
||||
- [URL parser](https://url.spec.whatwg.org/#concept-url-parser): `parseURL(input, { baseURL, encodingOverride })`
|
||||
- [Basic URL parser](https://url.spec.whatwg.org/#concept-basic-url-parser): `basicURLParse(input, { baseURL, encodingOverride, url, stateOverride })`
|
||||
- [URL serializer](https://url.spec.whatwg.org/#concept-url-serializer): `serializeURL(urlRecord, excludeFragment)`
|
||||
- [Host serializer](https://url.spec.whatwg.org/#concept-host-serializer): `serializeHost(hostFromURLRecord)`
|
||||
- [Serialize an integer](https://url.spec.whatwg.org/#serialize-an-integer): `serializeInteger(number)`
|
||||
- [Origin](https://url.spec.whatwg.org/#concept-url-origin) [serializer](https://html.spec.whatwg.org/multipage/origin.html#ascii-serialisation-of-an-origin): `serializeURLOrigin(urlRecord)`
|
||||
- [Set the username](https://url.spec.whatwg.org/#set-the-username): `setTheUsername(urlRecord, usernameString)`
|
||||
- [Set the password](https://url.spec.whatwg.org/#set-the-password): `setThePassword(urlRecord, passwordString)`
|
||||
- [Cannot have a username/password/port](https://url.spec.whatwg.org/#cannot-have-a-username-password-port): `cannotHaveAUsernamePasswordPort(urlRecord)`
|
||||
- [Percent decode](https://url.spec.whatwg.org/#percent-decode): `percentDecode(buffer)`
|
||||
|
||||
The `stateOverride` parameter is one of the following strings:
|
||||
|
||||
- [`"scheme start"`](https://url.spec.whatwg.org/#scheme-start-state)
|
||||
- [`"scheme"`](https://url.spec.whatwg.org/#scheme-state)
|
||||
- [`"no scheme"`](https://url.spec.whatwg.org/#no-scheme-state)
|
||||
- [`"special relative or authority"`](https://url.spec.whatwg.org/#special-relative-or-authority-state)
|
||||
- [`"path or authority"`](https://url.spec.whatwg.org/#path-or-authority-state)
|
||||
- [`"relative"`](https://url.spec.whatwg.org/#relative-state)
|
||||
- [`"relative slash"`](https://url.spec.whatwg.org/#relative-slash-state)
|
||||
- [`"special authority slashes"`](https://url.spec.whatwg.org/#special-authority-slashes-state)
|
||||
- [`"special authority ignore slashes"`](https://url.spec.whatwg.org/#special-authority-ignore-slashes-state)
|
||||
- [`"authority"`](https://url.spec.whatwg.org/#authority-state)
|
||||
- [`"host"`](https://url.spec.whatwg.org/#host-state)
|
||||
- [`"hostname"`](https://url.spec.whatwg.org/#hostname-state)
|
||||
- [`"port"`](https://url.spec.whatwg.org/#port-state)
|
||||
- [`"file"`](https://url.spec.whatwg.org/#file-state)
|
||||
- [`"file slash"`](https://url.spec.whatwg.org/#file-slash-state)
|
||||
- [`"file host"`](https://url.spec.whatwg.org/#file-host-state)
|
||||
- [`"path start"`](https://url.spec.whatwg.org/#path-start-state)
|
||||
- [`"path"`](https://url.spec.whatwg.org/#path-state)
|
||||
- [`"cannot-be-a-base-URL path"`](https://url.spec.whatwg.org/#cannot-be-a-base-url-path-state)
|
||||
- [`"query"`](https://url.spec.whatwg.org/#query-state)
|
||||
- [`"fragment"`](https://url.spec.whatwg.org/#fragment-state)
|
||||
|
||||
The URL record type has the following API:
|
||||
|
||||
- [`scheme`](https://url.spec.whatwg.org/#concept-url-scheme)
|
||||
- [`username`](https://url.spec.whatwg.org/#concept-url-username)
|
||||
- [`password`](https://url.spec.whatwg.org/#concept-url-password)
|
||||
- [`host`](https://url.spec.whatwg.org/#concept-url-host)
|
||||
- [`port`](https://url.spec.whatwg.org/#concept-url-port)
|
||||
- [`path`](https://url.spec.whatwg.org/#concept-url-path) (as an array)
|
||||
- [`query`](https://url.spec.whatwg.org/#concept-url-query)
|
||||
- [`fragment`](https://url.spec.whatwg.org/#concept-url-fragment)
|
||||
- [`cannotBeABaseURL`](https://url.spec.whatwg.org/#url-cannot-be-a-base-url-flag) (as a boolean)
|
||||
|
||||
These properties should be treated with care, as in general changing them will cause the URL record to be in an inconsistent state until the appropriate invocation of `basicURLParse` is used to fix it up. You can see examples of this in the URL Standard, where there are many step sequences like "4. Set context object’s url’s fragment to the empty string. 5. Basic URL parse _input_ with context object’s url as _url_ and fragment state as _state override_." In between those two steps, a URL record is in an unusable state.
|
||||
|
||||
The return value of "failure" in the spec is represented by `null`. That is, functions like `parseURL` and `basicURLParse` can return _either_ a URL record _or_ `null`.
|
||||
|
||||
## Development instructions
|
||||
|
||||
First, install [Node.js](https://nodejs.org/). Then, fetch the dependencies of whatwg-url, by running from this directory:
|
||||
|
||||
npm install
|
||||
|
||||
To run tests:
|
||||
|
||||
npm test
|
||||
|
||||
To generate a coverage report:
|
||||
|
||||
npm run coverage
|
||||
|
||||
To build and run the live viewer:
|
||||
|
||||
npm run build
|
||||
npm run build-live-viewer
|
||||
|
||||
Serve the contents of the `live-viewer` directory using any web server.
|
||||
|
||||
## Supporting whatwg-url
|
||||
|
||||
The jsdom project (including whatwg-url) is a community-driven project maintained by a team of [volunteers](https://github.com/orgs/jsdom/people). You could support us by:
|
||||
|
||||
- [Getting professional support for whatwg-url](https://tidelift.com/subscription/pkg/npm-whatwg-url?utm_source=npm-whatwg-url&utm_medium=referral&utm_campaign=readme) as part of a Tidelift subscription. Tidelift helps making open source sustainable for us while giving teams assurances for maintenance, licensing, and security.
|
||||
- Contributing directly to the project.
|
||||
217
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/lib/URL-impl.js
generated
vendored
Executable file
217
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/lib/URL-impl.js
generated
vendored
Executable file
|
|
@ -0,0 +1,217 @@
|
|||
"use strict";
|
||||
const usm = require("./url-state-machine");
|
||||
const urlencoded = require("./urlencoded");
|
||||
const URLSearchParams = require("./URLSearchParams");
|
||||
|
||||
exports.implementation = class URLImpl {
|
||||
constructor(constructorArgs) {
|
||||
const url = constructorArgs[0];
|
||||
const base = constructorArgs[1];
|
||||
|
||||
let parsedBase = null;
|
||||
if (base !== undefined) {
|
||||
parsedBase = usm.basicURLParse(base);
|
||||
if (parsedBase === null) {
|
||||
throw new TypeError(`Invalid base URL: ${base}`);
|
||||
}
|
||||
}
|
||||
|
||||
const parsedURL = usm.basicURLParse(url, { baseURL: parsedBase });
|
||||
if (parsedURL === null) {
|
||||
throw new TypeError(`Invalid URL: ${url}`);
|
||||
}
|
||||
|
||||
const query = parsedURL.query !== null ? parsedURL.query : "";
|
||||
|
||||
this._url = parsedURL;
|
||||
|
||||
// We cannot invoke the "new URLSearchParams object" algorithm without going through the constructor, which strips
|
||||
// question mark by default. Therefore the doNotStripQMark hack is used.
|
||||
this._query = URLSearchParams.createImpl([query], { doNotStripQMark: true });
|
||||
this._query._url = this;
|
||||
}
|
||||
|
||||
get href() {
|
||||
return usm.serializeURL(this._url);
|
||||
}
|
||||
|
||||
set href(v) {
|
||||
const parsedURL = usm.basicURLParse(v);
|
||||
if (parsedURL === null) {
|
||||
throw new TypeError(`Invalid URL: ${v}`);
|
||||
}
|
||||
|
||||
this._url = parsedURL;
|
||||
|
||||
this._query._list.splice(0);
|
||||
const { query } = parsedURL;
|
||||
if (query !== null) {
|
||||
this._query._list = urlencoded.parseUrlencoded(query);
|
||||
}
|
||||
}
|
||||
|
||||
get origin() {
|
||||
return usm.serializeURLOrigin(this._url);
|
||||
}
|
||||
|
||||
get protocol() {
|
||||
return this._url.scheme + ":";
|
||||
}
|
||||
|
||||
set protocol(v) {
|
||||
usm.basicURLParse(v + ":", { url: this._url, stateOverride: "scheme start" });
|
||||
}
|
||||
|
||||
get username() {
|
||||
return this._url.username;
|
||||
}
|
||||
|
||||
set username(v) {
|
||||
if (usm.cannotHaveAUsernamePasswordPort(this._url)) {
|
||||
return;
|
||||
}
|
||||
|
||||
usm.setTheUsername(this._url, v);
|
||||
}
|
||||
|
||||
get password() {
|
||||
return this._url.password;
|
||||
}
|
||||
|
||||
set password(v) {
|
||||
if (usm.cannotHaveAUsernamePasswordPort(this._url)) {
|
||||
return;
|
||||
}
|
||||
|
||||
usm.setThePassword(this._url, v);
|
||||
}
|
||||
|
||||
get host() {
|
||||
const url = this._url;
|
||||
|
||||
if (url.host === null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (url.port === null) {
|
||||
return usm.serializeHost(url.host);
|
||||
}
|
||||
|
||||
return usm.serializeHost(url.host) + ":" + usm.serializeInteger(url.port);
|
||||
}
|
||||
|
||||
set host(v) {
|
||||
if (this._url.cannotBeABaseURL) {
|
||||
return;
|
||||
}
|
||||
|
||||
usm.basicURLParse(v, { url: this._url, stateOverride: "host" });
|
||||
}
|
||||
|
||||
get hostname() {
|
||||
if (this._url.host === null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return usm.serializeHost(this._url.host);
|
||||
}
|
||||
|
||||
set hostname(v) {
|
||||
if (this._url.cannotBeABaseURL) {
|
||||
return;
|
||||
}
|
||||
|
||||
usm.basicURLParse(v, { url: this._url, stateOverride: "hostname" });
|
||||
}
|
||||
|
||||
get port() {
|
||||
if (this._url.port === null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return usm.serializeInteger(this._url.port);
|
||||
}
|
||||
|
||||
set port(v) {
|
||||
if (usm.cannotHaveAUsernamePasswordPort(this._url)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (v === "") {
|
||||
this._url.port = null;
|
||||
} else {
|
||||
usm.basicURLParse(v, { url: this._url, stateOverride: "port" });
|
||||
}
|
||||
}
|
||||
|
||||
get pathname() {
|
||||
if (this._url.cannotBeABaseURL) {
|
||||
return this._url.path[0];
|
||||
}
|
||||
|
||||
if (this._url.path.length === 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return "/" + this._url.path.join("/");
|
||||
}
|
||||
|
||||
set pathname(v) {
|
||||
if (this._url.cannotBeABaseURL) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._url.path = [];
|
||||
usm.basicURLParse(v, { url: this._url, stateOverride: "path start" });
|
||||
}
|
||||
|
||||
get search() {
|
||||
if (this._url.query === null || this._url.query === "") {
|
||||
return "";
|
||||
}
|
||||
|
||||
return "?" + this._url.query;
|
||||
}
|
||||
|
||||
set search(v) {
|
||||
const url = this._url;
|
||||
|
||||
if (v === "") {
|
||||
url.query = null;
|
||||
this._query._list = [];
|
||||
return;
|
||||
}
|
||||
|
||||
const input = v[0] === "?" ? v.substring(1) : v;
|
||||
url.query = "";
|
||||
usm.basicURLParse(input, { url, stateOverride: "query" });
|
||||
this._query._list = urlencoded.parseUrlencoded(input);
|
||||
}
|
||||
|
||||
get searchParams() {
|
||||
return this._query;
|
||||
}
|
||||
|
||||
get hash() {
|
||||
if (this._url.fragment === null || this._url.fragment === "") {
|
||||
return "";
|
||||
}
|
||||
|
||||
return "#" + this._url.fragment;
|
||||
}
|
||||
|
||||
set hash(v) {
|
||||
if (v === "") {
|
||||
this._url.fragment = null;
|
||||
return;
|
||||
}
|
||||
|
||||
const input = v[0] === "#" ? v.substring(1) : v;
|
||||
this._url.fragment = "";
|
||||
usm.basicURLParse(input, { url: this._url, stateOverride: "fragment" });
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
return this.href;
|
||||
}
|
||||
};
|
||||
335
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/lib/URL.js
generated
vendored
Executable file
335
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/lib/URL.js
generated
vendored
Executable file
|
|
@ -0,0 +1,335 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
|
||||
class URL {
|
||||
constructor(url) {
|
||||
if (arguments.length < 1) {
|
||||
throw new TypeError("Failed to construct 'URL': 1 argument required, but only " + arguments.length + " present.");
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
curArg = conversions["USVString"](curArg, { context: "Failed to construct 'URL': parameter 1" });
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
if (curArg !== undefined) {
|
||||
curArg = conversions["USVString"](curArg, { context: "Failed to construct 'URL': parameter 2" });
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return iface.setup(Object.create(new.target.prototype), args);
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl].toJSON();
|
||||
}
|
||||
|
||||
get href() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["href"];
|
||||
}
|
||||
|
||||
set href(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'href' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["href"] = V;
|
||||
}
|
||||
|
||||
toString() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
return this[impl]["href"];
|
||||
}
|
||||
|
||||
get origin() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["origin"];
|
||||
}
|
||||
|
||||
get protocol() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["protocol"];
|
||||
}
|
||||
|
||||
set protocol(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'protocol' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["protocol"] = V;
|
||||
}
|
||||
|
||||
get username() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["username"];
|
||||
}
|
||||
|
||||
set username(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'username' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["username"] = V;
|
||||
}
|
||||
|
||||
get password() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["password"];
|
||||
}
|
||||
|
||||
set password(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'password' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["password"] = V;
|
||||
}
|
||||
|
||||
get host() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["host"];
|
||||
}
|
||||
|
||||
set host(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'host' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["host"] = V;
|
||||
}
|
||||
|
||||
get hostname() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["hostname"];
|
||||
}
|
||||
|
||||
set hostname(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'hostname' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["hostname"] = V;
|
||||
}
|
||||
|
||||
get port() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["port"];
|
||||
}
|
||||
|
||||
set port(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'port' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["port"] = V;
|
||||
}
|
||||
|
||||
get pathname() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["pathname"];
|
||||
}
|
||||
|
||||
set pathname(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'pathname' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["pathname"] = V;
|
||||
}
|
||||
|
||||
get search() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["search"];
|
||||
}
|
||||
|
||||
set search(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'search' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["search"] = V;
|
||||
}
|
||||
|
||||
get searchParams() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.getSameObject(this, "searchParams", () => {
|
||||
return utils.tryWrapperForImpl(this[impl]["searchParams"]);
|
||||
});
|
||||
}
|
||||
|
||||
get hash() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["hash"];
|
||||
}
|
||||
|
||||
set hash(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'hash' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["hash"] = V;
|
||||
}
|
||||
}
|
||||
Object.defineProperties(URL.prototype, {
|
||||
toJSON: { enumerable: true },
|
||||
href: { enumerable: true },
|
||||
toString: { enumerable: true },
|
||||
origin: { enumerable: true },
|
||||
protocol: { enumerable: true },
|
||||
username: { enumerable: true },
|
||||
password: { enumerable: true },
|
||||
host: { enumerable: true },
|
||||
hostname: { enumerable: true },
|
||||
port: { enumerable: true },
|
||||
pathname: { enumerable: true },
|
||||
search: { enumerable: true },
|
||||
searchParams: { enumerable: true },
|
||||
hash: { enumerable: true },
|
||||
[Symbol.toStringTag]: { value: "URL", configurable: true }
|
||||
});
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'URL'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(URL.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(URL.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: URL,
|
||||
expose: {
|
||||
Window: { URL },
|
||||
Worker: { URL }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("./URL-impl.js");
|
||||
122
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/lib/URLSearchParams-impl.js
generated
vendored
Executable file
122
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/lib/URLSearchParams-impl.js
generated
vendored
Executable file
|
|
@ -0,0 +1,122 @@
|
|||
"use strict";
|
||||
const stableSortBy = require("lodash.sortby");
|
||||
const urlencoded = require("./urlencoded");
|
||||
|
||||
exports.implementation = class URLSearchParamsImpl {
|
||||
constructor(constructorArgs, { doNotStripQMark = false }) {
|
||||
let init = constructorArgs[0];
|
||||
this._list = [];
|
||||
this._url = null;
|
||||
|
||||
if (!doNotStripQMark && typeof init === "string" && init[0] === "?") {
|
||||
init = init.slice(1);
|
||||
}
|
||||
|
||||
if (Array.isArray(init)) {
|
||||
for (const pair of init) {
|
||||
if (pair.length !== 2) {
|
||||
throw new TypeError("Failed to construct 'URLSearchParams': parameter 1 sequence's element does not " +
|
||||
"contain exactly two elements.");
|
||||
}
|
||||
this._list.push([pair[0], pair[1]]);
|
||||
}
|
||||
} else if (typeof init === "object" && Object.getPrototypeOf(init) === null) {
|
||||
for (const name of Object.keys(init)) {
|
||||
const value = init[name];
|
||||
this._list.push([name, value]);
|
||||
}
|
||||
} else {
|
||||
this._list = urlencoded.parseUrlencoded(init);
|
||||
}
|
||||
}
|
||||
|
||||
_updateSteps() {
|
||||
if (this._url !== null) {
|
||||
let query = urlencoded.serializeUrlencoded(this._list);
|
||||
if (query === "") {
|
||||
query = null;
|
||||
}
|
||||
this._url._url.query = query;
|
||||
}
|
||||
}
|
||||
|
||||
append(name, value) {
|
||||
this._list.push([name, value]);
|
||||
this._updateSteps();
|
||||
}
|
||||
|
||||
delete(name) {
|
||||
let i = 0;
|
||||
while (i < this._list.length) {
|
||||
if (this._list[i][0] === name) {
|
||||
this._list.splice(i, 1);
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
this._updateSteps();
|
||||
}
|
||||
|
||||
get(name) {
|
||||
for (const tuple of this._list) {
|
||||
if (tuple[0] === name) {
|
||||
return tuple[1];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
getAll(name) {
|
||||
const output = [];
|
||||
for (const tuple of this._list) {
|
||||
if (tuple[0] === name) {
|
||||
output.push(tuple[1]);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
has(name) {
|
||||
for (const tuple of this._list) {
|
||||
if (tuple[0] === name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
set(name, value) {
|
||||
let found = false;
|
||||
let i = 0;
|
||||
while (i < this._list.length) {
|
||||
if (this._list[i][0] === name) {
|
||||
if (found) {
|
||||
this._list.splice(i, 1);
|
||||
} else {
|
||||
found = true;
|
||||
this._list[i][1] = value;
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
this._list.push([name, value]);
|
||||
}
|
||||
this._updateSteps();
|
||||
}
|
||||
|
||||
sort() {
|
||||
this._list = stableSortBy(this._list, [0]);
|
||||
this._updateSteps();
|
||||
}
|
||||
|
||||
[Symbol.iterator]() {
|
||||
return this._list[Symbol.iterator]();
|
||||
}
|
||||
|
||||
toString() {
|
||||
return urlencoded.serializeUrlencoded(this._list);
|
||||
}
|
||||
};
|
||||
432
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/lib/URLSearchParams.js
generated
vendored
Executable file
432
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/lib/URLSearchParams.js
generated
vendored
Executable file
|
|
@ -0,0 +1,432 @@
|
|||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
|
||||
const IteratorPrototype = Object.create(utils.IteratorPrototype, {
|
||||
next: {
|
||||
value: function next() {
|
||||
const internal = this[utils.iterInternalSymbol];
|
||||
const { target, kind, index } = internal;
|
||||
const values = Array.from(target[impl]);
|
||||
const len = values.length;
|
||||
if (index >= len) {
|
||||
return { value: undefined, done: true };
|
||||
}
|
||||
|
||||
const pair = values[index];
|
||||
internal.index = index + 1;
|
||||
const [key, value] = pair.map(utils.tryWrapperForImpl);
|
||||
|
||||
let result;
|
||||
switch (kind) {
|
||||
case "key":
|
||||
result = key;
|
||||
break;
|
||||
case "value":
|
||||
result = value;
|
||||
break;
|
||||
case "key+value":
|
||||
result = [key, value];
|
||||
break;
|
||||
}
|
||||
return { value: result, done: false };
|
||||
},
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
},
|
||||
[Symbol.toStringTag]: {
|
||||
value: "URLSearchParams Iterator",
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
class URLSearchParams {
|
||||
constructor() {
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
if (curArg !== undefined) {
|
||||
if (utils.isObject(curArg)) {
|
||||
if (curArg[Symbol.iterator] !== undefined) {
|
||||
if (!utils.isObject(curArg)) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'URLSearchParams': parameter 1" + " sequence" + " is not an iterable object."
|
||||
);
|
||||
} else {
|
||||
const V = [];
|
||||
const tmp = curArg;
|
||||
for (let nextItem of tmp) {
|
||||
if (!utils.isObject(nextItem)) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'URLSearchParams': parameter 1" +
|
||||
" sequence" +
|
||||
"'s element" +
|
||||
" is not an iterable object."
|
||||
);
|
||||
} else {
|
||||
const V = [];
|
||||
const tmp = nextItem;
|
||||
for (let nextItem of tmp) {
|
||||
nextItem = conversions["USVString"](nextItem, {
|
||||
context:
|
||||
"Failed to construct 'URLSearchParams': parameter 1" + " sequence" + "'s element" + "'s element"
|
||||
});
|
||||
|
||||
V.push(nextItem);
|
||||
}
|
||||
nextItem = V;
|
||||
}
|
||||
|
||||
V.push(nextItem);
|
||||
}
|
||||
curArg = V;
|
||||
}
|
||||
} else {
|
||||
if (!utils.isObject(curArg)) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'URLSearchParams': parameter 1" + " record" + " is not an object."
|
||||
);
|
||||
} else {
|
||||
const result = Object.create(null);
|
||||
for (const key of Reflect.ownKeys(curArg)) {
|
||||
const desc = Object.getOwnPropertyDescriptor(curArg, key);
|
||||
if (desc && desc.enumerable) {
|
||||
let typedKey = key;
|
||||
let typedValue = curArg[key];
|
||||
|
||||
typedKey = conversions["USVString"](typedKey, {
|
||||
context: "Failed to construct 'URLSearchParams': parameter 1" + " record" + "'s key"
|
||||
});
|
||||
|
||||
typedValue = conversions["USVString"](typedValue, {
|
||||
context: "Failed to construct 'URLSearchParams': parameter 1" + " record" + "'s value"
|
||||
});
|
||||
|
||||
result[typedKey] = typedValue;
|
||||
}
|
||||
}
|
||||
curArg = result;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
curArg = conversions["USVString"](curArg, { context: "Failed to construct 'URLSearchParams': parameter 1" });
|
||||
}
|
||||
} else {
|
||||
curArg = "";
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return iface.setup(Object.create(new.target.prototype), args);
|
||||
}
|
||||
|
||||
append(name, value) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 2) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'append' on 'URLSearchParams': 2 arguments required, but only " +
|
||||
arguments.length +
|
||||
" present."
|
||||
);
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
curArg = conversions["USVString"](curArg, {
|
||||
context: "Failed to execute 'append' on 'URLSearchParams': parameter 1"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = conversions["USVString"](curArg, {
|
||||
context: "Failed to execute 'append' on 'URLSearchParams': parameter 2"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].append(...args);
|
||||
}
|
||||
|
||||
delete(name) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'delete' on 'URLSearchParams': 1 argument required, but only " +
|
||||
arguments.length +
|
||||
" present."
|
||||
);
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
curArg = conversions["USVString"](curArg, {
|
||||
context: "Failed to execute 'delete' on 'URLSearchParams': parameter 1"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].delete(...args);
|
||||
}
|
||||
|
||||
get(name) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'get' on 'URLSearchParams': 1 argument required, but only " + arguments.length + " present."
|
||||
);
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
curArg = conversions["USVString"](curArg, {
|
||||
context: "Failed to execute 'get' on 'URLSearchParams': parameter 1"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].get(...args);
|
||||
}
|
||||
|
||||
getAll(name) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'getAll' on 'URLSearchParams': 1 argument required, but only " +
|
||||
arguments.length +
|
||||
" present."
|
||||
);
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
curArg = conversions["USVString"](curArg, {
|
||||
context: "Failed to execute 'getAll' on 'URLSearchParams': parameter 1"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return utils.tryWrapperForImpl(this[impl].getAll(...args));
|
||||
}
|
||||
|
||||
has(name) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'has' on 'URLSearchParams': 1 argument required, but only " + arguments.length + " present."
|
||||
);
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
curArg = conversions["USVString"](curArg, {
|
||||
context: "Failed to execute 'has' on 'URLSearchParams': parameter 1"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].has(...args);
|
||||
}
|
||||
|
||||
set(name, value) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 2) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'set' on 'URLSearchParams': 2 arguments required, but only " + arguments.length + " present."
|
||||
);
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
curArg = conversions["USVString"](curArg, {
|
||||
context: "Failed to execute 'set' on 'URLSearchParams': parameter 1"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = conversions["USVString"](curArg, {
|
||||
context: "Failed to execute 'set' on 'URLSearchParams': parameter 2"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].set(...args);
|
||||
}
|
||||
|
||||
sort() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl].sort();
|
||||
}
|
||||
|
||||
toString() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl].toString();
|
||||
}
|
||||
|
||||
keys() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
return module.exports.createDefaultIterator(this, "key");
|
||||
}
|
||||
|
||||
values() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
return module.exports.createDefaultIterator(this, "value");
|
||||
}
|
||||
|
||||
entries() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
return module.exports.createDefaultIterator(this, "key+value");
|
||||
}
|
||||
|
||||
forEach(callback) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
if (arguments.length < 1) {
|
||||
throw new TypeError("Failed to execute 'forEach' on 'iterable': 1 argument required, " + "but only 0 present.");
|
||||
}
|
||||
if (typeof callback !== "function") {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'forEach' on 'iterable': The callback provided " + "as parameter 1 is not a function."
|
||||
);
|
||||
}
|
||||
const thisArg = arguments[1];
|
||||
let pairs = Array.from(this[impl]);
|
||||
let i = 0;
|
||||
while (i < pairs.length) {
|
||||
const [key, value] = pairs[i].map(utils.tryWrapperForImpl);
|
||||
callback.call(thisArg, value, key, this);
|
||||
pairs = Array.from(this[impl]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
Object.defineProperties(URLSearchParams.prototype, {
|
||||
append: { enumerable: true },
|
||||
delete: { enumerable: true },
|
||||
get: { enumerable: true },
|
||||
getAll: { enumerable: true },
|
||||
has: { enumerable: true },
|
||||
set: { enumerable: true },
|
||||
sort: { enumerable: true },
|
||||
toString: { enumerable: true },
|
||||
keys: { enumerable: true },
|
||||
values: { enumerable: true },
|
||||
entries: { enumerable: true },
|
||||
forEach: { enumerable: true },
|
||||
[Symbol.toStringTag]: { value: "URLSearchParams", configurable: true },
|
||||
[Symbol.iterator]: { value: URLSearchParams.prototype.entries, configurable: true, writable: true }
|
||||
});
|
||||
const iface = {
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'URLSearchParams'.`);
|
||||
},
|
||||
|
||||
createDefaultIterator(target, kind) {
|
||||
const iterator = Object.create(IteratorPrototype);
|
||||
Object.defineProperty(iterator, utils.iterInternalSymbol, {
|
||||
value: { target, kind, index: 0 },
|
||||
configurable: true
|
||||
});
|
||||
return iterator;
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(URLSearchParams.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(URLSearchParams.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: URLSearchParams,
|
||||
expose: {
|
||||
Window: { URLSearchParams },
|
||||
Worker: { URLSearchParams }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require("./URLSearchParams-impl.js");
|
||||
24
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/lib/infra.js
generated
vendored
Executable file
24
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/lib/infra.js
generated
vendored
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
"use strict";
|
||||
|
||||
function isASCIIDigit(c) {
|
||||
return c >= 0x30 && c <= 0x39;
|
||||
}
|
||||
|
||||
function isASCIIAlpha(c) {
|
||||
return (c >= 0x41 && c <= 0x5A) || (c >= 0x61 && c <= 0x7A);
|
||||
}
|
||||
|
||||
function isASCIIAlphanumeric(c) {
|
||||
return isASCIIAlpha(c) || isASCIIDigit(c);
|
||||
}
|
||||
|
||||
function isASCIIHex(c) {
|
||||
return isASCIIDigit(c) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isASCIIDigit,
|
||||
isASCIIAlpha,
|
||||
isASCIIAlphanumeric,
|
||||
isASCIIHex
|
||||
};
|
||||
16
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/lib/public-api.js
generated
vendored
Executable file
16
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/lib/public-api.js
generated
vendored
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
"use strict";
|
||||
|
||||
exports.URL = require("./URL").interface;
|
||||
exports.URLSearchParams = require("./URLSearchParams").interface;
|
||||
|
||||
exports.parseURL = require("./url-state-machine").parseURL;
|
||||
exports.basicURLParse = require("./url-state-machine").basicURLParse;
|
||||
exports.serializeURL = require("./url-state-machine").serializeURL;
|
||||
exports.serializeHost = require("./url-state-machine").serializeHost;
|
||||
exports.serializeInteger = require("./url-state-machine").serializeInteger;
|
||||
exports.serializeURLOrigin = require("./url-state-machine").serializeURLOrigin;
|
||||
exports.setTheUsername = require("./url-state-machine").setTheUsername;
|
||||
exports.setThePassword = require("./url-state-machine").setThePassword;
|
||||
exports.cannotHaveAUsernamePasswordPort = require("./url-state-machine").cannotHaveAUsernamePasswordPort;
|
||||
|
||||
exports.percentDecode = require("./urlencoded").percentDecode;
|
||||
1303
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/lib/url-state-machine.js
generated
vendored
Executable file
1303
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/lib/url-state-machine.js
generated
vendored
Executable file
File diff suppressed because it is too large
Load diff
138
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/lib/urlencoded.js
generated
vendored
Executable file
138
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/lib/urlencoded.js
generated
vendored
Executable file
|
|
@ -0,0 +1,138 @@
|
|||
"use strict";
|
||||
const { isASCIIHex } = require("./infra");
|
||||
|
||||
function strictlySplitByteSequence(buf, cp) {
|
||||
const list = [];
|
||||
let last = 0;
|
||||
let i = buf.indexOf(cp);
|
||||
while (i >= 0) {
|
||||
list.push(buf.slice(last, i));
|
||||
last = i + 1;
|
||||
i = buf.indexOf(cp, last);
|
||||
}
|
||||
if (last !== buf.length) {
|
||||
list.push(buf.slice(last));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
function replaceByteInByteSequence(buf, from, to) {
|
||||
let i = buf.indexOf(from);
|
||||
while (i >= 0) {
|
||||
buf[i] = to;
|
||||
i = buf.indexOf(from, i + 1);
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
function percentEncode(c) {
|
||||
let hex = c.toString(16).toUpperCase();
|
||||
if (hex.length === 1) {
|
||||
hex = "0" + hex;
|
||||
}
|
||||
|
||||
return "%" + hex;
|
||||
}
|
||||
|
||||
function percentDecode(input) {
|
||||
const output = Buffer.alloc(input.byteLength);
|
||||
let ptr = 0;
|
||||
for (let i = 0; i < input.length; ++i) {
|
||||
if (input[i] !== 37 || !isASCIIHex(input[i + 1]) || !isASCIIHex(input[i + 2])) {
|
||||
output[ptr++] = input[i];
|
||||
} else {
|
||||
output[ptr++] = parseInt(input.slice(i + 1, i + 3).toString(), 16);
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
return output.slice(0, ptr);
|
||||
}
|
||||
|
||||
function parseUrlencoded(input) {
|
||||
const sequences = strictlySplitByteSequence(input, 38);
|
||||
const output = [];
|
||||
for (const bytes of sequences) {
|
||||
if (bytes.length === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let name;
|
||||
let value;
|
||||
const indexOfEqual = bytes.indexOf(61);
|
||||
|
||||
if (indexOfEqual >= 0) {
|
||||
name = bytes.slice(0, indexOfEqual);
|
||||
value = bytes.slice(indexOfEqual + 1);
|
||||
} else {
|
||||
name = bytes;
|
||||
value = Buffer.alloc(0);
|
||||
}
|
||||
|
||||
name = replaceByteInByteSequence(Buffer.from(name), 43, 32);
|
||||
value = replaceByteInByteSequence(Buffer.from(value), 43, 32);
|
||||
|
||||
output.push([percentDecode(name).toString(), percentDecode(value).toString()]);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
function serializeUrlencodedByte(input) {
|
||||
let output = "";
|
||||
for (const byte of input) {
|
||||
if (byte === 32) {
|
||||
output += "+";
|
||||
} else if (byte === 42 ||
|
||||
byte === 45 ||
|
||||
byte === 46 ||
|
||||
(byte >= 48 && byte <= 57) ||
|
||||
(byte >= 65 && byte <= 90) ||
|
||||
byte === 95 ||
|
||||
(byte >= 97 && byte <= 122)) {
|
||||
output += String.fromCodePoint(byte);
|
||||
} else {
|
||||
output += percentEncode(byte);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
function serializeUrlencoded(tuples, encodingOverride = undefined) {
|
||||
let encoding = "utf-8";
|
||||
if (encodingOverride !== undefined) {
|
||||
encoding = encodingOverride;
|
||||
}
|
||||
|
||||
let output = "";
|
||||
for (const [i, tuple] of tuples.entries()) {
|
||||
// TODO: handle encoding override
|
||||
const name = serializeUrlencodedByte(Buffer.from(tuple[0]));
|
||||
let value = tuple[1];
|
||||
if (tuple.length > 2 && tuple[2] !== undefined) {
|
||||
if (tuple[2] === "hidden" && name === "_charset_") {
|
||||
value = encoding;
|
||||
} else if (tuple[2] === "file") {
|
||||
// value is a File object
|
||||
value = value.name;
|
||||
}
|
||||
}
|
||||
value = serializeUrlencodedByte(Buffer.from(value));
|
||||
if (i !== 0) {
|
||||
output += "&";
|
||||
}
|
||||
output += `${name}=${value}`;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
percentEncode,
|
||||
percentDecode,
|
||||
|
||||
// application/x-www-form-urlencoded string parser
|
||||
parseUrlencoded(input) {
|
||||
return parseUrlencoded(Buffer.from(input));
|
||||
},
|
||||
|
||||
// application/x-www-form-urlencoded serializer
|
||||
serializeUrlencoded
|
||||
};
|
||||
127
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/lib/utils.js
generated
vendored
Executable file
127
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/lib/utils.js
generated
vendored
Executable file
|
|
@ -0,0 +1,127 @@
|
|||
"use strict";
|
||||
|
||||
// Returns "Type(value) is Object" in ES terminology.
|
||||
function isObject(value) {
|
||||
return typeof value === "object" && value !== null || typeof value === "function";
|
||||
}
|
||||
|
||||
function hasOwn(obj, prop) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, prop);
|
||||
}
|
||||
|
||||
const getOwnPropertyDescriptors = typeof Object.getOwnPropertyDescriptors === "function" ?
|
||||
Object.getOwnPropertyDescriptors :
|
||||
// Polyfill exists until we require Node.js v8.x
|
||||
// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
|
||||
obj => {
|
||||
if (obj === undefined || obj === null) {
|
||||
throw new TypeError("Cannot convert undefined or null to object");
|
||||
}
|
||||
obj = Object(obj);
|
||||
const ownKeys = Reflect.ownKeys(obj);
|
||||
const descriptors = {};
|
||||
for (const key of ownKeys) {
|
||||
const descriptor = Reflect.getOwnPropertyDescriptor(obj, key);
|
||||
if (descriptor !== undefined) {
|
||||
Reflect.defineProperty(descriptors, key, {
|
||||
value: descriptor,
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
}
|
||||
return descriptors;
|
||||
};
|
||||
|
||||
const wrapperSymbol = Symbol("wrapper");
|
||||
const implSymbol = Symbol("impl");
|
||||
const sameObjectCaches = Symbol("SameObject caches");
|
||||
|
||||
function getSameObject(wrapper, prop, creator) {
|
||||
if (!wrapper[sameObjectCaches]) {
|
||||
wrapper[sameObjectCaches] = Object.create(null);
|
||||
}
|
||||
|
||||
if (prop in wrapper[sameObjectCaches]) {
|
||||
return wrapper[sameObjectCaches][prop];
|
||||
}
|
||||
|
||||
wrapper[sameObjectCaches][prop] = creator();
|
||||
return wrapper[sameObjectCaches][prop];
|
||||
}
|
||||
|
||||
function wrapperForImpl(impl) {
|
||||
return impl ? impl[wrapperSymbol] : null;
|
||||
}
|
||||
|
||||
function implForWrapper(wrapper) {
|
||||
return wrapper ? wrapper[implSymbol] : null;
|
||||
}
|
||||
|
||||
function tryWrapperForImpl(impl) {
|
||||
const wrapper = wrapperForImpl(impl);
|
||||
return wrapper ? wrapper : impl;
|
||||
}
|
||||
|
||||
function tryImplForWrapper(wrapper) {
|
||||
const impl = implForWrapper(wrapper);
|
||||
return impl ? impl : wrapper;
|
||||
}
|
||||
|
||||
const iterInternalSymbol = Symbol("internal");
|
||||
const IteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()));
|
||||
|
||||
function isArrayIndexPropName(P) {
|
||||
if (typeof P !== "string") {
|
||||
return false;
|
||||
}
|
||||
const i = P >>> 0;
|
||||
if (i === Math.pow(2, 32) - 1) {
|
||||
return false;
|
||||
}
|
||||
const s = `${i}`;
|
||||
if (P !== s) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
const supportsPropertyIndex = Symbol("supports property index");
|
||||
const supportedPropertyIndices = Symbol("supported property indices");
|
||||
const supportsPropertyName = Symbol("supports property name");
|
||||
const supportedPropertyNames = Symbol("supported property names");
|
||||
const indexedGet = Symbol("indexed property get");
|
||||
const indexedSetNew = Symbol("indexed property set new");
|
||||
const indexedSetExisting = Symbol("indexed property set existing");
|
||||
const namedGet = Symbol("named property get");
|
||||
const namedSetNew = Symbol("named property set new");
|
||||
const namedSetExisting = Symbol("named property set existing");
|
||||
const namedDelete = Symbol("named property delete");
|
||||
|
||||
module.exports = exports = {
|
||||
isObject,
|
||||
hasOwn,
|
||||
getOwnPropertyDescriptors,
|
||||
wrapperSymbol,
|
||||
implSymbol,
|
||||
getSameObject,
|
||||
wrapperForImpl,
|
||||
implForWrapper,
|
||||
tryWrapperForImpl,
|
||||
tryImplForWrapper,
|
||||
iterInternalSymbol,
|
||||
IteratorPrototype,
|
||||
isArrayIndexPropName,
|
||||
supportsPropertyIndex,
|
||||
supportedPropertyIndices,
|
||||
supportsPropertyName,
|
||||
supportedPropertyNames,
|
||||
indexedGet,
|
||||
indexedSetNew,
|
||||
indexedSetExisting,
|
||||
namedGet,
|
||||
namedSetNew,
|
||||
namedSetExisting,
|
||||
namedDelete
|
||||
};
|
||||
54
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/package.json
generated
vendored
Executable file
54
BACK_BACK/node_modules/data-urls/node_modules/whatwg-url/package.json
generated
vendored
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
"name": "whatwg-url",
|
||||
"version": "7.1.0",
|
||||
"description": "An implementation of the WHATWG URL Standard's URL API and parsing machinery",
|
||||
"main": "lib/public-api.js",
|
||||
"files": [
|
||||
"lib/"
|
||||
],
|
||||
"author": "Sebastian Mayr <github@smayr.name>",
|
||||
"license": "MIT",
|
||||
"repository": "jsdom/whatwg-url",
|
||||
"dependencies": {
|
||||
"lodash.sortby": "^4.7.0",
|
||||
"tr46": "^1.0.1",
|
||||
"webidl-conversions": "^4.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "^16.2.2",
|
||||
"domexception": "^1.0.1",
|
||||
"eslint": "^5.4.0",
|
||||
"got": "^9.2.2",
|
||||
"jest": "^23.5.0",
|
||||
"recast": "^0.15.3",
|
||||
"webidl2js": "^9.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node scripts/transform.js && node scripts/convert-idl.js",
|
||||
"coverage": "jest --coverage",
|
||||
"lint": "eslint .",
|
||||
"prepublish": "node scripts/transform.js && node scripts/convert-idl.js",
|
||||
"pretest": "node scripts/get-latest-platform-tests.js && node scripts/transform.js && node scripts/convert-idl.js",
|
||||
"build-live-viewer": "browserify lib/public-api.js --standalone whatwgURL > live-viewer/whatwg-url.js",
|
||||
"test": "jest"
|
||||
},
|
||||
"jest": {
|
||||
"collectCoverageFrom": [
|
||||
"lib/**/*.js",
|
||||
"!lib/utils.js"
|
||||
],
|
||||
"coverageDirectory": "coverage",
|
||||
"coverageReporters": [
|
||||
"lcov",
|
||||
"text-summary"
|
||||
],
|
||||
"testEnvironment": "node",
|
||||
"testMatch": [
|
||||
"<rootDir>/test/**/*.js"
|
||||
],
|
||||
"testPathIgnorePatterns": [
|
||||
"^<rootDir>/test/testharness.js$",
|
||||
"^<rootDir>/test/web-platform-tests/"
|
||||
]
|
||||
}
|
||||
}
|
||||
50
BACK_BACK/node_modules/data-urls/package.json
generated
vendored
Executable file
50
BACK_BACK/node_modules/data-urls/package.json
generated
vendored
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
{
|
||||
"name": "data-urls",
|
||||
"description": "Parses data: URLs",
|
||||
"keywords": [
|
||||
"data url",
|
||||
"data uri",
|
||||
"data:",
|
||||
"http",
|
||||
"fetch",
|
||||
"whatwg"
|
||||
],
|
||||
"version": "1.1.0",
|
||||
"author": "Domenic Denicola <d@domenic.me> (https://domenic.me/)",
|
||||
"license": "MIT",
|
||||
"repository": "jsdom/data-urls",
|
||||
"main": "lib/parser.js",
|
||||
"files": [
|
||||
"lib/"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "jest",
|
||||
"coverage": "jest --coverage",
|
||||
"lint": "eslint .",
|
||||
"pretest": "node scripts/get-latest-platform-tests.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^5.7.0",
|
||||
"jest": "^23.6.0",
|
||||
"request": "^2.88.0"
|
||||
},
|
||||
"jest": {
|
||||
"coverageDirectory": "coverage",
|
||||
"coverageReporters": [
|
||||
"lcov",
|
||||
"text-summary"
|
||||
],
|
||||
"testEnvironment": "node",
|
||||
"testMatch": [
|
||||
"<rootDir>/test/**/*.js"
|
||||
],
|
||||
"coveragePathIgnorePatterns": [
|
||||
"<rootDir>/node_modules/(?!(abab/lib/atob.js))"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"abab": "^2.0.0",
|
||||
"whatwg-mimetype": "^2.2.0",
|
||||
"whatwg-url": "^7.0.0"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue